Raw Source
Adrriii / HMap

// ==UserScript==
// @name         HMap
// @namespace    ryderone
// @version      3.1.7
// @license      MIT
// @description  Attempt to rebuild the Die2Nite map in HTML5
// @author       RyderOne
// @match        http://www.die2nite.com/*
// @match        http://www.dieverdammten.de/*
// @match        http://www.hordes.fr/*
// @match        http://www.zombinoia.com/*
// @grant        none
// @downloadURL  https://datw.tf/hmap
// @updateURL    https://datw.tf/hmap
// @supportURL   https://github.com/Ryder-One/hmap/issues
// ==/UserScript==
"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj}}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj}}return _typeof(obj)}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)};return _getPrototypeOf(o)}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function")}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass)}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o};return _setPrototypeOf(o,p)}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++){o(t[i])}return o}return r})()({1:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var HMapArrow=function HMapArrow(ax,ay,rx,ry,w,h,t,a){var over=arguments.length>8&&arguments[8]!==undefined?arguments[8]:false;_classCallCheck(this,HMapArrow);this.ax=ax;this.ay=ay;this.rx=rx;this.ry=ry;this.w=w;this.h=h;this.t=t;this.a=a;this.over=over};exports.HMapArrow=HMapArrow},{}],2:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var HMapData=function(){function HMapData(mapDataPayload){var scavengerMode=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var scoutMode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var shamanMode=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;_classCallCheck(this,HMapData);if(mapDataPayload&&mapDataPayload.raw){this.data=this.decode(mapDataPayload.raw)}else if(mapDataPayload&&mapDataPayload.JSON){this.data=mapDataPayload.JSON}else{this.data=this.fakeData(true,scavengerMode,scoutMode,shamanMode)}}_createClass(HMapData,[{key:"patchData",value:function patchData(data){var decodedData;if(data.raw){decodedData=this.decode(data.raw)}else if(data.JSON){decodedData=data.JSON}else{throw new Error("HMapData::patchData - Cannot patch empty data")}this.patchDataJSON(decodedData)}},{key:"translate",value:function translate(char){if(char>=65&&char<=90){return char-65}if(char>=97&&char<=122){return char-71}if(char>=48&&char<=57){return char+4}return null}},{key:"binaryToMessage",value:function binaryToMessage(key,message){var keyArray=new Array;for(var i=0,j=key.length;i<j;i++){var char=this.translate(key.charCodeAt(i));if(char!=null){keyArray.push(char)}}if(keyArray.length===0){keyArray.push(0)}var returnStr="";for(var n=0,p=message.length;n<p;n++){var k=message.charCodeAt(n)^keyArray[(n+message.length)%keyArray.length];returnStr+=String.fromCharCode(k!==0?k:message.charCodeAt(n))}return returnStr}},{key:"prettyData",get:function get(){return JSON.stringify(this.data,undefined,4)}}]);return HMapData}();exports.HMapData=HMapData},{}],3:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var neighbours_1=require("../neighbours");var random_1=require("../random");var abstract_1=require("./abstract");var HMapDesertData=function(_abstract_1$HMapData){_inherits(HMapDesertData,_abstract_1$HMapData);function HMapDesertData(mapDataPayload){var _this;var scavengerMode=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var scoutMode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var shamanMode=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;_classCallCheck(this,HMapDesertData);_this=_possibleConstructorReturn(this,_getPrototypeOf(HMapDesertData).call(this,mapDataPayload,scavengerMode,scoutMode,shamanMode));_this.neighbours=new neighbours_1.HMapNeighbours;_this.buildings=new Map;_this.users=new Map;_this.buildNeighbours();_this.town=_this.findTown();_this.cacheBuildingsNames();_this.cacheUsersOutside();return _this}_createClass(HMapDesertData,[{key:"decode",value:function decode(urlEncoded){var st,hx,mc;try{var page=window.wrappedJSObject;if(page!==undefined&&page.StringTools&&page.MapCommon&&page.haxe){st=page.StringTools;hx=page.haxe;mc=page.MapCommon}else if(StringTools&&haxe&&MapCommon){st=StringTools;hx=haxe;mc=MapCommon}var tempMapData=st.urlDecode(urlEncoded);return hx.Unserializer.run(this.binaryToMessage(mc.genKey(tempMapData.length),mc.permute(tempMapData)))}catch(err){console.error("HMapDesertData::decode - caught an exception during decoding",err,urlEncoded);throw err}}},{key:"getPositionRelativeToTown",value:function getPositionRelativeToTown(position){return{x:position.x-this.town.x,y:this.town.y-position.y}}},{key:"movePosition",value:function movePosition(offsetX,offsetY){this.data._x+=offsetX;this.data._y+=offsetY}},{key:"getIndex",value:function getIndex(position){return position.x+position.y*this.size.width}},{key:"getCoordinates",value:function getCoordinates(index){return{y:Math.floor(index/this.size.width),x:index%this.size.width}}},{key:"inBounds",value:function inBounds(pos){return pos.x>=0&&pos.y>=0&&pos.x<this.size.width&&pos.y<this.size.height}},{key:"isPositionDiscovered",value:function isPositionDiscovered(pos){var index=this.getIndex(pos);return this.data._view[index]!==null&&this.data._view[index]!==undefined?true:false}},{key:"buildNeighbours",value:function buildNeighbours(){this.neighbours.neighbours=new Map;for(var X=this.position.x-1;X<=this.position.x+1;X++){for(var Y=this.position.y-1;Y<=this.position.y+1;Y++){var outbounds=!this.inBounds({x:X,y:Y});var p=void 0;if(X<this.position.x){if(Y<this.position.y){p="top_left"}else if(Y===this.position.y){p="middle_left"}else{p="bottom_left"}}else if(X===this.position.x){if(Y<this.position.y){p="top_center"}else if(Y===this.position.y){p="middle_center"}else{p="bottom_center"}}else{if(Y<this.position.y){p="top_right"}else if(Y===this.position.y){p="middle_right"}else{p="bottom_right"}}var N=new neighbours_1.HMapNeighbour(X,Y,p,outbounds,this.getIndex({x:X,y:Y}),false,0);if(!N.outbounds){if(this.data._details[N.index]===undefined||this.data._details[N.index]===null){this.data._details[N.index]={_c:0,_nvt:1,_s:false,_t:0,_z:0}}N.building=this.data._details[N.index]._c!==null?this.data._details[N.index]._c:0;N.view=this.isPositionDiscovered({x:X,y:Y})}this.neighbours.addNeighbour(N)}}}},{key:"fakeData",value:function fakeData(){var force=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var scavengerMode=arguments.length>1?arguments[1]:undefined;var scoutMode=arguments.length>2?arguments[2]:undefined;var shamanMode=arguments.length>3?arguments[3]:undefined;if(this._fakeData!==undefined&&force===false){return this._fakeData}else{var mapSize=random_1.HMapRandom.getRandomIntegerNoSeed(8,25);var town={x:random_1.HMapRandom.getRandomIntegerNoSeed(3,mapSize-3),y:random_1.HMapRandom.getRandomIntegerNoSeed(3,mapSize-3)};this._fakeData={_details:new Array,_city:"Oh yeah",_hour:17,_path:null,_slow:true,_b:new Array,_e:new Array,_h:mapSize,_r:{_neigDrops:new Array,_neig:new Array,_state:false,_c:1,_h:1,_m:6,_t:random_1.HMapRandom.getRandomIntegerNoSeed(0,12),_z:0,_zid:random_1.HMapRandom.getRandomIntegerNoSeed(111111,999999)},_w:mapSize,_x:town.x,_y:town.y,_town:false,_up:false,_view:new Array,_global:new Array,_users:null,_editor:false,_map:false,_mid:random_1.HMapRandom.getRandomIntegerNoSeed(111111,999999)};var index=0,townIndex=0;var buildings=new Array;for(var y=0;y<mapSize;y++){for(var x=0;x<mapSize;x++){var view=false;if(x<town.x+5&&x>town.x-5&&y<town.y+5&&y>town.y-5){view=true}var bid=town.x===x&&town.y===y?1:random_1.HMapRandom.getRandomIntegerNoSeed(0,10)===5?random_1.HMapRandom.getRandomIntegerNoSeed(2,62):0;bid=random_1.HMapRandom.getRandomIntegerNoSeed(0,10)===5?-1:bid;buildings.push({_id:bid,_n:"Building "+bid});console.log("ShamanMode "+shamanMode);this._fakeData._details.push({_c:bid,_s:shamanMode===true?random_1.HMapRandom.getRandomIntegerNoSeed(0,10)===1:false,_t:random_1.HMapRandom.getRandomIntegerNoSeed(0,12),_z:random_1.HMapRandom.getRandomIntegerNoSeed(0,3)===2?random_1.HMapRandom.getRandomIntegerNoSeed(0,18):0,_nvt:view});if(view===true){this._fakeData._view.push(bid)}else{this._fakeData._view.push(null)}if(bid===1){townIndex=index}index++}}this._fakeData._global=this._fakeData._view;this._fakeData._b=buildings;if(scoutMode===true){this._fakeData._r._neig=new Array;if(townIndex-mapSize>0){this._fakeData._r._neig.push(this._fakeData._details[townIndex-mapSize]._z)}else{this._fakeData._r._neig.push(0)}if(townIndex+1<mapSize*mapSize){this._fakeData._r._neig.push(this._fakeData._details[townIndex+1]._z)}else{this._fakeData._r._neig.push(0)}if(townIndex+mapSize<mapSize*mapSize){this._fakeData._r._neig.push(this._fakeData._details[townIndex+mapSize]._z)}else{this._fakeData._r._neig.push(0)}if(townIndex-1>0){this._fakeData._r._neig.push(this._fakeData._details[townIndex-1]._z)}else{this._fakeData._r._neig.push(0)}}if(scavengerMode===true){this._fakeData._r._neigDrops.push(random_1.HMapRandom.getOneOfNoSeed([null,true,false]));this._fakeData._r._neigDrops.push(random_1.HMapRandom.getOneOfNoSeed([null,true,false]));this._fakeData._r._neigDrops.push(random_1.HMapRandom.getOneOfNoSeed([null,true,false]));this._fakeData._r._neigDrops.push(random_1.HMapRandom.getOneOfNoSeed([null,true,false]))}return this._fakeData}}},{key:"patchDataJSON",value:function patchDataJSON(data){this.data._r=data;var indexNewPosition=this.getIndex({x:this.data._x,y:this.data._y});this.data._details[indexNewPosition]._c=this.data._r._c;this.data._details[indexNewPosition]._t=this.data._r._t;this.data._details[indexNewPosition]._z=this.data._r._z;if(this.data._details[indexNewPosition]._nvt===null){this.data._details[indexNewPosition]._nvt=false}this.data._view[indexNewPosition]=this.data._r._c;this.data._global[indexNewPosition]=this.data._r._c;this.buildNeighbours()}},{key:"findTown",value:function findTown(){for(var index=0,length=this.data._details.length;index<length;index++){if(this.data._details[index]===undefined||this.data._details[index]===null){continue}if(this.data._details[index]!==undefined&&this.data._details[index]._c===1){return this.getCoordinates(index)}}return{x:0,y:0}}},{key:"cacheBuildingsNames",value:function cacheBuildingsNames(){var _this2=this;this.data._b.forEach(function(B){_this2.buildings.set(B._id,B._n)})}},{key:"cacheUsersOutside",value:function cacheUsersOutside(){var _this3=this;if(this.data._users!==null&&this.data._users.length>0){this.data._users.forEach(function(user){var userIndex=_this3.getIndex({x:user._x,y:user._y});var userOnThisPosition=_this3.users.get(userIndex);if(userOnThisPosition===undefined||userOnThisPosition===null){userOnThisPosition=new Array}userOnThisPosition.push(user);_this3.users.set(userIndex,userOnThisPosition)})}}},{key:"size",get:function get(){return{width:this.data._w,height:this.data._h}}},{key:"position",get:function get(){return{x:this.data._x,y:this.data._y}}},{key:"index",get:function get(){return this.getIndex({x:this.data._x,y:this.data._y})}},{key:"actionPoints",get:function get(){return this.data._r._m}},{key:"numberOfHumans",get:function get(){return this.data._r._h}},{key:"zoneId",get:function get(){return this.data._r._zid}},{key:"numberOfZombies",get:function get(){return this.data._r._z}},{key:"hour",get:function get(){return this.data._hour}},{key:"hasControl",get:function get(){return!this.data._r._state}},{key:"scoutArray",get:function get(){return this.data._r._neig}},{key:"scavengerArray",get:function get(){return this.data._r._neigDrops}},{key:"details",get:function get(){return this.data._details}},{key:"global",get:function get(){return this.data._global}},{key:"view",get:function get(){return this.data._view}},{key:"townName",get:function get(){return this.data._city}}]);return HMapDesertData}(abstract_1.HMapData);exports.HMapDesertData=HMapDesertData},{"../neighbours":21,"../random":22,"./abstract":2}],4:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var abstract_1=require("./abstract");var random_1=require("../random");var HMapRuinData=function(_abstract_1$HMapData2){_inherits(HMapRuinData,_abstract_1$HMapData2);function HMapRuinData(mapDataPayload){var _this4;_classCallCheck(this,HMapRuinData);_this4=_possibleConstructorReturn(this,_getPrototypeOf(HMapRuinData).call(this,mapDataPayload));_this4.walls={motel:{A:["wall_bench_A"],B:["wall_bench_B","wall_palmtree_B"],C:[],D:["wall_flowers_D"],E:["wall_flowers_E"],F:[],G:["wall_bench_G","wall_palmtree_G"],H:["wall_bench_H"],I:[],J:[],K:[],L:[]},bunker:{A:["wall_hatch_A"],B:["wall_hatch_B"],C:[],D:["wall_barrel_D","wall_grid_D","wall_pipe_D"],E:["wall_barrel_E","wall_grid_E","wall_pipe_E"],F:[],G:["wall_hatch_G"],H:["wall_hatch_H"],I:[],J:[],K:[],L:[]},hospital:{A:[],B:[],C:[],D:["wall_bed_D","wall_dead_D"],E:["wall_bed_E","wall_dead_E"],F:[],G:[],H:[],I:[],J:["wall_grid_J"],K:["wall_grid_K"],L:[]}};_this4.zones={motel:{Z1:["zone_dead_left","zone_stain_left"],Z2:["zone_dead_top","zone_stain_top"],Z3:["zone_dead_right","zone_stain_right"],Z4:["zone_dead_bottom","zone_stain_bottom"],Z5:["zone_dead_left","zone_dead_right"]},bunker:{Z1:[],Z2:[],Z3:[],Z4:[],Z5:[]},hospital:{Z1:["zone_dead_left"],Z2:["zone_dead_top"],Z3:["zone_dead_right"],Z4:["zone_dead_bottom"],Z5:["zone_dead_left","zone_dead_right"]}};_this4.fakeRuinDirections=[[[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,true],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,false]],[[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,true],[false,false,false,false],[false,false,true,true],[true,true,true,false],[true,false,true,false],[true,false,true,false],[true,false,true,true],[true,false,true,false],[true,false,false,true],[false,false,false,false],[false,false,false,false]],[[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,true,true],[true,true,true,false],[true,false,true,false],[true,true,false,true],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,true,false,true],[false,false,false,false],[false,true,true,true],[true,false,false,false],[false,false,false,false]],[[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,true,false,true],[false,false,false,false],[false,false,false,false],[false,true,true,false],[true,false,true,false],[true,false,true,false],[true,false,true,false],[true,true,true,true],[true,false,true,false],[true,true,false,true],[false,false,false,false],[false,false,false,false]],[[false,false,true,true],[true,false,true,false],[true,false,true,false],[true,true,false,false],[false,false,false,false],[false,false,false,true],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,true,false,true],[false,false,false,false],[false,true,false,true],[false,false,false,false],[false,false,false,false]],[[false,true,false,true],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,true,true,true],[true,false,true,false],[true,false,false,true],[false,false,false,false],[false,false,false,false],[false,true,true,false],[true,false,true,false],[true,true,true,false],[true,false,false,true],[false,false,false,false]],[[false,true,true,false],[true,false,true,false],[true,false,false,true],[false,false,false,false],[false,false,false,false],[false,true,false,true],[false,false,false,false],[false,true,true,false],[true,false,false,true],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,true,false,true],[false,false,false,false]],[[false,false,false,false],[false,false,false,false],[false,true,true,false],[true,false,true,true],[true,false,true,false],[true,true,false,true],[false,false,false,false],[false,false,false,false],[false,true,true,false],[true,false,true,true],[true,false,true,false],[true,false,false,true],[false,false,false,false],[false,true,false,false],[false,false,false,false]],[[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,true,false,false],[false,false,false,false],[false,true,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,false],[false,true,false,false],[false,false,false,false],[false,true,false,false],[false,false,false,false],[false,false,false,false],[false,false,false,false]]];return _this4}_createClass(HMapRuinData,[{key:"decode",value:function decode(urlEncoded){var st,hx,ec;try{var page=window.wrappedJSObject;if(page!==undefined&&page.StringTools&&page.ExploCommon&&page.haxe){st=page.StringTools;hx=page.haxe;ec=page.ExploCommon}else if(StringTools&&haxe&&ExploCommon){st=StringTools;hx=haxe;ec=ExploCommon}var tempMapData=st.urlDecode(urlEncoded);return hx.Unserializer.run(this.binaryToMessage(ec.genKey(tempMapData.length),ec.permute(tempMapData)))}catch(err){console.error("HMapRuinData::decode - caught an exception during decoding",err,urlEncoded);throw err}}},{key:"fakeData",value:function fakeData(){var force=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;if(this._fakeData!==undefined&&force===false){return this._fakeData}else{this._fakeData={_d:true,_h:9,_k:random_1.HMapRandom.getOneOfNoSeed([0,1,2]),_r:{_dirs:[false,false,false,true],_move:true,_d:{_exit:true,_room:null,_seed:random_1.HMapRandom.getRandomIntegerNoSeed(100,1e3),_k:0,_w:false,_z:0},_o:3e5,_r:false,_x:7,_y:0},_w:15,_mid:random_1.HMapRandom.getRandomIntegerNoSeed(1e3,1e5),_zid:random_1.HMapRandom.getRandomIntegerNoSeed(1e3,1e5)};return this._fakeData}}},{key:"getFakeDirs",value:function getFakeDirs(pos){return this.fakeRuinDirections[pos.y][pos.x]}},{key:"patchDataJSON",value:function patchDataJSON(data){this.data._r=data}},{key:"height",get:function get(){return this.data._h}},{key:"width",get:function get(){return this.data._w}},{key:"position",get:function get(){return{x:this.data._r._x,y:this.data._r._y}}},{key:"directions",get:function get(){return this.data._r._dirs}},{key:"directionsStr",get:function get(){return""+ +this.directions[2]+ +this.directions[1]+ +this.directions[0]+ +this.directions[3]}},{key:"oxygen",get:function get(){return this.data._r._o}},{key:"ruinType",get:function get(){if(this.data._k===0){return"bunker"}else if(this.data._k===1){return"motel"}else{return"hospital"}}},{key:"zoneId",get:function get(){return this.data._zid}},{key:"exit",get:function get(){return this.data._r._d._exit}},{key:"seed",get:function get(){return this.data._r._d._seed}},{key:"zombies",get:function get(){return this.data._r._d._z}},{key:"door",get:function get(){return this.data._r._d._room}},{key:"room",get:function get(){return this.data._r._r}},{key:"kills",get:function get(){return this.data._r._d._k}}]);return HMapRuinData}(abstract_1.HMapData);exports.HMapRuinData=HMapRuinData},{"../random":22,"./abstract":2}],5:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Environment=function(){function Environment(){_classCallCheck(this,Environment);this._devMode=false}_createClass(Environment,[{key:"devMode",get:function get(){return this._devMode},set:function set(dev){this._devMode=dev}},{key:"dev",get:function get(){return this._devMode}},{key:"d",get:function get(){return this._devMode}},{key:"url",get:function get(){if(this.devMode===true){return"."}else{return"http://ryderone.dynu.net/"}}}],[{key:"getInstance",value:function getInstance(){if(Environment._instance===undefined){Environment._instance=new Environment}return Environment._instance}}]);return Environment}();exports.Environment=Environment},{}],6:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var grid_1=require("./maps/grid");var desert_1=require("./maps/desert");var ruin_1=require("./maps/ruin");var HMap=function(){function HMap(cssSelector){_classCallCheck(this,HMap);this.width=300;this.height=300;this.displayFlashMap=false;this.cssSelector=".swf";if(cssSelector!==undefined){this.cssSelector=cssSelector}}_createClass(HMap,[{key:"fetchMapData",value:function fetchMapData(){var _this5=this;if(this.map===undefined){this.autoBuildMap()}var counterCheckExists=0;var checkExist=setInterval(function(){if(document.querySelector("#swfCont")!==null){clearInterval(checkExist);var tempMapData;if(document.querySelector("#FlashMap")!==null){var node=document.querySelector("#FlashMap");if(node.nodeName.toUpperCase()==="OBJECT"){tempMapData=document.querySelector('#FlashMap param[name="flashvars"]').getAttribute("value").substring(13)}else{tempMapData=node.getAttribute("flashvars").substring(13)}}else{if(document.querySelector("#gameLayout")!==null){var scriptStr=document.querySelector("#gameLayout").innerHTML;var mapMarker=scriptStr.indexOf("mapLoader.swf");var exploMarker=scriptStr.indexOf("exploLoader.swf");if(mapMarker===-1&&exploMarker===-1){return}var startVar=-1;if(mapMarker!==-1){startVar=scriptStr.indexOf("data",mapMarker)+8}else{var textSearch="so.addVariable('data', '";startVar=scriptStr.indexOf(textSearch,mapMarker)+textSearch.length}var stopVar=scriptStr.indexOf("');",startVar);tempMapData=scriptStr.substring(startVar,stopVar)}}_this5.map.buildLayers();_this5.map.completeDataReceived({raw:tempMapData})}else if(++counterCheckExists===100){clearInterval(checkExist)}},100)}},{key:"setupInterceptor",value:function setupInterceptor(){var _js;var page=window.wrappedJSObject;if(page!==undefined&&page.js){_js=page.js}else{_js=js}if(_js&&_js.XmlHttp&&_js.XmlHttp.onData){this.originalOnData=_js.XmlHttp.onData;_js.XmlHttp.onData=this.dataInterceptor.bind(this)}else{throw new Error("HMap::setupInterceptor - Cannot find js.XmlHttp.onData")}}},{key:"dataInterceptor",value:function dataInterceptor(data){this.originalOnData(data);var currentLocation=this.getCurrentLocation();if(currentLocation==="unknown"){this.location="unknown";this.clearMap();return}if(data.indexOf("js.JsMap.init")!==-1||data.indexOf("js.JsExplo.init")!==-1||data.indexOf("exploLoader.swf")!==-1||data.indexOf("mapLoader.swf")!==-1){if(currentLocation!==this.location||data.indexOf("exploLoader.swf")!==-1||data.indexOf("mapLoader.swf")!==-1){this.location=currentLocation;this.clearMap();this.fetchMapData()}else{if(data.indexOf("js.JsMap.init")!==-1||data.indexOf("js.JsExplo.init")!==-1){var startVar=0;if(data.indexOf("js.JsMap.init")!==-1){startVar=data.indexOf("js.JsMap.init")+16}else{startVar=data.indexOf("js.JsExplo.init")+18}var stopVar=data.indexOf("',",startVar);var tempMapData=data.substring(startVar,stopVar);this.map.partialDataReceived({raw:tempMapData})}else{console.warn("HMap::dataInterceptor - this case hasn't been encoutered yet",data)}}}}},{key:"getCurrentLocation",value:function getCurrentLocation(){if(window.location.href.indexOf("outside")!==-1){return"desert"}else if(window.location.href.indexOf("door")!==-1){return"doors"}else if(window.location.href.indexOf("explo")!==-1){return"ruin"}else{return"unknown"}}},{key:"switchMapAndReload",value:function switchMapAndReload(type){var store=this.map.mapData.data;this.clearMap();if(type==="desert"){this.map=new desert_1.HMapDesertMap(this)}else if(type==="grid"){this.map=new grid_1.HMapGridMap(this)}else if(type==="ruin"){this.map=new ruin_1.HMapRuin(this)}this.map.buildLayers();this.map.completeDataReceived({JSON:store})}},{key:"reloadMapWithData",value:function reloadMapWithData(data){this.clearMap();this.target=undefined;this.autoBuildMap();this.map.buildLayers();this.map.completeDataReceived({JSON:data})}},{key:"clearMap",value:function clearMap(){var hmap=document.querySelector("#hmap");if(hmap!==null&&hmap.parentNode!==null){hmap.parentNode.removeChild(hmap)}this.map=undefined}},{key:"autoBuildMap",value:function autoBuildMap(){if(this.location==="doors"){this.map=new grid_1.HMapGridMap(this);this.map.mode="global"}else if(this.location==="desert"){this.map=new desert_1.HMapDesertMap(this)}else if(this.location==="ruin"){this.map=new ruin_1.HMapRuin(this)}else{throw new Error("HMap::autoBuildMap - could not detect location")}}}]);return HMap}();exports.HMap=HMap},{"./maps/desert":18,"./maps/grid":19,"./maps/ruin":20}],7:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var environment_1=require("./environment");var toast_1=require("./toast");var HMapImagesLoader=function(){function HMapImagesLoader(){_classCallCheck(this,HMapImagesLoader);this.images=new Map;var url=environment_1.Environment.getInstance().url+"/assets/";this.images.set("loading",{src:url+"loading.png",obj:undefined,width:300,height:300});this.images.set("glass",{src:url+"glass.png",obj:undefined,width:300,height:300});this.images.set("humanGlow",{src:url+"human_glow.png",obj:undefined,width:18,height:18});this.images.set("map",{src:url+"map.png",obj:undefined,width:950,height:950});this.images.set("moveArrowFill",{src:url+"move_arrow_fill.png",obj:undefined,width:82,height:27});this.images.set("moveArrowLight",{src:url+"move_arrow_light.png",obj:undefined,width:82,height:27});this.images.set("moveArrowOutline",{src:url+"move_arrow_outline.png",obj:undefined,width:83,height:28});this.images.set("night",{src:url+"night.png",obj:undefined,width:950,height:950});this.images.set("shadowFocus",{src:url+"shadow_focus.png",obj:undefined,width:433,height:433});this.images.set("targetArrow",{src:url+"town_arrow.png",obj:undefined,width:9,height:17});this.images.set("zombieGlow",{src:url+"zombie_glow.png",obj:undefined,width:18,height:18});this.images.set("blood",{src:url+"blood.png",obj:undefined,width:300,height:300});this.images.set("single",{src:url+"single.png",obj:undefined,width:200,height:200});this.images.set("hatch",{src:url+"hatch.png",obj:undefined,width:26,height:26});this.images.set("town",{src:url+"town.png",obj:undefined,width:26,height:26});this.images.set("building",{src:url+"building.png",obj:undefined,width:25,height:25});this.images.set("hatch-dense",{src:url+"hatch_dense.png",obj:undefined,width:25,height:25});this.images.set("target",{src:url+"target.png",obj:undefined,width:25,height:25});this.images.set("position",{src:url+"position.png",obj:undefined,width:25,height:25});this.images.set("people",{src:url+"people.png",obj:undefined,width:5,height:5});this.images.set("uncheck",{src:url+"uncheck.png",obj:undefined,width:12,height:13});this.images.set("check",{src:url+"check.png",obj:undefined,width:12,height:13});this.images.set("destination",{src:url+"destination.png",obj:undefined,width:12,height:12});this.images.set("depleted",{src:url+"depleted.png",obj:undefined,width:15,height:16});this.images.set("shovel",{src:url+"shovel.png",obj:undefined,width:15,height:16});for(var tag=1;tag<=11;tag++){this.images.set("tag_"+tag,{src:url+"tags/"+tag+".png",obj:undefined,width:16,height:16})}this.images.set("tag_12",{src:url+"tags/12.gif",obj:undefined,width:16,height:16})}_createClass(HMapImagesLoader,[{key:"loadRuinPics",value:function loadRuinPics(location){var url=environment_1.Environment.getInstance().url+"/assets/ruin/";this.images.set("0001",{src:url+location+"/0001.png",obj:undefined,width:300,height:300});this.images.set("0010",{src:url+location+"/0010.png",obj:undefined,width:300,height:300});this.images.set("0011",{src:url+location+"/0011.png",obj:undefined,width:300,height:300});this.images.set("0100",{src:url+location+"/0100.png",obj:undefined,width:300,height:300});this.images.set("0101",{src:url+location+"/0101.png",obj:undefined,width:300,height:300});this.images.set("0110",{src:url+location+"/0110.png",obj:undefined,width:300,height:300});this.images.set("0111",{src:url+location+"/0111.png",obj:undefined,width:300,height:300});this.images.set("1000",{src:url+location+"/1000.png",obj:undefined,width:300,height:300});this.images.set("1001",{src:url+location+"/1001.png",obj:undefined,width:300,height:300});this.images.set("1010",{src:url+location+"/1010.png",obj:undefined,width:300,height:300});this.images.set("1011",{src:url+location+"/1011.png",obj:undefined,width:300,height:300});this.images.set("1100",{src:url+location+"/1100.png",obj:undefined,width:300,height:300});this.images.set("1101",{src:url+location+"/1101.png",obj:undefined,width:300,height:300});this.images.set("1110",{src:url+location+"/1110.png",obj:undefined,width:300,height:300});this.images.set("1111",{src:url+location+"/1111.png",obj:undefined,width:300,height:300});this.images.set("dead",{src:url+location+"/dead.png",obj:undefined,width:23,height:36});this.images.set("exit",{src:url+location+"/exit.png",obj:undefined,width:62,height:57});this.images.set("room",{src:url+location+"/room.png",obj:undefined,width:300,height:300});this.images.set("zombiegif",{src:url+location+"/zombie.gif",obj:undefined,width:25,height:38});this.images.set("door-top-closed",{src:url+location+"/dtc.png",obj:undefined,width:30,height:30});this.images.set("door-top-open",{src:url+location+"/dto.png",obj:undefined,width:30,height:30});this.images.set("door-top-right-closed",{src:url+location+"/dtrc.png",obj:undefined,width:30,height:30});this.images.set("door-top-right-open",{src:url+location+"/dtro.png",obj:undefined,width:30,height:30});this.images.set("door-top-left-closed",{src:url+location+"/dtlc.png",obj:undefined,width:30,height:30});this.images.set("door-top-left-open",{src:url+location+"/dtlo.png",obj:undefined,width:30,height:30});this.images.set("door-bottom-closed",{src:url+location+"/dbc.png",obj:undefined,width:30,height:30});this.images.set("door-bottom-open",{src:url+location+"/dbo.png",obj:undefined,width:30,height:30});this.images.set("door-bottom-right-closed",{src:url+location+"/dbrc.png",obj:undefined,width:30,height:30});this.images.set("door-bottom-right-open",{src:url+location+"/dbro.png",obj:undefined,width:30,height:30});this.images.set("door-bottom-left-closed",{src:url+location+"/dblc.png",obj:undefined,width:30,height:30});this.images.set("door-bottom-left-open",{src:url+location+"/dblo.png",obj:undefined,width:30,height:30});this.images.set("door-left-closed",{src:url+location+"/dlc.png",obj:undefined,width:30,height:30});this.images.set("door-left-open",{src:url+location+"/dlo.png",obj:undefined,width:30,height:30});this.images.set("door-right-closed",{src:url+location+"/drc.png",obj:undefined,width:30,height:30});this.images.set("door-right-open",{src:url+location+"/dro.png",obj:undefined,width:30,height:30});this.images.set("you",{src:url+"you.gif",obj:undefined,width:16,height:32});this.images.set("you-noox",{src:url+"you_noox.gif",obj:undefined,width:16,height:34});this.images.set("scanner",{src:url+"scanner.gif",obj:undefined,width:38,height:27});if(location==="motel"){this.images.set("wall_bench_A",{src:url+location+"/wall_bench_A.png",obj:undefined,width:42,height:22});this.images.set("wall_bench_B",{src:url+location+"/wall_bench_B.png",obj:undefined,width:42,height:22});this.images.set("wall_bench_G",{src:url+location+"/wall_bench_G.png",obj:undefined,width:42,height:22});this.images.set("wall_bench_H",{src:url+location+"/wall_bench_H.png",obj:undefined,width:42,height:22});this.images.set("wall_flowers_D",{src:url+location+"/wall_flowers_D.png",obj:undefined,width:22,height:39});this.images.set("wall_flowers_E",{src:url+location+"/wall_flowers_E.png",obj:undefined,width:22,height:39});this.images.set("wall_palmtree_B",{src:url+location+"/wall_palmtree_B.png",obj:undefined,width:25,height:35});this.images.set("wall_palmtree_G",{src:url+location+"/wall_palmtree_G.png",obj:undefined,width:25,height:35});this.images.set("zone_dead_bottom",{src:url+location+"/zone_dead_bottom.png",obj:undefined,width:28,height:53});this.images.set("zone_dead_left",{src:url+location+"/zone_dead_left.png",obj:undefined,width:53,height:28});this.images.set("zone_dead_right",{src:url+location+"/zone_dead_right.png",obj:undefined,width:53,height:28});this.images.set("zone_dead_top",{src:url+location+"/zone_dead_top.png",obj:undefined,width:28,height:53});this.images.set("zone_stain_bottom",{src:url+location+"/zone_stain_bottom.png",obj:undefined,width:70,height:95});this.images.set("zone_stain_left",{src:url+location+"/zone_stain_left.png",obj:undefined,width:95,height:70});this.images.set("zone_stain_right",{src:url+location+"/zone_stain_right.png",obj:undefined,width:95,height:70});this.images.set("zone_stain_top",{src:url+location+"/zone_stain_top.png",obj:undefined,width:70,height:95})}else if(location==="hospital"){this.images.set("wall_bed_D",{src:url+location+"/wall_bed_D.png",obj:undefined,width:20,height:51});this.images.set("wall_bed_E",{src:url+location+"/wall_bed_E.png",obj:undefined,width:20,height:51});this.images.set("wall_dead_D",{src:url+location+"/wall_dead_D.png",obj:undefined,width:30,height:32});this.images.set("wall_dead_E",{src:url+location+"/wall_dead_E.png",obj:undefined,width:30,height:32});this.images.set("wall_grid_J",{src:url+location+"/wall_grid_J.png",obj:undefined,width:12,height:25});this.images.set("wall_grid_K",{src:url+location+"/wall_grid_K.png",obj:undefined,width:12,height:25});this.images.set("zone_dead_bottom",{src:url+location+"/zone_dead_bottom.png",obj:undefined,width:28,height:27});this.images.set("zone_dead_left",{src:url+location+"/zone_dead_left.png",obj:undefined,width:27,height:28});this.images.set("zone_dead_right",{src:url+location+"/zone_dead_right.png",obj:undefined,width:27,height:28});this.images.set("zone_dead_top",{src:url+location+"/zone_dead_top.png",obj:undefined,width:28,height:27})}else if(location==="bunker"){this.images.set("wall_barrel_D",{src:url+location+"/wall_barrel_D.png",obj:undefined,width:18,height:27});this.images.set("wall_barrel_E",{src:url+location+"/wall_barrel_E.png",obj:undefined,width:18,height:27});this.images.set("wall_grid_D",{src:url+location+"/wall_grid_D.png",obj:undefined,width:12,height:54});this.images.set("wall_grid_E",{src:url+location+"/wall_grid_E.png",obj:undefined,width:12,height:54});this.images.set("wall_gutter_B",{src:url+location+"/wall_gutter_B.png",obj:undefined,width:32,height:21});this.images.set("wall_gutter_G",{src:url+location+"/wall_gutter_G.png",obj:undefined,width:32,height:21});this.images.set("wall_hatch_A",{src:url+location+"/wall_hatch_A.png",obj:undefined,width:25,height:14});this.images.set("wall_hatch_B",{src:url+location+"/wall_hatch_B.png",obj:undefined,width:25,height:14});this.images.set("wall_hatch_G",{src:url+location+"/wall_hatch_G.png",obj:undefined,width:25,height:14});this.images.set("wall_hatch_H",{src:url+location+"/wall_hatch_H.png",obj:undefined,width:25,height:14});this.images.set("wall_pipe_D",{src:url+location+"/wall_pipe_D.png",obj:undefined,width:42,height:59});this.images.set("wall_pipe_E",{src:url+location+"/wall_pipe_E.png",obj:undefined,width:42,height:59})}}},{key:"isset",value:function isset(imageId){return this.images.get(imageId)!==undefined}},{key:"get",value:function get(imageId){return this.images.get(imageId)}},{key:"set",value:function set(imageId,value){this.images.set(imageId,value)}},{key:"issetImg",value:function issetImg(imageId){return this.isset(imageId)&&this.get(imageId).obj!==undefined}},{key:"getImg",value:function getImg(imageId){return this.get(imageId).obj}},{key:"preloadPictures",value:function preloadPictures(loadingLayer,init,onFinished){var _this6=this;var loaded=0;this.images.forEach(function(value){if(value.obj===undefined){var img=new Image;img.src=value.src;img.onload=function(){if(init){loadingLayer.progress(loaded/_this6.images.size)}if(++loaded===_this6.images.size&&onFinished){onFinished()}};img.onerror=function(){toast_1.Toast.show("Cannot load ressource : "+value.src)};value.obj=img}else{if(init){loadingLayer.progress(loaded/_this6.images.size)}if(++loaded===_this6.images.size&&onFinished){onFinished()}}})}},{key:"registerBuildingsToPreload",value:function registerBuildingsToPreload(neighbours){var _this7=this;neighbours.neighbours.forEach(function(neighbour){if(neighbour.building!==0&&neighbour.building!==undefined&&!_this7.issetImg("b"+neighbour.building)){var _url;if(neighbour.building===-1){_url=environment_1.Environment.getInstance().url+"/assets/buildings/b_m1.png"}else{_url=environment_1.Environment.getInstance().url+"/assets/buildings/b_"+neighbour.building+".png"}_this7.set("b"+neighbour.building,{src:_url,obj:undefined,height:100,width:100})}})}}],[{key:"getInstance",value:function getInstance(){if(this._instance===undefined){this._instance=new HMapImagesLoader}return this._instance}}]);return HMapImagesLoader}();exports.HMapImagesLoader=HMapImagesLoader},{"./environment":5,"./toast":23}],8:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var ruinNames={fr:{bunker:["Bunker abandonné","Bunker thermonucléaire","Bunker maginot","Bunker de la peur","Bunker de la fureur","Abri atomique","Pas d'abri, t'es pris !","Blockhaus glauque","Blockhaus abandonné","Blockhaus plein d'os","Blockhaus à l'os","Centre d'expérimentation","Bunker zone 52.1","Bunker zone 33","Etude des quarantaines"],motel:["Hôtel charlton eston","Le Motel enchanté","Caesar palace","Le palace de la place","L'Hôtel sordide","Hôtel terminus","Palace pas classe","Relais des gourmets","Hôtel de passe","Hôtel particulier","Hôtel de la défenestration","Hôtel Santa frit","Hôtel Chez yen","Hôtel Old port bay club","Hôtel Sapin lodge","Hôtel Front tenace","Hôtel Beverly colline","Palace Gonzalez"],hospital:["Hôpital Velpo","Clinique esthétruique","Hôpital malade","L'Hôpital du régal","L'hospice du vice","L'hôpital du mal","Clinique du couic !","Clinique aux allergiques","Pelle grain","Sale pré-trier","White et Necker","C.H.UT","Bordeaux grace","Georges XXXII"]},en:{bunker:["Abandoned Bunker","Thermonuclear Bunker","Garrison House","Bastion of Fear","Bunker of Fury","Fallout Shelter","Nowhere to hide, even inside!","Shady Fort","Abandoned Troop Station","Bone-filled Bunker","Bone Blockhouse","Secret Testing Center","Area 52.1 Shelter","Area 33 Bunker","Quarantine Zone"],motel:["Charlton Eston Hotel","The Enchanted Motel","The Rabble Lodge","The Unravel Inn","The Busted Arts","Terminal Hotel","Hotel Von Otto","S+M B+B","The Passing Trade Motel","The Hotel Peculiar","Liza Defenestration Hotel","The Smashed Santa Inn","Chez Clem Hotel","Three Door Hotel + Spa","Hostel Partout","The Bumbling Inn","The Vajazzl Inn","Hotel Venga"],hospital:["Cash Ulty Hospital","Aesthetyxiation Unit","Syck Niss Hospital","Royal Troon Hospital","The Munro Chronic STI Treatment Unit","Bill S. Preston Memorial Hospital","Dr Kwak's Clinic!","The Mererid Allergy Clinic","Pelle Grain Hospital","Osmond St Hospital","The Chapman Penis Reduction Clinic","The Brunting Daily Exhaustion Center","Bordeaux Grace","George and Ralph Children's Hospital"]},es:{bunker:["Bunker abandonado","Bunker termonuclear","Bunker de políticos","Bunker del terror","Bunker de los prófugos","Guarida insalubre","Refugio Fin del Mundo","Bunker rockero","Bunker graffitero","Bunker lleno de huesos","Bunker del rey","Centro de experimentos","Bunker zona 52.1","Bunker zona 33","Viejo bunker"],motel:["Hotel California","Hotel El Cielo II","Death Palace Hotel","Hostal Barato","Hotel Maravilla","Hotel Melody","Hotel Paraeso","Hostal de Paso","Hotel Particular","Hotel Monstruo","Hotel Znarfo","Hotel Transilvania","Hotel Nirvana","Hostal El Secreto","Hotel El Pájaro Loco","Hotel Gonzalez","Hostal El Cielo I"],hospital:["Hospital Matasanos","Clínica El Serrucho","Hospital Privado","Hospital del Rey","Clínica de Miércoles","Hospital Sangriento","Hospital Bar Discoteca","Hospital Cementerio","Hospital Dolores","Hospital Milagros","Clínica del Dr. Cuervo","Hospital Nocturno","Hospital del Estado","Hospital Madre Mía"]},de:{bunker:["Abandoned Bunker","Thermonuclear Bunker","Garrison House","Bastion of Fear","Bunker of Fury","Fallout Shelter","Nowhere to hide, even inside!","Shady Fort","Abandoned Troop Station","Bone-filled Bunker","Bone Blockhouse","Secret Testing Center","Area 52.1 Shelter","Area 33 Bunker","Quarantine Zone"],motel:["Charlton Eston Hotel","The Enchanted Motel","The Rabble Lodge","The Unravel Inn","The Busted Arts","Terminal Hotel","Hotel Von Otto","S+M B+B","The Passing Trade Motel","The Hotel Peculiar","Liza Defenestration Hotel","The Smashed Santa Inn","Chez Clem Hotel","Three Door Hotel + Spa","Hostel Partout","The Bumbling Inn","The Vajazzl Inn","Hotel Venga"],hospital:["Cash Ulty Hospital","Aesthetyxiation Unit","Syck Niss Hospital","Royal Troon Hospital","The Munro Chronic STI Treatment Unit","Bill S. Preston Memorial Hospital","Dr Kwak's Clinic!","The Mererid Allergy Clinic","Pelle Grain Hospital","Osmond St Hospital","The Chapman Penis Reduction Clinic","The Brunting Daily Exhaustion Center","Bordeaux Grace","George and Ralph Children's Hospital"]}};var french={modebutton:"Global",mapbutton:"Carte",debugbutton:"Debug",markersbutton:"Marqueurs",closebutton:"Fermer",resetbutton:"Reset",tag_1:"Appel à l'aide",tag_2:"Ressources abandonnées",tag_3:"Objet(s) abandonné(s)",tag_4:"Objet(s) important(s) !",tag_5:"Zone épuisée",tag_6:"Zone sécurisée",tag_7:"Zone à déblayer",tag_8:"Entre 5 et 8 zombies",tag_9:"9 zombies ou plus !",tag_10:"Campement prévu",tag_11:"Ruine à explorer",tag_12:"Âme perdue",fewZombies:"Zombies isolés",medZombies:"Meute de zombies",manyZombies:"Horde de zombies",toastdebug:"Le debug a été copié dans le presse papier",toasterror:"Une erreur est survenue. Ouvrez la console pour plus d'informations",undigged:"Secteur inexploitable",oxygen:"Oxygène",position:"Position"};var english={modebutton:"Global",mapbutton:"Carte",debugbutton:"Debug",markersbutton:"Markers",closebutton:"Close",resetbutton:"Reset",tag_1:"Call for help",tag_2:"Abandoned Resources",tag_3:"Abandoned Object(s)",tag_4:"Important Object(s) !",tag_5:"Zone depleted",tag_6:"Zone secured",tag_7:"Zone uncleared",tag_8:"Between 5 and 8 zombies",tag_9:"9 zombies or more !",tag_10:"Likely campsite",tag_11:"Ruin to explore",tag_12:"Lost soul",fewZombies:"Isolated zombies",medZombies:"Pack of zombies",manyZombies:"Horde of zombies",toastdebug:"Debug has been copied to clipboard",toasterror:"An error occurred. Check the console for more informations",undigged:"Unsearchable zone",oxygen:"Oxygen",position:"Position"};var german={modebutton:"Global",mapbutton:"Karte",debugbutton:"Debug",markersbutton:"Mark.",closebutton:"Schliessen",resetbutton:"Zurücksetzen",tag_1:"Hilferuf",tag_2:"Liegengebliebene Rohstoffe",tag_3:"Hinterlassene(r) Gegenstand/-aende",tag_4:"Wichtiger Gegenstand/-aende!",tag_5:"Zone leergesucht",tag_6:"Zone gesichert",tag_7:"Zone muss freigeraeumt werden",tag_8:"Zwischen 5 und 8 Zombies",tag_9:"9 oder mehr Zombies!",tag_10:"Camping geplant",tag_11:"Ruine zum Erkunden",tag_12:"Verlorene Seele",fewZombies:"Einzelner Zombie",medZombies:"Zombiemeute",manyZombies:"Zombiehorde",toastdebug:"Debug wurde in die Zwischenablage kopiert",toasterror:"Ein Fehler ist aufgetreten. Überprüfen Sie die Konsole für weitere Informationen",undigged:"Sektor nicht durchsuchbar",oxygen:"Sauerstoff",position:"Position"};var spanish={modebutton:"Global",mapbutton:"Mapa",debugbutton:"Debug",markersbutton:"Marca",closebutton:"Cerrar",resetbutton:"Reiniciar",tag_1:"Pedir ayuda",tag_2:"Recursos abandonado",tag_3:"Objeto(s) abandonado(s)",tag_4:"¡Objeto(s) importante(s)!",tag_5:"Zona agotada",tag_6:"Zona segura",tag_7:"Zona a despejar",tag_8:"Entre 5 y 8 zombis",tag_9:"¡9 zombis o más!",tag_10:"Campamento posible",tag_11:"Ruina a explorar",tag_12:"Alma perdida",fewZombies:"Zombis sueltos",medZombies:"Banda de zombis",manyZombies:"Turba de zombis",toastdebug:"La depuración se ha copiado al portapapeles.",toasterror:"Ocurrió un error. Compruebe la consola para más información",undigged:"Sector inexplotable",oxygen:"Oxígeno",position:"Posición"};var HMapLang=function(){function HMapLang(){_classCallCheck(this,HMapLang);this.traductions=new Map;this.language=this.detectLanguage();this.traductions.set("fr",french);this.traductions.set("en",english);this.traductions.set("de",german);this.traductions.set("es",spanish)}_createClass(HMapLang,[{key:"_get",value:function _get(key){if(this.traductions.get(this.language)!==undefined){var trads=this.traductions.get(this.language);return trads[key]}return this.traductions.get("en")[key]}},{key:"getRuinNames",value:function getRuinNames(ruinType){return ruinNames[this.language][ruinType]}},{key:"detectLanguage",value:function detectLanguage(){var url=window.location;if("hordes.fr"in url){return"fr"}else if("die2nite.com"in url){return"en"}else if("dieverdammten.de"in url){return"de"}else if("www.zombinoia.com"in url){return"es"}else{return"fr"}}}],[{key:"getInstance",value:function getInstance(){if(HMapLang.instance===undefined){HMapLang.instance=new HMapLang}return HMapLang.instance}},{key:"get",value:function get(key){var instance=HMapLang.getInstance();return instance._get(key)}}]);return HMapLang}();exports.HMapLang=HMapLang},{}],9:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var imagesLoader_1=require("../imagesLoader");var AbstractHMapLayer=function(){function AbstractHMapLayer(map){_classCallCheck(this,AbstractHMapLayer);this.ns="http://www.w3.org/2000/svg";this.map=map}_createClass(AbstractHMapLayer,[{key:"rect",value:function rect(x,y,width,height,fill,stroke){var strokeWidth=arguments.length>6&&arguments[6]!==undefined?arguments[6]:2;var rect=document.createElementNS(this.ns,"rect");rect.setAttributeNS(null,"x",(x|0)+"");rect.setAttributeNS(null,"y",(y|0)+"");rect.setAttributeNS(null,"width",width+"");rect.setAttributeNS(null,"height",height+"");if(fill!==undefined){rect.setAttributeNS(null,"fill",fill)}if(stroke!==undefined){rect.setAttributeNS(null,"stroke",stroke);rect.setAttributeNS(null,"stroke-width",strokeWidth+"")}rect.setAttributeNS(null,"shape-rendering","crispEdges");this.g.appendChild(rect);return rect}},{key:"path",value:function path(d,stroke){var strokeWidth=arguments.length>2&&arguments[2]!==undefined?arguments[2]:2;var path=document.createElementNS(this.ns,"path");path.setAttributeNS(null,"d",d);if(stroke!==undefined){path.setAttributeNS(null,"stroke",stroke);path.setAttributeNS(null,"stroke-width",strokeWidth+"")}this.g.appendChild(path);return path}},{key:"imgFromObj",value:function imgFromObj(id,x,y,angle,cssClass,height,width){var url=imagesLoader_1.HMapImagesLoader.getInstance().get(id).src;if(width===undefined){width=imagesLoader_1.HMapImagesLoader.getInstance().get(id).width}if(height===undefined){height=imagesLoader_1.HMapImagesLoader.getInstance().get(id).height}return this.img(url,x,y,width,height,angle,cssClass)}},{key:"textDetached",value:function textDetached(x,y,text,cssclass){var element=document.createElementNS(this.ns,"text");element.setAttributeNS(null,"x",(x|0)+"");element.setAttributeNS(null,"y",(y|0)+"");element.setAttributeNS(null,"shape-rendering","crispEdges");element.setAttributeNS(null,"dominant-baseline","middle");var txt=document.createTextNode(text);element.appendChild(txt);element.style.pointerEvents="none";element.style.userSelect="none";if(cssclass){element.setAttributeNS(null,"class",cssclass)}return element}},{key:"text",value:function text(x,y,_text,cssclass){var txt=this.textDetached(x,y,_text,cssclass);this.g.appendChild(txt);return txt}},{key:"img",value:function img(url,x,y,width,height,angle,cssClass){var img=document.createElementNS(this.ns,"image");img.setAttributeNS(null,"height",height+"");img.setAttributeNS(null,"width",width+"");img.setAttributeNS("http://www.w3.org/1999/xlink","href",url);img.setAttributeNS(null,"x",(x|0)+"");img.setAttributeNS(null,"y",(y|0)+"");img.setAttributeNS(null,"shape-rendering","crispEdges");if(cssClass){img.setAttributeNS(null,"class",cssClass)}img.style.pointerEvents="none";this.g.appendChild(img);if(angle&&width&&height){img.setAttributeNS(null,"transform","rotate("+angle+" "+(x+width/2)+" "+(y+height/2)+")")}return img}}]);return AbstractHMapLayer}();exports.AbstractHMapLayer=AbstractHMapLayer},{"../imagesLoader":7}],10:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var abstract_1=require("./abstract");var random_1=require("../random");var HMapSVGDesertBackgroundLayer=function(_abstract_1$AbstractH){_inherits(HMapSVGDesertBackgroundLayer,_abstract_1$AbstractH);function HMapSVGDesertBackgroundLayer(map){var _this8;_classCallCheck(this,HMapSVGDesertBackgroundLayer);_this8=_possibleConstructorReturn(this,_getPrototypeOf(HMapSVGDesertBackgroundLayer).call(this,map));_this8.translation={x:0,y:0};_this8.parallax={x:0,y:0};_this8.translateTo={x:0,y:0};var hmap=document.querySelector("#hmap");if(document.querySelector("#svgDesertBackground")===null&&hmap){var SVG=document.createElementNS(_this8.ns,"svg");SVG.setAttributeNS(null,"id","svgDesertBackground");SVG.setAttributeNS(null,"style","position:absolute;z-index:2;");hmap.appendChild(SVG)}_this8.svg=document.getElementById("svgDesertBackground");_this8.svg.setAttributeNS(null,"width",map.width+"px");_this8.svg.setAttributeNS(null,"height",map.height+"px");_this8.svg.style.width=map.width+"px";_this8.svg.style.height=map.height+"px";_this8.type="desert-background";return _this8}_createClass(HMapSVGDesertBackgroundLayer,[{key:"onMouseMove",value:function onMouseMove(e){if(this.translateTo.x!==0||this.translateTo.y!==0||!this.g){return}var rect=this.svg.getBoundingClientRect();var mouseX=e.clientX-rect.left;var mouseY=e.clientY-rect.top;var centerX=150;var centerY=150;this.parallax.x=Math.floor(-1*(centerX-mouseX)/10);this.parallax.y=Math.floor(-1*(centerY-mouseY)/10);this.translation.x=this.parallax.x;this.translation.y=this.parallax.y;this.g.setAttributeNS(null,"transform","translate("+-1*this.translation.x+" "+-1*this.translation.y+")")}},{key:"onMouseLeave",value:function onMouseLeave(e){var rect=this.svg.getBoundingClientRect();var mouseX=e.clientX-rect.left;var mouseY=e.clientY-rect.top;if(mouseX<1||mouseY<1||mouseX>=this.map.width*.98||mouseY>=this.map.height*.98){this.parallax.x=0;this.parallax.y=0;this.translation={x:0,y:0};this.g.setAttributeNS(null,"transform","translate("+-1*this.translation.x+" "+-1*this.translation.y+")")}}},{key:"easeMovement",value:function easeMovement(target,callback){var _this9=this;this.startTranslate=Date.now();this.translateTo=target;if(!this.intervalEasing){this.intervalEasing=window.setInterval(function(){var coef=1;if(_this9.startTranslate){var p=(Date.now()-_this9.startTranslate)/300;coef=p>=1?1:1-Math.pow(2,-10*p)}else{throw new Error("Cannot ease without starting the translation")}var translateX=_this9.translateTo.x+_this9.parallax.x;var translateY=_this9.translateTo.y+_this9.parallax.y;_this9.translation.x=translateX*coef;_this9.translation.y=translateY*coef;_this9.g.setAttributeNS(null,"transform","translate("+-1*_this9.translation.x+" "+-1*_this9.translation.y+")");if(coef>=1){_this9.startTranslate=undefined;_this9.translateTo={x:0,y:0};clearInterval(_this9.intervalEasing);_this9.intervalEasing=undefined;callback();return}},40)}}},{key:"draw",value:function draw(){var _this10=this;var oldGroup=this.g;this.g=document.createElementNS(this.ns,"g");var map=this.map;var mapData=this.map.mapData;var seed=mapData.zoneId;var random=new random_1.HMapRandom(seed);var neighbours=mapData.neighbours;var center={x:map.width/2,y:map.height/2};var position=mapData.position;var numberOfHumans=mapData.numberOfHumans;var numberOfZombies=mapData.numberOfZombies;this.imgFromObj("map",-100*(position.x%6)-25,-100*(position.y%6)-25);neighbours.neighbours.forEach(function(neighbour){if(neighbour.building!==0&&neighbour.building!==null){var building=_this10.imgFromObj("b"+neighbour.building,neighbour.offsetX,neighbour.offsetY);building.setAttributeNS(null,"hmap-bid",neighbour.building+"");building.setAttributeNS(null,"hmap-x",neighbour.offsetX+"");building.setAttributeNS(null,"hmap-y",neighbour.offsetY+"");building.style.pointerEvents="auto";building.onmouseenter=_this10.showPopupBuilding.bind(_this10);building.onmouseleave=_this10.hidePopupBuilding.bind(_this10)}});if(mapData.hour<7||mapData.hour>18){this.imgFromObj("night",-25,-25)}this.imgFromObj("humanGlow",141,141);for(var k=1;k<=numberOfHumans-1;k++){var newPosH=random.randomCircle(center,Math.floor(random.random()*30)+5);this.imgFromObj("humanGlow",newPosH.x,newPosH.y)}for(var n=1;n<=numberOfZombies;n++){var newPosZ=random.randomCircle(center,Math.floor(random.random()*40)+5);this.imgFromObj("zombieGlow",newPosZ.x,newPosZ.y)}for(var i=mapData.position.x-2;i<mapData.position.x+3;i++){for(var j=mapData.position.y-2;j<mapData.position.y+3;j++){var point={x:i,y:j};if(!mapData.inBounds(point)||!mapData.isPositionDiscovered(point)){var oX=0,oY=0;if(j-mapData.position.y===0&&i>mapData.position.x){oX=15}else if(j-mapData.position.y===0&&i<mapData.position.x){oX=-15}else if(i-mapData.position.x===0&&j>mapData.position.y){oY=15}else if(i-mapData.position.x===0&&j<mapData.position.y){oY=-15}var offsetX=(i-mapData.position.x+1)*100;var offsetY=(j-mapData.position.y+1)*100;if(!(offsetX===100&&offsetY===100)){this.imgFromObj("single",offsetX-50+oX,offsetY-50+oY)}}}}this.translation.x=this.parallax.x;this.translation.y=this.parallax.y;this.g.setAttributeNS(null,"transform","translate("+-1*this.translation.x+" "+-1*this.translation.y+")");this.svg.appendChild(this.g);if(oldGroup){window.setTimeout(function(){return _this10.svg.removeChild(oldGroup)},300)}}},{key:"showPopupBuilding",value:function showPopupBuilding(e){var canvas=document.createElement("canvas");var ctx=canvas.getContext("2d");ctx.font="13px visitor2";var target=e.target;var buildingId=+target.getAttributeNS(null,"hmap-bid");var map=this.map;var mapData=map.mapData;var buildingName=buildingId===1?mapData.townName:mapData.buildings.get(buildingId);var textWidth=ctx.measureText(buildingName).width;var x=+target.getAttributeNS(null,"hmap-x")+50;var y=+target.getAttributeNS(null,"hmap-y")+85;var popupWidth=Math.floor(textWidth+10);var popupHeight=16;var minWidthHeight=Math.min(map.width,map.height);var xPopup=Math.floor(Math.min(Math.max(x-popupWidth/2,0),minWidthHeight-popupWidth));var yPopup=Math.max(y-popupHeight,0)|0;var popup=this.rect(xPopup,yPopup,popupWidth,popupHeight,"#000000","#b9ba3e",1);popup.setAttributeNS(null,"fill-opacity","0.6");popup.setAttributeNS(null,"class","hmap-popup");popup.style.pointerEvents="none";this.text(xPopup+popupWidth/2-textWidth/2,yPopup+8,buildingName,"hmap-text-green hmap-popup");document.querySelectorAll(".hmap-popup").forEach(function(element){element.style.zIndex="11"})}},{key:"hidePopupBuilding",value:function hidePopupBuilding(e){document.querySelectorAll(".hmap-popup").forEach(function(element){element.remove()})}}]);return HMapSVGDesertBackgroundLayer}(abstract_1.AbstractHMapLayer);exports.HMapSVGDesertBackgroundLayer=HMapSVGDesertBackgroundLayer},{"../random":22,"./abstract":9}],11:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var abstract_1=require("./abstract");var lang_1=require("../lang");var HMapSVGDesertForegroundLayer=function(_abstract_1$AbstractH2){_inherits(HMapSVGDesertForegroundLayer,_abstract_1$AbstractH2);function HMapSVGDesertForegroundLayer(map){var _this11;_classCallCheck(this,HMapSVGDesertForegroundLayer);_this11=_possibleConstructorReturn(this,_getPrototypeOf(HMapSVGDesertForegroundLayer).call(this,map));var hmap=document.querySelector("#hmap");if(document.querySelector("#svgDesertForeground")===null&&hmap){var SVG=document.createElementNS(_this11.ns,"svg");SVG.setAttributeNS(null,"id","svgDesertForeground");SVG.setAttributeNS(null,"style","position:absolute;z-index:3;");hmap.appendChild(SVG)}_this11.svg=document.getElementById("svgDesertForeground");_this11.svg.setAttributeNS(null,"width",map.width+"px");_this11.svg.setAttributeNS(null,"height",map.height+"px");_this11.svg.style.width=map.width+"px";_this11.svg.style.height=map.height+"px";_this11.svg.style.pointerEvents="none";_this11.type="desert-foreground";return _this11}_createClass(HMapSVGDesertForegroundLayer,[{key:"draw",value:function draw(){var _this12=this;var oldGroup=this.g;this.g=document.createElementNS(this.ns,"g");var map=this.map;var mapData=this.map.mapData;this.imgFromObj("shadowFocus",(map.width-433)/2,(map.height-433)/2);if(mapData.position.x!==map.target.x||mapData.position.y!==map.target.y){var targetAngle=Math.atan2(map.target.y-mapData.position.y,map.target.x-mapData.position.x);this.positionTargetArrow(targetAngle)}if(mapData.position.x===map.target.x&&mapData.position.y===map.target.y){this.imgFromObj("destination",150-6,150-6)}if(!mapData.hasControl){this.imgFromObj("blood",0,0)}this.imgFromObj("glass",0,0);var relativePos=mapData.getPositionRelativeToTown(mapData.position);var positionText=lang_1.HMapLang.get("position")+" : "+relativePos.x+" / "+relativePos.y;var positionTextElement=this.text(map.width-10,map.height-25,positionText,"hmap-text-green");positionTextElement.setAttributeNS(null,"text-anchor","end");positionTextElement.style.fontSize="14px";var _loop=function _loop(i,j){var arrow=map.registredArrows[i];var arrowImg=_this12.imgFromObj("moveArrowLight",arrow.ax,arrow.ay,arrow.a);arrowImg.style.pointerEvents="auto";arrowImg.style.cursor="pointer";_this12.imgFromObj("moveArrowOutline",arrow.ax,arrow.ay,arrow.a);arrowImg.onmouseenter=function(){var arrowFill=_this12.imgFromObj("moveArrowLight",arrow.ax,arrow.ay,arrow.a);arrowFill.setAttributeNS(null,"class","hmap-arrowFill")};arrowImg.onmouseleave=function(){document.querySelectorAll(".hmap-arrowFill").forEach(function(element){element.remove()})};arrowImg.onclick=function(){_this12.map.move(arrow.t)}};for(var i=0,j=map.registredArrows.length;i<j;i++){_loop(i,j)}if(mapData.scoutArray&&mapData.scoutArray.length===4){if(mapData.neighbours.neighbours.get("top_center").outbounds===false){this.text(148,30,""+mapData.scoutArray[0],"hmap-text-green")}if(mapData.neighbours.neighbours.get("middle_right").outbounds===false){this.text(270,150,""+mapData.scoutArray[1],"hmap-text-green")}if(mapData.neighbours.neighbours.get("bottom_center").outbounds===false){this.text(148,270,""+mapData.scoutArray[2],"hmap-text-green")}if(mapData.neighbours.neighbours.get("middle_left").outbounds===false){this.text(30,150,""+mapData.scoutArray[3],"hmap-text-green")}}if(mapData.scavengerArray&&mapData.scavengerArray.length===4){if(mapData.scavengerArray[0]===true){this.imgFromObj("shovel",142,24)}else if(mapData.scavengerArray[0]===false){this.imgFromObj("depleted",142,24)}if(mapData.scavengerArray[1]===true){this.imgFromObj("shovel",263,142)}else if(mapData.scavengerArray[1]===false){this.imgFromObj("depleted",263,142)}if(mapData.scavengerArray[2]===true){this.imgFromObj("shovel",142,256)}else if(mapData.scavengerArray[2]===false){this.imgFromObj("depleted",142,256)}if(mapData.scavengerArray[3]===true){this.imgFromObj("shovel",26,142)}else if(mapData.scavengerArray[3]===false){this.imgFromObj("depleted",26,142)}}this.svg.appendChild(this.g);if(oldGroup){window.setTimeout(function(){return _this12.svg.removeChild(oldGroup)},10)}}},{key:"positionTargetArrow",value:function positionTargetArrow(angle){var originX=this.map.width/2-4;var originY=this.map.height/2-8;originX+=120*Math.cos(angle);originY+=120*Math.sin(angle);this.imgFromObj("targetArrow",originX,originY,angle*180/Math.PI)}}]);return HMapSVGDesertForegroundLayer}(abstract_1.AbstractHMapLayer);exports.HMapSVGDesertForegroundLayer=HMapSVGDesertForegroundLayer},{"../lang":8,"./abstract":9}],12:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var abstract_1=require("./abstract");var HMapSVGGlassStaticLayer=function(_abstract_1$AbstractH3){_inherits(HMapSVGGlassStaticLayer,_abstract_1$AbstractH3);function HMapSVGGlassStaticLayer(map){var _this13;_classCallCheck(this,HMapSVGGlassStaticLayer);_this13=_possibleConstructorReturn(this,_getPrototypeOf(HMapSVGGlassStaticLayer).call(this,map));var hmap=document.querySelector("#hmap");if(document.querySelector("#svgGlassStatic")===null&&hmap){var SVG=document.createElementNS(_this13.ns,"svg");SVG.setAttributeNS(null,"id","svgGlassStatic");SVG.setAttributeNS(null,"style","position:absolute;z-index:3;");hmap.appendChild(SVG);SVG.style.pointerEvents="none"}_this13.svg=document.getElementById("svgGlassStatic");_this13.svg.setAttributeNS(null,"width",map.width+"px");_this13.svg.setAttributeNS(null,"height",map.height+"px");_this13.svg.style.width=map.width+"px";_this13.svg.style.height=map.height+"px";_this13.type="glass-static";return _this13}_createClass(HMapSVGGlassStaticLayer,[{key:"draw",value:function draw(){var oldGroup=this.g;this.g=document.createElementNS(this.ns,"g");this.imgFromObj("glass",0,0);this.svg.appendChild(this.g);if(oldGroup){this.svg.removeChild(oldGroup)}}}]);return HMapSVGGlassStaticLayer}(abstract_1.AbstractHMapLayer);exports.HMapSVGGlassStaticLayer=HMapSVGGlassStaticLayer},{"./abstract":9}],13:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var random_1=require("../random");var abstract_1=require("./abstract");var lang_1=require("../lang");var HMapSVGGridLayer=function(_abstract_1$AbstractH4){_inherits(HMapSVGGridLayer,_abstract_1$AbstractH4);function HMapSVGGridLayer(map){var _this14;_classCallCheck(this,HMapSVGGridLayer);_this14=_possibleConstructorReturn(this,_getPrototypeOf(HMapSVGGridLayer).call(this,map));_this14.spaceBetweenSquares=1;_this14.isPanning=false;_this14.startPoint={x:0,y:0};_this14.endPoint={x:0,y:0};_this14.scale=1;_this14.viewBox={x:0,y:0,w:0,h:0};var hmap=document.querySelector("#hmap");if(document.querySelector("#svgGrid")===null&&hmap){var SVG=document.createElementNS(_this14.ns,"svg");SVG.setAttributeNS(null,"id","svgGrid");SVG.setAttributeNS(null,"style","position:absolute;z-index:2;");hmap.appendChild(SVG);hmap.style.backgroundColor="#2b3a08"}_this14.svg=document.getElementById("svgGrid");_this14.svg.setAttributeNS(null,"width",map.width+"px");_this14.svg.setAttributeNS(null,"height",map.height+"px");_this14.svg.style.width=map.width+"px";_this14.svg.style.height=map.height+"px";_this14.attachPanZoomEvents();_this14.type="grid";return _this14}_createClass(HMapSVGGridLayer,[{key:"draw",value:function draw(){var _this15=this;var oldGroup=this.g;this.g=document.createElementNS(this.ns,"g");var mapData=this.map.mapData;var map=this.map;var minWidthHeight=Math.min(map.width,map.height);var availableSize=minWidthHeight-25-this.spaceBetweenSquares*mapData.size.height;this.squareSize=Math.floor(availableSize/mapData.size.height);this.padding=Math.floor((minWidthHeight-this.spaceBetweenSquares*mapData.size.height-this.squareSize*mapData.size.height)/2);var soulsData=[];var _loop2=function _loop2(i,j){var position=mapData.getCoordinates(i);var currentPos=position.y===mapData.position.y&&position.x===mapData.position.x;var x=_this15.padding+position.x*(_this15.squareSize+_this15.spaceBetweenSquares);var y=_this15.padding/2+position.y*(_this15.squareSize+_this15.spaceBetweenSquares);if(mapData.details[i]===undefined||mapData.details[i]===null){mapData.details[i]={_z:0,_c:0,_s:false,_nvt:1,_t:0}}var visionArray=mapData.global;if(map.mode==="personal"){visionArray=mapData.view}var fillColor="#475613";var strokeColor=void 0;if(currentPos){strokeColor="#d8fe6e"}if(mapData.details[i]._z>9){fillColor="#8f340b"}else if(mapData.details[i]._z>5){fillColor="#8f7324"}else if(mapData.details[i]._z>0){fillColor="#8f990b"}else{fillColor="#475613"}var square=_this15.rect(x,y,_this15.squareSize,_this15.squareSize,fillColor,strokeColor);square.setAttributeNS(null,"index",i+"");if(currentPos){square.setAttributeNS(null,"current","true")}square.onmouseenter=_this15.onMouseEnterSquare.bind(_this15);square.onmouseleave=_this15.onMouseLeaveSquare.bind(_this15);square.onmouseup=_this15.onMouseUpSquare.bind(_this15);if(visionArray[i]!==undefined&&visionArray[i]!==null&&visionArray[i]>=-1){if(mapData.details[i]._nvt===true){_this15.imgFromObj("hatch",x,y,undefined,undefined,_this15.squareSize,_this15.squareSize)}else if(mapData.details[i]._nvt===false){}else{throw new Error("HMapGridLayer::draw - as far as I understand, we cannot be in this case")}}else{_this15.imgFromObj("hatch-dense",x,y,undefined,undefined,_this15.squareSize,_this15.squareSize)}if(mapData.details[i]._c>0||mapData.details[i]._c===-1){if(mapData.details[i]._c===1){_this15.imgFromObj("town",x,y,undefined,undefined,_this15.squareSize,_this15.squareSize)}else{_this15.imgFromObj("building",x,y,undefined,undefined,_this15.squareSize,_this15.squareSize)}}if(mapData.details[i]._c!==1){var users=mapData.users.get(i);if(users!==undefined){users.forEach(function(user){var usernameAsNumber=0;for(var k=0;k<user._n.length;k++){usernameAsNumber+=user._n.charCodeAt(k)}var seed=(x*10+y)*(y*10+x)+usernameAsNumber;var random=new random_1.HMapRandom(seed);var userImg=_this15.imgFromObj("people",x+random.getRandomIntegerLocalSeed(.2*_this15.squareSize,.8*_this15.squareSize),y+random.getRandomIntegerLocalSeed(.2*_this15.squareSize,.8*_this15.squareSize));userImg.setAttributeNS(null,"class","hmap-user")})}}if(mapData.details[i]._s){var points=[{x:x+_this15.squareSize,y:y+_this15.squareSize},{x:x-_this15.squareSize,y:y+_this15.squareSize},{x:x+_this15.squareSize,y:y-_this15.squareSize},{x:x-_this15.squareSize,y:y-_this15.squareSize}];for(var ipoint=0;ipoint<2;ipoint++){points.push({x:random_1.HMapRandom.getRandomIntegerNoSeed(x-_this15.squareSize,x+_this15.squareSize),y:y-_this15.squareSize})}for(var _ipoint=0;_ipoint<2;_ipoint++){points.push({x:random_1.HMapRandom.getRandomIntegerNoSeed(x-_this15.squareSize,x+_this15.squareSize),y:y+_this15.squareSize})}for(var _ipoint2=0;_ipoint2<2;_ipoint2++){points.push({x:x+_this15.squareSize,y:random_1.HMapRandom.getRandomIntegerNoSeed(y-_this15.squareSize,y+_this15.squareSize)})}for(var _ipoint3=0;_ipoint3<2;_ipoint3++){points.push({x:x-_this15.squareSize,y:random_1.HMapRandom.getRandomIntegerNoSeed(y-_this15.squareSize,y+_this15.squareSize)})}var _pathString="M ";var origLength=points.length;for(var _ipoint4=0;_ipoint4<origLength;_ipoint4++){var point=points.splice(random_1.HMapRandom.getRandomIntegerNoSeed(0,points.length),1)[0];_pathString+=point.x+" "+point.y;if(_ipoint4<origLength-1){_pathString+=" L "}}_pathString+=" Z";soulsData.push({path:_pathString,soul:{x:x,y:y}})}if(map.displayTags){var tag=mapData.details[i]._t;if(tag>0&&tag<13){var tagSize=Math.min(_this15.squareSize/1.5,16);var tagImg=_this15.imgFromObj("tag_"+tag,x+_this15.squareSize/2-tagSize/2,y+_this15.squareSize/2-tagSize/2,undefined,undefined,tagSize,tagSize);tagImg.setAttributeNS(null,"class","hmap-tag")}}if(mapData.details[i]._c!==1&&!currentPos&&position.x===map.target.x&&position.y===map.target.y){var target=_this15.imgFromObj("target",x,y,undefined,undefined,_this15.squareSize,_this15.squareSize);target.setAttributeNS(null,"class","hmap-target")}};for(var i=0,j=mapData.details.length;i<j;i++){_loop2(i,j)}for(var _i=0;_i<soulsData.length;_i++){var pathString=soulsData[_i].path;var path=this.path(pathString);path.setAttributeNS(null,"style","fill: none");path.setAttributeNS(null,"class","hmap-soul-path");var imgsoul=this.imgFromObj("tag_12",soulsData[_i].soul.x,soulsData[_i].soul.y,undefined,undefined,this.squareSize,this.squareSize);imgsoul.setAttributeNS(null,"class","hmap-soul")}this.svg.appendChild(this.g);if(oldGroup){window.setTimeout(function(){return _this15.svg.removeChild(oldGroup)},100)}var script=document.createElement("script");script.setAttributeNS(null,"type","application/javascript");script.setAttributeNS(null,"id","moveSoulScript");script.textContent="var counter = 0;"+"var direction = true;"+'var svgContainer = document.getElementById("hmap");'+'var ns = "http://www.w3.org/2000/svg";'+'var souls = svgContainer.getElementsByClassName("hmap-soul");'+"function moveSoul() {"+"if (parseInt(counter,10) === 1) {"+"direction = false;"+"} else if (parseInt(counter,10) < 0) {"+"direction = true;"+"}"+"if(direction) {"+"counter += 0.0005;"+"} else {"+"counter -= 0.0005;"+"}"+"for(var i = 0 ; i < souls.length ; i++){"+"var path = souls[i].previousSibling;"+"var pathLength = path.getTotalLength();"+"var newX = path.getPointAtLength(counter * pathLength).x;"+"var newY = path.getPointAtLength(counter * pathLength).y;"+'var transfX = parseFloat(newX - souls[i].getAttribute("x") - '+this.squareSize/2+");"+'var transfY = parseFloat(newY - souls[i].getAttribute("y") - '+this.squareSize/2+");"+'var oldTransf = souls[i].getAttribute("transform");'+'var oldX = parseInt(souls[i].getAttribute("x"));'+'var oldY = parseInt(souls[i].getAttribute("y"));'+"if (oldTransf != null) {"+"var regex = /translate\(([0-9-.]+),([0-9-.]+)\)/;"+"if (oldTransf.match(regex) != null && oldTransf.match(regex).length > 1) { "+"oldX += parseFloat(oldTransf.match(regex)[1]);"+"oldY += parseFloat(oldTransf.match(regex)[2]);"+"}"+"}"+"var h = Math.sqrt(Math.pow(newX - oldX, 2) + Math.pow(newY - oldY, 2));"+"var c = Math.abs(newX - oldX);"+"var a = Math.acos(c / h) * 180 / Math.PI;"+'var soulx = parseInt(souls[i].getAttribute("x"));'+'var souly = parseInt(souls[i].getAttribute("y"));'+'souls[i].setAttribute("transform", "'+'translate("+ transfX  + "," + transfY + ") '+'rotate(" + a + " " + (soulx + '+this.squareSize/2+') + " " + (souly + '+this.squareSize/2+') + ")");'+"}"+"requestAnimationFrame(moveSoul);"+"}"+"if (souls.length > 0) {"+"requestAnimationFrame(moveSoul);"+"}";document.getElementsByTagName("body")[0].appendChild(script);document.getElementsByTagName("body")[0].removeChild(script)}},{key:"resetView",value:function resetView(){var width=this.map.width;var height=this.map.height;this.viewBox={x:0,y:0,w:width,h:height};this.isPanning=false;this.startPoint={x:0,y:0};this.endPoint={x:0,y:0};this.scale=1;this.svg.setAttributeNS(null,"viewBox","".concat(this.viewBox.x," ").concat(this.viewBox.y," ").concat(this.viewBox.w," ").concat(this.viewBox.h))}},{key:"onMouseEnterSquare",value:function onMouseEnterSquare(e){if(this.isPanning){return}var rect=e.target;var index=rect.getAttributeNS(null,"index")!==null?+rect.getAttributeNS(null,"index"):undefined;if(index!==undefined&&this.squareSize&&this.padding){var mapData=this.map.mapData;var position=mapData.getCoordinates(index);var x=this.padding+position.x*(this.squareSize+this.spaceBetweenSquares);var y=this.padding/2+position.y*(this.squareSize+this.spaceBetweenSquares);if(rect.getAttributeNS(null,"current")!=="true"){rect.setAttributeNS(null,"stroke","#d8fe6e");rect.setAttributeNS(null,"stroke-width","2")}this.drawPopup(x,y,index)}}},{key:"onMouseLeaveSquare",value:function onMouseLeaveSquare(e){if(this.isPanning){return}var rect=e.target;if(rect.getAttributeNS(null,"current")!=="true"){rect.setAttributeNS(null,"stroke","");rect.setAttributeNS(null,"stroke-width","0")}document.querySelectorAll(".hmap-popup").forEach(function(elementToRemove){return elementToRemove.remove()})}},{key:"onMouseUpSquare",value:function onMouseUpSquare(e){if(this.startPoint.x!==this.endPoint.x||this.startPoint.y!==this.endPoint.y){return}var map=this.map;var rect=e.target;var index=rect.getAttributeNS(null,"index")!==null?+rect.getAttributeNS(null,"index"):undefined;document.querySelectorAll(".hmap-target").forEach(function(elementToRemove){return elementToRemove.remove()});if(index!==undefined&&this.squareSize&&this.padding){var mapData=this.map.mapData;var position=mapData.getCoordinates(index);var x=this.padding+position.x*(this.squareSize+this.spaceBetweenSquares);var y=this.padding/2+position.y*(this.squareSize+this.spaceBetweenSquares);map.setTarget(mapData.getCoordinates(index));var target=this.imgFromObj("target",x,y,undefined,undefined,this.squareSize,this.squareSize);target.setAttributeNS(null,"class","hmap-target")}}},{key:"attachPanZoomEvents",value:function attachPanZoomEvents(){var _this16=this;var svgContainer=document.querySelector("#hmap");this.viewBox={x:0,y:0,w:this.map.width,h:this.map.height};this.svg.setAttributeNS(null,"viewBox","".concat(this.viewBox.x," ").concat(this.viewBox.y," ").concat(this.viewBox.w," ").concat(this.viewBox.h));this.isPanning=false;this.startPoint={x:0,y:0};this.endPoint={x:0,y:0};this.scale=1;svgContainer.onwheel=function(e){e.preventDefault();var w=_this16.viewBox.w;var h=_this16.viewBox.h;var rect=_this16.svg.getBoundingClientRect();var mx=e.clientX-rect.left;var my=e.clientY-rect.top;var dh=-1*(w*Math.sign(e.deltaY)*.1);var dw=-1*(h*Math.sign(e.deltaY)*.1);var dx=dw*mx/_this16.map.width;var dy=dh*my/_this16.map.height;_this16.viewBox={x:_this16.viewBox.x+dx,y:_this16.viewBox.y+dy,w:_this16.viewBox.w-dw,h:_this16.viewBox.h-dh};_this16.scale=_this16.map.width/_this16.viewBox.w;_this16.svg.setAttributeNS(null,"viewBox","".concat(_this16.viewBox.x," ").concat(_this16.viewBox.y," ").concat(_this16.viewBox.w," ").concat(_this16.viewBox.h))};svgContainer.onmousedown=function(e){_this16.isPanning=true;_this16.startPoint={x:e.x,y:e.y};_this16.endPoint={x:e.x,y:e.y}};svgContainer.onmousemove=function(e){if(_this16.isPanning){_this16.endPoint={x:e.x,y:e.y};var dx=(_this16.startPoint.x-_this16.endPoint.x)/_this16.scale;var dy=(_this16.startPoint.y-_this16.endPoint.y)/_this16.scale;var movedViewBox={x:_this16.viewBox.x+dx,y:_this16.viewBox.y+dy,w:_this16.viewBox.w,h:_this16.viewBox.h};_this16.svg.setAttributeNS(null,"viewBox","".concat(movedViewBox.x," ").concat(movedViewBox.y," ").concat(movedViewBox.w," ").concat(movedViewBox.h))}};svgContainer.onmouseup=function(e){if(_this16.isPanning){_this16.endPoint={x:e.x,y:e.y};var dx=(_this16.startPoint.x-_this16.endPoint.x)/_this16.scale;var dy=(_this16.startPoint.y-_this16.endPoint.y)/_this16.scale;if(dx!==0||dy!==0){_this16.viewBox={x:_this16.viewBox.x+dx,y:_this16.viewBox.y+dy,w:_this16.viewBox.w,h:_this16.viewBox.h};_this16.svg.setAttributeNS(null,"viewBox","".concat(_this16.viewBox.x," ").concat(_this16.viewBox.y," ").concat(_this16.viewBox.w," ").concat(_this16.viewBox.h))}_this16.isPanning=false}};svgContainer.onmouseleave=svgContainer.onmouseup}},{key:"drawPopup",value:function drawPopup(x,y,index){var _this17=this;var canvas=document.createElement("canvas");var ctx=canvas.getContext("2d");ctx.font="13px visitor2";var map=this.map;var mapData=map.mapData;var currentPos=mapData.getCoordinates(index);var relativePos=mapData.getPositionRelativeToTown(currentPos);var numberOfLines=0;var title="Desert ";var maxTextWidth=0;var buildingId=mapData.details[index]._c;if(buildingId>0||buildingId===-1){if(buildingId===1){title=mapData.townName+" "}else if(buildingId===-1){title=lang_1.HMapLang.get("undigged")+" "}else{var buildingName=mapData.buildings.get(buildingId);if(buildingName){title=buildingName+" "}}}title+="[ "+relativePos.x+" , "+relativePos.y+" ]";maxTextWidth=ctx.measureText(title).width;numberOfLines++;if(mapData.details[index]._t>0&&map.displayTags){var tagName=lang_1.HMapLang.get(this.getTagName(mapData.details[index]._t));maxTextWidth=Math.max(ctx.measureText(tagName).width,maxTextWidth);numberOfLines++}var dangerName;if(mapData.details[index]._z>0){if(mapData.details[index]._z>9){dangerName=lang_1.HMapLang.get("manyZombies")}else if(mapData.details[index]._z>5){dangerName=lang_1.HMapLang.get("medZombies")}else{dangerName=lang_1.HMapLang.get("fewZombies")}maxTextWidth=Math.max(ctx.measureText(dangerName).width,maxTextWidth);numberOfLines++}var users=mapData.users.get(index);var usernamesAllLines=new Array;if(users!==undefined&&mapData.details[index]._c!==1){var singleLine=new Array;for(var u=0;u<users.length;u++){var user=users[u];singleLine.push(user._n);if(u>0&&(u+1)%3===0){var singleLineStr=singleLine.join(", ");maxTextWidth=Math.max(ctx.measureText(singleLineStr).width,maxTextWidth);usernamesAllLines.push(singleLineStr);singleLine=new Array;numberOfLines++}}if(singleLine.length>0){var _singleLineStr=singleLine.join(", ");maxTextWidth=Math.max(ctx.measureText(_singleLineStr).width,maxTextWidth);usernamesAllLines.push(_singleLineStr);numberOfLines++}}var popupWidth=Math.floor(maxTextWidth+10);var popupHeight=15*numberOfLines;var minWidthHeight=Math.min(map.width,map.height);var xPopup=Math.floor(Math.min(Math.max(x-popupWidth/2,0),minWidthHeight-popupWidth));var yPopup=Math.max(y-popupHeight,0)|0;var popup=this.rect(xPopup,yPopup,popupWidth,popupHeight,"#000000","#b9ba3e",1);popup.setAttributeNS(null,"fill-opacity","0.6");popup.setAttributeNS(null,"class","hmap-popup");popup.style.pointerEvents="none";numberOfLines=0;var titleSize=ctx.measureText(title).width;this.text(xPopup+popupWidth/2-titleSize/2,yPopup+7.5,title,"hmap-text-green hmap-popup");numberOfLines++;if(mapData.details[index]._t>0&&map.displayTags){var _tagName=lang_1.HMapLang.get(this.getTagName(mapData.details[index]._t));var tagWidth=ctx.measureText(_tagName).width;this.text(xPopup+popupWidth/2-tagWidth/2,yPopup+7.5+15*numberOfLines,_tagName,"hmap-text-green hmap-popup");numberOfLines++}if(dangerName!==undefined){var dangerWidth=ctx.measureText(dangerName).width;var dangerText=this.text(xPopup+popupWidth/2-dangerWidth/2,yPopup+7.5+15*numberOfLines,dangerName,"hmap-text-yellow hmap-popup");dangerText.style.fill="#fefe00";numberOfLines++}usernamesAllLines.forEach(function(lineToWrite,_index){var lineSize=ctx.measureText(lineToWrite).width;var line=_this17.text(xPopup+popupWidth/2-lineSize/2,yPopup+7.5+(_index+numberOfLines)*15,lineToWrite,"hmap-text-yellow hmap-popup");line.style.fill="#fefe00"});document.querySelectorAll(".hmap-popup").forEach(function(element){element.style.zIndex="11"})}},{key:"getTagName",value:function getTagName(tagIndex){switch(tagIndex){case 1:return"tag_1";case 2:return"tag_2";case 3:return"tag_3";case 4:return"tag_4";case 5:return"tag_5";case 6:return"tag_6";case 7:return"tag_7";case 8:return"tag_8";case 9:return"tag_9";case 10:return"tag_10";case 11:return"tag_11";case 12:return"tag_12";default:throw new Error("HMapSVGGridLayer::getTagName - Wrong tag index")}}}]);return HMapSVGGridLayer}(abstract_1.AbstractHMapLayer);exports.HMapSVGGridLayer=HMapSVGGridLayer},{"../lang":8,"../random":22,"./abstract":9}],14:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var abstract_1=require("./abstract");var HMapSVGLoadingLayer=function(_abstract_1$AbstractH5){_inherits(HMapSVGLoadingLayer,_abstract_1$AbstractH5);function HMapSVGLoadingLayer(map){var _this18;_classCallCheck(this,HMapSVGLoadingLayer);_this18=_possibleConstructorReturn(this,_getPrototypeOf(HMapSVGLoadingLayer).call(this,map));var hmap=document.querySelector("#hmap");if(document.querySelector("#svgLoading")===null&&hmap){var SVG=document.createElementNS(_this18.ns,"svg");SVG.setAttributeNS(null,"id","svgLoading");SVG.setAttributeNS(null,"style","position:absolute;z-index:998;");hmap.appendChild(SVG);SVG.style.pointerEvents="none"}_this18.svg=document.getElementById("svgLoading");_this18.svg.setAttributeNS(null,"width",map.width+"px");_this18.svg.setAttributeNS(null,"height",map.height+"px");_this18.svg.style.width=map.width+"px";_this18.svg.style.height=map.height+"px";_this18.type="loading";return _this18}_createClass(HMapSVGLoadingLayer,[{key:"draw",value:function draw(){var _this19=this;var oldGroup=this.g;this.g=document.createElementNS(this.ns,"g");var map=this.map;this.imgFromObj("loading",0,0);this.text(120,185,"by ryderone","hmap-text-yellow");this.loadingBar=this.rect(75,170,1,6,"#ebc369");this.svg.appendChild(this.g);if(oldGroup){window.setTimeout(function(){return _this19.svg.removeChild(oldGroup)},100)}}},{key:"progress",value:function progress(percent){this.loadingBar.setAttributeNS(null,"width",percent*155+"")}},{key:"hide",value:function hide(){this.svg.style.display="none"}}]);return HMapSVGLoadingLayer}(abstract_1.AbstractHMapLayer);exports.HMapSVGLoadingLayer=HMapSVGLoadingLayer},{"./abstract":9}],15:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var abstract_1=require("./abstract");var random_1=require("../random");var imagesLoader_1=require("../imagesLoader");var HMapSVGRuinBackgroundLayer=function(_abstract_1$AbstractH6){_inherits(HMapSVGRuinBackgroundLayer,_abstract_1$AbstractH6);function HMapSVGRuinBackgroundLayer(map){var _this20;_classCallCheck(this,HMapSVGRuinBackgroundLayer);_this20=_possibleConstructorReturn(this,_getPrototypeOf(HMapSVGRuinBackgroundLayer).call(this,map));_this20.translation={x:0,y:0};_this20.availableWalls=new Array;_this20.availableZones=new Array;_this20.translateTo={x:0,y:0};var hmap=document.querySelector("#hmap");if(document.querySelector("#svgRuinBackground")===null&&hmap){var SVG=document.createElementNS(_this20.ns,"svg");SVG.setAttributeNS(null,"id","svgRuinBackground");SVG.setAttributeNS(null,"style","position:absolute;z-index:10;");hmap.appendChild(SVG);SVG.style.pointerEvents="none"}_this20.svg=document.getElementById("svgRuinBackground");_this20.svg.setAttributeNS(null,"width",map.width+"px");_this20.svg.setAttributeNS(null,"height",map.height+"px");_this20.svg.style.width=map.width+"px";_this20.svg.style.height=map.height+"px";_this20.type="ruin-background";_this20.random=new random_1.HMapRandom;return _this20}_createClass(HMapSVGRuinBackgroundLayer,[{key:"draw",value:function draw(){var _this21=this;var oldGroup=this.g;this.g=document.createElementNS(this.ns,"g");var imagesLoader=imagesLoader_1.HMapImagesLoader.getInstance();var map=this.map;var mapData=this.map.mapData;this.random=new random_1.HMapRandom(mapData.seed);var typeOfRuin=mapData.ruinType;this.availableWalls=this.buildAvailableWalls();this.availableZones=this.buildAvailableZones();if(mapData.room===true){this.imgFromObj("room",0,0)}else{var directions=mapData.directionsStr;this.imgFromObj(directions,0,0);if(mapData.exit){this.imgFromObj("exit",117,90)}if(mapData.door){var coord=this.getRandomWallCoordinatesForDoors(30,30,["D","E","K","J"]);if(coord){var openClosed=mapData.door._locked?"closed":"open";var door=this.imgFromObj("door-"+coord.direction+"-"+openClosed,coord.x,coord.y);door.style.cursor="pointer";door.style.pointerEvents="auto";door.onclick=function(event){map.enterRoom()}}else{throw new Error("HMapSVGRuinBackground::draw - out of walls for doors")}}var zombies=new Array;for(var n=1;n<=mapData.zombies;n++){var zombieObj=imagesLoader.get("zombiegif");var newPos=this.getRandomFloorCoordinates(zombieObj.width,zombieObj.height,false,undefined,20);if(newPos){zombies.push(newPos)}else{throw new Error("HMapSVGRuinBackground::draw - out of zones for zombies")}}var kills=new Array;for(var _n=1;_n<=mapData.kills;_n++){var killsObj=imagesLoader.get("dead");var _newPos=this.getRandomFloorCoordinates(killsObj.width,killsObj.height,false,undefined,20);if(_newPos){kills.push(_newPos)}else{throw new Error("HMapSVGRuinBackground::draw - out of zones for zombies")}}var numberOfObjectsOnTheFloor=this.random.getOneOfLocalSeed([0,0,0,0,0,0,1,2]);for(var i=0;i<numberOfObjectsOnTheFloor;i++){var randomZone=this.random.getOneOfLocalSeed(this.availableZones);if(randomZone){var imageId=this.random.getOneOfLocalSeed(mapData.zones[typeOfRuin][randomZone]);if(imageId){var imageObj=imagesLoader.get(imageId);var coordinates=this.getRandomFloorCoordinates(imageObj.width,imageObj.height,true,randomZone);if(coordinates){this.imgFromObj(imageId,coordinates.x,coordinates.y)}}}}var numberOfObjectsOnTheWall=this.random.getOneOfLocalSeed([5]);for(var _i2=0;_i2<numberOfObjectsOnTheWall;_i2++){var randomWall=this.random.getOneOfLocalSeed(this.availableWalls);if(randomWall){this.availableWalls=this.removeFromArray(randomWall,this.availableWalls);var _imageId=this.random.getOneOfLocalSeed(mapData.walls[typeOfRuin][randomWall]);if(_imageId){var _coordinates=this.getCoordinates(_imageId);if(_coordinates){this.imgFromObj(_imageId,_coordinates.x,_coordinates.y)}}}}zombies.forEach(function(coord){_this21.imgFromObj("zombiegif",coord.x,coord.y)});kills.forEach(function(coord){_this21.imgFromObj("dead",coord.x,coord.y)});var you=this.imgFromObj("you",142,136);you.setAttributeNS(null,"id","hmap-ruin-you")}this.svg.appendChild(this.g);if(oldGroup){window.setTimeout(function(){return _this21.svg.removeChild(oldGroup)},100)}}},{key:"appendNextTile",value:function appendNextTile(shiftX,shiftY,dirs){var map=this.map;var directions=""+ +dirs[0]+ +dirs[1]+ +dirs[2]+ +dirs[3];this.imgFromObj(directions,shiftX*300,shiftY*300)}},{key:"easeMovement",value:function easeMovement(target,callback){var _this22=this;this.startTranslate=Date.now();this.translateTo=target;if(!this.intervalEasing){this.intervalEasing=window.setInterval(function(){var coef=1;if(_this22.startTranslate){var p=(Date.now()-_this22.startTranslate)/300;coef=p>=1?1:1-Math.pow(2,-10*p)}else{throw new Error("Cannot ease without starting the translation")}var translateX=_this22.translateTo.x;var translateY=_this22.translateTo.y;_this22.translation.x=translateX*coef;_this22.translation.y=translateY*coef;_this22.g.setAttributeNS(null,"transform","translate("+-1*_this22.translation.x+" "+-1*_this22.translation.y+")");if(coef>=1){_this22.startTranslate=undefined;_this22.translateTo={x:0,y:0};clearInterval(_this22.intervalEasing);_this22.intervalEasing=undefined;callback();return}},40)}}},{key:"getCoordinates",value:function getCoordinates(imageId){var mapData=this.map.mapData;var imagesLoader=imagesLoader_1.HMapImagesLoader.getInstance();var imageObj=imagesLoader.get(imageId);var height=imageObj.height;var width=imageObj.width;switch(mapData.ruinType){case"bunker":switch(imageId){case"wall_hatch_A":return{x:40,y:185};case"wall_gutter_B":return{x:78,y:128-height};case"wall_hatch_B":return{x:40,y:115-height};case"wall_barrel_D":return{x:130-width,y:60};case"wall_grid_D":return{x:114-width,y:55};case"wall_pipe_D":return{x:139-width,y:60};case"wall_barrel_E":return{x:170,y:70};case"wall_grid_E":return{x:186,y:55};case"wall_pipe_E":return{x:161,y:60};case"wall_gutter_G":return{x:222-width,y:128-height};case"wall_hatch_G":return{x:260-width,y:115-height};case"wall_hatch_H":return{x:260-width,y:185};default:throw new Error("Make the compiler happy")}case"hospital":switch(imageId){case"wall_bed_D":return{x:130-width,y:65};case"wall_dead_D":return{x:130-width,y:70};case"wall_bed_E":return{x:170,y:65};case"wall_dead_E":return{x:170,y:70};case"wall_grid_J":return{x:170,y:260-height};case"wall_grid_K":return{x:130-width,y:260-height};default:throw new Error("Make the compiler happy")}case"motel":switch(imageId){case"wall_bench_A":return{x:40,y:175};case"wall_bench_B":return{x:40,y:125-height};case"wall_palmtree_B":return{x:80,y:125-height};case"wall_flowers_D":return{x:130-width,y:70};case"wall_flowers_E":return{x:170,y:70};case"wall_bench_G":return{x:260-width,y:125-height};case"wall_palmtree_G":return{x:220-width,y:125-height};case"wall_bench_H":return{x:260-width,y:175};default:throw new Error("Make the compiler happy")}}}},{key:"getRandomFloorCoordinates",value:function getRandomFloorCoordinates(width,height){var remove=arguments.length>2&&arguments[2]!==undefined?arguments[2]:true;var zone=arguments.length>3?arguments[3]:undefined;var offset=arguments.length>4&&arguments[4]!==undefined?arguments[4]:0;var zoneCoordinates;if(!zone){zone=this.random.getOneOfLocalSeed(this.availableZones)}if(!zone){return undefined}if(remove){this.availableZones=this.removeFromArray(zone,this.availableZones)}if(zone==="Z1"){zoneCoordinates={topLeft:{x:offset,y:115},bottomRight:{x:115-width,y:185-height}}}else if(zone==="Z2"){zoneCoordinates={topLeft:{x:115,y:offset},bottomRight:{x:185-width,y:115-height}}}else if(zone==="Z3"){zoneCoordinates={topLeft:{x:185,y:115},bottomRight:{x:300-offset-width,y:185-height}}}else if(zone==="Z4"){zoneCoordinates={topLeft:{x:115,y:185},bottomRight:{x:185-width,y:300-offset-height}}}else{zoneCoordinates={topLeft:{x:115,y:115},bottomRight:{x:185-width,y:185-height}}}return{x:this.random.getRandomIntegerLocalSeed(zoneCoordinates.topLeft.x,zoneCoordinates.bottomRight.x),y:this.random.getRandomIntegerLocalSeed(zoneCoordinates.topLeft.y,zoneCoordinates.bottomRight.y)}}},{key:"getRandomWallCoordinatesForDoors",value:function getRandomWallCoordinatesForDoors(width,height,exceptions){var remove=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var wall=arguments.length>4?arguments[4]:undefined;if(!wall){wall=this.random.getOneOfLocalSeed(this.availableWalls,exceptions)}if(!wall){return undefined}if(remove){this.availableWalls=this.removeFromArray(wall,this.availableWalls)}switch(wall){case"A":return{direction:"bottom-left",x:40,y:175};case"B":return{direction:"top-left",x:40,y:125-height};case"C":return{direction:"left",x:130-width,y:150-width-2};case"D":return{direction:"left",x:130-width,y:90};case"E":return{direction:"right",x:170,y:90};case"F":return{direction:"top",x:150-width/2,y:125-height};case"G":return{direction:"top-right",x:260-width,y:125-height};case"H":return{direction:"bottom-right",x:260-width,y:175};case"I":return{direction:"right",x:170,y:150-height/2};case"J":return{direction:"bottom",x:170,y:260-height};case"K":return{direction:"bottom",x:130-width,y:260-height};case"L":return{direction:"bottom",x:150-width/2,y:175}}}},{key:"buildAvailableWalls",value:function buildAvailableWalls(){var mapData=this.map.mapData;var directions=mapData.directions;var walls=new Array;if(directions[2]===true){walls.push("A");walls.push("B")}else{walls.push("C")}if(directions[1]===true){walls.push("D");walls.push("E")}else{walls.push("F")}if(directions[0]===true){walls.push("G");walls.push("H")}else{walls.push("I")}if(directions[3]===true){walls.push("J");walls.push("K")}else{walls.push("L")}return walls}},{key:"buildAvailableZones",value:function buildAvailableZones(){var mapData=this.map.mapData;var directions=mapData.directions;var zones=new Array;zones.push("Z5");if(directions[2]===true){zones.push("Z1")}if(directions[1]===true){zones.push("Z2")}if(directions[0]===true){zones.push("Z3")}if(directions[3]===true){zones.push("Z4")}return zones}},{key:"removeFromArray",value:function removeFromArray(element,_array){var index=_array.indexOf(element);if(index!==-1){_array.splice(index,1)}return _array}}]);return HMapSVGRuinBackgroundLayer}(abstract_1.AbstractHMapLayer);exports.HMapSVGRuinBackgroundLayer=HMapSVGRuinBackgroundLayer},{"../imagesLoader":7,"../random":22,"./abstract":9}],16:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var abstract_1=require("./abstract");var lang_1=require("../lang");var random_1=require("../random");var HMapSVGRuinForegroundLayer=function(_abstract_1$AbstractH7){_inherits(HMapSVGRuinForegroundLayer,_abstract_1$AbstractH7);function HMapSVGRuinForegroundLayer(map){var _this23;_classCallCheck(this,HMapSVGRuinForegroundLayer);_this23=_possibleConstructorReturn(this,_getPrototypeOf(HMapSVGRuinForegroundLayer).call(this,map));_this23.lowOxygen=false;var hmap=document.querySelector("#hmap");if(document.querySelector("#svgRuinForeground")===null&&hmap){var SVG=document.createElementNS(_this23.ns,"svg");SVG.setAttributeNS(null,"id","svgRuinForeground");SVG.setAttributeNS(null,"style","position:absolute;z-index:998;");hmap.appendChild(SVG);SVG.style.pointerEvents="none"}_this23.svg=document.getElementById("svgRuinForeground");_this23.svg.setAttributeNS(null,"width",map.width+"px");_this23.svg.setAttributeNS(null,"height",map.height+"px");_this23.svg.style.width=map.width+"px";_this23.svg.style.height=map.height+"px";_this23.type="ruin-foreground";return _this23}_createClass(HMapSVGRuinForegroundLayer,[{key:"draw",value:function draw(){var _this24=this;var oldGroup=this.g;this.g=document.createElementNS(this.ns,"g");var map=this.map;var mapData=this.map.mapData;this.imgFromObj("scanner",250,250);this.imgFromObj("shadowFocus",(map.width-433)/2,(map.height-433)/2);this.imgFromObj("shadowFocus",(map.width-433)/2,(map.height-433)/2);this.rect(6,6,map.width-12,map.height-25,"transparent","#188400",1);this.rect(4,4,map.width-8,map.height-21,"transparent","#1a4e02",1);this.imgFromObj("glass",0,0);var oxygenText=this.text(map.width-10,14,lang_1.HMapLang.get("oxygen")+" :","hmap-text-green");oxygenText.setAttributeNS(null,"text-anchor","end");oxygenText.setAttributeNS(null,"style","fill:#188300;");var oxygenUnitO=this.text(map.width-14,27,"O","hmap-text-green");oxygenUnitO.setAttributeNS(null,"style","font-size: 20px;");oxygenUnitO.setAttributeNS(null,"text-anchor","end");var oxygenUnit2=this.text(map.width-10,32,"2","hmap-text-green");oxygenUnit2.setAttributeNS(null,"style","font-size: 10px;");oxygenUnit2.setAttributeNS(null,"text-anchor","end");oxygenUnit2.setAttributeNS(null,"dominant-baseline","baseline");var oxygenValue=this.text(map.width-27,27,"100","hmap-text-green");oxygenValue.setAttributeNS(null,"style","font-size: 20px;");oxygenValue.setAttributeNS(null,"text-anchor","end");oxygenValue.setAttributeNS(null,"id","hmap-oxygen");this.updateArrows();var random=new random_1.HMapRandom(mapData.zoneId);var possibleNames=lang_1.HMapLang.getInstance().getRuinNames(mapData.ruinType);var index=random.getRandomIntegerLocalSeed(0,possibleNames.length-1);var title=this.text(10,15,possibleNames[index],"hmap-text-green");title.setAttributeNS(null,"style","fill:#188300;");this.svg.appendChild(this.g);if(oldGroup){window.setTimeout(function(){return _this24.svg.removeChild(oldGroup)},100)}}},{key:"updateOxygen",value:function updateOxygen(){var textElement=document.getElementById("hmap-oxygen");var map=this.map;if(textElement){textElement.textContent=""+map.oxygen}if(map.oxygen<15){if(!this.lowOxygen){this.lowOxygen=true;var you=document.querySelector("#hmap-ruin-you");if(you){you.parentNode.removeChild(you)}this.imgFromObj("you-noox",142,133)}}}},{key:"updateArrows",value:function updateArrows(){var _this25=this;var existingArrows=document.querySelectorAll(".hmap-arrow");if(existingArrows){existingArrows.forEach(function(el){return el.parentNode.removeChild(el)})}var map=this.map;var _loop3=function _loop3(i,j){var arrow=map.registredArrows[i];var arrowImg=_this25.imgFromObj("moveArrowLight",arrow.ax,arrow.ay,arrow.a,"hmap-arrow");arrowImg.style.pointerEvents="auto";arrowImg.style.cursor="pointer";_this25.imgFromObj("moveArrowOutline",arrow.ax,arrow.ay,arrow.a,"hmap-arrow");arrowImg.onmouseenter=function(){_this25.imgFromObj("moveArrowLight",arrow.ax,arrow.ay,arrow.a,"hmap-arrow hmap-arrowFill")};arrowImg.onmouseleave=function(){document.querySelectorAll(".hmap-arrowFill").forEach(function(element){element.remove()})};arrowImg.onclick=function(){if(_this25.map.mapData.room===true){_this25.map.exitRoom()}else{_this25.map.move(arrow.t)}}};for(var i=0,j=map.registredArrows.length;i<j;i++){_loop3(i,j)}}}]);return HMapSVGRuinForegroundLayer}(abstract_1.AbstractHMapLayer);exports.HMapSVGRuinForegroundLayer=HMapSVGRuinForegroundLayer},{"../lang":8,"../random":22,"./abstract":9}],17:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var imagesLoader_1=require("../imagesLoader");var HMapAbstractMap=function(){function HMapAbstractMap(hmap){_classCallCheck(this,HMapAbstractMap);this.layers=new Map;this.hmap=hmap}_createClass(HMapAbstractMap,[{key:"completeDataReceived",value:function completeDataReceived(mapDataPayload){var _this26=this;this.mapData=this.generateMapData(mapDataPayload);var loading=new Image;loading.src=imagesLoader_1.HMapImagesLoader.getInstance().get("loading").src;loading.onload=function(){var loadingLayer=_this26.layers.get("loading");if(loadingLayer){loadingLayer.draw()}_this26.onDataReceived(true)}}},{key:"partialDataReceived",value:function partialDataReceived(tempMapData){this.mapData.patchData(tempMapData);this.onDataReceived(false)}},{key:"height",get:function get(){return this.hmap.height}},{key:"width",get:function get(){return this.hmap.width}}]);return HMapAbstractMap}();exports.HMapAbstractMap=HMapAbstractMap},{"../imagesLoader":7}],18:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var arrow_1=require("../arrow");var toast_1=require("../toast");var environment_1=require("../environment");var lang_1=require("../lang");var abstract_1=require("./abstract");var svg_desert_background_1=require("../layers/svg-desert-background");var svg_loading_1=require("../layers/svg-loading");var svg_desert_foreground_1=require("../layers/svg-desert-foreground");var hmap_desert_data_1=require("../data/hmap-desert-data");var imagesLoader_1=require("../imagesLoader");var HMapDesertMap=function(_abstract_1$HMapAbstr){_inherits(HMapDesertMap,_abstract_1$HMapAbstr);function HMapDesertMap(){var _this27;_classCallCheck(this,HMapDesertMap);_this27=_possibleConstructorReturn(this,_getPrototypeOf(HMapDesertMap).apply(this,arguments));_this27.registredArrows=new Array;_this27.moving=false;return _this27}_createClass(HMapDesertMap,[{key:"buildLayers",value:function buildLayers(){var swf=document.querySelector(this.hmap.cssSelector);if(swf!==null){swf.setAttribute("style","display:flex;flex-direction:column;height:auto");if(this.hmap.displayFlashMap===false){var originalMap=document.querySelector("#swfCont");if(originalMap){originalMap.style.display="none"}}if(document.querySelector("#hmap")===null){var hmap=document.createElement("div");hmap.setAttribute("id","hmap");hmap.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;position:relative");swf.appendChild(hmap);var hmapMenu=document.createElement("div");hmapMenu.setAttribute("id","hmap-menu");hmapMenu.setAttribute("style","position:absolute;bottom:0px;z-index:10;height:20px;display:none");hmap.appendChild(hmapMenu);var mapButton=document.createElement("div");mapButton.setAttribute("id","hmap-minimap-button");mapButton.setAttribute("class","hmap-button");hmapMenu.appendChild(mapButton);mapButton.onclick=this.onMapButtonClick.bind(this);var mapIcon=document.createElement("img");mapIcon.setAttribute("id","hmap-minimap-icon");mapIcon.setAttribute("src",environment_1.Environment.getInstance().url+"/assets/minimap.png");mapButton.appendChild(mapIcon);mapButton.append(lang_1.HMapLang.get("mapbutton"));mapButton.style.marginRight="3px";var debugButton=document.createElement("div");debugButton.setAttribute("id","hmap-debug-button");debugButton.setAttribute("class","hmap-button");debugButton.innerHTML=lang_1.HMapLang.get("debugbutton");hmapMenu.appendChild(debugButton);debugButton.onclick=this.onDebugButtonClick.bind(this);var buttons=document.querySelectorAll(".hmap-button");buttons.forEach(function(el){el.onmouseleave=function(e){e.target.style.outline="0px"};el.onmouseenter=function(e){e.target.style.outline="1px solid #eccb94"}});hmapMenu.style.display="none";hmap.onmousemove=this.onMouseMove.bind(this);hmap.onmouseleave=this.onMouseLeave.bind(this)}}var backgroundLayer=new svg_desert_background_1.HMapSVGDesertBackgroundLayer(this);this.layers.set("desert-background",backgroundLayer);var foregroundLayer=new svg_desert_foreground_1.HMapSVGDesertForegroundLayer(this);this.layers.set("desert-foreground",foregroundLayer);var LoadingLayer=new svg_loading_1.HMapSVGLoadingLayer(this);this.layers.set("loading",LoadingLayer)}},{key:"move",value:function move(direction){var _this28=this;var mapData=this.mapData;if(this.moving===true){return}this.moving=true;var x,y;if(direction==="right"){x=1;y=0}else if(direction==="left"){x=-1;y=0}else if(direction==="top"){x=0;y=-1}else{x=0;y=1}var bgLayer=this.layers.get("desert-background");if(environment_1.Environment.getInstance().devMode===false){var _url2="outside/go?x="+x+";y="+y+";z="+mapData.zoneId+js.JsMap.sh;var hx;var page=window.wrappedJSObject;if(page!==undefined&&page.haxe){hx=page.haxe}else if(haxe){hx=haxe}var r=new hx.Http("/"+_url2);js.XmlHttp.onStart(r);js.XmlHttp.urlForBack=_url2;r.setHeader("X-Handler","js.XmlHttp");r.onData=function(data){_this28.hmap.originalOnData(data);bgLayer.easeMovement({x:100*x,y:100*y},function(){mapData.movePosition(x,y);if(data.indexOf("js.JsMap.init")!==-1){var startVar=data.indexOf("js.JsMap.init")+16;var stopVar=data.indexOf("',",startVar);var tempMapData=data.substring(startVar,stopVar);_this28.partialDataReceived({raw:tempMapData})}_this28.moving=false})};r.onError=js.XmlHttp.onError;r.request(false)}else{bgLayer.easeMovement({x:100*x,y:100*y},function(){mapData.movePosition(x,y);var newIndex=mapData.index;var fakeData={_neigDrops:[],_neig:new Array,_state:false,_c:_this28.mapData.data._details[newIndex]._c?_this28.mapData.data._details[newIndex]._c:0,_h:0,_m:6,_t:0,_z:_this28.mapData.data._details[newIndex]._z?_this28.mapData.data._details[newIndex]._z:0,_zid:42424545};if(newIndex-mapData.size.height>0){fakeData._neig.push(_this28.mapData.data._details[newIndex-mapData.size.height]._z)}else{fakeData._neig.push(0)}if(newIndex+1<mapData.size.width*mapData.size.height){fakeData._neig.push(_this28.mapData.data._details[newIndex+1]._z)}else{fakeData._neig.push(0)}if(newIndex+mapData.size.height<mapData.size.height*mapData.size.height){fakeData._neig.push(_this28.mapData.data._details[newIndex+mapData.size.height]._z)}else{fakeData._neig.push(0)}if(newIndex-1>0){fakeData._neig.push(_this28.mapData.data._details[newIndex-1]._z)}else{fakeData._neig.push(0)}_this28.partialDataReceived({JSON:fakeData});_this28.moving=false})}}},{key:"generateMapData",value:function generateMapData(payload){return new hmap_desert_data_1.HMapDesertData(payload)}},{key:"onDataReceived",value:function onDataReceived(init){var _this29=this;this.registerArrows();var mapData=this.mapData;imagesLoader_1.HMapImagesLoader.getInstance().registerBuildingsToPreload(mapData.neighbours);imagesLoader_1.HMapImagesLoader.getInstance().preloadPictures(this.layers.get("loading"),init,function(){var hmapMenu=document.querySelector("#hmap-menu");if(hmapMenu!==null){hmapMenu.style.display="flex"}var loadingLayer=_this29.layers.get("loading");loadingLayer.hide();_this29.layers.get("desert-background").draw();_this29.layers.get("desert-foreground").draw()})}},{key:"onMouseMove",value:function onMouseMove(e){var layerBackground=this.layers.get("desert-background");layerBackground.onMouseMove(e)}},{key:"onMouseLeave",value:function onMouseLeave(e){var layerBackground=this.layers.get("desert-background");layerBackground.onMouseLeave(e)}},{key:"onMapButtonClick",value:function onMapButtonClick(){this.hmap.switchMapAndReload("grid")}},{key:"onDebugButtonClick",value:function onDebugButtonClick(){var el=document.createElement("textarea");el.value=this.mapData.prettyData;console.log(this.mapData.data);document.body.appendChild(el);el.select();document.execCommand("copy");document.body.removeChild(el);toast_1.Toast.show(lang_1.HMapLang.get("toastdebug"))}},{key:"registerArrows",value:function registerArrows(){var _this30=this;this.registredArrows=new Array;if(this.mapData){var mapData=this.mapData;if(mapData.actionPoints>0){mapData.neighbours.neighbours.forEach(function(neighbour){var offsetY,offsetX;if(neighbour.outbounds===false){if(neighbour.position==="top_center"){offsetY=15;offsetX=-41+150;var A=new arrow_1.HMapArrow(offsetX,offsetY,offsetX,offsetY,83,28,"top",0,false);_this30.registredArrows.push(A)}else if(neighbour.position==="bottom_center"){offsetY=250;offsetX=-41+150;var _A=new arrow_1.HMapArrow(offsetX,offsetY,offsetX,offsetY,83,28,"bottom",180,false);_this30.registredArrows.push(_A)}else if(neighbour.position==="middle_right"){offsetX=230;offsetY=-14+150;var _A2=new arrow_1.HMapArrow(offsetX,offsetY,offsetX+27,offsetY-27,28,83,"right",90,false);_this30.registredArrows.push(_A2)}else if(neighbour.position==="middle_left"){offsetX=-10;offsetY=-14+150;var _A3=new arrow_1.HMapArrow(offsetX,offsetY,offsetX+27,offsetY-27,28,83,"left",270,false);_this30.registredArrows.push(_A3)}}})}}}},{key:"target",get:function get(){if(this.hmap.target){return this.hmap.target}else if(this.mapData){return this.mapData.town}else{throw new Error("target and map data are not set")}}}]);return HMapDesertMap}(abstract_1.HMapAbstractMap);exports.HMapDesertMap=HMapDesertMap},{"../arrow":1,"../data/hmap-desert-data":3,"../environment":5,"../imagesLoader":7,"../lang":8,"../layers/svg-desert-background":10,"../layers/svg-desert-foreground":11,"../layers/svg-loading":14,"../toast":23,"./abstract":17}],19:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var toast_1=require("../toast");var abstract_1=require("./abstract");var svg_grid_1=require("../layers/svg-grid");var environment_1=require("../environment");var lang_1=require("../lang");var svg_loading_1=require("../layers/svg-loading");var svg_glass_static_1=require("../layers/svg-glass-static");var hmap_desert_data_1=require("../data/hmap-desert-data");var imagesLoader_1=require("../imagesLoader");var HMapGridMap=function(_abstract_1$HMapAbstr2){_inherits(HMapGridMap,_abstract_1$HMapAbstr2);function HMapGridMap(){var _this31;_classCallCheck(this,HMapGridMap);_this31=_possibleConstructorReturn(this,_getPrototypeOf(HMapGridMap).apply(this,arguments));_this31.mouseOverIndex=-1;_this31.mode="personal";_this31.displayTags=false;return _this31}_createClass(HMapGridMap,[{key:"buildLayers",value:function buildLayers(){var swf=document.querySelector(this.hmap.cssSelector);if(swf!==null){swf.setAttribute("style","display:flex;flex-direction:column;height:auto");if(this.hmap.displayFlashMap===false){var originalMap=document.querySelector("#swfCont");if(originalMap){originalMap.style.display="none"}}if(document.querySelector("#hmap")===null){var hmap=document.createElement("div");hmap.setAttribute("id","hmap");hmap.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;position:relative");swf.appendChild(hmap);var hmapMenu=document.createElement("div");hmapMenu.setAttribute("id","hmap-menu");hmapMenu.setAttribute("style","position:absolute;bottom:0px;z-index:10;height:20px;display:none");hmap.appendChild(hmapMenu);if(this.hmap.location==="desert"){var closeButton=document.createElement("div");closeButton.setAttribute("id","hmap-close-button");closeButton.setAttribute("class","hmap-button");closeButton.innerHTML=lang_1.HMapLang.get("closebutton");hmapMenu.appendChild(closeButton);closeButton.onclick=this.onMapButtonClick.bind(this)}var displayTagsButton=document.createElement("div");displayTagsButton.setAttribute("id","hmap-tags-button");displayTagsButton.setAttribute("class","hmap-button");hmapMenu.appendChild(displayTagsButton);if(!this.displayTags){var uncheckIcon=document.createElement("img");uncheckIcon.setAttribute("src",environment_1.Environment.getInstance().url+"/assets/uncheck.png");uncheckIcon.style.marginRight="3px";displayTagsButton.appendChild(uncheckIcon);displayTagsButton.append(lang_1.HMapLang.get("markersbutton"))}else{var checkIcon=document.createElement("img");checkIcon.setAttribute("src",environment_1.Environment.getInstance().url+"/assets/check.png");checkIcon.style.marginRight="3px";displayTagsButton.appendChild(checkIcon);displayTagsButton.append(lang_1.HMapLang.get("markersbutton"));displayTagsButton.style.background="#696486"}displayTagsButton.onclick=this.toggleDisplayTags.bind(this);var modeButton=document.createElement("div");modeButton.setAttribute("id","hmap-mode-button");modeButton.setAttribute("class","hmap-button");hmapMenu.appendChild(modeButton);if(this.mode!=="global"){var _uncheckIcon=document.createElement("img");_uncheckIcon.setAttribute("src",environment_1.Environment.getInstance().url+"/assets/uncheck.png");_uncheckIcon.style.marginRight="3px";modeButton.appendChild(_uncheckIcon);modeButton.append(lang_1.HMapLang.get("modebutton"))}else{var _checkIcon=document.createElement("img");_checkIcon.setAttribute("src",environment_1.Environment.getInstance().url+"/assets/check.png");_checkIcon.style.marginRight="3px";modeButton.appendChild(_checkIcon);modeButton.append(lang_1.HMapLang.get("modebutton"));modeButton.style.background="#696486"}modeButton.onclick=this.switchMode.bind(this);var resetViewButton=document.createElement("div");resetViewButton.setAttribute("id","hmap-reset-button");resetViewButton.setAttribute("class","hmap-button");resetViewButton.innerHTML=lang_1.HMapLang.get("resetbutton");hmapMenu.appendChild(resetViewButton);resetViewButton.onclick=this.onResetButtonClick.bind(this);var debugButton=document.createElement("div");debugButton.setAttribute("id","hmap-debug-button");debugButton.setAttribute("class","hmap-button");debugButton.innerHTML=lang_1.HMapLang.get("debugbutton");hmapMenu.appendChild(debugButton);debugButton.onclick=this.onDebugButtonClick.bind(this);var buttons=document.querySelectorAll(".hmap-button");buttons.forEach(function(el){el.onmouseleave=function(e){e.target.style.outline="0px"};el.onmouseenter=function(e){e.target.style.outline="1px solid #eccb94"}});hmapMenu.style.display="none"}var GridLayer=new svg_grid_1.HMapSVGGridLayer(this);this.layers.set("grid",GridLayer);var GlassStatic=new svg_glass_static_1.HMapSVGGlassStaticLayer(this);this.layers.set("glass-static",GlassStatic);var LoadingLayer=new svg_loading_1.HMapSVGLoadingLayer(this);this.layers.set("loading",LoadingLayer)}}},{key:"setTarget",value:function setTarget(index){if(this.hmap.location==="desert"||this.hmap.location==="doors"){this.hmap.target=index}}},{key:"generateMapData",value:function generateMapData(payload){return new hmap_desert_data_1.HMapDesertData(payload)}},{key:"onDataReceived",value:function onDataReceived(init){var _this32=this;imagesLoader_1.HMapImagesLoader.getInstance().preloadPictures(this.layers.get("loading"),init,function(){var hmapMenu=document.querySelector("#hmap-menu");if(hmapMenu!==null){hmapMenu.style.display="flex"}var loadingLayer=_this32.layers.get("loading");loadingLayer.hide();_this32.layers.get("grid").draw();_this32.layers.get("glass-static").draw()})}},{key:"onMapButtonClick",value:function onMapButtonClick(){this.hmap.switchMapAndReload("desert")}},{key:"onDebugButtonClick",value:function onDebugButtonClick(){var el=document.createElement("textarea");el.value=this.mapData.prettyData;console.log(this.mapData.data);document.body.appendChild(el);el.select();document.execCommand("copy");document.body.removeChild(el);toast_1.Toast.show(lang_1.HMapLang.get("toastdebug"))}},{key:"onResetButtonClick",value:function onResetButtonClick(){var layer=this.layers.get("grid");layer.resetView()}},{key:"toggleDisplayTags",value:function toggleDisplayTags(){var hmapTagButton=document.querySelector("#hmap-tags-button");while(hmapTagButton.lastChild){hmapTagButton.removeChild(hmapTagButton.lastChild)}if(this.displayTags){this.displayTags=false;var uncheckIcon=document.createElement("img");uncheckIcon.setAttribute("src",environment_1.Environment.getInstance().url+"/assets/uncheck.png");uncheckIcon.style.marginRight="3px";hmapTagButton.appendChild(uncheckIcon);hmapTagButton.append(lang_1.HMapLang.get("markersbutton"));hmapTagButton.style.background="#a13119"}else{this.displayTags=true;var checkIcon=document.createElement("img");checkIcon.setAttribute("src",environment_1.Environment.getInstance().url+"/assets/check.png");checkIcon.style.marginRight="3px";hmapTagButton.appendChild(checkIcon);hmapTagButton.append(lang_1.HMapLang.get("markersbutton"));hmapTagButton.style.background="#696486"}var layer=this.layers.get("grid");layer.draw()}},{key:"switchMode",value:function switchMode(){var hmapModeButton=document.querySelector("#hmap-mode-button");if(this.mode==="global"){this.mode="personal";if(hmapModeButton!==null){while(hmapModeButton.lastChild){hmapModeButton.removeChild(hmapModeButton.lastChild)}var uncheckIcon=document.createElement("img");uncheckIcon.setAttribute("src",environment_1.Environment.getInstance().url+"/assets/uncheck.png");uncheckIcon.style.marginRight="3px";hmapModeButton.appendChild(uncheckIcon);hmapModeButton.append(lang_1.HMapLang.get("modebutton"));hmapModeButton.style.background="#a13119"}}else{this.mode="global";if(hmapModeButton!==null){while(hmapModeButton.lastChild){hmapModeButton.removeChild(hmapModeButton.lastChild)}var checkIcon=document.createElement("img");checkIcon.setAttribute("src",environment_1.Environment.getInstance().url+"/assets/check.png");checkIcon.style.marginRight="3px";hmapModeButton.appendChild(checkIcon);hmapModeButton.append(lang_1.HMapLang.get("modebutton"));hmapModeButton.style.background="#696486"}}if(this.layers.get("grid")){this.layers.get("grid").draw()}}},{key:"target",get:function get(){if(this.hmap.target){return this.hmap.target}else if(this.mapData){return this.mapData.town}else{throw new Error("target and map data are not set")}}}]);return HMapGridMap}(abstract_1.HMapAbstractMap);exports.HMapGridMap=HMapGridMap},{"../data/hmap-desert-data":3,"../environment":5,"../imagesLoader":7,"../lang":8,"../layers/svg-glass-static":12,"../layers/svg-grid":13,"../layers/svg-loading":14,"../toast":23,"./abstract":17}],20:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var abstract_1=require("./abstract");var lang_1=require("../lang");var svg_ruin_background_1=require("../layers/svg-ruin-background");var svg_loading_1=require("../layers/svg-loading");var toast_1=require("../toast");var hmap_ruin_data_1=require("../data/hmap-ruin-data");var arrow_1=require("../arrow");var environment_1=require("../environment");var random_1=require("../random");var svg_ruin_foreground_1=require("../layers/svg-ruin-foreground");var imagesLoader_1=require("../imagesLoader");var HMapRuin=function(_abstract_1$HMapAbstr3){_inherits(HMapRuin,_abstract_1$HMapAbstr3);function HMapRuin(){var _this33;_classCallCheck(this,HMapRuin);_this33=_possibleConstructorReturn(this,_getPrototypeOf(HMapRuin).apply(this,arguments));_this33.registredArrows=new Array;_this33.oxygen=100;_this33.moving=false;return _this33}_createClass(HMapRuin,[{key:"buildLayers",value:function buildLayers(){var swf=document.querySelector(this.hmap.cssSelector);if(swf!==null){swf.setAttribute("style","display:flex;flex-direction:column;height:auto");var originalMap=document.querySelector("#swfCont");if(originalMap){originalMap.style.display="none"}if(document.querySelector("#hmap")===null){var hmap=document.createElement("div");hmap.setAttribute("id","hmap");hmap.setAttribute("style","width:"+this.width+"px;height:"+this.height+"px;position:relative");swf.appendChild(hmap);var hmapMenu=document.createElement("div");hmapMenu.setAttribute("id","hmap-menu");hmapMenu.setAttribute("style","position:absolute;bottom:0px;z-index:10;height:20px;display:none");hmap.appendChild(hmapMenu);var debugButton=document.createElement("div");debugButton.setAttribute("id","hmap-debug-button");debugButton.setAttribute("class","hmap-button");debugButton.innerHTML=lang_1.HMapLang.get("debugbutton");hmapMenu.appendChild(debugButton);debugButton.onclick=this.onDebugButtonClick.bind(this);var buttons=document.querySelectorAll(".hmap-button");buttons.forEach(function(el){el.onmouseleave=function(e){e.target.style.outline="0px"};el.onmouseenter=function(e){e.target.style.outline="1px solid #eccb94"}});hmapMenu.style.display="none"}var RuinBGLayer=new svg_ruin_background_1.HMapSVGRuinBackgroundLayer(this);this.layers.set("ruin-background",RuinBGLayer);var RuinFGLayer=new svg_ruin_foreground_1.HMapSVGRuinForegroundLayer(this);this.layers.set("ruin-foreground",RuinFGLayer);var LoadingLayer=new svg_loading_1.HMapSVGLoadingLayer(this);this.layers.set("loading",LoadingLayer)}}},{key:"move",value:function move(direction){var _this34=this;var mapData=this.mapData;if(this.moving===true){return}this.moving=true;var x,y;if(direction==="right"){x=1;y=0}else if(direction==="left"){x=-1;y=0}else if(direction==="top"){x=0;y=-1}else{x=0;y=1}var ruinLayer=this.layers.get("ruin-background");if(environment_1.Environment.getInstance().devMode===false){var _url3="explo/move?x="+x+";y="+y+";z="+mapData.zoneId+js.JsExplo.sh;var hx;var page=window.wrappedJSObject;if(page!==undefined&&page.haxe){hx=page.haxe}else if(haxe){hx=haxe}var r=new hx.Http("/"+_url3);js.XmlHttp.onStart(r);js.XmlHttp.urlForBack=_url3;r.setHeader("X-Handler","js.XmlHttp");r.onData=function(data){_this34.hmap.originalOnData(data);ruinLayer.easeMovement({x:300*x,y:300*y},function(){if(data.indexOf("js.JsExplo.init")!==-1){var startVar=data.indexOf("js.JsExplo.init")+18;var stopVar=data.indexOf("',",startVar);var tempMapData=data.substring(startVar,stopVar);_this34.partialDataReceived({raw:tempMapData})}_this34.moving=false})};r.onError=js.XmlHttp.onError;r.request(false)}else{var exit=false;if(mapData.position.x+x===7&&mapData.position.y+y===0){exit=true}var seed=1127+mapData.position.x+x+10*(mapData.position.y+y);var random=new random_1.HMapRandom(seed);var fakeData={_dirs:mapData.getFakeDirs({x:mapData.position.x+x,y:mapData.position.y+y}),_move:true,_d:{_exit:exit,_room:random.getOneOfLocalSeed([{_locked:random.getOneOfLocalSeed([true,false]),_doorKind:random.getOneOfLocalSeed([1,2,3])}]),_seed:seed,_k:random.getRandomIntegerLocalSeed(0,3),_w:true,_z:random.getOneOfLocalSeed([random.getRandomIntegerLocalSeed(1,3),0,0,0,0])},_o:this.oxygen*3e3,_r:false,_x:mapData.position.x+x,_y:mapData.position.y+y};ruinLayer.appendNextTile(x,y,fakeData._dirs);ruinLayer.easeMovement({x:300*x,y:300*y},function(){_this34.partialDataReceived({JSON:fakeData});_this34.moving=false})}}},{key:"enterRoom",value:function enterRoom(){var _this35=this;if(environment_1.Environment.getInstance().devMode===false){var _url4="explo/enterRoom?"+js.JsExplo.sh;var hx;var page=window.wrappedJSObject;if(page!==undefined&&page.haxe){hx=page.haxe}else if(haxe){hx=haxe}var r=new hx.Http("/"+_url4);js.XmlHttp.onStart(r);js.XmlHttp.urlForBack=_url4;r.setHeader("X-Handler","js.XmlHttp");r.onData=function(data){_this35.hmap.originalOnData(data);if(data.indexOf("js.JsExplo.init")!==-1){var startVar=data.indexOf("js.JsExplo.init")+18;var stopVar=data.indexOf("',",startVar);var tempMapData=data.substring(startVar,stopVar);_this35.partialDataReceived({raw:tempMapData})}};r.onError=js.XmlHttp.onError;r.request(false)}else{var mapData=this.mapData;var fakeData=mapData.data._r;fakeData._r=true;this.partialDataReceived({JSON:fakeData})}}},{key:"exitRoom",value:function exitRoom(){var _this36=this;if(environment_1.Environment.getInstance().devMode===false){var _url5="explo/leaveRoom?"+js.JsExplo.sh;var hx;var page=window.wrappedJSObject;if(page!==undefined&&page.haxe){hx=page.haxe}else if(haxe){hx=haxe}var r=new hx.Http("/"+_url5);js.XmlHttp.onStart(r);js.XmlHttp.urlForBack=_url5;r.setHeader("X-Handler","js.XmlHttp");r.onData=function(data){_this36.hmap.originalOnData(data);if(data.indexOf("js.JsExplo.init")!==-1){var startVar=data.indexOf("js.JsExplo.init")+18;var stopVar=data.indexOf("',",startVar);var tempMapData=data.substring(startVar,stopVar);_this36.partialDataReceived({raw:tempMapData})}};r.onError=js.XmlHttp.onError;r.request(false)}else{var mapData=this.mapData;var fakeData=mapData.data._r;fakeData._r=false;this.partialDataReceived({JSON:fakeData})}}},{key:"generateMapData",value:function generateMapData(payload){return new hmap_ruin_data_1.HMapRuinData(payload)}},{key:"onDataReceived",value:function onDataReceived(init){var _this37=this;this.type=this.mapData.ruinType;if(init){imagesLoader_1.HMapImagesLoader.getInstance().loadRuinPics(this.type)}this.registerArrows();imagesLoader_1.HMapImagesLoader.getInstance().preloadPictures(this.layers.get("loading"),init,function(){var hmapMenu=document.querySelector("#hmap-menu");if(hmapMenu!==null){hmapMenu.style.display="flex"}var loadingLayer=_this37.layers.get("loading");loadingLayer.hide();_this37.layers.get("ruin-background").draw();var FGLayer=_this37.layers.get("ruin-foreground");if(init){FGLayer.draw();_this37.watchOxygen()}else{FGLayer.updateArrows()}})}},{key:"onDebugButtonClick",value:function onDebugButtonClick(){var el=document.createElement("textarea");el.value=this.mapData.prettyData;console.log(this.mapData.data);document.body.appendChild(el);el.select();document.execCommand("copy");document.body.removeChild(el);toast_1.Toast.show(lang_1.HMapLang.get("toastdebug"))}},{key:"watchOxygen",value:function watchOxygen(){var _this38=this;if(this.oxygenTimer){window.clearInterval(this.oxygenTimer)}var mapData=this.mapData;this.oxygen=Math.floor(mapData.oxygen/3e3);var FGLayer=this.layers.get("ruin-foreground");FGLayer.updateOxygen();this.oxygenTimer=window.setInterval(function(){if(_this38.oxygen<=0){window.clearInterval(_this38.oxygenTimer);_this38.oxygenTimer=undefined;return}_this38.oxygen-=1;FGLayer.updateOxygen()},3e3)}},{key:"registerArrows",value:function registerArrows(){this.registredArrows=new Array;if(this.mapData){var mapData=this.mapData;var offsetY,offsetX;if(mapData.room){offsetY=250;offsetX=-41+150;var A=new arrow_1.HMapArrow(offsetX,offsetY,offsetX,offsetY,83,28,"bottom",180,false);this.registredArrows.push(A)}else{if(mapData.oxygen>0){var directions=mapData.directions;if(directions[1]===true){offsetY=15;offsetX=-41+150;var _A4=new arrow_1.HMapArrow(offsetX,offsetY,offsetX,offsetY,83,28,"top",0,false);this.registredArrows.push(_A4)}if(directions[3]===true){offsetY=250;offsetX=-41+150;var _A5=new arrow_1.HMapArrow(offsetX,offsetY,offsetX,offsetY,83,28,"bottom",180,false);this.registredArrows.push(_A5)}if(directions[0]===true){offsetX=230;offsetY=-14+150;var _A6=new arrow_1.HMapArrow(offsetX,offsetY,offsetX+27,offsetY-27,28,83,"right",90,false);this.registredArrows.push(_A6)}if(directions[2]===true){offsetX=-10;offsetY=-14+150;var _A7=new arrow_1.HMapArrow(offsetX,offsetY,offsetX+27,offsetY-27,28,83,"left",270,false);this.registredArrows.push(_A7)}}}}}}]);return HMapRuin}(abstract_1.HMapAbstractMap);exports.HMapRuin=HMapRuin},{"../arrow":1,"../data/hmap-ruin-data":4,"../environment":5,"../imagesLoader":7,"../lang":8,"../layers/svg-loading":14,"../layers/svg-ruin-background":15,"../layers/svg-ruin-foreground":16,"../random":22,"../toast":23,"./abstract":17}],21:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var HMapNeighbour=function HMapNeighbour(x,y,p,o,i,view,b){_classCallCheck(this,HMapNeighbour);this.offsetX=0;this.offsetY=0;this.x=x;this.y=y;this.position=p;this.outbounds=o;this.index=i;this.view=view;this.building=b;if(this.position==="top_right"||this.position==="middle_right"||this.position==="bottom_right"){this.offsetX=200}else if(this.position==="top_center"||this.position==="middle_center"||this.position==="bottom_center"){this.offsetX=100}if(this.position==="bottom_right"||this.position==="bottom_center"||this.position==="bottom_left"){this.offsetY=200}else if(this.position==="middle_right"||this.position==="middle_center"||this.position==="middle_left"){this.offsetY=100}};exports.HMapNeighbour=HMapNeighbour;var HMapNeighbours=function(){function HMapNeighbours(){_classCallCheck(this,HMapNeighbours);this.neighbours=new Map}_createClass(HMapNeighbours,[{key:"addNeighbour",value:function addNeighbour(n){this.neighbours.set(n.position,n)}}]);return HMapNeighbours}();exports.HMapNeighbours=HMapNeighbours},{}],22:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var HMapRandom=function(){function HMapRandom(){var seed=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;_classCallCheck(this,HMapRandom);this.seed=seed}_createClass(HMapRandom,[{key:"random",value:function random(){this.seed=(this.seed*9301+49297)%233280;return this.seed/233280}},{key:"getRandomIntegerLocalSeed",value:function getRandomIntegerLocalSeed(min,max){return Math.floor(this.random()*(max-min))+min}},{key:"getOneOfLocalSeed",value:function getOneOfLocalSeed(elements,exceptions){var random=this.random();var element=elements[Math.floor(random*elements.length)];if(exceptions!==undefined&&exceptions.length>0&&exceptions.indexOf(element)!==-1){return this.getOneOfLocalSeed(elements,exceptions)}else{return element}}},{key:"randomCircle",value:function randomCircle(center,radius){var ang=this.random()*360;return{x:center.x+radius*Math.sin(ang*Math.PI/180),y:center.y+radius*Math.cos(ang*Math.PI/180)}}}],[{key:"getRandomIntegerNoSeed",value:function getRandomIntegerNoSeed(min,max){return Math.floor(Math.random()*(max-min))+min}},{key:"getOneOfNoSeed",value:function getOneOfNoSeed(elements){return elements[Math.floor(Math.random()*elements.length)]}}]);return HMapRandom}();exports.HMapRandom=HMapRandom},{}],23:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var Toast=function(){function Toast(){_classCallCheck(this,Toast)}_createClass(Toast,null,[{key:"show",value:function show(text){var id=Math.floor(Math.random()*1e8);if(Toast.count===0){var body=document.querySelector("body");var _toastContainer=document.createElement("div");_toastContainer.setAttribute("id","toast-container");_toastContainer.setAttribute("style","position:fixed;top:0;left:0;padding:5px;display:flex;flex-direction:column;z-index:999");body.appendChild(_toastContainer)}var toastContainer=document.querySelector("#toast-container");if(toastContainer===null){throw new Error("Cannot find toast-container div")}var newToast=document.createElement("div");newToast.setAttribute("id","toast_"+id);newToast.innerHTML=text;var styleString="padding:6px;background:#a13119;font-size:12px;color:#eccb94;"+"font-family:Helvetica, Arial;cursor:pointer;margin-bottom:5px;border: 1px solid black";newToast.setAttribute("style",styleString);newToast.onclick=function(e){if(e.target!==null){var target=e.target;target.style.display="none"}};toastContainer.appendChild(newToast);Toast.count++;setTimeout(function(){var toast=document.querySelector("#toast_"+id);if(toast!==null&&toast.parentNode!==null){toast.parentNode.removeChild(toast);Toast.count--;if(Toast.count===0){var __toastContainer=document.querySelector("#toast-container");if(__toastContainer!==null&&__toastContainer.parentNode!==null){__toastContainer.parentNode.removeChild(__toastContainer)}}}},5e3)}}]);return Toast}();exports.Toast=Toast;Toast.count=0},{}],24:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var hmap_1=require("./hmap");var toast_1=require("./toast");var environment_1=require("./environment");var hmap_desert_data_1=require("./data/hmap-desert-data");var hmap_ruin_data_1=require("./data/hmap-ruin-data");var FontFaceObserver;if(typeof require!="undefined"){FontFaceObserver=require("fontfaceobserver-es")}else if(typeof LOCAL_FONTFACEOBSERVER!="undefined"){FontFaceObserver=LOCAL_FONTFACEOBSERVER}else{console.error("HMap::bootstrap","Cannot load fontface observer")}(function(){try{var env=environment_1.Environment.getInstance();env.devMode=typeof HMAP_DEVMODE==="undefined"?false:HMAP_DEVMODE?true:false;var style=document.createElement("style");style.appendChild(document.createTextNode("        @font-face {            font-family: visitor2;            src: url('"+env.url+"/visitor2.woff2') format('woff2');			src: url('"+env.url+"/visitor2.woff') format('woff');        }        @font-face {            font-family: economica;            src: url('"+env.url+"/economica.woff2') format('woff2');        }        div.hmap-button {            padding:0px 5px;            margin:2px 5px;            border:1px solid black;            background-color: #a13119;            font-size:13px;            font-weight:700;            font-family:economica;            color:#eccb94;            cursor:pointer;            display:flex;            align-items:center;            user-select:none;        }        .hmap-popup {            font-smooth: none;            -webkit-font-smoothing: none;        }        .hmap-text-green {            font-smooth: none;            -webkit-font-smoothing: none;            fill: #d7ff5b;            font-family: visitor2;            font-size: 13px;        }        .hmap-text-yellow {            font-smooth: none;            -webkit-font-smoothing: none;            fill: #ebc369;            font-family: visitor2;            font-size: 13px;        }        "));document.head.appendChild(style);var body=document.querySelector("body");var divVisitor2=document.createElement("div");divVisitor2.setAttribute("style","font-family:visitor2;display:none;");body.appendChild(divVisitor2);var divEconomica=document.createElement("div");divEconomica.setAttribute("style","font-family:economica;display:none;");body.appendChild(divEconomica);var visitor2=new FontFaceObserver("visitor2");var economica=new FontFaceObserver("economica");Promise.all([visitor2.load(),economica.load()]).then(function(){try{var map=new hmap_1.HMap;if(env.devMode===true){map.location="desert";map.reloadMapWithData();HMAP=map;HMAPDESERTDATA=hmap_desert_data_1.HMapDesertData;HMAPRUINDATA=hmap_ruin_data_1.HMapRuinData}else{var counterCheckJsMap=0;var checkLocationKnown=setInterval(function(){if(map.getCurrentLocation()!=="unknown"){clearInterval(checkLocationKnown);map.location=map.getCurrentLocation();map.fetchMapData();setTimeout(function(){return map.setupInterceptor()})}else if(++counterCheckJsMap>10){clearInterval(checkLocationKnown);map.setupInterceptor()}},200)}}catch(err){console.error("HMap::bootstrap - loaded",err,err.message);toast_1.Toast.show("Hmap - An error occured. Check the console to see the message.")}}).catch(function(err){console.error("HMap::promiseAll",err,err.message);toast_1.Toast.show("Hmap - Cannot load the fonts. Try to reload the page by pressing CTRL + F5 or change your browser")})}catch(err){console.error("HMap::bootstrap",err,err.message);toast_1.Toast.show("Hmap - An error occured. Check the console to see the message.")}})()},{"./data/hmap-desert-data":3,"./data/hmap-ruin-data":4,"./environment":5,"./hmap":6,"./toast":23,"fontfaceobserver-es":25}],25:[function(require,module,exports){!function(e,t){"object"==_typeof(exports)&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).FontFaceObserver=t()}(this,function(){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function e(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var l={maxWidth:"none",display:"inline-block",position:"absolute",height:"100%",width:"100%",overflow:"scroll",fontSize:"16px"},a={display:"inline-block",height:"200%",width:"200%",fontSize:"16px",maxWidth:"none"},s={maxWidth:"none",minWidth:"20px",minHeight:"20px",display:"inline-block",overflow:"hidden",position:"absolute",width:"auto",margin:"0",padding:"0",top:"-999px",whiteSpace:"nowrap",fontSynthesis:"none"},S=function(){function t(e){n(this,t),this.element=document.createElement("div"),this.element.setAttribute("aria-hidden","true"),this.element.appendChild(document.createTextNode(e)),this.collapsible=document.createElement("span"),this.expandable=document.createElement("span"),this.collapsibleInner=document.createElement("span"),this.expandableInner=document.createElement("span"),this.lastOffsetWidth=-1,Object.assign(this.collapsible.style,l),Object.assign(this.expandable.style,l),Object.assign(this.expandableInner.style,l),Object.assign(this.collapsibleInner.style,a),this.collapsible.appendChild(this.collapsibleInner),this.expandable.appendChild(this.expandableInner),this.element.appendChild(this.collapsible),this.element.appendChild(this.expandable)}return e(t,[{key:"getElement",value:function value(){return this.element}},{key:"setFont",value:function value(e){Object.assign(this.element.style,function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(e){o(t,e,n[e])})}return t}({},s,{font:e}))}},{key:"getWidth",value:function value(){return this.element.offsetWidth}},{key:"setWidth",value:function value(e){this.element.style.width=e+"px"}},{key:"reset",value:function value(){var e=this.getWidth(),t=e+100;return this.expandableInner.style.width=t+"px",this.expandable.scrollLeft=t,this.collapsible.scrollLeft=this.collapsible.scrollWidth+100,this.lastOffsetWidth!==e&&(this.lastOffsetWidth=e,!0)}},{key:"onScroll",value:function value(e){this.reset()&&null!==this.element.parentNode&&e(this.lastOffsetWidth)}},{key:"onResize",value:function value(e){var t=this;function n(){t.onScroll(e)}this.collapsible.addEventListener("scroll",n),this.expandable.addEventListener("scroll",n),this.reset()}}]),t}();var t=function(){function b(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return n(this,b),this.family=e,this.style=t.style||"normal",this.weight=t.weight||"normal",this.stretch=t.stretch||"normal",this}return e(b,null,[{key:"getUserAgent",value:function value(){return window.navigator.userAgent}},{key:"getNavigatorVendor",value:function value(){return window.navigator.vendor}},{key:"hasWebKitFallbackBug",value:function value(){if(null===b.HAS_WEBKIT_FALLBACK_BUG){var e=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(b.getUserAgent());b.HAS_WEBKIT_FALLBACK_BUG=!!e&&(parseInt(e[1],10)<536||536===parseInt(e[1],10)&&parseInt(e[2],10)<=11)}return b.HAS_WEBKIT_FALLBACK_BUG}},{key:"hasSafari10Bug",value:function value(){if(null===b.HAS_SAFARI_10_BUG)if(b.supportsNativeFontLoading()&&/Apple/.test(b.getNavigatorVendor())){var e=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))(?:\.([0-9]+))/.exec(b.getUserAgent());b.HAS_SAFARI_10_BUG=!!e&&parseInt(e[1],10)<603}else b.HAS_SAFARI_10_BUG=!1;return b.HAS_SAFARI_10_BUG}},{key:"supportsNativeFontLoading",value:function value(){return null===b.SUPPORTS_NATIVE_FONT_LOADING&&(b.SUPPORTS_NATIVE_FONT_LOADING=!!document.fonts),b.SUPPORTS_NATIVE_FONT_LOADING}},{key:"supportStretch",value:function value(){if(null===b.SUPPORTS_STRETCH){var e=document.createElement("div");try{e.style.font="condensed 100px sans-serif"}catch(e){}b.SUPPORTS_STRETCH=""!==e.style.font}return b.SUPPORTS_STRETCH}}]),e(b,[{key:"load",value:function value(e,t){var p=this,m=e||"BESbswy",g=0,y=t||b.DEFAULT_TIMEOUT,v=p.getTime();return new Promise(function(h,f){if(b.supportsNativeFontLoading()&&!b.hasSafari10Bug()){var e=new Promise(function(n,i){!function t(){var e=p.getTime();y<=e-v?i(new Error(y+"ms timeout exceeded")):document.fonts.load(p.getStyle('"'+p.family+'"'),m).then(function(e){1<=e.length?n():setTimeout(t,25)},i)}()}),t=new Promise(function(e,t){g=setTimeout(function(){t(new Error(y+"ms timeout exceeded"))},y)});Promise.race([t,e]).then(function(){clearTimeout(g),h(p)},f)}else n=function n(){var i=new S(m),o=new S(m),l=new S(m),a=-1,s=-1,r=-1,e=-1,t=-1,n=-1,u=document.createElement("div");function c(){null!==u.parentNode&&u.parentNode.removeChild(u)}function d(){if((-1!=a&&-1!=s||-1!=a&&-1!=r||-1!=s&&-1!=r)&&(a==s||a==r||s==r)){if(b.hasWebKitFallbackBug()&&(a==e&&s==e&&r==e||a==t&&s==t&&r==t||a==n&&s==n&&r==n))return;c(),clearTimeout(g),h(p)}}u.dir="ltr",i.setFont(p.getStyle("sans-serif")),o.setFont(p.getStyle("serif")),l.setFont(p.getStyle("monospace")),u.appendChild(i.getElement()),u.appendChild(o.getElement()),u.appendChild(l.getElement()),document.body.appendChild(u),e=i.getWidth(),t=o.getWidth(),n=l.getWidth(),function e(){var t=p.getTime();if(y<=t-v)c(),f(new Error(y+"ms timeout exceeded"));else{var n=document.hidden;!0!==n&&void 0!==n||(a=i.getWidth(),s=o.getWidth(),r=l.getWidth(),d()),g=setTimeout(e,50)}}(),i.onResize(function(e){a=e,d()}),i.setFont(p.getStyle('"'+p.family+'",sans-serif')),o.onResize(function(e){s=e,d()}),o.setFont(p.getStyle('"'+p.family+'",serif')),l.onResize(function(e){r=e,d()}),l.setFont(p.getStyle('"'+p.family+'",monospace'))},document.body?n():document.addEventListener?document.addEventListener("DOMContentLoaded",function e(){document.removeEventListener("DOMContentLoaded",e),n()}):document.attachEvent("onreadystatechange",function e(){"interactive"!=document.readyState&&"complete"!=document.readyState||(document.detachEvent("onreadystatechange",e),n())});var n})}},{key:"getStyle",value:function value(e){return[this.style,this.weight,b.supportStretch()?this.stretch:"","100px",e].join(" ")}},{key:"getTime",value:function value(){return(new Date).getTime()}}]),b}();return o(t,"Ruler",S),o(t,"HAS_WEBKIT_FALLBACK_BUG",null),o(t,"HAS_SAFARI_10_BUG",null),o(t,"SUPPORTS_STRETCH",null),o(t,"SUPPORTS_NATIVE_FONT_LOADING",null),o(t,"DEFAULT_TIMEOUT",3e3),t})},{}]},{},[24]);