import{P as o,b as p}from"./MainMap.js";const r={data:()=>({map:{addedPoints:[],staticAddedPoints:[],dynamicCategories:[],points:[]}}),computed:{mapDynamicCategories(){return this.$store.getters["map/dynamicCategories"]},mapDynamicCategoriesPoints(){return this.$store.getters["map/dynamicCategoriesPoints"]}},mounted(){this.refreshMapPoints(),this.refreshMapCategories()},methods:{setMapPlayer(e){let s=this.$refs.Map;JSON.parse(e)[2]&&s.moveToPlayer()},setMapPoints(e){const s=[];for(const t of JSON.parse(e))s.push({icon:t[0],name:t[1],position:{x:t[2][0],y:t[2][1]}});this.map.points=s},addMapPoints(e){for(const s of JSON.parse(e)){const t=!!s[3];this.map.staticAddedPoints.push({icon:s[0],name:s[1],...!t&&{type:o.OTHER},position:{x:s[2][0],y:s[2][1],z:s[2][2]},temp:!1,isOther:!t})}this.refreshMapPoints()},addMapTemporaryPoint(e){const s=JSON.parse(e);this.map.points=this.map.points.filter(a=>!a.temp);const t=this.map.points.push({icon:s[0],name:s[1],position:{x:s[2][0],y:s[2][1]},temp:!0});let i=this.$refs.Map;this.$nextTick(()=>{const a=i.$refs.markers[t-1];this.selectPoint(a.mapObject,this.map.points[t-1])})},showMapBusiness(e){const s=JSON.parse(e);for(const t of s)for(let i=0;i<this.map.points.length;++i)this.map.points[i].type==o.BUSINESS&&this.map.points[i].id==t[0]&&(this.map.points[i].show=!0,this.map.points[i].isAtm=t[1]);this.map.points=[...this.map.points]},refreshMapPoints(){this.map.addedPoints=[...this.map.staticAddedPoints,...this.mapDynamicCategoriesPoints],this.map.points=[...p(this.map.addedPoints)]},refreshMapCategories(){this.map.dynamicCategories=[...this.mapDynamicCategories]},focusMapBusiness(e){let s=this.$refs.Map,t=this.map.points.find(i=>i.type==o.BUSINESS&&i.id==e);if(t){let i=this.map.points.indexOf(t),a=s.$refs.markers[i];this.selectPoint(a.mapObject,t)}},removeMapTemporaryPoint(){this.map.points=this.map.points.filter(e=>!e.temp)}},watch:{mapDynamicCategories(){this.refreshMapCategories()},mapDynamicCategoriesPoints(){this.refreshMapPoints()}}};export{r as _};
