var stocks_list_more_txt=;var stocks_list_choose=;var pickupl_nopoints=;var mapTooltipLink_class="btn-small",autocompleteData=[],ajaxGetPickupNoMap=function(){$(".mapContainer_pickup, .pickupl_submit").show();var t={courierId:pickup_sites.courierId,isCod:pickup_sites.isCod};$.ajax({type:"GET",url:"/ajax/getPickups.php",data:t,dataType:"json",success:function(t){return t.pickupPoints.length?void setPickupPointsNoMap(t):(Alertek.show_alert(pickupl_nopoints),$(".loadingMap").hide(),!1)},error:function(){orderdetails_payments.ajaxLoadSite(0),$(".no_google_api_key div.asideContainer_pickup").show(),Alertek.show_alert(pickupl_error)}})},setPickupPointsNoMap=function(r){const e=document.getElementById("payitem_cash").checked?0:1;var s=$("#pickup_copy").clone(),t="";for(i in r.pickupPoints){const o=document.querySelector(`#item_${r.pickupPoints[i].courierId}-${e}`).parentElement,a=o.querySelector(".name").innerHTML,d=o.querySelector(".photo").innerHTML;var l=r.pickupPoints[i],n=""==l.address.buildingAndHouseNumber?l.address.street:l.address.street+" "+l.address.buildingAndHouseNumber;pickup_clone=s.clone(),pickup_clone.find("input[name=pickup_point], input[name=stock]").attr("id","pickup_point_"+l.id).val(l.id),pickup_clone.find("label").attr({id:"pp_"+l.id,"data-latitude":l.coordinates.latitude,"data-longitude":l.coordinates.longitude,"data-id":l.id,"data-requires_client_number":l.requiresClientNumber,"data-courier-id":r.pickupPoints[i].courierId,for:"pickup_point_"+l.id}),pickup_clone.find(".zipcodePickup").after(`${r.pickupPoints[i].price}`),l.coordinates.longitude?pickup_clone.find("label .map_dir").attr("href","https://www.google.com/maps/dir/?api=1&destination="+l.coordinates.latitude+","+l.coordinates.longitude):pickup_clone.find("label .map_dir").attr("href","https://maps.google.com?saddr=Current+Location&daddr="+l.address.street+"+"+l.address.postcode+"+"+l.address.city),pickup_clone.find("b.headerText").text(l.name),pickup_clone.find("span.streetText").text(n),pickup_clone.find("span.zipcodePickup").html(l.address.postcode+" "+l.address.city+""),pickup_clone.find("div.moreText").text(l.location),pickup_clone.find("a.moreLink").attr("href",l.link),pickup_clone.find(".headerText").before(`

${d}${a}

`),l.requiresClientNumber||pickup_clone.find("input[name=client_courier_number]").remove(),t+=pickup_clone.html(),autocompleteData.push({label:l.address.city+", "+l.address.street+" "+l.address.buildingAndHouseNumber+" "+l.address.postcode+" "+l.id,value:l.address.city+", "+l.address.street+" "+l.address.buildingAndHouseNumber+", "+l.id,description:l.location,id:l.id})}$("#pickup_site .asideContainer_pickup").html(t)},pickup_sites={geokoder:0,mapa:0,zoom:0,markerIcon:0,language:0,markersArray:[],contentsArray:[],markerInfo:0,timeout:0,loadNavBoolPickup:!1,pickupCount:0,pickupIteration:0,pickupFind:0,pickupFirstActive:!0,calendar:{},markerAnimation:0,pickupsType:0,google_api_key:"",courierId:app_shop.vars.courierId,isCod:!1,search_lat:"",search_lng:"",markerClusters:"",ClusterMaxZoom:13,minimumClusterSize:10,autocomplete:!1,adress:{street_number:"",route:"",locality:"",administrative_area_level_1:"",country:"",postal_code:""},fillInAddress:function(l,e){pickup_sites.adress={street_number:"",route:"",locality:"",administrative_area_level_1:"",country:"",postal_code:""};var t={street_number:"short_name",route:"long_name",locality:"long_name",administrative_area_level_1:"short_name",country:"long_name",postal_code:"short_name"};if(pickup_sites.search_lat="",pickup_sites.search_lng="",l&&!l.geometry)return!1;if(!l)return $("div.asideContainer_pickup").prepend("
"+pickupl_select_adress+"
"),$(".loadingMap").hide(),!1;$(".mapContainer_pickup, .asideContainer_pickup, .pickupl_submit, #pickup_map").show(),pickup_sites.search_lat=l.geometry.location.lat(),pickup_sites.search_lng=l.geometry.location.lng();for(var o,d=0;d"+pickupl_select_adress+""),$(".loadingMap").hide(),!1;$(".mapContainer_pickup, .asideContainer_pickup, .pickupl_submit, #pickup_map").show(),$("label.pickup_point").hide(),$("div.loadingMap").fadeIn("normal",function(){}),$("span.loadingMarkers").hide();var e={courierId:pickup_sites.courierId,"location[latitude]":pickup_sites.search_lat,"location[longitude]":pickup_sites.search_lng,isCod:pickup_sites.isCod};if(n)var e={courierId:pickup_sites.courierId,"location[latitude]":pickup_sites.search_lat,"location[longitude]":pickup_sites.search_lng,radius:function(){var t=pickup_sites.mapa.getZoom();return 15<=t?1:14==t?2:13==t?4:12==t?7:11==t?10:10==t?15:20}(),isCod:pickup_sites.isCod};$.ajax({type:"GET",url:"/ajax/getPickups.php",data:e,dataType:"json",success:function(t){if(!jQuery.isEmptyObject(selected_pickup_point)){for(i in t.pickupPoints)t.pickupPoints[i].id==selected_pickup_point.id&&delete t.pickupPoints[i];t.pickupPoints.unshift(selected_pickup_point)}if(!t.pickupPoints.length)return n?$("div.asideContainer_pickup").prepend("
"+pickupl_nopoints_in_area+"
"):$("div.asideContainer_pickup").prepend("
"+pickupl_nopoints+"
"),$(".loadingMap").hide(),!1;if(!pickup_sites.adress.route)for(i in t.pickupPoints)if($.trim(t.pickupPoints[i].address.city).toLowerCase()==$.trim(pickup_sites.adress.locality).toLowerCase())return e.radius=30,$.ajax({type:"GET",url:"/ajax/getPickups.php",data:e,dataType:"json",success:function(t){setPickupPoints(t,!0)},error:function(){}}),!1;setPickupPoints(t,!1)},error:function(){$("div.asideContainer_pickup").prepend("
"+pickupl_error+"
")}})},showSel:function(){pickup_sites.pickupCount=$(".asideContainer_pickup .pickup_point").length,pickup_sites.pickupIteration=0,$("div.loadingMap").fadeIn("normal",function(){}),$("span.loadingMap").hide(),$("span.loadingMarkers").css("display","block"),$("span.loadingMarkersCount").text(pickup_sites.pickupCount),$("span.loadingMarkersComplete").text(pickup_sites.pickupIteration),pickup_sites.markersArray=[];var o=[];$(".asideContainer_pickup .pickup_point").each(function(e){$this=$(this),o[e]={},o[e].idek=$this.data("id"),o[e].headerText=$.trim($this.find(".headerText").text()),o[e].streetText=$this.find(".streetText").text(),o[e].cityText=$.trim($this.find(".cityText").text()),o[e].moreText=$.trim($this.find(".moreLink").text()),o[e].moreLink=$.trim($this.find(".moreLink").attr("href")),o[e].infoText=$.trim($this.find(".infoText").text()),o[e].timeText=$.trim($this.find(".timeText").text()),o[e].latitude=$.trim($this.data("latitude")),o[e].longitude=$.trim($this.data("longitude")),o[e].icon=$.trim($this.data("icon"))});for(var e="";e=o.pop();)e.latitude&&e.longitude?pickup_sites.findAdres(e.headerText,e.streetText,e.cityText,e.moreText,e.moreLink,e.infoText,e.timeText,"none","another",!1,e.idek,e.latitude,e.longitude,e.icon):function(t){setTimeout(function(){pickup_sites.findAdres(t.headerText,t.streetText,t.cityText,t.moreText,t.moreLink,t.infoText,t.timeText,"none","another",!1,t.idek,t.latitude,t.longitude,t.icon)},pickup_sites.timeout)}(e)},printDates:function(t){return!!$("#selectPickupDay").size()&&void $.ajax({type:"GET",url:"/ajax/basket-delivery.php",data:{stock_id:t},dataType:"json",success:function(t){return t?void($("#selectPickupDay").html(""),$.each(t,function(o,e){$("#selectPickupDay").append("")}),$("#selectPickupDayWrapper").show(),$(".pickupl_hour_wrapper").show(),$("#selectPickupDay [name=\"calendar_select_date\"]").eq(1).prop("checked",!0)):($("#selectPickupDayWrapper").hide(),!1)},error:function(){Alertek.show_alert(pickupl_error)}})},setZoom:function(){var o=new google.maps.LatLngBounds;for(var e in pickup_sites.markersArray)o.extend(pickup_sites.markersArray[e].getPosition());pickup_sites.mapa.setCenter(o.getCenter()),pickup_sites.mapa.fitBounds(o),pickup_sites.mapa.setZoom(pickup_sites.mapa.getZoom()),15"+t+"";y+="
"+o+"  "+n+"
",s&&(y+="
"+s+"
"),y+="
"+l+"
",r&&(y+=""),y+="";var k={title:t,pickupPointID:m};k.position=P,k.map=pickup_sites.mapa,pickup_sites.markerAnimation&&(k.animation=google.maps.Animation.DROP),g&&""!=g?k.icon=g:""!=$("img.marker_face").attr("src")&&markerPickupsCustomIcon&&(k.icon=pickup_sites.markerIcon);var f=new google.maps.Marker(k);pickup_sites.markersArray.push(f),google.maps.event.addListener(f,"click",function(e){return function(t){t.cancelBubble=!0,t.returnValue=!1,t.stopPropagation&&(t.stopPropagation(),t.preventDefault()),pickup_sites.markerInfo.setContent(y),pickup_sites.markerInfo.open(pickup_sites.mapa,e),$(".asideContainer_pickup [value=\""+e.pickupPointID+"\"]").prop("checked",!0),$(".asideContainer_pickup").scrollTop(0),$(".asideContainer_pickup").scrollTop($("#pickup_site [name=\"pickup_point\"]:checked + label").position().top)}}(f,i));var v=$(".asideContainer_pickup [value=\""+f.pickupPointID+"\"]").get(0);$("label[for=\"pickup_point_"+f.pickupPointID+"\"]").show().fadeTo("slow",1),google.maps.event.addDomListener(v,"click",function(t){return function(){$(".asideContainer_pickup [value=\""+t.pickupPointID+"\"]").prop("checked",!0),pickup_sites.markerInfo.setContent(y),pickup_sites.mapa.setCenter(k.position),pickup_sites.mapa.getZoom()=pickup_sites.pickupCount&&setTimeout(function(){$("div.loadingMap").fadeOut("normal",function(){});var n=$(".markerCluster[src*=\"m1.png\"]").attr("src"),e=n.substring(0,n.indexOf("1.png"));pickup_sites.setZoom();var t=!0;pickup_sites.mapa.zoom=pickup_sites.pickupCount&&setTimeout(function(){$("div.loadingMap").fadeOut("normal",function(){});var n=$(".markerCluster[src*=\"m1.png\"]").attr("src"),e=n.substring(0,n.indexOf("1.png")-1);pickup_sites.setZoom();var t=!0;pickup_sites.mapa.zoom${d.price}`),a.find("input[name=pickup_point]").val(d.id),a.find("label").attr("data-latitude",d.coordinates.latitude),a.find("label").attr("data-longitude",d.coordinates.longitude),a.find("label").attr("data-id",d.id),a.find("label").attr("data-requires_client_number",d.requiresClientNumber),a.find("label").attr("for","pickup_point_"+d.id),a.find("label").hide().css("opacity","0"),d.markerIconUrl&&(a.find("label").attr("data-icon",d.markerIconUrl),a.find("label").find("svg").replaceWith("\""+d.id+"\"/")),d.coordinates.longitude?a.find("label .map_dir").attr("href","https://www.google.com/maps/dir/?api=1&destination="+d.coordinates.latitude+","+d.coordinates.longitude):a.find("label .map_dir").attr("href","https://maps.google.com?saddr=Current+Location&daddr="+d.address.street+"+"+d.address.postcode+"+"+d.address.city),a.find("b.headerText").text(d.name);var r=""!=d.address.buildingAndHouseNumber&&null!=d.address.buildingAndHouseNumber?d.address.street+" "+d.address.buildingAndHouseNumber:d.address.street;a.find("span.streetText").text(r),a.find("span.zipcodePickup").html(d.address.postcode+" "+d.address.city+""),a.find("div.moreText").text(d.location),a.find("a.moreLink").attr("href",d.link),a.find(".headerText").before(`

${o}${t}

`),d.requiresClientNumber||a.find("input[name=client_courier_number]").remove(),$("#pickup_site .asideContainer_pickup").append(a.find(" > *"))}pickup_sites.showSel()};function geolocate(){pickup_sites.search_lat="",pickup_sites.search_lng="",navigator.geolocation&&navigator.geolocation.getCurrentPosition(function(n){var e={lat:n.coords.latitude,lng:n.coords.longitude},t=new google.maps.Circle({center:e,radius:n.coords.accuracy});pickup_sites.autocomplete.setBounds(t.getBounds())})}$(document).on("click","#locationField .btn",function(){return $("#mymap").length?(leafletGetTextLocation(),$(".leafleat-suggestions").remove()):pickup_sites.getLocation(),!1}),$(document).on("click","div.morePickup",function(){var t=$("label.pickup_point.moreInfoShow");$(this).parents("label.pickup_point").addClass("moreInfoShow"),t.removeClass("moreInfoShow")}),$(document).on("click","#pickup_site [name=\"pickup_point\"], #pickup_site [name=\"stock\"]",function(){$("#pickup_site [name=\"client_courier_number\"]").prop("disabled",!0),$(this).find("+ label [name=\"client_courier_number\"]").prop("disabled",!1).focus(),pickup_sites.printDates($(this).val())}),app_shop.run(function(){pickup_sites.country_code=app_shop.vars.country_code,pickup_sites.language=app_shop.vars.language,pickup_sites.isCod=app_shop.vars.isCod,pickup_sites.courierId=app_shop.vars.courierId,init_pickupl_site();var o="https://maps.googleapis.com/maps/api/js?key="+app_shop.vars.apiKey+"&libraries=places&callback=pickup_sites.mapInit",e=document.createElement("script");e.setAttribute("src",o),document.body.appendChild(e)},"all","#pickup_site");function MarkerClusterer(r,e,t){this.extend(MarkerClusterer,google.maps.OverlayView),this.map_=r,this.markers_=[],this.clusters_=[],this.sizes=[53,56,66,78,90],this.styles_=[],this.ready_=!1;var o=t||{};this.gridSize_=o.gridSize||60,this.minClusterSize_=o.minimumClusterSize||2,this.maxZoom_=o.maxZoom||null,this.styles_=o.styles||[],this.imagePath_=o.imagePath||this.MARKER_CLUSTER_IMAGE_PATH_,this.imageExtension_=o.imageExtension||this.MARKER_CLUSTER_IMAGE_EXTENSION_,this.zoomOnClick_=!0,null!=o.zoomOnClick&&(this.zoomOnClick_=o.zoomOnClick),this.averageCenter_=!1,null!=o.averageCenter&&(this.averageCenter_=o.averageCenter),this.setupStyles_(),this.setMap(r),this.prevZoom_=this.map_.getZoom();var n=this;google.maps.event.addListener(this.map_,"zoom_changed",function(){var a=n.map_.getZoom(),r=n.map_.minZoom||0,t=Math.min(n.map_.maxZoom||100,n.map_.mapTypes[n.map_.getMapTypeId()].maxZoom);a=Math.min(Math.max(a,r),t),n.prevZoom_!=a&&(n.prevZoom_=a,n.resetViewport())}),google.maps.event.addListener(this.map_,"idle",function(){n.redraw()}),e&&(e.length||Object.keys(e).length)&&this.addMarkers(e,!1)}MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_="../images/m",MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_EXTENSION_="png",MarkerClusterer.prototype.extend=function(o,e){return function(o){for(var e in o.prototype)this.prototype[e]=o.prototype[e];return this}.apply(o,[e])},MarkerClusterer.prototype.onAdd=function(){this.setReady_(!0)},MarkerClusterer.prototype.draw=function(){},MarkerClusterer.prototype.setupStyles_=function(){if(!this.styles_.length)for(var o,n=0;o=this.sizes[n];n++)this.styles_.push({url:this.imagePath_+(n+1)+"."+this.imageExtension_,height:o,width:o})},MarkerClusterer.prototype.fitMapToMarkers=function(){for(var a,r=this.getMarkers(),t=new google.maps.LatLngBounds,o=0;a=r[o];o++)t.extend(a.getPosition());this.map_.fitBounds(t)},MarkerClusterer.prototype.setStyles=function(t){this.styles_=t},MarkerClusterer.prototype.getStyles=function(){return this.styles_},MarkerClusterer.prototype.isZoomOnClick=function(){return this.zoomOnClick_},MarkerClusterer.prototype.isAverageCenter=function(){return this.averageCenter_},MarkerClusterer.prototype.getMarkers=function(){return this.markers_},MarkerClusterer.prototype.getTotalMarkers=function(){return this.markers_.length},MarkerClusterer.prototype.setMaxZoom=function(t){this.maxZoom_=t},MarkerClusterer.prototype.getMaxZoom=function(){return this.maxZoom_},MarkerClusterer.prototype.calculator_=function(r,e){for(var t=0,s=r.length,n=s;0!==n;)n=parseInt(n/10,10),t++;return t=Math.min(t,e),{text:s,index:t}},MarkerClusterer.prototype.setCalculator=function(t){this.calculator_=t},MarkerClusterer.prototype.getCalculator=function(){return this.calculator_},MarkerClusterer.prototype.addMarkers=function(a,e){if(a.length)for(var t,r=0;t=a[r];r++)this.pushMarkerTo_(t);else if(Object.keys(a).length)for(var t in a)this.pushMarkerTo_(a[t]);e||this.redraw()},MarkerClusterer.prototype.pushMarkerTo_=function(o){if(o.isAdded=!1,o.draggable){var e=this;google.maps.event.addListener(o,"dragend",function(){o.isAdded=!1,e.repaint()})}this.markers_.push(o)},MarkerClusterer.prototype.addMarker=function(o,e){this.pushMarkerTo_(o),e||this.redraw()},MarkerClusterer.prototype.removeMarker_=function(a){var e=-1;if(this.markers_.indexOf)e=this.markers_.indexOf(a);else for(var r,s=0;r=this.markers_[s];s++)if(r==a){e=s;break}return-1!=e&&(a.setMap(null),this.markers_.splice(e,1),!0)},MarkerClusterer.prototype.removeMarker=function(n,e){var t=this.removeMarker_(n);return!e&&t&&(this.resetViewport(),this.redraw(),!0)},MarkerClusterer.prototype.removeMarkers=function(r,e){for(var t,l,d=!1,p=0;t=r[p];p++)l=this.removeMarker_(t),d=d||l;if(!e&&d)return this.resetViewport(),this.redraw(),!0},MarkerClusterer.prototype.setReady_=function(t){this.ready_||(this.ready_=t,this.createClusters_())},MarkerClusterer.prototype.getTotalClusters=function(){return this.clusters_.length},MarkerClusterer.prototype.getMap=function(){return this.map_},MarkerClusterer.prototype.setMap=function(t){this.map_=t},MarkerClusterer.prototype.getGridSize=function(){return this.gridSize_},MarkerClusterer.prototype.setGridSize=function(t){this.gridSize_=t},MarkerClusterer.prototype.getMinClusterSize=function(){return this.minClusterSize_},MarkerClusterer.prototype.setMinClusterSize=function(t){this.minClusterSize_=t},MarkerClusterer.prototype.getExtendedBounds=function(d){var e=this.getProjection(),t=new google.maps.LatLng(d.getNorthEast().lat(),d.getNorthEast().lng()),o=new google.maps.LatLng(d.getSouthWest().lat(),d.getSouthWest().lng()),n=e.fromLatLngToDivPixel(t);n.x+=this.gridSize_,n.y-=this.gridSize_;var a=e.fromLatLngToDivPixel(o);a.x-=this.gridSize_,a.y+=this.gridSize_;var r=e.fromDivPixelToLatLng(n),s=e.fromDivPixelToLatLng(a);return d.extend(r),d.extend(s),d},MarkerClusterer.prototype.isMarkerInBounds_=function(o,e){return e.contains(o.getPosition())},MarkerClusterer.prototype.clearMarkers=function(){this.resetViewport(!0),this.markers_=[]},MarkerClusterer.prototype.resetViewport=function(a){for(var e,r=0;e=this.clusters_[r];r++)e.remove();for(var s,r=0;s=this.markers_[r];r++)s.isAdded=!1,a&&s.setMap(null);this.clusters_=[]},MarkerClusterer.prototype.repaint=function(){var n=this.clusters_.slice();this.clusters_.length=0,this.resetViewport(),this.redraw(),window.setTimeout(function(){for(var e,a=0;e=n[a];a++)e.remove()},0)},MarkerClusterer.prototype.redraw=function(){this.createClusters_()},MarkerClusterer.prototype.distanceBetweenPoints_=function(s,e){if(!s||!e)return 0;var t=(e.lat()-s.lat())*Math.PI/180,o=(e.lng()-s.lng())*Math.PI/180,n=Math.sin(t/2)*Math.sin(t/2)+Math.cos(s.lat()*Math.PI/180)*Math.cos(e.lat()*Math.PI/180)*Math.sin(o/2)*Math.sin(o/2),r=2*Math.atan2(Math.sqrt(n),Math.sqrt(1-n));return 6371*r},MarkerClusterer.prototype.addToClosestCluster_=function(d){for(var e,p,_=4e4,m=null,c=d.getPosition(),r=0;e=this.clusters_[r];r++)if(p=e.getCenter(),p){var u=this.distanceBetweenPoints_(p,d.getPosition());u<_&&(_=u,m=e)}if(m&&m.isMarkerInClusterBounds(d))m.addMarker(d);else{var e=new Cluster(this);e.addMarker(d),this.clusters_.push(e)}},MarkerClusterer.prototype.createClusters_=function(){if(this.ready_)for(var a,r=new google.maps.LatLngBounds(this.map_.getBounds().getSouthWest(),this.map_.getBounds().getNorthEast()),t=this.getExtendedBounds(r),o=0;a=this.markers_[o];o++)!a.isAdded&&this.isMarkerInBounds_(a,t)&&this.addToClosestCluster_(a)};function Cluster(t){this.markerClusterer_=t,this.map_=t.getMap(),this.gridSize_=t.getGridSize(),this.minClusterSize_=t.getMinClusterSize(),this.averageCenter_=t.isAverageCenter(),this.center_=null,this.markers_=[],this.bounds_=null,this.clusterIcon_=new ClusterIcon(this,t.getStyles(),t.getGridSize())}Cluster.prototype.isMarkerAlreadyAdded=function(n){if(this.markers_.indexOf)return-1!=this.markers_.indexOf(n);for(var e,a=0;e=this.markers_[a];a++)if(e==n)return!0;return!1},Cluster.prototype.addMarker=function(s){if(this.isMarkerAlreadyAdded(s))return!1;if(!this.center_)this.center_=s.getPosition(),this.calculateBounds_();else if(this.averageCenter_){var e=this.markers_.length+1,t=(this.center_.lat()*(e-1)+s.getPosition().lat())/e,o=(this.center_.lng()*(e-1)+s.getPosition().lng())/e;this.center_=new google.maps.LatLng(t,o),this.calculateBounds_()}s.isAdded=!0,this.markers_.push(s);var n=this.markers_.length;if(n=this.minClusterSize_&&s.setMap(null),this.updateIcon(),!0},Cluster.prototype.getMarkerClusterer=function(){return this.markerClusterer_},Cluster.prototype.getBounds=function(){for(var a,r=new google.maps.LatLngBounds(this.center_,this.center_),t=this.getMarkers(),o=0;a=t[o];o++)r.extend(a.getPosition());return r},Cluster.prototype.remove=function(){this.clusterIcon_.remove(),this.markers_.length=0,delete this.markers_},Cluster.prototype.getSize=function(){return this.markers_.length},Cluster.prototype.getMarkers=function(){return this.markers_},Cluster.prototype.getCenter=function(){return this.center_},Cluster.prototype.calculateBounds_=function(){var t=new google.maps.LatLngBounds(this.center_,this.center_);this.bounds_=this.markerClusterer_.getExtendedBounds(t)},Cluster.prototype.isMarkerInClusterBounds=function(t){return this.bounds_.contains(t.getPosition())},Cluster.prototype.getMap=function(){return this.map_},Cluster.prototype.updateIcon=function(){var s=this.map_.getZoom(),e=this.markerClusterer_.getMaxZoom();if(e&&s>e){for(var t,l=0;t=this.markers_[l];l++)t.setMap(this.map_);return}if(this.markers_.length .pickup_search_here",function(){pickup_sites.search_lat=pickup_sites.mapa.center.lat(),pickup_sites.search_lng=pickup_sites.mapa.center.lng(),pickup_sites.ajaxGetPickup(!0)});var mymap,isLoaded=!1,isWaitingEnd=!1,leafletGetPickups=function(l,e,t){radius=15<=t?1:14==t?2:13==t?4:12==t?7:11==t?10:10==t?15:20;const s=pickup_sites.courierId.split("-")[1],o=document.querySelectorAll(`#osc_order1_${"1"==s?"prepaid":"dvp"} input[data-pickuppoint="y"]`),d=[];o.forEach(o=>{let n;const r=o.value.split("-")[0];n=t?{courierId:r,"location[latitude]":l,"location[longitude]":e,radius:radius,isCod:pickup_sites.isCod}:{courierId:r,"location[latitude]":l,"location[longitude]":e,isCod:pickup_sites.isCod},d.push($.ajax({type:"GET",url:"/ajax/getPickups.php",data:n,dataType:"json"}))}),Promise.all(d).then(n=>{const r={cities:[],pickupPoints:[]};if(n.forEach(t=>{0"+pickupl_nopoints_in_area+"")):$("div.asideContainer_pickup").prepend("
"+pickupl_nopoints+"
"),$(".loadingMap").hide(),!1;for(i in leafletItems=[],r.pickupPoints){var t=r.pickupPoints[i].coordinates.latitude,l=r.pickupPoints[i].coordinates.longitude;(""==t||""==l)&&($.ajaxSetup({async:!1}),$.get(location.protocol+"//nominatim.openstreetmap.org/search?format=json&q="+r.pickupPoints[i].address.street+", "+r.pickupPoints[i].address.city+" "+r.pickupPoints[i].address.city+" "+r.pickupPoints[i].address.country,function(o){jQuery.isEmptyObject(o)?console.log("nie mog\u0119 znale\u017A\u0107 korodynat\xF3w adresu!"):(t=o[0].lat,l=o[0].lon)})),r.pickupPoints[i].iconOptions=getMarkerIcon(r.pickupPoints[i].courierId),r.pickupPoints[i].price=document.getElementById(`item_${r.pickupPoints[i].courierId}-${s}`).parentElement.querySelector(".price").innerHTML,leafletItems.push({id:r.pickupPoints[i].id,name:r.pickupPoints[i].name,link:r.pickupPoints[i].link,address:r.pickupPoints[i].address,courierId:r.pickupPoints[i].courierId,price:r.pickupPoints[i].price,iconOptions:r.pickupPoints[i].iconOptions,lat:t,lon:l})}setPickupPointsNoMap(r,!1,!0),jQuery.isEmptyObject(leafletItems)||leafletStartMap(leafletItems[0].lat,leafletItems[0].lon,!0)})},leafletMarker=[],leafletItems=[];function leafletDelMarkers(){for(i=0;iOpenStreetMap contributors"}).addTo(mymap),isLoaded=!0,isWaitingEnd=!0),$(".loadingPoints").remove(),i=0;i`+stocks_list_more_txt+``+stocks_list_choose+``,e="";e=null==leafletItems[i].address.street?`
`+leafletItems[i].address+`
`:`
`+leafletItems[i].address.street+` `+leafletItems[i].address.buildingAndHouseNumber+` `+leafletItems[i].address.city+`
`;const t=`${leafletItems[i].price}`,o=document.querySelector(`#item_${leafletItems[i].courierId}-${a}`).parentElement,s=o.querySelector(".name").innerHTML,l=o.querySelector(".photo").innerHTML;let d=`

${l}${s}

`+leafletItems[i].name+`
`+e+t+`
`+r;markersList.push(leafletItems[i].id),markers[leafletItems[i].id]=L.marker([leafletItems[i].lat,leafletItems[i].lon],{icon:leafletItems[i].iconOptions}).addTo(mymap).on("click",leafletOnClick).bindPopup(d)}mymap.setView(new L.LatLng(n,e));let r=$(".asideContainer_pickup label.pickup_point").eq(0).attr("data-id");$(".asideContainer_pickup input[value=\""+r+"\"]").click(),$("img.leaflet-marker-icon").each(function(){var n=$(this).attr("src"),a=n.includes("preview/");a&&(n=n.replace("preview/",""));var t=n.includes("marker-icon");t&&(n=n.replace("-2x","")),$(this).attr("src",n)})},timeoutLeafLet=null;$(document).on("input","#autocomplete_location.autocomplete_nomap",function(){var t=$(this);clearTimeout(timeoutLeafLet),timeoutLeafLet=setTimeout(function(){3 .pickup_search_here_leaflet",function(){var o=mymap.getCenter(),e=mymap.getZoom();leafletDelMarkers(),selected_pickup_point={},leafletGetPickups(o.lat,o.lng,e)}),$(document).on("click","#pickup_site [name=\"pickup_point\"], #pickup_site [name=\"stock\"]",function(){const o=$(this).val();if(markers[o]){let e=markers[o].getLatLng();mymap.setView(new L.LatLng(e.lat,e.lng)),markers[o].openPopup()}});var leafletGetCoords=function(n){let a="",r="";n?$.get(location.protocol+"//nominatim.openstreetmap.org/search?format=json&q="+n,function(t){jQuery.isEmptyObject(t)?($(".asideContainer_pickup label.pickup_point").length&&($(".asideContainer_pickup label.pickup_point").each(function(){var s=$(this).data("id"),e=$(this).find(".headerText").text(),t=$(this).find(".map_dir").attr("href"),o=$(this).find(".streetText").text()+"
"+$(this).find(".zipcodePickup").text(),n=$(this).data("latitude"),a=$(this).data("longitude");leafletItems.push({id:s,name:e,link:t,address:o,lat:n,lon:a})}),leafletStartMap(leafletItems[0].lat,leafletItems[0].lon,!0)),$("div.asideContainer_pickup .menu_messages_message").length&&$("div.asideContainer_pickup .menu_messages_message").remove(),$("div.asideContainer_pickup").prepend("
"+pickupl_nopoints+"
")):(a=t[0].lat,r=t[0].lon,leafletGetPickups(a,r))}):$(".asideContainer_pickup label.pickup_point").length&&($(".asideContainer_pickup label.pickup_point").each(function(){var s=$(this).data("id"),e=$(this).find(".headerText").text(),t=$(this).find(".map_dir").attr("href"),o=$(this).find(".streetText").text()+"
"+$(this).find(".zipcodePickup").text(),n=$(this).data("latitude"),a=$(this).data("longitude");leafletItems.push({id:s,name:e,link:t,address:o,lat:n,lon:a})}),leafletStartMap(leafletItems[0].lat,leafletItems[0].lon,!0))},leafletGetLocation=function(t){$.get(location.protocol+"//nominatim.openstreetmap.org/search?format=json&q="+t,function(t){if(!jQuery.isEmptyObject(t))for(i in $("#locationField").append("
"),t)$(".leafleat-suggestions").append("
"+t[i].display_name+"
");else leafletStartMap(53.428,14.552,!0),$("div.asideContainer_pickup .menu_messages_message").length&&$("div.asideContainer_pickup .menu_messages_message").remove(),$("div.asideContainer_pickup").prepend("
"+pickupl_nopoints+"
")})},leafletGetTextLocation=function(){$("#mymap").prepend(`
${}...
`);var t=$("#autocomplete_location").val();selected_pickup_point={},$.get(location.protocol+"//nominatim.openstreetmap.org/search?format=json&q="+t,function(e){if(!jQuery.isEmptyObject(e))leafletDelMarkers(),leafletGetPickups(e[0].lat,e[0].lon),$("#autocomplete_location").val(e[0].display_name);else{if(t.search(",")){var a=t.split(","),o=a[a.length-1].trim();leafletGetCoords(o)}$("div.asideContainer_pickup .menu_messages_message").length&&$("div.asideContainer_pickup .menu_messages_message").remove(),$("div.asideContainer_pickup").prepend("
"+pickupl_nopoints+"
")}})};app_shop.run(function(){if($("#autocomplete_location").length&&""!=$("#autocomplete_location").val()){let t=$("#autocomplete_location").val();leafletGetCoords(t)}else leafletGetCoords(!1)},"all","#mymap"),app_shop.run(function(){$("#mymap").before($(".map_button_search"))},1,"#mymap"),app_shop.run(function(){$("#mymap").prepend($(".map_button_search"))},[2,3,4],"#mymap"),!function(o,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(o.L={})}(this,function(n){"use strict";function v(e){var o,n,a,d;for(n=1,a=arguments.length;nRt.indexOf(t.target.tagName)))return;go(t)}Q(t,o)});n["_leaflet_touchstart"+a]=t,n.addEventListener(kt,t,!1),Dt||(document.documentElement.addEventListener(kt,W,!0),document.documentElement.addEventListener(At,G,!0),document.documentElement.addEventListener(It,K,!0),document.documentElement.addEventListener(Ot,K,!0),Dt=!0)}(n,t,a):"touchmove"===o?function(n,o,a){function t(t){(t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&"mouse"!==t.pointerType||0!==t.buttons)&&Q(t,o)}n["_leaflet_touchmove"+a]=t,n.addEventListener(At,t,!1)}(n,t,a):"touchend"==o&&function(n,o,a){function t(t){Q(t,o)}n["_leaflet_touchend"+a]=t,n.addEventListener(It,t,!1),n.addEventListener(Ot,t,!1)}(n,t,a),this}function W(t){Nt[t.pointerId]=t,Cn++}function G(t){Nt[t.pointerId]&&(Nt[t.pointerId]=t)}function K(t){delete Nt[t.pointerId],Cn--}function Q(e,o){for(var t in e.touches=[],Nt)e.touches.push(Nt[t]);e.changedTouches=[e],o(e)}function re(n,s,a){function t(n){var o;if(xt){if(!it||"mouse"===n.pointerType)return;o=Cn}else o=n.touches.length;if(!(1=a,l=r}}function o(e){if(c&&!d.cancelBubble){if(xt){if(!it||"mouse"===e.pointerType)return;var o,n,p={};for(n in d)o=d[n],p[n]=o&&o.bind?o.bind(d):o;d=p}d.type="dblclick",d.button=0,s(d),l=null}}var l,d,c=!1;return n["_leaflet_"+An+a]=t,n["_leaflet_"+Ko+a]=o,n["_leaflet_dblclick"+a]=s,n.addEventListener(An,t,!!zt&&{passive:!1}),n.addEventListener(Ko,o,!!zt&&{passive:!1}),n.addEventListener("dblclick",s,!1),this}function Pe(o,a){var t=o["_leaflet_"+An+a],r=o["_leaflet_"+Ko+a],e=o["_leaflet_dblclick"+a];return o.removeEventListener(An,t,!!zt&&{passive:!1}),o.removeEventListener(Ko,r,!!zt&&{passive:!1}),it||o.removeEventListener("dblclick",e,!1),this}function Qe(t){return"string"==typeof t?document.getElementById(t):t}function Pt(e,o){var t=e.style[o]||e.currentStyle&&e.currentStyle[o];if((!t||"auto"===t)&&document.defaultView){var n=document.defaultView.getComputedStyle(e,null);t=n?n[o]:null}return"auto"===t?null:t}function wt(n,o,t){var a=document.createElement(n);return a.className=o||"",t&&t.appendChild(a),a}function Mt(o){var e=o.parentNode;e&&e.removeChild(o)}function Bt(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function Ht(o){var e=o.parentNode;e&&e.lastChild!==o&&e.appendChild(o)}function Wt(o){var e=o.parentNode;e&&e.firstChild!==o&&e.insertBefore(o,e.firstChild)}function Ft(e,o){if(void 0!==e.classList)return e.classList.contains(o);var t=Gt(e);return 0a||n.target._simulatedClick&&!n._simulated?yo(n):void(Jo=t,o(n))}(t,d)}),a.addEventListener(r,t,!1)):"attachEvent"in a&&a.attachEvent("on"+r,t):re(a,t,e),a._leaflet_events=a._leaflet_events||{},a._leaflet_events[e]=t}function _o(a,r,t,s){var e=r+H(t)+(s?"_"+H(s):""),n=a._leaflet_events&&a._leaflet_events[e];return n?void(xt&&0===r.indexOf("touch")?function(n,o,t){var a=n["_leaflet_"+o+t];"touchstart"===o?n.removeEventListener(kt,a,!1):"touchmove"===o?n.removeEventListener(At,a,!1):"touchend"==o&&(n.removeEventListener(It,a,!1),n.removeEventListener(Ot,a,!1))}(a,r,e):!Lt||"dblclick"!==r||xt&&ht?"removeEventListener"in a?"mousewheel"===r?a.removeEventListener("onwheel"in a?"wheel":"mousewheel",n,!!zt&&{passive:!1}):a.removeEventListener("mouseenter"===r?"mouseover":"mouseleave"===r?"mouseout":r,n,!1):"detachEvent"in a&&a.detachEvent("on"+r,n):Pe(a,e),a._leaflet_events[e]=null):this}function mo(t){return t.stopPropagation?t.stopPropagation():t.originalEvent?t.originalEvent._stopped=!0:t.cancelBubble=!0,xo(t),this}function co(t){return po(t,"mousewheel",mo),this}function uo(t){return so(t,"mousedown touchstart dblclick",mo),po(t,"click",vo),this}function go(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this}function yo(t){return go(t),mo(t),this}function ho(n,o){if(!o)return new y(n.clientX,n.clientY);var t=ro(o),a=t.boundingClientRect;return new y((n.clientX-a.left)/t.x-o.clientLeft,(n.clientY-a.top)/t.y-o.clientTop)}function fo(t){return it?t.wheelDeltaY/2:t.deltaY&&0===t.deltaMode?-t.deltaY/$o:t.deltaY&&1===t.deltaMode?20*-t.deltaY:t.deltaY&&2===t.deltaMode?60*-t.deltaY:t.deltaX||t.deltaZ?0:t.wheelDelta?(t.wheelDeltaY||t.wheelDelta)/2:t.detail&&32765>Math.abs(t.detail)?20*-t.detail:t.detail?60*(t.detail/-32765):0}function vo(t){ln[t.type]=!0}function xo(o){var e=ln[o.type];return ln[o.type]=!1,e}function Po(e,o){var t=o.relatedTarget;if(!t)return!0;try{for(;t&&t!==e;)t=t.parentNode}catch(t){return!1}return t!==e}function ko(t){return new kn(t)}function bo(e,t){if(!t||!e.length)return e.slice();var n=t*t;return e=function(o,a){var t=o.length,r=new("undefined"==typeof Uint8Array?Array:Uint8Array)(t);r[0]=r[t-1]=1,function a(r,t,l,e,n){var o,d,c,u=0;for(d=e+1;d<=n-1;d++)c=me(r[d],r[e],r[n],!0),uo.max.x&&(t|=2),e.yo.max.y&&(t|=8),t}function me(o,a,t,r){var e,s=a.x,l=a.y,d=t.x-s,u=t.y-l,h=d*d+u*u;return 0l;l++){for(c=h[l],a=[],r=0,s=(m=t.length)-1;r=this.min.x&&r.x<=this.max.x&&t.y>=this.min.y&&r.y<=this.max.y},intersects:function(t){t=w(t);var r=this.min,l=this.max,d=t.min,e=t.max,n=e.x>=r.x&&d.x<=l.x,o=e.y>=r.y&&d.y<=l.y;return n&&o},overlaps:function(t){t=w(t);var r=this.min,l=this.max,d=t.min,e=t.max,n=e.x>r.x&&d.xr.y&&d.y=d.lat&&o.lat<=l.lat&&t.lng>=d.lng&&o.lng<=l.lng},intersects:function(t){t=S(t);var r=this._southWest,l=this._northEast,d=t.getSouthWest(),e=t.getNorthEast(),n=e.lat>=r.lat&&d.lat<=l.lat,o=e.lng>=r.lng&&d.lng<=l.lng;return n&&o},overlaps:function(t){t=S(t);var r=this._southWest,l=this._northEast,d=t.getSouthWest(),e=t.getNorthEast(),n=e.lat>r.lat&&d.latr.lng&&d.lngst&&!("AudioNode"in window),at=!!window.opera,ht=N("chrome"),ut=N("gecko")&&!et&&!at&&!J,lt=!ht&&N("safari"),ct=N("phantom"),_t=("OTransition"in X),dt=0===navigator.platform.indexOf("Win"),pt=J&&"transition"in X,mt="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!ot,ft=("MozPerspective"in X),gt=!window.L_DISABLE_3D&&(pt||mt||ft)&&!_t&&!ct,vt="undefined"!=typeof orientation||N("mobile"),yt=!window.PointerEvent&&window.MSPointerEvent,xt=!et&&(window.PointerEvent||yt),Lt=!window.L_NO_TOUCH&&(xt||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch),bt=vt&&at,Tt=1<(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI),zt=function(){var t=!1;try{var n=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassiveEventSupport",Y,n),window.removeEventListener("testPassiveEventSupport",Y,n)}catch(t){}return t},Ct=!!document.createElement("canvas").getContext,Et=document.createElementNS&&R("svg").createSVGRect,St=!Et&&function(){try{var o=document.createElement("div");o.innerHTML="";var e=o.firstChild;return e.style.behavior="url(#default#VML)",e&&"object"==typeof e.adj}catch(t){return!1}}(),Zt=(Object.freeze||Object)({ie:J,ielt9:tt,edge:it,webkit:et,android:nt,android23:ot,androidStock:rt,opera:at,chrome:ht,gecko:ut,safari:lt,phantom:ct,opera12:_t,win:dt,ie3d:pt,webkit3d:mt,gecko3d:ft,any3d:gt,mobile:vt,mobileWebkit:vt&&et,mobileWebkit3d:vt&&mt,msPointer:yt,pointer:xt,touch:Lt,mobileOpera:bt,mobileGecko:vt&&ut,retina:Tt,passiveEvents:zt,canvas:Ct,svg:Et,vml:St}),kt=yt?"MSPointerDown":"pointerdown",At=yt?"MSPointerMove":"pointermove",It=yt?"MSPointerUp":"pointerup",Ot=yt?"MSPointerCancel":"pointercancel",Rt=["INPUT","SELECT","OPTION"],Nt={},Dt=!1,Cn=0,An=yt?"MSPointerDown":xt?"pointerdown":"touchstart",Ko=yt?"MSPointerUp":xt?"pointerup":"touchend",Kt=Jt(["transform","webkitTransform","OTransform","MozTransform","msTransform"]),Yt=Jt(["webkitTransition","transition","OTransition","MozTransition","msTransition"]),Yo="webkitTransition"===Yt||"OTransition"===Yt?Yt+"End":"transitionend";if("onselectstart"in document)Bo=function(){so(window,"selectstart",go)},Oo=function(){lo(window,"selectstart",go)};else{var Xo=Jt(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);Bo=function(){if(Xo){var t=document.documentElement.style;Ro=t[Xo],t[Xo]="none"}},Oo=function(){Xo&&(document.documentElement.style[Xo]=Ro,Ro=void 0)}}var Jo,Mn=(Object.freeze||Object)({TRANSFORM:Kt,TRANSITION:Yt,TRANSITION_END:Yo,get:Qe,getStyle:Pt,create:wt,remove:Mt,empty:Bt,toFront:Ht,toBack:Wt,hasClass:Ft,addClass:qt,removeClass:Vt,setClass:Ut,getClass:Gt,setOpacity:Xt,testProp:Jt,setTransform:Qt,setPosition:$t,getPosition:eo,disableTextSelection:Bo,enableTextSelection:Oo,disableImageDrag:to,enableImageDrag:oo,preventOutline:no,restoreOutline:ao,getSizedParentNode:io,getScale:ro}),$o=dt&&ht?2*window.devicePixelRatio:ut?window.devicePixelRatio:1,ln={},pn=(Object.freeze||Object)({on:so,off:lo,stopPropagation:mo,disableScrollPropagation:co,disableClickPropagation:uo,preventDefault:go,stop:yo,getMousePosition:ho,getWheelDelta:fo,fakeStop:vo,skipped:xo,isExternalTarget:Po,addListener:so,removeListener:lo}),yn=E.extend({run:function(n,o,t,a){this.stop(),this._el=n,this._inProgress=!0,this._duration=t||.25,this._easeOutPower=1/Math.max(a||.5,.2),this._startPos=eo(n),this._offset=o.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=ae(this._animate,this),this._step()},_step:function(e){var o=+new Date-this._startTime,t=1e3*this._duration;ot?-18:Math.log(t)}function n(t){return(Math.exp(t)-Math.exp(-t))/2}function T(t){return(Math.exp(t)+Math.exp(-t))/2}function e(e){return f*(T(c)*function(e){return n(e)/T(e)}(c+u*e)-n(c))/l}if(!1===(t=t||{}).animate||!gt)return this.setView(y,b,t);this._stop();var d=this.project(this.getCenter()),p=this.project(y),s=this.getSize(),r=this._zoom;y=M(y),b=void 0===b?r:b;var f=Math.max(s.x,s.y),a=f*this.getZoomScale(r,b),h=p.distanceTo(d)||1,u=1.42,l=u*u,c=o(0),_=Date.now(),m=(o(1)-c)/u,g=t.duration?1e3*t.duration:.8*(1e3*m);return this._moveStart(!0,t.noMoveStart),function a(){var o=(Date.now()-_)/g,t=function(t){return 1-Math.pow(1-t,1.5)}(o)*m;1>=o?(this._flyToFrame=ae(a,this),this._move(this.unproject(d.add(p.subtract(d).multiplyBy(e(t)/h)),r),this.getScaleZoom(f/function(t){return f*(T(c)/T(c+u*t))}(t),r),{flyTo:!0})):this._move(y,b)._moveEnd(!0)}.call(this),this},flyToBounds:function(e,o){var t=this._getBoundsCenterZoom(e,o);return this.flyTo(t.center,t.zoom,o)},setMaxBounds:function(t){return(t=S(t)).isValid()?(this.options.maxBounds&&this.off("moveend",this._panInsideMaxBounds),this.options.maxBounds=t,this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds)):(this.options.maxBounds=null,this.off("moveend",this._panInsideMaxBounds))},setMinZoom:function(o){var e=this.options.minZoom;return this.options.minZoom=o,this._loaded&&e!==o&&(this.fire("zoomlevelschange"),this.getZoom()this.options.maxZoom)?this.setZoom(o):this},panInsideBounds:function(n,o){this._enforcingBounds=!0;var t=this.getCenter(),a=this._limitCenter(t,this._zoom,S(n));return t.equals(a)||this.panTo(a,o),this._enforcingBounds=!1,this},panInside:function(c,d){var u=b((d=d||{}).paddingTopLeft||d.padding||[0,0]),p=b(d.paddingBottomRight||d.padding||[0,0]),e=this.getCenter(),n=this.project(e),o=this.project(c),s=this.getPixelBounds(),r=s.getSize().divideBy(2),a=w([s.min.add(u),s.max.subtract(p)]);if(!a.contains(o)){this._enforcingBounds=!0;var _=n.subtract(o),m=b(o.x+_.x,o.y+_.y);(o.xa.max.x)&&(m.x=n.x-_.x,0<_.x?m.x+=r.x-u.x:m.x-=r.x-p.x),(o.ya.max.y)&&(m.y=n.y-_.y,0<_.y?m.y+=r.y-u.y:m.y-=r.y-p.y),this.panTo(this.unproject(m),d),this._enforcingBounds=!1}return this},invalidateSize:function(t){if(!this._loaded)return this;t=v({animate:!1,pan:!0},!0===t?{animate:!0}:t);var s=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var r=this.getSize(),l=s.divideBy(2).round(),e=r.divideBy(2).round(),n=l.subtract(e);return n.x||n.y?(t.animate&&t.pan?this.panBy(n):(t.pan&&this._rawPanBy(n),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(h(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:s,newSize:r})):this},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire("viewreset"),this._stop()},locate:function(e){if(e=this._locateOptions=v({timeout:1e4,watch:!1},e),!("geolocation"in navigator))return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var t=h(this._handleGeolocationResponse,this),n=h(this._handleGeolocationError,this);return e.watch?this._locationWatchId=navigator.geolocation.watchPosition(t,n,e):navigator.geolocation.getCurrentPosition(t,n,e),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(e){var o=e.code,t=e.message||(1===o?"permission denied":2===o?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:o,message:"Geolocation error: "+t+"."})},_handleGeolocationResponse:function(r){var a=new I(r.coords.latitude,r.coords.longitude),t=a.toBounds(2*r.coords.accuracy),l=this._locateOptions;if(l.setView){var e=this.getBoundsZoom(t);this.setView(a,l.maxZoom?Math.min(e,l.maxZoom):e)}var n={latlng:a,bounds:t,timestamp:r.timestamp};for(var o in r.coords)"number"==typeof r.coords[o]&&(n[o]=r.coords[o]);this.fire("locationfound",n)},addHandler:function(e,o){if(!o)return this;var t=this[e]=new o(this);return this._handlers.push(t),this.options[e]&&t.enable(),this},remove:function(){if(this._initEvents(!0),this._containerId!==this._container._leaflet_id)throw new Error("Map container is being reused by another instance");try{delete this._container._leaflet_id,delete this._containerId}catch(t){this._container._leaflet_id=void 0,this._containerId=void 0}for(var t in void 0!==this._locationWatchId&&this.stopLocate(),this._stop(),Mt(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&(p(this._resizeRequest),this._resizeRequest=null),this._clearHandlers(),this._loaded&&this.fire("unload"),this._layers)this._layers[t].remove();for(t in this._panes)Mt(this._panes[t]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(e,o){var t=wt("div","leaflet-pane"+(e?" leaflet-"+e.replace("Pane","")+"-pane":""),o||this._mapPane);return e&&(this._panes[e]=t),t},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds();return new g(this.unproject(t.getBottomLeft()),this.unproject(t.getTopRight()))},getMinZoom:function(){return void 0===this.options.minZoom?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return void 0===this.options.maxZoom?void 0===this._layersMaxZoom?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(e,t,n){e=S(e),n=b(n||[0,0]);var d=this.getZoom()||0,m=this.getMinZoom(),f=this.getMaxZoom(),o=e.getNorthWest(),s=e.getSouthEast(),r=this.getSize().subtract(n),a=w(this.project(s,d),this.project(o,d)).getSize(),h=gt?this.options.zoomSnap:1,u=r.x/a.x,l=r.y/a.y,c=t?Math.max(u,l):Math.min(u,l);return d=this.getScaleZoom(c,d),h&&(d=Math.round(d/(h/100))*(h/100),d=t?Math.ceil(d/h)*h:Math.floor(d/h)*h),Math.max(m,Math.min(f,d))},getSize:function(){return this._size&&!this._sizeChanged||(this._size=new y(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(e,o){var t=this._getTopLeftPoint(e,o);return new C(t,t.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(t){return this.options.crs.getProjectedBounds(void 0===t?this.getZoom():t)},getPane:function(t){return"string"==typeof t?this._panes[t]:t},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(e,o){var a=this.options.crs;return o=void 0===o?this._zoom:o,a.scale(e)/a.scale(o)},getScaleZoom:function(n,o){var r=this.options.crs;o=void 0===o?this._zoom:o;var a=r.zoom(n*r.scale(o));return isNaN(a)?1/0:a},project:function(o,e){return e=void 0===e?this._zoom:e,this.options.crs.latLngToPoint(M(o),e)},unproject:function(o,e){return e=void 0===e?this._zoom:e,this.options.crs.pointToLatLng(b(o),e)},layerPointToLatLng:function(o){var e=b(o).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){return this.project(M(t))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(t){return this.options.crs.wrapLatLng(M(t))},wrapLatLngBounds:function(t){return this.options.crs.wrapLatLngBounds(S(t))},distance:function(o,e){return this.options.crs.distance(M(o),M(e))},containerPointToLayerPoint:function(t){return b(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return b(t).add(this._getMapPanePos())},containerPointToLatLng:function(o){var e=this.containerPointToLayerPoint(b(o));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(M(t)))},mouseEventToContainerPoint:function(t){return ho(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(o){var e=this._container=Qe(o);if(!e)throw new Error("Map container not found.");if(e._leaflet_id)throw new Error("Map container is already initialized.");so(e,"scroll",this._onScroll,this),this._containerId=H(e)},_initLayout:function(){var o=this._container;this._fadeAnimated=this.options.fadeAnimation&>,qt(o,"leaflet-container"+(Lt?" leaflet-touch":"")+(Tt?" leaflet-retina":"")+(tt?" leaflet-oldie":"")+(lt?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var e=Pt(o,"position");"absolute"!==e&&"relative"!==e&&"fixed"!==e&&(o.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._paneRenderers={},this._mapPane=this.createPane("mapPane",this._container),$t(this._mapPane,new y(0,0)),this.createPane("tilePane"),this.createPane("shadowPane"),this.createPane("overlayPane"),this.createPane("markerPane"),this.createPane("tooltipPane"),this.createPane("popupPane"),this.options.markerZoomAnimation||(qt(t.markerPane,"leaflet-zoom-hide"),qt(t.shadowPane,"leaflet-zoom-hide"))},_resetView:function(n,o){$t(this._mapPane,new y(0,0));var r=!this._loaded;this._loaded=!0,o=this._limitZoom(o),this.fire("viewprereset");var a=this._zoom!==o;this._moveStart(a,!1)._move(n,o)._moveEnd(a),this.fire("viewreset"),r&&this.fire("load")},_moveStart:function(o,e){return o&&this.fire("zoomstart"),e||this.fire("movestart"),this},_move:function(n,o,r){void 0===o&&(o=this._zoom);var a=this._zoom!==o;return this._zoom=o,this._lastCenter=n,this._pixelOrigin=this._getNewPixelOrigin(n),(a||r&&r.pinch)&&this.fire("zoom",r),this.fire("move",r)},_moveEnd:function(t){return t&&this.fire("zoomend"),this.fire("moveend")},_stop:function(){return p(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(t){$t(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(o){this._targets={};var e=o?lo:so;e((this._targets[H(this._container)]=this)._container,"click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this),this.options.trackResize&&e(window,"resize",this._onResize,this),gt&&this.options.transform3DLimit&&(o?this.off:this.on).call(this,"moveend",this._onMoveEnd)},_onResize:function(){p(this._resizeRequest),this._resizeRequest=ae(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var t=this._getMapPanePos();Math.max(Math.abs(t.x),Math.abs(t.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(e,n){for(var t,a=[],r="mouseout"===n||"mouseover"===n,s=e.target||e.srcElement,l=!1;s;){if((t=this._targets[H(s)])&&("click"===n||"preclick"===n)&&!e._simulated&&this._draggableMoved(t)){l=!0;break}if(t&&t.listens(n,!0)){if(r&&!Po(s,e))break;if(a.push(t),r)break}if(s===this._container)break;s=s.parentNode}return a.length||l||r||!Po(s,e)||(a=[this]),a},_handleDOMEvent:function(o){if(this._loaded&&!xo(o)){var e=o.type;"mousedown"!==e&&"keypress"!==e&&"keyup"!==e&&"keydown"!==e||no(o.target||o.srcElement),this._fireDOMEvent(o,e)}},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(e,t,a){if("click"===e.type){var l=v({},e);l.type="preclick",this._fireDOMEvent(l,l.type,a)}if(!e._stopped&&(a=(a||[]).concat(this._findEventTargets(e,t))).length){var d=a[0];"contextmenu"===t&&d.listens(t,!0)&&go(e);var n={originalEvent:e};if("keypress"!==e.type&&"keydown"!==e.type&&"keyup"!==e.type){var o=d.getLatLng&&(!d._radius||10>=d._radius);n.containerPoint=o?this.latLngToContainerPoint(d.getLatLng()):this.mouseEventToContainerPoint(e),n.layerPoint=this.containerPointToLayerPoint(n.containerPoint),n.latlng=o?d.getLatLng():this.layerPointToLatLng(n.layerPoint)}for(var s=0;sthis.options.zoomAnimationThreshold)return!1;var a=this.getZoomScale(o),s=this._getCenterOffset(e)._divideBy(1-1/a);return(!0===t.animate||this.getSize().contains(s))&&(ae(function(){this._moveStart(!0,!1)._animateZoom(e,o,!0)},this),!0)},_animateZoom:function(n,o,t,a){this._mapPane&&(t&&(this._animatingZoom=!0,this._animateToCenter=n,this._animateToZoom=o,qt(this._mapPane,"leaflet-zoom-anim")),this.fire("zoomanim",{center:n,zoom:o,noUpdate:a}),setTimeout(h(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&Vt(this._mapPane,"leaflet-zoom-anim"),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom),ae(function(){this._moveEnd(!0)},this))}}),kn=c.extend({options:{position:"topright"},initialize:function(t){l(this,t)},getPosition:function(){return this.options.position},setPosition:function(o){var e=this._map;return e&&e.removeControl(this),this.options.position=o,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(n){this.remove(),this._map=n;var o=this._container=this.onAdd(n),t=this.getPosition(),a=n._controlCorners[t];return qt(o,"leaflet-control"),-1===t.indexOf("bottom")?a.appendChild(o):a.insertBefore(o,a.firstChild),this._map.on("unload",this.remove,this),this},remove:function(){return this._map&&(Mt(this._container),this.onRemove&&this.onRemove(this._map),this._map.off("unload",this.remove,this),this._map=null),this},_refocusOnMap:function(t){this._map&&t&&0",a=document.createElement("div");return a.innerHTML=t,a.firstChild},_addItem:function(a){var r,s=document.createElement("label"),l=this._map.hasLayer(a.layer);a.overlay?((r=document.createElement("input")).type="checkbox",r.className="leaflet-control-layers-selector",r.defaultChecked=l):r=this._createRadioElement("leaflet-base-layers_"+H(this),l),this._layerControlInputs.push(r),r.layerId=H(a.layer),so(r,"click",this._onInputClick,this);var e=document.createElement("span");e.innerHTML=" "+a.name;var n=document.createElement("div");return s.appendChild(n),n.appendChild(r),n.appendChild(e),(a.overlay?this._overlaysList:this._baseLayersList).appendChild(s),this._checkDisabledLayers(),s},_onInputClick:function(){var t,s,d=this._layerControlInputs,l=[],e=[];this._handlingClick=!0;for(var n=d.length-1;0<=n;n--)t=d[n],s=this._getLayer(t.layerId).layer,t.checked?l.push(s):t.checked||e.push(s);for(n=0;no.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}}),te=kn.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"−",zoomOutTitle:"Zoom out"},onAdd:function(n){var o=wt("div","leaflet-control-zoom leaflet-bar"),t=this.options;return this._zoomInButton=this._createButton(t.zoomInText,t.zoomInTitle,"leaflet-control-zoom-in",o,this._zoomIn),this._zoomOutButton=this._createButton(t.zoomOutText,t.zoomOutTitle,"leaflet-control-zoom-out",o,this._zoomOut),this._updateDisabled(),n.on("zoomend zoomlevelschange",this._updateDisabled,this),o},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(t){!this._disabled&&this._map._zoomthis._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(t.shiftKey?3:1))},_createButton:function(s,a,t,r,e){var n=wt("a",t,r);return n.innerHTML=s,n.href="#",n.title=a,n.setAttribute("role","button"),n.setAttribute("aria-label",a),uo(n),so(n,"click",yo),so(n,"click",e,this),so(n,"click",this._refocusOnMap,this),n},_updateDisabled:function(){var t=this._map;Vt(this._zoomInButton,"leaflet-disabled"),Vt(this._zoomOutButton,"leaflet-disabled"),(this._disabled||t._zoom===t.getMinZoom())&&qt(this._zoomOutButton,"leaflet-disabled"),(this._disabled||t._zoom===t.getMaxZoom())&&qt(this._zoomInButton,"leaflet-disabled")}});fn.mergeOptions({zoomControl:!0}),fn.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new te,this.addControl(this.zoomControl))});var ie=kn.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0},onAdd:function(n){var o=wt("div","leaflet-control-scale"),t=this.options;return this._addScales(t,"leaflet-control-scale-line",o),n.on(t.updateWhenIdle?"moveend":"move",this._update,this),n.whenReady(this._update,this),o},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(e,o,t){e.metric&&(this._mScale=wt("div",o,t)),e.imperial&&(this._iScale=wt("div",o,t))},_update:function(){var e=this._map,o=e.getSize().y/2,t=e.distance(e.containerPointToLatLng([0,o]),e.containerPointToLatLng([this.options.maxWidth,o]));this._updateScales(t)},_updateScales:function(t){this.options.metric&&t&&this._updateMetric(t),this.options.imperial&&t&&this._updateImperial(t)},_updateMetric:function(e){var o=this._getRoundNum(e),t=1e3>o?o+" m":o/1e3+" km";this._updateScale(this._mScale,t,o/e)},_updateImperial:function(e){var o,n,a,d=3.2808399*e;5280Leaflet"},initialize:function(t){l(this,t),this._attributions={}},onAdd:function(o){for(var e in(o.attributionControl=this)._container=wt("div","leaflet-control-attribution"),uo(this._container),o._layers)o._layers[e].getAttribution&&this.addAttribution(o._layers[e].getAttribution());return this._update(),this._container},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t&&(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update()),this},removeAttribution:function(t){return t&&this._attributions[t]&&(this._attributions[t]--,this._update()),this},_update:function(){if(this._map){var e=[];for(var o in this._attributions)this._attributions[o]&&e.push(o);var t=[];this.options.prefix&&t.push(this.options.prefix),e.length&&t.push(e.join(", ")),this._container.innerHTML=t.join(" | ")}}});fn.mergeOptions({attributionControl:!0}),fn.addInitHook(function(){this.options.attributionControl&&new ee().addTo(this)}),kn.Layers=Sn,kn.Zoom=te,kn.Scale=ie,kn.Attribution=ee,ko.layers=function(e,o,t){return new Sn(e,o,t)},ko.zoom=function(t){return new te(t)},ko.scale=function(t){return new ie(t)},ko.attribution=function(t){return new ee(t)};var ne=c.extend({initialize:function(t){this._map=t},enable:function(){return this._enabled||(this._enabled=!0,this.addHooks()),this},disable:function(){return this._enabled&&(this._enabled=!1,this.removeHooks()),this},enabled:function(){return!!this._enabled}});ne.addTo=function(o,e){return o.addHandler(e,this),this};var oe,Bn,On=Lt?"touchstart mousedown":"mousedown",En={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},he={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"},ue=E.extend({options:{clickTolerance:3},initialize:function(n,o,t,a){l(this,a),this._element=n,this._dragStartTarget=o||n,this._preventOutline=t},enable:function(){this._enabled||(so(this._dragStartTarget,On,this._onDown,this),this._enabled=!0)},disable:function(){this._enabled&&(ue._dragging===this&&this.finishDrag(),lo(this._dragStartTarget,On,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(e){if(!e._simulated&&this._enabled&&(this._moved=!1,!Ft(this._element,"leaflet-zoom-anim")&&!(ue._dragging||e.shiftKey||1!==e.which&&1!==e.button&&!e.touches||((ue._dragging=this)._preventOutline&&no(this._element),to(),Bo(),this._moving)))){this.fire("down");var o=e.touches?e.touches[0]:e,t=io(this._element);this._startPoint=new y(o.clientX,o.clientY),this._parentScale=ro(t),so(document,he[e.type],this._onMove,this),so(document,En[e.type],this._onUp,this)}},_onMove:function(e){if(!e._simulated&&this._enabled)if(e.touches&&1c&&1e-7this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),void 0===this.options.minZoom&&this._layersMinZoom&&this.getZoom()n.opacity&&this._updateOpacity(),r&&this.getPane().appendChild(this._icon),this._initInteraction(),s&&l&&this.getPane(n.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),Mt(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&Mt(this._shadow),this._shadow=null},_setPos:function(t){this._icon&&$t(this._icon,t),this._shadow&&$t(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon&&(this._icon.style.zIndex=this._zIndex+t)},_animateZoom:function(o){var e=this._map._latLngToNewLayerPoint(this._latlng,o.zoom,o.center).round();this._setPos(e)},_initInteraction:function(){if(this.options.interactive&&(qt(this._icon,"leaflet-interactive"),this.addInteractiveTarget(this._icon),Be)){var t=this.options.draggable;this.dragging&&(t=this.dragging.enabled(),this.dragging.disable()),this.dragging=new Be(this),t&&this.dragging.enable()}},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var t=this.options.opacity;this._icon&&Xt(this._icon,t),this._shadow&&Xt(this._shadow,t)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}}),Ie=Ce.extend({options:{stroke:!0,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(t){this._renderer=t.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(t){return l(this,t),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&t&&t.hasOwnProperty("weight")&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+this._renderer.options.tolerance}}),Oe=Ie.extend({options:{fill:!0,radius:10},initialize:function(o,e){l(this,e),this._latlng=M(o),this._radius=this.options.radius},setLatLng:function(o){var e=this._latlng;return this._latlng=M(o),this.redraw(),this.fire("move",{oldLatLng:e,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(t){return this.options.radius=this._radius=t,this.redraw()},getRadius:function(){return this._radius},setStyle:function(o){var e=o&&o.radius||this._radius;return Ie.prototype.setStyle.call(this,o),this.setRadius(e),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var n=this._radius,o=this._radiusY||n,t=this._clickTolerance(),a=[n+t,o+t];this._pxBounds=new C(this._point.subtract(a),this._point.add(a))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(t){return t.distanceTo(this._point)<=this._radius+this._clickTolerance()}}),Re=Oe.extend({initialize:function(e,o,a){if("number"==typeof o&&(o=v({},a,{radius:o})),l(this,o),this._latlng=M(e),isNaN(this.options.radius))throw new Error("Circle radius cannot be NaN");this._mRadius=this.options.radius},setRadius:function(t){return this._mRadius=t,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var t=[this._radius,this._radiusY||this._radius];return new g(this._map.layerPointToLatLng(this._point.subtract(t)),this._map.layerPointToLatLng(this._point.add(t)))},setStyle:Ie.prototype.setStyle,_project:function(){var l=this._latlng.lng,d=this._latlng.lat,t=this._map,p=t.options.crs;if(p.distance===Mo.distance){var e=Math.PI/180,n=this._mRadius/Mo.R/e,o=t.project([d+n,l]),s=t.project([d-n,l]),r=o.add(s).divideBy(2),a=t.unproject(r).lat,_=Math.acos((Math.cos(n*e)-Math.sin(d*e)*Math.sin(a*e))/(Math.cos(d*e)*Math.cos(a*e)))/e;(isNaN(_)||0===_)&&(_=n/Math.cos(Math.PI/180*d)),this._point=r.subtract(t.getPixelOrigin()),this._radius=isNaN(_)?0:r.x-t.project([a,l-_]).x,this._radiusY=r.y-o.y}else{var c=p.unproject(p.project(this._latlng).subtract([this._mRadius,0]));this._point=t.latLngToLayerPoint(this._latlng),this._radius=this._point.x-t.latLngToLayerPoint(c).x}this._updateBounds()}}),Ne=Ie.extend({options:{smoothFactor:1,noClip:!1},initialize:function(o,e){l(this,e),this._setLatLngs(o)},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._setLatLngs(t),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(e){for(var o,n,r=1/0,l=null,d=me,c=0,u=this._parts.length;ce.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(v=!v);return v||Ne.prototype._containsPoint.call(this,e,!0)}}),je=Se.extend({initialize:function(o,e){l(this,e),this._layers={},o&&this.addData(o)},addData:function(e){var n,a,r,_=Ao(e)?e:e.features;if(_){for(n=0,a=_.length;nthis.options.opacity&&this._updateOpacity()),this.options.interactive&&(qt(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Mt(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&Ht(this._image),this},bringToBack:function(){return this._map&&Wt(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=S(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var o="IMG"===this._url.tagName,e=this._image=o?this._url:wt("img");qt(e,"leaflet-image-layer"),this._zoomAnimated&&qt(e,"leaflet-zoom-animated"),this.options.className&&qt(e,this.options.className),e.onselectstart=Y,e.onmousemove=Y,e.onload=h(this.fire,this,"load"),e.onerror=h(this._overlayOnError,this,"error"),(this.options.crossOrigin||""===this.options.crossOrigin)&&(e.crossOrigin=!0===this.options.crossOrigin?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),o?this._url=e.src:(e.src=this._url,e.alt=this.options.alt)},_animateZoom:function(e){var o=this._map.getZoomScale(e.zoom),t=this._map._latLngBoundsToNewLayerBounds(this._bounds,e.zoom,e.center).min;Qt(this._image,t,o)},_reset:function(){var e=this._image,o=new C(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),t=o.getSize();$t(e,o.min),e.style.width=t.x+"px",e.style.height=t.y+"px"},_updateOpacity:function(){Xt(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)}}),Je=He.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0},_initImage:function(){var o="VIDEO"===this._url.tagName,a=this._image=o?this._url:wt("video");if(qt(a,"leaflet-image-layer"),this._zoomAnimated&&qt(a,"leaflet-zoom-animated"),this.options.className&&qt(a,this.options.className),a.onselectstart=Y,a.onmousemove=Y,a.onloadeddata=h(this.fire,this,"load"),o){for(var t=a.getElementsByTagName("source"),r=[],e=0;ea.x&&(_=n.x+p-a.x+r.x),0>n.x-_-s.x&&(_=n.x-s.x),n.y+t+r.y>a.y&&(c=n.y+t-a.y+r.y),0>n.y-c-s.y&&(c=n.y-s.y),(_||c)&&l.fire("autopanstart").panBy([_,c])}},_onCloseButtonClick:function(t){this._close(),yo(t)},_getAnchor:function(){return b(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}});fn.mergeOptions({closePopupOnClick:!0}),fn.include({openPopup:function(e,t,n){return e instanceof nn||(e=new nn(n).setContent(e)),t&&e.setLatLng(t),this.hasLayer(e)?this:(this._popup&&this._popup.options.autoClose&&this.closePopup(),this._popup=e,this.addLayer(e))},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&this.removeLayer(t),this}}),Ce.include({bindPopup:function(o,e){return o instanceof nn?(l(o,e),(this._popup=o)._source=this):(this._popup&&!e||(this._popup=new nn(e,this)),this._popup.setContent(o)),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(o,e){return this._popup&&this._map&&(e=this._popup._prepareOpen(this,o,e),this._map.openPopup(this._popup,e)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(t){return this._popup&&(this._popup._map?this.closePopup():this.openPopup(t)),this},isPopupOpen:function(){return!!this._popup&&this._popup.isOpen()},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(o){var e=o.layer||o.target;this._popup&&this._map&&(yo(o),e instanceof Ie?this.openPopup(o.layer||o.target,o.latlng):this._map.hasLayer(this._popup)&&this._popup._source===e?this.closePopup():this.openPopup(e,o.latlng))},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){13===t.originalEvent.keyCode&&this._openPopup(t)}});var on=en.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,interactive:!1,opacity:.9},onAdd:function(t){en.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&this._source.fire("tooltipopen",{tooltip:this},!0)},onRemove:function(t){en.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&this._source.fire("tooltipclose",{tooltip:this},!0)},getEvents:function(){var t=en.prototype.getEvents.call(this);return Lt&&!this.options.permanent&&(t.preclick=this._close),t},_close:function(){this._map&&this._map.closeTooltip(this)},_initLayout:function(){var t="leaflet-tooltip "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=wt("div",t)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var s=this._map,d=this._container,p=s.latLngToContainerPoint(s.getCenter()),e=s.layerPointToContainerPoint(t),n=this.options.direction,c=d.offsetWidth,_=d.offsetHeight,r=b(this.options.offset),a=this._getAnchor();t="top"===n?t.add(b(-c/2+r.x,-_+r.y+a.y,!0)):"bottom"===n?t.subtract(b(c/2-r.x,-r.y,!0)):"center"===n?t.subtract(b(c/2+r.x,_/2-a.y+r.y,!0)):"right"===n||"auto"===n&&e.xn?a=!0:(l.active?s=!0:this._onOpaqueTile(l),l.active=!0)}}s&&!this._noPrune&&this._pruneTiles(),a&&(p(this._fadeFrame),this._fadeFrame=ae(this._updateOpacity,this))}},_onOpaqueTile:Y,_initContainer:function(){this._container||(this._container=wt("div","leaflet-layer "+(this.options.className||"")),this._updateZIndex(),1>this.options.opacity&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var o=this._tileZoom,n=this.options.maxZoom;if(void 0!==o){for(var t in this._levels)this._levels[t].el.children.length||t===o?(this._levels[t].el.style.zIndex=n-Math.abs(o-t),this._onUpdateLevel(t)):(Mt(this._levels[t].el),this._removeTilesAtZoom(t),this._onRemoveLevel(t),delete this._levels[t]);var a=this._levels[o],r=this._map;return a||((a=this._levels[o]={}).el=wt("div","leaflet-tile-container leaflet-zoom-animated",this._container),a.el.style.zIndex=n,a.origin=r.project(r.unproject(r.getPixelOrigin()),o).round(),a.zoom=o,this._setZoomTransform(a,r.getCenter(),r.getZoom()),a.el.offsetWidth,this._onCreateLevel(a)),this._level=a}},_onUpdateLevel:Y,_onRemoveLevel:Y,_onCreateLevel:Y,_pruneTiles:function(){if(this._map){var t,n,s=this._map.getZoom();if(s>this.options.maxZoom||sthis.options.maxZoom||void 0!==this.options.minZoom&&et.max.x)||!o.wrapLat&&(n.yt.max.y))return!1}if(!this.options.bounds)return!0;var a=this._tileCoordsToBounds(n);return S(this.options.bounds).overlaps(a)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(o){var a=this._map,t=this.getTileSize(),r=o.scaleBy(t),e=r.add(t);return[a.unproject(r,o.z),a.unproject(e,o.z)]},_tileCoordsToBounds:function(e){var o=this._tileCoordsToNwSe(e),t=new g(o[0],o[1]);return this.options.noWrap||(t=this._map.wrapLatLngBounds(t)),t},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(e){var o=e.split(":"),t=new y(+o[0],+o[1]);return t.z=+o[2],t},_removeTile:function(o){var e=this._tiles[o];e&&(Mt(e.el),delete this._tiles[o],this.fire("tileunload",{tile:e.el,coords:this._keyToTileCoords(o)}))},_initTile:function(o){qt(o,"leaflet-tile");var e=this.getTileSize();o.style.width=e.x+"px",o.style.height=e.y+"px",o.onselectstart=Y,o.onmousemove=Y,tt&&1>this.options.opacity&&Xt(o,this.options.opacity),nt&&!ot&&(o.style.WebkitBackfaceVisibility="hidden")},_addTile:function(o,a){var t=this._getTilePos(o),r=this._tileCoordsToKey(o),e=this.createTile(this._wrapCoords(o),h(this._tileReady,this,o));this._initTile(e),2>this.createTile.length&&ae(h(this._tileReady,this,o,null,e)),$t(e,t),this._tiles[r]={el:e,coords:o,current:!0},a.appendChild(e),this.fire("tileloadstart",{tile:e,coords:o})},_tileReady:function(e,o,t){o&&this.fire("tileerror",{error:o,tile:t,coords:e});var n=this._tileCoordsToKey(e);(t=this._tiles[n])&&(t.loaded=+new Date,this._map._fadeAnimated?(Xt(t.el,0),p(this._fadeFrame),this._fadeFrame=ae(this._updateOpacity,this)):(t.active=!0,this._pruneTiles()),o||(qt(t.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:t.el,coords:e})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),tt||!this._map._fadeAnimated?ae(this._pruneTiles,this):setTimeout(h(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(o){var e=new y(this._wrapX?V(o.x,this._wrapX):o.x,this._wrapY?V(o.y,this._wrapY):o.y);return e.z=o.z,e},_pxBoundsToTileRange:function(o){var e=this.getTileSize();return new C(o.min.unscaleBy(e).floor(),o.max.unscaleBy(e).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}}),an=rn.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1},initialize:function(o,e){this._url=o,(e=l(this,e)).detectRetina&&Tt&&0")}}catch(t){return function(t){return document.createElement("<"+t+" xmlns=\"urn:schemas-microsoft.com:vml\" class=\"lvml\">")}}}(),dn=St?_n:R,mn=un.extend({getEvents:function(){var t=un.prototype.getEvents.call(this);return t.zoomstart=this._onZoomStart,t},_initContainer:function(){this._container=dn("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=dn("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Mt(this._container),lo(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(!this._map._animatingZoom||!this._bounds){un.prototype._update.call(this);var e=this._bounds,o=e.getSize(),t=this._container;this._svgSize&&this._svgSize.equals(o)||(this._svgSize=o,t.setAttribute("width",o.x),t.setAttribute("height",o.y)),$t(t,e.min),t.setAttribute("viewBox",[e.min.x,e.min.y,o.x,o.y].join(" ")),this.fire("update")}},_initPath:function(o){var e=o._path=dn("path");o.options.className&&qt(e,o.options.className),o.options.interactive&&qt(e,"leaflet-interactive"),this._updateStyle(o),this._layers[H(o)]=o},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){Mt(t._path),t.removeInteractiveTarget(t._path),delete this._layers[H(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(e){var o=e._path,t=e.options;o&&(t.stroke?(o.setAttribute("stroke",t.color),o.setAttribute("stroke-opacity",t.opacity),o.setAttribute("stroke-width",t.weight),o.setAttribute("stroke-linecap",t.lineCap),o.setAttribute("stroke-linejoin",t.lineJoin),t.dashArray?o.setAttribute("stroke-dasharray",t.dashArray):o.removeAttribute("stroke-dasharray"),t.dashOffset?o.setAttribute("stroke-dashoffset",t.dashOffset):o.removeAttribute("stroke-dashoffset")):o.setAttribute("stroke","none"),t.fill?(o.setAttribute("fill",t.fillColor||t.color),o.setAttribute("fill-opacity",t.fillOpacity),o.setAttribute("fill-rule",t.fillRule||"evenodd")):o.setAttribute("fill","none"))},_updatePoly:function(o,e){this._setPath(o,D(o._parts,e))},_updateCircle:function(o){var a=o._point,t=Math.max(Math.round(o._radius),1),r="a"+t+","+(Math.max(Math.round(o._radiusY),1)||t)+" 0 1,0 ",e=o._empty()?"M0 0":"M"+(a.x-t)+","+a.y+r+2*t+",0 "+r+2*-t+",0 ";this._setPath(o,e)},_setPath:function(o,e){o._path.setAttribute("d",e)},_bringToFront:function(t){Ht(t._path)},_bringToBack:function(t){Wt(t._path)}});St&&mn.include({_initContainer:function(){this._container=wt("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(un.prototype._update.call(this),this.fire("update"))},_initPath:function(o){var e=o._container=_n("shape");qt(e,"leaflet-vml-shape "+(this.options.className||"")),e.coordsize="1 1",o._path=_n("path"),e.appendChild(o._path),this._updateStyle(o),this._layers[H(o)]=o},_addPath:function(o){var e=o._container;this._container.appendChild(e),o.options.interactive&&o.addInteractiveTarget(e)},_removePath:function(o){var e=o._container;Mt(e),o.removeInteractiveTarget(e),delete this._layers[H(o)]},_updateStyle:function(e){var o=e._stroke,a=e._fill,l=e.options,s=e._container;s.stroked=!!l.stroke,s.filled=!!l.fill,l.stroke?(o||(o=e._stroke=_n("stroke")),s.appendChild(o),o.weight=l.weight+"px",o.color=l.color,o.opacity=l.opacity,o.dashStyle=l.dashArray?Ao(l.dashArray)?l.dashArray.join(" "):l.dashArray.replace(/( *, *)/g," "):"",o.endcap=l.lineCap.replace("butt","flat"),o.joinstyle=l.lineJoin):o&&(s.removeChild(o),e._stroke=null),l.fill?(a||(a=e._fill=_n("fill")),s.appendChild(a),a.color=l.fillColor||l.color,a.opacity=l.fillOpacity):a&&(s.removeChild(a),e._fill=null)},_updateCircle:function(n){var o=n._point.round(),t=Math.round(n._radius),a=Math.round(n._radiusY||t);this._setPath(n,n._empty()?"M0 0":"AL "+o.x+","+o.y+" "+t+","+a+" 0,23592600")},_setPath:function(o,e){o._path.v=e},_bringToFront:function(t){Ht(t._container)},_bringToBack:function(t){Wt(t._container)}}),fn.include({getRenderer:function(o){var e=o.options.renderer||this._getPaneRenderer(o.options.pane)||this.options.renderer||this._renderer;return e||(e=this._renderer=this._createRenderer()),this.hasLayer(e)||this.addLayer(e),e},_getPaneRenderer:function(o){if("overlayPane"===o||void 0===o)return!1;var e=this._paneRenderers[o];return void 0===e&&(e=this._createRenderer({pane:o}),this._paneRenderers[o]=e),e},_createRenderer:function(t){return this.options.preferCanvas&&$e(t)||To(t)}});var gn=De.extend({initialize:function(o,e){De.prototype.initialize.call(this,this._boundsToLatLngs(o),e)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return[(t=S(t)).getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});mn.create=dn,mn.pointsToPath=D,je.geometryToLayer=ye,je.coordsToLatLng=Fe,je.coordsToLatLngs=Ue,je.latLngToCoords=Ve,je.latLngsToCoords=qe,je.getFeature=Ge,je.asFeature=Ke,fn.mergeOptions({boxZoom:!0});var vn=ne.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){so(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){lo(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Mt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){0!==this._resetStateTimeout&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){return!!(t.shiftKey&&(1===t.which||1===t.button))&&void(this._clearDeferredResetState(),this._resetState(),Bo(),to(),this._startPoint=this._map.mouseEventToContainerPoint(t),so(document,{contextmenu:yo,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this))},_onMouseMove:function(e){this._moved||(this._moved=!0,this._box=wt("div","leaflet-zoom-box",this._container),qt(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(e);var o=new C(this._point,this._startPoint),t=o.getSize();$t(this._box,o.min),this._box.style.width=t.x+"px",this._box.style.height=t.y+"px"},_finish:function(){this._moved&&(Mt(this._box),Vt(this._container,"leaflet-crosshair")),Oo(),oo(),lo(document,{contextmenu:yo,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(o){if((1===o.which||1===o.button)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(h(this._resetState,this),0);var e=new g(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(e).fire("boxzoomend",{boxZoomBounds:e})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}});fn.addInitHook("addHandler","boxZoom",vn),fn.mergeOptions({doubleClickZoom:!0});var xn=ne.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(o){var a=this._map,t=a.getZoom(),r=a.options.zoomDelta,e=o.originalEvent.shiftKey?t-r:t+r;"center"===a.options.doubleClickZoom?a.setZoom(e):a.setZoomAround(o.containerPoint,e)}});fn.addInitHook("addHandler","doubleClickZoom",xn),fn.mergeOptions({dragging:!0,inertia:!ot,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var wn=ne.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new ue(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}qt(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){Vt(this._map._container,"leaflet-grab"),Vt(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var o=this._map;if(o._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var e=S(this._map.options.maxBounds);this._offsetLimit=w(this._map.latLngToContainerPoint(e.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(e.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;o.fire("movestart").fire("dragstart"),o.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(e){if(this._map.options.inertia){var o=this._lastTime=+new Date,t=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(t),this._times.push(o),this._prunePositions(o)}this._map.fire("move",e).fire("drag",e)},_prunePositions:function(t){for(;1e.max.x&&(o.x=this._viscousLimit(o.x,e.max.x)),o.y>e.max.y&&(o.y=this._viscousLimit(o.y,e.max.y)),this._draggable._newPos=this._draggable._startPos.add(o)}},_onPreDragWrap:function(){var r=this._worldWidth,a=Math.round(r/2),t=this._initialWorldOffset,l=this._draggable._newPos.x,e=(l-a+t)%r+a-t,n=(l+a+t)%r-a-t,o=Math.abs(e+t)this._times.length;if(d.fire("dragend",_),p)d.fire("moveend");else{this._prunePositions(+new Date);var e=this._lastPos.subtract(this._positions[0]),n=(this._lastTime-this._times[0])/1e3,o=t.easeLinearity,s=e.multiplyBy(o/n),r=s.distanceTo([0,0]),a=Math.min(t.inertiaMaxSpeed,r),m=s.multiplyBy(a/r),u=a/(t.inertiaDeceleration*o),l=m.multiplyBy(-u/2).round();l.x||l.y?(l=d._limitOffset(l,d.options.maxBounds),ae(function(){d.panBy(l,{duration:u,easeLinearity:o,noMoveStart:!0,animate:!0})})):d.fire("moveend")}}});fn.addInitHook("addHandler","dragging",wn),fn.mergeOptions({keyboard:!0,keyboardPanDelta:80});var Pn=ne.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(t){this._map=t,this._setPanDelta(t.options.keyboardPanDelta),this._setZoomDelta(t.options.zoomDelta)},addHooks:function(){var t=this._map._container;0>=t.tabIndex&&(t.tabIndex="0"),so(t,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),lo(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var n=document.body,o=document.documentElement,t=n.scrollTop||o.scrollTop,a=n.scrollLeft||o.scrollLeft;this._map._container.focus(),window.scrollTo(a,t)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanDelta:function(e){var o,a,l=this._panKeys={},s=this.keyCodes;for(o=0,a=s.left.length;oe||this._zoom>a.getMaxZoom()&&1

${}

}" value=""> ${}
`; // Funkcja wyszukująca markery na mapie function runSearchPickup() { if (typeof mymap !== 'undefined') { mymap.eachLayer(function (layer) { if (layer._icon !== undefined) { mymap.removeLayer(layer); } }); leafletGetTextLocation(); } document.querySelector('.asideContainer_pickup').innerHTML = ''; } // Funkcja obsługująca dostawy z mapą function createEventsInpost(ITEM_ID) { const ITEM_FOR_MAP = '#item_' + ITEM_ID; const oscItem = document.querySelector(ITEM_FOR_MAP).closest('.osc_item'); document.querySelector(ITEM_FOR_MAP).addEventListener('click', function (e) { const deliveryValue = ITEM_FOR_MAP.slice(1); // Weź adres klienta do mapy(zalogowany lub niezalogowany: zwykly lub dostawa na inny adres) const clientStreet = getAddressInfo("street"); const clientZipCode = getAddressInfo("zipcode"); const clientCity = getAddressInfo("city"); // Jesli nie ma informacji potrzebnej do mapy, zapisz wiadomosc do errora let errorMessage = ""; if(!clientStreet) errorMessage += addAddressErrorForMap("street"); if(!clientZipCode) errorMessage += addAddressErrorForMap("zipcode"); if(!clientCity) errorMessage += addAddressErrorForMap("city"); // Zablokuj wybranie mapy jak nie ma adresu if(errorMessage !== ""){ Alertek.show_alert(errorMessage); const scrolledToElement = document.getElementById("deliver_to_billingaddr").checked ? document.getElementById("delivery_firstname") : document.getElementById("client_firstname"); scrollToHeight(scrolledToElement); e.target.checked = false; checkPrevShipping(); return false; } app_shop.vars.courierId = ITEM_ID; if (oscItem.querySelector('.finpost_loading')) oscItem.querySelector('.finpost_loading').style.display = "block"; // Pokaż/Wstaw mapę if (finpostjs){ document.getElementById("fbs_z02_cover").style.display = "block"; disablePageScroll(); } else { document.querySelector('body').insertAdjacentHTML("beforeend",htmlContent); disablePageScroll(); // Naprawienie searchu w leaflet(stackuja sie wyniki bez tego) document.getElementById("autocomplete_location").addEventListener("keyup", (e) => { const suggestions = document.querySelector(".leafleat-suggestions"); if(!suggestions) return; else suggestions.remove(); }); } // Wstaw adres klienta const searchField = document.getElementById("autocomplete_location"); searchField.value = `${clientStreet} ${clientZipCode} ${clientCity}`; // Zamknij popup document.getElementById("fbs_z02_close").addEventListener('click', closeMap); document.getElementById("fbs_z02_cover").addEventListener('click', function (e) { if (e.target.closest('#fbs_z02_wrapper')) return; closeMap(); }); // Zmiana miejsca przycisku "szukaj na tym obszarze" na mobile if (window.innerWidth < 757) document.getElementById("pickup_list_form").insertAdjacentElement("beforebegin",document.querySelector('.map_button_search')); if (!oscItem.querySelector('.fselectedPoint')) oscItem.insertAdjacentHTML("beforeend",``); // Wyszukiwanie punktów odbioru na mapie if (finpostjs) { pickup_sites.courierId = ITEM_ID; runSearchPickup(); } if (!finpostjs) { finpostjs = true; pickup_sites.courierId = ITEM_ID; runSearchPickup(); document.querySelector('#locationField .btn').click(); // Wybranie punktu i wstawienie go koło dostawy document.querySelector('.asideContainer_pickup').addEventListener("change", (e) => { if(e.target.type !== "radio") return; //Wyczyść poprzednie punkty odbioru clearSelectedPoints(); // Wybierz dobrą metode dostawy const courierId = document.querySelector(`#pickup_list_form .asideContainer_pickup label[data-id="${e.target.value}"]`).dataset.courierId; const prepaidValue = document.getElementById("payitem_cash").checked ? 0 : 1 const courierInput = document.querySelector(`#item_${courierId}-${prepaidValue}`); courierInput.checked = true; changeCurrentShippingInfo(courierInput); const selectedPoint = document.querySelector('[name="shipping"]:checked').closest('.osc_item').querySelector('.fselectedPoint'); selectedPoint.innerHTML = ""; // Utworzenie informacji o punkcie odbioru const deliveryId = document.querySelector('[name="pickup_point"]:checked').value; const chosenPoint = document.querySelector(`.asideContainer_pickup label[data-id="${deliveryId}"]`); const pickupName = chosenPoint.querySelector(".headerText").innerHTML; const streetName = chosenPoint.querySelector(".streetText").innerHTML; const cityName = chosenPoint.querySelector(".cityText").innerHTML; const zipCodeName = chosenPoint.querySelector(".zipcodePickup").innerHTML.slice(0, chosenPoint.querySelector(".zipcodePickup").innerHTML.search(" { if(!e.target.classList.contains("fbs02_btn")) return; closeMap(); }); } changeCurrentShippingInfo(e.target); }); } deliveryPickupPoints.forEach(point => createEventsInpost(point)); } // Zamknięcie mapy function closeMap(){ document.getElementById("fbs_z02_cover").style.display = "none"; enablePageScroll(); } // Zdobądź wartość adresu, kodu pocztowego i miasta function getAddressInfo(query){ if(document.getElementById("deliver_to_billingaddr").checked){ if(document.getElementById(`delivery_${query}`).value.trim()) return document.getElementById(`delivery_${query}`).value; }; return document.getElementById(`client_${query}`).value; } // Wiadomość errora, gdyby niebyło informacji adresowych przy otwieraniu mapy const addressErrorMessagesForMap = { "street": `${}`, "zipcode": `${}`, "city": `${}`, } function addAddressErrorForMap(query){ addErrorMessage(document.getElementById(`client_${query}`), addressErrorMessagesForMap[query]); return `${addressErrorMessagesForMap[query]}
`; } // Utworzenie informacji o punkcie odbioru function createPickuppointInfo(selectedPoint, deliveryPointId, name, streetText, cityText, zipcodeText, courierId){ // Pokazanie elementu fselectedPoint selectedPoint.style.display = "block"; // Wstawienie danych w punkt odbioru selectedPoint.dataset.courierId = courierId; selectedPoint.dataset.deliveryPointId = deliveryPointId; selectedPoint.dataset.name = name; selectedPoint.dataset.street = streetText; selectedPoint.dataset.city = cityText; selectedPoint.dataset.zipcode = zipcodeText; // Wstawienie danych o punkcie odbioru selectedPoint.insertAdjacentHTML("beforeend", ` `); } // Zmiana widoku listy, mapy na mobilce function toggleMapList(e){ const ifList = e.target.dataset.show === "list"; e.target.innerHTML = ifList ? "Pokaż Mapę" : "Pokaż Listę"; // Schowaj/ Pokaż mapę i listę if(ifList){ document.querySelector(".map_button_search").classList.add("--hide-map-el"); document.getElementById("mymap").classList.add("--hide-map-el"); document.querySelector(".asideContainer_pickup").classList.remove("--hide-map-el"); }else{ document.querySelector(".map_button_search").classList.remove("--hide-map-el"); document.getElementById("mymap").classList.remove("--hide-map-el"); document.querySelector(".asideContainer_pickup").classList.add("--hide-map-el"); } e.target.dataset.show = ifList ? "map" : "list"; } ////////////////////////////////////////////////////////////////////////// // DANE KLIENTA document.getElementById("bm-oscop-section1").addEventListener("click", (e) => { // Pokazanie się okna od logowania if(e.target.classList.contains("get_signin")) showSigninModal(); // Sprawdzenie czy kliknięcie było na "Załóź konto w sklepie Opcjonalnie" if(e.target.id === "register_client_checkbox"){ const registerForm = document.querySelector(".register__form"); if(e.target.checked) registerForm.classList.add("--fade-in"); else registerForm.classList.remove("--fade-in"); return; } // Ukrycie/Pokazanie hasła if(e.target.id === "toggle-password") return togglePassword(e.target); // Sprawdzenie czy kliknięcie było na firmę, czy na osobę prywatną if(e.target.id === "client_type1") return document.querySelectorAll("#bm-oscop-section1 .firm-group").forEach(el => el.classList.add("--fade-in")); if(e.target.id === "client_type2") return document.querySelectorAll("#bm-oscop-section1 .firm-group").forEach(el => el.classList.remove("--fade-in")); // Sprawdzenie czy dostawa na inny adres czy nie if(e.target.id === "deliver_to_billingaddr"){ let ifBillingaddr = false; if(e.target.checked) ifBillingaddr = true; return showDeliveryForm(ifBillingaddr); } // Sprawdzenie czy kliknięcie będzie na guzik "Wybierz z listy adresów" i pokazanie popupa if(e.target.classList.contains("delivery__address-list-button")){ app_shop.fn.addressModal = new Modal({ element: $(".delivery__address-list-container"), classList: "--fade-in-modal", afterShow: () => { disablePageScroll(); document.querySelector(".delivery__address-list").addEventListener("click", handleClickAddressList); }, beforeClose: () => { enablePageScroll(); document.querySelector(".delivery__address-list").removeEventListener("click", handleClickAddressList); }, }); return; } }); // Pokaż/schowaj hasło function togglePassword(el){ const passwordInput = document.querySelector(".register__password"); let showPassword = false; if(passwordInput.type === "password") showPassword = true; passwordInput.type = showPassword ? "text" : "password"; el.classList.remove(showPassword ? "register__show-password" : "register__hide-password"); el.classList.add(showPassword ? "register__hide-password" : "register__show-password"); el.innerHTML = showPassword ? `${}` : `${}`; } // Pokaż popup logowania function showSigninModal(){ app_shop.fn.signinModal = new Modal({ element: $("#signin-form"), classList: "--fade-in-modal", afterShow: ()=>{ disablePageScroll(); document.querySelector(".signin-form__login").addEventListener("keydown", logInOnEnter); document.querySelector(".signin-form__pass").addEventListener("keydown", logInOnEnter); }, beforeClose: ()=>{ enablePageScroll(); document.querySelector(".signin-form__login").removeEventListener("keydown", logInOnEnter); document.querySelector(".signin-form__pass").removeEventListener("keydown", logInOnEnter); }, }); } // Pokaż(true)/Schowaj(false) formularz dostawy na inny adres function showDeliveryForm(style){ const deliveryWrapper = document.querySelector(".bm-oscop__container #client_new_additional .delivery_box.cn_wrapper"); if((style && deliveryWrapper.classList.contains("--more")) || (!style && !deliveryWrapper.classList.contains("--more"))) return; // Formularz dostawy na inny adres style ? deliveryWrapper.classList.add("--more") : deliveryWrapper.classList.remove("--more"); // Przycisk od wybierania z listy adresów listBtn = document.querySelector(".delivery__address-list-button"); if(listBtn) style ? listBtn.classList.add("--fade-in") : listBtn.classList.remove("--fade-in"); // Zmiana regionu jeśli region klienta różni się od regionu dostawy const deliveryRegion = document.getElementById("delivery_region").value; const clientRegion = document.getElementById("client_region").value; if(deliveryRegion !== clientRegion) changeRegion(); } // EventListener listy adresów function handleClickAddressList(e){ const addressLi = e.target.closest("li"); if(!addressLi) return; // Uzupełnienie informacji o formularzu const addressForm = document.querySelector(".delivery_box.cn_wrapper"); changeDeliveryValue("#delivery_firstname", addressLi.dataset.firstname); changeDeliveryValue("#delivery_lastname", addressLi.dataset.lastname); const firmName = addressForm.querySelector("#delivery_additional"); if(addressLi.dataset.additional) { firmName.value = addressLi.dataset.additional; firmName.classList.add("focused"); addSuccess(firmName); } else { firmName.value = ""; firmName.classList.remove("focused"); clearValidation(firmName); } changeDeliveryValue("#delivery_street", addressLi.dataset.street); changeDeliveryValue("#delivery_zipcode", addressLi.dataset.zipcode); changeDeliveryValue("#delivery_city", addressLi.dataset.city); changeDeliveryValue("#delivery_phone", addressLi.dataset.phone); // Zmień państwo i przeładuj metody płatności jeśli jest inny const deliveryRegion = addressForm.querySelector("#delivery_region"); if(deliveryRegion.value !== addressLi.dataset.region_id) { addressForm.querySelector("#delivery_region").value = addressLi.dataset.region_id; changeRegion(); } // Nadanie klasy aktywnemu adresowi e.target.closest("ul").querySelectorAll("li").forEach(el => el.classList.remove("--active-address")); addressLi.classList.add("--active-address"); // Zamkniencie modala setTimeout(() => app_shop.fn.addressModal.closeModal(),100) } // Zmień wartości pól input delivery function changeDeliveryValue(selector, newValue){ const selectedInput = document.querySelector(selector); selectedInput.value = newValue; addSuccess(selectedInput); selectedInput.classList.add("focused") } // OBSŁUGA LOGOWANIA const SIGNIN = (signinInput) => JSON.stringify({ query: `mutation { login(${signinInput}) { status } }`, }); function logInOnEnter(e){ if(e.key === "Enter") logInToAccount(false) } const signinForm = document.querySelector(".signin-form__container form"); if(signinForm) signinForm.addEventListener("submit", logInToAccount); async function logInToAccount(event){ if(event) event.preventDefault(); const login = document.querySelector(".signin-form__login").value; const password = document.querySelector(".signin-form__pass").value; const loginStatus = await fetchData({ data: SIGNIN(` login: "${login.replace(/"/g, '\\"')}", password: "${password.replace(/"/g, '\\"')}", `), linkParameter: '?mutation=signin', alert: false, }); if (loginStatus.errors) { Alertek.show_alert(`${}`); return; } app_shop.fn.signinModal.closeModal(); getClientNew(); if(document.querySelector(".order2_terms_wrapper_sub.email")) document.querySelector(".order2_terms_wrapper_sub.email").remove(); if(document.querySelector(".order2_terms_wrapper_sub.sms")) document.querySelector(".order2_terms_wrapper_sub.sms").remove(); } // Zalogowanie/inicjacja użytkownika function getClientNew(){ app_shop.fn.ajaxLoadSite(1); // Przygotowanie jesli użytkownik nie jest zalogowany if(!document.querySelector(".--logged")) document.getElementById("client_form").remove(); document.querySelector(".step1_sub").insertAdjacentHTML("beforeend",''); $.ajax({ url: "/client-new.php?ajax=true&set_render=content", timeout: 16e3, complete: function (e, a) { throwAjaxError(a); app_shop.fn.ajaxLoadSite(0); }, success: function (e, a) { app_shop.fn.load( "place-order.php", [["#bm-oscop-section1", "#bm-oscop-section1"]], function () { history.go(-1); }, "?set_render=content" ).then(() => { changeRegion(); }) }, }); }; //////////////////////////////////////////////////////////////////////////////////////////////////////// // WALIDACJA // Wyczyść klasy walidacji function clearValidation(input){ const wrapper = input.closest(".has-feedback") wrapper.classList.remove('--success', '--error', 'has-error', 'has-success'); }; // Wyczyść wiadomość błędu function removeErrorMessage(input) { const valMessage = input.closest('.has-feedback').querySelector('.validate_message'); if(valMessage) valMessage.remove(); }; // Dodaj klasy błędu function addError(input){ clearValidation(input); removeErrorMessage(input); const wrapper = input.closest(".has-feedback"); clearValidation(wrapper); wrapper.classList.add('--error', 'has-error'); }; // Dodaj klasy sukcesu function addSuccess(input){ clearValidation(input); removeErrorMessage(input); const wrapper = input.closest(".has-feedback"); clearValidation(wrapper); wrapper.classList.add('--success', 'has-success'); }; // Dodaj error wraz z wiadomością function addErrorMessage(input, message){ addError(input); input.closest('.has-feedback').insertAdjacentHTML("beforeend",`${message}.`); } // Waliduj elementy wymagające wysłania requesta (zipcode, nip) async function validateRequest(target, order=false){ const wrapper = target.closest(".has-feedback"); let reqData = `${target.name}=${target.value}`; if(target.dataset.serialize) { const serializeEl = document.querySelector(target.dataset.serialize); reqData += '&' + `${serializeEl.name}=${encodeURIComponent(serializeEl.value)}`; } if(target.dataset.revalidate) { target.dataset.revalidate.split(",").forEach(elQuery => { validateRequest(document.querySelector(elQuery)); }) } if(target.value === '') { addErrorMessage(target, ); return false; } const resData = await $.ajax({ url: '/ajax/client-new.php?validAjax=true', type: 'POST', timeout: 16000, dataType: 'JSON', data: reqData, }); if(resData.errno) { let error_message = ''; if (resData.message.error_code) { if (resData.message.zipcode_pattern && (resData.message.error_code === 'incorect_zipcode' || resData.message.error_code === 'incorect_delivery_zipcode')) { error_message = clientNewErrorCode[resData.message.error_code] + ' ' + `${}]:` + ' '; error_message += resData.message.zipcode_pattern.join(', '); } else if (clientNewErrorCode[resData.message.error_code]) error_message = clientNewErrorCode[resData.message.error_code]; } addError(target); if (error_message) addErrorMessage(target, error_message); return false }else{ addSuccess(target); if (target.name==="client_email" && !order) { $.ajax({ url: '/ajax/client-new.php?checkClientExists=true', type: 'POST', timeout: 16000, dataType: 'JSON', data: {'client_mail': target.value}, }).then(function succesFn(resData) { if(resData.client_exists === true || resData.login) showEmailPopup(resData); }); } return true; } }; // Pokaż popup jeśli użytkownik wpisał email który posiada już konto function showEmailPopup(resData){ app_shop.fn.emailModal = new Modal({ html: `
${} ${}:
${resData.mail}

${}

`, classList: "--fade-in-modal", afterShow: disablePageScroll, beforeClose: enablePageScroll, }); return; } function handleShowSigninModalFromEmailModal(e){ e.preventDefault(); app_shop.fn.emailModal.closeModal(); showSigninModal(); } // EventListener zmian w kontenerze bm-oscop-section1 document.getElementById("bm-oscop-section1").addEventListener("change", (e) => { const validateRequestId = ["client_zipcode", "delivery_zipcode", "client_nip", "client_email"]; const notEmptyFieldsId = ["client_firstname", "client_lastname", "client_city", "delivery_firstname", "delivery_lastname", "delivery_city", "client_firm"]; // Walidacja zipcode, nipu i emaila if(validateRequestId.includes(e.target.id)) return validateRequest(e.target); // Zmiana regionu if(e.target.name === "client_region" || e.target.name === "delivery_region") { const clientType = e.target.name.split("_")[0]; validateRequest(document.getElementById(`${clientType}_zipcode`)); if(clientType === "client" && document.getElementById("client_type1").checked === true) validateRequest(document.getElementById("client_nip")); changeRegion(); return; } // Walidacja ulicy i numeru domu if(e.target.id === "client_street" || e.target.id === "delivery_street") validateStreet(e.target); // Walidacja numeru telefonu if(e.target.id === "client_phone" || e.target.id === "delivery_phone") validatePhone(e.target); // Walidacja loginu i hasła rejestracji if(e.target.classList.contains("register__login")) testLogin(); if(e.target.classList.contains("register__password")) testPassword(); // Walidacja imienia nazwiska miasta i firmy(wymagające po prostu nie bycia pustym) if(notEmptyFieldsId.includes(e.target.id)) validateNotEmpty(e.target); // Sprawdzenie czy firma w dostawie na inny adres została wpisana if(e.target.id === "delivery_additional"){ if(e.target.value.length > 0) addSuccess(e.target); else clearValidation(e.target); }; }); // Funkcje walidacji poszczególnych elementów function validateStreet(streetEl){ const streetParts = streetEl.value.split(" "); const addressNumber = Number(streetParts[streetParts.length-1][0]); if(streetEl.value.length === 0 || (streetEl.value.length > 0 && (!addressNumber || streetParts.length < 2))){ addErrorMessage(streetEl, ); return false; }else{ addSuccess(streetEl); return true; } } function validatePhone(streetEl){ const phoneNumber = streetEl.value.replaceAll(" ",""); if(phoneNumber.length===0 || (phoneNumber.length > 0 && !(Number(phoneNumber)) || phoneNumber.length<9)){ addErrorMessage(streetEl, ); return false; }else { addSuccess(streetEl); return true; } } function validateNotEmpty(checkEl){ if(checkEl.value.length < 1) { addErrorMessage(checkEl, ); return false; } else{ addSuccess(checkEl); return true; } } // Sprawdzenie loginu i hasla function testLogin(){ const login = document.querySelector(".register__login"); if(login.value.trim().length < 1){ addErrorMessage(login, ); return false; } else if(!/^[A-Za-z0-9@._-]*$/.test(login.value.trim()) || Number(login.value.trim()) || login.value.trim().length<3){ addErrorMessage(login, ); return false; }else{ addSuccess(login); return true; } } function testPassword(){ const repeatPassword = document.getElementById("repeat_password"); const password = document.querySelector(".register__password"); repeatPassword.value = password.value; if(password.value.trim().length < 1){ addError(password); password.closest('.has-feedback').insertAdjacentHTML("beforeend", `${}.`); return false; } if(password.value.trim().length < 6){ addError(password); password.closest('.has-feedback').insertAdjacentHTML("beforeend", `${}.`); return false; }else{ addSuccess(password); return true; } } // Obsługa przesuwających się labelek document.querySelector("body").addEventListener("change", (e) => { if(e.target.classList.contains("f-control")){ if(e.target.value.length > 0) e.target.classList.add("focused"); else e.target.classList.remove("focused"); } }) ////////////////////////////////////////////////////////////////////// // DOSTAWA I PŁATNOSĆI const SET_REGION = (setRegionInput) => JSON.stringify({ query: `mutation { setRegion(${setRegionInput}) { status error { code message } } }`, }); // Zmiana regionu dostawy async function changeRegion(payAndDelData = null) { // Pobranie informacji o regionie z formularza const clientRegion = document.getElementById("client_region").value; const deliveryRegion = document.getElementById("deliver_to_billingaddr").checked ? document.getElementById("delivery_region").value : clientRegion; // Zmiana regionu const regionStatus = await this.fetchData({ data: SET_REGION(`SetRegionInput: { billingRegionId: ${clientRegion}, deliveryRegionId: ${deliveryRegion}, areForced: true }`), linkParameter: '?mutation=setRegion', }); const { status } = regionStatus?.data?.setRegion || {}; if (status !== 'success') return alert("Błąd podczas zmiany kraju. Przeładuj stronę jeszcze raz."); // Pobranie nowych metod płatności i dostaw getNewPaymentsAndDeliveries(payAndDelData); }; // Załadowanie metod dostaw i płatności function getNewPaymentsAndDeliveries(data = null) { // Wyczyszczenie zapisanych poprzednich metod płatności prevPayment = undefined; prevShipping = undefined; // Wyczyszczenie punktow odbioru deliveryPickupPoints.length = 0; app_shop.fn.ajaxLoadSite(1); // Dane do uzupełnienia przy edycji let paymentValue, deliveryId; if(data){ paymentValue = data.paymentMethodId; deliveryId = `item_${data.deliveryMethodId}-${paymentValue === "cash" ? "0" : "1"}`; } // Pobranie metod płatności i dostawy $.ajax({ url: "/ajax/get-deliveries.php?mode=productAndBasket&prepaids=true", dataType: "json", timeout: 1e4, async: !0, complete: function (e, a) { throwAjaxError(a); app_shop.fn.ajaxLoadSite(0); }, success: async function (e) { let prepaidMarkup = ""; // Stworzenie markupa dla metod dostaw e.prepaid.forEach(function (method) { prepaidMarkup += prepareDeliveryMarkup(method, deliveryId); }); // Stworzenie markupa dla metod dostaw (dla płatności przy odbiorze) let dvpMarkup = ""; e.dvp.forEach(function (method) { dvpMarkup += prepareDeliveryMarkup(method, deliveryId); }); // Dane do zaznaczenia płatności i dostawy jeśli wcześniej na tej przeglądarce(localStorage) było już zamówienie const prevOrderInfo = JSON.parse(localStorage.getItem("prevOrderInfo")); // Wstawienie metod dostaw na strone const deliveryMarkup = `
${prepaidMarkup}
${dvpMarkup}
`; const previousDeliveries = document.getElementById("osc_order1"); if(previousDeliveries) previousDeliveries.remove(); document.getElementById("bm-oscop-deliveries").insertAdjacentHTML("beforeend",deliveryMarkup); // Stworzenie metod płatności let prepaidsMethodMarkup = ""; let prepaidsTransferMarkup = createPaymentContainerMarkup("transfer"); let prepaidsCardMarkup = createPaymentContainerMarkup("card"); // Sprawdzenie czy sklep ma możliwość płatności bankiem/kartą let ifPaymentTransfer = false; let ifPaymentCard = false; // Przygotowanie Płatności e.prepaids_method.forEach(function (method) { const checkedPayment = paymentValue === method.id; const markup = ` `; // Przygotowanie metod dla przelewów online/kart płatności if(method.group === "transfer") { prepaidsTransferMarkup += markup; ifPaymentTransfer = true; } else if(method.group === "card"){ prepaidsCardMarkup += markup; ifPaymentCard = true; } else{ prepaidsMethodMarkup += markup; // Okienko vouchera if(method.id === 2){ prepaidsMethodMarkup += `
Bon towarowy Zapłać za zakupy bonem towarowym
Jeżeli posiadasz więcej bonów, możesz wpisać ich numery przy podsumowaniu zamówienia.
` } } }); prepaidsTransferMarkup += ""; prepaidsCardMarkup += ""; // Dołączenie metody płatność przy odbiorze if(e.dvp.length) prepaidsMethodMarkup += ` `; // Wstawienie metod płatności na stronę const previousPayments = document.getElementById("osc_prepaids_method"); if(previousPayments) previousPayments.remove(); document.getElementById("bm-oscop-payments").insertAdjacentHTML("beforeend", `
${ifPaymentTransfer ? prepaidsTransferMarkup : ""}${ifPaymentCard ? prepaidsCardMarkup : ""}${prepaidsMethodMarkup}
`); // Wstawienie błędu jeśli metody płatności są puste const currentPayments = document.getElementById("osc_prepaids_method"); if(document.getElementById("osc_prepaids_method").innerHTML === "") currentPayments.insertAdjacentHTML("beforeend",'"); // Przygotowanie informacji o dostawie do obliczenia daty dostawy const deliveryDateInfo = {deliveryVal: null, delivery: null, pickuppoint: null}; const firstInput = document.querySelector("#osc_order1 input"); if(firstInput) changeDeliveryInfoObject(deliveryDateInfo, firstInput); // Wstawienie pickuppoint jeśli edycja i istnieje if(data?.pickupData !== undefined && data?.pickupData !== null){ const selectedShipping = document.querySelector(`#bm-oscop-section2 input#${deliveryId}`); const pointExists = await checkPrevPickupPoint( selectedShipping.parentElement.querySelector(".fselectedPoint"), data.pickupData.id, data.pickupData.name, `${data.pickupData.address.street} ${data.pickupData.address.buildingAndHouseNumber}`, data.pickupData.address.city, data.pickupData.address.postcode, data.deliveryMethodId ) // Odznaczenie punktu jeśli punkt odbioru nie istnieje(Wcześniej był zaznaczony przy edycji) if(!pointExists) selectedShipping.checked = false; else changeDeliveryInfoObject(deliveryDateInfo, selectedShipping); }// Sprawdzenie czy użytkownik ma zapisane poprzednio użyte metody w przeglądarce(tylko przy pierwszym załadowaniu strony) else if(firstTimeLoadPage && prevOrderInfo && prevOrderInfo?.prevCountry === document.getElementById("client_region").value){ // POPRZEDNIa PŁATNOSC const prevPaymentMethod = prevOrderInfo.prevPaymentMethod; // Zaznaczenie metod płatności które nie tworzą popupa if(prevPaymentMethod.id !== "payitem_2" && prevPaymentMethod.group !== "card" && prevPaymentMethod.group !== "transfer"){ document.getElementById(prevPaymentMethod.id).click(); } else if(prevPaymentMethod.group === "card" || prevPaymentMethod.group === "transfer"){ const paymentMethodId = prevPaymentMethod.id.replace("-clone", ""); cloneElement(document.getElementById(paymentMethodId)); } // POPRZEDNIA DOSTAWA const prevDeliveryMethod = prevOrderInfo.prevDeliveryMethod; const prevDeliveryInput = document.querySelector(`input#${prevDeliveryMethod.id}`); // Sprawdzenie czy istnieje metoda dostawy (na wypadek gdyby była usunięta lub klient zamawiał do innego kraju) if(prevDeliveryInput){ // Sprawdzenie czy dostawa miała punkt odbioru if(prevDeliveryMethod.fselectedPoint){ const pointExists = await checkPrevPickupPoint( prevDeliveryInput.parentElement.querySelector(".fselectedPoint"), prevDeliveryMethod.fselectedPoint.deliveryPointId, prevDeliveryMethod.fselectedPoint.name, prevDeliveryMethod.fselectedPoint.street, prevDeliveryMethod.fselectedPoint.city, prevDeliveryMethod.fselectedPoint.zipcode, prevDeliveryMethod.fselectedPoint.courierId ) if(pointExists) prevDeliveryInput.checked = true; }else{ prevDeliveryInput.checked = true; } changeDeliveryInfoObject(deliveryDateInfo, prevDeliveryInput); } } // Zaznaczenie karty/banku w przypadku edycji const checkedPayment = document.querySelector(`#osc_prepaids_method input[name="payform_id"]:checked`) if(paymentValue && checkedPayment && (checkedPayment.dataset.group === "card" || checkedPayment.dataset.group === "transfer")){ cloneElement(checkedPayment); } // Przeładowanie mapy loadMap(); // Zmiana daty dostawy i pokazanych opcji dostawy if(deliveryDateInfo.deliveryVal && deliveryDateInfo.delivery && deliveryDateInfo.pickuppoint) calculateDeliveryDate(deliveryDateInfo.deliveryVal, deliveryDateInfo.delivery, deliveryDateInfo.pickuppoint); // Przeliczenie kosztu dostawy calculateBasketCost(); app_shop.fn.ajaxLoadSite(0); firstTimeLoadPage = false; }, }); }; // Stworzenie kontenera na "przelewy online" lub "karta platnicza" function createPaymentContainerMarkup(method){ const operationName = method === "transfer" ? : ; const methodName = method === "transfer" ? "banków" : "kart płatniczych"; return `