-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathupdateManager.min.js
27 lines (27 loc) · 99.3 KB
/
updateManager.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
*
* @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
* Copyright (C) 2018 Arthur Malulley B. de O.
*
*
* The JavaScript code in this page is free software: you can
* redistribute it and/or modify it under the terms of the GNU
* General Public License (GNU GPL) as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version. The code is distributed WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
*
* As additional permission under GNU GPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*
*/
console.log(),console.log("###########################################"),console.log("# PSO2 Affixing Assistant's Build Manager #"),console.log("###########################################"),console.log(),console.log("Setting up the build environment...");var e=require("fs");const{exec:t}=require("child_process"),i=require("readline").createInterface({input:process.stdin,output:process.stdout});let n=null,o=null,l=require("./js/affixData"),a=require("./js/lang");const s=require("./js/affixDataParser");var r="./intermediate",d="/**\n *\n * @licstart The following is the entire license notice for the \n * JavaScript code in this page.\n *\n * Copyright (C) 2018 Arthur Malulley B. de O.\n *\n *\n * The JavaScript code in this page is free software: you can\n * redistribute it and/or modify it under the terms of the GNU\n * General Public License (GNU GPL) as published by the Free Software\n * Foundation, either version 3 of the License, or (at your option)\n * any later version. The code is distributed WITHOUT ANY WARRANTY;\n * without even the implied warranty of MERCHANTABILITY or FITNESS\n * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.\n *\n * As additional permission under GNU GPL version 3 section 7, you\n * may distribute non-source (e.g., minimized or compacted) forms of\n * that code without the copy of the GNU GPL normally required by\n * section 4, provided you include this license notice and a URL\n * through which recipients can access the Corresponding Source.\n *\n * @licend The above is the entire license notice\n * for the JavaScript code in this page.\n *\n */\n\nconst lang = Object.freeze({0});\n\nvar module = module || undefined\nif (module && module.exports) {\n module.exports.lang = lang\n}\n",c="/**\n *\n * @licstart The following is the entire license notice for the \n * JavaScript code in this page.\n *\n * Copyright (C) 2018 Arthur Malulley B. de O.\n *\n *\n * The JavaScript code in this page is free software: you can\n * redistribute it and/or modify it under the terms of the GNU\n * General Public License (GNU GPL) as published by the Free Software\n * Foundation, either version 3 of the License, or (at your option)\n * any later version. The code is distributed WITHOUT ANY WARRANTY;\n * without even the implied warranty of MERCHANTABILITY or FITNESS\n * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.\n *\n * As additional permission under GNU GPL version 3 section 7, you\n * may distribute non-source (e.g., minimized or compacted) forms of\n * that code without the copy of the GNU GPL normally required by\n * section 4, provided you include this license notice and a URL\n * through which recipients can access the Corresponding Source.\n *\n * @licend The above is the entire license notice\n * for the JavaScript code in this page.\n *\n */\n\nlet data = {0}\n\nvar module = module || undefined\nif (module && module.exports) {\n module.exports.data = data\n}\n",f=null;try{var u=e.readFileSync("config.json","utf8");if(!u||"string"!=typeof u)throw new Error("Could not read config.json file data.");if(u=u.replace(/\/\/.*/g,"").trim(),!(f=JSON.parse(u)))throw new Error("Contents of config.json could not be obtained.");if("object"!=typeof f)throw new Error("Invalid file format. Assert that config.json contains a JSON object.");if("function"==typeof f[Symbol.iterator])throw new Error("Invalid file format. Assert that config.json contains a JSON object (2*).");var p=[["itemsMissingTranslation","object"],["addItemsMissingTranslation","object"],["swikiToVisiphoneNameInconsistencies","object"],["assistantToVisiphoneNameInconsistencies","object"],["itemsWithOverridenData","object"],["itemsToKeepFromExistingVersion","array"],["potentialEnToJpTranslations","object"],["boostWeekPercentages","array"],["deadRefs","array"],["swikiToVisiDiscrepancies","object"],["visiToSimDiscrepancies","object"],["simToAstDiscrepancies","object"],["internalLangKeys","array"],["jsDependencies","string"],["cssDependencies","string"]].filter(e=>!f[e[0]]||("array"===e[1]?"object"!=typeof f[e[0]]||"function"!=typeof f[e[0]][Symbol.iterator]:typeof f[e[0]]!==e[1]));if(0!==p.length)throw new Error("config.json is missing required fields: "+JSON.stringify(p.map(e=>e[0]+" of type "+e[1])));!function(e){let n=["node-fetch","cheerio","uglify-es","uglifycss"];var o=0,l=t=>{t?++o<n.length?a(n[o],l):e(!0):e(!1)};function a(e,n){try{require.resolve(e),n(!0)}catch(o){console.log("Linking package: "+e),t("npm link "+e,(o,l,a)=>{if(o)i.question("Could not create local link to package "+e,function(e){n(!1)});else try{require.resolve(e),n(!0)}catch(o){i.question(`The Build Manager requires the NodeJS package '${e}' to operate.\nTo install it, run the following command on a NodeJS command prompt:\n npm install ${e}\nPress 'Y' to install it now on the application folder, 'G' to install it now globally, or any key to quit...`,function(i){"Y"===i||"y"===i?(console.log("Running 'npm install "+e+"'..."),t("npm install "+e,(t,i,o)=>{if(t)return console.log("NodeJS package '"+e+"' could not be installed."),console.log(t),void n(!1);console.log(i),console.log("NodeJS packed installed successfully."),n(!0)})):"G"===i||"g"===i?(console.log("Running 'npm install "+e+" -g'..."),t("npm install "+e+" -g",(t,i,o)=>{if(t)return console.log("NodeJS package '"+e+"' could not be installed."),console.log(t),void n(!1);console.log(i),console.log("NodeJS packed installed successfully."),n(!0)})):n(!1)})}})}}a(n[0],l)}(t=>{if(!t)return console.log("Some required NodeJS packages are missing, please install them and try again."),void process.exit();n=require("node-fetch"),o=require("cheerio");var s=()=>{if(console.log(),console.log("Validating files..."),P(l.data,a.lang)){console.log(),console.log("Fetching updates...");var t=(n,o,s,u,p,j,N,O)=>{var _=null;null===n?_="Could not fetch data from PSO2 Affixing Simulator.":null===o?_="Could not fetch data from PSO2 Affixing Simulator Global.":null===s?_="Could not fetch data from PSO2 Swiki Abilities.":null===u?_="Could not fetch data from PSO2 Swiki SAFs.":null===p?_="Could not fetch data from PSO2 Swiki SSAs.":null===j?_="Could not fetch data from Arks Visiphone Abilities.":null===N?_="Could not fetch data from Arks Visiphone Weapon SSAs.":null===O&&(_="Could not fetch data from Arks Visiphone Unit SSAs."),"string"!=typeof _?(e.existsSync(r)||e.mkdirSync(r),function(t,n,o,l,s,u,p,h,j){console.log(),console.log("Crunching data to update the affix database...");var N="",O=b(l);O||(N+="\nERROR Could not crunch PSO2 Swiki normal abilities.");var _=v(s);_||(N+="\nERROR Could not crunch PSO2 Swiki normal ability SAFs.");let B=S(u,!0);B||(N+="\nERROR Could not crunch PSO2 Swiki SSAs.");var w=b(l,!0);w||(N+="\nERROR Could not crunch PSO2 Swiki normal Add Ability Items.");var C=A(p);C||(N+="\nERROR Could not crunch ARKs Visiphone normal abilities.");var k=[...x(h),...x(j)];k||(N+="\nERROR Could not crunch ARKs Visiphone SSAs.");if(N&&N.length>0)return void i.question(N+" Press any key to quit...",function(e){process.exit()});var R=Math.max(...t.abilityList.map(e=>e.ref));console.log("Crunching normal abilities...");for(var M=0,F=[],G=0;G<O.length;G++){var V={name:"TO BE DETERMINED",jpName:O[G].name,effect:"TO BE DETERMINED",jpEffect:O[G].effect,hasSAF:!1,hasAddItem:!1,isSSA:!1},U=C.filter(e=>e.jpName==O[G].name)[0];U||(U=C.filter(e=>I(e.jpName.replace("・",""))==I(O[G].name.replace("・","")))[0]),f.swikiToVisiDiscrepancies[O[G].name]&&(U=f.swikiToVisiDiscrepancies[O[G].name]);var J=null,W=!0;U&&U.enName?V.name=U.enName:W=!1,U&&U.effect?V.effect=U.effect:W=!1,W||(J="Could not find ability in Arks Visiphone");var q=n.abilityList.filter(e=>e&&e.name&&(e.name.replace(/\/|-|\s/g,"").toUpperCase()==V.name.replace(/\/|-|\s/g,"").toUpperCase()||f.visiToSimDiscrepancies[V.name]&&e.name.replace(/\/|-|\s/g,"").toUpperCase()==f.visiToSimDiscrepancies[V.name].replace(/\/|-|\s/g,"").toUpperCase()))[0];if(q&&q.code){V.simCode=q.code,q.name&&(V.name=q.name),q.effect&&(V.effect=q.effect);for(var z=Object.keys(q),Y=0;Y<z.length;Y++)q[z[Y]]&&!V[z[Y]]&&(V[z[Y]]=q[z[Y]])}else{var q=n.optionList.additional.filter(e=>e&&e.name&&(e.name.replace(/\/|-|\s/g,"").toUpperCase()==V.name.replace(/\/|-|\s/g,"").toUpperCase()||f.visiToSimDiscrepancies[V.name]&&e.name.replace(/\/|-|\s/g,"").toUpperCase()==f.visiToSimDiscrepancies[V.name].replace(/\/|-|\s/g,"").toUpperCase()))[0];q&&q.name&&(V.name=q.name),q&&q.effect?V.effect=q.effect:J=(J?J+"\n":"")+"Could not find ability in Simulator"}f.simToAstDiscrepancies[V.name]&&(V.name=f.simToAstDiscrepancies[V.name]);var $=t.abilityList.filter(e=>e&&e.name&&e.name==V.name)[0];$||($=t.abilityList.filter(e=>e&&e.simCode&&e.simCode==V.simCode)[0]),$&&$.code?(V.ref=$.ref,V.code=$.code):t.abilityList.filter(e=>e.code==V.simCode).length>0&&(V.code=L(V.simCode,t.abilityList,F),(!V.code||V.code.length<4)&&(V.code=null,console.log("ERROR Following ability did not receive a 'code' property:"),console.log(V))),"TO BE DETERMINED"!=V.name&&"TO BE DETERMINED"!=V.effect||(J=(J?J+"\n":"")+"Following ability has missing information"),J?(console.log("WARNING\n"+J+":"),console.log(V)):F.filter(e=>e.jpName==V.jpName).length>0||((void 0===V.ref||V.ref<0)&&(R++,V.ref=R),F.push(V))}console.log(F.length-M+" abilities added"),M=F.length,console.log("Crunching abilities internal to the assistant...");for(var K=t.abilityList.filter(e=>e.internalUse||/^(Junk)|(S[1-8]:Junk)/.test(e.name)),H={},G=0;G<K.length;G++){var X=K[G].simCode,q=n.abilityList.filter(e=>e.code==X)[0];if(q||(q=n.abilityList.filter(e=>e.name.replace(" ","")==K[G].name.replace(" ","")||e.name.replace(" ","")==K[G].name.replace("Junk","Placeholder").replace(" ",""))[0]),q){K[G].simCode=q.code;for(var z=Object.keys(q),Q=["code","ref"],Y=0;Y<z.length;Y++)q[z[Y]]&&!Q.includes(z[Y])&&(K[G][z[Y]]=q[z[Y]])}/^(Junk)|(S[1-8]:Junk)/.test(K[G].name)&&K[G].code.length>1&&(H[K[G].name.substr(1,1)]=K[G].code.substr(0,2)),K[G].internalUse=!0;var Z=a.lang[K[G].code];K[G].jpName=Z&&Z.name_jp?Z.name_jp:K[G].jpName,K[G].jpEffect=E(Z&&Z.effect_jp?Z.effect_jp:K[G].jpEffect),F.push(K[G])}console.log(F.length-M+" abilities added"),M=F.length,console.log("Crunching normal ability SAFs...");for(var ee=0,te=[],G=0;G<_.length;G++){var ie=F.filter(e=>e.jpName==_[G].name)[0];if(ie&&ie.name&&_[G].name)te.filter(e=>e.jpName==_[G].name).length>0||(F[F.indexOf(ie)].hasSAF=!0,te.push({name:ie.name,jpName:_[G].name}));else{if(te.filter(e=>_[G]&&e.jpName==_[G].name).length>0)continue;console.log("WARNING Found SAF whose ability was not added: "+_[G].name)}}console.log(te.length+" SAFs added"),ee=te.length,console.log("Crunching normal Add Ability Items...");for(var ne=0,oe=[{id:"Nothing",jpId:"無し",value:"B01"}],G=0;G<w.length;G++){var ie=F.filter(e=>e.jpName==w[G].name)[0];if(ie&&ie.name&&w[G].name){if(!(oe.filter(e=>w[G]&&e.jpName==w[G].name).length>0)){F[F.indexOf(ie)].hasAddItem=!0;var le={ref:ie.ref,id:"Add Ability (TO BE DETERMINED)",name:ie.name,jpId:w[G].addItemName,jpName:w[G].name,value:"TO BE DETERMINED",extend:100,effect:ie.effect};oe.push(le)}}else{if(oe.filter(e=>w[G]&&e.jpName==w[G].name).length>0)continue;console.log("WARNING Found Add Ability Item whose ability was not added: "+w[G].name)}}for(var G=0;G<oe.length;G++){f.addItemsMissingTranslation&&f.addItemsMissingTranslation[oe[G].jpName]&&(oe[G].id=f.addItemsMissingTranslation[oe[G].jpName].id||oe[G].id);var $=t.optionList.additional.filter(e=>e.ref&&e.ref==oe[G].ref)[0];$&&(oe[G].id=$.id||oe[G].id,oe[G].value=$.value||oe[G].value);var q=n.optionList.additional.filter(e=>e.id&&e.id.toUpperCase().trim()==oe[G].id.toUpperCase().trim())[0];q&&(oe[G].simId=q.id.trim(),"Add Ability (TO BE DETERMINED)"==oe[G].id&&(oe[G].id=q.value.trim()),oe[G].simValue=q.value.trim(),"TO BE DETERMINED"==oe[G].value&&(oe[G].value=q.value.trim())),"TO BE DETERMINED"==oe[G].value&&(oe[G].value=T("B",t.optionList.additional,F))}console.log(oe.length+" Add Items added"),ne=oe.length,console.log("Crunching SSAs...");for(var G=0;G<B.abilities.length;G++){var ae={ref:-1,code:"TO BE DETERMINED",gid:"TO BE DETERMINED",name:"TO BE DETERMINED",jpName:B.abilities[G].name,extend:[100],effect:"TO BE DETERMINED",jpEffect:B.abilities[G].effect,noEx:!0,hasSAF:B.safs.filter(e=>e.name==B.abilities[G].name).length>0,hasAddItem:B.addItems.filter(e=>e.name==B.abilities[G].name).length>0,isSSA:!0};f.itemsMissingTranslation&&f.itemsMissingTranslation[ae.jpName]&&(ae.name=f.itemsMissingTranslation[ae.jpName].name||ae.name,ae.effect=f.itemsMissingTranslation[ae.jpName].effect||ae.effect);var se=k.filter(e=>e.jpName==B.abilities[G].name)[0];!se&&f.swikiToVisiphoneNameInconsistencies&&f.swikiToVisiphoneNameInconsistencies[B.abilities[G].name]&&(se=k.filter(e=>e.jpName==f.swikiToVisiphoneNameInconsistencies[B.abilities[G].name])[0]),se&&(ae.name=se.enName||ae.name,ae.name=ae.name.trim(),ae.effect=se.enEffect||ae.effect,ae.effect=ae.effect.trim());var q=n.abilityList.filter(e=>e.name==ae.name)[0];if(/^S[0-9]/.test(ae.jpName)){var re=ae.jpName.substr(1,1),de=RegExp("^S"+re+":\\s*((Junk)|(Placeholder))"),ce=F.filter(e=>de.test(e.name))[0];ce&&(ae.gid=ce.gid||ae.gid,ae.simCode=ce.simCode||ae.simCode,ae.code=L(ce.code,t.abilityList,F))}q&&(ae.simCode=q.code||ae.simCode,ae.gid=q.gid||ae.gid,ae.effect=q.effect||ae.effect,ae.effect=ae.effect.trim());var $=t.abilityList.filter(e=>e.name&&e.name.toUpperCase()==ae.name.toUpperCase())[0];!$&&f.assistantToVisiphoneNameInconsistencies&&($=t.abilityList.filter(e=>f.assistantToVisiphoneNameInconsistencies[e.name]==ae.name)[0]),$&&(ae.ref=void 0!==$.ref&&null!==$.ref?$.ref:ae.ref,ae.code=$.code||ae.code),ae.ref<0&&(R++,ae.ref=R),ae.hasSAF&&0==te.filter(e=>e.jpName==ae.jpName).length&&te.push({name:ae.name,jpName:ae.jpName});var fe=ae.name.replace(":"," Add: ");if(ae.hasAddItem&&0==oe.filter(e=>e.name==fe).length){var le={ref:ae.ref,id:fe,name:ae.name,jpId:ae.jpName.replace(":","追加:"),jpName:ae.jpName,value:"",extend:100,effect:""};oe.push(le)}Object.values(ae).includes("TO BE DETERMINED")?(console.log("WARNING Could not find some information for the following SSA:"),console.log(ae)):F.filter(e=>e.jpName==ae.jpName).length>0||F.push(ae)}console.log(F.length-M+" abilities added"),M=F.length,console.log(te.length-ee+" SAFs added"),ee=te.length,console.log(oe.length-ne+" Add Items added"),ne=oe.length,console.log("Crunching existing Add Ability Items that weren't detected...");for(var G=0;G<t.optionList.additional.length;G++)if(0==oe.filter(e=>e.id&&e.id==t.optionList.additional[G].id).length){var ue=t.optionList.additional[G].id,pe=t.optionList.additional[G].name,ie=F.filter(e=>e.name==pe)[0],ge=oe.filter(e=>e.name==pe)[0];if(ie&&(F[F.indexOf(ie)].hasAddItem=!0),ie&&!ge&&0==oe.filter(e=>e.jpName==ie.jpName).length){var me=Object.values(a.lang.additional).filter(e=>e.en==ue)[0];me=me?me.jp:me;var he={ref:ie.ref,id:ue,simId:ue,name:pe,jpId:me||"TO BE DETERMINED",jpName:ie.jpName,value:t.optionList.additional[G].value,simValue:t.optionList.additional[G].value,extend:100,effect:ie.effect};if(Object.values(he).includes("TO BE DETERMINED")){console.log("WARNING Could not find some information for the following Add Ability Item:"),console.log(he);continue}console.log("WARNING Detected: "+he.id+" / "+he.jpId),oe.push(he)}}console.log(oe.length-ne+" Add Items added"),ne=oe.length,console.log("Crunching support items...");for(var ye=[],be=Math.max(...t.optionList.support.map(e=>e.ref)),G=0;G<n.optionList.support.length;G++){var ve=n.optionList.support[G];ve.simValue=ve.value;var Ae=t.optionList.support.filter(e=>e.id==ve.id)[0];ve.ref=-1,Ae&&(ve.value=Ae.value||ve.value,ve.ref=void 0!==Ae.ref&&null!==Ae.ref?Ae.ref:ve.ref),ve.ref<0&&(be++,ve.ref=be),ve.jpId="TO BE DETERMINED",/Ability Success Rate \+[0-9]+%/.test(ve.id)?ve.jpId="能力追加成功率+"+ve.id.split("+")[1]:"Nothing"==ve.id&&(ve.jpId="無し"),ye.push(ve)}console.log(ye.length+" Support Items added"),console.log("Crunching potentials...");for(var xe=[],Se=Math.max(...t.optionList.potential.map(e=>e.ref)),G=0;G<n.optionList.potential.length;G++){var Ie=n.optionList.potential[G];Ie.simValue=Ie.value;var je=t.optionList.potential.filter(e=>e.id==Ie.id)[0];Ie.ref=-1,je&&(Ie.value=je.value||Ie.value,Ie.ref=void 0!==je.ref&&null!==je.ref?je.ref:Ie.ref),je.ref<0&&(Se++,je.ref=Se),Ie.jpId="TO BE DETERMINED",f.potentialEnToJpTranslations&&f.potentialEnToJpTranslations[Ie.id]?Ie.jpId=f.potentialEnToJpTranslations[Ie.id]:"Nothing"==Ie.id&&(Ie.jpId="無し"),xe.push(Ie)}if(console.log(xe.length+" Potentials added"),f.itemsToKeepFromExistingVersion&&Object.keys(f.itemsToKeepFromExistingVersion).length>0){console.log("Crunching extra abilities to keep from existing version...");for(var Ee=t.abilityList.filter(e=>e.code&&f.itemsToKeepFromExistingVersion.includes(e.name)&&0==F.filter(t=>t.ref==e.ref).length),G=0;G<Ee.length;G++)"number"!=typeof Ee[G].ref||F.filter(e=>e.ref==Ee[G].ref).length>0||(Ee[G].jpName=a.lang[Ee[G].code].name_jp,Ee[G].jpEffect=a.lang[Ee[G].code].effect_jp,F.push(Ee[G]));console.log(F.length-M+" abilities added"),M=F.length}if(f.itemsWithOverridenData&&Object.keys(f.itemsWithOverridenData).length>0){console.log("Crunching abilities with overriden information...");for(var G=0;G<F.length;G++)if(f.itemsWithOverridenData[F[G].jpName]){for(var z=Object.keys(f.itemsWithOverridenData[F[G].jpName]),Y=0;Y<z.length;Y++)["name","effect"].includes(z[Y])&&(F[G][z[Y]]=f.itemsWithOverridenData[F[G].jpName][z[Y]]);var Ne=te.filter(e=>e.jpName==F[G].jpName)[0];Ne&&f.itemsWithOverridenData[F[G].jpName].name&&(Ne.name=f.itemsWithOverridenData[F[G].jpName].name)}}console.log("Sorting abilities by name..."),F.sort((e,t)=>e.name.toUpperCase()>t.name.toUpperCase()?1:-1),console.log("Double checking identifiers...");var Le=F.map(e=>e.ref).filter(e=>"number"==typeof e).sort((e,t)=>e-t);if(Le.length>0){0!=Le[0]&&(console.log("ERROR initial REF expected 0, but found: "+Le[0]),console.log(F.filter(e=>e.ref==Le[0])));let e="";for(var G=Le[0];G<Le[Le.length-1];G++)Le.includes(G)||f.deadRefs.includes(G)||(e+=G+", ");e.length>0&&console.log("ERROR Update has been compromised! Gap detected in ability identifiers caused by the following missing refs: "+e)}console.log("Double checking duplicates...");var Te=F.filter(e=>F.filter(t=>t.ref==e.ref).length>1);Te.length>0&&(console.log("WARNING Found the following abilities with duplicate refs in the list:"),console.log(Te));console.log("Crunching exclude patterns...");let Pe=function(t,i,n){if(!(t&&i&&t.abilityList&&i.abilityList&&t.abilityList.length&&i.abilityList.length))return console.warn("WARN Illegal Argument passed to checkUpdates"),console.warn(" - Usage: checkUpdates(ast, sim, $swiki)"),console.warn(" - ast: The affix assistant database"),console.warn(" - sim: The affix simulator database to compare to"),console.warn(" - $swiki: The jQuery object representing the PSO2 Swiki website"),null;let o={support:{outdatedInSim:[],outdatedInAst:[],inconclusiveInAst:[],inconclusiveInSim:[],codeChanges:[]},additional:{outdatedInSim:[],outdatedInAst:[],inconclusiveInAst:[],inconclusiveInSim:[],codeChanges:[]},potential:{outdatedInSim:[],outdatedInAst:[],inconclusiveInAst:[],inconclusiveInSim:[],codeChanges:[]},extendAbility:{outdatedInSim:[],outdatedInAst:[],inconclusiveInAst:[],inconclusiveInSim:[]},excludePattern:{addition:{outdatedInSim:[],outdatedInAst:[],inconclusiveInAst:[],inconclusiveInSim:[]},select:{outdatedInSim:[],outdatedInAst:[],inconclusiveInAst:[],inconclusiveInSim:[]}},extraSlot:{outdatedInSim:[],outdatedInAst:[],inconclusiveInAst:[],inconclusiveInSim:[]},sameBonusBoost:{outdatedInSim:[],outdatedInAst:[],inconclusiveInAst:[],inconclusiveInSim:[]},boostPoint:{},ability:{outdatedInSim:[],outdatedInAst:[],inconclusiveInAst:[],inconclusiveInSim:[],codeChanges:[]},abilityFactorsMissingInAst:[],addAbilitiesMissingInAst:[]};for(var l=0;l<i.abilityList.length;l++){let e=i.abilityList[l];if(m.filter(t=>t.simName==e.name).length>0)continue;if(!e||!e.name){o.ability.inconclusiveInSim.push(e);continue}let n=!1;for(var s=0;s<t.abilityList.length;s++){let i=t.abilityList[s];i&&i.name?e.name==i.name&&(n=!0):o.ability.inconclusiveInAst.push(i)}n||o.ability.outdatedInAst.push(e)}for(var l=0;l<t.abilityList.length;l++){let e=t.abilityList[l];if(!e||!e.name)continue;let n=m.filter(t=>t.astName==e.name);if(n.length>0&&(n[0].ignoreType!==g.pendingInSim||!i.abilityList.map(e=>e.name).includes(e.name)))continue;let a=!1,r=null;for(var s=0;s<i.abilityList.length;s++){let t=i.abilityList[s];t&&t.name&&(t.name==e.name&&(a=!0),t.name==e.name&&t.code!=e.code&&t.code!=e.simCode&&0==m.filter(i=>i.ignoreType===g.dupCodeInSim&&i.simCode==t.code&&i.astCode==(e.simCode?e.simCode:e.code)).length&&(r=e.name+":"+(e.simCode?e.simCode:e.code)+" -> "+t.name+":"+t.code))}a?r&&o.ability.codeChanges.push(r):o.ability.outdatedInSim.push(e)}for(var l=0;i.optionList&&i.optionList.support&&l<i.optionList.support.length;l++){let e=i.optionList.support[l];if(!e||!e.id||!e.value){o.support.inconclusiveInSim.push(e);continue}let n=m.filter(t=>t.simSupId==e.id);if(n.length>0&&(void 0===n[0].astSupId||t.optionList.support.map(e=>e.id).includes(n[0].astSupId)))continue;let a=!1;for(var s=0;t.optionList&&t.optionList.support&&s<t.optionList.support.length;s++){let i=t.optionList.support[s];i&&i.id?(e.id==i.id||e.id.includes(i.id)||i.id.includes(e.id))&&(a=!0):o.support.inconclusiveInAst.push(i)}a||o.support.outdatedInAst.push(e)}for(var l=0;t.optionList&&t.optionList.support&&l<t.optionList.support.length;l++){let e=t.optionList.support[l];if(!e||!e.id)continue;let n=m.filter(t=>t.astSupId==e.id);if(n.length>0&&(void 0===n[0].simSupId||i.optionList.support.map(e=>e.id).includes(n[0].simSupId)))continue;let a=!1,r=null;for(var s=0;i.optionList&&i.optionList.support&&s<i.optionList.support.length;s++){let t=i.optionList.support[s];t&&t.id&&t.value&&((t.id==e.id||t.id.includes(e.id)||e.id.includes(t.id))&&(a=!0),t.id==e.id&&t.value!=e.value&&t.value!=e.simValue&&(r=e.id+":"+e.value+" -> "+t.id+":"+t.value))}a?r&&o.support.codeChanges.push(r):o.support.outdatedInSim.push(e)}for(var l=0;i.optionList&&i.optionList.additional&&l<i.optionList.additional.length;l++){let e=i.optionList.additional[l];if(!e||!e.id||!e.value){o.additional.inconclusiveInSim.push(e);continue}let n=m.filter(t=>t.simAddId instanceof RegExp?t.simAddId.test(e.id):t.simAddId==e.id);if(n.length>0&&(void 0===n[0].astAddId||t.optionList.additional.map(e=>e.id).filter(e=>n[0].astAddId instanceof RegExp?n[0].astAddId.test(e):e===n[0].astAddId).length>0))continue;let a=!1;for(var s=0;t.optionList&&t.optionList.additional&&s<t.optionList.additional.length;s++){let i=t.optionList.additional[s];i&&i.id?(e.id==i.id||e.id.includes(i.id)||i.id.includes(e.id))&&(a=!0):o.additional.inconclusiveInAst.push(i)}a||o.additional.outdatedInAst.push(e)}for(var l=0;t.optionList&&t.optionList.additional&&l<t.optionList.additional.length;l++){let e=t.optionList.additional[l];if(!e||!e.id)continue;let n=m.filter(t=>t.astAddId instanceof RegExp?t.astAddId.test(e.id):t.astAddId==e.id);if(n.length>0&&(void 0===n[0].simAddId||i.optionList.additional.map(e=>e.id).filter(e=>n[0].simAddId instanceof RegExp?n[0].simAddId.test(e):e===n[0].simAddId).length>0))continue;let a=!1,r=null;for(var s=0;i.optionList&&i.optionList.additional&&s<i.optionList.additional.length;s++){let t=i.optionList.additional[s];t&&t.id&&t.value&&((t.id==e.id||t.id.includes(e.id)||e.id.includes(t.id))&&(a=!0),t.id==e.id&&t.value!=e.value&&t.value!=e.simValue&&(r=e.id+":"+e.value+" -> "+t.id+":"+t.value))}a?r&&o.additional.codeChanges.push(r):o.additional.outdatedInSim.push(e)}for(var l=0;i.optionList&&i.optionList.potential&&l<i.optionList.potential.length;l++){let e=i.optionList.potential[l];if(!e||!e.id||!e.value){o.potential.inconclusiveInSim.push(e);continue}let n=m.filter(t=>t.simPotId==e.id);if(n.length>0&&(void 0===n[0].astPotId||t.optionList.potential.map(e=>e.id).includes(n[0].astPotId)))continue;let a=!1;for(var s=0;t.optionList&&t.optionList.potential&&s<t.optionList.potential.length;s++){let i=t.optionList.potential[s];i&&i.id?(e.id==i.id||e.id.includes(i.id)||i.id.includes(e.id))&&(a=!0):o.potential.inconclusiveInAst.push(i)}a||o.potential.outdatedInAst.push(e)}for(var l=0;t.optionList&&t.optionList.potential&&l<t.optionList.potential.length;l++){let e=t.optionList.potential[l];if(!e||!e.id)continue;let n=m.filter(t=>t.astPotId==e.id);if(n.length>0&&(void 0===n[0].simPotId||i.optionList.potential.map(e=>e.id).includes(n[0].simPotId)))continue;let a=!1,r=null;for(var s=0;i.optionList&&i.optionList.potential&&s<i.optionList.potential.length;s++){let t=i.optionList.potential[s];t&&t.id&&t.value&&((t.id==e.id||t.id.includes(e.id)||e.id.includes(t.id))&&(a=!0),t.id==e.id&&t.value!=e.value&&t.value!=e.simValue&&(r=e.id+":"+e.value+" -> "+t.id+":"+t.value))}a?r&&o.potential.codeChanges.push(r):o.potential.outdatedInSim.push(e)}for(var l=0;i.extendAbility&&l<i.extendAbility.length;l++){let e=i.extendAbility[l];if(!(e&&e.base&&e.ref&&e.success)){o.extendAbility.inconclusiveInSim.push(e);continue}let n=m.filter(t=>void 0!==t.simExtBase&&t.simExtBase.filter(t=>e.base.includes(t)).length===e.base.length);if(n.length>0&&(void 0===n[0].astExtBase||t.extendAbility.map(e=>e.base).filter(e=>void 0!==n[0].astExtBase&&n[0].astExtBase.includes(e)).length===n[0].astExtBase.length))continue;let a=t.extendAbility.filter(t=>t.success===e.success).filter(t=>"object"==typeof e.ref?0===e.ref.filter(i=>e.ref.filter(e=>e===i).length!==("object"==typeof t.ref?t.ref.filter(e=>e===i).length:t.ref===i?1:0)).length:"object"==typeof t.ref?1==t.ref.length&&t.ref[0]===e.ref:t.ref===e.ref).filter(t=>"object"==typeof e.base?0===e.base.filter(i=>e.base.filter(e=>e===i).length!==("object"==typeof t.base?t.base.filter(e=>e===i).length:t.base===i?1:0)).length:"object"==typeof t.base?1===t.base.filter(t=>t===e.base).length:t.base===e.base);1!==a.length&&o.extendAbility.outdatedInAst.push(e)}for(var l=0;t.extendAbility&&l<t.extendAbility.length;l++){let e=t.extendAbility[l];if(!(e&&e.base&&e.ref&&e.success))continue;let n=m.filter(t=>void 0!==t.astExtBase&&t.astExtBase.filter(t=>e.base.includes(t)).length===e.base.length);if(n.length>0&&(void 0===n[0].simExtBase||i.extendAbility.map(e=>e.base).filter(e=>void 0!==n[0].simExtBase&&n[0].simExtBase.includes(e)).length===n[0].simExtBase.length))continue;let a=i.extendAbility.filter(t=>t.success===e.success).filter(t=>"object"==typeof e.ref?0===e.ref.filter(i=>e.ref.filter(e=>e===i).length!==("object"==typeof t.ref?t.ref.filter(e=>e===i).length:t.ref===i?1:0)).length:"object"==typeof t.ref?1===t.ref.filter(t=>t===e.ref).length:t.ref===e.ref).filter(t=>"object"==typeof e.base?0===e.base.filter(i=>e.base.filter(e=>e===i).length!==("object"==typeof t.base?t.base.filter(e=>e===i).length:t.base===i?1:0)).length:"object"==typeof t.base?1===t.base.filter(t=>t===e.base).length:t.base===e.base);1!==a.length&&o.extendAbility.outdatedInSim.push(e)}for(var l=0;i.excludePattern.addition&&l<i.excludePattern.addition.length;l++){let e=i.excludePattern.addition[l];if(!e){o.excludePattern.addition.inconclusiveInSim.push(e);continue}let n=t.excludePattern.addition.filter(t=>typeof t==typeof e&&("object"==typeof e?0===e.filter(i=>e.filter(e=>e===i).length!==("object"==typeof t?t.filter(e=>e===i).length:t===i?1:0)).length:"object"==typeof t?1===t.filter(t=>t===e).length:t===e));1!==n.length&&0===m.filter(t=>typeof t==typeof e&&t.simExcludePatternAdd&&("object"==typeof e?0===e.filter(i=>e.filter(e=>e===i).length!==("object"==typeof t.simExcludePatternAdd?t.simExcludePatternAdd.filter(e=>e===i).length:t.simExcludePatternAdd===i?1:0)).length:"object"==typeof t.simExcludePatternAdd?1===t.simExcludePatternAdd.filter(t=>t===e).length:t.simExcludePatternAdd===e)).length&&o.excludePattern.addition.outdatedInAst.push(e)}for(var l=0;t.excludePattern.addition&&l<t.excludePattern.addition.length;l++){let e=t.excludePattern.addition[l];if(!e){o.excludePattern.addition.inconclusiveInAst.push(e);continue}let n=i.excludePattern.addition.filter(t=>typeof t==typeof e&&("object"==typeof e?0===e.filter(i=>e.filter(e=>e===i).length!==("object"==typeof t?t.filter(e=>e===i).length:t===i?1:0)).length:"object"==typeof t?1===t.filter(t=>t===e).length:t===e));1!==n.length&&0===m.filter(t=>typeof t==typeof e&&t.astExcludePatternAdd&&("object"==typeof e?0===e.filter(i=>e.filter(e=>e===i).length!==("object"==typeof t.astExcludePatternAdd?t.astExcludePatternAdd.filter(e=>e===i).length:t.astExcludePatternAdd===i?1:0)).length:"object"==typeof t.astExcludePatternAdd?1===t.astExcludePatternAdd.filter(t=>t===e).length:t.astExcludePatternAdd===e)).length&&o.excludePattern.addition.outdatedInSim.push(e)}for(var l=0;i.excludePattern.select&&l<i.excludePattern.select.length;l++){let e=i.excludePattern.select[l];if(!e){o.excludePattern.select.inconclusiveInSim.push(e);continue}let n=t.excludePattern.select.filter(t=>typeof t==typeof e&&("object"==typeof e?0===e.filter(i=>e.filter(e=>e===i).length!==("object"==typeof t?t.filter(e=>e===i).length:t===i?1:0)).length:"object"==typeof t?1===t.filter(t=>t===e).length:t===e));1!==n.length&&0===m.filter(t=>typeof t==typeof e&&t.simExcludePatternSel&&("object"==typeof e?0===e.filter(i=>e.filter(e=>e===i).length!==("object"==typeof t.simExcludePatternSel?t.simExcludePatternSel.filter(e=>e===i).length:t.simExcludePatternSel===i?1:0)).length:"object"==typeof t.simExcludePatternSel?1===t.simExcludePatternSel.filter(t=>t===e).length:t.simExcludePatternSel===e)).length&&o.excludePattern.select.outdatedInAst.push(e)}for(var l=0;t.excludePattern.select&&l<t.excludePattern.select.length;l++){let e=t.excludePattern.select[l];if(!e){o.excludePattern.select.inconclusiveInAst.push(e);continue}let n=i.excludePattern.select.filter(t=>typeof t==typeof e&&("object"==typeof e?0===e.filter(i=>e.filter(e=>e===i).length!==("object"==typeof t?t.filter(e=>e===i).length:t===i?1:0)).length:"object"==typeof t?1===t.filter(t=>t===e).length:t===e));1!==n.length&&0===m.filter(t=>typeof t==typeof e&&t.astExcludePatternSel&&("object"==typeof e?0===e.filter(i=>e.filter(e=>e===i).length!==("object"==typeof t.astExcludePatternSel?t.astExcludePatternSel.filter(e=>e===i).length:t.astExcludePatternSel===i?1:0)).length:"object"==typeof t.astExcludePatternSel?1===t.astExcludePatternSel.filter(t=>t===e).length:t.astExcludePatternSel===e)).length&&o.excludePattern.select.outdatedInSim.push(e)}let d=e=>void 0!==e&&null!==e&&"object"==typeof e&&void 0!==e.true&&null!==e.true&&"number"==typeof e.true&&void 0!==e.false&&null!==e.false&&"number"==typeof e.false,c=i.extraSlot.filter(e=>d(e));c.length!==i.extraSlot.length&&(o.extraSlot.inconclusiveInSim=i.extraSlot.filter(e=>!d(e)));let f=t.extraSlot.filter(e=>d(e));f.length!==t.extraSlot.length&&(o.extraSlot.inconclusiveInAst=t.extraSlot.filter(e=>!d(e)));o.extraSlot.outdatedInAst=c.filter(e=>0===f.filter(t=>e.true===t.true&&e.false===t.false).length),o.extraSlot.outdatedInSim=f.filter(e=>0===c.filter(t=>e.true===t.true&&e.false===t.false).length);let u=e=>void 0!==e&&null!==e&&"number"==typeof e,p=i.sameBonusBoost.filter(e=>u(e));p.length!==i.sameBonusBoost.length&&(o.sameBonusBoost.inconclusiveInSim=i.sameBonusBoost.filter(e=>!u(e)));let h=t.sameBonusBoost.filter(e=>u(e));h.length!==t.sameBonusBoost.length&&(o.sameBonusBoost.inconclusiveInAst=t.sameBonusBoost.filter(e=>!u(e)));o.sameBonusBoost.outdatedInAst=p.filter(e=>0===h.filter(t=>e===t).length),o.sameBonusBoost.outdatedInSim=h.filter(e=>0===p.filter(t=>e===t).length);let y=function(e,t){var i,n;return i=[],n=[],function e(t,o,l){var a;if(isNaN(t)&&isNaN(o)&&"number"==typeof t&&"number"==typeof o)return{valueInSim:t,valueInAst:o};if(t===o)return{valueInSim:t,valueInAst:o};if("function"==typeof t&&"function"==typeof o||t instanceof Date&&o instanceof Date||t instanceof RegExp&&o instanceof RegExp||t instanceof String&&o instanceof String||t instanceof Number&&o instanceof Number)return t.toString(),o.toString(),{valueInSim:t,valueInAst:o};if(!(t instanceof Object&&o instanceof Object))return{valueInSim:t,valueInAst:o};if(t.isPrototypeOf(o)||o.isPrototypeOf(t))return{valueInSim:t,valueInAst:o};if(t.constructor!==o.constructor)return{valueInSim:t,valueInAst:o};if(t.prototype!==o.prototype)return{valueInSim:t,valueInAst:o};if(i.indexOf(t)>-1||n.indexOf(o)>-1)return{valueInSim:t,valueInAst:o};let s={};for(a in o)o.hasOwnProperty(a)!==t.hasOwnProperty(a)?s[a]={valueInSim:t[a],valueInAst:o[a]}:typeof o[a]!=typeof t[a]&&(s[a]={valueInSim:t[a],valueInAst:o[a]});for(a in t)switch(o.hasOwnProperty(a)!==t.hasOwnProperty(a)?s[a]={valueInSim:t[a],valueInAst:o[a]}:typeof o[a]!=typeof t[a]&&(s[a]={valueInSim:t[a],valueInAst:o[a]}),typeof t[a]){case"object":case"function":i.push(t),n.push(o);let l=e(t[a],o[a]);0!=Object.keys(l).length&&(s[a]=l),i.pop(),n.pop();break;default:t[a]!==o[a]&&(s[a]={valueInSim:t[a],valueInAst:o[a]})}return s}(e,t)}(i.boostPoint,t.boostPoint);Object.keys(y).length>0&&(o.boostPoint=y);let b=S(n),v=b?b.safs:[],A=b?b.addItems:[],x=(b&&b.abilities,t.abilityFactor.map(e=>e.jpName));o.abilityFactorsMissingInAst=v.filter(e=>!x.includes(e));let I=Object.values(a.lang);if(a.lang)for(var l in o.abilityFactorsMissingInAst){let e=I.filter(e=>e.name_jp===o.abilityFactorsMissingInAst[l]);e.length>0&&(o.abilityFactorsMissingInAst[l]={name:e[0].name_en,jpName:o.abilityFactorsMissingInAst[l]})}let j=Object.values(a.lang.additional).map(e=>e.jp);if(A=A.map(e=>{let t=I.filter(t=>t.name_jp===e),i=e;if(/^S[1-8]:/.test(e)&&(i=e.substr(0,2)+"追加"+e.substr(2,e.length)),t.length>0){let e=t[0].name_en;if(/^S[1-8]:/.test(t[0].name_en))return{en:e=t[0].name_en.substr(0,2)+" Add: "+t[0].name_en.substr(3,t[0].name_en.length),jp:i}}return{en:"{replace with english name for "+i+"}",jp:i}}),o.addAbilitiesMissingInAst=A.filter(e=>!j.includes(e.jp?e.jp:e)),a.lang){let e=Object.values(a.lang.additional);for(var l in o.addAbilitiesMissingInAst){let t=e.filter(e=>e.jp===o.addAbilitiesMissingInAst[l]);t.length>0&&(o.addAbilitiesMissingInAst[l]={en:t[0].en,jp:o.addAbilitiesMissingInAst[l]})}}let E=0;o.addAbilitiesMissingInAst=o.addAbilitiesMissingInAst.reduce((e,t)=>(e[t.en?t.en:E]=t,E++,e),{}),console.warn("WARNING: Checks for boostdaySystem are not supported."),0==o.support.outdatedInSim.length&&delete o.support.outdatedInSim;0==o.support.outdatedInAst.length&&delete o.support.outdatedInAst;0==o.support.inconclusiveInSim.length&&delete o.support.inconclusiveInSim;0==o.support.inconclusiveInAst.length&&delete o.support.inconclusiveInAst;0==o.support.codeChanges.length&&delete o.support.codeChanges;0==o.additional.outdatedInSim.length&&delete o.additional.outdatedInSim;0==o.additional.outdatedInAst.length&&delete o.additional.outdatedInAst;0==o.additional.inconclusiveInSim.length&&delete o.additional.inconclusiveInSim;0==o.additional.inconclusiveInAst.length&&delete o.additional.inconclusiveInAst;0==o.additional.codeChanges.length&&delete o.additional.codeChanges;0==o.potential.outdatedInSim.length&&delete o.potential.outdatedInSim;0==o.potential.outdatedInAst.length&&delete o.potential.outdatedInAst;0==o.potential.inconclusiveInSim.length&&delete o.potential.inconclusiveInSim;0==o.potential.inconclusiveInAst.length&&delete o.potential.inconclusiveInAst;0==o.potential.codeChanges.length&&delete o.potential.codeChanges;0==o.extendAbility.outdatedInSim.length&&delete o.extendAbility.outdatedInSim;0==o.extendAbility.outdatedInAst.length&&delete o.extendAbility.outdatedInAst;0==o.extendAbility.inconclusiveInSim.length&&delete o.extendAbility.inconclusiveInSim;0==o.extendAbility.inconclusiveInAst.length&&delete o.extendAbility.inconclusiveInAst;0==o.ability.outdatedInSim.length&&delete o.ability.outdatedInSim;0==o.ability.outdatedInAst.length&&delete o.ability.outdatedInAst;0==o.ability.inconclusiveInSim.length&&delete o.ability.inconclusiveInSim;0==o.ability.inconclusiveInAst.length&&delete o.ability.inconclusiveInAst;0==o.ability.codeChanges.length&&delete o.ability.codeChanges;0==o.excludePattern.addition.outdatedInSim.length&&delete o.excludePattern.addition.outdatedInSim;0==o.excludePattern.addition.outdatedInAst.length&&delete o.excludePattern.addition.outdatedInAst;0==o.excludePattern.addition.inconclusiveInSim.length&&delete o.excludePattern.addition.inconclusiveInSim;0==o.excludePattern.addition.inconclusiveInAst.length&&delete o.excludePattern.addition.inconclusiveInAst;0==o.excludePattern.select.outdatedInSim.length&&delete o.excludePattern.select.outdatedInSim;0==o.excludePattern.select.outdatedInAst.length&&delete o.excludePattern.select.outdatedInAst;0==o.excludePattern.select.inconclusiveInSim.length&&delete o.excludePattern.select.inconclusiveInSim;0==o.excludePattern.select.inconclusiveInAst.length&&delete o.excludePattern.select.inconclusiveInAst;0==o.extraSlot.outdatedInSim.length&&delete o.extraSlot.outdatedInSim;0==o.extraSlot.outdatedInAst.length&&delete o.extraSlot.outdatedInAst;0==o.extraSlot.inconclusiveInSim.length&&delete o.extraSlot.inconclusiveInSim;0==o.extraSlot.inconclusiveInAst.length&&delete o.extraSlot.inconclusiveInAst;0==o.sameBonusBoost.outdatedInSim.length&&delete o.sameBonusBoost.outdatedInSim;0==o.sameBonusBoost.outdatedInAst.length&&delete o.sameBonusBoost.outdatedInAst;0==o.sameBonusBoost.inconclusiveInSim.length&&delete o.sameBonusBoost.inconclusiveInSim;0==o.sameBonusBoost.inconclusiveInAst.length&&delete o.sameBonusBoost.inconclusiveInAst;0===Object.keys(o.support).length&&delete o.support;0===Object.keys(o.additional).length&&delete o.additional;0===Object.keys(o.potential).length&&delete o.potential;0===Object.keys(o.extendAbility).length&&delete o.extendAbility;0===Object.keys(o.ability).length&&delete o.ability;0===Object.keys(o.excludePattern.addition).length&&delete o.excludePattern.addition;0===Object.keys(o.excludePattern.select).length&&delete o.excludePattern.select;0===Object.keys(o.excludePattern).length&&delete o.excludePattern;0===Object.keys(o.extraSlot).length&&delete o.extraSlot;0===Object.keys(o.sameBonusBoost).length&&delete o.sameBonusBoost;0===Object.keys(o.boostPoint).length&&delete o.boostPoint;0==o.abilityFactorsMissingInAst.length&&delete o.abilityFactorsMissingInAst;0!=o.addAbilitiesMissingInAst.length&&0!==Object.keys(o.addAbilitiesMissingInAst).length||delete o.addAbilitiesMissingInAst;if(0===Object.keys(o).length)return"No pending updates from PSO2 Affixing Simulator at the moment!";return e.writeFile(r+"/changes.txt",JSON.stringify(o,null,4),function(e){}),o}(t,n,u);var Oe=t.excludePattern;if(Pe&&Pe.excludePattern&&Pe.excludePattern.addition&&Pe.excludePattern.addition.outdatedInAst)for(var G=0;G<Pe.excludePattern.addition.outdatedInAst.length;G++)Oe.addition.push(Pe.excludePattern.addition.outdatedInAst[G]);if(Pe&&Pe.excludePattern&&Pe.excludePattern.select&&Pe.excludePattern.select.outdatedInAst)for(var G=0;G<Pe.excludePattern.select.outdatedInAst.length;G++)Oe.select.push(Pe.excludePattern.select.outdatedInAst[G]);console.log("Crunching extend ability...");var De=t.extendAbility;if(Pe&&Pe.extendAbility&&Pe.extendAbility.outdatedInAst)for(var G=0;G<Pe.extendAbility.outdatedInAst.length;G++)De.push(Pe.extendAbility.outdatedInAst[G]);console.log("Crunching extra slot...");var _e=t.extraSlot;Pe&&Pe.extraSlot&&Pe.extraSlot.outdatedInAst&&Pe.extraSlot.outdatedInAst.length>0&&(_e=n.extraSlot);console.log("Crunching same bonus boost...");var Be=t.sameBonusBoost;Pe&&Pe.sameBonusBoost&&Pe.sameBonusBoost.outdatedInAst&&Pe.sameBonusBoost.outdatedInAst.length>0&&(Be=n.sameBonusBoost);console.log("Crunching boost point...");var we=t.boostPoint;Pe&&Pe.boostPoint&&(we=n.boostPoint);console.log("Crunching language file...");var Ce={};console.log("Crunching ability language...");for(var G=0;G<F.length;G++){if(F[G].code&&!F[G].code.includes("TO BE DETERMINED")){var ke={};if(!ke.name||!ke.effect)try{ke={name:a.lang[F[G].code].name_glen,effect:a.lang[F[G].code].effect_glen}}catch(e){}if(!(ke=ke||{}).name||!ke.effect)try{ke=o.abilityList.filter(e=>e.code==F[G].simCode)[0]}catch(e){}if(!(ke=ke||{}).name||!ke.effect){var ge=oe.filter(e=>e.ref==F[G].ref)[0];try{ke=o.optionList.additional.filter(e=>e.value==ge.simValue)[0]}catch(e){}}ke=ke||{},Ce[F[G].code]={name_en:F[G].name||"TO BE DETERMINED",name_jp:F[G].jpName,name_glen:ke.name||"TO BE DETERMINED",effect_en:F[G].effect||"TO BE DETERMINED",effect_jp:F[G].jpEffect,effect_glen:ke.effect||"TO BE DETERMINED"}}(F[G].ref<0||!F[G].code||F[G].code.includes("TO BE DETERMINED")||"TO BE DETERMINED"==F[G].name||"TO BE DETERMINED"==F[G].effect)&&(console.log("WARNING Could not find some information for the following Ability:"),console.log(F[G])),ke.name&&ke.effect||console.log("WARNING Could not find global translation for ability: "+F[G].name+" - simCode: "+F[G].simCode)}Ce.support={Nothing:{en:"Nothing",jp:"無し",glen:"Nothing"}},console.log("Crunching support item language...");for(var G=0;G<ye.length;G++){if(!ye[G].id.includes("TO BE DETERMINED")){var Re={};if(!Re.id)try{Re={id:a.lang.support[ye[G].id].glen}}catch(e){}if(!(Re=Re||{}).id)try{Re=o.optionList.support.filter(e=>e.value==ye[G].simValue)[0]}catch(e){}Re=Re||{},Ce.support[ye[G].id]={en:ye[G].id,jp:ye[G].jpId,glen:Re.id||"TO BE DETERMINED"}}(ye[G].ref<0||ye[G].id.includes("TO BE DETERMINED")||"TO BE DETERMINED"==ye[G].name||"TO BE DETERMINED"==ye[G].value||"number"!=typeof ye[G].boost)&&(console.log("WARNING Could not find some information for the following Support Item:"),console.log(ye[G])),Re.id||console.log("WARNING Could not find global translation for support item: "+ye[G].id+" - simValue: "+ye[G].simValue)}console.log("Crunching AddBility Item language..."),Ce.additional={Nothing:{en:"Nothing",jp:"無し",glen:"Nothing"}};for(var G=0;G<oe.length;G++){var Me={};if(!Me.id)try{Me={id:a.lang.additional[oe[G].id].glen}}catch(e){}if(!(Me=Me||{}).id)try{Me=o.optionList.additional.filter(e=>e.value==oe[G].simValue)[0]}catch(e){}Me=Me||{},oe[G].id.includes("TO BE DETERMINED")||(Ce.additional[oe[G].id]={en:oe[G].id,jp:oe[G].jpId,glen:Me.id||"TO BE DETERMINED"}),(oe[G].ref<0||oe[G].id.includes("TO BE DETERMINED")||"TO BE DETERMINED"==oe[G].name||"TO BE DETERMINED"==oe[G].value||"TO BE DETERMINED"==oe[G].effect)&&(console.log("WARNING Could not find some information for the following Add Ability Item:"),console.log(oe[G])),Me.id||console.log("WARNING Could not find global translation for Add item: "+oe[G].id+" - simValue: "+oe[G].simValue)}console.log("Crunching potential language..."),Ce.potential={Nothing:{en:"Nothing",jp:"無し",glen:"Nothing"}};for(var G=0;G<xe.length;G++){var Fe={};if(!Fe.id)try{Fe={id:a.lang.potential[xe[G].id].glen}}catch(e){}if(!(Fe=Fe||{}).id)try{Fe=o.optionList.potential.filter(e=>e.value==xe[G].simValue)[0]}catch(e){}Fe=Fe||{},xe[G].id.includes("TO BE DETERMINED")||(Ce.potential[xe[G].id]={en:xe[G].id,jp:xe[G].jpId,glen:Fe.id||"TO BE DETERMINED"}),(xe[G].ref<0||xe[G].id.includes("TO BE DETERMINED")||"TO BE DETERMINED"==xe[G].name||"TO BE DETERMINED"==xe[G].value||"number"!=typeof xe[G].boost)&&(console.log("WARNING Could not find some information for the following Potential:"),console.log(xe[G])),Fe.id||console.log("WARNING Could not find global translation for potential: "+xe[G].id+" - simValue: "+xe[G].simValue)}console.log("Crunching language internal to the assistant...");for(var G=0;G<f.internalLangKeys.length;G++)a.lang[f.internalLangKeys[G]]&&(Ce[f.internalLangKeys[G]]=a.lang[f.internalLangKeys[G]]);console.log("Wrapping up...");var Ge={optionList:{support:ye,additional:oe,potential:xe,boostWeek:f.boostWeekPercentages},excludePattern:Oe,extendAbility:De,extraSlot:_e,boostPoint:we,sameBonusBoost:Be,pairingExceptions:t.pairingExceptions,abilityList:F,abilityFactor:te};let Ve=new D,Ue=null;Ve.notify(()=>{if(console.log(),!Ue)return Ue||!P(Ge,Ce)?void i.question("Some problems were encountered while updating the affix database. Please review the files in 'intermediate' folder for more information. Press any key to quit...",function(e){process.exit()}):void i.question("The affixing database is ready to be updated! Please review the files 'intermediate/affixData.json' and 'intermediate/lang.json' for quality assurance and when ready, press any key to continue the build process...",function(t){!function t(n,o){console.log("Building project...");let l=(e,t,n)=>{if(e)return console.log(e),void i.question("Build failed. Press 'Y' to try again or any key to quit...",function(e){"Y"===e||"y"===e?y(l):process.exit()});console.log(t),i.question("Build complete! Press enter to quit...",function(e){process.exit()})};let a=new D;let s=null;a.notify(()=>{s?i.question(s+" Press 'Y' to try again or any key to quit...",function(e){"Y"===e||"y"===e?t(n,o):process.exit()}):y(l)});a.enter();e.writeFile("js/affixData.js",c.format(JSON.stringify(n,null,4)),function(e){e&&(console.log(e),s="Could not write to affixData.js."),a.leave()});a.enter();e.writeFile("js/lang.js",d.format(JSON.stringify(o,null,4)),function(e){e&&(console.log(e),s="Could not write to lang.js."),a.leave()})}(Ge,Ce)});console.log(Ue)}),Ve.enter(),e.writeFile(r+"/affixData.json",JSON.stringify(Ge,null,4),function(e){e&&(Ue=e),Ve.leave()}),Ve.enter(),e.writeFile(r+"/lang.json",JSON.stringify(Ce,null,4),function(e){e&&(Ue=e),Ve.leave()}),Ve.enter(),e.writeFile(r+"/swikiAbilities.json",JSON.stringify(O,null,4),function(e){e&&(Ue=e),Ve.leave()}),Ve.enter(),e.writeFile(r+"/swikiSafs.json",JSON.stringify(_,null,4),function(e){e&&(Ue=e),Ve.leave()}),Ve.enter(),e.writeFile(r+"/swikiSSAs.json",JSON.stringify(B,null,4),function(e){e&&(Ue=e),Ve.leave()}),Ve.enter(),e.writeFile(r+"/swikiAddAbilities.json",JSON.stringify(w,null,4),function(e){e&&(Ue=e),Ve.leave()}),Ve.enter(),e.writeFile(r+"/arksVisiphone.json",JSON.stringify(C,null,4),function(e){e&&(Ue=e),Ve.leave()}),Ve.enter(),e.writeFile(r+"/arksVisiphoneSSAs.json",JSON.stringify(k,null,4),function(e){e&&(Ue=e),Ve.leave()})}(l.data,n,o,s,u,p,j,N,O)):i.question(_+" Press 'Y' to try again or any key to quit...",function(e){"Y"===e||"y"===e?h(t):process.exit()})};h(t)}else i.question("Please review the impacted files and restart the build process. Press 'Y' to try again or any key to quit...",function(e){"Y"===e||"y"===e?(delete require.cache[require.resolve("./js/affixData")],delete require.cache[require.resolve("./js/lang")],l=require("./js/affixData"),a=require("./js/lang"),s()):process.exit()})};s()})}catch(e){console.error("ERROR Configuration file incorrectly initialized."),console.error(e),i.question("Press any key to quit...",function(e){process.exit()})}const g={temp:0,pendingInSim:1,nameMismatch:2,astOnly:4,dupCodeInSim:5};var m=[{ignoreType:g.temp,simName:"S2:Lethal Intent"},{ignoreType:g.temp,simName:"S3:Lethal Intent"},{ignoreType:g.temp,simName:"S3:Rupturing Excess"},{ignoreType:g.temp,simName:"S1:Immediate Skill"},{ignoreType:g.pendingInSim,astName:"S1:Brilliant Intent 2"},{ignoreType:g.pendingInSim,astName:"S1:Photon Balance 2"},{ignoreType:g.pendingInSim,astName:"S1:Collaborator Liberator 2"},{ignoreType:g.pendingInSim,astName:"S1:Offensive Intent 2"},{ignoreType:g.pendingInSim,astName:"S1:Flowing Grace"},{ignoreType:g.pendingInSim,astName:"S2:Heavenly Keeper 2"},{ignoreType:g.pendingInSim,astName:"S2:Photon Reduction 3"},{ignoreType:g.pendingInSim,astName:"S2:Guardian Armor 2"},{ignoreType:g.pendingInSim,astName:"S2:Instant Reduction 2"},{ignoreType:g.pendingInSim,astName:"S2:Instant Purpose"},{ignoreType:g.pendingInSim,astName:"S2:Medicinal Wisdom 2"},{ignoreType:g.pendingInSim,astName:"S3:Powering Intent"},{ignoreType:g.pendingInSim,astName:"S3:Radiant Strike 3"},{ignoreType:g.pendingInSim,astName:"S3:Vital Intent 2"},{ignoreType:g.pendingInSim,astName:"S5:Aegis Balance"},{ignoreType:g.pendingInSim,astName:"S6:Raising Expanse"},{ignoreType:g.pendingInSim,astName:"S6:Rainbow's Shield"},{ignoreType:g.pendingInSim,astName:"S7:Rainbow's Skill"},{ignoreType:g.pendingInSim,astName:"S8:Rainbow's Decay"},{ignoreType:g.pendingInSim,astAddId:"Add Ability (Exceed Receptor)"},{ignoreType:g.pendingInSim,astAddId:"Add Ability (Mana Reverie)"},{ignoreType:g.pendingInSim,astAddId:"Add Ability (Ether F)"},{ignoreType:g.pendingInSim,astAddId:"Add Ability (Astral S)"},{ignoreType:g.nameMismatch,astName:"S1:Vigor Enhancement",simName:"S1:Vigor Enhancment"},{ignoreType:g.nameMismatch,astName:"Ceremo Fever",simName:"Ceramo Fever"},{ignoreType:g.nameMismatch,astName:"Extreceptor",simName:"Extreme Receptor"},{ignoreType:g.nameMismatch,astName:"Grand Spirita",simName:"Grace Spirita"},{ignoreType:g.nameMismatch,astExcludePatternAdd:["VA","VC"]},{ignoreType:g.nameMismatch,astExcludePatternAdd:["VA","VB"]},{ignoreType:g.nameMismatch,astExcludePatternAdd:["VB","VC"]},{ignoreType:g.nameMismatch,astExcludePatternAdd:["TA","UA","UB"],simExcludePatternAdd:["TA","U"]},{ignoreType:g.nameMismatch,astExcludePatternAdd:["XG","XJ","XH","XI"]},{ignoreType:g.nameMismatch,astExcludePatternSel:["VA*","VB*"],simExcludePatternSel:["VB01","VA*"]},{ignoreType:g.nameMismatch,astExcludePatternSel:["VB*","VC*"],simExcludePatternSel:["VB03","VA*"]},{ignoreType:g.nameMismatch,astExcludePatternSel:["VA*","VB*"],simExcludePatternSel:["VB01","VC*"]},{ignoreType:g.nameMismatch,astExcludePatternSel:["VB*","VC*"],simExcludePatternSel:["VB03","VC*"]},{ignoreType:g.nameMismatch,astExcludePatternSel:["XG","XJ","XH","XI"]},{ignoreType:g.nameMismatch,astExtBase:["XG01","UC*"]},{ignoreType:g.nameMismatch,astExtBase:["XJ01","ID*"]},{ignoreType:g.astOnly,astName:"Stamina Boost"},{ignoreType:g.astOnly,astName:"Spirita Boost"},{ignoreType:g.astOnly,astName:"Power Boost"},{ignoreType:g.astOnly,astName:"Shoot Boost"},{ignoreType:g.astOnly,astName:"Technique Boost"},{ignoreType:g.astOnly,astName:"Tenora Boost"},{ignoreType:g.astOnly,astName:"GRM Boost"},{ignoreType:g.astOnly,astName:"Yohmei Boost"},{ignoreType:g.astOnly,astName:"Noble Stamina"},{ignoreType:g.astOnly,astName:"Elegant Stamina"},{ignoreType:g.astOnly,astName:"Grace Stamina"},{ignoreType:g.astOnly,astName:"Grand Stamina"},{ignoreType:g.astOnly,astName:"Noble Power"},{ignoreType:g.astOnly,astName:"Elegant Power"},{ignoreType:g.astOnly,astName:"Grace Power"},{ignoreType:g.astOnly,astName:"Grand Power"},{ignoreType:g.astOnly,astName:"Noble Shoot"},{ignoreType:g.astOnly,astName:"Elegant Shoot"},{ignoreType:g.astOnly,astName:"Grace Shoot"},{ignoreType:g.astOnly,astName:"Grand Shoot"},{ignoreType:g.astOnly,astName:"Noble Technique"},{ignoreType:g.astOnly,astName:"Elegant Technique"},{ignoreType:g.astOnly,astName:"Grace Technique"},{ignoreType:g.astOnly,astName:"Grand Technique"},{ignoreType:g.astOnly,astName:"Grace Spirita"},{ignoreType:g.astOnly,astName:"Offense Boost"},{ignoreType:g.astOnly,astName:"Attack Boost"},{ignoreType:g.astOnly,astName:"Defense Boost"},{ignoreType:g.astOnly,astName:"Guard Boost"},{ignoreType:g.astOnly,astName:"S1:Junk"},{ignoreType:g.astOnly,astName:"S2:Junk"},{ignoreType:g.astOnly,astName:"S3:Junk"},{ignoreType:g.astOnly,astName:"S4:Junk"},{ignoreType:g.astOnly,astName:"S5:Junk"},{ignoreType:g.astOnly,astName:"S6:Junk"},{ignoreType:g.astOnly,astName:"S7:Junk"},{ignoreType:g.astOnly,astName:"S8:Junk"},{ignoreType:g.astOnly,astAddId:/^S[1-8]{1} Add: .+$/},{ignoreType:g.dupCodeInSim,astCode:"LB91",simCode:"LB1V"},{ignoreType:g.dupCodeInSim,astCode:"LC88",simCode:"LC1I"},{ignoreType:g.dupCodeInSim,astCode:"LC89",simCode:"LC1H"},{ignoreType:g.dupCodeInSim,astCode:"LC90",simCode:"LC1J"},{ignoreType:g.dupCodeInSim,astCode:"LC91",simCode:"LC1K"}];function h(e){if(void 0===e||null===e||"function"!=typeof e)return console.warn("WARN Illegal Argument passed to fetchUpdates"),console.warn(" - Usage: fetchUpdates(completion)"),void console.warn(" - completion: the completion handler function containing one parameter for the data retrieved");let t=null,i=null,l=null,a=null,s=null,r=null,d=null,c=null,f=new D;f.notify(()=>{t&&i&&l&&a&&s&&r&&d&&c?e(t,i,l,a,s,r,d,c):(console.log("Failed to load data sources..."),e(null,null,null,null,null,null,null))}),f.enter(),console.log("Obtaining latest PSO2 Affixing Simulator data..."),n("https://arks-layer.com/abilitysim/jp/params.json").then(e=>e.text()).then(e=>{let t=e.replace(/,\s*}/g,"}");return JSON.parse(t)}).then(e=>{console.log("Obtained the latest PSO2 Affixing Simulator data..."),t=e,f.leave()}).catch(t=>{console.log("Failed to obtain the latest PSO2 Affixing Simulator data..."),console.error(t),e(null,null,null,null,null,null,null)}),f.enter(),console.log("Obtaining latest PSO2 Affixing Simulator Global data..."),n("https://arks-layer.com/abilitysim/na/params.json").then(e=>e.text()).then(e=>{let t=e.replace(/,\s*}/g,"}");return JSON.parse(t)}).then(e=>{console.log("Obtained the latest PSO2 Affixing Simulator Global data..."),i=e,f.leave()}).catch(t=>{console.log("Failed to obtain the latest PSO2 Affixing Simulator Global data..."),console.error(t),e(null,null,null,null,null,null,null)}),httpsAgent=new https.Agent({rejectUnauthorized:!1}),f.enter(),console.log("Obtaining latest PSO2 Swiki Ability data..."),n("https://pso2.swiki.jp/index.php?%E7%89%B9%E6%AE%8A%E8%83%BD%E5%8A%9B%E8%BF%BD%E5%8A%A0",{method:"GET",agent:httpsAgent}).then(e=>e.text()).then(e=>{console.log("Obtained the latest PSO2 Swiki Ability data..."),l=o.load(e),f.leave()}).catch(t=>{console.log("Failed to obtain the latest PSO2 Swiki Ability data..."),console.error(t),e(null,null,null,null,null,null,null)}),f.enter(),console.log("Obtaining latest PSO2 Swiki SAF data..."),n("https://pso2.swiki.jp/index.php?%E7%89%B9%E6%AE%8A%E8%83%BD%E5%8A%9B%E5%9B%A0%E5%AD%90",{method:"GET",agent:httpsAgent}).then(e=>e.text()).then(e=>{console.log("Obtained the latest PSO2 Swiki SSAs data..."),a=o.load(e),f.leave()}).catch(t=>{console.log("Failed to obtain the latest PSO2 Swiki SSAs data..."),console.error(t),e(null,null,null,null,null,null,null)}),f.enter(),console.log("Obtaining latest PSO2 Swiki SSA data..."),n("https://pso2.swiki.jp/index.php?S%E7%B4%9A%E7%89%B9%E6%AE%8A%E8%83%BD%E5%8A%9B",{method:"GET",agent:httpsAgent}).then(e=>e.text()).then(e=>{console.log("Obtained the latest PSO2 Swiki SSAs data..."),s=o.load(e),f.leave()}).catch(t=>{console.log("Failed to obtain the latest PSO2 Swiki SSAs data..."),console.error(t),e(null,null,null,null,null,null,null)}),f.enter(),console.log("Obtaining latest Arks Visiphone Ability data..."),n("https://pso2.arks-visiphone.com/wiki/List_of_Special_Abilities",{method:"GET",agent:httpsAgent}).then(e=>e.text()).then(e=>{console.log("Obtained the latest Arks Visiphone Ability data..."),r=o.load(e),f.leave()}).catch(t=>{console.log("Failed to obtain the latest Arks Visiphone Ability data..."),console.error(t),e(null,null,null,null,null,null,null)}),f.enter(),console.log("Obtaining latest Arks Visiphone Weapon SSA data..."),n("https://pso2.arks-visiphone.com/wiki/S-Class_Special_Ability_(Weapons)",{method:"GET",agent:httpsAgent}).then(e=>e.text()).then(e=>{console.log("Obtained the latest Arks Visiphone Weapon SSA data..."),d=o.load(e),f.leave()}).catch(t=>{console.log("Failed to obtain the latest Arks Visiphone Weapon SSA data..."),console.error(t),e(null,null,null,null,null,null,null)}),f.enter(),console.log("Obtaining latest Arks Visiphone Unit SSA data..."),n("https://pso2.arks-visiphone.com/wiki/S-Class_Special_Ability_(Units)",{method:"GET",agent:httpsAgent}).then(e=>e.text()).then(e=>{console.log("Obtained the latest Arks Visiphone Unit SSA data..."),c=o.load(e),f.leave()}).catch(t=>{console.log("Failed to obtain the latest Arks Visiphone Unit SSA data..."),console.error(t),e(null,null,null,null,null,null,null)})}function y(i){s.parser.parse(l.data);e.existsSync(r)||e.mkdirSync(r),e.writeFile("intermediate/affixingassistant.min.temp.txt","/** PSO2 Affixing Assistant\n * @author malulleybovo (since 2018)\n * @license GNU General Public License v3.0\n *\n * @licstart The following is the entire license notice for the \n * JavaScript code in this page.\n *\n * Copyright (C) 2018 Arthur Malulley B. de O.\n *\n *\n * The JavaScript code in this page is free software: you can\n * redistribute it and/or modify it under the terms of the GNU\n * General Public License (GNU GPL) as published by the Free Software\n * Foundation, either version 3 of the License, or (at your option)\n * any later version. The code is distributed WITHOUT ANY WARRANTY;\n * without even the implied warranty of MERCHANTABILITY or FITNESS\n * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.\n *\n * As additional permission under GNU GPL version 3 section 7, you\n * may distribute non-source (e.g., minimized or compacted) forms of\n * that code without the copy of the GNU GPL normally required by\n * section 4, provided you include this license notice and a URL\n * through which recipients can access the Corresponding Source.\n *\n * @licend The above is the entire license notice\n * for the JavaScript code in this page.\n *\n */\n",function(e){if(e)return console.log(stderr),void i("Could not include license.",stdout,stderr);let n="uglifyjs --compress --mangle --toplevel -o %outfolder%/affixingassistant.min.js -- %jssrc% & uglifycss %csssrc% > %outfolder%/stylesheet.min.css & type intermediate\\affixingassistant.min.temp.txt > intermediate\\stylesheet.min.temp.txt & type dist\\affixingassistant.min.js >> intermediate\\affixingassistant.min.temp.txt & type intermediate\\affixingassistant.min.temp.txt > dist\\affixingassistant.min.js & del intermediate\\affixingassistant.min.temp.txt & type dist\\stylesheet.min.css >> intermediate\\stylesheet.min.temp.txt & type intermediate\\stylesheet.min.temp.txt > dist\\stylesheet.min.css & del intermediate\\stylesheet.min.temp.txt";n=(n=(n=n.replace(/%outfolder%/g,"dist")).replace(/%jssrc%/g,f.jsDependencies)).replace(/%csssrc%/g,f.cssDependencies),t(n,(e,t,n)=>{console.log(t),console.log(n),i(e,t,n)})})}function b(e,t){var i=e("div.ie5 > table.style_table");contentTables=[];for(var n=0;n<i.length;n++)"名称"==e(i[n]).find("thead td:first-child").text()&&contentTables.push(i[n]);abilities=[];for(n=0;n<contentTables.length;n++){var l=e(contentTables[n]).find("tbody > tr"),a=e(contentTables[n]).find("thead").text().includes("補正値");if(l)for(var s=0,r="",d=null,c=0;c<l.length;c++)if(!(e(l[c]).find("td").length<2)){var f=e(l[c]).find("td:first-child");if(f&&f.get(0))if(0==s){if(!(d=f.text()))continue;var u=o.html(f.get(0)).match(/rowspan=\"[0-9]+\"/);if(u&&u.length>0){s=parseInt(u[0].match(/[0-9]+/)[0]);var p=f.next().text();if(/^(Ⅰ|Ⅱ|Ⅲ|Ⅳ|Ⅴ|Ⅵ)$/.test(p)){var g=A(f.next().next(),!0),m=void 0;if(t)(h=e(l[c]).text().match(/特殊能力(追加)?\([^\)○]+\)/))&&h[0]&&(m=h[0]);abilities.push({name:d.trim()+p,effect:g,addItemName:m})}s--}else{g=A(f.next(),!1),m=void 0;if(t)(h=e(l[c]).text().match(/特殊能力(追加)?\([^\)○]+\)/))&&h[0]&&(m=h[0]);abilities.push({name:d.trim(),effect:g,addItemName:m})}}else{if(!d){s--;continue}p=f.text();if(/^(Ⅰ|Ⅱ|Ⅲ|Ⅳ|Ⅴ|Ⅵ)$/.test(p)){var h;g=A(f.next(),!1),m=void 0;if(t)(h=e(l[c]).text().match(/特殊能力(追加)?\([^\)○]+\)/))&&h[0]&&(m=h[0]);abilities.push({name:d.trim()+p,effect:g,addItemName:m})}s--}}}var y=abilities.filter(e=>abilities.filter(t=>t.name==e.name).length>1).sort((e,t)=>t.effect.length-e.effect.length),b=[];for(n=0;n<y.length;n++){var v=b.filter(e=>e.name==y[n].name);0==v.length?b.push(y[n]):!v[0].addItemName&&y[n].addItemName&&abilities.indexOf(v[0])&&(abilities[abilities.indexOf(v[0])].addItemName=y[n].addItemName)}function A(e,t){var i=j(e),n=a&&0==s;if(/rowspan=\"[0-9]+\"/.test(o.html(e[0]))?(r=i,n=!0):i=i.startsWith("+")?r+i:r+"\n"+i,n){var l=e.next();if(!l.get(0).children[0])return i;var d=l.get(0).children[0].data;d.startsWith("+")?i+=d:i=i+"\n"+d}return E(i)}return y=y.filter(e=>!b.includes(e)),abilities=abilities.filter(e=>!y.includes(e)),t&&(abilities=abilities.filter(e=>e.addItemName&&e.addItemName.length>0)),abilities.forEach(e=>{e.effect=e.effect.replace(/^\s+|\s+$/g,"")}),abilities}function v(e){tables=e("div.ie5 > table.style_table"),contentTables=[];for(var t=0;t<tables.length;t++)"名称"==e(tables[t]).find("thead td:first-child").text()&&contentTables.push(tables[t]);abilities=[];for(t=0;t<contentTables.length;t++){var i=e(contentTables[t]).find("tbody > tr"),n=e(contentTables[t]).find("thead").text(),l=(n.includes("補正値"),n.includes("Lv"));if(i)for(var a=0,s=null,r=0;r<i.length;r++)if(e(i[r]).find("td").length<2)a>0&&a--;else{var d=e(i[r]).find("td:first-child");if(d&&d.get(0))if(0==a){if(!(s=d.text()))continue;var c=o.html(d.get(0)).match(/rowspan=\"[0-9]+\"/),f=o.html(d.next().get(0)).match(/rowspan=\"[0-9]+\"/),u=c&&c.length>0,p=o.html(d.get(0)).match(/colspan=\"[0-9]+\"/);if(p&&p.length>0||!l&&!u)abilities.push({name:s.trim()});else{a=u?parseInt(c[0].match(/[0-9]+/)[0]):1;var g=d.next().text();(/^(Ⅰ|Ⅱ|Ⅲ|Ⅳ|Ⅴ|Ⅵ|-)$/.test(g)||f&&f.length>0)&&(/^(Ⅰ|Ⅱ|Ⅲ|Ⅳ|Ⅴ|Ⅵ)$/.test(g)||(g=""),abilities.push({name:s.trim()+g})),a--}}else{if(!s){a--;continue}g=d.text();/^(Ⅰ|Ⅱ|Ⅲ|Ⅳ|Ⅴ|Ⅵ)$/.test(g)&&abilities.push({name:s.trim()+g}),a--}else a>0&&a--}}var m=abilities.filter(e=>abilities.filter(t=>t.name==e.name).length>1),h=[];for(t=0;t<m.length;t++)0==h.filter(e=>e.name==m[t].name).length&&h.push(m[t]);m=m.filter(e=>!h.includes(e)),abilities=abilities.filter(e=>!m.includes(e));var y={"エグゼクル・グレア":"エクゼクル・グレア"};for(t=0;t<abilities.length;t++)y[abilities[t].name]&&(abilities[t].name=y[abilities[t].name]);return abilities}function A(e){tables=e("table"),abilities=[];for(var t=0;t<tables.length;t++)if(e(tables[t]).find("tr:first-child").text().includes("JP Name")){for(var i=e(tables[t]).find("tr"),n=[],o=e(i.get(0)).find("th"),l=0;l<o.length;l++)e(o[l]).text().includes("JP Name")?n.push("jpName"):e(o[l]).text().includes("EN Name")?n.push("enName"):e(o[l]).text().includes("Effect")&&n.push("effect");for(l=1;l<i.length;l++){for(var a=e(i[l]).find("td"),s={},r=0;r<a.length&&r<n.length;r++)s[n[r]]=("effect"==n[r]?j(e(a[r])):e(a[r]).text()).replace(/^\s+|\s+$/g,"");abilities.push(s)}}return abilities}function x(e){tables=e("table"),abilities=[];for(var t=0;t<tables.length;t++)if(e(tables[t]).find("tr:first-child").text().includes("S-Class")){for(var i=e(tables[t]).find("tr"),n={},o=e(i.get(0)).find("th"),l=0;l<o.length;l++)e(o[l]).text().includes("S-Class")?n[l]="name":e(o[l]).text().includes("Capsule")?n[l]="addItemName":e(o[l]).text().includes("Description")?n[l]="effect":e(o[l]).text().includes("Ability Factor")&&(n[l]="hasSAF");for(l=1;l<i.length;l++){for(var a=e(i[l]).find("td"),s={},r=!1,d=0;d<a.length;d++)switch(n[d]){case"name":2===(c=N(e(a[d])).replace(/\s*<br>\s*/g,"<br>").replace(/\s*:\s*/g,":").split("<br>")).length&&(s.jpName=I(c[0].trim()),s.enName=I(c[1].trim()));break;case"addItemName":var c;2===(c=N(e(a[d])).replace(/\s*<br>\s*/g,"<br>").replace(/\s*:\s*/g,":").split("<br>")).length&&(s.jpAddItemName=I(c[0].trim()),s.enAddItemName=I(c[1].trim()));break;case"effect":s.enEffect=j(e(a[d]));case"hasSAF":e(a[d]).text().trim().includes("Not Implemented")&&(r=!0),s.hasSAF=e(a[d]).text().trim().length>0}r||abilities.push(s)}}return abilities}function S(e,t){let i=[],n=[],o=[],l=e("div.ie5 > table.style_table");for(var a=0;a<l.length;a++){let c=l.get(a),f=e(c).find("thead")[0],u=e(c).find("tbody")[0];if(void 0===f||0==f.children.length||0==f.children[0].children.length||"名称"!==e(f.children[0].children[0]).text())continue;for(var s=null,r=null,d=0;d<u.children.length;d++){let l=u.children[d];e(l).html().includes("rowspan=")&&2===l.children.length&&/^S[1-9]:.+$/.test(e(l.children[0]).text())&&(s=e(l.children[0]).text(),r=E(e(l.children[0]).next().text())),null!==s&&"string"==typeof s&&(e(l).html().includes("//image.swiki.jp/img1/?host=pso2&page=%E7%94%BB%E5%83%8F%E7%BD%AE%E5%A0%B4&src=%E7%89%B9%E6%AE%8A%E8%83%BD%E5%8A%9B%E5%9B%A0%E5%AD%90.png")&&(t?0==i.filter(e=>e.name==s).length:!i.includes(s))&&i.push(t?{name:s,effect:r}:s),e(l).html().includes("//image.swiki.jp/img1/?host=pso2&page=%E7%89%B9%E6%AE%8A%E8%83%BD%E5%8A%9B%E8%BF%BD%E5%8A%A0&src=S%E7%B4%9A%E7%89%B9%E6%AE%8A%E8%83%BD%E5%8A%9B%E8%BF%BD%E5%8A%A0.png")&&(t?0==n.filter(e=>e.name==s).length:!n.includes(s))&&n.push(t?{name:s,effect:r}:s),(t?0!=o.filter(e=>e.name==s).length:o.includes(s))||o.push(t?{name:s,effect:r}:s))}}return{abilities:o,safs:i,addItems:n}}function I(e){for(var t="",i=0,n=e.length;i<n;i++){var o=e[i].charCodeAt(0);o>=65280&&o<=65519&&(o=255&o+32),t+=String.fromCharCode(o)}return t}function j(e){for(var t="",i=0;i<e[0].childNodes.length;i++)if(e[0].childNodes[i].nodeValue){var n=e[0].childNodes[i].nodeValue;/((ATK)|(DEF)|(DEX)|(HP)|(PP)|(ALL)|(撃力)|(撃防御)|(技量)|(耐性)|(軽減)|(打射法)|(打射法防御))\s+(\+|-)[0-9]+/.test(n)&&(n=n.replace(/\s+\+/g,"+").replace(/\s+-/g,"-")),t+=n}else o.html(e[0].childNodes[i]).startsWith("<br")&&(t+="<br>");return E(t)}function E(e){var t=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(/\s+<br>\s+/g,"<br>")).replace(/+/g,"+")).replace(/-/g,"-")).replace(/打撃\+/g,"打撃力+")).replace(/打撃-/g,"打撃力-")).replace(/射撃\+/g,"射撃力+")).replace(/射撃-/g,"射撃力-")).replace(/法撃\+/g,"法撃力+")).replace(/法撃-/g,"法撃力-")).replace(/全\+/g,"ALL+")).replace(/全-/g,"ALL-")).match(/((ATK)|(DEF)|(DEX)|(HP)|(PP)|(ALL)|(撃力)|(撃防御)|(技量)|(耐性)|(軽減)|(打射法)|(打射法防御))\s*(\+|-)[0-9]+/g);if(t)for(var i=0;i<t.length;i++)if(t[i]&&e.indexOf(t[i])>=0){var n=t[i].includes("+"),o=t[i].split(/\+|-/g),l="("+(n?"+":"-")+o[1]+")",a=/^打射法\s*(\+|-)/.test(t[i]),s=/^打射法防御\s*(\+|-)/.test(t[i]);e=a?e.replace(t[i],"打撃力"+l+"<br>射撃力"+l+"<br>法撃力"+l):s?e.replace(t[i],"打撃防御"+l+"<br>射撃防御"+l+"<br>法撃防御"+l):e.replace(t[i],o[0].trim()+l)}if(t=e.match(/打撃、射撃、法撃力が[0-9]+上昇。/g))for(i=0;i<t.length;i++)if(t[i]&&e.indexOf(t[i])>=0&&t[i].match(/[0-9]+/)){l="(+"+t[i].match(/[0-9]+/)[0]+")";e=e.replace(t[i],`打撃力${l}<br>射撃力${l}<br>法撃力${l}`)}if(t=e.match(/最大HPが[0-9]+上昇。/g))for(i=0;i<t.length;i++)if(t[i]&&e.indexOf(t[i])>=0&&t[i].match(/[0-9]+/)){l="(+"+t[i].match(/[0-9]+/)[0]+")";e=e.replace(t[i],`HP${l}`)}if(t=e.match(/最大PPが[0-9]+上昇。/g))for(i=0;i<t.length;i++)if(t[i]&&e.indexOf(t[i])>=0&&t[i].match(/[0-9]+/)){l="(+"+t[i].match(/[0-9]+/)[0]+")";e=e.replace(t[i],`PP${l}`)}if(t=e.match(/打撃力が[0-9]+上昇。/g))for(i=0;i<t.length;i++)if(t[i]&&e.indexOf(t[i])>=0&&t[i].match(/[0-9]+/)){l="(+"+t[i].match(/[0-9]+/)[0]+")";e=e.replace(t[i],`打撃力${l}`)}if(t=e.match(/射撃力が[0-9]+上昇。/g))for(i=0;i<t.length;i++)if(t[i]&&e.indexOf(t[i])>=0&&t[i].match(/[0-9]+/)){l="(+"+t[i].match(/[0-9]+/)[0]+")";e=e.replace(t[i],`射撃力${l}`)}if(t=e.match(/法撃力が[0-9]+上昇。/g))for(i=0;i<t.length;i++)if(t[i]&&e.indexOf(t[i])>=0&&t[i].match(/[0-9]+/)){l="(+"+t[i].match(/[0-9]+/)[0]+")";e=e.replace(t[i],`法撃力${l}`)}return e.trim()}function N(e){for(var t="",i=0;i<e[0].childNodes.length;i++){if(e[0].childNodes[i].nodeValue)t+=e[0].childNodes[i].nodeValue;else o.html(e[0].childNodes[i]).startsWith("<br")&&(t+="<br>")}return t=t.replace(/\s+<br>\s+/g,"<br>")}function L(e,t,i){var n=e.substr(0,2),o="ZYXWVUTSRQPONMLKJIHGFEDCBA9876543210";if(n.length>=2)for(var l=9;l>=0;l--)for(var a=0;a<o.length;a++){var s=n+l+o[a];if(0==t.filter(e=>e.code==s).length&&0==i.filter(e=>e.code==s).length)return s}return"TO BE DETERMINED"}function T(e,t,i){for(var n="ZYXWVUTSRQPONMLKJIHGFEDCBA9876543210",o=9;o>=0;o--)for(var l=0;l<n.length;l++){var a=e+o+n[l];if(0==t.filter(e=>e.value==a).length&&0==i.filter(e=>e.value==a).length)return a}return"TO BE DETERMINED"}function P(e,t){if(void 0===e||null===e||"object"!=typeof e)return console.log("Assistant's Affix Database must be an object"),!1;if(void 0===e.optionList||null===e.optionList||"object"!=typeof e.optionList)return console.log("Assistant's Affix Database must contain an object property called 'optionList'"),!1;if(void 0===e.optionList.support||null===e.optionList.support||"object"!=typeof e.optionList.support||void 0===e.optionList.support.length)return console.log("Assistant's Affix Database must contain an list property called 'support' inside 'optionList'"),!1;if(e.optionList.support.filter(e=>void 0===e.id||null===e.id||"string"!=typeof e.id).length>0)return console.log("Assistant's Affix Database must contain a string property called 'id' for every item inside 'optionList.support'"),console.log(e.optionList.support.filter(e=>void 0===e.id||null===e.id||"string"!=typeof e.id).slice(0,10)),!1;if(e.optionList.support.filter(e=>void 0===e.name||null===e.name||"string"!=typeof e.name).length>0)return console.log("Assistant's Affix Database must contain a string property called 'name' for every item inside 'optionList.support'"),console.log(e.optionList.support.filter(e=>void 0===e.name||null===e.name||"string"!=typeof e.name).slice(0,10)),!1;if(e.optionList.support.filter(e=>void 0===e.value||null===e.value||"string"!=typeof e.value).length>0)return console.log("Assistant's Affix Database must contain a string property called 'value' for every item inside 'optionList.support'"),console.log(e.optionList.support.filter(e=>void 0===e.value||null===e.value||"string"!=typeof e.value).slice(0,10)),!1;if(e.optionList.support.filter(e=>void 0===e.boost||null===e.boost||"number"!=typeof e.boost).length>0)return console.log("Assistant's Affix Database must contain a numeric property called 'boost' for every item inside 'optionList.support'"),console.log(e.optionList.support.filter(e=>void 0===e.fn||null===e.fn||"function"!=typeof e.fn).slice(0,10)),!1;if(void 0===e.optionList.additional||null===e.optionList.additional||"object"!=typeof e.optionList.additional||void 0===e.optionList.additional.length)return console.log("Assistant's Affix Database must contain an list property called 'additional' inside 'optionList'"),!1;if(e.optionList.additional.filter(e=>void 0===e.id||null===e.id||"string"!=typeof e.id).length>0)return console.log("Assistant's Affix Database must contain a string property called 'id' for every item inside 'optionList.additional'"),console.log(e.optionList.additional.filter(e=>void 0===e.id||null===e.id||"string"!=typeof e.id).slice(0,10)),!1;if(e.optionList.additional.filter(e=>"Nothing"!==e.id&&(void 0===e.name||null===e.name||"string"!=typeof e.name)).length>0)return console.log("Assistant's Affix Database must contain a string property called 'name' for every item inside 'optionList.additional'"),console.log(e.optionList.additional.filter(e=>"Nothing"!==e.id&&(void 0===e.name||null===e.name||"string"!=typeof e.name)).slice(0,10)),!1;if(e.optionList.additional.filter(e=>void 0===e.value||null===e.value||"string"!=typeof e.value).length>0)return console.log("Assistant's Affix Database must contain a string property called 'value' for every item inside 'optionList.additional'"),console.log(e.optionList.additional.filter(e=>void 0===e.value||null===e.value||"string"!=typeof e.value).slice(0,10)),!1;if(e.optionList.additional.filter(e=>"Nothing"!==e.id&&(void 0===e.extend||null===e.extend||"number"!=typeof e.extend||e.extend<0||e.extend>100||!Number.isInteger(e.extend))).length>0)return console.log("Assistant's Affix Database must contain a integer property ranging from 0 to 100 called 'extend' for every item inside 'optionList.additional'"),console.log(e.optionList.additional.filter(e=>"Nothing"!==e.id&&(void 0===e.extend||null===e.extend||"number"!=typeof e.extend||e.extend<0||e.extend>100||!Number.isInteger(e.extend))).slice(0,10)),!1;if(e.optionList.additional.filter(e=>"Nothing"!==e.id&&(void 0===e.effect||null===e.effect||"string"!=typeof e.effect)).length>0)return console.log("Assistant's Affix Database must contain a string property called 'effect' for every item inside 'optionList.additional'"),console.log(e.optionList.additional.filter(e=>"Nothing"!==e.id&&(void 0===e.effect||null===e.effect||"string"!=typeof e.effect)).slice(0,10)),!1;if(void 0===e.optionList.potential||null===e.optionList.potential||"object"!=typeof e.optionList.potential||void 0===e.optionList.potential.length)return console.log("Assistant's Affix Database must contain an list property called 'potential' inside 'optionList'"),!1;if(e.optionList.potential.filter(e=>void 0===e.id||null===e.id||"string"!=typeof e.id).length>0)return console.log("Assistant's Affix Database must contain a string property called 'id' for every item inside 'optionList.potential'"),console.log(e.optionList.potential.filter(e=>void 0===e.id||null===e.id||"string"!=typeof e.id).slice(0,10)),!1;if(e.optionList.potential.filter(e=>void 0===e.name||null===e.name||"string"!=typeof e.name).length>0)return console.log("Assistant's Affix Database must contain a string property called 'name' for every item inside 'optionList.potential'"),console.log(e.optionList.potential.filter(e=>void 0===e.name||null===e.name||"string"!=typeof e.name).slice(0,10)),!1;if(e.optionList.potential.filter(e=>void 0===e.value||null===e.value||"string"!=typeof e.value).length>0)return console.log("Assistant's Affix Database must contain a string property called 'value' for every item inside 'optionList.potential'"),console.log(e.optionList.potential.filter(e=>void 0===e.value||null===e.value||"string"!=typeof e.value).slice(0,10)),!1;if(e.optionList.potential.filter(e=>void 0===e.boost||null===e.boost||"number"!=typeof e.boost).length>0)return console.log("Assistant's Affix Database must contain a numeric property called 'boost' for every item inside 'optionList.potential'"),console.log(e.optionList.potential.filter(e=>void 0===e.fn||null===e.fn||"function"!=typeof e.fn).slice(0,10)),!1;if(void 0===e.optionList.boostWeek||null===e.optionList.boostWeek||"object"!=typeof e.optionList.boostWeek||void 0===e.optionList.boostWeek.length)return console.log("Assistant's Affix Database must contain an list property called 'boostWeek' inside 'optionList'"),!1;if(e.optionList.boostWeek.filter(e=>void 0===e||null===e||"number"!=typeof e||e<0||e>100||!Number.isInteger(e)).length>0)return console.log("Assistant's Affix Database must only contain integer numbers ranging from 0 to 100 inside 'optionList.boostWeek'"),console.log(e.optionList.boostWeek.filter(e=>void 0===e||null===e||"number"!=typeof e||e<0||e>100||!Number.isInteger(e)).slice(0,10)),!1;if(void 0===e.excludePattern||null===e.excludePattern||"object"!=typeof e.excludePattern)return console.log("Assistant's Affix Database must contain an object property called 'excludePattern'"),!1;if(void 0===e.excludePattern.addition||null===e.excludePattern.addition||"object"!=typeof e.excludePattern.addition)return console.log("Assistant's Affix Database must contain an object property called 'addition' inside 'excludePattern'"),!1;if(e.excludePattern.addition.filter(e=>void 0===e||null===e||!("string"==typeof e||"object"==typeof e&&void 0!==e.length&&0==e.filter(e=>void 0===e||null===e||"string"!=typeof e).length)).length>0)return console.log("Assistant's Affix Database must only contain strings and/or list of strings inside 'excludePattern.addition'"),console.log(e.excludePattern.addition.filter(e=>void 0===e||null===e||!("string"==typeof e||"object"==typeof e&&void 0!==e.length&&0==e.filter(e=>void 0===e||null===e||"string"!=typeof e).length)).slice(0,10)),!1;if(void 0===e.excludePattern.select||null===e.excludePattern.select||"object"!=typeof e.excludePattern.select)return console.log("Assistant's Affix Database must contain an object property called 'select' inside 'excludePattern'"),!1;if(e.excludePattern.select.filter(e=>void 0===e||null===e||!("string"==typeof e||"object"==typeof e&&0==e.filter(e=>void 0===e||null===e||"string"!=typeof e).length)).length>0)return console.log("Assistant's Affix Database must only contain strings and/or list of strings inside 'excludePattern.select'"),console.log(e.excludePattern.select.filter(e=>void 0===e||null===e||!("string"==typeof e||"object"==typeof e&&0==e.filter(e=>void 0===e||null===e||"string"!=typeof e).length)).slice(0,10)),!1;if(void 0===e.extendAbility||null===e.extendAbility||"object"!=typeof e.extendAbility||void 0===e.extendAbility.length)return console.log("Assistant's Affix Database must contain a list property called 'extendAbility'"),!1;if(e.extendAbility.filter(e=>void 0===e||null===e||"object"!=typeof e).length>0)return console.log("Assistant's Affix Database must only contain objects inside 'extendAbility'"),console.log(e.extendAbility.filter(e=>void 0===e||null===e||"object"!=typeof e)),!1;if(e.extendAbility.filter(e=>void 0===e.base||null===e.base||"object"!=typeof e.base||void 0===e.base.length||e.base.filter(e=>void 0===e||null===e||"string"!=typeof e).length>0).length>0)return console.log("Assistant's Affix Database must contain a list of strings called 'base' for every item inside 'extendAbility'"),console.log(e.extendAbility.filter(e=>void 0===e.base||null===e.base||"object"!=typeof e.base||void 0===e.base.length||e.base.filter(e=>void 0===e||null===e||"string"!=typeof e)).slice(0,10)),!1;if(e.extendAbility.filter(e=>void 0===e.ref||null===e.ref||!("string"==typeof e.ref||"object"==typeof e.ref&&void 0!==e.ref.length&&0==e.ref.filter(e=>void 0===e||null===e||"string"!=typeof e).length)).length>0)return console.log("Assistant's Affix Database must contain a list of strings called 'base' or a string property called 'base' for every item inside 'extendAbility'"),console.log(e.extendAbility.filter(e=>void 0===e.ref||null===e.ref||!("string"==typeof e.ref||"object"==typeof e.ref&&void 0!==e.ref.length&&0==e.ref.filter(e=>void 0===e||null===e||"string"!=typeof e).length)).slice(0,10)),!1;if(e.extendAbility.filter(e=>void 0===e.success||null===e.success||"number"!=typeof e.success||e.success<0||e.success>100||!Number.isInteger(e.success)).length>0)return console.log("Assistant's Affix Database must contain an integer property ranging from 0 to 100 called 'success' for every item inside 'extendAbility'"),console.log(e.extendAbility.filter(e=>void 0===e.success||null===e.success||"number"!=typeof e.success||e.success<0||e.success>100||!Number.isInteger(e.success)).slice(0,10)),!1;if(void 0===e.extraSlot||null===e.extraSlot||"object"!=typeof e.extraSlot||void 0===e.extraSlot.length)return console.log("Assistant's Affix Database must contain a list property called 'extraSlot'"),!1;if(e.extraSlot.filter(e=>void 0===e||null===e||"object"!=typeof e).length>0)return console.log("Assistant's Affix Database must only contain objects inside 'extraSlot'"),console.log(e.extraSlot.filter(e=>void 0===e||null===e||"object"!=typeof e).slice(0,10)),!1;if(e.extraSlot.filter(e=>void 0===e.true||null===e.true||"number"!=typeof e.true||e.true<0||e.true>100||!Number.isInteger(e.true)).length>0)return console.log("Assistant's Affix Database must contain an integer property called 'true' ranging from 0 to 100 for every item inside 'extraSlot'"),console.log(e.extraSlot.filter(e=>void 0===e.true||null===e.true||"number"!=typeof e.true||e.true<0||e.true>100||!Number.isInteger(e.true)).slice(0,10)),!1;if(e.extraSlot.filter(e=>void 0===e.false||null===e.false||"number"!=typeof e.false||e.false<0||e.false>100||!Number.isInteger(e.false)).length>0)return console.log("Assistant's Affix Database must contain an integer property called 'false' ranging from 0 to 100 for every item inside 'extraSlot'"),console.log(e.extraSlot.filter(e=>void 0===e.false||null===e.false||"number"!=typeof e.false||e.false<0||e.false>100||!Number.isInteger(e.false)).slice(0,10)),!1;if(void 0===e.boostPoint||null===e.boostPoint||"object"!=typeof e.boostPoint)return console.log("Assistant's Affix Database must contain an object property called 'boostPoint'"),!1;if(void 0===e.sameBonusBoost||null===e.sameBonusBoost||"object"!=typeof e.sameBonusBoost||void 0===e.sameBonusBoost.length)return console.log("Assistant's Affix Database must contain a list property called 'sameBonusBoost'"),!1;if(e.sameBonusBoost.filter(e=>void 0===e||null===e||"number"!=typeof e).length>0)return console.log("Assistant's Affix Database must only contain float numbers inside 'sameBonusBoost'"),console.log(e.sameBonusBoost.filter(e=>void 0===e||null===e||"number"!=typeof e).slice(0,10)),!1;if(void 0===e.pairingExceptions||null===e.pairingExceptions||"object"!=typeof e.pairingExceptions)return console.log("Assistant's Affix Database must contain an object property called 'pairingExceptions'"),!1;if(void 0===e.pairingExceptions.strict||null===e.pairingExceptions.strict||"object"!=typeof e.pairingExceptions.strict)return console.log("Assistant's Affix Database must contain an object property called 'strict' inside 'pairingExceptions'"),!1;if(e.pairingExceptions.strict.filter(e=>void 0===e||null===e||"object"!=typeof e||void 0===e.length||e.filter(e=>void 0===e||null===e||"string"!=typeof e).length>0).length>0)return console.log("Assistant's Affix Database must only contain lists of strings inside 'pairingExceptions.strict'"),console.log(e.pairingExceptions.strict.filter(e=>void 0===e||"object"!=typeof e||null===e||void 0===e.length||e.filter(e=>void 0===e||null===e||"string"!=typeof e).length>0).slice(0,10)),!1;if(void 0===e.pairingExceptions.lenient||null===e.pairingExceptions.lenient||"object"!=typeof e.pairingExceptions.lenient)return console.log("Assistant's Affix Database must contain an object property called 'lenient' inside 'pairingExceptions'"),!1;if(e.pairingExceptions.lenient.filter(e=>void 0===e||null===e||"object"!=typeof e||void 0===e.length||e.filter(e=>void 0===e||null===e||"string"!=typeof e).length>0).length>0)return console.log("Assistant's Affix Database must only contain lists of strings inside 'pairingExceptions.lenient'"),console.log(e.pairingExceptions.lenient.filter(e=>void 0===e||null===e||"object"!=typeof e||void 0===e.length||e.filter(e=>void 0===e||null===e||"string"!=typeof e).length>0).slice(0,10)),!1;if(void 0===e.abilityList||null===e.abilityList||"object"!=typeof e.abilityList||void 0===e.abilityList.length)return console.log("Assistant's Affix Database must contain a list property called 'abilityList'"),!1;if(e.abilityList.filter(e=>void 0===e||null===e||"object"!=typeof e).length>0)return console.log("Assistant's Affix Database must only contain objects inside 'abilityList'"),console.log(e.abilityList.filter(e=>void 0===e||null===e||"object"!=typeof e).slice(0,10)),!1;if(e.abilityList.filter(e=>void 0===e.code||null===e.code||"string"!=typeof e.code).length>0)return console.log("Assistant's Affix Database must contain a string property called 'code' for every item inside 'abilityList'"),console.log(e.abilityList.filter(e=>void 0===e.code||null===e.code||"string"!=typeof e.code).slice(0,10)),!1;if(e.abilityList.filter(e=>void 0===e.name||null===e.name||"string"!=typeof e.name).length>0)return console.log("Assistant's Affix Database must contain a string property called 'name' for every item inside 'abilityList'"),console.log(e.abilityList.filter(e=>void 0===e.name||null===e.name||"string"!=typeof e.name).slice(0,10)),!1;if(e.abilityList.filter(e=>void 0===e.effect||null===e.effect||"string"!=typeof e.effect).length>0)return console.log("Assistant's Affix Database must contain a string property called 'effect' for every item inside 'abilityList'"),console.log(e.abilityList.filter(e=>void 0===e.effect||null===e.effect||"string"!=typeof e.effect).slice(0,10)),!1;if(void 0===e.abilityFactor||"object"!=typeof e.abilityFactor)return console.log("Assistant's Affix Database must contain an object property called 'abilityFactor'"),!1;if(e.abilityFactor.filter(e=>void 0===e.name||null===e.name||"string"!=typeof e.name).length>0)return console.log("Assistant's Affix Database must contain a string property called 'name' for every item inside 'abilityFactor'"),console.log(e.abilityFactor.filter(e=>void 0===e.name||null===e.name||"string"!=typeof e.name).slice(0,10)),!1;var i=O(e.optionList.support,1);if((l=i.map(e=>e.ref).sort((e,t)=>e-t)).filter(e=>"number"!=typeof e).length>0)return console.log("Assistant's Affix Database must contain a numeric property called 'ref' for every item in 'optionList.support'"),console.log(i.filter(e=>void 0===e.ref||null===e.ref||"number"!=typeof e.ref).slice(0,10)),!1;if(l.length>0&&0!=l[0])return console.log("Assistant's Affix Database must contain a starting item with a ref value of 0 in 'optionList.support'"),console.log(i.filter(e=>e.ref===l[0]).slice(0,10)),!1;if(l.length!==new Set(l).size){console.log("Assistant's Affix Database must not contain duplicate refs in 'optionList.support', but contained duplicate refs.");let e=[];for(var n=1;n<l.length;n++){let t=l[n-1],i=l[n];t!=i||e.includes(i)||e.push(i)}return console.log(e),console.log(i.filter(t=>e.includes(t.ref)).slice(0,10)),!1}for(n=1;n<l.length;n++){let e=l[n-1],t=l[n];if(t-e!=1)return console.log("Assistant's Affix Database must not skip refs in 'optionList.support', but skipped ref "+(e+1)),console.log("... "+e+" .. ("+(e+1)+"?) .. "+t+" ..."),!1}var o=O(e.optionList.potential,1);if((l=o.map(e=>e.ref).sort((e,t)=>e-t)).filter(e=>"number"!=typeof e).length>0)return console.log("Assistant's Affix Database must contain a numeric property called 'ref' for every item in 'optionList.potential'"),console.log(o.filter(e=>void 0===e.ref||"number"!=typeof e.ref).slice(0,10)),!1;if(l.length>0&&0!=l[0])return console.log("Assistant's Affix Database must contain a starting item with a ref value of 0 in 'optionList.potential'"),console.log(o.filter(e=>e.ref===l[0]).slice(0,10)),!1;if(l.length!==new Set(l).size){console.log("Assistant's Affix Database must not contain duplicate refs in 'optionList.potential', but contained duplicate refs.");let e=[];for(n=1;n<l.length;n++){let t=l[n-1],i=l[n];t!=i||e.includes(i)||e.push(i)}return console.log(e),console.log(o.filter(t=>e.includes(t.ref)).slice(0,10)),!1}for(n=1;n<l.length;n++){let e=l[n-1],t=l[n];if(t-e!=1)return console.log("Assistant's Affix Database must not skip refs in 'optionList.potential', but skipped ref "+(e+1)),console.log("... "+e+" .. ("+(e+1)+"?) .. "+t+" ..."),!1}var l,a=O(e.abilityList,1);if((l=a.map(e=>e.ref).sort((e,t)=>e-t)).filter(e=>"number"!=typeof e).length>0)return console.log("Assistant's Affix Database must contain a numeric property called 'ref' for every item in 'abilityList'"),console.log(a.filter(e=>void 0===e.ref||null===e.ref||"number"!=typeof e.ref).slice(0,10)),!1;if(l.length>0&&0!=l[0])return console.log("Assistant's Affix Database must contain a starting item with a ref value of 0 in 'abilityList'"),console.log(a.filter(e=>e.ref===l[0]).slice(0,10)),!1;if(l.length!==new Set(l).size){console.log("Assistant's Affix Database must not contain duplicate refs in 'abilityList', but contained duplicate refs.");let e=[];for(n=1;n<l.length;n++){let t=l[n-1],i=l[n];t!=i||e.includes(i)||e.push(i)}return console.log(e),console.log(a.filter(t=>e.includes(t.ref)).slice(0,10)),!1}let s=a.map(e=>e.code).sort();if(s.length!==new Set(s).size){console.log("Assistant's Affix Database must not contain duplicate codes in 'abilityList', but contained the following:");let e=[];for(n=1;n<s.length;n++){let t=s[n-1],i=s[n];t!=i||e.includes(i)||e.push(i)}return console.log(e),console.log(a.filter(t=>t.simCode?e.includes(t.simCode):e.includes(t.code)).slice(0,10)),!1}for(n=1;n<l.length;n++){let e=l[n-1],t=l[n];if(!f.deadRefs.includes(e+1)&&t-e!=1)return console.log("Assistant's Affix Database must not skip refs in 'abilityList', but skipped ref "+(e+1)),console.log("... "+e+" .. ("+(e+1)+"?) .. "+t+" ..."),!1}var r=O(e.optionList.additional,1),d=r.filter(e=>"Nothing"!==e.id).map(e=>e.ref).sort((e,t)=>e-t);if(d.filter(e=>"number"!=typeof e).length>0)return console.log("Assistant's Affix Database must contain a numeric property called 'ref' for every item (except for the item with id 'Nothing') in 'optionList.additional'"),console.log(r.filter(e=>void 0===e.ref||null===e.ref||"number"!=typeof e.ref).slice(0,10)),!1;if(d.length!==new Set(d).size){console.log("Assistant's Affix Database must not contain duplicate refs in 'optionList.additional', but contained duplicate refs.");let e=[];for(n=1;n<d.length;n++){let t=d[n-1],i=d[n];t!=i||e.includes(i)||e.push(i)}return console.log(e),console.log(r.filter(t=>e.includes(t.ref)).slice(0,10)),!1}for(var n in d){if(!l.includes(d[n]))return console.log("Assistant's Affix Database must not contain a ref in 'optionList.additional' that does not match any ref in 'abilityList', but contains ref "+d[n]),!1;let e=a.filter(e=>e.ref==d[n])[0],t=r.filter(e=>e.ref==d[n])[0];if(e.name!==t.name)return console.log("Assistant's Affix Database must not contain a ref in 'optionList.additional' that does not match the name of the item with the matching ref in 'abilityList'"),console.log("ref: "+d[n]+"; "+e.name+" != "+t.name),!1}if(void 0===e.abilityFactor||null===e.abilityFactor||"object"!=typeof e.abilityFactor||void 0===e.abilityFactor.length||null===e.abilityFactor.length||"number"!=typeof e.abilityFactor.length)return console.log("Assistant's Affix Database must contain a list property called 'abilityFactor'"),!1;if(e.abilityFactor.filter(e=>void 0===e||null===e||"object"!=typeof e||void 0===e.name||null===e.name||"string"!=typeof e.name||0==e.name.length).length>0)return console.log("Assistant's Affix Database must contain only contain objects with string property 'name' in 'abilityFactor',but contained:"),console.log(e.abilityFactor.filter(e=>void 0===e||null===e||"object"!=typeof e||void 0===e.name||null===e.name||"string"!=typeof e.name||0==e.name.length).slice(0,10)),!1;for(var n in e.abilityFactor){let t=e.abilityFactor[n].name;if(0==a.filter(e=>e.name==t).length)return console.log("Assistant's Affix Database must contain an ability in 'abilityList' with matching name for every item name in 'abilityFactor', but did not contain: "+t),!1}if(void 0===t||null===t||"object"!=typeof t)return console.log("Assistant's Affix Database must contain a localizable language data structure named 'lang'"),!1;if(void 0===t.support||null===t.support||"object"!=typeof t.support)return console.log("Assistant's Affix Database must contain an object property called 'support' in the localizable language data structure 'lang'"),!1;if(void 0===t.additional||null===t.additional||"object"!=typeof t.additional)return console.log("Assistant's Affix Database must contain an object property called 'additional' in the localizable language data structure 'lang'"),!1;if(void 0===t.potential||null===t.potential||"object"!=typeof t.potential)return console.log("Assistant's Affix Database must contain an object property called 'potential' in the localizable language data structure 'lang'"),!1;let c=["support","additional","potential"];if(Object.keys(t).filter(e=>!(f.internalLangKeys.includes(e)||c.includes(e)||void 0!==t[e]&&null!==t[e]&&"object"==typeof t[e]&&void 0!==t[e].name_en&&null!==t[e].name_en&&"string"==typeof t[e].name_en&&void 0!==t[e].name_jp&&null!==t[e].name_jp&&"string"==typeof t[e].name_jp&&void 0!==t[e].effect_en&&null!==t[e].effect_en&&"string"==typeof t[e].effect_en&&void 0!==t[e].effect_jp&&null!==t[e].effect_jp&&"string"==typeof t[e].effect_jp)).length>0)return console.log("Assistant's Affix Database must only contain object properties in 'lang' named 'app', 'filters', 'statsDisplayOrder', 'synonyms', 'support', 'additional', 'potential', and any other property must follow the format:\n \"{{ability_code}}\": {\n name_en: \"{{ability_name_as_in_affixData_abilityList_code}}\",\n name_jp: \"{{ability_name_in_japanese}}\",\n effect_en: \"{{ability_effect_in_english}}\",\n effect_jp: \"{{ability_effect_in_japanese}}\"\n }\nBut contained the following items:"),console.log(Object.keys(t).filter(e=>!(f.internalLangKeys.includes(e)||c.includes(e)||void 0!==t[e]&&null!==t[e]&&"object"==typeof t[e]&&void 0!==t[e].name_en&&null!==t[e].name_en&&"object"==typeof t[e].name_en&&void 0!==t[e].name_jp&&null!==t[e].name_jp&&"object"==typeof t[e].name_jp&&void 0!==t[e].effect_en&&null!==t[e].effect_en&&"object"==typeof t[e].effect_en&&void 0!==t[e].effect_jp&&null!==t[e].effect_jp&&"object"==typeof t[e].effect_jp)).slice(0,10)),!1;if(Object.keys(t.support).filter(e=>void 0===t.support[e]||null===t.support[e]||"object"!=typeof t.support[e]||void 0===t.support[e].en||null===t.support[e].en||"string"!=typeof t.support[e].en||void 0===t.support[e].jp||null===t.support[e].jp||"string"!=typeof t.support[e].jp).length>0)return console.log('Assistant\'s Affix Database must only contain object properties in \'lang.support\' in the following format:\n "{{support_item_id_as_in_affixData_optionList_support_id}}": {\n en: "{{support_item_id_in_english}}",\n jp: "{{support_item_id_in_japanese}}"\n },\nBut contained the following items:'),console.log(Object.keys(t.support).filter(e=>void 0===t.support[e]||null===t.support[e]||"object"!=typeof t.support[e]||void 0===t.support[e].en||null===t.support[e].en||"string"!=typeof t.support[e].en||void 0===t.support[e].jp||null===t.support[e].jp||"string"!=typeof t.support[e].jp).slice(0,10)),!1;if(Object.keys(t.additional).filter(e=>void 0===t.additional[e]||null===t.additional[e]||"object"!=typeof t.additional[e]||void 0===t.additional[e].en||null===t.additional[e].en||"string"!=typeof t.additional[e].en||void 0===t.additional[e].jp||null===t.additional[e].jp||"string"!=typeof t.additional[e].jp).length>0)return console.log('Assistant\'s Affix Database must only contain object properties in \'lang.additional\' in the following format:\n "{{add_ability_id_as_in_affixData_optionList_additional_id}}": {\n en: "{{add_ability_id_in_english}}",\n jp: "{{add_ability_id_in_japanese}}"\n },\nBut contained the following items:'),console.log(Object.keys(t.additional).filter(e=>void 0===t.additional[e]||null===t.additional[e]||"object"!=typeof t.additional[e]||void 0===t.additional[e].en||null===t.additional[e].en||"string"!=typeof t.additional[e].en||void 0===t.additional[e].jp||null===t.additional[e].jp||"string"!=typeof t.additional[e].jp).slice(0,10)),!1;if(Object.keys(t.potential).filter(e=>void 0===t.potential[e]||null===t.potential[e]||"object"!=typeof t.potential[e]||void 0===t.potential[e].en||null===t.potential[e].en||"string"!=typeof t.potential[e].en||void 0===t.potential[e].jp||null===t.potential[e].jp||"string"!=typeof t.potential[e].jp).length>0)return console.log('Assistant\'s Affix Database must only contain object properties in \'lang.potential\' in the following format:\n "{{potential_id_as_in_affixData_optionList_potential_id}}": {\n en: "{{potential_id_in_english}}",\n jp: "{{potential_id_in_japanese}}"\n },\nBut contained the following items:'),console.log(Object.keys(t.potential).filter(e=>void 0===t.potential[e]||null===t.potential[e]||"object"!=typeof t.potential[e]||void 0===t.potential[e].en||null===t.potential[e].en||"string"!=typeof t.potential[e].en||void 0===t.potential[e].jp||null===t.potential[e].jp||"string"!=typeof t.potential[e].jp).slice(0,10)),!1;var u;if((u=a.filter(e=>{let i=t[e.code];return void 0===i||null===i||"object"!=typeof i||void 0===i.name_en||null===i.name_en||"string"!=typeof i.name_en||0==i.name_en.length||i.name_en!=e.name||void 0===i.name_jp||null===i.name_jp||"string"!=typeof i.name_jp||0==i.name_jp.length||void 0===i.effect_en||null===i.effect_en||"string"!=typeof i.effect_en||0==i.effect_en.length||void 0===i.effect_jp||null===i.effect_jp||"string"!=typeof i.effect_jp||0==i.effect_jp.length})).length>0){console.log('Assistant\'s Affix Database must contain a localizable object in \'lang\' for every ability code in \'abilityList\' in the following format:\n "{{ability_code}}": {\n name_en: "{{ability_name_as_in_affixData_abilityList_code}}",\n name_jp: "{{ability_name_in_japanese}}",\n effect_en: "{{ability_effect_in_english}}",\n effect_jp: "{{ability_effect_in_japanese}}"\n }\nBut did not contain one for the following items:'),console.log(u);var p={};return u.forEach(e=>{p[e.code]={name_en:e.name,name_jp:"{{ability_name_in_japanese}}",effect_en:e.effect,effect_jp:"{{ability_effect_in_japanese}}"}}),console.log("Include and complete the following in 'lang':"),console.log(p),!1}if((u=i.filter(e=>{let i=t.support[e.id];return void 0===i||null===i||"object"!=typeof i||void 0===i.en||null===i.en||"string"!=typeof i.en||0==i.en.length||i.en!=e.id||void 0===i.jp||null===i.jp||"string"!=typeof i.jp||0==i.jp.length})).length>0){console.log('Assistant\'s Affix Database must contain a localizable object in \'lang.support\' for every Support Item id in \'optionList.support\' in the following format:\n "{{support_item_id_as_in_affixData_optionList_support_id}}": {\n en: "{{support_item_id_in_english}}",\n jp: "{{support_item_id_in_japanese}}"\n },\nBut did not contain one for the following items:'),console.log(u);p={};return u.forEach(e=>{p[e.id]={en:e.id,jp:"{{support_item_id_in_japanese}}"}}),console.log("Include and complete the following in 'lang.support':"),console.log(p),!1}if((u=r.filter(e=>{let i=t.additional[e.id];return void 0===i||null===i||"object"!=typeof i||void 0===i.en||null===i.en||"string"!=typeof i.en||0==i.en.length||i.en!=e.id||void 0===i.jp||null===i.jp||"string"!=typeof i.jp||0==i.jp.length})).length>0){console.log('Assistant\'s Affix Database must contain a localizable object in \'lang.additional\' for every Add Ability Item id in \'optionList.additional\' in the following format:\n "{{add_ability_id_as_in_affixData_optionList_additional_id}}": {\n en: "{{add_ability_id_in_english}}",\n jp: "{{add_ability_id_in_japanese}}"\n },\nBut did not contain one for the following items:'),console.log(u);p={};return u.forEach(e=>{p[e.id]={en:e.id,jp:"{{add_ability_id_in_japanese}}"}}),console.log("Include and complete the following in 'lang.additional':"),console.log(p),!1}if((u=o.filter(e=>{let i=t.potential[e.id];return void 0===i||null===i||"object"!=typeof i||void 0===i.en||null===i.en||"string"!=typeof i.en||0==i.en.length||i.en!=e.id||void 0===i.jp||null===i.jp||"string"!=typeof i.jp||0==i.jp.length})).length>0)return console.log('Assistant\'s Affix Database must contain a localizable object in \'lang.potential\' for every Potential id in \'optionList.potential\' in the following format:\n "{{potential_id_as_in_affixData_optionList_potential_id}}": {\n en: "{{potential_id_in_english}}",\n jp: "{{pontential_id_in_japanese}}"\n },\nBut did not contain one for the following items:'),console.log(u),!1;let g=[],m=[],h=[],y=[];for(var b in t)if(!f.internalLangKeys.includes(b))if("support"!==b)if("additional"!==b)if("potential"!==b)0==a.filter(e=>e.code==b).length&&y.push(b);else for(var v in t[b])0==o.filter(e=>e.id==v).length&&h.push(v);else for(var v in t[b])0==r.filter(e=>e.id==v).length&&m.push(v);else for(var v in t[b])0==i.filter(e=>e.id==v).length&&g.push(v);return g.length>0?(console.log("Assistant's Affix Database must not contain a localizable language object in 'lang.support' for a Support Item id not listed in 'optionList.support', but contained the following:"),console.log(g),!1):m.length>0?(console.log("Assistant's Affix Database must not contain a localizable language object in 'lang.additional' for an Add Ability Item id not listed in 'optionList.additional', but contained the following:"),console.log(m),!1):h.length>0?(console.log("Assistant's Affix Database must not contain a localizable language object in 'lang.potential' for a Potential id not listed in 'optionList.potential', but contained the following:"),console.log(h),!1):!(y.length>0)||(console.log("Assistant's Affix Database must not contain a localizable language object in 'lang' for an ability code not listed in 'abilityList', but contained the following:"),console.log(y),!1)}function O(e,t,i,n){let o=!0;if(void 0!==n&&(o=!1),n=n||[],(i=i||0)<=t&&void 0!==e&&"object"==typeof e)for(var l in o||n.push(e),i++,e)e.hasOwnProperty(l)&&O(e[l],t,i,n);return n}String.prototype.format=String.prototype.format||function(){"use strict";var e=this.toString();if(arguments.length){var t,i=typeof arguments[0],n="string"===i||"number"===i?Array.prototype.slice.call(arguments):arguments[0];for(t in n)e=e.replace(new RegExp("\\{"+t+"\\}","gi"),()=>n[t])}return e};class D{constructor(){this.processesOngoing=0,this._notify=(()=>{})}enter(){this.processesOngoing++}leave(){this.processesOngoing--,this.processesOngoing<=0&&this._notify()}notify(e){this._notify=e}}