function toWKT(e){var t,r,n=[];if(e instanceof L.Polygon||e instanceof L.Polyline){for(var a=e.getLatLngs(),o=0;o

This feature allows you to initially hide a layer. This can be used to achieve a desired layer presentation as well as to provide faster map loading for larger layers.

',html:!0,trigger:"hover",container:"body"}),jQuery(".at_active_chk").bootstrapSwitch({size:"mini",onSwitchChange:function(t,r){t.preventDefault();var n=jQuery(this).parents("ul:first"),a=n.attr("data-id"),o=getIndex(selectedLayers,"unique_id",a);selectedLayers[o].settings||"undefined"!=typeof selectedLayers[o].settings||(selectedLayers[o].settings=new Object),r===!0?(selectedLayers[o].settings.active=1,jQuery("#at-"+e.unique_id+" a.dropdown-toggle span").removeClass("label-danger").addClass("label-primary"),mymap.addLayer(featureGroup[a][selectedLayers[o].name])):(selectedLayers[o].settings.active=0,jQuery("#at-"+e.unique_id+" a.dropdown-toggle span").addClass("label-danger").removeClass("label-primary"),mymap.removeLayer(featureGroup[a][selectedLayers[o].name])),calculateBounds()}})),1==e.type||4==e.type){var r={format:"image/png",layers:e.Name,transparent:!0,crs:L.CRS.EPSG4326,unique_id:e.unique_id,srs1:e.SRS,layer_type:e.type};"undefined"!=typeof e.geometry_area&&(r.geometry=e.geometry_area),L.tileLayer.betterWms(e.url,r).addTo(featureGroup[e.unique_id][e.name])}else 2==e.type?""==t?(e.cache_timer||"undefined"!=typeof e.cache_timer||(e.cache_timer=15),t={datasource:e.connection_id,sql_layer_name:e.name,query_box:e.query,_token:jQuery('[name="_token"]').val(),cache_key:e.cache_key,cache_timer:e.cache_timer,type:2},ajaxRequest("map/layer/json","post","json",t,function(t){"200"==t.status?processSQLJSON(t,e):showMsg(t.status,t.msg)})):processSQLJSON(t,e):3==e.type;overlayers_controls(e),overlays[e.name]=featureGroup[e.unique_id][e.name],layerSelector.addOverlay(featureGroup[e.unique_id][e.name],e.name),3==e.type&&jQuery("#at-"+e.unique_id).find(".style-at-layer").remove(),calculateBounds()}function getPopupContent(e,t){return $.each(e.features,function(e,r){$.each(r.properties,function(e,r){t=t.replace("<"+e+">",r)})}),t}function processSQLJSON(e,t){t=defaultLayerStyle(t),jQuery.each(e.result,function(e,r){L.geoJson(r,{onEachFeature:function(e,r){if(r instanceof L.Marker){var n=!1;"nr"==t.style.type?$.each(t.style.custom,function(a,o){if(between(e.properties[t.style.field],o.val))return n=!0,r.setIcon(L.AwesomeMarkers.icon(o.style)),!1}):"g"==t.style.type&&$.each(t.style.custom,function(a,o){if(e.properties[t.style.field]==o.val)return n=!0,r.setIcon(L.AwesomeMarkers.icon(o.style)),!1}),0==n&&r.setIcon(L.AwesomeMarkers.icon(t.style.marker))}r.on("click",function(n){var a=getSQLPopupContent(e.properties,t.pc);r.bindPopup(a)})},style:function(e,r){return t.style.polygon}}).addTo(featureGroup[t.unique_id][t.name]),mymap.fitBounds(featureGroup[t.unique_id][t.name].getBounds())})}function initLayer(){selectedLayers.sort(sort_value_layer),selectedBaseLayers.length>0&&jQuery("#visiable-layers").find(".baselayers-control").removeClass("hide"),jQuery.each(selectedBaseLayers,function(e,t){if(layerSelector.addBaseLayer(baseLayers.mymap[t.name],t.name),baselayers_controls(t.name),"undefined"!=typeof page&&"manage"==page){var r=jQuery("#base_layer_selection").find('input:checkbox[data-name="'+t.name+'"]');r.length>0&&(r.prop("checked","checked"),baseLayerMap(r,!1))}}),jQuery.each(selectedLayers,function(e,t){renderLayer(t,"")});var e={type:3,id:map.id,_token:jQuery('[name="_token"]').val()};ajaxRequest("map/layer/json","post","json",e,function(e){"200"==e.status?processFreeHand(e):showMsg(e.status,e.msg)})}function processFreeHand(e){jQuery.each(e.result,function(e,r){index=getIndex(selectedLayers,"unique_id",e),t=selectedLayers[index],"undefined"==typeof featureGroup[t.unique_id]&&(featureGroup[t.unique_id]=new Array),featureGroup[t.unique_id][t.name]=new L.FeatureGroup,"undefined"!=typeof t.settings?1==t.settings.active?featureGroup[t.unique_id][t.name].addTo(mymap):t.settings.active=0:(featureGroup[t.unique_id][t.name].addTo(mymap),t.settings=new Object,t.settings.active=1),L.geoJson(r,{onEachFeature:function(e,r){selectedLayers[index].layer=r,1==t.settings.active&&drawingGroup.addLayer(r),featureGroup[t.unique_id][t.name].addLayer(r),r instanceof L.Marker&&r.setIcon(L.AwesomeMarkers.icon(selectedLayers[index].style.marker)),r.bindPopup(selectedLayers[index].pc)},style:function(e,r){return t.style.polygon},pointToLayer:function(e,r){return"undefined"!=typeof t.radius?L.circle(r,parseInt(t.radius,10)):L.marker(r)}})}),calculateBounds()}function calculateBounds(){bounds=!0,jQuery.each(selectedLayers,function(e,t){if(("undefined"==typeof t.settings.active||1==t.settings.active)&&((1==t.type||4==t.type&&"undefined"==typeof t.geometry_area)&&(1!=bounds?bounds.extend([parseFloat(t.LatLonBoundingBox["@attributes"].miny),parseFloat(t.LatLonBoundingBox["@attributes"].minx)],[parseFloat(t.LatLonBoundingBox["@attributes"].maxy),parseFloat(t.LatLonBoundingBox["@attributes"].maxx)]):bounds=L.latLngBounds([parseFloat(t.LatLonBoundingBox["@attributes"].miny),parseFloat(t.LatLonBoundingBox["@attributes"].minx)],[parseFloat(t.LatLonBoundingBox["@attributes"].maxy),parseFloat(t.LatLonBoundingBox["@attributes"].maxx)])),3==t.type&&"undefined"!=typeof featureGroup[t.unique_id]&&"undefined"!=typeof featureGroup[t.unique_id][t.name])){var r=featureGroup[t.unique_id][t.name];if(1!=bounds){var n=r.getBounds();"undefined"!=typeof n._southWest&&bounds.extend(r.getBounds())}else{var n=r.getBounds();"undefined"!=typeof n._southWest&&(bounds=n)}}}),bounds!==!0&&mymap.fitBounds(bounds)}function getLayersIndex(e){var t=selectedLayers.length;for(i=0;i").attr("data-key",e.unique_id).attr("data-name",e.name).addClass("overlay_control_"+e.unique_id).html(Mustache.render(t,e)).appendTo("#visiable-layers div.dropdown-menu .custom-control-layers").find('input[type="checkbox"]').bootstrapSwitch({size:"mini",onSwitchChange:function(e,t){e.preventDefault();var r=jQuery(this).parents("li:first"),n=r.attr("data-key"),a=r.attr("data-name"),o=getIndex(selectedLayers,"unique_id",n);selectedLayers[o];t===!0?mymap.addLayer(featureGroup[n][a]):mymap.removeLayer(featureGroup[n][a])}});else{var r=document.getElementById("map-overlayer-submenu-controls-tmpl").innerHTML;Mustache.parse(r),$("
  • ").attr("data-key",e.unique_id).attr("data-name",e.name).addClass("nav-item treeview overlay_control_"+e.unique_id).html(Mustache.render(r,e)).appendTo("#visiable-layers div.dropdown-menu .custom-control-layers"),addSubOverLayer(e)}"undefined"!=typeof page&&"manage"==page&&$("#visiable-layers div.dropdown-menu .custom-control-layers").sortable({stop:sortLayers}).disableSelection()}function addSubOverLayer(e){var t=jQuery('li[data-key="'+e.unique_id+'"]'),r=document.getElementById("map-overlayer-sub-controls-tmpl").innerHTML;$.each(e.style.custom,function(n,a){$("
  • ").attr("data-key",e.unique_id).attr("data-name",e.name).attr("data-val",a.val).html(Mustache.render(r,{val:a.val,t:e})).appendTo(t.find("ul")).find('input[type="checkbox"]').bootstrapSwitch({size:"mini",onSwitchChange:function(e,t){e.preventDefault();var r=jQuery(this).parents("li:first"),n=r.attr("data-key"),a=r.attr("data-name"),o=r.attr("data-val"),i=getIndex(selectedLayers,"unique_id",n),s=selectedLayers[i],l=featureGroup[n][a].getLayers();$.each(l,function(e,r){r.eachLayer(function(e){"nr"==s.style.type?between(e.feature.properties[s.style.field],o)&&(t===!0?mymap.addLayer(e):mymap.removeLayer(e)):"g"==s.style.type&&e.feature.properties[s.style.field]==o&&(t===!0?mymap.addLayer(e):mymap.removeLayer(e))})})}})}),jQuery(".subcontrol-layer-action").slimScroll({alwaysVisible:!0,height:100}),jQuery(".submenu-overlay-controls").click(function(e){e.preventDefault();var t=jQuery(this);t.toggleClass("in");var r=$(t.attr("href"));return r.hasClass("in")?r.collapse("hide"):r.collapse("show"),!1})}function baselayers_controls(e){var t=document.getElementById("map-baselayer-controls-tmpl").innerHTML;Mustache.parse(t),$("
  • ").attr("data-name",e).addClass("baselayer_control_"+e).html(Mustache.render(t,{name:e})).prependTo("#visiable-layers div.dropdown-menu .baselayers-control-layers").find('input[type="radio"]').bootstrapSwitch({size:"mini",onSwitchChange:function(e,t){e.preventDefault();var r=jQuery(this).parents("li:first"),n=r.attr("data-name");$.each(baseLayers.mymap,function(e,t){mymap.removeLayer(baseLayers.mymap[e])}),t===!0&&mymap.addLayer(baseLayers.mymap[n])}})}function removeOverlayerControl(e){jQuery("#visiable-layers").find(".overlay_control_"+e).remove()}function applyLiveStyle(e){var t=jQuery('#map-sidebar-container [name="my_unique_id"]').val(),r=getIndex(selectedLayers,"unique_id",t),n={};jQuery("#layer-polygon-styling input").each(function(){var e=jQuery(this);n[e.attr("name")]=e.val()});var a={};if(jQuery("#layer-marker-styling .default-marker-style select").each(function(){var e=jQuery(this);a[e.attr("data-name")]=e.val()}),2==selectedLayers[r].type){var o=featureGroup[selectedLayers[r].unique_id][selectedLayers[r].name].getLayers();$.each(o,function(e,t){t.eachLayer(function(e){e instanceof L.Marker?e.setIcon(L.AwesomeMarkers.icon(a)):(e instanceof L.Polyline||e instanceof L.Polygon||e instanceof L.Rectangle||e instanceof L.Circle)&&e.setStyle(n)})})}else if(3==selectedLayers[r].type){var i=selectedLayers[r].layer;i instanceof L.Marker?i.setIcon(L.AwesomeMarkers.icon(a)):(i instanceof L.Polyline||i instanceof L.Polygon||i instanceof L.Rectangle||i instanceof L.Circle)&&i.setStyle(n)}selectedLayers[r].style.polygon=n,selectedLayers[r].style.marker=a}function defaultLayerStyle(e){var t=new Object,r=new Object;"undefined"==typeof e.style&&(e.style=new Object),"undefined"!=typeof e.style.polygon?t=e.style.polygon:e.style.polygon=new Object,"undefined"!=typeof e.style.marker?r=e.style.marker:e.style.marker=new Object,"undefined"==typeof t.color&&(t.color="#ccc"),"undefined"==typeof t.opacity&&(t.opacity=1),"undefined"==typeof t.fillOpacity&&(t.fillOpacity=1),"undefined"==typeof t.fillColor&&(t.fillColor="#ccc"),"undefined"==typeof t.weight&&(t.weight=1),"undefined"==typeof r.icon&&(r.icon=""),"undefined"==typeof r.color&&(r.color="blue"),e.style.polygon=t,e.style.marker=r;var n=getIndex(selectedLayers,"unique_id",e.unique_id);return selectedLayers[n].style=e.style,e}function getLayerIndex1(e){var t=selectedLayers.length;for(i=0;i=r[0]&&e<=r[1]}function getMarkerStyle(e){if(""==e.markerColor){var t=jQuery("#default_style_marker_color").val();""!=t?e.markerColor=t:e.markerColor="blue"}if(""==e.icon){var r=jQuery("#default_style_marker_icon").val();""!=r?e.icon=r:e.icon=""}return e}function ajaxLoadSucess(){jQuery("#main-loader").addClass("hide")}function WMSLayers(e,r,n){var a=e.attr("data-gsid"),o=e.attr("data-layername"),i=getIndex(DBLayerType,"id",n),s=gslayers[DBLayerType[i].tmpl+"_"+a][0],l=getDetailsByAttr(s.layers,"Name",o);l=l[0];var u,c=l.Name.split(":");u=1==n?s.url+c[0]+"/wms":s.url;var y=l.l_id;if(e.is(":checked"))1==r&&(t=l,t.id=s.id,t.unique_id=y,t.type=n,t.name=l.Title,t.url=u,t.pc="",selectedLayers.push(t)),renderLayer(t,"");else{jQuery("#at-"+y).remove();var i=getLayersIndex(y);selectedLayers.splice(i,1),featureGroup[y][l.Title].clearLayers(),layerSelector.removeLayer(featureGroup[y][l.Title]),removeOverlayerControl(y)}calculateBounds()}function clearMap(){jQuery.each(selectedLayers,function(e,t){$self=jQuery("#layer_selection_"+t.gs.id).find('input:checkbox[data-layername="'+t.gs.layers.Name+'"]');var r=$self.attr("data-gsid"),n=$self.attr("data-layername"),a=getDetailsByAttr(layers,"id",r);a=a[0];var o=getDetailsByAttr(a.layers,"Name",n);o=o[0];var i="gs_"+o.Name+"_"+a.id;layerSelector.removeLayer(featureGroup[i][o.Title]),featureGroup[i][o.Title].clearLayers()})}function tinyMCEInit_Popup(e){tinyMCE.init({selector:e,theme:"modern",plugins:[],toolbar1:"insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image jbimages",toolbar2:"print preview media | forecolor backcolor emoticons | mapshapes",image_advtab:!0,relative_urls:!1,remove_script_host:!1,convert_urls:!0,autosave_ask_before_unload:!1,extended_valid_elements:"a[onclick|style|href|title|id|class|target]",setup:function(e){e.on("change",function(t){var r=jQuery(e.targetElm),n=getIndex(selectedLayers,"unique_id",r.attr("data-uniqueid"));selectedLayers[n].pc=e.getContent()})}})}function baseLayerMap(e,t){var r=e.attr("data-name"),n=e.val();if(e.is(":checked")){if(t===!0){layerSelector.addBaseLayer(baseLayers.mymap[r],r);var a=new Object;a.id=n,a.name=r,selectedBaseLayers.push(a),baselayers_controls(r)}}else{layerSelector.removeLayer(baseLayers.mymap[r]);var o=getIndex(selectedBaseLayers,"id",n);selectedBaseLayers.splice(o,1),jQuery('#custom_layers [data-name="'+r+'"]').remove()}selectedBaseLayers.length>0&&jQuery("#visiable-layers").find(".baselayers-control").removeClass("hide")}function makeFasterTree(e){var t=new Array;$.each(db.columns,function(e,r){var n=new Object;n.text=e,n.href=e,n.tags=r.length,n.nodes=new Array,$.each(r,function(e,t){var r=new Object;r.text=t.column_name,r.href=t.column_name,n.nodes.push(r)}),t.push(n)});var r={bootstrap2:!1,showTags:!1,levels:1,data:t,onNodeSelected:function(e,t){"undefined"==typeof t.parentId?$(this).treeview("toggleNodeExpanded",[t.nodeId,{silent:!0}]):jQuery("#query_box").val(jQuery("#query_box").val()+" "+t.href)}};$("#"+e).treeview(r),jQuery("#table_tree_container").slimScroll({height:400}),jQuery("#query-help-text-btn").slimScroll({height:400})}function getGeoLayer(e,t){var r=e.attr("data-id");e.find(".loading").removeClass("hide"),0==e.find("ul").length&&ajaxRequest("developer/geoserver/layers/json","get","json",{id:r,type:t},function(n){if(e.find(".loading").addClass("hide"),200==n.status){gslayers[t+"_"+r]=n.result;var a=document.getElementById("geoserver-layers-tmpl").innerHTML;Mustache.parse(a),e.find(".box-body").html(Mustache.render(a,{geolayers:n.result}));var o=getIndex(DBLayerType,"tmpl",t),i=getDetailsByType(selectedLayers,"id",r,"type",DBLayerType[o].id),s=jQuery("#"+t+'-container [data-id="'+r+'"]');jQuery.each(i,function(e,t){s.find('[data-layername="'+t.Name+'"]').prop("checked",!0)}),jQuery(".scroller").slimScroll({railVisible:!0,alwaysVisible:!0}),$('.gs-collapse input[type="checkbox"].layer_chk').each(function(){jQuery(this).bootstrapSwitch({size:"mini",onSwitchChange:function(e,t){var r=jQuery(e.target);WMSLayers(r,!0,1)}})}),$('.wms-collapse input[type="checkbox"].layer_chk').each(function(){jQuery(this).bootstrapSwitch({size:"mini",onSwitchChange:function(e,t){var r=jQuery(e.target);WMSLayers(r,!0,4)}})})}else showMsg(n.error,n.msg)})}function deleteLayer(e){var t=getLayersIndex(e);3==selectedLayers[t].type&&drawingGroup.removeLayer(selectedLayers[t].layer),jQuery("#at-"+e).remove(),featureGroup[selectedLayers[t].unique_id][selectedLayers[t].name].clearLayers(),layerSelector.removeLayer(featureGroup[selectedLayers[t].unique_id][selectedLayers[t].name]),selectedLayers.splice(t,1)}function editATLayer(e){var t=getLayersIndex(e);currentIndex=t,1==selectedLayers[t].type||4==selectedLayers[t].type?layerDialog(selectedLayers[t]):2==selectedLayers[t].type?layerDialog(selectedLayers[t]):3==selectedLayers[t].type&&layerDialog(selectedLayers[t])}function editSQLATLayer(e){var t=getLayersIndex(e);if(currentIndex=t,1==selectedLayers[t].type)layerDialog(selectedLayers[t]);else if(2==selectedLayers[t].type){var r=document.getElementById("sql-layer-modal-tmpl").innerHTML;Mustache.parse(r),jQuery("#sql_layer_form").html(Mustache.render(r,{ds:ds})),jQuery("#sql-layer-modal").modal("show"),jQuery("#query_box").val(selectedLayers[t].query),jQuery("#query_box").val(selectedLayers[t].query),jQuery("#sql_layer_name").val(selectedLayers[t].name),jQuery("#sql_datasource").val(selectedLayers[t].connection_id),jQuery("#sql_unique_id").val(selectedLayers[t].unique_id),jQuery("#sql_datasource").trigger("change"),validateForm(jQuery("#sql_layer_form")),sqlFormChange=!1,SQLModeModal(selectedLayers[t].sqlMode)}else 3==selectedLayers[t].type&&layerDialog(selectedLayers[t])}function editCacheLayer(e){var t=getLayersIndex(e);currentIndex=t;var r=jQuery("#cache_settings_form");if(1==selectedLayers[t].type||3==selectedLayers[t].type){var n="Cache settings not avaliable for Geoserver layers.";3==selectedLayers[t].type&&(n="Cache settings not avaliable for FreeHand layers.");var a=document.getElementById("no-settings-msg-modal-tmpl").innerHTML;Mustache.parse(a),r.html(Mustache.render(a,{msg:n})),jQuery("#cache-settings-modal").modal("show"),jQuery("#cache-settings-modal .btn.btn-success").addClass("hide")}else if(2==selectedLayers[t].type){var o=document.getElementById("sql-layer-cache-modal-tmpl").innerHTML;Mustache.parse(o),r.html(Mustache.render(o,{ds:ds})),jQuery("#cache-settings-modal").modal("show"),r.find('[name="cache_timer"]').val(selectedLayers[t].cache_timer),r.find('[name="unique_id"]').val(selectedLayers[t].unique_id),validateForm(jQuery("#cache_settings_form")),jQuery("#cache-settings-modal .btn.btn-success").removeClass("hide")}}function editStyleLayer(e){var t=getLayersIndex(e);currentIndex=t;var r=jQuery("#style_settings_form");if(1==selectedLayers[t].type){var n=document.getElementById("geoserver-style-modal-tmpl").innerHTML;Mustache.parse(n),r.html(Mustache.render(n)),jQuery("#style-settings-modal").modal("show"),jQuery("#style-settings-modal .btn.btn-success").addClass("hide")}else if(2==selectedLayers[t].type){var a=document.getElementById("sql-layer-style-modal-tmpl").innerHTML;return Mustache.parse(a),jQuery("#map-sidebar-container").html(Mustache.render(a,{t:selectedLayers[t]})),jQuery(".control-sidebar").toggleClass("control-sidebar-open"),jQuery("#layer_polygon_fill_color,#layer_polygon_color").colorpicker({theme:"bootstrap"}).on("changeColor",function(e){applyLiveStyle()}),jQuery("#layer-polygon-styling input").change(function(){applyLiveStyle()}),jQuery("#layer-marker-styling select").change(function(){applyLiveStyle()}),void jQuery(".sidebar_hide").toggleClass("hide")}else 3==selectedLayers[t].type&&(jQuery("#layer_polygon_fill_color,#layer_polygon_color").colorpicker({theme:"bootstrap"}).on("changeColor",function(e){applyLiveStyle()}),jQuery("#layer-polygon-styling input").change(function(){applyLiveStyle()}))}function sqlFormEvent(){jQuery(".sql-layers-btn").click(function(){currentIndex=-1;var e=(jQuery(this).val(),document.getElementById("sql-layer-modal-tmpl").innerHTML);Mustache.parse(e),jQuery("#sql_layer_form").html(Mustache.render(e,{ds:ds})),jQuery("#sql-layer-modal").modal("show"),validateForm(jQuery("#sql_layer_form")),SQLModeModal()}),jQuery("#sql-layer-modal").on("change","#sql_datasource",function(){var e=jQuery(this).val();currentIndex!=-1&&selectedLayers[currentIndex].connection_id!=e&&setupEditor(),ajaxRequest("db/table/"+e,"get","json",{},function(e){200==e.status?(db.tables=e.tables,db.columns=e.columns,makeFasterTree("tree_5"),jQuery("#drag_table").html(""),jQuery("#drag_table").append(Mustache.render(table_tmpl,e)),currentIndex!=-1&&(jQuery("#drag_table").val(selectedLayers[currentIndex].table_name),jQuery("#drag_table").trigger("change")),jQuery("#drag_table").select2({width:"100%"})):showMsg("error",e.error)})}),jQuery("#sql-layer-modal").on("change","#drag_table",function(){var e=jQuery(this).val();if(jQuery("#drag_geometry_column").html(Mustache.render(column_tmpl,{columns:db.columns[e]})),jQuery("#drag_other_column").html(Mustache.render(column_tmpl,{columns:db.columns[e]})),currentIndex!=-1&&(jQuery("#drag_geometry_column").val(selectedLayers[currentIndex].geometry_col),"undefined"!=typeof selectedLayers[currentIndex].other_col&&selectedLayers[currentIndex].other_col.length>0))for(var t in selectedLayers[currentIndex].other_col){var r=selectedLayers[currentIndex].other_col[t];$("#drag_other_column").find("option[value="+r+"]").prop("selected","selected")}jQuery("#drag_other_column, #drag_geometry_column").select2({width:"100%"})}),jQuery("#sql-layer-modal").on("change","#geohelm_tags",function(){var e=jQuery(this).val();jQuery("#query_box").val(jQuery("#query_box").val()+e)}),jQuery("#sql-layer-save-btn").click(function(e){e.preventDefault();var r=jQuery(this);if(jQuery("#sql_layer_form").validate().form())if(sqlFormChange===!0){r.button("loading");var n=jQuery("#sql_layer_form").serialize();ajaxRequest("developer/map/sql/layer/save","post","json",n,function(e){if(r.button("reset"),200==e.status){sqlMode=jQuery("#sql-mode-switch").bootstrapSwitch("state");var n=jQuery("#sql_unique_id").val(),a=-1;""!=n?(a=getLayersIndex(n),t=selectedLayers[a]):(t=new Object,t.unique_id=uniqId("pg"),t.pc="",t.type=2,t.cache_timer=15),t.connection_id=jQuery("#sql_datasource").val(),1==sqlMode?(t.query=jQuery("#query_box").val(),t.sqlMode=!0):t.query=e.query,t.table_name=jQuery("#drag_table").val(),t.geometry_col=jQuery("#drag_geometry_column").val(),t.other_col=jQuery("#drag_other_column").val(),t.name=jQuery("#sql_layer_name").val(),t.properties=e.columns,a!=-1?(selectedLayers[a]=t,mymap.removeLayer(featureGroup[t.unique_id][t.name]),mymap.addLayer(featureGroup[t.unique_id][t.name]),processSQLJSON(e,t)):(selectedLayers.push(t),renderLayer(t,e)),jQuery("#sql-layer-modal").modal("hide")}else showMsg(e.status,e.msg)})}else jQuery("#sql-layer-modal").modal("hide")}),jQuery("#geoserver-layer-save-btn").click(function(e){e.preventDefault();jQuery(this);if(jQuery("#geoserver_layer_form").validate().form()){var r=jQuery("#geoserver_unique_id").val(),n=-1;""!=r?(n=getLayersIndex(r),t=selectedLayers[n]):(t=new Object,t.unique_id=uniqId("pg"),t.pc="",t.type=2),t.name=jQuery("#geoserver_layer_name").val(),n!=-1?(selectedLayers[n]=t,jQuery("#at-"+t.unique_id+" span").html(t.name)):(selectedLayers.push(t),renderLayer(t,data)),jQuery("#geoserver-layer-modal").modal("hide")}}),jQuery("#sql-layer-modal").on("change","#sql_datasource, #drag_sql_datasource",function(){sqlFormChange=!0}),jQuery("#sql-layer-modal").on("change","#query_box, #drag_geometry_column,#drag_other_column,#drag_table",function(){sqlFormChange=!0})}function SQLModeModal(e){jQuery("#drag_sql_datasource,#sql_datasource").select2({width:"100%"}),$("#sql-mode-switch").on("switchChange.bootstrapSwitch",function(e,t){sqlFormChange=!0,e.preventDefault(),jQuery("#sql_mode").val(!0),t===!0?(jQuery("#sql-mode-container").show(),jQuery("#drag-drop-container").hide()):(jQuery("#sql-mode-container").hide(),jQuery("#drag-drop-container").show())}),jQuery("#sql-mode-switch").bootstrapSwitch("state",e,!1)}function setupEditor(){jQuery("#query_box").val(""),jQuery("#drag_table").val(""),jQuery("#drag_geometry_column").val(""),jQuery("#drag_other_column").val("")}function drawing_event(){var e=function(){mymap.on("draw:drawstart",function(e){draw_editStart(e)}),mymap.on("draw:deletestart",function(e){draw_editStart(e)}),mymap.on("draw:editstop",function(e){draw_editStop(e)}),mymap.on("draw:drawstop",function(e){draw_editStop(e)}),mymap.on("draw:deletestop",function(e){draw_editStop(e)}),mymap.on("moveend",function(e){updateMapCenter()}),mymap.on("draw:created",function(e){var t=new Object;t.lt=e.layerType;var r=e.layer;drawingGroup.addLayer(r),r.on("click",function(){var e=getLayerIndex1(r);editMode?(layerDialog(selectedLayers[e]),setTimeout(function(){mymap.closePopup()},50)):r.bindPopup(selectedLayers[e].pc)}),style={};r instanceof L.Marker?(style.marker=new Object,style.marker.icon="",style.marker.color="",t.marker=!0,t.polygon=!1):(r instanceof L.MultiPolygon||r instanceof L.Polyline||r instanceof L.Rectangle||r instanceof L.Circle)&&(style.polygon=new Object,style.polygon.color="#ff0000",style.polygon.opacity=.5,style.polygon.weight=5,style.polygon.fillColor="#ff0000",style.polygon.fillOpacity=.5,r.setStyle(style.polygon),t.marker=!1,t.polygon=!0),t.layer=r,t.style=style,t.type=3,t.name="Layer Name",t.location="",t.pc="",t.unique_id=uniqId("cl"),selectedLayers.push(t),layerDialog(t),renderLayer(t)}),mymap.on("draw:editstart",function(e){draw_editStart(),editMode=!0}),mymap.on("draw:editstop",function(e){editMode=!1,draw_editStop(e)}),mymap.on("draw:deleted",function(e){var t=e.layers;t.eachLayer(function(e){(e instanceof L.MultiPolygon||e instanceof L.Polyline||e instanceof L.Rectangle||e instanceof L.Circle||e instanceof L.Marker)&&deleteLayer(e.feature.properties.unique_id)})})};e(),$(".leaflet-draw.leaflet-control").hide(),$("#mapid > #data").show(),$("#draw-polyline,#draw-polygon,#draw-rectangle,#draw-marker, #edit-edit,#edit-remove, #draw-circle").click(function(e){if("#"==$(this).attr("href")){e.preventDefault();var t=$(this).attr("id");$(".leaflet-draw-"+t)[0].click()}})}function draw_editStart(e){var t=0;setTimeout(function(){info=$(".leaflet-draw-tooltip").text().replace("Click cancel to undo changes.",""),$("#control-tip-info").html(info),$("#control-tip-buttons").text(""),$(".leaflet-draw-actions li").each(function(e){var r=$(this);if("block"==r.parent().css("display")){var n=r.text(),a="";a=/cancel/i.test(n)?"remove":/save/i.test(n)?"save":"trash",Actions=' '+r.text()+"",$("#control-tip-buttons").prepend(Actions)}})},100)}function draw_editStop(e){$("#control-tip-info").html('Select the Shape to draw on Map or click here to import gpx, json or kml.'),$("#control-tip-buttons").text("")}function updateMapCenter(){canter=mymap.getCenter(),$("input[name=latitude]").val(canter.lat),$("input[name=longitude]").val(canter.lng),$("#mapcenter").val("["+canter.lat+","+canter.lng+"]")}function layerDialog(e){var t=document.getElementById("cl-style-modal-tmpl").innerHTML;if(Mustache.parse(t),jQuery("#map-sidebar-container").html(Mustache.render(t,{t:e,type:layerType[e.type]})),jQuery(".sidebar_hide").hasClass("hide")||(jQuery(".sidebar_hide").toggleClass("hide"),jQuery(".control-sidebar").toggleClass("control-sidebar-open")),tinyMCEInit_Popup('#cs-layer-popup [name="pc"]'),2==e.type||3==e.type){if("nr"==e.style.type||"g"==e.style.type){var r=featureGroup[e.unique_id][e.name].getLayers(),n=new Array,a=0;if($.each(r,function(e,t){t.eachLayer(function(e){n[a++]=e.feature.properties})}),"nr"==e.style.type){var o=_.max(n,function(t){return t[e.style.field]}),i=document.getElementById(e.style.type+"-style-selection").innerHTML;Mustache.parse(i),jQuery("#style_column_name").val(e.style.field),jQuery("#style_data_type").val(e.style.type),jQuery("#attribute-input-field").html(Mustache.render(i,{max:o[e.style.field]}));$.each(e.style.custom,function(t,r){var n=document.getElementById(e.style.type+"-column-style-selection").innerHTML;Mustache.parse(n);var a=Mustache.render(n,{});jQuery("#attribute-input-field table tbody").append(a);var o=jQuery("#attribute-input-field table tbody tr:last");o.find("input").val(r.val),o.find('select[data-name="markerColor"]').val(r.style.markerColor),o.find('select[data-name="icon"]').val(r.style.icon)})}else if("g"==e.style.type){var o=_.groupBy(n,function(t){return parseFloat(t[e.style.field])}),i=document.getElementById(e.style.type+"-style-selection").innerHTML;Mustache.parse(i),jQuery("#style_column_name").val(e.style.field),jQuery("#style_data_type").val(e.style.type),jQuery("#attribute-input-field").html(Mustache.render(i,{max:o[e.style.field]}));$.each(e.style.custom,function(t,r){var n=document.getElementById(e.style.type+"-column-style-selection").innerHTML;Mustache.parse(n);var a=Mustache.render(n,{});jQuery("#attribute-input-field table tbody").append(a);var o=jQuery("#attribute-input-field table tbody tr:last");o.find("input").val(r.val),o.find('select[data-name="markerColor"]').val(r.style.markerColor),o.find('select[data-name="icon"]').val(r.style.icon)})}}jQuery("#layer_polygon_fill_color,#layer_polygon_color").colorpicker({theme:"bootstrap"}).on("changeColor",function(e){applyLiveStyle()}),jQuery("#layer-polygon-styling input").change(function(){applyLiveStyle()}),jQuery("#layer-marker-styling .default-marker-style select").change(function(){applyLiveStyle()}),jQuery("#layer-marker-styling").on("click",".numeric-range",function(){var e=jQuery(this).parents("tr:first"),t=e.clone();t.find("input").val(""),e.after(t)}),jQuery("#layer-marker-styling .custom-marker-style #style_data_type, #layer-marker-styling .custom-marker-style #style_column_name").change(function(){var e=jQuery("#style_column_name").val(),t=jQuery("#style_data_type").val();if(""!=e&&""!=t){jQuery("#attribute-input-field").html("");var r=jQuery('#map-sidebar-container [name="my_unique_id"]').val(),n=getIndex(selectedLayers,"unique_id",r),a=featureGroup[selectedLayers[n].unique_id][selectedLayers[n].name].getLayers(),o=new Array,i=0;if($.each(a,function(e,t){t.eachLayer(function(e){o[i++]=e.feature.properties})}),"nr"==t){var s=_.max(o,function(t){ return parseFloat(t[e])}),l=document.getElementById(t+"-style-selection").innerHTML;if(Mustache.parse(l),jQuery("#attribute-input-field").html(Mustache.render(l,{max:s[e]})),0==jQuery("#attribute-input-field table tboday tr").length){var l=document.getElementById("nr-column-style-selection").innerHTML;Mustache.parse(l);var u=Mustache.render(l,{});jQuery("#attribute-input-field table tbody").append(u)}}else{var s=_.groupBy(o,function(t){return t[e]}),l=document.getElementById(t+"-style-selection").innerHTML;Mustache.parse(l),jQuery("#attribute-input-field").html(Mustache.render(l,{max:s[e]})),$.each(s,function(e,t){var r=document.getElementById("g-column-style-selection").innerHTML;Mustache.parse(r);var n=Mustache.render(r,{attr:e});jQuery("#attribute-input-field table tbody").append(n)})}}});var s=new Array,l=0;jQuery("#attribute-input-field").on("change","table input, table select",function(){var e=jQuery('#map-sidebar-container [name="my_unique_id"]').val(),t=getIndex(selectedLayers,"unique_id",e),r=featureGroup[selectedLayers[t].unique_id][selectedLayers[t].name].getLayers(),n=jQuery("#style_column_name").val(),a=jQuery("#style_data_type").val();s=new Array,l=0,jQuery("#attribute-numeric-table tbody tr").each(function(){var e=jQuery(this),t=e.find("input:text").val(),o={};e.find("select").each(function(){o[jQuery(this).attr("data-name")]=jQuery(this).val()}),s[l]=new Object,s[l].val=t,s[l].style=o,l++,o=getMarkerStyle(o),$.each(r,function(e,r){r.eachLayer(function(e){"nr"==a?between(e.feature.properties[n],t)&&e.setIcon(L.AwesomeMarkers.icon(o)):"g"==a&&e.feature.properties[n]==t&&e.setIcon(L.AwesomeMarkers.icon(o))})})}),"undefined"==typeof selectedLayers[t].style.custom&&(selectedLayers[t].style.custom=new Object),selectedLayers[t].style.custom=s,selectedLayers[t].style.type=a,selectedLayers[t].style.field=n}),e.style.marker&&"undefined"!=typeof e.style.marker&&(jQuery('#layer-marker-styling select[name="marker_color"]').val(e.style.marker.markerColor),jQuery('#layer-marker-styling select[name="marker_icon"]').val(e.style.marker.icon))}jQuery("#cs-layer-info input").change(function(){var e=jQuery(this),t=jQuery('#map-sidebar-container [name="my_unique_id"]').val(),r=getIndex(selectedLayers,"unique_id",t);selectedLayers[r][e.attr("name")]=e.val(),jQuery("#at-"+selectedLayers[r].unique_id+" span.at-text").html(selectedLayers[r].name)}),3==e.type&&(autocomplete=new google.maps.places.Autocomplete(document.getElementById("autoFillAddress"),{types:["geocode"]}),google.maps.event.addListener(autocomplete,"place_changed",function(e){lat=autocomplete.getPlace().geometry.location.lat(),lng=autocomplete.getPlace().geometry.location.lng();var t=jQuery("#style_settings_form").find('[name="my_unique_id"]').val(),r=getIndex(selectedLayers,"unique_id",t);selectedLayers[r].layer.setLatLng([lat,lng]),selectedLayers[r].location=jQuery("#autoFillAddress").val(),mymap.setView([lat,lng],mymap.getZoom())}))}function tipButtonsclick(e){var t=void 0;return $(".leaflet-draw-actions").each(function(e){"block"==$(this).css("display")&&(t=$(this))}),t&&t.find("a")[e].click(),!1}function getDetailsByType(e,t,r,n,a){var o=[],s=e.length;for(i=0;i"'`=\/]/g,function(e){return v[e]})}function l(t,r){function a(){if(g&&!v)for(;h.length;)delete f[h.pop()];else h=[];g=!1,v=!1}function o(e){if("string"==typeof e&&(e=e.split(_,2)),!m(e)||2!==e.length)throw new Error("Invalid tags: "+e);s=new RegExp(n(e[0])+"\\s*"),l=new RegExp("\\s*"+n(e[1])),d=new RegExp("\\s*"+n("}"+e[1]))}if(!t)return[];var s,l,d,p=[],f=[],h=[],g=!1,v=!1;o(r||e.tags);for(var Q,x,k,M,q,S,I=new y(t);!I.eos();){if(Q=I.pos,k=I.scanUntil(s))for(var C=0,T=k.length;C0?o[o.length-1][4]:n;break;default:a.push(t)}return n}function y(e){this.string=e,this.tail=e,this.pos=0}function d(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function p(){this.cache={}}var f=Object.prototype.toString,m=Array.isArray||function(e){return"[object Array]"===f.call(e)},h=RegExp.prototype.test,g=/\S/,v={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},L=/\s*/,_=/\s+/,b=/\s*=/,j=/\s*\}/,w=/#|\^|\/|>|\{|&|=|!/;y.prototype.eos=function(){return""===this.tail},y.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var r=t[0];return this.tail=this.tail.substring(r.length),this.pos+=r.length,r},y.prototype.scanUntil=function(e){var t,r=this.tail.search(e);switch(r){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,r),this.tail=this.tail.substring(r)}return this.pos+=t.length,t},d.prototype.push=function(e){return new d(e,this)},d.prototype.lookup=function(e){var r,n=this.cache;if(n.hasOwnProperty(e))r=n[e];else{for(var o,i,s=this,l=!1;s;){if(e.indexOf(".")>0)for(r=s.view,o=e.split("."),i=0;null!=r&&i"===o?i=this.renderPartial(a,t,r,n):"&"===o?i=this.unescapedValue(a,t):"name"===o?i=this.escapedValue(a,t):"text"===o&&(i=this.rawValue(a)),void 0!==i&&(s+=i);return s},p.prototype.renderSection=function(e,r,n,a){function o(e){return i.render(e,r,n)}var i=this,s="",l=r.lookup(e[1]);if(l){if(m(l))for(var u=0,c=l.length;u=0&&i>o;o+=e){var s=a?a[o]:o;n=r(n,t[s],s,t)}return n}return function(r,n,a,o){n=L(n,o,4);var i=!k(r)&&v.keys(r),s=(i||r).length,l=e>0?0:s-1;return arguments.length<3&&(a=r[i?i[l]:l],l+=e),t(r,n,a,i,l,s)}}function t(e){return function(t,r,n){r=_(r,n);for(var a=x(t),o=e>0?0:a-1;o>=0&&a>o;o+=e)if(r(t[o],o,t))return o;return-1}}function r(e,t,r){return function(n,a,o){var i=0,s=x(n);if("number"==typeof o)e>0?i=o>=0?o:Math.max(o+s,i):s=o>=0?Math.min(o+1,s):o+s+1;else if(r&&o&&s)return o=r(n,a),n[o]===a?o:-1;if(a!==a)return o=t(c.call(n,i,s),v.isNaN),o>=0?o+i:-1;for(o=e>0?i:s-1;o>=0&&s>o;o+=e)if(n[o]===a)return o;return-1}}function n(e,t){var r=C.length,n=e.constructor,a=v.isFunction(n)&&n.prototype||s,o="constructor";for(v.has(e,o)&&!v.contains(t,o)&&t.push(o);r--;)o=C[r],o in e&&e[o]!==a[o]&&!v.contains(t,o)&&t.push(o)}var a=this,o=a._,i=Array.prototype,s=Object.prototype,l=Function.prototype,u=i.push,c=i.slice,y=s.toString,d=s.hasOwnProperty,p=Array.isArray,f=Object.keys,m=l.bind,h=Object.create,g=function(){},v=function(e){return e instanceof v?e:this instanceof v?void(this._wrapped=e):new v(e)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=v),exports._=v):a._=v,v.VERSION="1.8.3";var L=function(e,t,r){if(void 0===t)return e;switch(null==r?3:r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,a){return e.call(t,r,n,a)};case 4:return function(r,n,a,o){return e.call(t,r,n,a,o)}}return function(){return e.apply(t,arguments)}},_=function(e,t,r){return null==e?v.identity:v.isFunction(e)?L(e,t,r):v.isObject(e)?v.matcher(e):v.property(e)};v.iteratee=function(e,t){return _(e,t,1/0)};var b=function(e,t){return function(r){var n=arguments.length;if(2>n||null==r)return r;for(var a=1;n>a;a++)for(var o=arguments[a],i=e(o),s=i.length,l=0;s>l;l++){var u=i[l];t&&void 0!==r[u]||(r[u]=o[u])}return r}},j=function(e){if(!v.isObject(e))return{};if(h)return h(e);g.prototype=e;var t=new g;return g.prototype=null,t},w=function(e){return function(t){return null==t?void 0:t[e]}},Q=Math.pow(2,53)-1,x=w("length"),k=function(e){var t=x(e);return"number"==typeof t&&t>=0&&Q>=t};v.each=v.forEach=function(e,t,r){t=L(t,r);var n,a;if(k(e))for(n=0,a=e.length;a>n;n++)t(e[n],n,e);else{var o=v.keys(e);for(n=0,a=o.length;a>n;n++)t(e[o[n]],o[n],e)}return e},v.map=v.collect=function(e,t,r){t=_(t,r);for(var n=!k(e)&&v.keys(e),a=(n||e).length,o=Array(a),i=0;a>i;i++){var s=n?n[i]:i;o[i]=t(e[s],s,e)}return o},v.reduce=v.foldl=v.inject=e(1),v.reduceRight=v.foldr=e(-1),v.find=v.detect=function(e,t,r){var n;return n=k(e)?v.findIndex(e,t,r):v.findKey(e,t,r),void 0!==n&&n!==-1?e[n]:void 0},v.filter=v.select=function(e,t,r){var n=[];return t=_(t,r),v.each(e,function(e,r,a){t(e,r,a)&&n.push(e)}),n},v.reject=function(e,t,r){return v.filter(e,v.negate(_(t)),r)},v.every=v.all=function(e,t,r){t=_(t,r);for(var n=!k(e)&&v.keys(e),a=(n||e).length,o=0;a>o;o++){var i=n?n[o]:o;if(!t(e[i],i,e))return!1}return!0},v.some=v.any=function(e,t,r){t=_(t,r);for(var n=!k(e)&&v.keys(e),a=(n||e).length,o=0;a>o;o++){var i=n?n[o]:o;if(t(e[i],i,e))return!0}return!1},v.contains=v.includes=v.include=function(e,t,r,n){return k(e)||(e=v.values(e)),("number"!=typeof r||n)&&(r=0),v.indexOf(e,t,r)>=0},v.invoke=function(e,t){var r=c.call(arguments,2),n=v.isFunction(t);return v.map(e,function(e){var a=n?t:e[t];return null==a?a:a.apply(e,r)})},v.pluck=function(e,t){return v.map(e,v.property(t))},v.where=function(e,t){return v.filter(e,v.matcher(t))},v.findWhere=function(e,t){return v.find(e,v.matcher(t))},v.max=function(e,t,r){var n,a,o=-1/0,i=-1/0;if(null==t&&null!=e){e=k(e)?e:v.values(e);for(var s=0,l=e.length;l>s;s++)n=e[s],n>o&&(o=n)}else t=_(t,r),v.each(e,function(e,r,n){a=t(e,r,n),(a>i||a===-1/0&&o===-1/0)&&(o=e,i=a)});return o},v.min=function(e,t,r){var n,a,o=1/0,i=1/0;if(null==t&&null!=e){e=k(e)?e:v.values(e);for(var s=0,l=e.length;l>s;s++)n=e[s],o>n&&(o=n)}else t=_(t,r),v.each(e,function(e,r,n){a=t(e,r,n),(i>a||1/0===a&&1/0===o)&&(o=e,i=a)});return o},v.shuffle=function(e){for(var t,r=k(e)?e:v.values(e),n=r.length,a=Array(n),o=0;n>o;o++)t=v.random(0,o),t!==o&&(a[o]=a[t]),a[t]=r[o];return a},v.sample=function(e,t,r){return null==t||r?(k(e)||(e=v.values(e)),e[v.random(e.length-1)]):v.shuffle(e).slice(0,Math.max(0,t))},v.sortBy=function(e,t,r){return t=_(t,r),v.pluck(v.map(e,function(e,r,n){return{value:e,index:r,criteria:t(e,r,n)}}).sort(function(e,t){var r=e.criteria,n=t.criteria;if(r!==n){if(r>n||void 0===r)return 1;if(n>r||void 0===n)return-1}return e.index-t.index}),"value")};var M=function(e){return function(t,r,n){var a={};return r=_(r,n),v.each(t,function(n,o){var i=r(n,o,t);e(a,n,i)}),a}};v.groupBy=M(function(e,t,r){v.has(e,r)?e[r].push(t):e[r]=[t]}),v.indexBy=M(function(e,t,r){e[r]=t}),v.countBy=M(function(e,t,r){v.has(e,r)?e[r]++:e[r]=1}),v.toArray=function(e){return e?v.isArray(e)?c.call(e):k(e)?v.map(e,v.identity):v.values(e):[]},v.size=function(e){return null==e?0:k(e)?e.length:v.keys(e).length},v.partition=function(e,t,r){t=_(t,r);var n=[],a=[];return v.each(e,function(e,r,o){(t(e,r,o)?n:a).push(e)}),[n,a]},v.first=v.head=v.take=function(e,t,r){return null==e?void 0:null==t||r?e[0]:v.initial(e,e.length-t)},v.initial=function(e,t,r){return c.call(e,0,Math.max(0,e.length-(null==t||r?1:t)))},v.last=function(e,t,r){return null==e?void 0:null==t||r?e[e.length-1]:v.rest(e,Math.max(0,e.length-t))},v.rest=v.tail=v.drop=function(e,t,r){return c.call(e,null==t||r?1:t)},v.compact=function(e){return v.filter(e,v.identity)};var q=function(e,t,r,n){for(var a=[],o=0,i=n||0,s=x(e);s>i;i++){var l=e[i];if(k(l)&&(v.isArray(l)||v.isArguments(l))){t||(l=q(l,t,r));var u=0,c=l.length;for(a.length+=c;c>u;)a[o++]=l[u++]}else r||(a[o++]=l)}return a};v.flatten=function(e,t){return q(e,t,!1)},v.without=function(e){return v.difference(e,c.call(arguments,1))},v.uniq=v.unique=function(e,t,r,n){v.isBoolean(t)||(n=r,r=t,t=!1),null!=r&&(r=_(r,n));for(var a=[],o=[],i=0,s=x(e);s>i;i++){var l=e[i],u=r?r(l,i,e):l;t?(i&&o===u||a.push(l),o=u):r?v.contains(o,u)||(o.push(u),a.push(l)):v.contains(a,l)||a.push(l)}return a},v.union=function(){return v.uniq(q(arguments,!0,!0))},v.intersection=function(e){for(var t=[],r=arguments.length,n=0,a=x(e);a>n;n++){var o=e[n];if(!v.contains(t,o)){for(var i=1;r>i&&v.contains(arguments[i],o);i++);i===r&&t.push(o)}}return t},v.difference=function(e){var t=q(arguments,!0,!0,1);return v.filter(e,function(e){return!v.contains(t,e)})},v.zip=function(){return v.unzip(arguments)},v.unzip=function(e){for(var t=e&&v.max(e,x).length||0,r=Array(t),n=0;t>n;n++)r[n]=v.pluck(e,n);return r},v.object=function(e,t){for(var r={},n=0,a=x(e);a>n;n++)t?r[e[n]]=t[n]:r[e[n][0]]=e[n][1];return r},v.findIndex=t(1),v.findLastIndex=t(-1),v.sortedIndex=function(e,t,r,n){r=_(r,n,1);for(var a=r(t),o=0,i=x(e);i>o;){var s=Math.floor((o+i)/2);r(e[s])o;o++,e+=r)a[o]=e;return a};var S=function(e,t,r,n,a){if(!(n instanceof t))return e.apply(r,a);var o=j(e.prototype),i=e.apply(o,a);return v.isObject(i)?i:o};v.bind=function(e,t){if(m&&e.bind===m)return m.apply(e,c.call(arguments,1));if(!v.isFunction(e))throw new TypeError("Bind must be called on a function");var r=c.call(arguments,2),n=function(){return S(e,n,t,this,r.concat(c.call(arguments)))};return n},v.partial=function(e){var t=c.call(arguments,1),r=function(){for(var n=0,a=t.length,o=Array(a),i=0;a>i;i++)o[i]=t[i]===v?arguments[n++]:t[i];for(;n=n)throw new Error("bindAll must be passed function names");for(t=1;n>t;t++)r=arguments[t],e[r]=v.bind(e[r],e);return e},v.memoize=function(e,t){var r=function(n){var a=r.cache,o=""+(t?t.apply(this,arguments):n);return v.has(a,o)||(a[o]=e.apply(this,arguments)),a[o]};return r.cache={},r},v.delay=function(e,t){var r=c.call(arguments,2);return setTimeout(function(){return e.apply(null,r)},t)},v.defer=v.partial(v.delay,v,1),v.throttle=function(e,t,r){var n,a,o,i=null,s=0;r||(r={});var l=function(){s=r.leading===!1?0:v.now(),i=null,o=e.apply(n,a),i||(n=a=null)};return function(){var u=v.now();s||r.leading!==!1||(s=u);var c=t-(u-s);return n=this,a=arguments,0>=c||c>t?(i&&(clearTimeout(i),i=null),s=u,o=e.apply(n,a),i||(n=a=null)):i||r.trailing===!1||(i=setTimeout(l,c)),o}},v.debounce=function(e,t,r){var n,a,o,i,s,l=function(){var u=v.now()-i;t>u&&u>=0?n=setTimeout(l,t-u):(n=null,r||(s=e.apply(o,a),n||(o=a=null)))};return function(){o=this,a=arguments,i=v.now();var u=r&&!n;return n||(n=setTimeout(l,t)),u&&(s=e.apply(o,a),o=a=null),s}},v.wrap=function(e,t){return v.partial(t,e)},v.negate=function(e){return function(){return!e.apply(this,arguments)}},v.compose=function(){var e=arguments,t=e.length-1;return function(){for(var r=t,n=e[t].apply(this,arguments);r--;)n=e[r].call(this,n);return n}},v.after=function(e,t){return function(){return--e<1?t.apply(this,arguments):void 0}},v.before=function(e,t){var r;return function(){return--e>0&&(r=t.apply(this,arguments)),1>=e&&(t=null),r}},v.once=v.partial(v.before,2);var I=!{toString:null}.propertyIsEnumerable("toString"),C=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];v.keys=function(e){if(!v.isObject(e))return[];if(f)return f(e);var t=[];for(var r in e)v.has(e,r)&&t.push(r);return I&&n(e,t),t},v.allKeys=function(e){if(!v.isObject(e))return[];var t=[];for(var r in e)t.push(r);return I&&n(e,t),t},v.values=function(e){for(var t=v.keys(e),r=t.length,n=Array(r),a=0;r>a;a++)n[a]=e[t[a]];return n},v.mapObject=function(e,t,r){t=_(t,r);for(var n,a=v.keys(e),o=a.length,i={},s=0;o>s;s++)n=a[s],i[n]=t(e[n],n,e);return i},v.pairs=function(e){for(var t=v.keys(e),r=t.length,n=Array(r),a=0;r>a;a++)n[a]=[t[a],e[t[a]]];return n},v.invert=function(e){for(var t={},r=v.keys(e),n=0,a=r.length;a>n;n++)t[e[r[n]]]=r[n];return t},v.functions=v.methods=function(e){var t=[];for(var r in e)v.isFunction(e[r])&&t.push(r);return t.sort()},v.extend=b(v.allKeys),v.extendOwn=v.assign=b(v.keys),v.findKey=function(e,t,r){t=_(t,r);for(var n,a=v.keys(e),o=0,i=a.length;i>o;o++)if(n=a[o],t(e[n],n,e))return n},v.pick=function(e,t,r){var n,a,o={},i=e;if(null==i)return o;v.isFunction(t)?(a=v.allKeys(i),n=L(t,r)):(a=q(arguments,!1,!1,1),n=function(e,t,r){return t in r},i=Object(i));for(var s=0,l=a.length;l>s;s++){var u=a[s],c=i[u];n(c,u,i)&&(o[u]=c)}return o},v.omit=function(e,t,r){if(v.isFunction(t))t=v.negate(t);else{var n=v.map(q(arguments,!1,!1,1),String);t=function(e,t){return!v.contains(n,t)}}return v.pick(e,t,r)},v.defaults=b(v.allKeys,!0),v.create=function(e,t){var r=j(e);return t&&v.extendOwn(r,t),r},v.clone=function(e){return v.isObject(e)?v.isArray(e)?e.slice():v.extend({},e):e},v.tap=function(e,t){return t(e),e},v.isMatch=function(e,t){var r=v.keys(t),n=r.length;if(null==e)return!n;for(var a=Object(e),o=0;n>o;o++){var i=r[o];if(t[i]!==a[i]||!(i in a))return!1}return!0};var T=function(e,t,r,n){if(e===t)return 0!==e||1/e===1/t;if(null==e||null==t)return e===t;e instanceof v&&(e=e._wrapped),t instanceof v&&(t=t._wrapped);var a=y.call(e);if(a!==y.call(t))return!1;switch(a){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!==+e?+t!==+t:0===+e?1/+e===1/t:+e===+t;case"[object Date]":case"[object Boolean]":return+e===+t}var o="[object Array]"===a;if(!o){if("object"!=typeof e||"object"!=typeof t)return!1;var i=e.constructor,s=t.constructor;if(i!==s&&!(v.isFunction(i)&&i instanceof i&&v.isFunction(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}r=r||[],n=n||[];for(var l=r.length;l--;)if(r[l]===e)return n[l]===t;if(r.push(e),n.push(t),o){if(l=e.length,l!==t.length)return!1;for(;l--;)if(!T(e[l],t[l],r,n))return!1}else{var u,c=v.keys(e);if(l=c.length,v.keys(t).length!==l)return!1;for(;l--;)if(u=c[l],!v.has(t,u)||!T(e[u],t[u],r,n))return!1}return r.pop(),n.pop(),!0};v.isEqual=function(e,t){return T(e,t)},v.isEmpty=function(e){return null==e||(k(e)&&(v.isArray(e)||v.isString(e)||v.isArguments(e))?0===e.length:0===v.keys(e).length)},v.isElement=function(e){return!(!e||1!==e.nodeType)},v.isArray=p||function(e){return"[object Array]"===y.call(e)},v.isObject=function(e){var t=typeof e;return"function"===t||"object"===t&&!!e},v.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(e){v["is"+e]=function(t){return y.call(t)==="[object "+e+"]"}}),v.isArguments(arguments)||(v.isArguments=function(e){return v.has(e,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(v.isFunction=function(e){return"function"==typeof e||!1}),v.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},v.isNaN=function(e){return v.isNumber(e)&&e!==+e},v.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"===y.call(e)},v.isNull=function(e){return null===e},v.isUndefined=function(e){return void 0===e},v.has=function(e,t){return null!=e&&d.call(e,t)},v.noConflict=function(){return a._=o,this},v.identity=function(e){return e},v.constant=function(e){return function(){return e}},v.noop=function(){},v.property=w,v.propertyOf=function(e){return null==e?function(){}:function(t){return e[t]}},v.matcher=v.matches=function(e){return e=v.extendOwn({},e),function(t){return v.isMatch(t,e)}},v.times=function(e,t,r){var n=Array(Math.max(0,e));t=L(t,r,1);for(var a=0;e>a;a++)n[a]=t(a);return n},v.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},v.now=Date.now||function(){return(new Date).getTime()};var B={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},F=v.invert(B),O=function(e){var t=function(t){return e[t]},r="(?:"+v.keys(e).join("|")+")",n=RegExp(r),a=RegExp(r,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(a,t):e}};v.escape=O(B),v.unescape=O(F),v.result=function(e,t,r){var n=null==e?void 0:e[t];return void 0===n&&(n=r),v.isFunction(n)?n.call(e):n};var E=0;v.uniqueId=function(e){var t=++E+"";return e?e+t:t},v.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var A=/(.)^/,$={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},G=/\\|'|\r|\n|\u2028|\u2029/g,P=function(e){return"\\"+$[e]};v.template=function(e,t,r){!t&&r&&(t=r),t=v.defaults({},t,v.templateSettings);var n=RegExp([(t.escape||A).source,(t.interpolate||A).source,(t.evaluate||A).source].join("|")+"|$","g"),a=0,o="__p+='";e.replace(n,function(t,r,n,i,s){return o+=e.slice(a,s).replace(G,P),a=s+t.length,r?o+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":n?o+="'+\n((__t=("+n+"))==null?'':__t)+\n'":i&&(o+="';\n"+i+"\n__p+='"),t}),o+="';\n",t.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var i=new Function(t.variable||"obj","_",o)}catch(s){throw s.source=o,s}var l=function(e){return i.call(this,e,v)},u=t.variable||"obj";return l.source="function("+u+"){\n"+o+"}",l},v.chain=function(e){var t=v(e);return t._chain=!0,t};var D=function(e,t){return e._chain?v(t).chain():t};v.mixin=function(e){v.each(v.functions(e),function(t){var r=v[t]=e[t];v.prototype[t]=function(){var e=[this._wrapped];return u.apply(e,arguments),D(this,r.apply(v,e))}})},v.mixin(v),v.each(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=i[e];v.prototype[e]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!==e&&"splice"!==e||0!==r.length||delete r[0],D(this,r)}}),v.each(["concat","join","slice"],function(e){var t=i[e];v.prototype[e]=function(){return D(this,t.apply(this._wrapped,arguments))}}),v.prototype.value=function(){return this._wrapped},v.prototype.valueOf=v.prototype.toJSON=v.prototype.value,v.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return v})}.call(this),jQuery(document).ready(function(){L.TileLayer.BetterWMS=L.TileLayer.WMS.extend({onAdd:function(e){L.TileLayer.WMS.prototype.onAdd.call(this,e),e.on("click",this.getFeatureInfo,this)},onRemove:function(e){L.TileLayer.WMS.prototype.onRemove.call(this,e),e.off("click",this.getFeatureInfo,this)},getFeatureInfo:function(e){var t=this.getFeatureInfoUrl(e.latlng),r=L.Util.bind(this.showGetFeatureInfo,this);$.ajax({url:t,success:function(t,n,a){var o="string"==typeof t?null:t;r(o,e.latlng,t)},error:function(e,t,n){r(n)}})},getFeatureInfoUrl:function(e){var t=this._map.latLngToContainerPoint(e,this._map.getZoom()),r=this._map.getSize(),n=this.wmsParams.layer_type,a="application/json";4==n&&(a="text/html");var o={request:"GetFeatureInfo",service:"WMS",srs:"EPSG:4326",styles:this.wmsParams.styles,transparent:this.wmsParams.transparent,version:this.wmsParams.version,format:this.wmsParams.format,height:r.y,width:r.x,layers:this.wmsParams.layers,query_layers:this.wmsParams.layers,info_format:a};return o["1.3.0"===o.version?"i":"x"]=t.x,o["1.3.0"===o.version?"j":"y"]=t.y,this._url+L.Util.getParamString(o,this._url,!0)},showGetFeatureInfo:function(e,t,r){var n=getIndex(selectedLayers,"unique_id",this.wmsParams.unique_id),a="";if(1==selectedLayers[n].type){if(!r.features||0==r.features.length)return; a=getPopupContent(r,selectedLayers[n].pc)}else{if(jQuery(r).find("tr").length<2)return;a=r}L.popup({maxWidth:"auto"}).setLatLng(t).setContent(a).openOn(this._map)}}),L.tileLayer.betterWms=function(e,t){return new L.TileLayer.BetterWMS(e,t)},L.Icon.Default.imagePath=baseURL+"/assets/plugins/leaflet/images",L.AwesomeMarkers.Icon.prototype.options.prefix="fa"});var pgsql_tmpl,featureGroup=new Array,bounds,layerSelector=new Array,overlays=new Array,mymap,currentBaseMap=new Array,marker_content_tmpl,popupContentId=new Array,tmpl={},db={},table_tmpl=document.getElementById("table-tmpl").innerHTML;Mustache.parse(table_tmpl);var column_tmpl=document.getElementById("column-tmpl").innerHTML;Mustache.parse(column_tmpl);var currentIndex=-1,drawingGroup,editMode=!1;jQuery(document).ready(function(){$.fn.button.Constructor.DEFAULTS={loadingText:' Processing...…'},$(".gs-collapse").on("expanded",function(){var e=jQuery(this);getGeoLayer(e,"gs")}),$(".wms-collapse").on("expanded",function(){var e=jQuery(this);getGeoLayer(e,"wms")}),drawingGroup=new L.FeatureGroup,marker_content_tmpl=document.getElementById("marker-content-tmpl").innerHTML,Mustache.parse(marker_content_tmpl),tmpl.activeLayer=document.getElementById("active-layers-tmpl").innerHTML,Mustache.parse(tmpl.activeLayer),defaultSettings();var e=new L.Control.Draw({edit:{featureGroup:drawingGroup}});mymap=L.map("mapid",{}).setView([51.505,-.09],13),e.addTo(mymap),drawingGroup.addTo(mymap),drawing_event(),selectedBaseLayers.length>0?layername=selectedBaseLayers[0].name:$.each(baseLayers.mymap,function(e,t){layername=e}),$("#share-modal").on("shown.bs.modal",function(){var e=baseURL;map.settings.https||1==map.settings.https||(e=baseURL.replace("s://","://"));var t='';jQuery("#ds_iframe_code").val(t),jQuery("#ds_share_url").val(e+"map/share/"+map.random_token),jQuery("#ds_json_url").val(e+"map/json/"+map.random_token)}),currentBaseMap=isGoogle()?L.tileLayer("https://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}",{maxZoom:20,subdomains:["mt0","mt1","mt2","mt3"]}).addTo(mymap):L.tileLayer(baseLayers.mymap[layername]._url,{maxZoom:18,attribution:baseLayers.mymap[layername].options.attribution,id:baseLayers.mymap[layername].options.id}).addTo(mymap),layerSelector=L.control.layers({},{}),mymap.on("baselayerchange",function(e,t){}),mymap.addControl(layerSelector),jQuery("#active-layers-container").on("click",".delete-at-layer",function(){var e=jQuery(this);swal({title:"Are you sure?",text:"This will remove layer from current map.",type:"warning",showCancelButton:!0,confirmButtonColor:"#DD6B55",confirmButtonText:"Yes, delete it!",cancelButtonText:"No, cancel plx!",closeOnConfirm:!0,closeOnCancel:!0},function(t){if(t){var r=e.parents("ul:first").attr("data-id");deleteLayer(r)}})}),jQuery("#active-layers-container").on("click",".geometry-area-limit",function(){var e=jQuery(this),t=e.parents("ul:first").attr("data-id"),r=document.getElementById("geometry-area-limit-tmpl").innerHTML;Mustache.parse(r);var n=getIndex(selectedLayers,"unique_id",t),a=_.filter(selectedLayers,function(e){return 2==e.type||3==e.type});jQuery("#geometry-area-limit-form-body").html(Mustache.render(r,{unique_id:t,t:n,f:a})),jQuery("#geometry-area-limit-modal").modal("show"),validateForm(jQuery("#geometry-area-limit-form")),jQuery("#geometry_area_dd").click(function(){var e=(jQuery(this).val(),jQuery(this).val()),e=document.getElementById(e).innerHTML;Mustache.parse(e),jQuery("#geometry-type-render-container").html(Mustache.render(e))}),jQuery("#geometry-area-limit-submit").unbind("click"),jQuery("#geometry-area-limit-submit").click(function(){var e=jQuery("#geometry-area-limit-form");if(e.validate().form()){var t=e.find('[name="unique_id"]').val(),r=getIndex(selectedLayers,"unique_id",t),n=e.find('[name="geometry_area"]').val();if("custom"==n){var a=getIndex(selectedLayers,"unique_id",n);selectedLayers[r].geometry_area=jQuery("#custom_geometry_area").val()}else{var a=getIndex(selectedLayers,"unique_id",n);2==selectedLayers[a].type?ajaxRequest("developer/map/get/wkt","post","json",{data:selectedLayers[a],_token:jQuery('[name="_token"]').val()},function(e){if(200==e.status){getIndex(selectedLayers,"unique_id",e.unique_id);selectedLayers[r].geometry_area=e.wkt,jQuery("#geometry-area-limit-modal").modal("hide")}else showMsg("error",e.msg)}):(selectedLayers[r].geometry_area=toWKT(selectedLayers[a].layer),jQuery("#geometry-area-limit-modal").modal("hide"))}}})}),jQuery("#active-layers-container").on("click",".edit-at-layer",function(){var e=jQuery(this),t=e.parents("ul:first").attr("data-id");editATLayer(t)}),jQuery("#active-layers-container").on("click",".edit-query-at-layer",function(){var e=jQuery(this),t=e.parents("ul:first").attr("data-id");editSQLATLayer(t)}),jQuery("#active-layers-container").on("click",".cache-at-layer",function(){var e=jQuery(this),t=e.parents("ul:first").attr("data-id");editCacheLayer(t)}),jQuery("#active-layers-container").on("click",".style-at-layer",function(e){var t=jQuery(this),r=t.parents("ul:first").attr("data-id");editStyleLayer(r)}),jQuery("#cache-settings-modal").on("click","#cache-settings-save-btn",function(e){e.preventDefault();var t=jQuery("#cache_settings_form");if(t.validate().form()){var r=t.find('[name="unique_id"]').val(),n=getIndex(selectedLayers,"unique_id",r),a=t.find('[name="cache_timer"]').val();selectedLayers[n].cache_timer=a,jQuery("#cahe-settings-modal").modal("hide"),saveMapData("settings",function(){showMsg("success","Cache settings save successfully.")})}}),jQuery("#layer-tmpl").change(function(){var e=jQuery(this).val(),e=document.getElementById(e).innerHTML;Mustache.parse(e),jQuery("#layer-render-tmpl").html(Mustache.render(e))}),jQuery(".layer_chk").change(function(){var e=jQuery(this);WMSLayers(e,!0)}),jQuery("#layer-submit").click(function(){var e=jQuery("#layer-form").serialize();ajaxRequest("/developer/connection/save","post","json",e,function(e){if(200==e.status&&""==e.table_name){var t=document.getElementById("table-tmpl").innerHTML;Mustache.parse(t),jQuery("#tables_div").html(Mustache.render(t,{tables:e.result}))}else 200==e.status&&""!=e.table_name&&(jQuery.each(e.result,function(e,t){featureGroup=new L.FeatureGroup,featureGroup.addTo(mymap),L.geoJson(t,{onEachFeature:function(e,t){}}).addTo(featureGroup),mymap.fitBounds(featureGroup.getBounds())}),jQuery("#layer-modal").modal("hide"))})}),jQuery("#save-your-map").click(function(e){e.preventDefault();var t=jQuery(this);t.button("loading"),saveMapData("map",function(e){t.button("reset"),window.location=baseURL+"/developer/map/edit/"+e.map_id})}),jQuery(".close-right-sidebar").click(function(){jQuery(".sidebar_hide").hasClass("hide")&&(jQuery(".sidebar_hide").toggleClass("hide"),jQuery(".control-sidebar").toggleClass("control-sidebar-open"))}),jQuery("#settings-menu-open").click(function(e){e.stopPropagation(),e.preventDefault();var t=document.getElementById("map-settings-sidebar-tmpl").innerHTML;Mustache.parse(t),jQuery("#map-sidebar-container").html(Mustache.render(t,{}));var r=document.getElementById("map-settings-tmpl").innerHTML;Mustache.parse(r),jQuery("#setting_tab_2").html(Mustache.render(r,{settings:map.settings,bg_layers:bglayersrow})),"undefined"!=typeof map.settings.base_layer&&jQuery("#map_base_layers").val(map.settings.base_layer),jQuery(".sidebar_hide").hasClass("hide")||(jQuery(".sidebar_hide").toggleClass("hide"),jQuery(".control-sidebar").toggleClass("control-sidebar-open")),tinyMCEInit_Popup(".popup-content-textarea");var n=jQuery("#map-settings-form");validateForm(n),map.settings.fullscreen&&1==map.settings.fullscreen&&n.find('[name="fullscreen"]').prop("checked",!0),map.settings.https&&1==map.settings.https&&n.find('[name="https"]').prop("checked",!0),jQuery(".map_settings_chk").bootstrapSwitch({size:"small"})}),jQuery(".control-sidebar").on("click","#save-settings-btn",function(e){if(jQuery("#map-settings-form").validate().form()){e.preventDefault();var t=jQuery(this);t.button("loading"),saveMapData("settings",function(e){t.button("reset"),map.settings=e.settings,showMsg("success","Settings saved successfully.")})}}),jQuery(".control-sidebar").on("click",".save-settings",function(e){e.preventDefault();var t=jQuery(this);jQuery("#style_settings_form").validate().form()&&(t.button("loading"),saveMapData("style",function(e){t.button("reset"),showMsg("success","Style saved successfully.")}))}),jQuery(".control-sidebar").on("click","#save_popup_content",function(){var e=jQuery("#layer-form").serialize();ajaxRequest("/developer/map/save","post","json",e,function(e){200==e.status?(jQuery("#map_id").val(e.map_id),window.location=baseURL+"/developer/map/edit/"+e.map_id):showMsg("error",e.msg)})}),sqlFormEvent(),assingSettings()}),jQuery(document).ready(function(){jQuery("#main-loader").removeClass("hide"),initLayer(),$('input[type="checkbox"].bg_layer_chk').each(function(){jQuery(this).bootstrapSwitch({size:"mini",onSwitchChange:function(e,t){e.preventDefault();var r=jQuery(e.target);baseLayerMap(r,!0)}})}),jQuery(".make-switch").bootstrapSwitch({size:"mini"});var e=getDetailsByAttr(selectedLayers,"type",2);0==e.length&&ajaxLoadSucess()}).ajaxStop(function(){ajaxLoadSucess()});var sqlFormChange=!1,autocomplete,globalLastFileFormat="";