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}({"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;
},{}],"MRps":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;const a={pl_PL:{actualCoords:"Aktualne koordynaty",searchBonusBarbarianVillages:"Wyszukaj koczownicze",village:"Wioska",distance:"Dystans",action:"Akcja"},en_DK:{actualCoords:"Actual coords",searchBonusBarbarianVillages:"Search bonus barbarian villages",village:"Village",distance:"Distance",action:"Action"}};var e=()=>a[window.game_data.locale]||a.en_DK;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;
},{}],"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;
},{}],"XOOL":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.calcDistanceBetweenTwoPoints=void 0;const e=(e,t,s,o)=>{const c=e-s,n=t-o;return Math.sqrt(c*c+n*n)};exports.calcDistanceBetweenTwoPoints=e;
},{}],"fvjy":[function(require,module,exports) {
"use strict";var e=c(require("./libs/requestCreator")),t=c(require("./i18n/bonusBarbarianVillageFinder")),n=c(require("./utils/getCurrentServer")),r=i(require("./utils/tribalwars")),a=require("./utils/math");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 c(e){return e&&e.__esModule?e:{default:e}}function s(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 l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const f=(0,n.default)(),d="\n  query villages($server: String!, $filter: VillageFilter, $sort: [String!], $offset: Int) {\n    villages(server: $server, filter: $filter, offset: $offset, sort: $sort) {\n      total\n      items {\n        id\n        name\n        bonus\n        x\n        y\n      }\n    }\n  }\n",p="bonusBarbarianVillageFinderTable",b="actualCoords",y=(0,t.default)();let v=void 0;const g=(e,t)=>({query:d,variables:{server:f,sort:["id DESC"],filter:{bonus:e,playerID:[0]},offset:t}}),m=async t=>{const{villages:n}=await(0,e.default)(g(t,0));for(let r=n.length;r<n.total;r+=1e3){const r=await(0,e.default)(g(t,0));n.items=[...n.items,...r.villages.items]}return n},O=async e=>{e.preventDefault();const t=await m(parseInt(e.target[0].value)),n=TWMap.pos;t.items=t.items.map(e=>l(l({},e),{},{distance:(0,a.calcDistanceBetweenTwoPoints)(n[0],n[1],e.x,e.y)})).sort((e,t)=>e.distance-t.distance),document.querySelector("#"+p).innerHTML=j(t.items)},h=()=>{let e=[];for(let t in TWMap.bonus_data)e.push({value:t,text:TWMap.bonus_data[t].text});return e},j=e=>"\n        <tbody>\n            <tr>\n                <th>\n                    ".concat(y.village,"\n                </th>\n                <th>\n                    ").concat(y.distance,"\n                </th>\n                <th>\n                    ").concat(y.action,"\n                </th>\n            </tr>\n            ").concat(Array.isArray(e)?e.map(e=>'<tr>\n                <td>\n                    <a href="'.concat(r.buildVillageURL(e.id),'">\n                        ').concat(r.buildVillageName(e.name,e.x,e.y),"\n                    </a>\n                </td>\n                <td>\n                    ").concat(e.distance.toFixed(1),'\n                </td>\n                <td>\n                    <a href="#" onclick="return TWMap.focusUserSpecified(').concat(e.x,", ").concat(e.y,')">Center</a>\n                </td>\n            </tr>')).join(""):"","\n        </tbody>\n    "),w=()=>{document.querySelector("#actualCoords").innerHTML="".concat(y.actualCoords,": <strong>").concat(TWMap.pos.join("|"),"</strong>")},P=()=>{const e='\n        <p id="'.concat("actualCoords",'"></p>\n        <form>\n            <select>\n                ').concat(h().map(e=>'<option value="'.concat(e.value,'">').concat(e.text,"</option>")).join(""),'\n            </select>\n            <button type="submit">').concat(y.searchBonusBarbarianVillages,'</button>\n        </form>\n        <table class="vis" style="width: 100%;" id="').concat(p,'">\n            ').concat(j(),"\n        </table>\n    ");v||((v=document.createElement("div")).classList.add("containerBorder"),v.style.clear="both",document.querySelector("#map_big").appendChild(v)),v.innerHTML=e,v.querySelector("form").addEventListener("submit",O),w(),setInterval(w,1e3)};P();
},{"./libs/requestCreator":"Ph2E","./i18n/bonusBarbarianVillageFinder":"MRps","./utils/getCurrentServer":"DMkL","./utils/tribalwars":"fHHP","./utils/math":"XOOL"}]},{},["fvjy"], null)