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;c0&&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; },{}],"chDM":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const e=".popup_helper",t="#inline_popup";var o=function(){let{e:e,title:o,html:n,id:l}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const i=document.querySelector(t);i&&(i.style.width="auto",i.style.maxWidth="1000px"),i.classList.contains("show")?(i.querySelector("#inline_popup_title").innerHTML=o,i.querySelector("#inline_popup_content").innerHTML=n):inlinePopup(e,l,null,{offset_x:0,offset_y:0},n,o);const p=document.querySelector(".popup_helper");p&&(p.style.width="auto",p.style.position="fixed",p.style.zIndex="50001")};exports.default=o; },{}],"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; },{}],"V6Mf":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=(e,t)=>new Date(e).toLocaleDateString(window.game_data.locale.replace("_","-"),t||{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"});exports.default=e; },{}],"fHHP":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.buildImgURL=exports.calcAttackDuration=exports.formatVillageName=exports.formatVillageURL=exports.formatPlayerURL=exports.formatTribeURL=void 0;const o=o=>window.location.origin+TribalWars.buildURL("",{screen:"info_ally",id:o});exports.formatTribeURL=o;const t=o=>window.location.origin+TribalWars.buildURL("",{screen:"info_player",id:o});exports.formatPlayerURL=t;const r=o=>window.location.origin+TribalWars.buildURL("",{screen:"info_village",id:o});exports.formatVillageURL=r;const e=function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:500;const e="K"+String(r)[0]+String(t)[0];return"".concat(o," (").concat(t,"|").concat(r,") ").concat(e)};exports.formatVillageName=e;const i=(o,t,r)=>Math.round(o*r/t);exports.calcAttackDuration=i;const a=o=>image_base+o;exports.buildImgURL=a; },{}],"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; },{}],"FxgK":[function(require,module,exports) { "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const e={pl_PL:{showLatestEnnoblements:"Pokaż najnowsze przejęcia",village:"Wioska",newOwner:"Nowy właściciel",newOwnerTribe:"Plemię nowego właściciela",oldOwner:"Poprzedni właściciel",oldOwnerTribe:"Plemię poprzedniego właściciela",date:"Data",filters:"Filtry",apply:"Zastosuj",ennoblements:"Przejęcia"},en_DK:{showLatestEnnoblements:"Show latest ennoblements",village:"Village",newOwner:"New owner",newOwnerTribe:"New owner tribe",oldOwner:"Old owner",oldOwnerTribe:"Old owner tribe",filters:"Filters",date:"Date",apply:"Apply",ennoblements:"Ennoblements"}};var n=()=>e[window.game_data.locale]||e.en_DK;exports.default=n; },{}],"hkfB":[function(require,module,exports) { "use strict";var e=i(require("./libs/requestCreator")),t=i(require("./utils/showPopup")),n=i(require("./utils/getCurrentServer")),r=i(require("./utils/formatDate")),o=require("./utils/tribalwars"),l=require("./utils/localStorage"),a=i(require("./i18n/latestEnnoblements"));function i(e){return e&&e.__esModule?e:{default:e}}function c(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(0,l.getItem)(m),g=()=>(0,l.getItem)(p),E=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,l.setItem)(m,e)},j=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(0,l.setItem)(p,e)},L=()=>(0,e.default)({query:f,variables:{server:u}}).then(e=>(E(e),new Promise(t=>t(e)))),_=(e,t)=>e&&e.name.toLowerCase().includes(t.toLowerCase()),P=(e,t)=>e&&e.tribe&&(e.tribe.name.toLowerCase().includes(t.toLowerCase())||e.tribe.tag.toLowerCase().includes(t.toLowerCase())),T=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],{newOwner:t,newOwnerTribe:n,oldOwner:r,oldOwnerTribe:o}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.filter(e=>!(t&&!_(e.newOwner,t))&&(!(n&&!P(e.newOwner,n))&&(!(r&&!_(e.oldOwner,r))&&!(o&&!P(e.oldOwner,o)))))},q=(e,t)=>{e.preventDefault();const n=s(s({},v),{},{newOwner:e.target[0].value,newOwnerTribe:e.target[1].value,oldOwner:e.target[2].value,oldOwnerTribe:e.target[3].value});document.querySelector("#".concat(w," tbody")).innerHTML=k(T(t,n)).join(""),j(n)},x=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];document.querySelector("#sle_form").addEventListener("submit",t=>{q(t,e)})},C=e=>e&&e.name?'').concat(e.name," (").concat(e.tribe&&e.tribe.tag?'').concat(e.tribe.tag,""):"-",")"):"-",S=e=>'').concat((0,o.formatVillageName)(e.name,e.x,e.y),""),k=e=>e.reverse().map(e=>"\n ".concat(S(e.village),"\n ").concat(C(e.newOwner),"\n ").concat(C(e.oldOwner),"\n ").concat((0,r.default)(e.ennobledAt),"\n ")),D=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=s(s({},v),n),o='\n
\n

').concat(y.filters,'

\n \n \n \n \n
\n \n
\n
\n \n \n \n \n \n \n \n \n \n \n ").concat(k(T(e,r)).join(""),"\n \n
').concat(y.village,"").concat(y.newOwner,"").concat(y.oldOwner,"").concat(y.date,"
\n ");(0,t.default)({e:{clientY:60},title:y.ennoblements,id:"ennoblements",html:o}),x(e)},I=async()=>{try{const t=h(),n=g();Array.isArray(t.liveEnnoblements)&&t.liveEnnoblements.length>0&&D(t.liveEnnoblements,n);const{liveEnnoblements:r}=await L();D(r,n)}catch(e){console.log("latestEnnoblements",e)}},A=()=>{const e=document.createElement("div");e.style.position="fixed",e.style.top="5px",e.style.left="4px",e.style.zIndex="50000";const t=document.createElement("a");t.innerHTML=''),t.title=y.showLatestEnnoblements,t.style.cursor="pointer",t.addEventListener("click",I),e.append(t),document.body.appendChild(e)};A(); },{"./libs/requestCreator":"Ph2E","./utils/showPopup":"chDM","./utils/getCurrentServer":"DMkL","./utils/formatDate":"V6Mf","./utils/tribalwars":"fHHP","./utils/localStorage":"KWxH","./i18n/latestEnnoblements":"FxgK"}]},{},["hkfB"], null)