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}({"kK6Q":[function(require,module,exports) {
"use strict";function e(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
},{}],"KYJg":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=r;var e=t(require("../_lib/requiredArgs/index.js"));function t(e){return e&&e.__esModule?e:{default:e}}function r(t){(0,e.default)(1,arguments);var r=Object.prototype.toString.call(t);return t instanceof Date||"object"==typeof t&&"[object Date]"===r?new Date(t.getTime()):"number"==typeof t||"[object Number]"===r?new Date(t):("string"!=typeof t&&"[object String]"!==r||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}
},{"../_lib/requiredArgs/index.js":"kK6Q"}],"aFbL":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=r;var e=6e4;function t(t){return t.getTime()%e}function r(r){var n=new Date(r.getTime()),i=Math.ceil(n.getTimezoneOffset());n.setSeconds(0,0);var o=i>0?(e+t(n))%e:t(n);return i*e+o}
},{}],"DgmM":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=u;var e=t(require("../toDate/index.js")),r=t(require("../_lib/requiredArgs/index.js"));function t(e){return e&&e.__esModule?e:{default:e}}function u(t){(0,r.default)(1,arguments);var u=(0,e.default)(t);return u.setHours(0,0,0,0),u}
},{"../toDate/index.js":"KYJg","../_lib/requiredArgs/index.js":"kK6Q"}],"ieRm":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=d;var e=u(require("../_lib/getTimezoneOffsetInMilliseconds/index.js")),t=u(require("../startOfDay/index.js")),r=u(require("../_lib/requiredArgs/index.js"));function u(e){return e&&e.__esModule?e:{default:e}}var i=864e5;function d(u,d){(0,r.default)(2,arguments);var a=(0,t.default)(u),l=(0,t.default)(d),n=a.getTime()-(0,e.default)(a),s=l.getTime()-(0,e.default)(l);return Math.round((n-s)/i)}
},{"../_lib/getTimezoneOffsetInMilliseconds/index.js":"aFbL","../startOfDay/index.js":"DgmM","../_lib/requiredArgs/index.js":"kK6Q"}],"mdVI":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=a;var e=u(require("../toDate/index.js")),t=u(require("../differenceInCalendarDays/index.js")),r=u(require("../_lib/requiredArgs/index.js"));function u(e){return e&&e.__esModule?e:{default:e}}function n(e,t){var r=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return r<0?-1:r>0?1:r}function a(u,a){(0,r.default)(2,arguments);var s=(0,e.default)(u),i=(0,e.default)(a),d=n(s,i),l=Math.abs((0,t.default)(s,i));s.setDate(s.getDate()-d*l);var o=d*(l-(n(s,i)===-d));return 0===o?0:o}
},{"../toDate/index.js":"KYJg","../differenceInCalendarDays/index.js":"ieRm","../_lib/requiredArgs/index.js":"kK6Q"}],"iFDG":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const e={pl_PL:{date:"Data",createdAt:"Data założenia",dominance:"Dominacja",bestRank:"Najlepszy ranking",mostPoints:"Najwięcej punktów",mostVillages:"Najwięcej wiosek",player:"Gracz",points:"Punkty",villages:"Wioski",opponentsDefeated:"Pokonani przeciwnicy",opponentsDefeatedAsAttacker:"Pokonani przeciwnicy jako agresor",opponentsDefeatedAsDefender:"Pokonani przeciwnicy jako obrońca",opponentsDefeatedAsSupporter:"Pokonani przeciwnicy jako wspierający",change:"Zmień",left:"Opuścił",joined:"Dołączył",tribeChanges:"Zmiany plemion",membersGrowth:"Rozwój graczy",act:"Akcja",total:"Razem",oda:"RA",odd:"RO",ods:"RW",od:"Pokonani ogólnie",dailyGrowth:"Dzienny przyrost",playerLinks:"Linki",action:{linkToTWHelp:"Akta plemienia (TWHelp)",showTribeChanges:"Pokaż zmiany plemion",showEnnoblements:"Pokaż przejęcia",showMembersGrowth:"Pokaż rozwój graczy",showHistory:"Pokaż historię",generateMailingList:"Wygeneruj listę mailingową",exportVillages:"Wyeksportuj wioski"}},en_DK:{date:"Date",createdAt:"Created at",dominance:"Dominance",bestRank:"Best rank",mostPoints:"Most points",mostVillages:"Most villages",player:"Player",points:"Points",villages:"Villages",opponentsDefeated:"Opponents defeated",opponentsDefeatedAsAttacker:"Opponents defeated as attacker",opponentsDefeatedAsDefender:"Opponents defeated as defender",opponentsDefeatedAsSupporter:"Opponents defeated as supporter",change:"Change",membersGrowth:"Members growth",tribeChanges:"Tribe changes",left:"Left",joined:"Joined",act:"Action",total:"Total",oda:"ODA",odd:"ODD",ods:"ODS",od:"OD",dailyGrowth:"Daily growth",playerLinks:"Player links",action:{linkToTWHelp:"Tribal file (TWHelp)",showTribeChanges:"Show tribe changes",showEnnoblements:"Show ennoblements",showMembersGrowth:"Show members growth",showHistory:"Show history",generateMailingList:"Generate mailing list",exportVillages:"Export villages"}}};var o=()=>e[window.game_data.locale]||e.en_DK;exports.default=o;
},{}],"Ph2E":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.API_URI=void 0;const e="https://api.tribalwarshelp.com/graphql";exports.API_URI=e;var r=function(){let{query:r,variables:t={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return fetch(e,{method:"POST",body:JSON.stringify({query:r,variables:t}),headers:{"Content-Type":"application/json"}}).then(e=>e.json()).then(e=>{let{data:r,errors:t}=e;if(t&&Array.isArray(t)&&t.length>0)throw new Error(t[0].message);return new Promise(e=>e(r))})};exports.default=r;
},{}],"fCHX":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.generatePaginationItems=exports.calcNumberOfPages=exports.getPage=exports.setPage=exports.getContainerStyles=void 0;const e="data-page",t=()=>"display: flex; flex-direction: row; flex-wrap: wrap;";exports.getContainerStyles=t;const r=function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(!t instanceof HTMLElement)throw new Error("Expected HTMLElement as the first argument");if("number"!=typeof(r=parseInt(r))||isNaN(r))throw new Error("Expected number or string as the second argument");t.setAttribute(e,r+"")};exports.setPage=r;const n=t=>!t instanceof HTMLElement?0:parseInt(t.getAttribute(e));exports.getPage=n;const o=(e,t)=>{if("number"!=typeof e)throw new Error("Expected number as the first argument");if("number"!=typeof t)throw new Error("Expected number as the second argument");return e>0?Math.ceil(e/t):1};exports.calcNumberOfPages=o;const a=function(){let{total:t,limit:r,marginRight:n=3,currentPage:a=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const s=o(t,r),c=[];for(let o=1;o<=s;o++)o===a?c.push('<strong style="margin-right: '.concat(n,'px">>').concat(o,"<</strong>")):c.push('<a style="margin-right: '.concat(n,'px" href="#" ').concat(e,'="').concat(o,'">').concat(o,"</a>"));return c};exports.generatePaginationItems=a;
},{}],"l9PO":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const a={pl_PL:{title:"Dzisiejsze zmiany w statystykach",points:"Punkty",rank:"Ranking",villages:"Liczba wiosek",members:"Liczba członków",oda:"Pokonani przeciwnicy jako agresor",odaRank:"RA",odd:"Pokonani przeciwnicy jako obrońca",oddRank:"RO",ods:"Pokonani przeciwnicy jako wspierający",odsRank:"RW",od:"Pokonani przeciwnicy",odRank:"Pokonani przeciwnicy razem ranking"},en_DK:{title:"Today's stat changes",points:"Points",rank:"Rank",villages:"Villages",members:"Members",oda:"ODA",odaRank:"ODA Rank",odd:"ODD",oddRank:"ODD Rank",ods:"ODS",odsRank:"ODS Rank",od:"OD",odRank:"OD Rank"}};var o=()=>a[window.game_data.locale]||a.en_DK;exports.default=o;
},{}],"yQib":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=e=>null==e;exports.default=e;
},{}],"yrCm":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=a(require("../i18n/renderTodaysStats")),n=a(require("../utils/isNil"));function a(t){return t&&t.__esModule?t:{default:t}}const c=(0,t.default)(),o=t=>{return t>0?"color: #000; background-color: #0f0":t<0?"color: #000; background-color: #f00":"color: #000; background-color: #808080"};var r=(t,a)=>{let r=t.querySelector("#todaysStats");r||((r=document.createElement("div")).id="todaysStats",r.width="100%",t.prepend(r));const d=!(0,n.default)(a.rankSup);r.innerHTML='\n      <table width="100%" class="vis">\n        <tbody>\n          <tr>\n            <th colspan="2">\n              '.concat(c.title,"\n            </th>\n          </tr>\n            <tr>\n              <td>\n                ").concat(c.points,':\n              </td>\n              <td style="').concat(o(a.points),'">\n                ').concat(Math.abs(a.points).toLocaleString(),"\n              </td>\n            </tr>\n            <tr>\n              <td>\n                ").concat(c.rank,':\n              </td>\n              <td style="').concat(o(a.rank),'">\n                ').concat(Math.abs(a.rank),"\n              </td>\n            </tr>\n            <tr>\n              <td>\n                ").concat(c.villages,':\n              </td>\n              <td style="').concat(o(a.villages),'">\n                ').concat(Math.abs(a.villages).toLocaleString(),"\n              </td>\n            </tr>\n            ").concat(d?"":"<tr>\n              <td>\n                ".concat(c.members,':\n              </td>\n              <td style="').concat(o(a.members),'">\n                ').concat(Math.abs(a.members),"\n              </td>\n            </tr>"),"\n            <tr>\n              <td>\n                ").concat(c.oda,':\n              </td>\n              <td style="').concat(o(a.scoreAtt),'">\n                ').concat(Math.abs(a.scoreAtt).toLocaleString(),"\n              </td>\n            </tr>\n            <tr>\n              <td>\n                ").concat(c.odaRank,':\n              </td>\n              <td style="').concat(o(a.rankAtt),'">\n                ').concat(Math.abs(a.rankAtt),"\n              </td>\n            </tr>\n            <tr>\n              <td>\n                ").concat(c.odd,':\n              </td>\n              <td style="').concat(o(a.scoreDef),'">\n                ').concat(Math.abs(a.scoreDef).toLocaleString(),"\n              </td>\n            </tr>\n            <tr>\n              <td>\n                ").concat(c.oddRank,':\n              </td>\n              <td style="').concat(o(a.rankDef),'">\n                ').concat(Math.abs(a.rankDef),"\n              </td>\n            </tr>\n            ").concat(d?"<tr>\n              <td>\n                ".concat(c.ods,':\n              </td>\n              <td style="').concat(o(a.scoreSup),'">\n                ').concat(Math.abs(a.scoreSup).toLocaleString(),"\n              </td>\n            </tr>\n            <tr>\n              <td>\n                ").concat(c.odsRank,':\n              </td>\n              <td style="').concat(o(a.rankSup),'">\n                ').concat(Math.abs(a.rankSup),"\n              </td>\n            </tr>"):"","\n            <tr>\n              <td>\n                ").concat(c.od,':\n              </td>\n              <td style="').concat(o(a.scoreTotal),'">\n                ').concat(Math.abs(a.scoreTotal).toLocaleString(),"\n              </td>\n            </tr>\n            <tr>\n              <td>\n                ").concat(c.odRank,':\n              </td>\n              <td style="').concat(o(a.rankTotal),'">\n                ').concat(Math.abs(a.rankTotal),"\n              </td>\n            </tr>\n      </tbody>\n      </table>\n  ")};exports.default=r;
},{"../i18n/renderTodaysStats":"l9PO","../utils/isNil":"yQib"}],"tKRp":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const e={pl_PL:{date:"Data",newOwner:"Nowy właściciel",oldOwner:"Poprzedni właściciel",village:"Wioska",title:"Przejęcia"},en_DK:{date:"Date",newOwner:"New owner",oldOwner:"Old owner",village:"Village",title:"Ennoblements"}};var l=()=>e[window.game_data.locale]||e.en_DK;exports.default=l;
},{}],"chDM":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.POPUP_SELECTOR=void 0;const t=".popup_box";exports.POPUP_SELECTOR=".popup_box";const o=function(){let{html:t,id:o,title:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Dialog.show(o,"<h3>".concat(e,"</h3>")+t);const p=document.querySelector(".popup_box");p&&(p.style.width="auto",p.style.maxWidth="1000px")};var e=o;exports.default=e;
},{}],"ZbyX":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.formatDate=exports.inUTC=exports.inTZ=void 0;const t=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"UTC";return new Date(new Date(t).toLocaleString("en-US",{timeZone:e}))};exports.inTZ=t;const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;return t(e)};exports.inUTC=e;const n=(t,e)=>new Date(t).toLocaleDateString(void 0,e||{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"});exports.formatDate=n;
},{}],"fHHP":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildImgURL=exports.calcAttackDuration=exports.buildVillageName=exports.buildVillageURL=exports.buildPlayerURL=exports.buildTribeURL=void 0;const i=i=>window.location.origin+TribalWars.buildURL("",{screen:"info_ally",id:i});exports.buildTribeURL=i;const o=i=>window.location.origin+TribalWars.buildURL("",{screen:"info_player",id:i});exports.buildPlayerURL=o;const e=i=>window.location.origin+TribalWars.buildURL("",{screen:"info_village",id:i});exports.buildVillageURL=e;const t=function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:500;const t="K"+String(e)[0]+String(o)[0];return"".concat(i," (").concat(o,"|").concat(e,") ").concat(t)};exports.buildVillageName=t;const l=(i,o)=>Math.round(i*o);exports.calcAttackDuration=l;const r=i=>image_base+i;exports.buildImgURL=r;
},{}],"vNT1":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=l(require("../i18n/showEnnoblementsPopup")),t=require("../utils/pagination"),n=l(require("../utils/showPopup")),r=require("../utils/date"),a=i(require("../utils/tribalwars"));function o(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return o=function(){return e},e}function i(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=o();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var i=r?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(n,a,i):n[a]=e[a]}return n.default=e,t&&t.set(e,n),n}function l(e){return e&&e.__esModule?e:{default:e}}const c="ennoblementsPagination",d=(0,e.default)(),u=(e,t)=>e?'<td><a href="'.concat(a.buildPlayerURL(e.id),'">').concat(e.name," (").concat(t?'<a href="'.concat(a.buildTribeURL(t.id),'">').concat(t.tag,"</a>"):"-",")</a></td>"):"<td>-</td>";var s=function(e,o){let{limit:i=0,currentPage:l=1,onPageChange:s=(()=>{})}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const f=(0,t.generatePaginationItems)({total:o.total,limit:i,currentPage:l}),p='\n    <div style="'.concat((0,t.getContainerStyles)(),'" id="').concat(c,'">\n      ').concat(f.join(""),'\n    </div>\n    <table class="vis" style="border-collapse: separate; border-spacing: 2px; width: 100%;">\n      <tbody>\n        <tr>\n          <th>\n            ').concat(d.date,"\n          </th>\n          <th>\n            ").concat(d.village,"\n          </th>\n          <th>\n            ").concat(d.newOwner,"\n          </th>\n          <th>\n            ").concat(d.oldOwner,"\n          </th>\n        </tr>\n        ").concat(o.items.map(e=>{let t="<tr>"+"<td>".concat((0,r.formatDate)(e.ennobledAt),"</td>");return e.village?t+='<td><a href="'.concat(a.buildVillageURL(e.village.id),'">').concat(a.buildVillageName(e.village.name,e.village.x,e.village.y),"</a></td>"):t+="<td>-</td>",t+=u(e.newOwner,e.newOwnerTribe),(t+=u(e.oldOwner,e.oldOwnerTribe))+"</tr>"}).join(""),"\n      </tbody>\n    </table>\n  ");(0,n.default)({e:e,title:d.title,id:"ennoblements",html:p}),document.querySelectorAll("#ennoblementsPagination a").forEach(e=>{e.addEventListener("click",s)})};exports.default=s;
},{"../i18n/showEnnoblementsPopup":"tKRp","../utils/pagination":"fCHX","../utils/showPopup":"chDM","../utils/date":"ZbyX","../utils/tribalwars":"fHHP"}],"VYL5":[function(require,module,exports) {
"use strict";function e(e){if(null===e||!0===e||!1===e)return NaN;var r=Number(e);return isNaN(r)?r:r<0?Math.ceil(r):Math.floor(r)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
},{}],"lQIY":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=a;var e=u(require("../_lib/toInteger/index.js")),t=u(require("../toDate/index.js")),r=u(require("../_lib/requiredArgs/index.js"));function u(e){return e&&e.__esModule?e:{default:e}}function a(u,a){(0,r.default)(2,arguments);var i=(0,t.default)(u),d=(0,e.default)(a);return isNaN(d)?new Date(NaN):d?(i.setDate(i.getDate()+d),i):i}
},{"../_lib/toInteger/index.js":"VYL5","../toDate/index.js":"KYJg","../_lib/requiredArgs/index.js":"kK6Q"}],"mRRL":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=d;var e=u(require("../_lib/toInteger/index.js")),r=u(require("../addDays/index.js")),t=u(require("../_lib/requiredArgs/index.js"));function u(e){return e&&e.__esModule?e:{default:e}}function d(u,d){(0,t.default)(2,arguments);var i=(0,e.default)(d);return(0,r.default)(u,-i)}
},{"../_lib/toInteger/index.js":"VYL5","../addDays/index.js":"lQIY","../_lib/requiredArgs/index.js":"kK6Q"}],"hNDe":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const e={pl_PL:{title:"Historia",date:"Data",tribe:"Plemię",points:"Punkty",rank:"Ranking",villages:"Liczba wiosek",members:"Liczba członków",oda:"Pokonani przeciwnicy jako agresor",odd:"Pokonani przeciwnicy jako obrońca",ods:"Pokonani przeciwnicy jako wspierający",od:"Pokonani przeciwnicy"},en_DK:{title:"History",date:"Date",tribe:"Tribe",points:"Points",villages:"Villages",members:"Members",oda:"ODA",odd:"ODD",ods:"ODS",od:"OD"}};var o=()=>e[window.game_data.locale]||e.en_DK;exports.default=o;
},{}],"kEDU":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=s(require("date-fns/subDays")),n=s(require("../i18n/showHistoryPopup")),e=s(require("../utils/showPopup")),o=require("../utils/pagination"),a=require("../utils/date"),r=i(require("../utils/tribalwars"));function c(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return c=function(){return t},t}function i(t){if(t&&t.__esModule)return t;if(null===t||"object"!=typeof t&&"function"!=typeof t)return{default:t};var n=c();if(n&&n.has(t))return n.get(t);var e={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){var r=o?Object.getOwnPropertyDescriptor(t,a):null;r&&(r.get||r.set)?Object.defineProperty(e,a,r):e[a]=t[a]}return e.default=t,n&&n.set(t,e),e}function s(t){return t&&t.__esModule?t:{default:t}}const l="historyPagination",d=(0,n.default)(),u=t=>t>0?"+"+t:t;var g=function(n,c,i){let{currentPage:s=1,limit:l=0,onPageChange:g=(()=>{}),tribe:f=!1}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const p=(0,o.generatePaginationItems)({total:c.total,limit:l,currentPage:s}),h='\n    <div style="'.concat((0,o.getContainerStyles)(),'" id="').concat("historyPagination",'">\n      ').concat(p.join(""),'\n    </div>\n    <table class="vis" style="border-collapse: separate; border-spacing: 2px; width: 100%;">\n      <tbody>\n        <tr>\n          <th>\n            ').concat(d.date,"\n          </th>\n          ").concat(f?"":"<th>".concat(d.tribe,"</th>"),"\n          <th>\n          ").concat(d.points,"\n          </th>\n          <th>\n          ").concat(d.villages,"\n          </th>\n          ").concat(f?"<th>".concat(d.members,"</th>"):"","\n          <th>\n            ").concat(d.od,"\n          </th>\n          <th>\n            ").concat(d.oda,"\n          </th>\n          <th>\n            ").concat(d.odd,"\n          </th>\n          ").concat(f?"":"<th>".concat(d.ods,"</th>"),"\n        </tr>\n        ").concat(c.items.map(n=>{const e=(0,t.default)(new Date(n.createDate),1).toISOString().split(".")[0]+"Z",o=i.items.find(t=>t.createDate===e);let c="<tr>"+"<td>".concat((0,a.formatDate)(n.createDate,{year:"numeric",month:"2-digit",day:"2-digit"}),"</td>");return!f&&n.tribe?c+='<td><a href="'.concat(r.buildTribeURL(n.tribe.id),'">').concat(n.tribe.tag,"</a></td>"):f||(c+="<td>-</td>"),c+='\n              <td title="'.concat(o?u(o.points):"",'">\n                ').concat(n.points.toLocaleString()," (<strong>").concat(n.rank,'</strong>)\n              </td>\n              <td title="').concat(o?u(o.villages):"",'">\n                ').concat(n.totalVillages.toLocaleString(),"\n              </td>\n              ").concat(f?'\n                  <td title="'.concat(o?u(o.members):"",'">\n                    ').concat(n.totalMembers,"\n                </td>\n              "):"",'\n              <td title="').concat(o?u(o.scoreTotal):"",'">\n                ').concat(n.scoreTotal.toLocaleString()," (<strong>").concat(n.rankTotal,'</strong>)\n              </td>\n              <td title="').concat(o?u(o.scoreAtt):"",'">\n                ').concat(n.scoreAtt.toLocaleString()," (<strong>").concat(n.rankAtt,'</strong>)\n              </td>\n              <td title="').concat(o?u(o.scoreDef):"",'">\n                ').concat(n.scoreDef.toLocaleString()," (<strong>").concat(n.rankDef,"</strong>)\n              </td>\n              ").concat(f?"":'\n                  <td title="'.concat(o?u(o.scoreSup):"",'">\n                    ').concat(n.scoreSup.toLocaleString()," (<strong>").concat(n.rankSup,"</strong>)\n                </td>\n              "),"\n            ")+"</tr>"}).join(""),"\n      </tbody>\n    </table>\n  ");(0,e.default)({e:n,title:d.title,id:"history",html:h}),document.querySelectorAll("#historyPagination a").forEach(t=>{t.addEventListener("click",g)})};exports.default=g;
},{"date-fns/subDays":"mRRL","../i18n/showHistoryPopup":"hNDe","../utils/showPopup":"chDM","../utils/pagination":"fCHX","../utils/date":"ZbyX","../utils/tribalwars":"fHHP"}],"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;
},{}],"DMkL":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=()=>window.location.host.split(".")[0];exports.default=e;
},{}],"KWxH":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.setItem=exports.getItem=void 0;const e=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const o=localStorage.getItem(e);let s=t;return o&&(s=JSON.parse(o)),s};exports.getItem=e;const t=(e,t)=>{localStorage.setItem(e,JSON.stringify(t))};exports.setItem=t;
},{}],"J1Ly":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").substr(0,2)};exports.default=e;
},{}],"Syko":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildPlayerURL=void 0;const t=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"http://www.twstats.com/in/".concat(t,"/player/").concat(e)};exports.buildPlayerURL=t;
},{}],"gvXE":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildVillageURL=exports.buildTribeURL=exports.buildPlayerURL=exports.buildURLToProfile=exports.buildURLToServerPage=exports.BASE_URL=void 0;const e="tribalwarshelp.com";exports.BASE_URL=e;const t=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return"https://".concat(t,".").concat(e,"/server/").concat(o)};exports.buildURLToServerPage=t;const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return"".concat(t(e,o),"/").concat(n,"/").concat(l)};exports.buildURLToProfile=o;const l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return o(e,t,l,"player")};exports.buildPlayerURL=l;const n=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return o(e,t,l,"tribe")};exports.buildTribeURL=n;const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return o(e,t,l,"village")};exports.buildVillageURL=i;
},{}],"r4nF":[function(require,module,exports) {
"use strict";var e=h(require("date-fns/differenceInDays")),t=h(require("./i18n/extendedTribeProfile")),n=h(require("./libs/requestCreator")),r=require("./utils/pagination"),a=h(require("./common/renderTodaysStats")),i=h(require("./common/showEnnoblementsPopup")),o=h(require("./common/showHistoryPopup")),l=h(require("./utils/showPopup")),s=h(require("./utils/getIDFromURL")),c=h(require("./utils/getCurrentServer")),d=require("./utils/localStorage"),u=require("./utils/date"),f=h(require("./utils/getServerVersionCode")),m=g(require("./utils/twstats")),b=g(require("./utils/twhelp")),p=g(require("./utils/tribalwars"));function y(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return y=function(){return e},e}function g(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=y();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var i=r?Object.getOwnPropertyDescriptor(e,a):null;i&&(i.get||i.set)?Object.defineProperty(n,a,i):n[a]=e[a]}return n.default=e,t&&t.set(e,n),n}function h(e){return e&&e.__esModule?e:{default:e}}function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function S(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach(function(t){D(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const T=(0,c.default)(),w=(0,f.default)(T),$=(0,s.default)(window.location.search),E="kichiyaki_extended_tribe_profile"+$,q="\n    query tribe($server: String!, $id: Int!, $dailyTribeStatsSort: [String!], $dailyTribeStatsLimit: Int, $playerSort: [String!], $playerFilter: PlayerFilter!, $dailyTribeStatsFilter: DailyTribeStatsFilter!) {\n        tribe(server: $server, id: $id) {\n            id\n            bestRank\n            bestRankAt\n            mostPoints\n            mostPointsAt\n            mostVillages\n            mostVillagesAt\n            createdAt\n            dominance\n        }\n        dailyTribeStats(server: $server, limit: $dailyTribeStatsLimit, sort: $dailyTribeStatsSort, filter: $dailyTribeStatsFilter) {\n          items {\n            rank\n            rankAtt\n            rankDef\n            rankTotal\n            points\n            scoreAtt\n            scoreAtt\n            scoreDef\n            scoreTotal\n            villages\n            members\n          }\n        }\n        players(server: $server, sort: $playerSort, filter: $playerFilter) {\n          items {\n            id\n            rankAtt\n            rankDef\n            rankSup\n            rankTotal\n            scoreAtt\n            scoreAtt\n            scoreDef\n            scoreSup\n            scoreTotal\n            dailyGrowth\n          }\n        }\n    }\n",L="\n    query ennoblements($server: String!, $limit: Int, $offset: Int, $sort: [String!], $filter: EnnoblementFilter!) {\n      ennoblements(server: $server, limit: $limit, offset: $offset, sort: $sort, filter: $filter) {\n        total\n        items {\n          village {\n            id\n            name\n            x\n            y\n          }\n          oldOwner {\n            id\n            name\n          }\n          oldOwnerTribe {\n            id\n            tag\n          }\n          newOwner {\n            id\n            name\n          }\n          newOwnerTribe {\n            id\n            tag\n          }\n          ennobledAt\n        }\n      }\n    }\n",k=15,P="\nquery tribeHistoryAndTribeDailyStats($server: String!,\n     $tribeHistoryFilter: TribeHistoryFilter!,\n     $dailyTribeStatsFilter: DailyTribeStatsFilter!,\n     $sort: [String!],\n     $offset: Int,\n     $limit: Int) {\n  tribeHistory(server: $server, sort: $sort, limit: $limit, offset: $offset, filter: $tribeHistoryFilter) {\n    total\n    items {\n      totalVillages\n      points\n      rank\n      scoreAtt\n      rankAtt\n      scoreDef\n      rankDef\n      scoreTotal\n      rankTotal\n      createDate\n      totalMembers\n    }\n  }\n  dailyTribeStats(server: $server, sort: $sort, limit: $limit, offset: $offset, filter: $dailyTribeStatsFilter) {\n    items {\n        points\n        scoreAtt\n        scoreDef\n        scoreTotal\n        villages\n        createDate\n        members\n      }\n    }\n}\n",A=15,C="\nquery tribeMembersDailyStats($server: String!,\n     $filter: DailyPlayerStatsFilter!,\n     $limit: Int,\n     $sort: [String!]) {\n  dailyPlayerStats(server: $server, limit: $limit, sort: $sort, filter: $filter) {\n    items {\n        player {\n          id\n          name\n        }\n        points\n        scoreAtt\n        scoreDef\n        scoreSup\n        scoreTotal\n        villages\n        createDate\n      }\n    }\n}\n";let O="points";const j="\n    query tribeChanges($server: String!, $limit: Int, $offset: Int, $sort: [String!], $filter: TribeChangeFilter!) {\n      tribeChanges(server: $server, offset: $offset, limit: $limit, sort: $sort, filter: $filter) {\n        total\n        items {\n          player {\n            id\n            name\n          }\n          newTribe {\n            id\n            tag\n          }\n          createdAt\n        }\n      }\n    }\n",I="tribeChangesPagination",F=15,H=document.querySelector("#content_value > table:nth-child(3) > tbody > tr > td:nth-child(1) > table > tbody"),x=H,M=document.querySelector("#content_value > table:nth-child(3) > tbody > tr > td:nth-child(2)"),_=document.querySelector("#content_value > table.vis > tbody"),G=(0,t.default)(),R=()=>(0,d.getItem)(E),V=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,d.setItem)(E,e)},N=()=>{const e=[];return _.querySelectorAll("a").forEach(t=>{const n=t.getAttribute("href");n.includes("info_player")&&e.push((0,s.default)(n))}),e},U=()=>{const e=[];return _.querySelectorAll("a").forEach(t=>{t.getAttribute("href").includes("info_player")&&e.push(t.innerText.trim())}),e},W=async()=>{const e=N(),t=await(0,n.default)({query:q,variables:{server:T,id:$,dailyTribeStatsSort:["createDate DESC"],dailyTibeStatsLimit:1,dailyTribeStatsFilter:{tribeID:[$]},playerSort:["rank ASC"],playerFilter:{id:e}}});return V(t),t},X=e=>{let{title:t,data:n,id:r}=e,a=document.querySelector("#"+r);a||((a=document.createElement("tr")).id=r,a.appendChild(document.createElement("td")),a.appendChild(document.createElement("td")),H.append(a)),a.children[0].innerHTML=t,a.children[1].innerHTML=n},Y=e=>{_.parentElement.style.width="100%";const t=_.querySelector("tr:first-child");11!==t.children.length&&[G.oda,G.odd,G.ods,G.od,G.dailyGrowth,G.playerLinks].forEach(e=>{const n=document.createElement("th");n.innerHTML=e,t.appendChild(n)}),_.querySelectorAll("tr").forEach(t=>{const n=t.querySelector("a");if(!n)return;const r=(0,s.default)(n.getAttribute("href")),a=e.items.find(e=>e.id===r);a&&[[a.scoreAtt,a.rankAtt],[a.scoreDef,a.rankDef],[a.scoreSup,a.rankSup],[a.scoreTotal,a.rankTotal],a.dailyGrowth,[{link:b.buildPlayerURL(w,T,a.id),label:"TWHelp"},{link:m.buildPlayerURL(T,a.id),label:"TWStats"}]].forEach((e,n)=>{let r=t.children[5+n];r||(r=document.createElement("td"),t.appendChild(r)),Array.isArray(e)?"number"==typeof e[0]?r.innerHTML="".concat(e[0].toLocaleString()," (<strong>").concat(e[1],"</strong>)"):e[0].link&&(r.innerHTML=e.map(e=>{let{link:t,label:n}=e;return'<a target="_blank" href="'.concat(t,'">').concat(n,"</a>")}).join("<br>")):"number"==typeof e&&(r.innerHTML=e.toLocaleString())})})},z=e=>{let{tribe:t,dailyTribeStats:n,players:r}=e;[{title:G.createdAt+":",data:(0,u.formatDate)(t.createdAt),id:"created_at"},{title:G.dominance+":",data:t.dominance.toFixed(2)+"%",id:"dominance"},{title:G.bestRank+":",data:t.bestRank+" "+"(".concat((0,u.formatDate)(t.bestRankAt),")"),id:"best_rank"},{title:G.mostPoints+":",data:t.mostPoints.toLocaleString()+" "+"(".concat((0,u.formatDate)(t.mostPointsAt),")"),id:"most_points"},{title:G.mostVillages+":",data:t.mostVillages+" "+"(".concat((0,u.formatDate)(t.mostVillagesAt),")"),id:"most_villages"}].forEach(e=>{X(e)}),n&&n.items.length>0&&(0,a.default)(M,n.items[0]),r&&r.items.length>0&&Y(r)},B=async e=>{e.preventDefault();const t=(0,r.getPage)(e.target);if(!isNaN(t)){const r=await(0,n.default)({query:L,variables:{filter:{or:{oldOwnerTribeID:[$],newOwnerTribeID:[$]}},offset:15*(t-1),limit:15,sort:["ennobledAt DESC"],server:T}});(0,i.default)(e,r.ennoblements,{currentPage:t,limit:15,onPageChange:B})}},J=async e=>{e.preventDefault();const t=(0,r.getPage)(e.target);if(!isNaN(t))try{const r={tribeID:[$]},{tribeHistory:i,dailyTribeStats:l}=await(0,n.default)({query:P,variables:{server:T,offset:15*(t-1),limit:15,sort:["createDate DESC"],tribeHistoryFilter:r,dailyTribeStatsFilter:r}});(0,o.default)(e,i,l,{currentPage:t,limit:15,tribe:!0,onPageChange:J})}catch(a){console.log("cannot load tribe history",a)}},K=e=>{return e>0?"color: #000; background-color: #0f0":e<0?"color: #000; background-color: #f00":"color: #000; background-color: #808080"},Q=e=>{switch(O){case"points":return e.points;case"villages":return e.villages;case"od":return e.scoreTotal;case"oda":return e.scoreAtt;case"odd":return e.scoreDef;case"ods":return e.scoreSup;default:return 0}},Z=e=>{const t=[...new Set(e.items.map(e=>e.createDate))].reverse();return"\n    <tbody>\n        <tr>\n          <th>".concat(G.player,"</th>\n          ").concat(t.map(e=>"<th>".concat((0,u.formatDate)(e,{year:"numeric",month:"2-digit",day:"2-digit"}),"</th>")).join(""),"\n          <th>").concat(G.total,"</th>\n        </tr>\n        ").concat(N().map(n=>{const r=e.items.filter(e=>e.player&&e.player.id===n).reverse();let a=void 0;r.length>0&&(a=r[0].player);const i=[];let o=0;for(let e of t){const t=r.find(t=>t.createDate===e);let n=0;t&&(n=Q(t)),o+=n,i.push('<td style="'.concat(K(n),'">').concat(n.toLocaleString(),"</td>"))}return"<tr>\n            <td>\n              ".concat(a?'<a href="'.concat(p.buildPlayerURL(n),'">').concat(a.name,"</a>"):"-","\n            </td>\n            ").concat(i.join(""),'\n            <td style="').concat(K(o),'"><strong>').concat(o.toLocaleString(),"</strong></td>\n          </tr>")}).join(""),"\n      </tbody>\n  ")},ee="membersGrowth",te="membersGrowthForm",ne=e=>t=>{t.preventDefault(),O=t.target[0].value,document.querySelector("#membersGrowth").innerHTML=Z(e)},re=(e,t)=>{const n=[["points",G.points],["villages",G.villages],["od",G.opponentsDefeated],["oda",G.opponentsDefeatedAsAttacker],["odd",G.opponentsDefeatedAsDefender],["ods",G.opponentsDefeatedAsSupporter]].map(e=>"<option ".concat(O===e[0]?'selected="selected"':"",' value="').concat(e[0],'">').concat(e[1],"</option>")),r='\n    <form id="'.concat("membersGrowthForm",'">\n      <select>\n        ').concat(n.join(""),'\n      </select>\n      <button type="submit">').concat(G.change,'</button>\n    </form>\n    <table id="').concat("membersGrowth",'" class="vis" style="border-collapse: separate; border-spacing: 2px; width: 100%;">\n      ').concat(Z(t),"\n    </table>\n  ");(0,l.default)({e:e,title:G.membersGrowth,id:"mg",html:r}),document.querySelector("#membersGrowthForm").addEventListener("submit",ne(t))},ae=async function(){let{createDateLTE:t,createDateGT:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const a=N(),i=a.length*(0,e.default)(t,r),o={playerID:a,createDateLTE:t,createDateGT:r};return await(0,n.default)({query:C,variables:{filter:o,limit:i,sort:["createDate DESC"],server:T}})},ie=async e=>{e.preventDefault();const t=new Date;t.setDate(t.getDate()-7);const n=await ae({createDateLTE:new Date,createDateGT:t});re(e,n.dailyPlayerStats)},oe=(e,t,n)=>{const a=(0,r.generatePaginationItems)({total:n.total,limit:15,currentPage:t}),i='\n    <div style="'.concat((0,r.getContainerStyles)(),'" id="').concat("tribeChangesPagination",'">\n      ').concat(a.join(""),'\n    </div>\n    <table class="vis" style="border-collapse: separate; border-spacing: 2px; width: 100%;">\n      <tbody>\n        <tr>\n          <th>\n            ').concat(G.date,"\n          </th>\n          <th>\n            ").concat(G.player,"\n          </th>\n          <th>\n            ").concat(G.act,"\n          </th>\n        </tr>\n        ").concat(n.items.map(e=>{let t="<tr>"+"<td>".concat((0,u.formatDate)(e.createdAt),"</td>");return e.player?t+='<td><a href="'.concat(p.buildPlayerURL(e.player.id),'">').concat(e.player.name,"</a></td>"):t+="<td>-</td>",(t+="<td><strong>".concat(e.newTribe&&e.newTribe.id===$?G.joined:G.left,"</strong></td>"))+"</tr>"}).join(""),"\n      </tbody>\n    </table>\n  ");(0,l.default)({e:e,title:G.tribeChanges,id:"tribeChanges",html:i}),document.querySelectorAll("#tribeChangesPagination a").forEach(e=>{e.addEventListener("click",le)})},le=async e=>{e.preventDefault();const t=(0,r.getPage)(e.target);if(!isNaN(t)){const r=await(0,n.default)({query:j,variables:{filter:{or:{oldTribeID:[$],newTribeID:[$]}},offset:15*(t-1),limit:15,sort:["createdAt DESC"],server:T}});oe(e,t,r.tribeChanges)}},se=e=>{e.preventDefault();const t=U(),n=[];for(let a=0;a<t.length;a+=50)n.push(t.slice(a,a+50));let r="";n.forEach((e,t)=>{r+='<h3 style="margin-bottom: 5px;">'.concat(t+1,'.</h3>\n    <textarea cols=30 rows=8 readonly style="margin-bottom: 15px;">').concat(e.join(";"),"</textarea>")}),Dialog.show("mailinglist",r)},ce=async function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{const a=await(0,n.default)({variables:e,query:"\n        query villages($server: String!, $sort: [String!], $limit: Int, $offset: Int, $filter: VillageFilter!) {\n          villages(server: $server, sort: $sort, limit: $limit, offset: $offset, filter: $filter) {\n            ".concat(t?"total":"","\n            items {\n              id\n              x\n              y\n            }\n          }\n        }\n      ")});if(a&&a.villages&&Array.isArray(a.villages.items))return a.villages}catch(r){console.log("load villages",r)}return{total:0,items:[]}},de=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e&&t?Dialog.show("loading","Loaded: <strong>".concat(e,"</strong>/<strong>").concat(t,"</strong>")):Dialog.show("loading","<strong>Loading...</strong>")},ue=async e=>{e.preventDefault();let t=parseInt(e.target[4].value);const n={filter:{xLTE:parseInt(e.target[0].value),xGTE:parseInt(e.target[1].value),yLTE:parseInt(e.target[2].value),yGTE:parseInt(e.target[3].value),playerID:N()},limit:isNaN(t)||!t?0:t,sort:["id ASC"],server:T};de();let{total:r,items:a}=await ce(n,!0);const i=a.length;if(0!==t&&t<r&&(r=t),isNaN(t)||!t||t>i)for(let o=i;o<r;o+=i){de(o,r);const e=await ce(S(S({},n),{},{filter:S({},n.filter),offset:o}));a=[...a,...e.items]}Dialog.show("exportTribeVillages","\n    <textarea cols=60 rows=8 readonly>".concat(a.map(e=>"".concat(e.x,"|").concat(e.y)).join(" "),"</textarea>\n  "))},fe=e=>{e.preventDefault();const t='\n    <div style="display: flex; align-items: center; justify-content: center;">\n      <form id="'.concat("etvForm",'">\n        <div>\n          <label>X <= </label>\n          <input type="number" min="0" value="1000" required />\n        </div>\n        <div>\n          <label>X >= </label>\n          <input type="number" min="0" value="0" required />\n        </div>\n        <div>\n          <label>Y <= </label>\n          <input type="number" min="0" value="1000" required />\n        </div>\n        <div>\n          <label>Y >= </label>\n          <input type="number" min="0" value="0" required />\n        </div>\n        <div>\n          <label>Limit: </label>\n          <input type="number" min="0" value="0" required />\n        </div>\n        <button type="submit">Export</button>\n      </form>\n    </div>\n  ');Dialog.show("exportTribeVillages",t),document.querySelector("#etvForm").addEventListener("submit",ue)},me=e=>{const t=document.createElement("td");t.colSpan="2",t.append(e);const n=document.createElement("tr");return n.appendChild(t),n},be=()=>{const e=document.createElement("a");e.href=b.buildTribeURL(w,T,$),e.innerHTML=G.action.linkToTWHelp,x.appendChild(me(e));const t=document.createElement("a");t.href="#",(0,r.setPage)(t,"1"),t.innerHTML=G.action.showEnnoblements,t.addEventListener("click",B),x.appendChild(me(t));const n=document.createElement("a");n.href="#",(0,r.setPage)(n,"1"),n.innerHTML=G.action.showHistory,n.addEventListener("click",J),x.appendChild(me(n));const a=document.createElement("a");a.href="#",(0,r.setPage)(a,"1"),a.innerHTML=G.action.showTribeChanges,a.addEventListener("click",le),x.appendChild(me(a));const i=document.createElement("a");i.href="#",i.innerHTML=G.action.showMembersGrowth,i.addEventListener("click",ie),x.appendChild(me(i));const o=document.createElement("a");o.href="#",o.innerHTML=G.action.generateMailingList,o.addEventListener("click",se),x.appendChild(me(o));const l=document.createElement("a");l.href="#",l.innerHTML=G.action.exportVillages,l.addEventListener("click",fe),x.appendChild(me(l))};!async function(){try{document.querySelector("#content_value > table:nth-child(3)").style.width="100%",be();const t=R();t&&t.tribe&&z(t);const n=await W();n&&z(n)}catch(e){console.log("extended tribe profile",e)}}();
},{"date-fns/differenceInDays":"mdVI","./i18n/extendedTribeProfile":"iFDG","./libs/requestCreator":"Ph2E","./utils/pagination":"fCHX","./common/renderTodaysStats":"yrCm","./common/showEnnoblementsPopup":"vNT1","./common/showHistoryPopup":"kEDU","./utils/showPopup":"chDM","./utils/getIDFromURL":"tQUs","./utils/getCurrentServer":"DMkL","./utils/localStorage":"KWxH","./utils/date":"ZbyX","./utils/getServerVersionCode":"J1Ly","./utils/twstats":"Syko","./utils/twhelp":"gvXE","./utils/tribalwars":"fHHP"}]},{},["r4nF"], null)