(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{GsoD:function(t,e,o){"use strict";o.d(e,"a",function(){return a});var s=o("8Y7J"),i=o("SVse");let a=(()=>{class t{constructor(t){this.location=t}onClick(){console.log("Directive [backButton] !!"),this.location.back()}}return t.\u0275fac=function(e){return new(e||t)(s.Mb(i.i))},t.\u0275dir=s.Hb({type:t,selectors:[["","backButton",""]],hostBindings:function(t,e){1&t&&s.ac("click",function(){return e.onClick()})}}),t})()},UPWR:function(t,e,o){"use strict";o.d(e,"a",function(){return p});var s=o("mrSG"),i=o("4ZJM"),a=o("AALx"),r=o("fmbZ"),n=o("2hsb"),h=o("8Y7J");let p=(()=>{class t{constructor(t,e,o){this.util=t,this.mapboxService=e,this.storage=o,this.busStop={am:{},pm:{}},this.colorRoute={am:"#a900c7",pm:"#c73609"},this.walkingDirection={},this.markersAll={},this.toggleMap=!1}ngOnChanges(){(this.searchLocation.lat&&this.searchLocation.lng||this.schooLocation.lat&&this.schooLocation.lng)&&this.buildMap(),this.markersDisplay[0]&&this.markersDisplay[0].jobID&&this.buildRoute()}ngAfterViewInit(){}ngOnInit(){}initMap(){return Object(s.a)(this,void 0,void 0,function*(){if(!this.map){let t=this.util.getEnv(),e={lat:parseFloat(t.default_region.lat)||0,lon:parseFloat(t.default_region.lon)||0};console.log("deafultMap",e),this.map=new i.Map({container:"map-search-mapbox",style:"mapbox://styles/mapbox/streets-v11",center:[e.lon,e.lat],zoom:13})}return this.map})}buildRoute(){return Object(s.a)(this,void 0,void 0,function*(){this.map||(yield this.initMap());let t={};this.markersDisplay.forEach((e,o)=>Object(s.a)(this,void 0,void 0,function*(){e.route.forEach((t,o)=>{this.markersAll[e.jobID+"_"+o]=new i.Marker,this.markersAll[e.jobID+"_"+o].setLngLat([t.lng,t.lat]),this.markersAll[e.jobID+"_"+o].addTo(this.map),this.markersAll[e.jobID+"_"+o].setPopup(this.makerPopUp(t.address))});let o=yield this.storage.getStorage("routeJob_"+e.jobID);if(o)o=JSON.parse(o);else{let t=(yield this.mapboxService.getRouteDirection(e.routeLatLng,"mapbox/driving")).routes[0].geometry.coordinates;yield this.storage.setStorage("routeJob_"+e.jobID,JSON.stringify(t))}t=yield this.mapRouteDrawStyle("all",o,e.jobID)})),this.map.on("load",()=>Object(s.a)(this,void 0,void 0,function*(){this.toggleMap||(this.map.addLayer(t),this.toggleMap=!0)}))})}buildMap(){return Object(s.a)(this,void 0,void 0,function*(){let t=[],e="";this.schooLocation.lat&&this.schooLocation.lng?(t=[this.schooLocation.lng,this.schooLocation.lat],e=this.schooLocation.collection_name):(t=[this.searchLocation.lng,this.searchLocation.lat],e=this.searchLocation.address),this.map||(this.initMap(),this.map.setCenter(t));let o=this.customMarker("homemarker.png"),s=this.makerPopUp(e),a=new i.Marker(o);if(a.setLngLat(t),a.addTo(this.map),a.setPopup(s),a.togglePopup(),void 0!==this.busStopList&&!Object.keys(this.busStopList).length){this.busStop[this.routeType]._lngLat&&(this.removeMarkerandDrawer(this.routeType),this.busStop[this.routeType].remove(),this.busStop[this.routeType]={});let e=!1;Object.keys(this.busStop).forEach(t=>{t!=this.routeType&&this.busStop[t]._lngLat&&(e=!0,this.map.flyTo({center:[this.busStop[t]._lngLat.lng,this.busStop[t]._lngLat.lat],zoom:19}))}),e||this.map.flyTo({center:t,zoom:19})}if(this.routeType&&this.busStopList&&this.busStopList.add_lat&&this.busStopList.add_lng){let t="am"==this.routeType?this.busStopList.add_lat:this.busStopList.des_lat,e="am"==this.routeType?this.busStopList.add_lng:this.busStopList.des_lng,o="am"==this.routeType?this.busStopList.pickup_point:this.busStopList.dropoff_point;if(!this.busStop[this.routeType].setLngLat){let t=this.customMarker("busmarker.png");this.busStop[this.routeType]=new i.Marker(t)}this.busStop[this.routeType].setLngLat([e,t]),this.busStop[this.routeType].addTo(this.map),this.busStop[this.routeType].setPopup(this.makerPopUp(o)),this.busStop[this.routeType].togglePopup(),this.unselect!="unselect"+this.routeType&&this.map.flyTo({center:[e,t],zoom:19}),this.searchLocation.lat&&this.searchLocation.lng&&(this.unselect=="unselect"+this.routeType?this.removeMarkerandDrawer(this.routeType):this.routeDirection(this.routeType,[this.searchLocation.lng,this.searchLocation.lat],[e,t]))}})}makerPopUp(t=""){return new i.Popup({offset:25}).setText(t)}routeDirection(t,e=[],o=[]){return Object(s.a)(this,void 0,void 0,function*(){let s=[];if(this.busStopList.jobID&&this.walkingDirection[this.busStopList.jobID]?s=this.walkingDirection[this.busStopList.jobID]:(s=(yield this.mapboxService.getRouteDirection([e,o],"mapbox/walking")).routes[0].geometry.coordinates,this.walkingDirection[this.busStopList.jobID]=s),this.map.getSource("route"+t)){let e={type:"Feature",properties:{},geometry:{type:"LineString",coordinates:s}};this.map.getSource("route"+t).setData(e)}else this.map.addLayer(this.mapRouteDrawStyle(t,s))})}removeMarkerandDrawer(t){this.map.getSource("route"+t)&&(this.map.removeLayer("route"+t),this.map.removeSource("route"+t),this.busStop[this.routeType].remove())}mapRouteDrawStyle(t,e,o=""){return{id:"route"+t+o,type:"line",source:{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}}},paint:{"line-color":"all"!=t?this.colorRoute[t]:"#a900c7","line-width":3,"line-dasharray":"all"!=t?[1,2]:[1]}}}customMarker(t){const e=document.createElement("div");return e.style.width="38px",e.style.height="38px",e.style.background="url(assets/img/images/"+t+") no-repeat",e.style.backgroundSize="contain",e}}return t.\u0275fac=function(e){return new(e||t)(h.Mb(r.a),h.Mb(a.a),h.Mb(n.a))},t.\u0275cmp=h.Gb({type:t,selectors:[["app-searchbusmap"]],inputs:{routeType:"routeType",busStopList:"busStopList",searchLocation:"searchLocation",schooLocation:"schooLocation",routeDisplay:"routeDisplay",markersDisplay:"markersDisplay",unselect:"unselect"},features:[h.xb],decls:4,vars:0,consts:[[1,"col-12","col-md-12","no-padding"],[1,"row"],[1,"col-12","col-md-12","col-sm-12","col-xs-12"],["id","map-search-mapbox"]],template:function(t,e){1&t&&(h.Sb(0,"div",0),h.Sb(1,"div",1),h.Sb(2,"div",2),h.Nb(3,"div",3),h.Rb(),h.Rb(),h.Rb())},styles:["#map-search-mapbox[_ngcontent-%COMP%]{height:85vh;max-height:85vh;margin-bottom:20px}.popup2[_ngcontent-%COMP%]{transform:none!important;top:-36px!important;left:10px}"]}),t})()},ot1H:function(t,e,o){"use strict";o.d(e,"a",function(){return h});var s=o("s7LF"),i=o("SVse"),a=o("LqlI"),r=o("WEGI"),n=o("8Y7J");let h=(()=>{class t{}return t.\u0275fac=function(e){return new(e||t)},t.\u0275mod=n.Kb({type:t}),t.\u0275inj=n.Jb({imports:[[s.j,i.c,r.a,a.b.forRoot()]]}),t})()}}]);