parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"tQUs":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=e=>parseInt(new URLSearchParams(e).get("id"));exports.default=e;
},{}],"dSAr":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=t(require("../utils/getIDFromURL"));function t(e){return e&&e.__esModule?e:{default:e}}class r{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.dom=(new DOMParser).parseFromString(e,"text/html"),this.trs=this.dom.querySelectorAll("#in_a_day_ranking_table tbody tr"),this.filters=t}isValidRow(e){return!!e&&((!this.filters.playerID||e.playerID===this.filters.playerID)&&!(this.filters.tribes&&Array.isArray(this.filters.tribes)&&!this.filters.tribes.some(t=>t===e.tribe)))}parseRow(t){if(!t||!t instanceof HTMLTableRowElement)return;let r={};return r.rank=parseInt(t.children[0].innerText.trim()),r.name=t.children[1].innerText.trim(),r.playerID=(0,e.default)(t.children[1].querySelector("a").getAttribute("href")),r.tribe=t.children[2].innerText.trim(),r.tribeID=0,r.tribe&&(r.tribeID=(0,e.default)(t.children[2].querySelector("a").getAttribute("href"))),r.score=parseInt(t.children[3].innerText.trim().replace(/\./g,"")),r.date=t.children[4].innerText.trim(),r}parse(){const e=[];for(let t=1;t<this.trs.length;t++){const r=this.trs[t],i=this.parseRow(r);this.isValidRow(i)&&e.push(i)}return e}}exports.default=r;
},{"../utils/getIDFromURL":"tQUs"}],"hPka":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const e={pl_PL:{addTribe:"Dodaj plemię",generate:"Wygeneruj",delete:"Usuń",player:"Gracz",tribe:"Plemię",rank:"Ranking",score:"Wynik",date:"Data",loaded:"Załadowano"},en_DK:{addTribe:"Add tribe",generate:"Generate",delete:"Delete",player:"Player",tribe:"Tribe",rank:"Rank",score:"Score",date:"Date",loaded:"Loaded"}};var a=()=>e[window.game_data.locale]||e.en_DK;exports.default=a;
},{}],"oUdd":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=e=>new Promise(t=>setTimeout(t,e));exports.default=e;
},{}],"s4G3":[function(require,module,exports) {
"use strict";var e=a(require("./libs/InADayParser")),t=a(require("./i18n/inADayTribeRankingGenerator")),n=a(require("./utils/wait"));function a(e){return e&&e.__esModule?e:{default:e}}const r="iad_tribes",c="iad_limit",i=(0,t.default)(),o=()=>{const e=document.querySelector("#iad_tribes"),t=document.createElement("div");t.innerHTML="\n        <label>".concat(i.tribe,': </label>\n        <input type="text" required />\n        <button type="button">').concat(i.delete,"</button>\n    "),t.querySelector("button").addEventListener("click",()=>{e.children.length>1&&t.remove()}),e.appendChild(t)},l=async t=>{t.preventDefault();const a=parseInt(document.querySelector("#iad_limit").value),r=[],c=new URLSearchParams(window.location.search).get("type")||"kill_att";document.querySelectorAll("#iad_tribes input").forEach(e=>{e.value&&r.push(e.value.trim())});let o=[],l=0;for(;o.length<a;){Dialog.show("iad_loading","".concat(i.loaded,": <strong>").concat(o.length,"/").concat(a,"</strong>"));try{const t=await fetch(TribalWars.buildURL("",{screen:"ranking",mode:"in_a_day",type:c,offset:25*l})),a=await t.text(),i=new e.default(a,{tribes:r});if(26!==i.trs.length)break;o=[...o,...i.parse()],l++,await(0,n.default)(200)}catch(d){break}}o.length>a&&(o=o.slice(0,a)),Dialog.show("iad_result","\n    <textarea cols=30 rows=8 readonly>[table]\n[**][||]".concat(i.player,"[||]").concat(i.tribe,"[||]").concat(i.rank,"[||]").concat(i.score,"[||]").concat(i.date,"[/**]\n").concat(o.map((e,t)=>"[*]".concat(t+1,".[|][player]").concat(e.name,"[/player][|][ally]").concat(e.tribe,"[/ally][|]").concat(e.rank,"[|]").concat(e.score.toLocaleString(),"[|]").concat(e.date)).join("\n"),"\n[/table]</textarea>\n  "))},d=()=>{const e=document.createElement("div"),t='\n    <form>\n        <div id="'.concat("iad_tribes",'">\n        </div>\n        <div>\n            <label>Limit: </label>\n            <input id="').concat("iad_limit",'" type="number" min="1" value="10" required />\n        </div>\n        <button type="submit">').concat(i.generate,'</button>\n        <button id="').concat("iad_add",'" type="button">').concat(i.addTribe,"</button>\n    </form>\n  ");e.innerHTML=t,document.querySelector("#content_value > table > tbody > tr > td:nth-child(2)").prepend(e),e.querySelector("form").addEventListener("submit",l),e.querySelector("#iad_add").addEventListener("click",o),o()};!function(){try{d()}catch(e){console.log("'In A Day' Tribe Ranking Generator",e)}}();
},{"./libs/InADayParser":"dSAr","./i18n/inADayTribeRankingGenerator":"hPka","./utils/wait":"oUdd"}]},{},["s4G3"], null)