// source --> https://businessportal.bg/wp-content/plugins/geodirectory/assets/js/select2/select2.full.min.js?ver=4.0.4 
(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else if(typeof module==="object"&&module.exports){module.exports=function(root,jQuery){if(jQuery===undefined){if(typeof window!=="undefined"){jQuery=require("jquery")}else{jQuery=require("jquery")(root)}}factory(jQuery);return jQuery}}else{factory(jQuery)}})(function(jQuery){var S2=function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd){var S2=jQuery.fn.select2.amd}var S2;(function(){if(!S2||!S2.requirejs){if(!S2){S2={}}else{require=S2}var requirejs,require,define;(function(undef){var main,req,makeMap,handlers,defined={},waiting={},config={},defining={},hasOwn=Object.prototype.hasOwnProperty,aps=[].slice,jsSuffixRegExp=/\.js$/;function hasProp(obj,prop){return hasOwn.call(obj,prop)}function normalize(name,baseName){var nameParts,nameSegment,mapValue,foundMap,lastIndex,foundI,foundStarMap,starI,i,j,part,normalizedBaseParts,baseParts=baseName&&baseName.split("/"),map=config.map,starMap=map&&map["*"]||{};if(name){name=name.split("/");lastIndex=name.length-1;if(config.nodeIdCompat&&jsSuffixRegExp.test(name[lastIndex])){name[lastIndex]=name[lastIndex].replace(jsSuffixRegExp,"")}if(name[0].charAt(0)==="."&&baseParts){normalizedBaseParts=baseParts.slice(0,baseParts.length-1);name=normalizedBaseParts.concat(name)}for(i=0;i<name.length;i++){part=name[i];if(part==="."){name.splice(i,1);i-=1}else if(part===".."){if(i===0||i===1&&name[2]===".."||name[i-1]===".."){continue}else if(i>0){name.splice(i-1,2);i-=2}}}name=name.join("/")}if((baseParts||starMap)&&map){nameParts=name.split("/");for(i=nameParts.length;i>0;i-=1){nameSegment=nameParts.slice(0,i).join("/");if(baseParts){for(j=baseParts.length;j>0;j-=1){mapValue=map[baseParts.slice(0,j).join("/")];if(mapValue){mapValue=mapValue[nameSegment];if(mapValue){foundMap=mapValue;foundI=i;break}}}}if(foundMap){break}if(!foundStarMap&&starMap&&starMap[nameSegment]){foundStarMap=starMap[nameSegment];starI=i}}if(!foundMap&&foundStarMap){foundMap=foundStarMap;foundI=starI}if(foundMap){nameParts.splice(0,foundI,foundMap);name=nameParts.join("/")}}return name}function makeRequire(relName,forceSync){return function(){var args=aps.call(arguments,0);if(typeof args[0]!=="string"&&args.length===1){args.push(null)}return req.apply(undef,args.concat([relName,forceSync]))}}function makeNormalize(relName){return function(name){return normalize(name,relName)}}function makeLoad(depName){return function(value){defined[depName]=value}}function callDep(name){if(hasProp(waiting,name)){var args=waiting[name];delete waiting[name];defining[name]=true;main.apply(undef,args)}if(!hasProp(defined,name)&&!hasProp(defining,name)){throw new Error("No "+name)}return defined[name]}function splitPrefix(name){var prefix,index=name?name.indexOf("!"):-1;if(index>-1){prefix=name.substring(0,index);name=name.substring(index+1,name.length)}return[prefix,name]}function makeRelParts(relName){return relName?splitPrefix(relName):[]}makeMap=function(name,relParts){var plugin,parts=splitPrefix(name),prefix=parts[0],relResourceName=relParts[1];name=parts[1];if(prefix){prefix=normalize(prefix,relResourceName);plugin=callDep(prefix)}if(prefix){if(plugin&&plugin.normalize){name=plugin.normalize(name,makeNormalize(relResourceName))}else{name=normalize(name,relResourceName)}}else{name=normalize(name,relResourceName);parts=splitPrefix(name);prefix=parts[0];name=parts[1];if(prefix){plugin=callDep(prefix)}}return{f:prefix?prefix+"!"+name:name,n:name,pr:prefix,p:plugin}};function makeConfig(name){return function(){return config&&config.config&&config.config[name]||{}}}handlers={require:function(name){return makeRequire(name)},exports:function(name){var e=defined[name];if(typeof e!=="undefined"){return e}else{return defined[name]={}}},module:function(name){return{id:name,uri:"",exports:defined[name],config:makeConfig(name)}}};main=function(name,deps,callback,relName){var cjsModule,depName,ret,map,i,relParts,args=[],callbackType=typeof callback,usingExports;relName=relName||name;relParts=makeRelParts(relName);if(callbackType==="undefined"||callbackType==="function"){deps=!deps.length&&callback.length?["require","exports","module"]:deps;for(i=0;i<deps.length;i+=1){map=makeMap(deps[i],relParts);depName=map.f;if(depName==="require"){args[i]=handlers.require(name)}else if(depName==="exports"){args[i]=handlers.exports(name);usingExports=true}else if(depName==="module"){cjsModule=args[i]=handlers.module(name)}else if(hasProp(defined,depName)||hasProp(waiting,depName)||hasProp(defining,depName)){args[i]=callDep(depName)}else if(map.p){map.p.load(map.n,makeRequire(relName,true),makeLoad(depName),{});args[i]=defined[depName]}else{throw new Error(name+" missing "+depName)}}ret=callback?callback.apply(defined[name],args):undefined;if(name){if(cjsModule&&cjsModule.exports!==undef&&cjsModule.exports!==defined[name]){defined[name]=cjsModule.exports}else if(ret!==undef||!usingExports){defined[name]=ret}}}else if(name){defined[name]=callback}};requirejs=require=req=function(deps,callback,relName,forceSync,alt){if(typeof deps==="string"){if(handlers[deps]){return handlers[deps](callback)}return callDep(makeMap(deps,makeRelParts(callback)).f)}else if(!deps.splice){config=deps;if(config.deps){req(config.deps,config.callback)}if(!callback){return}if(callback.splice){deps=callback;callback=relName;relName=null}else{deps=undef}}callback=callback||function(){};if(typeof relName==="function"){relName=forceSync;forceSync=alt}if(forceSync){main(undef,deps,callback,relName)}else{setTimeout(function(){main(undef,deps,callback,relName)},4)}return req};req.config=function(cfg){return req(cfg)};requirejs._defined=defined;define=function(name,deps,callback){if(typeof name!=="string"){throw new Error("See almond README: incorrect module build, no module name")}if(!deps.splice){callback=deps;deps=[]}if(!hasProp(defined,name)&&!hasProp(waiting,name)){waiting[name]=[name,deps,callback]}};define.amd={jQuery:true}})();S2.requirejs=requirejs;S2.require=require;S2.define=define}})();S2.define("almond",function(){});S2.define("jquery",[],function(){var _$=jQuery||$;if(_$==null&&console&&console.error){console.error("Select2: An instance of jQuery or a jQuery-compatible library was not "+"found. Make sure that you are including jQuery before Select2 on your "+"web page.")}return _$});S2.define("select2/utils",["jquery"],function($){var Utils={};Utils.Extend=function(ChildClass,SuperClass){var __hasProp={}.hasOwnProperty;function BaseConstructor(){this.constructor=ChildClass}for(var key in SuperClass){if(__hasProp.call(SuperClass,key)){ChildClass[key]=SuperClass[key]}}BaseConstructor.prototype=SuperClass.prototype;ChildClass.prototype=new BaseConstructor;ChildClass.__super__=SuperClass.prototype;return ChildClass};function getMethods(theClass){var proto=theClass.prototype;var methods=[];for(var methodName in proto){var m=proto[methodName];if(typeof m!=="function"){continue}if(methodName==="constructor"){continue}methods.push(methodName)}return methods}Utils.Decorate=function(SuperClass,DecoratorClass){var decoratedMethods=getMethods(DecoratorClass);var superMethods=getMethods(SuperClass);function DecoratedClass(){var unshift=Array.prototype.unshift;var argCount=DecoratorClass.prototype.constructor.length;var calledConstructor=SuperClass.prototype.constructor;if(argCount>0){unshift.call(arguments,SuperClass.prototype.constructor);calledConstructor=DecoratorClass.prototype.constructor}calledConstructor.apply(this,arguments)}DecoratorClass.displayName=SuperClass.displayName;function ctr(){this.constructor=DecoratedClass}DecoratedClass.prototype=new ctr;for(var m=0;m<superMethods.length;m++){var superMethod=superMethods[m];DecoratedClass.prototype[superMethod]=SuperClass.prototype[superMethod]}var calledMethod=function(methodName){var originalMethod=function(){};if(methodName in DecoratedClass.prototype){originalMethod=DecoratedClass.prototype[methodName]}var decoratedMethod=DecoratorClass.prototype[methodName];return function(){var unshift=Array.prototype.unshift;unshift.call(arguments,originalMethod);return decoratedMethod.apply(this,arguments)}};for(var d=0;d<decoratedMethods.length;d++){var decoratedMethod=decoratedMethods[d];DecoratedClass.prototype[decoratedMethod]=calledMethod(decoratedMethod)}return DecoratedClass};var Observable=function(){this.listeners={}};Observable.prototype.on=function(event,callback){this.listeners=this.listeners||{};if(event in this.listeners){this.listeners[event].push(callback)}else{this.listeners[event]=[callback]}};Observable.prototype.trigger=function(event){var slice=Array.prototype.slice;var params=slice.call(arguments,1);this.listeners=this.listeners||{};if(params==null){params=[]}if(params.length===0){params.push({})}params[0]._type=event;if(event in this.listeners){this.invoke(this.listeners[event],slice.call(arguments,1))}if("*"in this.listeners){this.invoke(this.listeners["*"],arguments)}};Observable.prototype.invoke=function(listeners,params){for(var i=0,len=listeners.length;i<len;i++){listeners[i].apply(this,params)}};Utils.Observable=Observable;Utils.generateChars=function(length){var chars="";for(var i=0;i<length;i++){var randomChar=Math.floor(Math.random()*36);chars+=randomChar.toString(36)}return chars};Utils.bind=function(func,context){return function(){func.apply(context,arguments)}};Utils._convertData=function(data){for(var originalKey in data){var keys=originalKey.split("-");var dataLevel=data;if(keys.length===1){continue}for(var k=0;k<keys.length;k++){var key=keys[k];key=key.substring(0,1).toLowerCase()+key.substring(1);if(!(key in dataLevel)){dataLevel[key]={}}if(k==keys.length-1){dataLevel[key]=data[originalKey]}dataLevel=dataLevel[key]}delete data[originalKey]}return data};Utils.hasScroll=function(index,el){var $el=$(el);var overflowX=el.style.overflowX;var overflowY=el.style.overflowY;if(overflowX===overflowY&&(overflowY==="hidden"||overflowY==="visible")){return false}if(overflowX==="scroll"||overflowY==="scroll"){return true}return $el.innerHeight()<el.scrollHeight||$el.innerWidth()<el.scrollWidth};Utils.escapeMarkup=function(markup){var replaceMap={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};if(typeof markup!=="string"){return markup}return String(markup).replace(/[&<>"'\/\\]/g,function(match){return replaceMap[match]})};Utils.appendMany=function($element,$nodes){if($.fn.jquery.substr(0,3)==="1.7"){var $jqNodes=$();$.map($nodes,function(node){$jqNodes=$jqNodes.add(node)});$nodes=$jqNodes}$element.append($nodes)};Utils.__cache={};var id=0;Utils.GetUniqueElementId=function(element){var select2Id=element.getAttribute("data-select2-id");if(select2Id==null){if(element.id){select2Id=element.id;element.setAttribute("data-select2-id",select2Id)}else{element.setAttribute("data-select2-id",++id);select2Id=id.toString()}}return select2Id};Utils.StoreData=function(element,name,value){var id=Utils.GetUniqueElementId(element);if(!Utils.__cache[id]){Utils.__cache[id]={}}Utils.__cache[id][name]=value};Utils.GetData=function(element,name){var id=Utils.GetUniqueElementId(element);if(name){if(Utils.__cache[id]){if(Utils.__cache[id][name]!=null){return Utils.__cache[id][name]}return $(element).data(name)}return $(element).data(name)}else{return Utils.__cache[id]}};Utils.RemoveData=function(element){var id=Utils.GetUniqueElementId(element);if(Utils.__cache[id]!=null){delete Utils.__cache[id]}element.removeAttribute("data-select2-id")};return Utils});S2.define("select2/results",["jquery","./utils"],function($,Utils){function Results($element,options,dataAdapter){this.$element=$element;this.data=dataAdapter;this.options=options;Results.__super__.constructor.call(this)}Utils.Extend(Results,Utils.Observable);Results.prototype.render=function(){var $results=$('<ul class="select2-results__options" role="listbox"></ul>');if(this.options.get("multiple")){$results.attr("aria-multiselectable","true")}this.$results=$results;return $results};Results.prototype.clear=function(){this.$results.empty()};Results.prototype.displayMessage=function(params){var escapeMarkup=this.options.get("escapeMarkup");this.clear();this.hideLoading();var $message=$('<li role="alert" aria-live="assertive"'+' class="select2-results__option"></li>');var message=this.options.get("translations").get(params.message);$message.append(escapeMarkup(message(params.args)));$message[0].className+=" select2-results__message";this.$results.append($message)};Results.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()};Results.prototype.append=function(data){this.hideLoading();var $options=[];if(data.results==null||data.results.length===0){if(this.$results.children().length===0){this.trigger("results:message",{message:"noResults"})}return}data.results=this.sort(data.results);for(var d=0;d<data.results.length;d++){var item=data.results[d];var $option=this.option(item);$options.push($option)}this.$results.append($options)};Results.prototype.position=function($results,$dropdown){var $resultsContainer=$dropdown.find(".select2-results");$resultsContainer.append($results)};Results.prototype.sort=function(data){var sorter=this.options.get("sorter");return sorter(data)};Results.prototype.highlightFirstItem=function(){var $options=this.$results.find(".select2-results__option[aria-selected]");var $selected=$options.filter("[aria-selected=true]");if($selected.length>0){$selected.first().trigger("mouseenter")}else{$options.first().trigger("mouseenter")}this.ensureHighlightVisible()};Results.prototype.setClasses=function(){var self=this;this.data.current(function(selected){var selectedIds=$.map(selected,function(s){return s.id.toString()});var $options=self.$results.find(".select2-results__option[aria-selected]");$options.each(function(){var $option=$(this);var item=Utils.GetData(this,"data");var id=""+item.id;if(item.element!=null&&item.element.selected||item.element==null&&$.inArray(id,selectedIds)>-1){$option.attr("aria-selected","true")}else{$option.attr("aria-selected","false")}})})};Results.prototype.showLoading=function(params){this.hideLoading();var loadingMore=this.options.get("translations").get("searching");var loading={disabled:true,loading:true,text:loadingMore(params)};var $loading=this.option(loading);$loading.className+=" loading-results";this.$results.prepend($loading)};Results.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()};Results.prototype.option=function(data){var option=document.createElement("li");option.className="select2-results__option";var attrs={role:"option","aria-selected":"false"};var matches=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;if(data.element!=null&&matches.call(data.element,":disabled")||data.element==null&&data.disabled){delete attrs["aria-selected"];attrs["aria-disabled"]="true"}if(data.id==null){delete attrs["aria-selected"]}if(data._resultId!=null){option.id=data._resultId}if(data.title){option.title=data.title}if(data.children){attrs.role="group";attrs["aria-label"]=data.text;delete attrs["aria-selected"]}for(var attr in attrs){var val=attrs[attr];option.setAttribute(attr,val)}if(data.children){var $option=$(option);var label=document.createElement("strong");label.className="select2-results__group";var $label=$(label);this.template(data,label);var $children=[];for(var c=0;c<data.children.length;c++){var child=data.children[c];var $child=this.option(child);$children.push($child)}var $childrenContainer=$("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});$childrenContainer.append($children);$option.append(label);$option.append($childrenContainer)}else{this.template(data,option)}Utils.StoreData(option,"data",data);return option};Results.prototype.bind=function(container,$container){var self=this;var id=container.id+"-results";this.$results.attr("id",id);container.on("results:all",function(params){self.clear();self.append(params.data);if(container.isOpen()){self.setClasses();self.highlightFirstItem()}});container.on("results:append",function(params){self.append(params.data);if(container.isOpen()){self.setClasses()}});container.on("query",function(params){self.hideMessages();self.showLoading(params)});container.on("select",function(){if(!container.isOpen()){return}self.setClasses();if(self.options.get("scrollAfterSelect")){self.highlightFirstItem()}});container.on("unselect",function(){if(!container.isOpen()){return}self.setClasses();if(self.options.get("scrollAfterSelect")){self.highlightFirstItem()}});container.on("open",function(){self.$results.attr("aria-expanded","true");self.$results.attr("aria-hidden","false");self.setClasses();self.ensureHighlightVisible()});container.on("close",function(){self.$results.attr("aria-expanded","false");self.$results.attr("aria-hidden","true");self.$results.removeAttr("aria-activedescendant")});container.on("results:toggle",function(){var $highlighted=self.getHighlightedResults();if($highlighted.length===0){return}$highlighted.trigger("mouseup")});container.on("results:select",function(){var $highlighted=self.getHighlightedResults();if($highlighted.length===0){return}var data=Utils.GetData($highlighted[0],"data");if($highlighted.attr("aria-selected")=="true"){self.trigger("close",{})}else{self.trigger("select",{data:data})}});container.on("results:previous",function(){var $highlighted=self.getHighlightedResults();var $options=self.$results.find("[aria-selected]");var currentIndex=$options.index($highlighted);if(currentIndex<=0){return}var nextIndex=currentIndex-1;if($highlighted.length===0){nextIndex=0}var $next=$options.eq(nextIndex);$next.trigger("mouseenter");var currentOffset=self.$results.offset().top;var nextTop=$next.offset().top;var nextOffset=self.$results.scrollTop()+(nextTop-currentOffset);if(nextIndex===0){self.$results.scrollTop(0)}else if(nextTop-currentOffset<0){self.$results.scrollTop(nextOffset)}});container.on("results:next",function(){var $highlighted=self.getHighlightedResults();var $options=self.$results.find("[aria-selected]");var currentIndex=$options.index($highlighted);var nextIndex=currentIndex+1;if(nextIndex>=$options.length){return}var $next=$options.eq(nextIndex);$next.trigger("mouseenter");var currentOffset=self.$results.offset().top+self.$results.outerHeight(false);var nextBottom=$next.offset().top+$next.outerHeight(false);var nextOffset=self.$results.scrollTop()+nextBottom-currentOffset;if(nextIndex===0){self.$results.scrollTop(0)}else if(nextBottom>currentOffset){self.$results.scrollTop(nextOffset)}});container.on("results:focus",function(params){params.element.addClass("select2-results__option--highlighted")});container.on("results:message",function(params){self.displayMessage(params)});if($.fn.mousewheel){this.$results.on("mousewheel",function(e){var top=self.$results.scrollTop();var bottom=self.$results.get(0).scrollHeight-top+e.deltaY;var isAtTop=e.deltaY>0&&top-e.deltaY<=0;var isAtBottom=e.deltaY<0&&bottom<=self.$results.height();if(isAtTop){self.$results.scrollTop(0);e.preventDefault();e.stopPropagation()}else if(isAtBottom){self.$results.scrollTop(self.$results.get(0).scrollHeight-self.$results.height());e.preventDefault();e.stopPropagation()}})}this.$results.on("mouseup",".select2-results__option[aria-selected]",function(evt){var $this=$(this);var data=Utils.GetData(this,"data");if($this.attr("aria-selected")==="true"){if(self.options.get("multiple")){self.trigger("unselect",{originalEvent:evt,data:data})}else{self.trigger("close",{})}return}self.trigger("select",{originalEvent:evt,data:data})});this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(evt){var data=Utils.GetData(this,"data");self.getHighlightedResults().removeClass("select2-results__option--highlighted");self.trigger("results:focus",{data:data,element:$(this)})})};Results.prototype.getHighlightedResults=function(){var $highlighted=this.$results.find(".select2-results__option--highlighted");return $highlighted};Results.prototype.destroy=function(){this.$results.remove()};Results.prototype.ensureHighlightVisible=function(){var $highlighted=this.getHighlightedResults();if($highlighted.length===0){return}var $options=this.$results.find("[aria-selected]");var currentIndex=$options.index($highlighted);var currentOffset=this.$results.offset().top;var nextTop=$highlighted.offset().top;var nextOffset=this.$results.scrollTop()+(nextTop-currentOffset);var offsetDelta=nextTop-currentOffset;nextOffset-=$highlighted.outerHeight(false)*2;if(currentIndex<=2){this.$results.scrollTop(0)}else if(offsetDelta>this.$results.outerHeight()||offsetDelta<0){this.$results.scrollTop(nextOffset)}};Results.prototype.template=function(result,container){var template=this.options.get("templateResult");var escapeMarkup=this.options.get("escapeMarkup");var content=template(result,container);if(content==null){container.style.display="none"}else if(typeof content==="string"){container.innerHTML=escapeMarkup(content)}else{$(container).append(content)}};return Results});S2.define("select2/keys",[],function(){var KEYS={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return KEYS});S2.define("select2/selection/base",["jquery","../utils","../keys"],function($,Utils,KEYS){function BaseSelection($element,options){this.$element=$element;this.options=options;BaseSelection.__super__.constructor.call(this)}Utils.Extend(BaseSelection,Utils.Observable);BaseSelection.prototype.render=function(){var $selection=$('<span class="select2-selection" role="combobox" '+' aria-haspopup="true" aria-expanded="false">'+"</span>");this._tabindex=0;if(Utils.GetData(this.$element[0],"old-tabindex")!=null){this._tabindex=Utils.GetData(this.$element[0],"old-tabindex")}else if(this.$element.attr("tabindex")!=null){this._tabindex=this.$element.attr("tabindex")}$selection.attr("title",this.$element.attr("title"));$selection.attr("tabindex",this._tabindex);$selection.attr("aria-disabled","false");this.$selection=$selection;return $selection};BaseSelection.prototype.bind=function(container,$container){var self=this;var resultsId=container.id+"-results";this.container=container;this.$selection.on("focus",function(evt){self.trigger("focus",evt)});this.$selection.on("blur",function(evt){self._handleBlur(evt)});this.$selection.on("keydown",function(evt){self.trigger("keypress",evt);if(evt.which===KEYS.SPACE){evt.preventDefault()}});container.on("results:focus",function(params){self.$selection.attr("aria-activedescendant",params.data._resultId)});container.on("selection:update",function(params){self.update(params.data)});container.on("open",function(){self.$selection.attr("aria-expanded","true");self.$selection.attr("aria-owns",resultsId);self._attachCloseHandler(container)});container.on("close",function(){self.$selection.attr("aria-expanded","false");self.$selection.removeAttr("aria-activedescendant");self.$selection.removeAttr("aria-owns");self.$selection.trigger("focus");self._detachCloseHandler(container)});container.on("enable",function(){self.$selection.attr("tabindex",self._tabindex);self.$selection.attr("aria-disabled","false")});container.on("disable",function(){self.$selection.attr("tabindex","-1");self.$selection.attr("aria-disabled","true")})};BaseSelection.prototype._handleBlur=function(evt){var self=this;window.setTimeout(function(){if(document.activeElement==self.$selection[0]||$.contains(self.$selection[0],document.activeElement)){return}self.trigger("blur",evt)},1)};BaseSelection.prototype._attachCloseHandler=function(container){$(document.body).on("mousedown.select2."+container.id,function(e){var $target=$(e.target);var $select=$target.closest(".select2");var $all=$(".select2.select2-container--open");$all.each(function(){if(this==$select[0]){return}var $element=Utils.GetData(this,"element");$element.select2("close")})})};BaseSelection.prototype._detachCloseHandler=function(container){$(document.body).off("mousedown.select2."+container.id)};BaseSelection.prototype.position=function($selection,$container){var $selectionContainer=$container.find(".selection");$selectionContainer.append($selection)};BaseSelection.prototype.destroy=function(){this._detachCloseHandler(this.container)};BaseSelection.prototype.update=function(data){throw new Error("The `update` method must be defined in child classes.")};BaseSelection.prototype.isEnabled=function(){return!this.isDisabled()};BaseSelection.prototype.isDisabled=function(){return this.options.get("disabled")};return BaseSelection});S2.define("select2/selection/single",["jquery","./base","../utils","../keys"],function($,BaseSelection,Utils,KEYS){function SingleSelection(){SingleSelection.__super__.constructor.apply(this,arguments)}Utils.Extend(SingleSelection,BaseSelection);SingleSelection.prototype.render=function(){var $selection=SingleSelection.__super__.render.call(this);$selection.addClass("select2-selection--single");$selection.html('<span class="select2-selection__rendered"></span>'+'<span class="select2-selection__arrow" role="presentation">'+'<b role="presentation"></b>'+"</span>");return $selection};SingleSelection.prototype.bind=function(container,$container){var self=this;SingleSelection.__super__.bind.apply(this,arguments);var id=container.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",id).attr("role","textbox").attr("aria-readonly","true");this.$selection.attr("aria-labelledby",id);this.$selection.on("mousedown",function(evt){if(evt.which!==1){return}self.trigger("toggle",{originalEvent:evt})});this.$selection.on("focus",function(evt){});this.$selection.on("blur",function(evt){});container.on("focus",function(evt){if(!container.isOpen()){self.$selection.trigger("focus")}})};SingleSelection.prototype.clear=function(){var $rendered=this.$selection.find(".select2-selection__rendered");$rendered.empty();$rendered.removeAttr("title")};SingleSelection.prototype.display=function(data,container){var template=this.options.get("templateSelection");var escapeMarkup=this.options.get("escapeMarkup");return escapeMarkup(template(data,container))};SingleSelection.prototype.selectionContainer=function(){return $("<span></span>")};SingleSelection.prototype.update=function(data){if(data.length===0){this.clear();return}var selection=data[0];var $rendered=this.$selection.find(".select2-selection__rendered");var formatted=this.display(selection,$rendered);$rendered.empty().append(formatted);var title=selection.title||selection.text;if(title){$rendered.attr("title",title)}else{$rendered.removeAttr("title")}};return SingleSelection});S2.define("select2/selection/multiple",["jquery","./base","../utils"],function($,BaseSelection,Utils){function MultipleSelection($element,options){MultipleSelection.__super__.constructor.apply(this,arguments)}Utils.Extend(MultipleSelection,BaseSelection);MultipleSelection.prototype.render=function(){var $selection=MultipleSelection.__super__.render.call(this);$selection.addClass("select2-selection--multiple");$selection.html('<ul class="select2-selection__rendered"></ul>');return $selection};MultipleSelection.prototype.bind=function(container,$container){var self=this;MultipleSelection.__super__.bind.apply(this,arguments);this.$selection.on("click",function(evt){self.trigger("toggle",{originalEvent:evt})});this.$selection.on("click",".select2-selection__choice__remove",function(evt){if(self.isDisabled()){return}var $remove=$(this);var $selection=$remove.parent();var data=Utils.GetData($selection[0],"data");self.trigger("unselect",{originalEvent:evt,data:data})})};MultipleSelection.prototype.clear=function(){var $rendered=this.$selection.find(".select2-selection__rendered");$rendered.empty();$rendered.removeAttr("title")};MultipleSelection.prototype.display=function(data,container){var template=this.options.get("templateSelection");var escapeMarkup=this.options.get("escapeMarkup");return escapeMarkup(template(data,container))};MultipleSelection.prototype.selectionContainer=function(){var $container=$('<li class="select2-selection__choice">'+'<span class="select2-selection__choice__remove" role="presentation">'+"&times;"+"</span>"+"</li>");return $container};MultipleSelection.prototype.update=function(data){this.clear();if(data.length===0){return}var $selections=[];for(var d=0;d<data.length;d++){var selection=data[d];var $selection=this.selectionContainer();var formatted=this.display(selection,$selection);$selection.append(formatted);var title=selection.title||selection.text;if(title){$selection.attr("title",title)}Utils.StoreData($selection[0],"data",selection);$selections.push($selection)}var $rendered=this.$selection.find(".select2-selection__rendered");Utils.appendMany($rendered,$selections)};return MultipleSelection});S2.define("select2/selection/placeholder",["../utils"],function(Utils){function Placeholder(decorated,$element,options){this.placeholder=this.normalizePlaceholder(options.get("placeholder"));decorated.call(this,$element,options)}Placeholder.prototype.normalizePlaceholder=function(_,placeholder){if(typeof placeholder==="string"){placeholder={id:"",text:placeholder}}return placeholder};Placeholder.prototype.createPlaceholder=function(decorated,placeholder){var $placeholder=this.selectionContainer();$placeholder.html(this.display(placeholder));$placeholder.addClass("select2-selection__placeholder").removeClass("select2-selection__choice");return $placeholder};Placeholder.prototype.update=function(decorated,data){var singlePlaceholder=data.length==1&&data[0].id!=this.placeholder.id;var multipleSelections=data.length>1;if(multipleSelections||singlePlaceholder){return decorated.call(this,data)}this.clear();var $placeholder=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append($placeholder)};return Placeholder});S2.define("select2/selection/allowClear",["jquery","../keys","../utils"],function($,KEYS,Utils){function AllowClear(){}AllowClear.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);if(this.placeholder==null){if(this.options.get("debug")&&window.console&&console.error){console.error("Select2: The `allowClear` option should be used in combination "+"with the `placeholder` option.")}}this.$selection.on("mousedown",".select2-selection__clear",function(evt){self._handleClear(evt)});container.on("keypress",function(evt){self._handleKeyboardClear(evt,container)})};AllowClear.prototype._handleClear=function(_,evt){if(this.isDisabled()){return}var $clear=this.$selection.find(".select2-selection__clear");if($clear.length===0){return}evt.stopPropagation();var data=Utils.GetData($clear[0],"data");var previousVal=this.$element.val();this.$element.val(this.placeholder.id);var unselectData={data:data};this.trigger("clear",unselectData);if(unselectData.prevented){this.$element.val(previousVal);return}for(var d=0;d<data.length;d++){unselectData={data:data[d]};this.trigger("unselect",unselectData);if(unselectData.prevented){this.$element.val(previousVal);return}}this.$element.trigger("input").trigger("change");this.trigger("toggle",{})};AllowClear.prototype._handleKeyboardClear=function(_,evt,container){if(container.isOpen()){return}if(evt.which==KEYS.DELETE||evt.which==KEYS.BACKSPACE){this._handleClear(evt)}};AllowClear.prototype.update=function(decorated,data){decorated.call(this,data);if(this.$selection.find(".select2-selection__placeholder").length>0||data.length===0){return}var removeAll=this.options.get("translations").get("removeAllItems");var $remove=$('<span class="select2-selection__clear" title="'+removeAll()+'">'+"&times;"+"</span>");Utils.StoreData($remove[0],"data",data);this.$selection.find(".select2-selection__rendered").prepend($remove)};return AllowClear});S2.define("select2/selection/search",["jquery","../utils","../keys"],function($,Utils,KEYS){function Search(decorated,$element,options){
decorated.call(this,$element,options)}Search.prototype.render=function(decorated){var $search=$('<li class="select2-search select2-search--inline">'+'<input class="select2-search__field" type="search" tabindex="-1"'+' autocomplete="off" autocorrect="off" autocapitalize="none"'+' spellcheck="false" role="searchbox" aria-autocomplete="list" />'+"</li>");this.$searchContainer=$search;this.$search=$search.find("input");var $rendered=decorated.call(this);this._transferTabIndex();return $rendered};Search.prototype.bind=function(decorated,container,$container){var self=this;var resultsId=container.id+"-results";decorated.call(this,container,$container);container.on("open",function(){self.$search.attr("aria-controls",resultsId);self.$search.trigger("focus")});container.on("close",function(){self.$search.val("");self.$search.removeAttr("aria-controls");self.$search.removeAttr("aria-activedescendant");self.$search.trigger("focus")});container.on("enable",function(){self.$search.prop("disabled",false);self._transferTabIndex()});container.on("disable",function(){self.$search.prop("disabled",true)});container.on("focus",function(evt){self.$search.trigger("focus")});container.on("results:focus",function(params){if(params.data._resultId){self.$search.attr("aria-activedescendant",params.data._resultId)}else{self.$search.removeAttr("aria-activedescendant")}});this.$selection.on("focusin",".select2-search--inline",function(evt){self.trigger("focus",evt)});this.$selection.on("focusout",".select2-search--inline",function(evt){self._handleBlur(evt)});this.$selection.on("keydown",".select2-search--inline",function(evt){evt.stopPropagation();self.trigger("keypress",evt);self._keyUpPrevented=evt.isDefaultPrevented();var key=evt.which;if(key===KEYS.BACKSPACE&&self.$search.val()===""){var $previousChoice=self.$searchContainer.prev(".select2-selection__choice");if($previousChoice.length>0){var item=Utils.GetData($previousChoice[0],"data");self.searchRemoveChoice(item);evt.preventDefault()}}});this.$selection.on("click",".select2-search--inline",function(evt){if(self.$search.val()){evt.stopPropagation()}});var msie=document.documentMode;var disableInputEvents=msie&&msie<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(evt){if(disableInputEvents){self.$selection.off("input.search input.searchcheck");return}self.$selection.off("keyup.search")});this.$selection.on("keyup.search input.search",".select2-search--inline",function(evt){if(disableInputEvents&&evt.type==="input"){self.$selection.off("input.search input.searchcheck");return}var key=evt.which;if(key==KEYS.SHIFT||key==KEYS.CTRL||key==KEYS.ALT){return}if(key==KEYS.TAB){return}self.handleSearch(evt)})};Search.prototype._transferTabIndex=function(decorated){this.$search.attr("tabindex",this.$selection.attr("tabindex"));this.$selection.attr("tabindex","-1")};Search.prototype.createPlaceholder=function(decorated,placeholder){this.$search.attr("placeholder",placeholder.text)};Search.prototype.update=function(decorated,data){var searchHadFocus=this.$search[0]==document.activeElement;this.$search.attr("placeholder","");decorated.call(this,data);this.$selection.find(".select2-selection__rendered").append(this.$searchContainer);this.resizeSearch();if(searchHadFocus){this.$search.trigger("focus")}};Search.prototype.handleSearch=function(){this.resizeSearch();if(!this._keyUpPrevented){var input=this.$search.val();this.trigger("query",{term:input})}this._keyUpPrevented=false};Search.prototype.searchRemoveChoice=function(decorated,item){this.trigger("unselect",{data:item});this.$search.val(item.text);this.handleSearch()};Search.prototype.resizeSearch=function(){this.$search.css("width","25px");var width="";if(this.$search.attr("placeholder")!==""){width=this.$selection.find(".select2-selection__rendered").width()}else{var minimumWidth=this.$search.val().length+1;width=minimumWidth*.75+"em"}this.$search.css("width",width)};return Search});S2.define("select2/selection/eventRelay",["jquery"],function($){function EventRelay(){}EventRelay.prototype.bind=function(decorated,container,$container){var self=this;var relayEvents=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"];var preventableEvents=["opening","closing","selecting","unselecting","clearing"];decorated.call(this,container,$container);container.on("*",function(name,params){if($.inArray(name,relayEvents)===-1){return}params=params||{};var evt=$.Event("select2:"+name,{params:params});self.$element.trigger(evt);if($.inArray(name,preventableEvents)===-1){return}params.prevented=evt.isDefaultPrevented()})};return EventRelay});S2.define("select2/translation",["jquery","require"],function($,require){function Translation(dict){this.dict=dict||{}}Translation.prototype.all=function(){return this.dict};Translation.prototype.get=function(key){return this.dict[key]};Translation.prototype.extend=function(translation){this.dict=$.extend({},translation.all(),this.dict)};Translation._cache={};Translation.loadPath=function(path){if(!(path in Translation._cache)){var translations=require(path);Translation._cache[path]=translations}return new Translation(Translation._cache[path])};return Translation});S2.define("select2/diacritics",[],function(){var diacritics={"Ⓐ":"A","Ａ":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","Ｂ":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","Ｃ":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","Ｄ":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","Ǳ":"DZ","Ǆ":"DZ","ǲ":"Dz","ǅ":"Dz","Ⓔ":"E","Ｅ":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","Ｆ":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","Ｇ":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","Ｈ":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","Ｉ":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","Ｊ":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","Ｋ":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","Ｌ":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","Ǉ":"LJ","ǈ":"Lj","Ⓜ":"M","Ｍ":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","Ｎ":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","Ǌ":"NJ","ǋ":"Nj","Ⓞ":"O","Ｏ":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Œ":"OE","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","Ｐ":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Ｑ":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","Ｒ":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","Ｓ":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","Ｔ":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","Ｕ":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","Ｖ":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","Ｗ":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","Ｘ":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Ｙ":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Ｚ":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","ａ":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","ｂ":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","ｃ":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","ｄ":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","ǳ":"dz","ǆ":"dz","ⓔ":"e","ｅ":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","ｆ":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","ｇ":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","ｈ":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","ｉ":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","ｊ":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","ｋ":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","ｌ":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","ǉ":"lj","ⓜ":"m","ｍ":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","ｎ":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ŉ":"n","ꞑ":"n","ꞥ":"n","ǌ":"nj","ⓞ":"o","ｏ":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","œ":"oe","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","ｐ":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","ｑ":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","ｒ":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","ｓ":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","ｔ":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","ｕ":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","ｖ":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","ｗ":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","ｘ":"x","ẋ":"x","ẍ":"x","ⓨ":"y","ｙ":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","ｚ":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ώ":"ω","ς":"σ","’":"'"};return diacritics});S2.define("select2/data/base",["../utils"],function(Utils){function BaseAdapter($element,options){BaseAdapter.__super__.constructor.call(this)}Utils.Extend(BaseAdapter,Utils.Observable);BaseAdapter.prototype.current=function(callback){throw new Error("The `current` method must be defined in child classes.")};BaseAdapter.prototype.query=function(params,callback){throw new Error("The `query` method must be defined in child classes.")};BaseAdapter.prototype.bind=function(container,$container){};BaseAdapter.prototype.destroy=function(){};BaseAdapter.prototype.generateResultId=function(container,data){var id=container.id+"-result-";id+=Utils.generateChars(4);if(data.id!=null){id+="-"+data.id.toString()}else{id+="-"+Utils.generateChars(4)}return id};return BaseAdapter});S2.define("select2/data/select",["./base","../utils","jquery"],function(BaseAdapter,Utils,$){function SelectAdapter($element,options){this.$element=$element;this.options=options;SelectAdapter.__super__.constructor.call(this)}Utils.Extend(SelectAdapter,BaseAdapter);SelectAdapter.prototype.current=function(callback){var data=[];var self=this;this.$element.find(":selected").each(function(){var $option=$(this);var option=self.item($option);data.push(option)});callback(data)};SelectAdapter.prototype.select=function(data){var self=this;data.selected=true;if($(data.element).is("option")){data.element.selected=true;this.$element.trigger("input").trigger("change");return}if(this.$element.prop("multiple")){this.current(function(currentData){var val=[];data=[data];data.push.apply(data,currentData);for(var d=0;d<data.length;d++){var id=data[d].id;if($.inArray(id,val)===-1){val.push(id)}}self.$element.val(val);self.$element.trigger("input").trigger("change")})}else{var val=data.id;this.$element.val(val);this.$element.trigger("input").trigger("change")}};SelectAdapter.prototype.unselect=function(data){var self=this;if(!this.$element.prop("multiple")){return}data.selected=false;if($(data.element).is("option")){data.element.selected=false;this.$element.trigger("input").trigger("change");return}this.current(function(currentData){var val=[];for(var d=0;d<currentData.length;d++){var id=currentData[d].id;if(id!==data.id&&$.inArray(id,val)===-1){val.push(id)}}self.$element.val(val);self.$element.trigger("input").trigger("change")})};SelectAdapter.prototype.bind=function(container,$container){var self=this;this.container=container;container.on("select",function(params){self.select(params.data)});container.on("unselect",function(params){self.unselect(params.data)})};SelectAdapter.prototype.destroy=function(){this.$element.find("*").each(function(){Utils.RemoveData(this)})};SelectAdapter.prototype.query=function(params,callback){var data=[];var self=this;var $options=this.$element.children();$options.each(function(){var $option=$(this);if(!$option.is("option")&&!$option.is("optgroup")){return}var option=self.item($option);var matches=self.matches(params,option);if(matches!==null){data.push(matches)}});callback({results:data})};SelectAdapter.prototype.addOptions=function($options){Utils.appendMany(this.$element,$options)};SelectAdapter.prototype.option=function(data){var option;if(data.children){option=document.createElement("optgroup");option.label=data.text}else{option=document.createElement("option");if(option.textContent!==undefined){option.textContent=data.text}else{option.innerText=data.text}}if(data.id!==undefined){option.value=data.id}if(data.disabled){option.disabled=true}if(data.selected){option.selected=true}if(data.title){option.title=data.title}var $option=$(option);var normalizedData=this._normalizeItem(data);normalizedData.element=option;Utils.StoreData(option,"data",normalizedData);return $option};SelectAdapter.prototype.item=function($option){var data={};data=Utils.GetData($option[0],"data");if(data!=null){return data}if($option.is("option")){data={id:$option.val(),text:$option.text(),disabled:$option.prop("disabled"),selected:$option.prop("selected"),title:$option.prop("title")}}else if($option.is("optgroup")){data={text:$option.prop("label"),children:[],title:$option.prop("title")};var $children=$option.children("option");var children=[];for(var c=0;c<$children.length;c++){var $child=$($children[c]);var child=this.item($child);children.push(child)}data.children=children}data=this._normalizeItem(data);data.element=$option[0];Utils.StoreData($option[0],"data",data);return data};SelectAdapter.prototype._normalizeItem=function(item){if(item!==Object(item)){item={id:item,text:item}}item=$.extend({},{text:""},item);var defaults={selected:false,disabled:false};if(item.id!=null){item.id=item.id.toString()}if(item.text!=null){item.text=item.text.toString()}if(item._resultId==null&&item.id&&this.container!=null){item._resultId=this.generateResultId(this.container,item)}return $.extend({},defaults,item)};SelectAdapter.prototype.matches=function(params,data){var matcher=this.options.get("matcher");return matcher(params,data)};return SelectAdapter});S2.define("select2/data/array",["./select","../utils","jquery"],function(SelectAdapter,Utils,$){function ArrayAdapter($element,options){this._dataToConvert=options.get("data")||[];ArrayAdapter.__super__.constructor.call(this,$element,options)}Utils.Extend(ArrayAdapter,SelectAdapter);ArrayAdapter.prototype.bind=function(container,$container){ArrayAdapter.__super__.bind.call(this,container,$container);this.addOptions(this.convertToOptions(this._dataToConvert))};ArrayAdapter.prototype.select=function(data){var $option=this.$element.find("option").filter(function(i,elm){return elm.value==data.id.toString()});if($option.length===0){$option=this.option(data);this.addOptions($option)}ArrayAdapter.__super__.select.call(this,data)};ArrayAdapter.prototype.convertToOptions=function(data){var self=this;var $existing=this.$element.find("option");var existingIds=$existing.map(function(){return self.item($(this)).id}).get();var $options=[];function onlyItem(item){return function(){return $(this).val()==item.id}}for(var d=0;d<data.length;d++){var item=this._normalizeItem(data[d]);if($.inArray(item.id,existingIds)>=0){var $existingOption=$existing.filter(onlyItem(item));var existingData=this.item($existingOption);var newData=$.extend(true,{},item,existingData);var $newOption=this.option(newData);$existingOption.replaceWith($newOption);continue}var $option=this.option(item);if(item.children){var $children=this.convertToOptions(item.children);Utils.appendMany($option,$children)}$options.push($option)}return $options};return ArrayAdapter});S2.define("select2/data/ajax",["./array","../utils","jquery"],function(ArrayAdapter,Utils,$){function AjaxAdapter($element,options){this.ajaxOptions=this._applyDefaults(options.get("ajax"));if(this.ajaxOptions.processResults!=null){this.processResults=this.ajaxOptions.processResults}AjaxAdapter.__super__.constructor.call(this,$element,options)}Utils.Extend(AjaxAdapter,ArrayAdapter);AjaxAdapter.prototype._applyDefaults=function(options){var defaults={data:function(params){return $.extend({},params,{q:params.term})},transport:function(params,success,failure){var $request=$.ajax(params);$request.then(success);$request.fail(failure);return $request}};return $.extend({},defaults,options,true)};AjaxAdapter.prototype.processResults=function(results){return results};AjaxAdapter.prototype.query=function(params,callback){var matches=[];var self=this;if(this._request!=null){if($.isFunction(this._request.abort)){this._request.abort()}this._request=null}var options=$.extend({type:"GET"},this.ajaxOptions);if(typeof options.url==="function"){options.url=options.url.call(this.$element,params)}if(typeof options.data==="function"){options.data=options.data.call(this.$element,params)}function request(){var $request=options.transport(options,function(data){var results=self.processResults(data,params);if(self.options.get("debug")&&window.console&&console.error){if(!results||!results.results||!$.isArray(results.results)){console.error("Select2: The AJAX results did not return an array in the "+"`results` key of the response.")}}callback(results)},function(){if("status"in $request&&($request.status===0||$request.status==="0")){return}self.trigger("results:message",{message:"errorLoading"})});self._request=$request}if(this.ajaxOptions.delay&&params.term!=null){if(this._queryTimeout){window.clearTimeout(this._queryTimeout)}this._queryTimeout=window.setTimeout(request,this.ajaxOptions.delay)}else{request()}};return AjaxAdapter});S2.define("select2/data/tags",["jquery"],function($){function Tags(decorated,$element,options){var tags=options.get("tags");var createTag=options.get("createTag");if(createTag!==undefined){this.createTag=createTag}var insertTag=options.get("insertTag");if(insertTag!==undefined){this.insertTag=insertTag}decorated.call(this,$element,options);if($.isArray(tags)){for(var t=0;t<tags.length;t++){var tag=tags[t];var item=this._normalizeItem(tag);var $option=this.option(item);this.$element.append($option)}}}Tags.prototype.query=function(decorated,params,callback){var self=this;this._removeOldTags();if(params.term==null||params.page!=null){decorated.call(this,params,callback);return}function wrapper(obj,child){var data=obj.results;for(var i=0;i<data.length;i++){var option=data[i];var checkChildren=option.children!=null&&!wrapper({results:option.children},true);var optionText=(option.text||"").toUpperCase();var paramsTerm=(params.term||"").toUpperCase();var checkText=optionText===paramsTerm;if(checkText||checkChildren){if(child){return false}obj.data=data;callback(obj);return}}if(child){return true}var tag=self.createTag(params);if(tag!=null){var $option=self.option(tag);$option.attr("data-select2-tag",true);self.addOptions([$option]);self.insertTag(data,tag)}obj.results=data;callback(obj)}decorated.call(this,params,wrapper)};Tags.prototype.createTag=function(decorated,params){var term=$.trim(params.term);if(term===""){return null}return{id:term,text:term}};Tags.prototype.insertTag=function(_,data,tag){data.unshift(tag)};Tags.prototype._removeOldTags=function(_){var $options=this.$element.find("option[data-select2-tag]");$options.each(function(){if(this.selected){return}$(this).remove()})};return Tags});S2.define("select2/data/tokenizer",["jquery"],function($){function Tokenizer(decorated,$element,options){var tokenizer=options.get("tokenizer");if(tokenizer!==undefined){this.tokenizer=tokenizer}decorated.call(this,$element,options)}Tokenizer.prototype.bind=function(decorated,container,$container){decorated.call(this,container,$container);this.$search=container.dropdown.$search||container.selection.$search||$container.find(".select2-search__field")};Tokenizer.prototype.query=function(decorated,params,callback){var self=this;function createAndSelect(data){var item=self._normalizeItem(data);var $existingOptions=self.$element.find("option").filter(function(){return $(this).val()===item.id});if(!$existingOptions.length){var $option=self.option(item);$option.attr("data-select2-tag",true);self._removeOldTags();self.addOptions([$option])}select(item)}function select(data){self.trigger("select",{data:data})}params.term=params.term||"";var tokenData=this.tokenizer(params,this.options,createAndSelect);if(tokenData.term!==params.term){if(this.$search.length){this.$search.val(tokenData.term);this.$search.trigger("focus")}params.term=tokenData.term}decorated.call(this,params,callback)};Tokenizer.prototype.tokenizer=function(_,params,options,callback){var separators=options.get("tokenSeparators")||[];var term=params.term;var i=0;var createTag=this.createTag||function(params){return{id:params.term,text:params.term}};while(i<term.length){var termChar=term[i];if($.inArray(termChar,separators)===-1){i++;continue}var part=term.substr(0,i);var partParams=$.extend({},params,{term:part});var data=createTag(partParams);if(data==null){i++;continue}callback(data);term=term.substr(i+1)||"";i=0}return{term:term}};return Tokenizer});S2.define("select2/data/minimumInputLength",[],function(){function MinimumInputLength(decorated,$e,options){this.minimumInputLength=options.get("minimumInputLength");decorated.call(this,$e,options)}MinimumInputLength.prototype.query=function(decorated,params,callback){params.term=params.term||"";if(params.term.length<this.minimumInputLength){this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:params.term,params:params}});return}decorated.call(this,params,callback)};return MinimumInputLength});S2.define("select2/data/maximumInputLength",[],function(){function MaximumInputLength(decorated,$e,options){this.maximumInputLength=options.get("maximumInputLength");decorated.call(this,$e,options)}MaximumInputLength.prototype.query=function(decorated,params,callback){params.term=params.term||"";if(this.maximumInputLength>0&&params.term.length>this.maximumInputLength){this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:params.term,params:params}});return}decorated.call(this,params,callback)};return MaximumInputLength});S2.define("select2/data/maximumSelectionLength",[],function(){function MaximumSelectionLength(decorated,$e,options){this.maximumSelectionLength=options.get("maximumSelectionLength");decorated.call(this,$e,options)}MaximumSelectionLength.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);container.on("select",function(){self._checkIfMaximumSelected()})};MaximumSelectionLength.prototype.query=function(decorated,params,callback){var self=this;this._checkIfMaximumSelected(function(){decorated.call(self,params,callback)})};MaximumSelectionLength.prototype._checkIfMaximumSelected=function(_,successCallback){var self=this;this.current(function(currentData){var count=currentData!=null?currentData.length:0;if(self.maximumSelectionLength>0&&count>=self.maximumSelectionLength){self.trigger("results:message",{message:"maximumSelected",args:{maximum:self.maximumSelectionLength}});return}if(successCallback){successCallback()}})};return MaximumSelectionLength});S2.define("select2/dropdown",["jquery","./utils"],function($,Utils){function Dropdown($element,options){this.$element=$element;this.options=options;Dropdown.__super__.constructor.call(this)}Utils.Extend(Dropdown,Utils.Observable);Dropdown.prototype.render=function(){var $dropdown=$('<span class="select2-dropdown">'+'<span class="select2-results"></span>'+"</span>");$dropdown.attr("dir",this.options.get("dir"));this.$dropdown=$dropdown;return $dropdown};Dropdown.prototype.bind=function(){};Dropdown.prototype.position=function($dropdown,$container){};Dropdown.prototype.destroy=function(){this.$dropdown.remove()};return Dropdown});S2.define("select2/dropdown/search",["jquery","../utils"],function($,Utils){function Search(){}Search.prototype.render=function(decorated){var $rendered=decorated.call(this);var $search=$('<span class="select2-search select2-search--dropdown">'+'<input class="select2-search__field" type="search" tabindex="-1"'+' autocomplete="off" autocorrect="off" autocapitalize="none"'+' spellcheck="false" role="searchbox" aria-autocomplete="list" />'+"</span>");this.$searchContainer=$search;this.$search=$search.find("input");$rendered.prepend($search);return $rendered};Search.prototype.bind=function(decorated,container,$container){var self=this;var resultsId=container.id+"-results";decorated.call(this,container,$container);this.$search.on("keydown",function(evt){self.trigger("keypress",evt);self._keyUpPrevented=evt.isDefaultPrevented()});this.$search.on("input",function(evt){$(this).off("keyup")});this.$search.on("keyup input",function(evt){self.handleSearch(evt)});container.on("open",function(){self.$search.attr("tabindex",0);self.$search.attr("aria-controls",resultsId);self.$search.trigger("focus");window.setTimeout(function(){self.$search.trigger("focus")},0)});container.on("close",function(){self.$search.attr("tabindex",-1);self.$search.removeAttr("aria-controls");self.$search.removeAttr("aria-activedescendant");self.$search.val("");self.$search.trigger("blur")});container.on("focus",function(){if(!container.isOpen()){self.$search.trigger("focus")}});container.on("results:all",function(params){if(params.query.term==null||params.query.term===""){var showSearch=self.showSearch(params);if(showSearch){self.$searchContainer.removeClass("select2-search--hide")}else{self.$searchContainer.addClass("select2-search--hide")}}});container.on("results:focus",function(params){if(params.data._resultId){self.$search.attr("aria-activedescendant",params.data._resultId)}else{self.$search.removeAttr("aria-activedescendant")}})};Search.prototype.handleSearch=function(evt){if(!this._keyUpPrevented){var input=this.$search.val();this.trigger("query",{term:input})}this._keyUpPrevented=false};Search.prototype.showSearch=function(_,params){return true};return Search});S2.define("select2/dropdown/hidePlaceholder",[],function(){function HidePlaceholder(decorated,$element,options,dataAdapter){this.placeholder=this.normalizePlaceholder(options.get("placeholder"));decorated.call(this,$element,options,dataAdapter)}HidePlaceholder.prototype.append=function(decorated,data){data.results=this.removePlaceholder(data.results);decorated.call(this,data)};HidePlaceholder.prototype.normalizePlaceholder=function(_,placeholder){if(typeof placeholder==="string"){placeholder={id:"",text:placeholder}}return placeholder};HidePlaceholder.prototype.removePlaceholder=function(_,data){var modifiedData=data.slice(0);for(var d=data.length-1;d>=0;d--){var item=data[d];if(this.placeholder.id===item.id){modifiedData.splice(d,1)}}return modifiedData};return HidePlaceholder});S2.define("select2/dropdown/infiniteScroll",["jquery"],function($){function InfiniteScroll(decorated,$element,options,dataAdapter){this.lastParams={};decorated.call(this,$element,options,dataAdapter);this.$loadingMore=this.createLoadingMore();this.loading=false}InfiniteScroll.prototype.append=function(decorated,data){this.$loadingMore.remove();this.loading=false;decorated.call(this,data);if(this.showLoadingMore(data)){this.$results.append(this.$loadingMore);this.loadMoreIfNeeded()}};InfiniteScroll.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);container.on("query",function(params){self.lastParams=params;self.loading=true});container.on("query:append",function(params){self.lastParams=params;self.loading=true});this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))};InfiniteScroll.prototype.loadMoreIfNeeded=function(){var isLoadMoreVisible=$.contains(document.documentElement,this.$loadingMore[0]);if(this.loading||!isLoadMoreVisible){return}var currentOffset=this.$results.offset().top+this.$results.outerHeight(false);var loadingMoreOffset=this.$loadingMore.offset().top+this.$loadingMore.outerHeight(false);if(currentOffset+50>=loadingMoreOffset){this.loadMore()}};InfiniteScroll.prototype.loadMore=function(){this.loading=true;var params=$.extend({},{page:1},this.lastParams);params.page++;this.trigger("query:append",params)};InfiniteScroll.prototype.showLoadingMore=function(_,data){return data.pagination&&data.pagination.more};InfiniteScroll.prototype.createLoadingMore=function(){var $option=$("<li "+'class="select2-results__option select2-results__option--load-more"'+'role="option" aria-disabled="true"></li>');var message=this.options.get("translations").get("loadingMore");$option.html(message(this.lastParams));return $option};return InfiniteScroll});S2.define("select2/dropdown/attachBody",["jquery","../utils"],function($,Utils){function AttachBody(decorated,$element,options){this.$dropdownParent=$(options.get("dropdownParent")||document.body);decorated.call(this,$element,options)}AttachBody.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);container.on("open",function(){self._showDropdown();
self._attachPositioningHandler(container);self._bindContainerResultHandlers(container)});container.on("close",function(){self._hideDropdown();self._detachPositioningHandler(container)});this.$dropdownContainer.on("mousedown",function(evt){evt.stopPropagation()})};AttachBody.prototype.destroy=function(decorated){decorated.call(this);this.$dropdownContainer.remove()};AttachBody.prototype.position=function(decorated,$dropdown,$container){$dropdown.attr("class",$container.attr("class"));$dropdown.removeClass("select2");$dropdown.addClass("select2-container--open");$dropdown.css({position:"absolute",top:-999999});this.$container=$container};AttachBody.prototype.render=function(decorated){var $container=$("<span></span>");var $dropdown=decorated.call(this);$container.append($dropdown);this.$dropdownContainer=$container;return $container};AttachBody.prototype._hideDropdown=function(decorated){this.$dropdownContainer.detach()};AttachBody.prototype._bindContainerResultHandlers=function(decorated,container){if(this._containerResultsHandlersBound){return}var self=this;container.on("results:all",function(){self._positionDropdown();self._resizeDropdown()});container.on("results:append",function(){self._positionDropdown();self._resizeDropdown()});container.on("results:message",function(){self._positionDropdown();self._resizeDropdown()});container.on("select",function(){self._positionDropdown();self._resizeDropdown()});container.on("unselect",function(){self._positionDropdown();self._resizeDropdown()});this._containerResultsHandlersBound=true};AttachBody.prototype._attachPositioningHandler=function(decorated,container){var self=this;var scrollEvent="scroll.select2."+container.id;var resizeEvent="resize.select2."+container.id;var orientationEvent="orientationchange.select2."+container.id;var $watchers=this.$container.parents().filter(Utils.hasScroll);$watchers.each(function(){Utils.StoreData(this,"select2-scroll-position",{x:$(this).scrollLeft(),y:$(this).scrollTop()})});$watchers.on(scrollEvent,function(ev){var position=Utils.GetData(this,"select2-scroll-position");$(this).scrollTop(position.y)});$(window).on(scrollEvent+" "+resizeEvent+" "+orientationEvent,function(e){self._positionDropdown();self._resizeDropdown()})};AttachBody.prototype._detachPositioningHandler=function(decorated,container){var scrollEvent="scroll.select2."+container.id;var resizeEvent="resize.select2."+container.id;var orientationEvent="orientationchange.select2."+container.id;var $watchers=this.$container.parents().filter(Utils.hasScroll);$watchers.off(scrollEvent);$(window).off(scrollEvent+" "+resizeEvent+" "+orientationEvent)};AttachBody.prototype._positionDropdown=function(){var $window=$(window);var isCurrentlyAbove=this.$dropdown.hasClass("select2-dropdown--above");var isCurrentlyBelow=this.$dropdown.hasClass("select2-dropdown--below");var newDirection=null;var offset=this.$container.offset();offset.bottom=offset.top+this.$container.outerHeight(false);var container={height:this.$container.outerHeight(false)};container.top=offset.top;container.bottom=offset.top+container.height;var dropdown={height:this.$dropdown.outerHeight(false)};var viewport={top:$window.scrollTop(),bottom:$window.scrollTop()+$window.height()};var enoughRoomAbove=viewport.top<offset.top-dropdown.height;var enoughRoomBelow=viewport.bottom>offset.bottom+dropdown.height;var css={left:offset.left,top:container.bottom};var $offsetParent=this.$dropdownParent;if($offsetParent.css("position")==="static"){$offsetParent=$offsetParent.offsetParent()}var parentOffset={top:0,left:0};if(($.contains(document.body,$offsetParent[0])||$offsetParent[0].isConnected)&&$offsetParent.prop("tagName")!="HTML"){parentOffset=$offsetParent.offset()}css.top-=parentOffset.top;css.left-=parentOffset.left;if(!isCurrentlyAbove&&!isCurrentlyBelow){newDirection="below"}if(!enoughRoomBelow&&enoughRoomAbove&&!isCurrentlyAbove){newDirection="above"}else if(!enoughRoomAbove&&enoughRoomBelow&&isCurrentlyAbove){newDirection="below"}if(newDirection=="above"||isCurrentlyAbove&&newDirection!=="below"){css.top=container.top-parentOffset.top-dropdown.height}if(newDirection!=null){this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+newDirection);this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+newDirection)}this.$dropdownContainer.css(css)};AttachBody.prototype._resizeDropdown=function(){var css={width:this.$container.outerWidth(false)+"px"};if(this.options.get("dropdownAutoWidth")){css.minWidth=css.width;css.position="relative";css.width="auto"}this.$dropdown.css(css)};AttachBody.prototype._showDropdown=function(decorated){this.$dropdownContainer.appendTo(this.$dropdownParent);this._positionDropdown();this._resizeDropdown()};return AttachBody});S2.define("select2/dropdown/minimumResultsForSearch",[],function(){function countResults(data){var count=0;for(var d=0;d<data.length;d++){var item=data[d];if(item.children){count+=countResults(item.children)}else{count++}}return count}function MinimumResultsForSearch(decorated,$element,options,dataAdapter){this.minimumResultsForSearch=options.get("minimumResultsForSearch");if(this.minimumResultsForSearch<0){this.minimumResultsForSearch=Infinity}decorated.call(this,$element,options,dataAdapter)}MinimumResultsForSearch.prototype.showSearch=function(decorated,params){if(countResults(params.data.results)<this.minimumResultsForSearch){return false}return decorated.call(this,params)};return MinimumResultsForSearch});S2.define("select2/dropdown/selectOnClose",["../utils"],function(Utils){function SelectOnClose(){}SelectOnClose.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);container.on("close",function(params){self._handleSelectOnClose(params)})};SelectOnClose.prototype._handleSelectOnClose=function(_,params){if(params&&params.originalSelect2Event!=null){var event=params.originalSelect2Event;if(event._type==="select"||event._type==="unselect"){return}}var $highlightedResults=this.getHighlightedResults();if($highlightedResults.length<1){return}var data=Utils.GetData($highlightedResults[0],"data");if(data.element!=null&&data.element.selected||data.element==null&&data.selected){return}this.trigger("select",{data:data})};return SelectOnClose});S2.define("select2/dropdown/closeOnSelect",[],function(){function CloseOnSelect(){}CloseOnSelect.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);container.on("select",function(evt){self._selectTriggered(evt)});container.on("unselect",function(evt){self._selectTriggered(evt)})};CloseOnSelect.prototype._selectTriggered=function(_,evt){var originalEvent=evt.originalEvent;if(originalEvent&&(originalEvent.ctrlKey||originalEvent.metaKey)){return}this.trigger("close",{originalEvent:originalEvent,originalSelect2Event:evt})};return CloseOnSelect});S2.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(args){var overChars=args.input.length-args.maximum;var message="Please delete "+overChars+" character";if(overChars!=1){message+="s"}return message},inputTooShort:function(args){var remainingChars=args.minimum-args.input.length;var message="Please enter "+remainingChars+" or more characters";return message},loadingMore:function(){return"Loading more results…"},maximumSelected:function(args){var message="You can only select "+args.maximum+" item";if(args.maximum!=1){message+="s"}return message},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"}}});S2.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function($,require,ResultsList,SingleSelection,MultipleSelection,Placeholder,AllowClear,SelectionSearch,EventRelay,Utils,Translation,DIACRITICS,SelectData,ArrayData,AjaxData,Tags,Tokenizer,MinimumInputLength,MaximumInputLength,MaximumSelectionLength,Dropdown,DropdownSearch,HidePlaceholder,InfiniteScroll,AttachBody,MinimumResultsForSearch,SelectOnClose,CloseOnSelect,EnglishTranslation){function Defaults(){this.reset()}Defaults.prototype.apply=function(options){options=$.extend(true,{},this.defaults,options);if(options.dataAdapter==null){if(options.ajax!=null){options.dataAdapter=AjaxData}else if(options.data!=null){options.dataAdapter=ArrayData}else{options.dataAdapter=SelectData}if(options.minimumInputLength>0){options.dataAdapter=Utils.Decorate(options.dataAdapter,MinimumInputLength)}if(options.maximumInputLength>0){options.dataAdapter=Utils.Decorate(options.dataAdapter,MaximumInputLength)}if(options.maximumSelectionLength>0){options.dataAdapter=Utils.Decorate(options.dataAdapter,MaximumSelectionLength)}if(options.tags){options.dataAdapter=Utils.Decorate(options.dataAdapter,Tags)}if(options.tokenSeparators!=null||options.tokenizer!=null){options.dataAdapter=Utils.Decorate(options.dataAdapter,Tokenizer)}if(options.query!=null){var Query=require(options.amdBase+"compat/query");options.dataAdapter=Utils.Decorate(options.dataAdapter,Query)}if(options.initSelection!=null){var InitSelection=require(options.amdBase+"compat/initSelection");options.dataAdapter=Utils.Decorate(options.dataAdapter,InitSelection)}}if(options.resultsAdapter==null){options.resultsAdapter=ResultsList;if(options.ajax!=null){options.resultsAdapter=Utils.Decorate(options.resultsAdapter,InfiniteScroll)}if(options.placeholder!=null){options.resultsAdapter=Utils.Decorate(options.resultsAdapter,HidePlaceholder)}if(options.selectOnClose){options.resultsAdapter=Utils.Decorate(options.resultsAdapter,SelectOnClose)}}if(options.dropdownAdapter==null){if(options.multiple){options.dropdownAdapter=Dropdown}else{var SearchableDropdown=Utils.Decorate(Dropdown,DropdownSearch);options.dropdownAdapter=SearchableDropdown}if(options.minimumResultsForSearch!==0){options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,MinimumResultsForSearch)}if(options.closeOnSelect){options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,CloseOnSelect)}if(options.dropdownCssClass!=null||options.dropdownCss!=null||options.adaptDropdownCssClass!=null){var DropdownCSS=require(options.amdBase+"compat/dropdownCss");options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,DropdownCSS)}options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,AttachBody)}if(options.selectionAdapter==null){if(options.multiple){options.selectionAdapter=MultipleSelection}else{options.selectionAdapter=SingleSelection}if(options.placeholder!=null){options.selectionAdapter=Utils.Decorate(options.selectionAdapter,Placeholder)}if(options.allowClear){options.selectionAdapter=Utils.Decorate(options.selectionAdapter,AllowClear)}if(options.multiple){options.selectionAdapter=Utils.Decorate(options.selectionAdapter,SelectionSearch)}if(options.containerCssClass!=null||options.containerCss!=null||options.adaptContainerCssClass!=null){var ContainerCSS=require(options.amdBase+"compat/containerCss");options.selectionAdapter=Utils.Decorate(options.selectionAdapter,ContainerCSS)}options.selectionAdapter=Utils.Decorate(options.selectionAdapter,EventRelay)}options.language=this._resolveLanguage(options.language);options.language.push("en");var uniqueLanguages=[];for(var l=0;l<options.language.length;l++){var language=options.language[l];if(uniqueLanguages.indexOf(language)===-1){uniqueLanguages.push(language)}}options.language=uniqueLanguages;options.translations=this._processTranslations(options.language,options.debug);return options};Defaults.prototype.reset=function(){function stripDiacritics(text){function match(a){return DIACRITICS[a]||a}return text.replace(/[^\u0000-\u007E]/g,match)}function matcher(params,data){if($.trim(params.term)===""){return data}if(data.children&&data.children.length>0){var match=$.extend(true,{},data);for(var c=data.children.length-1;c>=0;c--){var child=data.children[c];var matches=matcher(params,child);if(matches==null){match.children.splice(c,1)}}if(match.children.length>0){return match}return matcher(params,match)}var original=stripDiacritics(data.text).toUpperCase();var term=stripDiacritics(params.term).toUpperCase();if(original.indexOf(term)>-1){return data}return null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:true,debug:false,dropdownAutoWidth:false,escapeMarkup:Utils.escapeMarkup,language:{},matcher:matcher,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:false,scrollAfterSelect:false,sorter:function(data){return data},templateResult:function(result){return result.text},templateSelection:function(selection){return selection.text},theme:"default",width:"resolve"}};Defaults.prototype.applyFromElement=function(options,$element){var optionLanguage=options.language;var defaultLanguage=this.defaults.language;var elementLanguage=$element.prop("lang");var parentLanguage=$element.closest("[lang]").prop("lang");var languages=Array.prototype.concat.call(this._resolveLanguage(elementLanguage),this._resolveLanguage(optionLanguage),this._resolveLanguage(defaultLanguage),this._resolveLanguage(parentLanguage));options.language=languages;return options};Defaults.prototype._resolveLanguage=function(language){if(!language){return[]}if($.isEmptyObject(language)){return[]}if($.isPlainObject(language)){return[language]}var languages;if(!$.isArray(language)){languages=[language]}else{languages=language}var resolvedLanguages=[];for(var l=0;l<languages.length;l++){resolvedLanguages.push(languages[l]);if(typeof languages[l]==="string"&&languages[l].indexOf("-")>0){var languageParts=languages[l].split("-");var baseLanguage=languageParts[0];resolvedLanguages.push(baseLanguage)}}return resolvedLanguages};Defaults.prototype._processTranslations=function(languages,debug){var translations=new Translation;for(var l=0;l<languages.length;l++){var languageData=new Translation;var language=languages[l];if(typeof language==="string"){try{languageData=Translation.loadPath(language)}catch(e){try{language=this.defaults.amdLanguageBase+language;languageData=Translation.loadPath(language)}catch(ex){if(debug&&window.console&&console.warn){console.warn('Select2: The language file for "'+language+'" could '+"not be automatically loaded. A fallback will be used instead.")}}}}else if($.isPlainObject(language)){languageData=new Translation(language)}else{languageData=language}translations.extend(languageData)}return translations};Defaults.prototype.set=function(key,value){var camelKey=$.camelCase(key);var data={};data[camelKey]=value;var convertedData=Utils._convertData(data);$.extend(true,this.defaults,convertedData)};var defaults=new Defaults;return defaults});S2.define("select2/options",["require","jquery","./defaults","./utils"],function(require,$,Defaults,Utils){function Options(options,$element){this.options=options;if($element!=null){this.fromElement($element)}if($element!=null){this.options=Defaults.applyFromElement(this.options,$element)}this.options=Defaults.apply(this.options);if($element&&$element.is("input")){var InputCompat=require(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=Utils.Decorate(this.options.dataAdapter,InputCompat)}}Options.prototype.fromElement=function($e){var excludedData=["select2"];if(this.options.multiple==null){this.options.multiple=$e.prop("multiple")}if(this.options.disabled==null){this.options.disabled=$e.prop("disabled")}if(this.options.dir==null){if($e.prop("dir")){this.options.dir=$e.prop("dir")}else if($e.closest("[dir]").prop("dir")){this.options.dir=$e.closest("[dir]").prop("dir")}else{this.options.dir="ltr"}}$e.prop("disabled",this.options.disabled);$e.prop("multiple",this.options.multiple);if(Utils.GetData($e[0],"select2Tags")){if(this.options.debug&&window.console&&console.warn){console.warn("Select2: The `data-select2-tags` attribute has been changed to "+'use the `data-data` and `data-tags="true"` attributes and will be '+"removed in future versions of Select2.")}Utils.StoreData($e[0],"data",Utils.GetData($e[0],"select2Tags"));Utils.StoreData($e[0],"tags",true)}if(Utils.GetData($e[0],"ajaxUrl")){if(this.options.debug&&window.console&&console.warn){console.warn("Select2: The `data-ajax-url` attribute has been changed to "+"`data-ajax--url` and support for the old attribute will be removed"+" in future versions of Select2.")}$e.attr("ajax--url",Utils.GetData($e[0],"ajaxUrl"));Utils.StoreData($e[0],"ajax-Url",Utils.GetData($e[0],"ajaxUrl"))}var dataset={};function upperCaseLetter(_,letter){return letter.toUpperCase()}for(var attr=0;attr<$e[0].attributes.length;attr++){var attributeName=$e[0].attributes[attr].name;var prefix="data-";if(attributeName.substr(0,prefix.length)==prefix){var dataName=attributeName.substring(prefix.length);var dataValue=Utils.GetData($e[0],dataName);var camelDataName=dataName.replace(/-([a-z])/g,upperCaseLetter);dataset[camelDataName]=dataValue}}if($.fn.jquery&&$.fn.jquery.substr(0,2)=="1."&&$e[0].dataset){dataset=$.extend(true,{},$e[0].dataset,dataset)}var data=$.extend(true,{},Utils.GetData($e[0]),dataset);data=Utils._convertData(data);for(var key in data){if($.inArray(key,excludedData)>-1){continue}if($.isPlainObject(this.options[key])){$.extend(this.options[key],data[key])}else{this.options[key]=data[key]}}return this};Options.prototype.get=function(key){return this.options[key]};Options.prototype.set=function(key,val){this.options[key]=val};return Options});S2.define("select2/core",["jquery","./options","./utils","./keys"],function($,Options,Utils,KEYS){var Select2=function($element,options){if(Utils.GetData($element[0],"select2")!=null){Utils.GetData($element[0],"select2").destroy()}this.$element=$element;this.id=this._generateId($element);options=options||{};this.options=new Options(options,$element);Select2.__super__.constructor.call(this);var tabindex=$element.attr("tabindex")||0;Utils.StoreData($element[0],"old-tabindex",tabindex);$element.attr("tabindex","-1");var DataAdapter=this.options.get("dataAdapter");this.dataAdapter=new DataAdapter($element,this.options);var $container=this.render();this._placeContainer($container);var SelectionAdapter=this.options.get("selectionAdapter");this.selection=new SelectionAdapter($element,this.options);this.$selection=this.selection.render();this.selection.position(this.$selection,$container);var DropdownAdapter=this.options.get("dropdownAdapter");this.dropdown=new DropdownAdapter($element,this.options);this.$dropdown=this.dropdown.render();this.dropdown.position(this.$dropdown,$container);var ResultsAdapter=this.options.get("resultsAdapter");this.results=new ResultsAdapter($element,this.options,this.dataAdapter);this.$results=this.results.render();this.results.position(this.$results,this.$dropdown);var self=this;this._bindAdapters();this._registerDomEvents();this._registerDataEvents();this._registerSelectionEvents();this._registerDropdownEvents();this._registerResultsEvents();this._registerEvents();this.dataAdapter.current(function(initialData){self.trigger("selection:update",{data:initialData})});$element.addClass("select2-hidden-accessible");$element.attr("aria-hidden","true");this._syncAttributes();Utils.StoreData($element[0],"select2",this);$element.data("select2",this)};Utils.Extend(Select2,Utils.Observable);Select2.prototype._generateId=function($element){var id="";if($element.attr("id")!=null){id=$element.attr("id")}else if($element.attr("name")!=null){id=$element.attr("name")+"-"+Utils.generateChars(2)}else{id=Utils.generateChars(4)}id=id.replace(/(:|\.|\[|\]|,)/g,"");id="select2-"+id;return id};Select2.prototype._placeContainer=function($container){$container.insertAfter(this.$element);var width=this._resolveWidth(this.$element,this.options.get("width"));if(width!=null){$container.css("width",width)}};Select2.prototype._resolveWidth=function($element,method){var WIDTH=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if(method=="resolve"){var styleWidth=this._resolveWidth($element,"style");if(styleWidth!=null){return styleWidth}return this._resolveWidth($element,"element")}if(method=="element"){var elementWidth=$element.outerWidth(false);if(elementWidth<=0){return"auto"}return elementWidth+"px"}if(method=="style"){var style=$element.attr("style");if(typeof style!=="string"){return null}var attrs=style.split(";");for(var i=0,l=attrs.length;i<l;i=i+1){var attr=attrs[i].replace(/\s/g,"");var matches=attr.match(WIDTH);if(matches!==null&&matches.length>=1){return matches[1]}}return null}if(method=="computedstyle"){var computedStyle=window.getComputedStyle($element[0]);return computedStyle.width}return method};Select2.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container);this.selection.bind(this,this.$container);this.dropdown.bind(this,this.$container);this.results.bind(this,this.$container)};Select2.prototype._registerDomEvents=function(){var self=this;this.$element.on("change.select2",function(){self.dataAdapter.current(function(data){self.trigger("selection:update",{data:data})})});this.$element.on("focus.select2",function(evt){self.trigger("focus",evt)});this._syncA=Utils.bind(this._syncAttributes,this);this._syncS=Utils.bind(this._syncSubtree,this);if(this.$element[0].attachEvent){this.$element[0].attachEvent("onpropertychange",this._syncA)}var observer=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;if(observer!=null){this._observer=new observer(function(mutations){self._syncA();self._syncS(null,mutations)});this._observer.observe(this.$element[0],{attributes:true,childList:true,subtree:false})}else if(this.$element[0].addEventListener){this.$element[0].addEventListener("DOMAttrModified",self._syncA,false);this.$element[0].addEventListener("DOMNodeInserted",self._syncS,false);this.$element[0].addEventListener("DOMNodeRemoved",self._syncS,false)}};Select2.prototype._registerDataEvents=function(){var self=this;this.dataAdapter.on("*",function(name,params){self.trigger(name,params)})};Select2.prototype._registerSelectionEvents=function(){var self=this;var nonRelayEvents=["toggle","focus"];this.selection.on("toggle",function(){self.toggleDropdown()});this.selection.on("focus",function(params){self.focus(params)});this.selection.on("*",function(name,params){if($.inArray(name,nonRelayEvents)!==-1){return}self.trigger(name,params)})};Select2.prototype._registerDropdownEvents=function(){var self=this;this.dropdown.on("*",function(name,params){self.trigger(name,params)})};Select2.prototype._registerResultsEvents=function(){var self=this;this.results.on("*",function(name,params){self.trigger(name,params)})};Select2.prototype._registerEvents=function(){var self=this;this.on("open",function(){self.$container.addClass("select2-container--open")});this.on("close",function(){self.$container.removeClass("select2-container--open")});this.on("enable",function(){self.$container.removeClass("select2-container--disabled")});this.on("disable",function(){self.$container.addClass("select2-container--disabled")});this.on("blur",function(){self.$container.removeClass("select2-container--focus")});this.on("query",function(params){if(!self.isOpen()){self.trigger("open",{})}this.dataAdapter.query(params,function(data){self.trigger("results:all",{data:data,query:params})})});this.on("query:append",function(params){this.dataAdapter.query(params,function(data){self.trigger("results:append",{data:data,query:params})})});this.on("keypress",function(evt){var key=evt.which;if(self.isOpen()){if(key===KEYS.ESC||key===KEYS.TAB||key===KEYS.UP&&evt.altKey){self.close(evt);evt.preventDefault()}else if(key===KEYS.ENTER){self.trigger("results:select",{});evt.preventDefault()}else if(key===KEYS.SPACE&&evt.ctrlKey){self.trigger("results:toggle",{});evt.preventDefault()}else if(key===KEYS.UP){self.trigger("results:previous",{});evt.preventDefault()}else if(key===KEYS.DOWN){self.trigger("results:next",{});evt.preventDefault()}}else{if(key===KEYS.ENTER||key===KEYS.SPACE||key===KEYS.DOWN&&evt.altKey){self.open();evt.preventDefault()}}})};Select2.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled"));if(this.isDisabled()){if(this.isOpen()){this.close()}this.trigger("disable",{})}else{this.trigger("enable",{})}};Select2.prototype._isChangeMutation=function(evt,mutations){var changed=false;var self=this;if(evt&&evt.target&&(evt.target.nodeName!=="OPTION"&&evt.target.nodeName!=="OPTGROUP")){return}if(!mutations){changed=true}else if(mutations.addedNodes&&mutations.addedNodes.length>0){for(var n=0;n<mutations.addedNodes.length;n++){var node=mutations.addedNodes[n];if(node.selected){changed=true}}}else if(mutations.removedNodes&&mutations.removedNodes.length>0){changed=true}else if($.isArray(mutations)){$.each(mutations,function(evt,mutation){if(self._isChangeMutation(evt,mutation)){changed=true;return false}})}return changed};Select2.prototype._syncSubtree=function(evt,mutations){var changed=this._isChangeMutation(evt,mutations);var self=this;if(changed){this.dataAdapter.current(function(currentData){self.trigger("selection:update",{data:currentData})})}};Select2.prototype.trigger=function(name,args){var actualTrigger=Select2.__super__.trigger;var preTriggerMap={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(args===undefined){args={}}if(name in preTriggerMap){var preTriggerName=preTriggerMap[name];var preTriggerArgs={prevented:false,name:name,args:args};actualTrigger.call(this,preTriggerName,preTriggerArgs);if(preTriggerArgs.prevented){args.prevented=true;return}}actualTrigger.call(this,name,args)};Select2.prototype.toggleDropdown=function(){if(this.isDisabled()){return}if(this.isOpen()){this.close()}else{this.open()}};Select2.prototype.open=function(){if(this.isOpen()){return}if(this.isDisabled()){return}this.trigger("query",{})};Select2.prototype.close=function(evt){if(!this.isOpen()){return}this.trigger("close",{originalEvent:evt})};Select2.prototype.isEnabled=function(){return!this.isDisabled()};Select2.prototype.isDisabled=function(){return this.options.get("disabled")};Select2.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")};Select2.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")};Select2.prototype.focus=function(data){if(this.hasFocus()){return}this.$container.addClass("select2-container--focus");this.trigger("focus",{})};Select2.prototype.enable=function(args){if(this.options.get("debug")&&window.console&&console.warn){console.warn('Select2: The `select2("enable")` method has been deprecated and will'+' be removed in later Select2 versions. Use $element.prop("disabled")'+" instead.")}if(args==null||args.length===0){args=[true]}var disabled=!args[0];this.$element.prop("disabled",disabled)};Select2.prototype.data=function(){if(this.options.get("debug")&&arguments.length>0&&window.console&&console.warn){console.warn('Select2: Data can no longer be set using `select2("data")`. You '+"should consider setting the value instead using `$element.val()`.")}var data=[];this.dataAdapter.current(function(currentData){data=currentData});return data};Select2.prototype.val=function(args){if(this.options.get("debug")&&window.console&&console.warn){console.warn('Select2: The `select2("val")` method has been deprecated and will be'+" removed in later Select2 versions. Use $element.val() instead.")}if(args==null||args.length===0){return this.$element.val()}var newVal=args[0];if($.isArray(newVal)){newVal=$.map(newVal,function(obj){return obj.toString()})}this.$element.val(newVal).trigger("input").trigger("change")};Select2.prototype.destroy=function(){this.$container.remove();if(this.$element[0].detachEvent){this.$element[0].detachEvent("onpropertychange",this._syncA)}if(this._observer!=null){this._observer.disconnect();this._observer=null}else if(this.$element[0].removeEventListener){this.$element[0].removeEventListener("DOMAttrModified",this._syncA,false);this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,false);this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,false)}this._syncA=null;this._syncS=null;this.$element.off(".select2");this.$element.attr("tabindex",Utils.GetData(this.$element[0],"old-tabindex"));this.$element.removeClass("select2-hidden-accessible");this.$element.attr("aria-hidden","false");Utils.RemoveData(this.$element[0]);this.$element.removeData("select2");this.dataAdapter.destroy();this.selection.destroy();this.dropdown.destroy();this.results.destroy();this.dataAdapter=null;this.selection=null;this.dropdown=null;this.results=null};Select2.prototype.render=function(){var $container=$('<span class="select2 select2-container">'+'<span class="selection"></span>'+'<span class="dropdown-wrapper" aria-hidden="true"></span>'+"</span>");$container.attr("dir",this.options.get("dir"));this.$container=$container;this.$container.addClass("select2-container--"+this.options.get("theme"));Utils.StoreData($container[0],"element",this.$element);return $container};return Select2});S2.define("select2/compat/utils",["jquery"],function($){function syncCssClasses($dest,$src,adapter){var classes,replacements=[],adapted;classes=$.trim($dest.attr("class"));if(classes){classes=""+classes;$(classes.split(/\s+/)).each(function(){if(this.indexOf("select2-")===0){replacements.push(this)}})}classes=$.trim($src.attr("class"));if(classes){classes=""+classes;$(classes.split(/\s+/)).each(function(){if(this.indexOf("select2-")!==0){adapted=adapter(this);if(adapted!=null){replacements.push(adapted)}}})}$dest.attr("class",replacements.join(" "))}return{syncCssClasses:syncCssClasses}});S2.define("select2/compat/containerCss",["jquery","./utils"],function($,CompatUtils){function _containerAdapter(clazz){return null}function ContainerCSS(){}ContainerCSS.prototype.render=function(decorated){var $container=decorated.call(this);var containerCssClass=this.options.get("containerCssClass")||"";if($.isFunction(containerCssClass)){containerCssClass=containerCssClass(this.$element)}var containerCssAdapter=this.options.get("adaptContainerCssClass");containerCssAdapter=containerCssAdapter||_containerAdapter;if(containerCssClass.indexOf(":all:")!==-1){containerCssClass=containerCssClass.replace(":all:","");var _cssAdapter=containerCssAdapter;containerCssAdapter=function(clazz){var adapted=_cssAdapter(clazz);if(adapted!=null){return adapted+" "+clazz}return clazz}}var containerCss=this.options.get("containerCss")||{};if($.isFunction(containerCss)){containerCss=containerCss(this.$element)}CompatUtils.syncCssClasses($container,this.$element,containerCssAdapter);$container.css(containerCss);$container.addClass(containerCssClass);return $container};return ContainerCSS});S2.define("select2/compat/dropdownCss",["jquery","./utils"],function($,CompatUtils){function _dropdownAdapter(clazz){return null}function DropdownCSS(){}DropdownCSS.prototype.render=function(decorated){var $dropdown=decorated.call(this);var dropdownCssClass=this.options.get("dropdownCssClass")||"";if($.isFunction(dropdownCssClass)){dropdownCssClass=dropdownCssClass(this.$element)}var dropdownCssAdapter=this.options.get("adaptDropdownCssClass");dropdownCssAdapter=dropdownCssAdapter||_dropdownAdapter;if(dropdownCssClass.indexOf(":all:")!==-1){dropdownCssClass=dropdownCssClass.replace(":all:","");var _cssAdapter=dropdownCssAdapter;
dropdownCssAdapter=function(clazz){var adapted=_cssAdapter(clazz);if(adapted!=null){return adapted+" "+clazz}return clazz}}var dropdownCss=this.options.get("dropdownCss")||{};if($.isFunction(dropdownCss)){dropdownCss=dropdownCss(this.$element)}CompatUtils.syncCssClasses($dropdown,this.$element,dropdownCssAdapter);$dropdown.css(dropdownCss);$dropdown.addClass(dropdownCssClass);return $dropdown};return DropdownCSS});S2.define("select2/compat/initSelection",["jquery"],function($){function InitSelection(decorated,$element,options){if(options.get("debug")&&window.console&&console.warn){console.warn("Select2: The `initSelection` option has been deprecated in favor"+" of a custom data adapter that overrides the `current` method. "+"This method is now called multiple times instead of a single "+"time when the instance is initialized. Support will be removed "+"for the `initSelection` option in future versions of Select2")}this.initSelection=options.get("initSelection");this._isInitialized=false;decorated.call(this,$element,options)}InitSelection.prototype.current=function(decorated,callback){var self=this;if(this._isInitialized){decorated.call(this,callback);return}this.initSelection.call(null,this.$element,function(data){self._isInitialized=true;if(!$.isArray(data)){data=[data]}callback(data)})};return InitSelection});S2.define("select2/compat/inputData",["jquery","../utils"],function($,Utils){function InputData(decorated,$element,options){this._currentData=[];this._valueSeparator=options.get("valueSeparator")||",";if($element.prop("type")==="hidden"){if(options.get("debug")&&console&&console.warn){console.warn("Select2: Using a hidden input with Select2 is no longer "+"supported and may stop working in the future. It is recommended "+"to use a `<select>` element instead.")}}decorated.call(this,$element,options)}InputData.prototype.current=function(_,callback){function getSelected(data,selectedIds){var selected=[];if(data.selected||$.inArray(data.id,selectedIds)!==-1){data.selected=true;selected.push(data)}else{data.selected=false}if(data.children){selected.push.apply(selected,getSelected(data.children,selectedIds))}return selected}var selected=[];for(var d=0;d<this._currentData.length;d++){var data=this._currentData[d];selected.push.apply(selected,getSelected(data,this.$element.val().split(this._valueSeparator)))}callback(selected)};InputData.prototype.select=function(_,data){if(!this.options.get("multiple")){this.current(function(allData){$.map(allData,function(data){data.selected=false})});this.$element.val(data.id);this.$element.trigger("input").trigger("change")}else{var value=this.$element.val();value+=this._valueSeparator+data.id;this.$element.val(value);this.$element.trigger("input").trigger("change")}};InputData.prototype.unselect=function(_,data){var self=this;data.selected=false;this.current(function(allData){var values=[];for(var d=0;d<allData.length;d++){var item=allData[d];if(data.id==item.id){continue}values.push(item.id)}self.$element.val(values.join(self._valueSeparator));self.$element.trigger("input").trigger("change")})};InputData.prototype.query=function(_,params,callback){var results=[];for(var d=0;d<this._currentData.length;d++){var data=this._currentData[d];var matches=this.matches(params,data);if(matches!==null){results.push(matches)}}callback({results:results})};InputData.prototype.addOptions=function(_,$options){var options=$.map($options,function($option){return Utils.GetData($option[0],"data")});this._currentData.push.apply(this._currentData,options)};return InputData});S2.define("select2/compat/matcher",["jquery"],function($){function oldMatcher(matcher){function wrappedMatcher(params,data){var match=$.extend(true,{},data);if(params.term==null||$.trim(params.term)===""){return match}if(data.children){for(var c=data.children.length-1;c>=0;c--){var child=data.children[c];var doesMatch=matcher(params.term,child.text,child);if(!doesMatch){match.children.splice(c,1)}}if(match.children.length>0){return match}}if(matcher(params.term,data.text,data)){return match}return null}return wrappedMatcher}return oldMatcher});S2.define("select2/compat/query",[],function(){function Query(decorated,$element,options){if(options.get("debug")&&window.console&&console.warn){console.warn("Select2: The `query` option has been deprecated in favor of a "+"custom data adapter that overrides the `query` method. Support "+"will be removed for the `query` option in future versions of "+"Select2.")}decorated.call(this,$element,options)}Query.prototype.query=function(_,params,callback){params.callback=callback;var query=this.options.get("query");query.call(null,params)};return Query});S2.define("select2/dropdown/attachContainer",[],function(){function AttachContainer(decorated,$element,options){decorated.call(this,$element,options)}AttachContainer.prototype.position=function(decorated,$dropdown,$container){var $dropdownContainer=$container.find(".dropdown-wrapper");$dropdownContainer.append($dropdown);$dropdown.addClass("select2-dropdown--below");$container.addClass("select2-container--below")};return AttachContainer});S2.define("select2/dropdown/stopPropagation",[],function(){function StopPropagation(){}StopPropagation.prototype.bind=function(decorated,container,$container){decorated.call(this,container,$container);var stoppedEvents=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$dropdown.on(stoppedEvents.join(" "),function(evt){evt.stopPropagation()})};return StopPropagation});S2.define("select2/selection/stopPropagation",[],function(){function StopPropagation(){}StopPropagation.prototype.bind=function(decorated,container,$container){decorated.call(this,container,$container);var stoppedEvents=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$selection.on(stoppedEvents.join(" "),function(evt){evt.stopPropagation()})};return StopPropagation});(function(factory){if(typeof S2.define==="function"&&S2.define.amd){S2.define("jquery-mousewheel",["jquery"],factory)}else if(typeof exports==="object"){module.exports=factory}else{factory(jQuery)}})(function($){var toFix=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],toBind="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],slice=Array.prototype.slice,nullLowestDeltaTimeout,lowestDelta;if($.event.fixHooks){for(var i=toFix.length;i;){$.event.fixHooks[toFix[--i]]=$.event.mouseHooks}}var special=$.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener){for(var i=toBind.length;i;){this.addEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=handler}$.data(this,"mousewheel-line-height",special.getLineHeight(this));$.data(this,"mousewheel-page-height",special.getPageHeight(this))},teardown:function(){if(this.removeEventListener){for(var i=toBind.length;i;){this.removeEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=null}$.removeData(this,"mousewheel-line-height");$.removeData(this,"mousewheel-page-height")},getLineHeight:function(elem){var $elem=$(elem),$parent=$elem["offsetParent"in $.fn?"offsetParent":"parent"]();if(!$parent.length){$parent=$("body")}return parseInt($parent.css("fontSize"),10)||parseInt($elem.css("fontSize"),10)||16},getPageHeight:function(elem){return $(elem).height()},settings:{adjustOldDeltas:true,normalizeOffset:true}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel")},unmousewheel:function(fn){return this.unbind("mousewheel",fn)}});function handler(event){var orgEvent=event||window.event,args=slice.call(arguments,1),delta=0,deltaX=0,deltaY=0,absDelta=0,offsetX=0,offsetY=0;event=$.event.fix(orgEvent);event.type="mousewheel";if("detail"in orgEvent){deltaY=orgEvent.detail*-1}if("wheelDelta"in orgEvent){deltaY=orgEvent.wheelDelta}if("wheelDeltaY"in orgEvent){deltaY=orgEvent.wheelDeltaY}if("wheelDeltaX"in orgEvent){deltaX=orgEvent.wheelDeltaX*-1}if("axis"in orgEvent&&orgEvent.axis===orgEvent.HORIZONTAL_AXIS){deltaX=deltaY*-1;deltaY=0}delta=deltaY===0?deltaX:deltaY;if("deltaY"in orgEvent){deltaY=orgEvent.deltaY*-1;delta=deltaY}if("deltaX"in orgEvent){deltaX=orgEvent.deltaX;if(deltaY===0){delta=deltaX*-1}}if(deltaY===0&&deltaX===0){return}if(orgEvent.deltaMode===1){var lineHeight=$.data(this,"mousewheel-line-height");delta*=lineHeight;deltaY*=lineHeight;deltaX*=lineHeight}else if(orgEvent.deltaMode===2){var pageHeight=$.data(this,"mousewheel-page-height");delta*=pageHeight;deltaY*=pageHeight;deltaX*=pageHeight}absDelta=Math.max(Math.abs(deltaY),Math.abs(deltaX));if(!lowestDelta||absDelta<lowestDelta){lowestDelta=absDelta;if(shouldAdjustOldDeltas(orgEvent,absDelta)){lowestDelta/=40}}if(shouldAdjustOldDeltas(orgEvent,absDelta)){delta/=40;deltaX/=40;deltaY/=40}delta=Math[delta>=1?"floor":"ceil"](delta/lowestDelta);deltaX=Math[deltaX>=1?"floor":"ceil"](deltaX/lowestDelta);deltaY=Math[deltaY>=1?"floor":"ceil"](deltaY/lowestDelta);if(special.settings.normalizeOffset&&this.getBoundingClientRect){var boundingRect=this.getBoundingClientRect();offsetX=event.clientX-boundingRect.left;offsetY=event.clientY-boundingRect.top}event.deltaX=deltaX;event.deltaY=deltaY;event.deltaFactor=lowestDelta;event.offsetX=offsetX;event.offsetY=offsetY;event.deltaMode=0;args.unshift(event,delta,deltaX,deltaY);if(nullLowestDeltaTimeout){clearTimeout(nullLowestDeltaTimeout)}nullLowestDeltaTimeout=setTimeout(nullLowestDelta,200);return($.event.dispatch||$.event.handle).apply(this,args)}function nullLowestDelta(){lowestDelta=null}function shouldAdjustOldDeltas(orgEvent,absDelta){return special.settings.adjustOldDeltas&&orgEvent.type==="mousewheel"&&absDelta%120===0}});S2.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function($,_,Select2,Defaults,Utils){if($.fn.select2==null){var thisMethods=["open","close","destroy"];$.fn.select2=function(options){options=options||{};if(typeof options==="object"){this.each(function(){var instanceOptions=$.extend(true,{},options);var instance=new Select2($(this),instanceOptions)});return this}else if(typeof options==="string"){var ret;var args=Array.prototype.slice.call(arguments,1);this.each(function(){var instance=Utils.GetData(this,"select2");if(instance==null&&window.console&&console.error){console.error("The select2('"+options+"') method was called on an "+"element that is not using Select2.")}ret=instance[options].apply(instance,args)});if($.inArray(options,thisMethods)>-1){return this}return ret}else{throw new Error("Invalid arguments for Select2: "+options)}}}if($.fn.select2.defaults==null){$.fn.select2.defaults=Defaults}return Select2});return{define:S2.define,require:S2.require}}();var select2=S2.require("jquery.select2");jQuery.fn.select2.amd=S2;return select2});
// source --> https://businessportal.bg/wp-content/plugins/geodirectory/assets/js/geodir-select2.min.js?ver=2.8.162 
jQuery(function($){try{$(document.body).on("geodir-select-init",function(){$(":input.geodir-select").filter(":not(.enhanced)").each(function(){var $this=$(this);var select2_args=$.extend({minimumResultsForSearch:$this.data("tags")?0:parseInt($this.data("min-results"))>0?parseInt($this.data("min-results")):10,allowClear:$(this).data("allow_clear")?true:false,containerCssClass:"gd-select2-selection",dropdownCssClass:"gd-select2-dropdown",placeholder:$(this).data("placeholder"),width:"resolve",dropdownAutoWidth:true,templateSelection:function(data){return geodirSelect2TemplateSelection($this,data)}},geodirSelect2FormatString());var $select2=$(this).select2(select2_args);$select2.addClass("enhanced");$select2.data("select2").$container.addClass("gd-select2-container");$select2.data("select2").$dropdown.addClass("gd-select2-container");if($(this).data("sortable")){var $select=$(this);var $list=$(this).next(".select2-container").find("ul.select2-selection__rendered");$list.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:true,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){$($list.find(".select2-selection__choice").get().reverse()).each(function(){var id=$(this).data("data").id;var option=$select.find('option[value="'+id+'"]')[0];$select.prepend(option)})}})}$this.on("change.select2",function(e){geodirSelect2OnChange($this,$select2)});if($this.data("cmultiselect")||$this.data("cselect")){$this.trigger("change.select2")}});$(":input.geodir-select-nostd").filter(":not(.enhanced)").each(function(){var $this=$(this);var select2_args=$.extend({minimumResultsForSearch:$this.data("tags")?0:parseInt($this.data("min-results"))>0?parseInt($this.data("min-results")):10,allowClear:true,containerCssClass:"gd-select2-selection",dropdownCssClass:"gd-select2-dropdown",placeholder:$(this).data("placeholder"),templateSelection:function(data){return geodirSelect2TemplateSelection($this,data)}},geodirSelect2FormatString());var $select2=$(this).select2(select2_args);$select2.addClass("enhanced");$select2.data("select2").$container.addClass("gd-select2-container");$select2.data("select2").$dropdown.addClass("gd-select2-container");if($(this).data("sortable")){var $select=$(this);var $list=$(this).next(".select2-container").find("ul.select2-selection__rendered");$list.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:true,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){$($list.find(".select2-selection__choice").get().reverse()).each(function(){var id=$(this).data("data").id;var option=$select.find('option[value="'+id+'"]')[0];$select.prepend(option)})}})}$this.on("change.select2",function(e){geodirSelect2OnChange($this,$select2)});if($this.data("cmultiselect")||$this.data("cselect")){$this.trigger("change.select2")}});$(":input.geodir-select-tags").filter(":not(.enhanced)").each(function(){var select2_args=$.extend({tags:true,selectOnClose:false,tokenSeparators:[","],minimumResultsForSearch:10,allowClear:$(this).data("allow_clear")?true:false,containerCssClass:"gd-select2-selection",dropdownCssClass:"gd-select2-dropdown",placeholder:$(this).data("placeholder")},geodirSelect2FormatString());var $select2=$(this).select2(select2_args);$select2.addClass("enhanced");$select2.data("select2").$container.addClass("gd-select2-container");$select2.data("select2").$dropdown.addClass("gd-select2-container");if($(this).data("sortable")){var $select=$(this);var $list=$(this).next(".select2-container").find("ul.select2-selection__rendered");$list.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:true,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){$($list.find(".select2-selection__choice").get().reverse()).each(function(){var id=$(this).data("data").id;var option=$select.find('option[value="'+id+'"]')[0];$select.prepend(option)})}})}});$(":input.geodir-select-search").filter(":not(.enhanced)").each(function(){var search=$(this).data("select-search");if(!search){return true}var select2_args={allowClear:$(this).data("allow_clear")?true:false,placeholder:$(this).data("placeholder"),minimumInputLength:$(this).data("min-input-length")?$(this).data("min-input-length"):"2",escapeMarkup:function(m){return m},ajax:{url:geodir_params.ajax_url,type:"POST",dataType:"json",delay:250,data:function(params){var data={term:params.term,action:"geodir_json_search_"+search,security:$(this).data("nonce")};if($(this).data("exclude")){data.exclude=$(this).data("exclude")}if($(this).data("include")){data.include=$(this).data("include")}if($(this).data("limit")){data.limit=$(this).data("limit")}return data},processResults:function(data){var terms=[];if(data){$.each(data,function(id,text){terms.push({id:id,text:text})})}return{results:terms}},cache:true}};select2_args=$.extend(select2_args,geodirSelect2FormatString());var $select2=$(this).select2(select2_args);$select2.addClass("enhanced");$select2.data("select2").$container.addClass("gd-select2-container");$select2.data("select2").$dropdown.addClass("gd-select2-container");if($(this).data("sortable")){var $select=$(this);var $list=$(this).next(".select2-container").find("ul.select2-selection__rendered");$list.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:true,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){$($list.find(".select2-selection__choice").get().reverse()).each(function(){var id=$(this).data("data").id;var option=$select.find('option[value="'+id+'"]')[0];$select.prepend(option)})}})}else if($(this).prop("multiple")){$(this).on("change",function(){var $children=$(this).children();$children.sort(function(a,b){var atext=a.text.toLowerCase();var btext=b.text.toLowerCase();if(atext>btext){return 1}if(atext<btext){return-1}return 0});$(this).html($children)})}})}).trigger("geodir-select-init");$("html").on("click",function(event){if(this===event.target){$(".geodir-select, :input.geodir-select-search").filter(".select2-hidden-accessible").select2("close")}})}catch(err){window.console.log(err)}});function geodirSelect2FormatString(){return{language:{errorLoading:function(){return geodir_select2_params.i18n_searching},inputTooLong:function(args){var overChars=args.input.length-args.maximum;if(1===overChars){return geodir_select2_params.i18n_input_too_long_1}return geodir_select2_params.i18n_input_too_long_n.replace("%item%",overChars)},inputTooShort:function(args){var remainingChars=args.minimum-args.input.length;if(1===remainingChars){return geodir_select2_params.i18n_input_too_short_1}return geodir_select2_params.i18n_input_too_short_n.replace("%item%",remainingChars)},loadingMore:function(){return geodir_select2_params.i18n_load_more},maximumSelected:function(args){if(args.maximum===1){return geodir_select2_params.i18n_selection_too_long_1}return geodir_select2_params.i18n_selection_too_long_n.replace("%item%",args.maximum)},noResults:function(){return geodir_select2_params.i18n_no_matches},searching:function(){return geodir_select2_params.i18n_searching}}}}function geodirSelect2TemplateSelection($el,data){if($el.data("cmultiselect")){var rEl;rEl='<span class="select2-selection_gd_custom">';rEl+='<span class="select2-selection_gd_text">'+data.text+"</span>";rEl+='<span class="select2-selection_gd_field">';rEl+='<input type="radio" class="select2-selection_gd_v_'+(data.id!="undefined"?data.id:"")+"\" onchange=\"jQuery(this).closest('form').find('input[name="+$el.data("cmultiselect")+']\').val(jQuery(this).val());" value="'+(data.id!="undefined"?data.id:"")+'" name="'+$el.data("cmultiselect")+'_radio">';rEl+="</span>";rEl+="</span>";return jQuery(rEl)}return data.text}function geodirSelect2OnChange($this,$select2){var $cont,$field,value,$input;if($this.data("cmultiselect")){$cont=$select2.data("select2").$container;$field=$this.closest("form").find("input[name="+$this.data("cmultiselect")+"]");value=$field.val()!="undefined"?$field.val():"";if(jQuery(".select2-selection_gd_field",$cont).length>0){if(jQuery(".select2-selection_gd_v_"+value).length>0){$input=jQuery(".select2-selection_gd_v_"+value)}else{$input=jQuery(".select2-selection_gd_field:first",$cont).find('[type="radio"]')}$input.prop("checked",true).trigger("change")}else{$field.val("")}}};
// source --> https://businessportal.bg/wp-content/plugins/geodirectory/assets/js/libraries/gd_lity.min.js?ver=2.8.162 
(function(window,factory){if(typeof define==="function"&&define.amd){define(["jquery"],function($){return factory(window,$)})}else if(typeof module==="object"&&typeof module.exports==="object"){module.exports=factory(window,require("jquery"))}else{window.lity=factory(window,window.jQuery||window.Zepto)}})(typeof window!=="undefined"?window:this,function(window,$){"use strict";var document=window.document;var _win=$(window);var _deferred=$.Deferred;var _html=$("html");var _instances=[];var _attrAriaHidden="aria-hidden";var _dataAriaHidden="lity-"+_attrAriaHidden;var _focusableElementsSelector='a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])';var _defaultOptions={esc:true,handler:null,handlers:{image:imageHandler,inline:inlineHandler,youtube:youtubeHandler,vimeo:vimeoHandler,googlemaps:googlemapsHandler,facebookvideo:facebookvideoHandler,iframe:iframeHandler},template:'<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true"><i class="fas fa-circle-notch fa-spin"></i></div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>&times;</button></div></div></div>'};var _imageRegexp=/(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i;var _youtubeRegex=/(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i;var _vimeoRegex=/(vimeo(pro)?\.com)\/(?:[^\d]+)?(\d+)\??(.*)?$/;var _googlemapsRegex=/((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i;var _facebookvideoRegex=/(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?$/i;var _transitionEndEvent=function(){var el=document.createElement("div");var transEndEventNames={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var name in transEndEventNames){if(el.style[name]!==undefined){return transEndEventNames[name]}}return false}();function transitionEnd(element){var deferred=_deferred();if(!_transitionEndEvent||!element.length){deferred.resolve()}else{element.one(_transitionEndEvent,deferred.resolve);setTimeout(deferred.resolve,500)}return deferred.promise()}function settings(currSettings,key,value){if(arguments.length===1){return $.extend({},currSettings)}if(typeof key==="string"){if(typeof value==="undefined"){return typeof currSettings[key]==="undefined"?null:currSettings[key]}currSettings[key]=value}else{$.extend(currSettings,key)}return this}function parseQueryParams(params){var pos=params.indexOf("?");if(pos>-1){params=params.substr(pos+1)}var pairs=decodeURI(params.split("#")[0]).split("&");var obj={},p;for(var i=0,n=pairs.length;i<n;i++){if(!pairs[i]){continue}p=pairs[i].split("=");obj[p[0]]=p[1]}return obj}function appendQueryParams(url,params){if(!params){return url}if("string"===$.type(params)){params=parseQueryParams(params)}if(url.indexOf("?")>-1){var split=url.split("?");url=split.shift();params=$.extend({},parseQueryParams(split[0]),params)}return url+"?"+$.param(params)}function transferHash(originalUrl,newUrl){var pos=originalUrl.indexOf("#");if(-1===pos){return newUrl}if(pos>0){originalUrl=originalUrl.substr(pos)}return newUrl+originalUrl}function iframe(iframeUrl,instance,queryParams,hashUrl){instance&&instance.element().addClass("lity-iframe");if(queryParams){iframeUrl=appendQueryParams(iframeUrl,queryParams)}if(hashUrl){iframeUrl=transferHash(hashUrl,iframeUrl)}return'<div class="lity-iframe-container"><iframe onload="jQuery(\'.lity-iframe-container .svg-inline--fa, .lity-iframe-container i\').remove();" frameborder="0" allowfullscreen src="'+iframeUrl+'"></iframe><i class="fas fa-sync fa-spin fa-3x fa-fw"></i></div>'}function error(msg){return $('<span class="lity-error"></span>').append(msg)}function imageHandler(target,instance){var has_next=instance.opener().parent().next("li").find("a").length;var has_prev=instance.opener().parent().prev("li").find("a").length;var gallery_nav="";if(has_next||has_prev){gallery_nav='<div class="lity-nav">';if(has_prev){gallery_nav=gallery_nav+'<span class="lity-nav-left"><i class="fas fa-chevron-left" aria-hidden="true"></i></span>'}if(has_next){gallery_nav=gallery_nav+'<span class="lity-nav-right"><i class="fas fa-chevron-right" aria-hidden="true"></i></span>'}gallery_nav=gallery_nav+"</div>";var initGallery=function(){if(has_next){jQuery(".lity-opened").on("keydown",function(e){if(e.which==39){instance.close();instance.opener().parent().next("li").find("a").trigger("click")}});jQuery(".lity-nav-right").on("click",function(){instance.close();instance.opener().parent().next("li").find("a").trigger("click")})}if(has_prev){jQuery(".lity-opened").on("keydown",function(e){if(e.which==37){instance.close();instance.opener().parent().prev("li").find("a").trigger("click")}});jQuery(".lity-nav-left").on("click",function(){instance.close();instance.opener().parent().prev("li").find("a").trigger("click")})}}}var caption="";var title=instance.opener()&&instance.opener().find("img").attr("title")||"";var alt=instance.opener()&&instance.opener().find("img").attr("alt")||"";var desc=instance.opener()&&instance.opener().find("img").data("caption")||"";var srcset=instance.opener()&&instance.opener().find("img").attr("srcset")||"";if(!srcset&&instance.opener()&&instance.opener().find("img").data("srcset")){srcset=instance.opener().find("img").attr("data-srcset")}if(title||desc){caption='<div class="lity-caption">';if(title){caption=caption+'<span class="lity-caption-title">'+title+"</span>"}if(desc){caption=caption+'<span class="lity-caption-desc">'+desc+"</span>"}caption=caption+"</div>"}var img=$('<img src="'+target+'" alt="'+alt+'" srcset="'+srcset+'"/>'+caption+gallery_nav);var deferred=_deferred();var failed=function(){deferred.reject(error("Failed loading image"))};img.on("load",function(){if(this.naturalWidth===0){return failed()}deferred.resolve(img);if(gallery_nav){var gdLityTo;clearTimeout(gdLityTo);gdLityTo=setTimeout(function(){initGallery()},50)}}).on("error",failed);return deferred.promise()}imageHandler.test=function(target){return _imageRegexp.test(target)};function inlineHandler(target,instance){var el,placeholder,hasHideClass;if(target==="loading"){return"loading"}try{el=$(target)}catch(e){return false}if(!el.length){return false}placeholder=$('<i style="display:none !important"></i>');hasHideClass=el.hasClass("lity-hide");instance.element().one("lity:remove",function(){placeholder.before(el).remove();if(hasHideClass&&!el.closest(".lity-content").length){el.addClass("lity-hide")}});return el.removeClass("lity-hide").after(placeholder)}function youtubeHandler(target,instance){var matches=_youtubeRegex.exec(target);if(!matches){return false}return iframe("https://www.youtube"+(matches[2]||"")+".com/embed/"+matches[4]+"?autoplay=1",instance,matches[5],target)}function vimeoHandler(target,instance){var matches=_vimeoRegex.exec(target);if(!matches){return false}return iframe("https://player.vimeo.com/video/"+matches[3]+"?autoplay=1",instance,matches[4],target)}function facebookvideoHandler(target,instance){var matches=_facebookvideoRegex.exec(target);if(!matches){return false}if(0!==target.indexOf("http")){target="https:"+target}return iframe("https://www.facebook.com/plugins/video.php?href="+target+"&autoplay=1",instance,matches[4],target)}function googlemapsHandler(target,instance){var matches=_googlemapsRegex.exec(target);if(!matches){return false}return iframe("https://www.google."+matches[3]+"/maps?"+matches[6],instance,{output:matches[6].indexOf("layer=c")>0?"svembed":"embed"},target)}function iframeHandler(target,instance){return iframe(target,instance)}function winHeight(){return document.documentElement.clientHeight?document.documentElement.clientHeight:Math.round(_win.height())}function keydown(e){var current=currentInstance();if(!current){return}if(e.keyCode===27&&!!current.options("esc")){current.close()}if(e.keyCode===9){handleTabKey(e,current)}}function handleTabKey(e,instance){var focusableElements=instance.element().find(_focusableElementsSelector);var focusedIndex=focusableElements.index(document.activeElement);if(e.shiftKey&&focusedIndex<=0){focusableElements.get(focusableElements.length-1).focus();e.preventDefault()}else if(!e.shiftKey&&focusedIndex===focusableElements.length-1){focusableElements.get(0).focus();e.preventDefault()}}function resize(){$.each(_instances,function(i,instance){instance.resize()})}function registerInstance(instanceToRegister){if(1===_instances.unshift(instanceToRegister)){_html.addClass("lity-active");_win.on({resize:resize,keydown:keydown})}$("body > *").not(instanceToRegister.element()).addClass("lity-hidden").each(function(){var el=$(this);if(undefined!==el.data(_dataAriaHidden)){return}el.data(_dataAriaHidden,el.attr(_attrAriaHidden)||null)}).attr(_attrAriaHidden,"true")}function removeInstance(instanceToRemove){var show;instanceToRemove.element().attr(_attrAriaHidden,"true");if(1===_instances.length){_html.removeClass("lity-active");_win.off({resize:resize,keydown:keydown})}_instances=$.grep(_instances,function(instance){return instanceToRemove!==instance});if(!!_instances.length){show=_instances[0].element()}else{show=$(".lity-hidden")}show.removeClass("lity-hidden").each(function(){var el=$(this),oldAttr=el.data(_dataAriaHidden);if(!oldAttr){el.removeAttr(_attrAriaHidden)}else{el.attr(_attrAriaHidden,oldAttr)}el.removeData(_dataAriaHidden)})}function currentInstance(){if(0===_instances.length){return null}return _instances[0]}function factory(target,instance,handlers,preferredHandler){var handler="inline",content;var currentHandlers=$.extend({},handlers);if(preferredHandler&&currentHandlers[preferredHandler]){content=currentHandlers[preferredHandler](target,instance);handler=preferredHandler}else{$.each(["inline","iframe"],function(i,name){delete currentHandlers[name];currentHandlers[name]=handlers[name]});$.each(currentHandlers,function(name,currentHandler){if(!currentHandler){return true}if(currentHandler.test&&!currentHandler.test(target,instance)){return true}content=currentHandler(target,instance);if(false!==content){handler=name;return false}})}return{handler:handler,content:content||""}}function Lity(target,options,opener,activeElement){var self=this;var result;var isReady=false;var isClosed=false;var element;var content;options=$.extend({},_defaultOptions,options);element=$(options.template);self.element=function(){return element};self.opener=function(){return opener};self.content=function(){return content};self.options=$.proxy(settings,self,options);self.handlers=$.proxy(settings,self,options.handlers);self.resize=function(){if(!isReady||isClosed){return}content.css("max-height",winHeight()+"px").trigger("lity:resize",[self])};self.close=function(){if(!isReady||isClosed){return}isClosed=true;removeInstance(self);var deferred=_deferred();if(activeElement&&(document.activeElement===element[0]||$.contains(element[0],document.activeElement))){try{activeElement.focus()}catch(e){}}content.trigger("lity:close",[self]);element.removeClass("lity-opened").addClass("lity-closed");transitionEnd(content.add(element)).always(function(){content.trigger("lity:remove",[self]);element.remove();element=undefined;deferred.resolve()});jQuery(".lity-opened").off("keydown");return deferred.promise()};result=factory(target,self,options.handlers,options.handler);element.attr(_attrAriaHidden,"false").addClass("lity-loading lity-opened lity-"+result.handler).appendTo("body").focus().on("click","[data-lity-close]",function(e){if($(e.target).is("[data-lity-close]")){self.close()}}).trigger("lity:open",[self]);registerInstance(self);$.when(result.content).always(ready);function ready(result){if(result==="loading"){result=".lity-loader";content=$(result);isReady=true}else{content=$(result).css("max-height",winHeight()+"px");element.find(".lity-loader").each(function(){var loader=$(this);transitionEnd(loader).always(function(){loader.remove()})});element.removeClass("lity-loading").find(".lity-content").empty().append(content);isReady=true;content.trigger("lity:ready",[self])}}}function lity(target,options,opener){if(!target.preventDefault){opener=$(opener)}else{target.preventDefault();opener=$(this);target=opener.data("lity-target")||opener.attr("href")||opener.attr("src")}var instance=new Lity(target,$.extend({},opener.data("lity-options")||opener.data("lity"),options),opener,document.activeElement);if(!target.preventDefault){return instance}}lity.version="3.0.0-dev";lity.options=$.proxy(settings,lity,_defaultOptions);lity.handlers=$.proxy(settings,lity,_defaultOptions.handlers);lity.current=currentInstance;lity.iframe=iframe;$(document).on("click.lity","[data-lity]",lity);return lity});
// source --> https://businessportal.bg/wp-content/uploads/524/519/public/assets/js/356.js?ver=1.10.3 
/**
 * plain js functions for displaying ads by size
 *
 **/

// basic variables
var advanced_ads_resizetimeout = 1000; // time to wait until resized window width is saved, in millisec
var advanced_ads_cookieexpires = 30; // days until the cookie expires
var advanced_ads_browser_width = advanced_ads_get_browser_width();

// save browserWidth in a cookie if not set or not equal to current saved width
if ( window.advads !== undefined && ! advads.get_cookie( 'advanced_ads_browser_width' ) ||
        advads.get_cookie('advanced_ads_browser_width') !== advanced_ads_browser_width ) {

    advanced_ads_save_width( advanced_ads_browser_width );

}

// save new browser width, when window resizes
if (window.addEventListener) {    // most non-IE browsers and IE9
   window.addEventListener("resize", advanced_ads_resize_window, false);
} else if (window.attachEvent) {  // Internet Explorer 5 or above
   window.attachEvent("onresize", advanced_ads_resize_window);
}

function advanced_ads_resize_window () {
	advads_resize_delay(function(){
		var previous_width = advanced_ads_browser_width;
		advanced_ads_browser_width = advanced_ads_get_browser_width();
		if ( previous_width === advanced_ads_browser_width ) {
			// Return if the viewport has not actually changed
			// Scroll events were triggering this on iOS due to the position of the address bar.
			return;
		}

		advanced_ads_save_width( advanced_ads_browser_width );

		var advanced_ads_responsive = window.advanced_ads_responsive || {}
		if ( window.jQuery && parseInt( advanced_ads_responsive.reload_on_resize, 10 ) ) {
			jQuery( document ).triggerHandler( 'advanced-ads-resize-window' );
		}
	}, advanced_ads_resizetimeout);
}    

// save width in cookie
function advanced_ads_save_width ( width ) {
    if( window.advads !== undefined ){
	    advads.set_cookie( 'advanced_ads_browser_width', width, advanced_ads_cookieexpires );
    }
}

// create a listener calling only once after resize
// http://stackoverflow.com/questions/2854407/javascript-jquery-window-resize-how-to-fire-after-the-resize-is-completed
var advads_resize_delay = (function(){
    var timer = 0;
    return function (callback, ms) {
	clearTimeout(timer);
	timer = setTimeout(callback, ms);
    };
})();

/**
 * get the width of the browser
 */
function advanced_ads_get_browser_width() {
    if ( window.jQuery ){    
        return jQuery(window).width();
    } else {
        var browserWidth = 0;
        if( typeof( window.innerWidth ) == 'number' ) {
            //Non-IE
            browserWidth = window.innerWidth;
        } else if( document.documentElement && document.documentElement.clientWidth ) {
            //IE 6+ in 'standards compliant mode'
            browserWidth = document.documentElement.clientWidth;
        } else if( document.body && document.body.clientWidth ) {
            //IE 4 compatible
            browserWidth = document.body.clientWidth;
        }
        return browserWidth;
    }
};
// source --> https://businessportal.bg/wp-content/uploads/524/242/public/assets/js/202.js?ver=1.8.3 
function advanced_ads_sticky_check_position_fixed() {
	var container = document.body;
	if (document.createElement && container && container.appendChild && container.removeChild) {
		var el = document.createElement( 'div' );
		if ( ! el.getBoundingClientRect) {
			return null; }
		el.innerHTML = 'x';
		el.style.cssText = 'position:fixed;top:100px;';
		container.appendChild( el );
		var originalHeight = container.style.height,
				originalScrollTop = container.scrollTop;
		// In IE<=7, the window's upper-left is at 2,2 (pixels) with respect to the true client.
		// surprisely, in IE8, the window's upper-left is at -2, -2 (pixels), but other elements
		// tested is just right, so we need adjust this.
		// https://groups.google.com/forum/?fromgroups#!topic/comp.lang.javascript/zWJaFM5gMIQ
		// https://bugzilla.mozilla.org/show_bug.cgi?id=174397
		var extraTop = parseInt( document.documentElement.getBoundingClientRect().top, 10 );
		extraTop = extraTop > 0 ? extraTop : 0;
		container.style.height = '3000px';
		container.scrollTop = 500;
		var elementTop = parseInt( el.getBoundingClientRect().top, 10 );
		container.style.height = originalHeight;
		var isSupported = (elementTop - extraTop) === 100;
		container.removeChild( el );
		container.scrollTop = originalScrollTop;
		return isSupported;
	}
	return null;
};

// decode sticky ads right after consent is given.
document.addEventListener('advanced_ads_privacy', function (event) {
	if (event.detail.state !== 'accepted' && event.detail.state !== 'not_needed') {
		return;
	}

	window.advanced_ads_sticky_settings.placements.forEach(function (value) {
		document.querySelectorAll('script[type="text/plain"][data-tcf="waiting-for-consent"][data-placement="' + value + '"]').forEach(advads.privacy.decode_ad);
	});
});

jQuery( document ).ready(function($) {
	var resize_timeout = null, $el, previous_width = $( window ).width();


	// Update position when viewport size changes.
	function resize_handler() {
		if ( resize_timeout ) clearTimeout( resize_timeout );
		resize_timeout = setTimeout( function() {
			var new_width = $( window ).width();
			if ( previous_width === new_width ) {
				// Return if the viewport has not actually changed
				// Scroll event triggered this due to the position of the address bar.
				return;
			}
			previous_width  = new_width;

			if ( typeof advanced_ads_sticky_items !== 'undefined' ) {
				$.each( advanced_ads_sticky_items, function( wrapper_id, data ) {
					$el = $( '#' + wrapper_id );
					// Apply initial 'position: absolute' styles if 'position: absolute' was transformed to 'position: fixed'
					// using the 'advads.fix_element' function.
					$el.prop( 'style', data.initial_css );

					// Fix to windows position and/or center vertically again.
					data.modifying_func();
				} );
			}
		}, 1000 );
	}

	if ( 'undefined' === typeof advanced_ads_responsive || ! parseInt( advanced_ads_responsive.reload_on_resize, 10 ) ) {
		// If the "Reload ads on resize" feature of the Responsive add-on is not used.
		jQuery( window ).on( 'resize', resize_handler );
	}

	//Remove 'position: fixed' if not supported, if the feature enabled in the settings.
	if ( typeof advanced_ads_sticky_settings === 'undefined' || ! advanced_ads_sticky_settings.check_position_fixed ) {
		return;
	}

	// story scroll enable value so it isn’t checked multiple times per page view
	var advanced_ads_sticky_position_fixed_supported = '';
	var allowed_offset = $( document.body ).is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0;

	/**
	 * Remove all position related inline styles.
	 *
	 * @param {object=} $stickyads Optional jQuery object.
	 */
	function remove_css( $stickyads ) {
		// if position fixed is unsupported
		if ( advanced_ads_sticky_position_fixed_supported === false ) {
			$( window ).off( 'resize', resize_handler );
			$stickyads = $stickyads || jQuery( '.' + advanced_ads_sticky_settings.sticky_class );
			setTimeout( function() {
				$stickyads.each( function( key, value ) {
					var $stickyad = $( value );
					if ( window.advanced_ads_sticky_items[ $stickyad.attr( 'id' ) ].can_convert_to_abs ) {
						$stickyad.css( 'position', 'absolute' );
					} else {
						$stickyad.css( 'position', '' ).css( 'top', '' ).css( 'right', '' ).css( 'bottom', '' ).css( 'left', '' ).css( 'margin-left', '' )
							.css( 'transform', 'none' ).css( '-webkit-transform', 'none' ).css( '-moz-transform', 'none' ).css( '-ms-transform', 'none' );
					}
				});
			} );
		}
	}


	function scroll_handler() {
		clearTimeout( $.data( this, 'scrollTimer' ) );
		// wait 100ms when scrolling before checking
		$.data(this, 'scrollTimer', setTimeout(function() {
			// don’t do anything if scroll position is 0 == top
			// or admin bar has not been scrolled.
			if($( document ).scrollTop() <= allowed_offset ) { return; }
			// check if position fixed is supported; story result in a variable so test runs only once
			if(advanced_ads_sticky_position_fixed_supported == ''){
				advanced_ads_sticky_position_fixed_supported = advanced_ads_sticky_check_position_fixed();
				clearTimeout( $.data( this, 'scrollTimer' ) );
				$( window ).off( 'scroll', scroll_handler );
			}
			// rewrite sticky ads
			remove_css();
		}, 100));
	}

	if ( navigator.userAgent.indexOf( 'Opera Mini' ) > -1 ) {
		//Opera mini does not support 'scroll' event.
		advanced_ads_sticky_position_fixed_supported = false;
		remove_css();
	} else {
		$( window ).scroll( scroll_handler );
	}


	// When cache-busting inserts new item.
	if ( typeof advanced_ads_pro === 'object' && advanced_ads_pro !== null ) {
		advanced_ads_pro.postscribeObservers.add( function (event) {
			if ( event.event === 'postscribe_done' && event.ref && event.ad ) {
				var $stickyad = jQuery( event.ref ).children( '.' + advanced_ads_sticky_settings.sticky_class );
				if ( $stickyad.length ) {
					remove_css( $stickyad );
				}
			}
		} );
	}
});
// source --> https://businessportal.bg/wp-content/uploads/524/602/assets/js/203.js?ver=2.19.2 
!function(t){var e="advads_procfp",a="advanced_ads_ad_clicks",n=null,o=null;function r(t){try{return JSON.parse(t)}catch(t){return null}}t(document).on("advads-passive-cb-conditions",(function(t,e){e.conditions.ad_clicks="check_ad_clicks",e.check_ad_clicks=function(t,e){if(advads.cookie_exists(a+"_"+e.id)){var n=advads.get_cookie(a+"_"+e.id);n=r(n)}if(n){var o=parseInt((new Date).getTime()/1e3);for(var i in n)if("_"+t.expiration==i&&n[i].ttl>=o&&n[i].count>=parseInt(t.limit))return!1}return!0}}));var i=function(){this.$elements={},this.currentIFrame=!1,this.focusLost=!1,this.wrappers=[".google-auto-placed"],this.attributes={"data-anchor-status":"displayed","data-vignette-loaded":"true"},this.lastClick=0,this.init()};i.prototype={constructor:i,init:function(){const e=this;let a;t(document).on("click","a[data-cfpa]",(function(){e.onClick(parseInt(t(this).attr("data-cfpa")))})),t(window).on("blur",(function(t){setTimeout((function(){if(!e.currentIFrame)for(let t=document.activeElement;t&&t!==this&&t!==document&&(e.currentIFrame=e.checkWrappers(t),!e.currentIFrame);t=t.parentNode);e.currentIFrame&&(e.onClick(e.currentIFrame),e.focusLost=!0,top.focus())}),0)})),t(document).on("mouseenter","div[data-cfpa]",(function(){var a=parseInt(t(this).attr("data-cfpa"));e.addElement(a)})),document.addEventListener("touchmove",(function(){a=!0}),!1),document.addEventListener("touchstart",(function(){a=!1}),!1),["click","touchend"].forEach((function(t){document.addEventListener(t,(function(t){if(a||e.getTimestamp()-e.lastClick<1)return;let n=null;for(let a=t.target;a&&a!==this&&a!==document;a=a.parentNode){if(n=e.checkWrappers(a),n){e.onClick(n);break}if(a.hasAttribute("data-cfpa")&&a.hasAttribute("data-cfptl")){n=parseInt(a.getAttribute("data-cfpa"),10),e.onClick(n);break}}}))}))},getTimestamp:function(){return Math.floor(Date.now()/1e3)},checkWrappers:function(t){for(let e=0,a=this.wrappers.length,n=null;e<a;e++)if(n=this.wrappers[e],t.matches&&t.matches(n))return".google-auto-placed"===n?"google-auto-placed":null;for(const[e,a]of Object.entries(this.attributes))if(t.hasAttribute(e)&&t.getAttribute(e)===a)return"google-auto-placed";return null},addElement:function(e){!1==e instanceof jQuery&&(e=t('div[data-cfpa="'+e+'"]').first());var i=!!e.find("iframe").length;if(i||e.find("a").length){var c=parseInt(e.attr("data-cfpa"));if(this.$elements[c]=e,e.removeAttr("data-cfpa"),i?(e.find("iframe").first().attr({"data-cfpa":c}),e.attr("data-cfph")&&e.find("iframe").first().attr({"data-cfph":e.attr("data-cfph")})):(e.find("a").not(".advads-edit-button").first().attr({"data-cfpa":c}),e.attr("data-cfph")&&e.find("a").not(".advads-edit-button").first().attr({"data-cfph":e.attr("data-cfph")})),e.removeAttr("data-cfph"),advads.cookie_exists(a+"_"+c)){var s=advads.get_cookie(a+"_"+c);if(s=r(s)){var d=parseInt((new Date).getTime()/1e3),f=!1;for(var p in s)if(s.hasOwnProperty(p)&&"exp"!=p&&s[p].ttl<d){for(var u=parseFloat(p.substr(1)),l=s[p].ttl;l<d;)l+=60*u*60;s[p].ttl=l,s[p].count=0,f=!0}if(f){var v=new Date(s.exp);advads.set_cookie_sec(a+"_"+c,JSON.stringify(s,"false",!1),parseInt(v.getTime()/1e3),n,o)}}}}},_banVisitor:function(){var t=new Date,e=new Date;e.setTime(e.getTime()+24*advadsCfpInfo.cfpBan*60*60*1e3);var a=(e.getTime()-t.getTime())/1e3;advads.set_cookie_sec("advads_pro_cfp_ban",1,a,n,o),document.querySelectorAll("[data-cfpw]:not([data-cfp-exclude])").forEach((function(t){t.remove()})),this.removeEmptyWrappers(),this.wrappers.forEach((function(t){jQuery(t).remove()}));for(const[t,e]of Object.entries(this.attributes))jQuery("["+t+'="'+e+'"]').remove()},removeEmptyWrappers:function(){document.querySelectorAll("[data-cfptl]:not([data-cfpw])").forEach((function(t){t.querySelectorAll("[data-cfpw]").length||t.remove()}))},onClick:function(i){var c=this,s=!1,d=!1;if(this.lastClick=this.getTimestamp(),"google-auto-placed"!==i&&t('[data-cfpa="'+i+'"]').attr("data-cfph")){advads.cookie_exists(a+"_"+i)&&(d=r(advads.get_cookie(a+"_"+i)));const e=r(t('[data-cfpa="'+i+'"]').attr("data-cfph"));if(d){const t=parseInt((new Date).getTime()/1e3,10),r=document.querySelectorAll('[data-cfpw="'+i+'"]');for(var f in d)d.hasOwnProperty(f)&&"exp"!==f&&(d[f].count=parseInt(d[f].count,10)+1,d[f].ttl>=t&&d[f].count>=parseInt(e[f],10)&&(r.forEach((function(t){t.remove()})),c.removeEmptyWrappers()));var p=new Date,u=new Date(d.exp),l=parseInt((u.getTime()-p.getTime())/1e3);advads.set_cookie_sec(a+"_"+i,JSON.stringify(d,"false",!1),l,n,o)}else{var v={},m=0,h=new Date;p=new Date;for(var f in e)f=f.substring(1),parseFloat(f)>m&&(m=parseFloat(f)),v["_"+f]={count:1,ttl:parseInt(p.getTime()/1e3+3600*parseFloat(f),10)};h.setTime(h.getTime()+60*m*60*1e3);var g="expires="+h.toUTCString();l=parseInt((h.getTime()-p.getTime())/1e3);v.exp=g,advads.set_cookie_sec(a+"_"+i,JSON.stringify(v,"false",!1),l,n,o)}}if(advads.cookie_exists(e+"_"+i)&&(s=r(advads.get_cookie(e+"_"+i))),s){s.count=parseInt(s.count,10)+1;p=new Date,l=((u=new Date(s.exp)).getTime()-p.getTime())/1e3;advads.set_cookie_sec(e+"_"+i,JSON.stringify(s,"false",!1),l,n,o),advadsCfpInfo.cfpClickLimit<=s.count&&void 0!==advadsCfpInfo.cfpBan&&c._banVisitor()}else{h=new Date,p=new Date;h.setTime(h.getTime()+60*advadsCfpInfo.cfpExpHours*60*1e3);g="expires="+h.toUTCString(),l=(h.getTime()-p.getTime())/1e3;advads.set_cookie_sec(e+"_"+i,'{"count":1,"exp":"'+g+'"}',l,n,o),1===advadsCfpInfo.cfpClickLimit&&void 0!==advadsCfpInfo.cfpBan&&c._banVisitor()}}},t((function(){for(var e in window.advadsProCfp=new i,t(document).on("mouseenter","iframe[data-cfpa]",(function(e){var a=parseInt(t(this).attr("data-cfpa"));advadsProCfp.currentIFrame=a})).on("mouseenter",".google-auto-placed",(function(t){advadsProCfp.currentIFrame="google-auto-placed"})).on("mouseleave mouseout","[data-cfpa], .google-auto-placed",(function(){advadsProCfp.currentIFrame=!1,advadsProCfp.focusLost&&(advadsProCfp.focusLost=!1,t(window).trigger("focus"))})),advadsCfpQueue)advadsCfpQueue.hasOwnProperty(e)&&advadsProCfp.addElement(advadsCfpQueue[e]);advadsCfpQueue=[],void 0!==window.advadsCfpInfo.cfpPath&&(""!=advadsCfpInfo.cfpPath&&(n=advadsCfpInfo.cfpPath),""!=advadsCfpInfo.cfpDomain&&(o=advadsCfpInfo.cfpDomain))}))}(window.jQuery);
// source --> https://businessportal.bg/wp-content/themes/GeoDirectory_framework/assets/js/scripts.js?ver=2.0.0.6 
/*
 * GeoDirectory Framework Scripts File
 * Author: GeoDirectory
 *
 * This file should contain any js scripts you want to add to the site.
 * Instead of calling it in the header or throwing it inside wp_head()
 * this file will be called automatically in the footer so as not to
 * slow the page load.
 *
 * There are a lot of example functions and tools in here. If you don't
 * need any of it, just remove it. They are meant to be helpers and are
 * not required. It's your world baby, you can do whatever you want.
*/


/*
 * Get Viewport Dimensions
 * returns object with viewport dimensions to match css in width and height properties
 * ( source: http://andylangton.co.uk/blog/development/get-viewport-size-width-and-height-javascript )
*/
function updateViewportDimensions() {
    var w = window,
        d = document,
        e = d.documentElement,
        g = d.getElementsByTagName('body')[0],
        x = w.innerWidth || e.clientWidth || g.clientWidth,
        y = w.innerHeight || e.clientHeight || g.clientHeight;
    return {
        width: x,
        height: y
    }
}
// setting the viewport width
var viewport = updateViewportDimensions();


/*
 * Throttle Resize-triggered Events
 * Wrap your actions in this function to throttle the frequency of firing them off, for better performance, esp. on mobile.
 * ( source: http://stackoverflow.com/questions/2854407/javascript-jquery-window-resize-how-to-fire-after-the-resize-is-completed )
*/
var waitForFinalEvent = (function() {
    var timers = {};
    
    return function(callback, ms, uniqueId) {
        if (!uniqueId) {
            uniqueId = "Don't call this twice without a uniqueId";
        }
        
        if (timers[uniqueId]) {
            clearTimeout(timers[uniqueId]);
        }
        timers[uniqueId] = setTimeout(callback, ms);
    };
})();

// how long to wait before deciding the resize has stopped, in ms. Around 50-100 should work ok.
var timeToWaitForLast = 100;

/*
 * Here's an example so you can see how we're using the above function
 *
 * This is commented out so it won't work, but you can copy it and
 * remove the comments.
 *
 *
 *
 * If we want to only do it on a certain page, we can setup checks so we do it
 * as efficient as possible.
 *
 * if( typeof is_home === "undefined" ) var is_home = $('body').hasClass('home');
 *
 * This once checks to see if you're on the home page based on the body class
 * We can then use that check to perform actions on the home page only
 *
 * When the window is resized, we perform this function
 * $(window).resize(function () {
 *
 *    // if we're on the home page, we wait the set amount (in function above) then fire the function
 *    if( is_home ) { waitForFinalEvent( function() {
 *
 *      // if we're above or equal to 768 fire this off
 *      if( viewport.width >= 768 ) {
 *        console.log('On home page and window sized to 768 width or more.');
 *      } else {
 *        // otherwise, let's do this instead
 *        console.log('Not on home page, or window sized to less than 768.');
 *      }
 *
 *    }, timeToWaitForLast, "your-function-identifier-string"); }
 * });
 *
 * Pretty cool huh? You can create functions like this to conditionally load
 * content and other stuff dependent on the viewport.
 * Remember that mobile devices and javascript aren't the best of friends.
 * Keep it light and always make sure the larger viewports are doing the heavy lifting.
 *
*/

/*
 * We're going to swap out the gravatars.
 * In the functions.php file, you can see we're not loading the gravatar
 * images on mobile to save bandwidth. Once we hit an acceptable viewport
 * then we can swap out those images since they are located in a data attribute.
*/
function loadGravatars() {
    // set the viewport using the function above
    viewport = updateViewportDimensions();
    
    // if the viewport is tablet or larger, we load in the gravatars
    if (viewport.width >= 768) {
        jQuery('.comment img[data-gravatar]').each(function() {
            jQuery(this).attr('src', jQuery(this).attr('data-gravatar'));
        });
    }
} // end function



/*
 * Put all your regular jQuery in here.
 */
jQuery(document).ready(function($) {
    /*
     * Let's fire off the gravatar function
     * You can remove this if you don't need it
     */
    loadGravatars();
    
    // $("nav#mobile-navigation-left").mmenu();
    // $(window).resize(function() { mmenuw(); });
    jQuery(function() {
        var $menuleft = jQuery("#mobile-navigation-left");
        
        if (jQuery('#menu-item-gd-location-switcher').length) {
            $menuleft.on(
                "opened.mm",
                function() {
                    jQuery("#menu-item-gd-location-switcher:first .geodir_location_tab_container").detach().appendTo('#mm-mobile-navigation-left .gd-location-switcher-menu-item');
                    jQuery('#mm-mobile-navigation-left .geodir_location_tab_container.mm-panel').remove();
                }
            );
            
            $menuleft.on(
                "closed.mm",
                function() {
                    jQuery("#mm-mobile-navigation-left .geodir_location_tab_container").detach().appendTo('#menu-item-gd-location-switcher:first .gd-location-switcher-menu-item');
                }
            );
        }
        
        $menuleft.mmenu({}, {
            clone: 1
        }); // clone it so we can do responsive
        
        var $menu = jQuery('#mobile-navigation-right');
        
        $menu.mmenu({
            position: 'right',
            isMenu: false,
            panelClass: 'profile-sub-menu' // class of the div that holds the login menu
        });
    });
}); /* end of as page load scripts */

// menu hover off screen fix
jQuery(".nav > li").on('mouseenter mouseleave', function(e) {
    var elm = jQuery('ul:first', this);
    var off = elm.offset();
    
    if (typeof off == 'undefined') {
        return;
    }
    var l = off.left;
    var w = elm.width();
    var docH = jQuery("#mobile-navigation-left").height();
    var docW = jQuery("#mobile-navigation-left").width();
    var gdisEntirelyVisible = (l + w <= docW);
    
    if (!gdisEntirelyVisible) {
        jQuery(this).addClass('gd-edge');
    } else {
        jQuery(this).removeClass('gd-edge');
    }
});
// source --> https://businessportal.bg/wp-content/themes/GeoDirectory_framework/assets/js/jquery.mmenu.min.js?ver=2.0.0.6 
/*	
 * jQuery mmenu v4.2.4
 * @requires jQuery 1.7.0 or later
 *
 * mmenu.frebsite.nl
 *	
 * Copyright (c) Fred Heusschen
 * www.frebsite.nl
 *
 * Dual licensed under the MIT and GPL licenses.
 * http://en.wikipedia.org/wiki/MIT_License
 * http://en.wikipedia.org/wiki/GNU_General_Public_License
 */
!function(e){function t(t,n,s){if(s){if("object"!=typeof t&&(t={}),"boolean"!=typeof t.isMenu){var o=s.children();t.isMenu=1==o.length&&o.is(n.panelNodetype)}return t}return t=e.extend(!0,{},e[a].defaults,t),("top"==t.position||"bottom"==t.position)&&("back"==t.zposition||"next"==t.zposition)&&(e[a].deprecated('Using position "'+t.position+'" in combination with zposition "'+t.zposition+'"','zposition "front"'),t.zposition="front"),t}function n(t){return t=e.extend(!0,{},e[a].configuration,t),"string"!=typeof t.pageSelector&&(t.pageSelector="> "+t.pageNodetype),"append"!=t.menuInjectMethod&&(t.menuInjectMethod="prepend"),t}function s(){r.$wndw=e(window),r.$html=e("html"),r.$body=e("body"),r.$allMenus=e(),e.each([d,c,u],function(e,t){t.add=function(e){e=e.split(" ");for(var n in e)t[e[n]]=t.mm(e[n])}}),d.mm=function(e){return"mm-"+e},d.add("menu ismenu panel list subtitle selected label spacer current highest hidden page blocker modal background opened opening subopened subopen fullsubopen subclose"),d.umm=function(e){return"mm-"==e.slice(0,3)&&(e=e.slice(3)),e},c.mm=function(e){return"mm-"+e},c.add("parent style"),u.mm=function(e){return e+".mm"},u.add("toggle open opening opened close closing closed update setPage setSelected transitionend webkitTransitionEnd mousedown touchstart mouseup touchend scroll touchmove click keydown keyup resize"),r.$wndw.on(u.keydown,function(e){return r.$html.hasClass(d.opened)&&9==e.keyCode?(e.preventDefault(),!1):void 0});var t=0;r.$wndw.on(u.resize,function(e,n){if(n||r.$html.hasClass(d.opened)){var s=r.$wndw.height();(n||s!=t)&&(t=s,r.$page.css("minHeight",s))}}),e[a]._c=d,e[a]._d=c,e[a]._e=u,e[a].glbl=r}function o(t,n){if(t.hasClass(d.current))return!1;var s=e("."+d.panel,n),o=s.filter("."+d.current);return s.removeClass(d.highest).removeClass(d.current).not(t).not(o).addClass(d.hidden),t.hasClass(d.opened)?o.addClass(d.highest).removeClass(d.opened).removeClass(d.subopened):(t.addClass(d.highest),o.addClass(d.subopened)),t.removeClass(d.hidden).removeClass(d.subopened).addClass(d.current).addClass(d.opened),"open"}function i(e,t,n){var s=!1,o=function(){s||t.call(e[0]),s=!0};e.one(u.transitionend,o),e.one(u.webkitTransitionEnd,o),setTimeout(o,1.1*n)}var a="mmenu",l="4.2.4";if(!e[a]){var r={$wndw:null,$html:null,$body:null,$page:null,$blck:null,$allMenus:null},d={},c={},u={},p=0,h=0;e[a]=function(e,t,n){return r.$allMenus=r.$allMenus.add(e),this.$menu=e,this.opts=t,this.conf=n,this.serialnr=p++,this._init(),this},e[a].prototype={open:function(){var e=this;return this._openSetup(),setTimeout(function(){e._openFinish()},50),"open"},_openSetup:function(){h=r.$wndw.scrollTop(),this.$menu.addClass(d.current),r.$allMenus.not(this.$menu).trigger(u.close),r.$page.data(c.style,r.$page.attr("style")||""),r.$wndw.trigger(u.resize,[!0]),this.opts.modal&&r.$html.addClass(d.modal),this.opts.moveBackground&&r.$html.addClass(d.background),"left"!=this.opts.position&&r.$html.addClass(d.mm(this.opts.position)),"back"!=this.opts.zposition&&r.$html.addClass(d.mm(this.opts.zposition)),this.opts.classes&&r.$html.addClass(this.opts.classes),r.$html.addClass(d.opened),this.$menu.addClass(d.opened)},_openFinish:function(){var e=this;i(r.$page,function(){e.$menu.trigger(u.opened)},this.conf.transitionDuration),r.$html.addClass(d.opening),this.$menu.trigger(u.opening)},close:function(){var e=this;return i(r.$page,function(){e.$menu.removeClass(d.current).removeClass(d.opened),r.$html.removeClass(d.opened).removeClass(d.modal).removeClass(d.background).removeClass(d.mm(e.opts.position)).removeClass(d.mm(e.opts.zposition)),e.opts.classes&&r.$html.removeClass(e.opts.classes),r.$page.attr("style",r.$page.data(c.style)),e.$menu.trigger(u.closed)},this.conf.transitionDuration),r.$html.removeClass(d.opening),this.$menu.trigger(u.closing),"close"},_init:function(){if(this.opts=t(this.opts,this.conf,this.$menu),this.direction=this.opts.slidingSubmenus?"horizontal":"vertical",this._initPage(r.$page),this._initMenu(),this._initBlocker(),this._initPanles(),this._initLinks(),this._initOpenClose(),this._bindCustomEvents(),e[a].addons)for(var n=0;n<e[a].addons.length;n++)"function"==typeof this["_addon_"+e[a].addons[n]]&&this["_addon_"+e[a].addons[n]]()},_bindCustomEvents:function(){var t=this;this.$menu.off(u.open+" "+u.close+" "+u.setPage+" "+u.update).on(u.open+" "+u.close+" "+u.setPage+" "+u.update,function(e){e.stopPropagation()}),this.$menu.on(u.open,function(n){return e(this).hasClass(d.current)?(n.stopImmediatePropagation(),!1):t.open()}).on(u.close,function(n){return e(this).hasClass(d.current)?t.close():(n.stopImmediatePropagation(),!1)}).on(u.setPage,function(e,n){t._initPage(n),t._initOpenClose()});var n=this.$menu.find(this.opts.isMenu&&"horizontal"!=this.direction?"ul, ol":"."+d.panel);n.off(u.toggle+" "+u.open+" "+u.close).on(u.toggle+" "+u.open+" "+u.close,function(e){e.stopPropagation()}),"horizontal"==this.direction?n.on(u.open,function(){return o(e(this),t.$menu)}):n.on(u.toggle,function(){var t=e(this);return t.triggerHandler(t.parent().hasClass(d.opened)?u.close:u.open)}).on(u.open,function(){return e(this).parent().addClass(d.opened),"open"}).on(u.close,function(){return e(this).parent().removeClass(d.opened),"close"})},_initBlocker:function(){var t=this;r.$blck||(r.$blck=e('<div id="'+d.blocker+'" />').appendTo(r.$body)),r.$blck.off(u.touchstart).on(u.touchstart,function(e){e.preventDefault(),e.stopPropagation(),r.$blck.trigger(u.mousedown)}).on(u.mousedown,function(e){e.preventDefault(),r.$html.hasClass(d.modal)||t.$menu.trigger(u.close)})},_initPage:function(t){t||(t=e(this.conf.pageSelector,r.$body),t.length>1&&(e[a].debug("Multiple nodes found for the page-node, all nodes are wrapped in one <"+this.conf.pageNodetype+">."),t=t.wrapAll("<"+this.conf.pageNodetype+" />").parent())),t.addClass(d.page),r.$page=t},_initMenu:function(){this.conf.clone&&(this.$menu=this.$menu.clone(!0),this.$menu.add(this.$menu.find("*")).filter("[id]").each(function(){e(this).attr("id",d.mm(e(this).attr("id")))})),this.$menu.contents().each(function(){3==e(this)[0].nodeType&&e(this).remove()}),this.$menu[this.conf.menuInjectMethod+"To"](this.conf.menuWrapperSelector).addClass(d.menu),this.$menu.addClass(d.mm(this.direction)),this.opts.classes&&this.$menu.addClass(this.opts.classes),this.opts.isMenu&&this.$menu.addClass(d.ismenu),"left"!=this.opts.position&&this.$menu.addClass(d.mm(this.opts.position)),"back"!=this.opts.zposition&&this.$menu.addClass(d.mm(this.opts.zposition))},_initPanles:function(){var t=this;this.__refactorClass(e("."+this.conf.listClass,this.$menu),"list"),this.opts.isMenu&&e("ul, ol",this.$menu).not(".mm-nolist").addClass(d.list);var n=e("."+d.list+" > li",this.$menu);this.__refactorClass(n.filter("."+this.conf.selectedClass),"selected"),this.__refactorClass(n.filter("."+this.conf.labelClass),"label"),this.__refactorClass(n.filter("."+this.conf.spacerClass),"spacer"),n.off(u.setSelected).on(u.setSelected,function(t,s){t.stopPropagation(),n.removeClass(d.selected),"boolean"!=typeof s&&(s=!0),s&&e(this).addClass(d.selected)}),this.__refactorClass(e("."+this.conf.panelClass,this.$menu),"panel"),this.$menu.children().filter(this.conf.panelNodetype).add(this.$menu.find("."+d.list).children().children().filter(this.conf.panelNodetype)).addClass(d.panel);var s=e("."+d.panel,this.$menu);s.each(function(n){var s=e(this),o=s.attr("id")||d.mm("m"+t.serialnr+"-p"+n);s.attr("id",o)}),s.find("."+d.panel).each(function(){var n=e(this),s=n.is("ul, ol")?n:n.find("ul ,ol").first(),o=n.parent(),i=o.find("> a, > span"),a=o.closest("."+d.panel);if(n.data(c.parent,o),o.parent().is("."+d.list)){var l=e('<a class="'+d.subopen+'" href="#'+n.attr("id")+'" />').insertBefore(i);i.is("a")||l.addClass(d.fullsubopen),"horizontal"==t.direction&&s.prepend('<li class="'+d.subtitle+'"><a class="'+d.subclose+'" href="#'+a.attr("id")+'">'+i.text()+"</a></li>")}});var o="horizontal"==this.direction?u.open:u.toggle;if(s.each(function(){var n=e(this),s=n.attr("id");e('a[href="#'+s+'"]',t.$menu).off(u.click).on(u.click,function(e){e.preventDefault(),n.trigger(o)})}),"horizontal"==this.direction){var i=e("."+d.list+" > li."+d.selected,this.$menu);i.add(i.parents("li")).parents("li").removeClass(d.selected).end().each(function(){var t=e(this),n=t.find("> ."+d.panel);n.length&&(t.parents("."+d.panel).addClass(d.subopened),n.addClass(d.opened))}).closest("."+d.panel).addClass(d.opened).parents("."+d.panel).addClass(d.subopened)}else e("li."+d.selected,this.$menu).addClass(d.opened).parents("."+d.selected).removeClass(d.selected);var a=s.filter("."+d.opened);a.length||(a=s.first()),a.addClass(d.opened).last().addClass(d.current),"horizontal"==this.direction&&s.find("."+d.panel).appendTo(this.$menu)},_initLinks:function(){var t=this;e("."+d.list+" > li > a",this.$menu).not("."+d.subopen).not("."+d.subclose).not('[rel="external"]').not('[target="_blank"]').off(u.click).on(u.click,function(n){var s=e(this),o=s.attr("href");t.__valueOrFn(t.opts.onClick.setSelected,s)&&s.parent().trigger(u.setSelected);var i=t.__valueOrFn(t.opts.onClick.preventDefault,s,"#"==o.slice(0,1));i&&n.preventDefault(),t.__valueOrFn(t.opts.onClick.blockUI,s,!i)&&r.$html.addClass(d.blocking),t.__valueOrFn(t.opts.onClick.close,s,i)&&t.$menu.triggerHandler(u.close)})},_initOpenClose:function(){var t=this,n=this.$menu.attr("id");n&&n.length&&(this.conf.clone&&(n=d.umm(n)),e('a[href="#'+n+'"]').off(u.click).on(u.click,function(e){e.preventDefault(),t.$menu.trigger(u.open)}));var n=r.$page.attr("id");n&&n.length&&e('a[href="#'+n+'"]').off(u.click).on(u.click,function(e){e.preventDefault(),t.$menu.trigger(u.close)})},__valueOrFn:function(e,t,n){return"function"==typeof e?e.call(t[0]):"undefined"==typeof e&&"undefined"!=typeof n?n:e},__refactorClass:function(e,t){e.removeClass(this.conf[t+"Class"]).addClass(d[t])}},e.fn[a]=function(o,i){return r.$wndw||s(),o=t(o,i),i=n(i),this.each(function(){var t=e(this);t.data(a)||t.data(a,new e[a](t,o,i))})},e[a].version=l,e[a].defaults={position:"left",zposition:"back",moveBackground:!0,slidingSubmenus:!0,modal:!1,classes:"",onClick:{setSelected:!0}},e[a].configuration={panelClass:"Panel",listClass:"List",selectedClass:"Selected",labelClass:"Label",spacerClass:"Spacer",pageNodetype:"div",panelNodetype:"ul, ol, div",pageSelector:null,menuWrapperSelector:"body",menuInjectMethod:"prepend",transitionDuration:400},function(){var t=window.document,n=window.navigator.userAgent,s=(document.createElement("div").style,"ontouchstart"in t),o="WebkitOverflowScrolling"in t.documentElement.style,i=function(){return n.indexOf("Android")>=0?2.4>parseFloat(n.slice(n.indexOf("Android")+8)):!1}();e[a].support={touch:s,oldAndroidBrowser:i,overflowscrolling:function(){return s?o?!0:i?!1:!0:!0}()}}(),e[a].debug=function(){},e[a].deprecated=function(e,t){"undefined"!=typeof console&&"undefined"!=typeof console.warn&&console.warn("MMENU: "+e+" is deprecated, use "+t+" instead.")}}}(jQuery);
// source --> https://businessportal.bg/wp-content/uploads/iGQQLOcCGpAs/YRCPnpiLiTfT.js?ver=2.2.3 
/* global anOptions */
/* global console */
/* global ajax_object */
/* global CSSStyleDeclaration */
/*
 an_scripts.js
 AdBlock Notify
 Copyright: (c) 2016 Themeisle, themeisle.com
 */

jQuery(document).ready(function ($) {
    //define global testing var
    var $an_state = null;

    /*  Detection
     /* ------------------------------------ */

    $(window).load(function () {

        setTimeout(function () {

            //launch FIRST test (jQuery) - check adsense element height
            if ($('#adsense.an-sponsored').length > 0) {
                if ($('#adsense.an-sponsored .an-advert-banner').outerHeight() === 0) {
                    $an_state = true;
                    $('#adsense.an-sponsored').remove();
                }
            }

            //launch SECOND test (jQuery) - based on defined adverts selectors
            if ($an_state === null && anOptions.anOptionAdsSelectors !== '') {
                var substr = anOptions.anOptionAdsSelectors.split(',');
                $.each(substr, function (i) {
                    if (($(substr[i]).length > 0 && $(substr[i]).outerHeight() === 0 )) {
                        $an_state = true;
                        return false;
                    }
                });
            }


            //launch SECOND test with fuckadblock script (js file)
            //Disabled due to too many bug repports
            /*function adBlockDetected() {
             $an_state = true;
             //do action
             an_message_display($an_state);
             }
             function adBlockNotDetected() {
             //do action
             an_message_display($an_state);
             }
             if(typeof fuckAdBlock === 'undefined') {
             adBlockDetected();
             } else {
             fuckAdBlock.onDetected(adBlockDetected);
             fuckAdBlock.onNotDetected(adBlockNotDetected);
             }*/

            an_message_display($an_state);

        }, 500);

    });

    /*  Do action
     /* ------------------------------------ */

    function an_count_unique_pages_b4_showing(){
        if(parseInt(anOptions.anOptionModalShowAfter) === 0){
            return true;
        }

        var hasStorage          = typeof(window.localStorage) !== 'undefined';
        var uniqPagesCrossed    = false;
        var uniqArrAsStr        = '';
        var itemName            = 'an_uniqpgs' + anOptions.anSiteID;

        if(hasStorage){
            uniqArrAsStr        = window.localStorage.getItem(itemName);
        }else{
            uniqArrAsStr        = getCookie(itemName);
        }

        var arr                 = JSON.parse(uniqArrAsStr);
        if(!arr){
            arr                 = [];
        }
        
        uniqPagesCrossed        = arr.length > anOptions.anOptionModalShowAfter;

        if(!uniqPagesCrossed){
            var bAdd            = true;
            for(var i = 0; i < arr.length; i++){
                if(arr[i] === anOptions.anPageMD5){
                    bAdd        = false;
                    break;
                }
            }
            if(bAdd){
                arr[arr.length]     = anOptions.anPageMD5;
                uniqArrAsStr        = JSON.stringify(arr);
                if(hasStorage){
                    window.localStorage.setItem(itemName, uniqArrAsStr);
                }else{
                    setCookie(itemName, uniqArrAsStr, 365, '/');
                }
            }
            uniqPagesCrossed        = arr.length > anOptions.anOptionModalShowAfter;
        }

        return uniqPagesCrossed;
    }

    function an_message_display($an_state) {
        if ($an_state === true) {

            //IF MODAL BOX IS ACTIVATED

            if ((parseInt(anOptions.anOptionChoice) === 2 && parseInt(anOptions.anOptionCookie) === 1 && getCookie('anCookie') !== 'true') || (parseInt(anOptions.anOptionChoice) === 2 && parseInt(anOptions.anOptionCookie) === 2) && an_count_unique_pages_b4_showing()) {
                $('#FAAhLXYFRsJi').prepend(anOptions.modalHTML);

                $('#FAAhLXYFRsJi').bind('reveal:open', function () {                    	//on modale box open
                    $('.dqADDewKESfc-bg').css({                                     	//apply custom style
                        'background': anOptions.anOptionModalOverlay
                    });

                    //fixed for IE
                    if (msieversion() === 'IE') {
                        $('#FAAhLXYFRsJi').css('left', Math.max(0, (($(window).width() - $('#FAAhLXYFRsJi').outerWidth()) / 2) + $(window).scrollLeft()) + 'px');
                    }

                });

                $('#FAAhLXYFRsJi').reveal({
                    animation: anOptions.anOptionModalEffect,                       	//fade, fadeAndPop, none
                    animationspeed: anOptions.anOptionModalspeed,                  	 	//how fast animtions are
                    closeonbackgroundclick: anOptions.anOptionModalclose,           	//if you click background will modal close?
                    closeonescape: anOptions.anOptionModalclose,           	//if you click escape will modal close?
                    dismissmodalclass: 'close-modal'                         	//the class of a button or element that will close an open modal
                }).trigger('reveal:open');

                $('#FAAhLXYFRsJi').bind('reveal:close', function () {                   	//on modale box close
                    $('#FAAhLXYFRsJi p, #FAAhLXYFRsJi a').fadeOut(150);                     	//fix for visual elements
                    setCookie('anCookie', 'true', anOptions.anOptionCookieLife, '/');   //set cookie to true
                    setTimeout(function () {
                        $('#FAAhLXYFRsJi, .dqADDewKESfc-bg').remove();
                    }, anOptions.anOptionModalspeed);
                });

                //IF PAGE REDIRECT IS ACTIVATED
            } else if (parseInt(anOptions.anOptionChoice) === 3 && anOptions.anPermalink !== 'undefined'){
                if(getCookie('anCookie') !== 'true') {
                    setCookie('anCookie', 'true', anOptions.anOptionCookieLife, '/');      	//set cookie to true
                    setLinkBeforeRedirect(window.location.href);
                    window.location.replace(anOptions.anPermalink);                     	//redirect to user page
                }
            }

            //IF AD PLACEHOLDER IS ACTIVATED
            if (anOptions.anAlternativeActivation === true && anOptions.anAlternativeElement !== '') {

                $(anOptions.anAlternativeElement).each(function () {

                    var $element = $(this);
                    if (($element.outerHeight() === 0) || ($element.size() <= 2)) {
                        var newElement;
                        if (anOptions.anAlternativeClone < 4) {
                            var elementType = $element[0].tagName;
                            newElement = document.createElement(elementType),
                                newElement = $(newElement);
                        } else {
                            newElement = document.createElement('DIV'),
                                newElement = $(newElement);
                        }
                        var copiedStyles;
                        if (parseInt(anOptions.anAlternativeClone) === 1 && anOptions.anAlternativeProperties !== '') {

                            copiedStyles = getStyleObjectCss($element);
                            if (typeof (copiedStyles) === 'undefined') {
                                copiedStyles = $element.getStyleObject();
                            }
                            newElement.css(copiedStyles);

                            var anAskedCSS = anOptions.anAlternativeProperties.split(' ').join('');
                            console.log(anAskedCSS);
                            var arrayProperties = [];
                            arrayProperties = anAskedCSS.split(',');

                            var anKeepCSS = [];
                            $.each(arrayProperties, function (item, value) {
                                var elProperty = newElement.css(value);
                                if (typeof elProperty !== 'undefined') {
                                    if (elProperty !== '') {
                                        anKeepCSS.push(value + ':' + elProperty + ';');
                                    }
                                }
                            });

                            anKeepCSS = anKeepCSS.join('');
                            newElement.removeAttr('style').attr('style', anKeepCSS);

                        } else if (parseInt(anOptions.anAlternativeClone) === 2) {

                            copiedStyles = getStyleObjectCss($element);
                            if (typeof (copiedStyles) === 'undefined') {
                                copiedStyles = $element.getStyleObject();
                            }
                            newElement.css(copiedStyles).css(anExcludeRules);
                        } else if (parseInt(anOptions.anAlternativeClone) === 3) {

                            copiedStyles = $element.getStyleObject();
                            newElement.css(copiedStyles).css(anExcludeRules);

                        }

                        newElement.html(anOptions.anAlternativeText);
                        $element.before(newElement);

                        newElement.addClass('wCNokNEKgxpp').fadeIn(300);

                    }

                });

            }

            an_blocker_counter(['total', 'blocked']);                       	//adblocker detected

        } else {

            //IF AD BLOCKER IS DEACTIVATED
            if (getCookie('anCookie') === 'true') {
                an_blocker_counter(['total', 'deactivated']);					//adblocker deactivated	
                setCookie('anCookie', '', anOptions.anOptionCookieLife, '/');	//set cookie to true
            } else {
                an_blocker_counter(['total']);									//no adblocker	
            }
            if (parseInt(anOptions.anOptionChoice) === 3){
                redirectToOrigLinkIfValid();
            }
        }

    }


//COUNT PAGE VIEWS WITH ADBLOCKER
    function an_blocker_counter(value) {
        if (anOptions.anOptionStats !== 2) {
            $.post(ajax_object.ajaxurl, {
                action: 'call_an_adblock_counter',
                an_state: value
            });
            return false;
        }
    }

    function msieversion() {
        var ua = window.navigator.userAgent;
        var msie = ua.indexOf('MSIE ');
        if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {       // If Internet Explorer, return version number
            return 'IE';
        }
    }

    /*  Fetch all DEFINED Element CSS Properties
     /*  Source: http://stackoverflow.com/a/5830517
     /* ------------------------------------ */
    function getStyleObjectCss(element) {
        var sheets = document.styleSheets, o = {};
        for (var i in sheets) {
            try {
                if (typeof (sheets[i].cssRules) !== 'undefined') {
                    var rules = sheets[i].rules || sheets[i].cssRules;
                    for (var r in rules) {
                        if (element.is(rules[r].selectorText)) {
                            o = $.extend(o, css2json(rules[r].style), css2json(element.attr('style')));
                        }
                    }
                }
            } catch (e) {
                return;
            }

        }
        return o;
    }

    function css2json(css) {
        var s = {};
        if (!css) {
            return s;
        }
        var i;
        if (css instanceof CSSStyleDeclaration) {
            for (i in css) {
                if ((css[i]).toLowerCase) {
                    s[(css[i]).toLowerCase()] = (css[css[i]]);
                }
            }
        } else if (typeof css === 'string') {
            css = css.split('; ');
            for (i in css) {
                var l = css[i].split(': ');
                s[l[0].toLowerCase()] = (l[1]);
            }
        }
        return s;
    }

    /*  Fetch ALL Element CSS Properties
     /*  Source: http://stackoverflow.com/a/5830517
     /* ------------------------------------ */
    $.fn.getStyleObject = function () {
        var dom = this.get(0);
        var style;
        var returns = {};
        var prop;
        if (window.getComputedStyle) {
            var camelize = function (a, b) {
                return b.toUpperCase();
            };
            style = window.getComputedStyle(dom, null);
            for (var i = 0, l = style.length; i < l; i++) {
                prop = style[i];
                var camel = prop.replace(/\-([a-z])/, camelize);
                var val = style.getPropertyValue(prop);
                returns[camel] = val;
            }
            return returns;
        }

        if (style = dom.currentStyle) {
            for (prop in style) {
                returns[prop] = style[prop];
            }

            return returns;
        }

        if (style = dom.style) {
            for (prop in style) {
                if (typeof style[prop] !== 'function') {
                    returns[prop] = style[prop];
                }
            }
            return returns;
        }
        return returns;
    };

    /*  Initiate cookies functions
     /* ------------------------------------ */
    function setCookie(cname, cvalue, exdays, cpath) {
        var d = new Date();
        d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
        var expires = 'expires=' + d.toGMTString();
        var path = 'path=' + cpath;
        document.cookie = cname + '=' + cvalue + '; ' + expires + '; ' + path;
    }

    function getCookie(cname) {
        var name = cname + '=';
        var ca = document.cookie.split(';');
        for (var i = 0; i < ca.length; i++) {
            var c = ca[i].trim();
            if (c.indexOf(name) === 0) {
                return c.substring(name.length, c.length);
            }
        }
        return '';
    }

    function setLinkBeforeRedirect(href) {
        if (typeof(window.sessionStorage) !== 'undefined') {
            window.sessionStorage.setItem('anPrevLink', href);
        } else {
            setCookie('anPrevLink', href, 0, '/');
        }
    }

    function getLinkBeforeRedirect() {
        var url     = '';
        if (typeof(window.sessionStorage) !== 'undefined') {
            url = window.sessionStorage.getItem('anPrevLink');
            window.sessionStorage.removeItem('anPrevLink');
        } else {
            url = getCookie('anPrevLink');
            setCookie('anPrevLink', '', -1, '/');
        }
        return url;
    }

    function redirectToOrigLinkIfValid() {
        var url         = getLinkBeforeRedirect();
        if (url){
            window.location.replace(url);
        }
    }

    //All CSS rules to exclude
    var anExcludeRules = {
        'height': '',
        'min-height': '',
        'max-height': '',
        'orphans': '',
        'align-content': '',
        'align-items': '',
        'align-self': '',
        'animation': '',
        'animation-play-state': '',
        'backface-visibility': '',
        'border-collapse': '',
        'border-spacing': '',
        'box-shadow': '',
        'content-box': '',
        'clip': '',
        'content': '',
        'counter-increment': '',
        'counter-reset': '',
        'cursor': '',
        'direction': '',
        'empty-cells': '',
        'flex': '',
        'flex-flow': '',
        'font': '',
        'image-orientation': '',
        'ime-mode': '',
        'justify-content': '',
        'letter-spacing': '',
        'list-style': '',
        'marker-offset': '',
        'order': '',
        'outline': '',
        'outline-offset': '',
        'page-break-after': '',
        'page-break-before': '',
        'page-break-inside': '',
        'perspective': '',
        'perspective-origin': '',
        'pointer-events': '',
        'quotes': '',
        'resize': '',
        'table-layout': '',
        'text-indent': '',
        'text-overflow': '',
        'text-shadow': '',
        'text-transform': '',
        'transform': '',
        'transform-origin': '',
        'transform-style': '',
        'transition': '',
        'unicode-bidi': '',
        'vertical-align': '',
        'white-space': '',
        'word-break': '',
        'word-spacing': '',
        'word-wrap': '',
        '-moz-appearance': '',
        '-moz-background-inline-policy': '',
        '-moz-binding': '',
        '-moz-box-align': '',
        '-moz-box-direction': '',
        '-moz-box-flex': '',
        '-moz-box-ordinal-group': '',
        '-moz-box-orient': '',
        '-moz-box-pack': '',
        '-moz-columns': '',
        '-moz-column-fill': '',
        '-moz-column-gap': '',
        '-moz-column-rule': '',
        '-moz-float-edge': '',
        '-moz-force-broken-image-icon': '',
        '-moz-hyphens': '',
        '-moz-image-region': '',
        '-moz-orient': '',
        '-moz-outline-radius': '',
        '-moz-stack-sizing': '',
        '-moz-tab-size': '',
        '-moz-text-align-last': '',
        '-moz-text-decoration-color': '',
        '-moz-text-decoration-line': '',
        '-moz-text-decoration-style': '',
        '-moz-text-size-adjust': '',
        '-moz-user-focus': '',
        '-moz-user-input': '',
        '-moz-user-modify': '',
        '-moz-user-select': '',
        '-moz-window-shadow': '',
        'clip-path': '',
        'clip-rule': '',
        'color-interpolation': '',
        'color-interpolation-filters': '',
        'dominant-baseline': '',
        'fill': '',
        'fill-opacity': '',
        'fill-rule': '',
        'filter': '',
        'flood-color': '',
        'flood-opacity': '',
        'image-rendering': '',
        'lighting-color': '',
        'marker': '',
        'mask': '',
        'shape-rendering': '',
        'stop-color': '',
        'stop-opacity': '',
        'stroke': '',
        'stroke-dasharray': '',
        'stroke-dashoffset': '',
        'stroke-linecap': '',
        'stroke-linejoin': '',
        'stroke-miterlimit': '',
        'stroke-opacity': '',
        'stroke-width': '',
        'text-anchor': '',
        'text-rendering': '',
        'vector-effect': '',
        'background-blend-mode': '',
        'border-bottom-left-radius': '',
        'border-bottom-right-radius': '',
        'border-image-outset': '',
        'border-image-repeat': '',
        'border-image-slice': '',
        'border-image-source': '',
        'border-image-width': '',
        'border-top-left-radius': '',
        'border-top-right-radius': '',
        'box-sizing': '',
        'caption-side': '',
        'font-kerning': '',
        'font-variant-ligatures': '',
        'object-fit': '',
        'object-position': '',
        'overflow-wrap': '',
        'speak': '',
        'tab-size': '',
        'widows': '',
        'zoom': '',
        '-webkit-appearance': '',
        '-webkit-background-clip': '',
        '-webkit-background-composite': '',
        '-webkit-background-origin': '',
        '-webkit-background-size': '',
        '-webkit-border-fit': '',
        '-webkit-border-image': '',
        '-webkit-box-align': '',
        '-webkit-box-decoration-break': '',
        '-webkit-box-direction': '',
        '-webkit-box-flex': '',
        '-webkit-box-flex-group': '',
        '-webkit-box-lines': '',
        '-webkit-box-ordinal-group': '',
        '-webkit-box-orient': '',
        '-webkit-box-pack': '',
        '-webkit-box-reflect': '',
        '-webkit-box-shadow': '',
        '-webkit-clip-path': '',
        '-webkit-column-break-after': '',
        '-webkit-column-break-before': '',
        '-webkit-column-break-inside': '',
        '-webkit-column-count': '',
        '-webkit-column-gap': '',
        '-webkit-column-rule-color': '',
        '-webkit-column-rule-style': '',
        '-webkit-column-rule-width': '',
        '-webkit-column-span': '',
        '-webkit-column-width': '',
        '-webkit-filter': '',
        '-webkit-font-smoothing': '',
        '-webkit-highlight': '',
        '-webkit-hyphenate-character': '',
        '-webkit-line-box-contain': '',
        '-webkit-line-break': '',
        '-webkit-margin-before-collapse': '',
        '-webkit-margin-after-collapse': '',
        '-webkit-mask-box-image-source': '',
        '-webkit-mask-box-image-slice': '',
        '-webkit-mask-box-image-width': '',
        '-webkit-mask-box-image-outset': '',
        '-webkit-mask-box-image-repeat': '',
        '-webkit-mask': '',
        '-webkit-mask-composite': '',
        '-webkit-mask-size': '',
        '-webkit-perspective-origin-x': '',
        '-webkit-perspective-origin-y': '',
        '-webkit-print-color-adjust': '',
        '-webkit-rtl-ordering': '',
        '-webkit-tap-highlight-color': '',
        '-webkit-text-combine': '',
        '-webkit-text-decorations-in-effect': '',
        '-webkit-text-emphasis-color': '',
        '-webkit-text-emphasis-position': '',
        '-webkit-text-emphasis-style': '',
        '-webkit-text-fill-color': '',
        '-webkit-text-orientation': '',
        '-webkit-text-security': '',
        '-webkit-text-stroke-color': '',
        '-webkit-text-stroke-width': '',
        '-webkit-user-drag': '',
        '-webkit-user-modify': '',
        '-webkit-user-select': '',
        '-webkit-writing-mode': '',
        '-webkit-app-region': '',
        'buffered-rendering': '',
        'color-rendering': '',
        'marker-end': '',
        'marker-mid': '',
        'marker-start': '',
        'mask-type': '',
        'alignment-baseline': '',
        'baseline-shift': '',
        'kerning': '',
        'writing-mode': '',
        'glyph-orientation-horizontal': '',
        'glyph-orientation-vertical': '',
        'paint-order': ''
    };
//,'width':'','min-width':'','max-width':''	


    /*
     * jQuery Reveal Plugin 1.0
     * www.ZURB.com
     * Copyright 2010, ZURB
     * Free to use under the MIT license.
     * http://www.opensource.org/licenses/mit-license.php
     */

    /*---------------------------
     Listener for data-reveal-id attributes
     ----------------------------*/

    $(document).on('click', 'a[data-reveal-id]', function (e) {
        e.preventDefault();
        var modalLocation = $(this).attr('data-reveal-id');
        $('#' + modalLocation).reveal($(this).data());
    });

    /*---------------------------
     Extend and Execute
     ----------------------------*/

    $.fn.reveal = function (options) {

        var defaults = {
            animation: 'fadeAndPop',                                            //fade, fadeAndPop, none
            animationspeed: 350,                                                //how fast animtions are
            closeonbackgroundclick: true,                                       //if you click background will modal close?
            closeonescape: true,                                       //if you click escape will modal close?
            dismissmodalclass: 'close-modal'                             //the class of a button or element that will close an open modal
        };

        //Extend dem' options
        options = $.extend({}, defaults, options);

        return this.each(function () {


            /*---------------------------
             Global Variables
             ----------------------------*/
            var modal = $(this),
                topMeasure = 100, 
                locked = false,
                modalBG = $('.dqADDewKESfc-bg');

            /*---------------------------
             Create Modal BG
             ----------------------------*/
            if (modalBG.length === 0) {
                modalBG = $('<div class="dqADDewKESfc-bg" style="z-index:999999" />').insertAfter(modal);
            }

            /*---------------------------
             Open & Close Animations
             ----------------------------*/
            //Entrance Animations
            modal.bind('reveal:open', function () {
                modalBG.unbind('click.modalEvent');
                $('.' + options.dismissmodalclass).unbind('click.modalEvent');
                if (!locked) {
                    lockModal();
                    if (options.animation === 'fadeAndPop') {
                        modal.css({   'opacity': 0, 'visibility': 'visible'});
                        modalBG.fadeIn(options.animationspeed / 2);
                        modal.delay(options.animationspeed / 2).animate({

                            'opacity': 1
                        }, options.animationspeed, unlockModal());
                    }
                    if (options.animation === 'fade') {
                        modal.css({'opacity': 0, 'visibility': 'visible'});
                        modalBG.fadeIn(options.animationspeed / 2);
                        modal.delay(options.animationspeed / 2).animate({
                            'opacity': 1
                        }, options.animationspeed, unlockModal());
                    }
                    if (options.animation === 'none') {
                        modal.css({'visibility': 'visible' });
                        modalBG.css({'display': 'block'});
                        unlockModal();
                    }
                }
                modal.unbind('reveal:open');
            });

            //Closing Animation
            modal.bind('reveal:close', function () {
                if (!locked) {
                    lockModal();
                    if (options.animation === 'fadeAndPop') {
                        modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
                        modal.animate({
                            'opacity': 0
                        }, options.animationspeed / 2, function () {
                            modal.css({'top': topMeasure, 'opacity': 1, 'visibility': 'hidden'});
                            unlockModal();
                        });
                    }
                    if (options.animation === 'fade') {
                        modalBG.delay(options.animationspeed).fadeOut(options.animationspeed);
                        modal.animate({
                            'opacity': 0
                        }, options.animationspeed, function () {
                            modal.css({'opacity': 1, 'visibility': 'hidden', 'top': topMeasure});
                            unlockModal();
                        });
                    }
                    if (options.animation === 'none') {
                        modal.css({'visibility': 'hidden', 'top': topMeasure});
                        modalBG.css({'display': 'none'});
                    }
                }
                modal.unbind('reveal:close');
            });

            /*---------------------------
             Open and add Closing Listeners
             ----------------------------*/
            //Open Modal Immediately
            modal.trigger('reveal:open');

            //Close Modal Listeners
            $('.' + options.dismissmodalclass).bind('click.modalEvent', function () {
                modal.trigger('reveal:close');
            });

            if (options.closeonbackgroundclick) {
                modalBG.css({'cursor': 'pointer'});
                modalBG.bind('click.modalEvent', function () {
                    modal.trigger('reveal:close');
                });
            }
            if (options.closeonescape) {
                $('body').keyup(function (e) {
                    if (e.which === 27) {
                        modal.trigger('reveal:close');
                    } // 27 is the keycode for the Escape key
                });
            }


            /*---------------------------
             Animations Locks
             ----------------------------*/
            function unlockModal() {
                locked = false;
            }

            function lockModal() {
                locked = true;
            }

        });//each call
    }; //orbit plugin call


//END JQUERY
});
// source --> https://businessportal.bg/wp-content/plugins/geodirectory/assets/leaflet/leaflet.min.js?ver=2.8.162 
(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports):typeof define==="function"&&define.amd?define(["exports"],factory):factory(global.L={})})(this,function(exports){"use strict";var version="1.6.0";var freeze=Object.freeze;Object.freeze=function(obj){return obj};function extend(dest){var i,j,len,src;for(j=1,len=arguments.length;j<len;j++){src=arguments[j];for(i in src){dest[i]=src[i]}}return dest}var create=Object.create||function(){function F(){}return function(proto){F.prototype=proto;return new F}}();function bind(fn,obj){var slice=Array.prototype.slice;if(fn.bind){return fn.bind.apply(fn,slice.call(arguments,1))}var args=slice.call(arguments,2);return function(){return fn.apply(obj,args.length?args.concat(slice.call(arguments)):arguments)}}var lastId=0;function stamp(obj){obj._leaflet_id=obj._leaflet_id||++lastId;return obj._leaflet_id}function throttle(fn,time,context){var lock,args,wrapperFn,later;later=function(){lock=false;if(args){wrapperFn.apply(context,args);args=false}};wrapperFn=function(){if(lock){args=arguments}else{fn.apply(context,arguments);setTimeout(later,time);lock=true}};return wrapperFn}function wrapNum(x,range,includeMax){var max=range[1],min=range[0],d=max-min;return x===max&&includeMax?x:((x-min)%d+d)%d+min}function falseFn(){return false}function formatNum(num,digits){var pow=Math.pow(10,digits===undefined?6:digits);return Math.round(num*pow)/pow}function trim(str){return str.trim?str.trim():str.replace(/^\s+|\s+$/g,"")}function splitWords(str){return trim(str).split(/\s+/)}function setOptions(obj,options){if(!obj.hasOwnProperty("options")){obj.options=obj.options?create(obj.options):{}}for(var i in options){obj.options[i]=options[i]}return obj.options}function getParamString(obj,existingUrl,uppercase){var params=[];for(var i in obj){params.push(encodeURIComponent(uppercase?i.toUpperCase():i)+"="+encodeURIComponent(obj[i]))}return(!existingUrl||existingUrl.indexOf("?")===-1?"?":"&")+params.join("&")}var templateRe=/\{ *([\w_-]+) *\}/g;function template(str,data){return str.replace(templateRe,function(str,key){var value=data[key];if(value===undefined){throw new Error("No value provided for variable "+str)}else if(typeof value==="function"){value=value(data)}return value})}var isArray=Array.isArray||function(obj){return Object.prototype.toString.call(obj)==="[object Array]"};function indexOf(array,el){for(var i=0;i<array.length;i++){if(array[i]===el){return i}}return-1}var emptyImageUrl="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function getPrefixed(name){return window["webkit"+name]||window["moz"+name]||window["ms"+name]}var lastTime=0;function timeoutDefer(fn){var time=+new Date,timeToCall=Math.max(0,16-(time-lastTime));lastTime=time+timeToCall;return window.setTimeout(fn,timeToCall)}var requestFn=window.requestAnimationFrame||getPrefixed("RequestAnimationFrame")||timeoutDefer;var cancelFn=window.cancelAnimationFrame||getPrefixed("CancelAnimationFrame")||getPrefixed("CancelRequestAnimationFrame")||function(id){window.clearTimeout(id)};function requestAnimFrame(fn,context,immediate){if(immediate&&requestFn===timeoutDefer){fn.call(context)}else{return requestFn.call(window,bind(fn,context))}}function cancelAnimFrame(id){if(id){cancelFn.call(window,id)}}var Util=(Object.freeze||Object)({freeze:freeze,extend:extend,create:create,bind:bind,lastId:lastId,stamp:stamp,throttle:throttle,wrapNum:wrapNum,falseFn:falseFn,formatNum:formatNum,trim:trim,splitWords:splitWords,setOptions:setOptions,getParamString:getParamString,template:template,isArray:isArray,indexOf:indexOf,emptyImageUrl:emptyImageUrl,requestFn:requestFn,cancelFn:cancelFn,requestAnimFrame:requestAnimFrame,cancelAnimFrame:cancelAnimFrame});function Class(){}Class.extend=function(props){var NewClass=function(){if(this.initialize){this.initialize.apply(this,arguments)}this.callInitHooks()};var parentProto=NewClass.__super__=this.prototype;var proto=create(parentProto);proto.constructor=NewClass;NewClass.prototype=proto;for(var i in this){if(this.hasOwnProperty(i)&&i!=="prototype"&&i!=="__super__"){NewClass[i]=this[i]}}if(props.statics){extend(NewClass,props.statics);delete props.statics}if(props.includes){checkDeprecatedMixinEvents(props.includes);extend.apply(null,[proto].concat(props.includes));delete props.includes}if(proto.options){props.options=extend(create(proto.options),props.options)}extend(proto,props);proto._initHooks=[];proto.callInitHooks=function(){if(this._initHooksCalled){return}if(parentProto.callInitHooks){parentProto.callInitHooks.call(this)}this._initHooksCalled=true;for(var i=0,len=proto._initHooks.length;i<len;i++){proto._initHooks[i].call(this)}};return NewClass};Class.include=function(props){extend(this.prototype,props);return this};Class.mergeOptions=function(options){extend(this.prototype.options,options);return this};Class.addInitHook=function(fn){var args=Array.prototype.slice.call(arguments,1);var init=typeof fn==="function"?fn:function(){this[fn].apply(this,args)};this.prototype._initHooks=this.prototype._initHooks||[];this.prototype._initHooks.push(init);return this};function checkDeprecatedMixinEvents(includes){if(typeof L==="undefined"||!L||!L.Mixin){return}includes=isArray(includes)?includes:[includes];for(var i=0;i<includes.length;i++){if(includes[i]===L.Mixin.Events){console.warn("Deprecated include of L.Mixin.Events: "+"this property will be removed in future releases, "+"please inherit from L.Evented instead.",(new Error).stack)}}}var Events={on:function(types,fn,context){if(typeof types==="object"){for(var type in types){this._on(type,types[type],fn)}}else{types=splitWords(types);for(var i=0,len=types.length;i<len;i++){this._on(types[i],fn,context)}}return this},off:function(types,fn,context){if(!types){delete this._events}else if(typeof types==="object"){for(var type in types){this._off(type,types[type],fn)}}else{types=splitWords(types);for(var i=0,len=types.length;i<len;i++){this._off(types[i],fn,context)}}return this},_on:function(type,fn,context){this._events=this._events||{};var typeListeners=this._events[type];if(!typeListeners){typeListeners=[];this._events[type]=typeListeners}if(context===this){context=undefined}var newListener={fn:fn,ctx:context},listeners=typeListeners;for(var i=0,len=listeners.length;i<len;i++){if(listeners[i].fn===fn&&listeners[i].ctx===context){return}}listeners.push(newListener)},_off:function(type,fn,context){var listeners,i,len;if(!this._events){return}listeners=this._events[type];if(!listeners){return}if(!fn){for(i=0,len=listeners.length;i<len;i++){listeners[i].fn=falseFn}delete this._events[type];return}if(context===this){context=undefined}if(listeners){for(i=0,len=listeners.length;i<len;i++){var l=listeners[i];if(l.ctx!==context){continue}if(l.fn===fn){l.fn=falseFn;if(this._firingCount){this._events[type]=listeners=listeners.slice()}listeners.splice(i,1);return}}}},fire:function(type,data,propagate){if(!this.listens(type,propagate)){return this}var event=extend({},data,{type:type,target:this,sourceTarget:data&&data.sourceTarget||this});if(this._events){var listeners=this._events[type];if(listeners){this._firingCount=this._firingCount+1||1;for(var i=0,len=listeners.length;i<len;i++){var l=listeners[i];l.fn.call(l.ctx||this,event)}this._firingCount--}}if(propagate){this._propagateEvent(event)}return this},listens:function(type,propagate){var listeners=this._events&&this._events[type];if(listeners&&listeners.length){return true}if(propagate){for(var id in this._eventParents){if(this._eventParents[id].listens(type,propagate)){return true}}}return false},once:function(types,fn,context){if(typeof types==="object"){for(var type in types){this.once(type,types[type],fn)}return this}var handler=bind(function(){this.off(types,fn,context).off(types,handler,context)},this);return this.on(types,fn,context).on(types,handler,context)},addEventParent:function(obj){this._eventParents=this._eventParents||{};this._eventParents[stamp(obj)]=obj;return this},removeEventParent:function(obj){if(this._eventParents){delete this._eventParents[stamp(obj)]}return this},_propagateEvent:function(e){for(var id in this._eventParents){this._eventParents[id].fire(e.type,extend({layer:e.target,propagatedFrom:e.target},e),true)}}};Events.addEventListener=Events.on;Events.removeEventListener=Events.clearAllEventListeners=Events.off;Events.addOneTimeEventListener=Events.once;Events.fireEvent=Events.fire;Events.hasEventListeners=Events.listens;var Evented=Class.extend(Events);function Point(x,y,round){this.x=round?Math.round(x):x;this.y=round?Math.round(y):y}var trunc=Math.trunc||function(v){return v>0?Math.floor(v):Math.ceil(v)};Point.prototype={clone:function(){return new Point(this.x,this.y)},add:function(point){return this.clone()._add(toPoint(point))},_add:function(point){this.x+=point.x;this.y+=point.y;return this},subtract:function(point){return this.clone()._subtract(toPoint(point))},_subtract:function(point){this.x-=point.x;this.y-=point.y;return this},divideBy:function(num){return this.clone()._divideBy(num)},_divideBy:function(num){this.x/=num;this.y/=num;return this},multiplyBy:function(num){return this.clone()._multiplyBy(num)},_multiplyBy:function(num){this.x*=num;this.y*=num;return this},scaleBy:function(point){return new Point(this.x*point.x,this.y*point.y)},unscaleBy:function(point){return new Point(this.x/point.x,this.y/point.y)},round:function(){return this.clone()._round()},_round:function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this},floor:function(){return this.clone()._floor()},_floor:function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this},ceil:function(){return this.clone()._ceil()},_ceil:function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this},trunc:function(){return this.clone()._trunc()},_trunc:function(){this.x=trunc(this.x);this.y=trunc(this.y);return this},distanceTo:function(point){point=toPoint(point);var x=point.x-this.x,y=point.y-this.y;return Math.sqrt(x*x+y*y)},equals:function(point){point=toPoint(point);return point.x===this.x&&point.y===this.y},contains:function(point){point=toPoint(point);return Math.abs(point.x)<=Math.abs(this.x)&&Math.abs(point.y)<=Math.abs(this.y)},toString:function(){return"Point("+formatNum(this.x)+", "+formatNum(this.y)+")"}};function toPoint(x,y,round){if(x instanceof Point){return x}if(isArray(x)){return new Point(x[0],x[1])}if(x===undefined||x===null){return x}if(typeof x==="object"&&"x"in x&&"y"in x){return new Point(x.x,x.y)}return new Point(x,y,round)}function Bounds(a,b){if(!a){return}var points=b?[a,b]:a;for(var i=0,len=points.length;i<len;i++){this.extend(points[i])}}Bounds.prototype={extend:function(point){point=toPoint(point);if(!this.min&&!this.max){this.min=point.clone();this.max=point.clone()}else{this.min.x=Math.min(point.x,this.min.x);this.max.x=Math.max(point.x,this.max.x);this.min.y=Math.min(point.y,this.min.y);this.max.y=Math.max(point.y,this.max.y)}return this},getCenter:function(round){return new Point((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,round)},getBottomLeft:function(){return new Point(this.min.x,this.max.y)},getTopRight:function(){return new Point(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(obj){var min,max;if(typeof obj[0]==="number"||obj instanceof Point){obj=toPoint(obj)}else{obj=toBounds(obj)}if(obj instanceof Bounds){min=obj.min;max=obj.max}else{min=max=obj}return min.x>=this.min.x&&max.x<=this.max.x&&min.y>=this.min.y&&max.y<=this.max.y},intersects:function(bounds){bounds=toBounds(bounds);var min=this.min,max=this.max,min2=bounds.min,max2=bounds.max,xIntersects=max2.x>=min.x&&min2.x<=max.x,yIntersects=max2.y>=min.y&&min2.y<=max.y;return xIntersects&&yIntersects},overlaps:function(bounds){bounds=toBounds(bounds);var min=this.min,max=this.max,min2=bounds.min,max2=bounds.max,xOverlaps=max2.x>min.x&&min2.x<max.x,yOverlaps=max2.y>min.y&&min2.y<max.y;return xOverlaps&&yOverlaps},isValid:function(){return!!(this.min&&this.max)}};function toBounds(a,b){if(!a||a instanceof Bounds){return a}return new Bounds(a,b)}function LatLngBounds(corner1,corner2){if(!corner1){return}var latlngs=corner2?[corner1,corner2]:corner1;for(var i=0,len=latlngs.length;i<len;i++){this.extend(latlngs[i])}}LatLngBounds.prototype={extend:function(obj){var sw=this._southWest,ne=this._northEast,sw2,ne2;if(obj instanceof LatLng){sw2=obj;ne2=obj}else if(obj instanceof LatLngBounds){sw2=obj._southWest;ne2=obj._northEast;if(!sw2||!ne2){return this}}else{return obj?this.extend(toLatLng(obj)||toLatLngBounds(obj)):this}if(!sw&&!ne){this._southWest=new LatLng(sw2.lat,sw2.lng);this._northEast=new LatLng(ne2.lat,ne2.lng)}else{sw.lat=Math.min(sw2.lat,sw.lat);sw.lng=Math.min(sw2.lng,sw.lng);ne.lat=Math.max(ne2.lat,ne.lat);ne.lng=Math.max(ne2.lng,ne.lng)}return this},pad:function(bufferRatio){var sw=this._southWest,ne=this._northEast,heightBuffer=Math.abs(sw.lat-ne.lat)*bufferRatio,widthBuffer=Math.abs(sw.lng-ne.lng)*bufferRatio;return new LatLngBounds(new LatLng(sw.lat-heightBuffer,sw.lng-widthBuffer),new LatLng(ne.lat+heightBuffer,ne.lng+widthBuffer))},getCenter:function(){return new LatLng((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new LatLng(this.getNorth(),this.getWest())},getSouthEast:function(){return new LatLng(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(obj){if(typeof obj[0]==="number"||obj instanceof LatLng||"lat"in obj){obj=toLatLng(obj)}else{obj=toLatLngBounds(obj)}var sw=this._southWest,ne=this._northEast,sw2,ne2;if(obj instanceof LatLngBounds){sw2=obj.getSouthWest();ne2=obj.getNorthEast()}else{sw2=ne2=obj}return sw2.lat>=sw.lat&&ne2.lat<=ne.lat&&sw2.lng>=sw.lng&&ne2.lng<=ne.lng},intersects:function(bounds){bounds=toLatLngBounds(bounds);var sw=this._southWest,ne=this._northEast,sw2=bounds.getSouthWest(),ne2=bounds.getNorthEast(),latIntersects=ne2.lat>=sw.lat&&sw2.lat<=ne.lat,lngIntersects=ne2.lng>=sw.lng&&sw2.lng<=ne.lng;return latIntersects&&lngIntersects},overlaps:function(bounds){bounds=toLatLngBounds(bounds);var sw=this._southWest,ne=this._northEast,sw2=bounds.getSouthWest(),ne2=bounds.getNorthEast(),latOverlaps=ne2.lat>sw.lat&&sw2.lat<ne.lat,lngOverlaps=ne2.lng>sw.lng&&sw2.lng<ne.lng;return latOverlaps&&lngOverlaps},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(bounds,maxMargin){if(!bounds){return false}bounds=toLatLngBounds(bounds);return this._southWest.equals(bounds.getSouthWest(),maxMargin)&&this._northEast.equals(bounds.getNorthEast(),maxMargin)},isValid:function(){return!!(this._southWest&&this._northEast)}};function toLatLngBounds(a,b){if(a instanceof LatLngBounds){return a}return new LatLngBounds(a,b)}function LatLng(lat,lng,alt){if(isNaN(lat)||isNaN(lng)){throw new Error("Invalid LatLng object: ("+lat+", "+lng+")")}this.lat=+lat;this.lng=+lng;if(alt!==undefined){this.alt=+alt}}LatLng.prototype={equals:function(obj,maxMargin){if(!obj){return false}obj=toLatLng(obj);var margin=Math.max(Math.abs(this.lat-obj.lat),Math.abs(this.lng-obj.lng));return margin<=(maxMargin===undefined?1e-9:maxMargin)},toString:function(precision){return"LatLng("+formatNum(this.lat,precision)+", "+formatNum(this.lng,precision)+")"},distanceTo:function(other){return Earth.distance(this,toLatLng(other))},wrap:function(){return Earth.wrapLatLng(this)},toBounds:function(sizeInMeters){var latAccuracy=180*sizeInMeters/40075017,lngAccuracy=latAccuracy/Math.cos(Math.PI/180*this.lat);return toLatLngBounds([this.lat-latAccuracy,this.lng-lngAccuracy],[this.lat+latAccuracy,this.lng+lngAccuracy])},clone:function(){return new LatLng(this.lat,this.lng,this.alt)}};function toLatLng(a,b,c){if(a instanceof LatLng){return a}if(isArray(a)&&typeof a[0]!=="object"){if(a.length===3){return new LatLng(a[0],a[1],a[2])}if(a.length===2){return new LatLng(a[0],a[1])}return null}if(a===undefined||a===null){return a}if(typeof a==="object"&&"lat"in a){return new LatLng(a.lat,"lng"in a?a.lng:a.lon,a.alt)}if(b===undefined){return null}return new LatLng(a,b,c)}var CRS={latLngToPoint:function(latlng,zoom){var projectedPoint=this.projection.project(latlng),scale=this.scale(zoom);return this.transformation._transform(projectedPoint,scale)},pointToLatLng:function(point,zoom){var scale=this.scale(zoom),untransformedPoint=this.transformation.untransform(point,scale);return this.projection.unproject(untransformedPoint)},project:function(latlng){return this.projection.project(latlng)},unproject:function(point){return this.projection.unproject(point)},scale:function(zoom){return 256*Math.pow(2,zoom)},zoom:function(scale){return Math.log(scale/256)/Math.LN2},getProjectedBounds:function(zoom){if(this.infinite){return null}var b=this.projection.bounds,s=this.scale(zoom),min=this.transformation.transform(b.min,s),max=this.transformation.transform(b.max,s);return new Bounds(min,max)},infinite:false,wrapLatLng:function(latlng){var lng=this.wrapLng?wrapNum(latlng.lng,this.wrapLng,true):latlng.lng,lat=this.wrapLat?wrapNum(latlng.lat,this.wrapLat,true):latlng.lat,alt=latlng.alt;return new LatLng(lat,lng,alt)},wrapLatLngBounds:function(bounds){var center=bounds.getCenter(),newCenter=this.wrapLatLng(center),latShift=center.lat-newCenter.lat,lngShift=center.lng-newCenter.lng;if(latShift===0&&lngShift===0){return bounds}var sw=bounds.getSouthWest(),ne=bounds.getNorthEast(),newSw=new LatLng(sw.lat-latShift,sw.lng-lngShift),newNe=new LatLng(ne.lat-latShift,ne.lng-lngShift);return new LatLngBounds(newSw,newNe)}};var Earth=extend({},CRS,{wrapLng:[-180,180],R:6371e3,distance:function(latlng1,latlng2){var rad=Math.PI/180,lat1=latlng1.lat*rad,lat2=latlng2.lat*rad,sinDLat=Math.sin((latlng2.lat-latlng1.lat)*rad/2),sinDLon=Math.sin((latlng2.lng-latlng1.lng)*rad/2),a=sinDLat*sinDLat+Math.cos(lat1)*Math.cos(lat2)*sinDLon*sinDLon,c=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a));return this.R*c}});var earthRadius=6378137;var SphericalMercator={R:earthRadius,MAX_LATITUDE:85.0511287798,project:function(latlng){var d=Math.PI/180,max=this.MAX_LATITUDE,lat=Math.max(Math.min(max,latlng.lat),-max),sin=Math.sin(lat*d);return new Point(this.R*latlng.lng*d,this.R*Math.log((1+sin)/(1-sin))/2)},unproject:function(point){var d=180/Math.PI;return new LatLng((2*Math.atan(Math.exp(point.y/this.R))-Math.PI/2)*d,point.x*d/this.R)},bounds:function(){var d=earthRadius*Math.PI;return new Bounds([-d,-d],[d,d])}()};function Transformation(a,b,c,d){if(isArray(a)){this._a=a[0];this._b=a[1];this._c=a[2];this._d=a[3];return}this._a=a;this._b=b;this._c=c;this._d=d}Transformation.prototype={transform:function(point,scale){return this._transform(point.clone(),scale)},_transform:function(point,scale){scale=scale||1;point.x=scale*(this._a*point.x+this._b);point.y=scale*(this._c*point.y+this._d);return point},untransform:function(point,scale){scale=scale||1;return new Point((point.x/scale-this._b)/this._a,(point.y/scale-this._d)/this._c)}};function toTransformation(a,b,c,d){return new Transformation(a,b,c,d)}var EPSG3857=extend({},Earth,{code:"EPSG:3857",projection:SphericalMercator,transformation:function(){var scale=.5/(Math.PI*SphericalMercator.R);return toTransformation(scale,.5,-scale,.5)}()});var EPSG900913=extend({},EPSG3857,{code:"EPSG:900913"});function svgCreate(name){return document.createElementNS("http://www.w3.org/2000/svg",name)}function pointsToPath(rings,closed){var str="",i,j,len,len2,points,p;for(i=0,len=rings.length;i<len;i++){points=rings[i];for(j=0,len2=points.length;j<len2;j++){p=points[j];str+=(j?"L":"M")+p.x+" "+p.y}str+=closed?svg?"z":"x":""}return str||"M0 0"}var style$1=document.documentElement.style;var ie="ActiveXObject"in window;var ielt9=ie&&!document.addEventListener;var edge="msLaunchUri"in navigator&&!("documentMode"in document);var webkit=userAgentContains("webkit");var android=userAgentContains("android");var android23=userAgentContains("android 2")||userAgentContains("android 3");var webkitVer=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10);var androidStock=android&&userAgentContains("Google")&&webkitVer<537&&!("AudioNode"in window);var opera=!!window.opera;var chrome=userAgentContains("chrome");var gecko=userAgentContains("gecko")&&!webkit&&!opera&&!ie;var safari=!chrome&&userAgentContains("safari");var phantom=userAgentContains("phantom");var opera12="OTransition"in style$1;var win=navigator.platform.indexOf("Win")===0;var ie3d=ie&&"transition"in style$1;var webkit3d="WebKitCSSMatrix"in window&&"m11"in new window.WebKitCSSMatrix&&!android23;var gecko3d="MozPerspective"in style$1;var any3d=!window.L_DISABLE_3D&&(ie3d||webkit3d||gecko3d)&&!opera12&&!phantom;var mobile=typeof orientation!=="undefined"||userAgentContains("mobile");var mobileWebkit=mobile&&webkit;var mobileWebkit3d=mobile&&webkit3d;var msPointer=!window.PointerEvent&&window.MSPointerEvent;var pointer=!webkit&&!!(window.PointerEvent||msPointer);var touch=!window.L_NO_TOUCH&&(pointer||"ontouchstart"in window||window.DocumentTouch&&document instanceof window.DocumentTouch);var mobileOpera=mobile&&opera;var mobileGecko=mobile&&gecko;var retina=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1;var passiveEvents=function(){var supportsPassiveOption=false;try{var opts=Object.defineProperty({},"passive",{get:function(){supportsPassiveOption=true}});window.addEventListener("testPassiveEventSupport",falseFn,opts);window.removeEventListener("testPassiveEventSupport",falseFn,opts)}catch(e){}return supportsPassiveOption};var canvas=function(){return!!document.createElement("canvas").getContext}();var svg=!!(document.createElementNS&&svgCreate("svg").createSVGRect);var vml=!svg&&function(){try{var div=document.createElement("div");div.innerHTML='<v:shape adj="1"/>';var shape=div.firstChild;shape.style.behavior="url(#default#VML)";return shape&&typeof shape.adj==="object"}catch(e){return false}}();function userAgentContains(str){return navigator.userAgent.toLowerCase().indexOf(str)>=0}var Browser=(Object.freeze||Object)({ie:ie,ielt9:ielt9,edge:edge,webkit:webkit,android:android,android23:android23,androidStock:androidStock,opera:opera,chrome:chrome,gecko:gecko,safari:safari,phantom:phantom,opera12:opera12,win:win,ie3d:ie3d,webkit3d:webkit3d,gecko3d:gecko3d,any3d:any3d,mobile:mobile,mobileWebkit:mobileWebkit,mobileWebkit3d:mobileWebkit3d,msPointer:msPointer,pointer:pointer,touch:touch,mobileOpera:mobileOpera,mobileGecko:mobileGecko,retina:retina,passiveEvents:passiveEvents,canvas:canvas,svg:svg,vml:vml});var POINTER_DOWN=msPointer?"MSPointerDown":"pointerdown";var POINTER_MOVE=msPointer?"MSPointerMove":"pointermove";var POINTER_UP=msPointer?"MSPointerUp":"pointerup";var POINTER_CANCEL=msPointer?"MSPointerCancel":"pointercancel";var TAG_WHITE_LIST=["INPUT","SELECT","OPTION"];var _pointers={};var _pointerDocListener=false;var _pointersCount=0;function addPointerListener(obj,type,handler,id){if(type==="touchstart"){_addPointerStart(obj,handler,id)}else if(type==="touchmove"){_addPointerMove(obj,handler,id)}else if(type==="touchend"){_addPointerEnd(obj,handler,id)}return this}function removePointerListener(obj,type,id){var handler=obj["_leaflet_"+type+id];if(type==="touchstart"){obj.removeEventListener(POINTER_DOWN,handler,false)}else if(type==="touchmove"){obj.removeEventListener(POINTER_MOVE,handler,false)}else if(type==="touchend"){obj.removeEventListener(POINTER_UP,handler,false);obj.removeEventListener(POINTER_CANCEL,handler,false)}return this}function _addPointerStart(obj,handler,id){var onDown=bind(function(e){if(e.pointerType!=="mouse"&&e.MSPOINTER_TYPE_MOUSE&&e.pointerType!==e.MSPOINTER_TYPE_MOUSE){if(TAG_WHITE_LIST.indexOf(e.target.tagName)<0){preventDefault(e)}else{return}}_handlePointer(e,handler)});obj["_leaflet_touchstart"+id]=onDown;obj.addEventListener(POINTER_DOWN,onDown,false);if(!_pointerDocListener){document.documentElement.addEventListener(POINTER_DOWN,_globalPointerDown,true);document.documentElement.addEventListener(POINTER_MOVE,_globalPointerMove,true);document.documentElement.addEventListener(POINTER_UP,_globalPointerUp,true);document.documentElement.addEventListener(POINTER_CANCEL,_globalPointerUp,true);_pointerDocListener=true}}function _globalPointerDown(e){_pointers[e.pointerId]=e;_pointersCount++}function _globalPointerMove(e){if(_pointers[e.pointerId]){_pointers[e.pointerId]=e}}function _globalPointerUp(e){delete _pointers[e.pointerId];_pointersCount--}function _handlePointer(e,handler){e.touches=[];for(var i in _pointers){e.touches.push(_pointers[i])}e.changedTouches=[e];handler(e)}function _addPointerMove(obj,handler,id){var onMove=function(e){if((e.pointerType===e.MSPOINTER_TYPE_MOUSE||e.pointerType==="mouse")&&e.buttons===0){return}_handlePointer(e,handler)};obj["_leaflet_touchmove"+id]=onMove;obj.addEventListener(POINTER_MOVE,onMove,false)}function _addPointerEnd(obj,handler,id){var onUp=function(e){_handlePointer(e,handler)};obj["_leaflet_touchend"+id]=onUp;obj.addEventListener(POINTER_UP,onUp,false);obj.addEventListener(POINTER_CANCEL,onUp,false)}var _touchstart=msPointer?"MSPointerDown":pointer?"pointerdown":"touchstart";var _touchend=msPointer?"MSPointerUp":pointer?"pointerup":"touchend";var _pre="_leaflet_";function addDoubleTapListener(obj,handler,id){var last,touch$$1,doubleTap=false,delay=250;function onTouchStart(e){var count;if(pointer){if(!edge||e.pointerType==="mouse"){return}count=_pointersCount}else{count=e.touches.length}if(count>1){return}var now=Date.now(),delta=now-(last||now);touch$$1=e.touches?e.touches[0]:e;doubleTap=delta>0&&delta<=delay;last=now}function onTouchEnd(e){if(doubleTap&&!touch$$1.cancelBubble){if(pointer){if(!edge||e.pointerType==="mouse"){return}var newTouch={},prop,i;for(i in touch$$1){prop=touch$$1[i];newTouch[i]=prop&&prop.bind?prop.bind(touch$$1):prop}touch$$1=newTouch}touch$$1.type="dblclick";touch$$1.button=0;handler(touch$$1);last=null}}obj[_pre+_touchstart+id]=onTouchStart;obj[_pre+_touchend+id]=onTouchEnd;obj[_pre+"dblclick"+id]=handler;obj.addEventListener(_touchstart,onTouchStart,passiveEvents?{passive:false}:false);obj.addEventListener(_touchend,onTouchEnd,passiveEvents?{passive:false}:false);obj.addEventListener("dblclick",handler,false);return this}function removeDoubleTapListener(obj,id){var touchstart=obj[_pre+_touchstart+id],touchend=obj[_pre+_touchend+id],dblclick=obj[_pre+"dblclick"+id];obj.removeEventListener(_touchstart,touchstart,passiveEvents?{passive:false}:false);obj.removeEventListener(_touchend,touchend,passiveEvents?{passive:false}:false);if(!edge){obj.removeEventListener("dblclick",dblclick,false)}return this}var TRANSFORM=testProp(["transform","webkitTransform","OTransform","MozTransform","msTransform"]);var TRANSITION=testProp(["webkitTransition","transition","OTransition","MozTransition","msTransition"]);var TRANSITION_END=TRANSITION==="webkitTransition"||TRANSITION==="OTransition"?TRANSITION+"End":"transitionend";function get(id){return typeof id==="string"?document.getElementById(id):id}function getStyle(el,style){var value=el.style[style]||el.currentStyle&&el.currentStyle[style];if((!value||value==="auto")&&document.defaultView){var css=document.defaultView.getComputedStyle(el,null);value=css?css[style]:null}return value==="auto"?null:value}function create$1(tagName,className,container){var el=document.createElement(tagName);el.className=className||"";if(container){container.appendChild(el)}return el}function remove(el){var parent=el.parentNode;if(parent){parent.removeChild(el)}}function empty(el){while(el.firstChild){el.removeChild(el.firstChild)}}function toFront(el){var parent=el.parentNode;if(parent&&parent.lastChild!==el){parent.appendChild(el)}}function toBack(el){var parent=el.parentNode;if(parent&&parent.firstChild!==el){parent.insertBefore(el,parent.firstChild)}}function hasClass(el,name){if(el.classList!==undefined){return el.classList.contains(name)}var className=getClass(el);return className.length>0&&new RegExp("(^|\\s)"+name+"(\\s|$)").test(className)}function addClass(el,name){if(el.classList!==undefined){var classes=splitWords(name);for(var i=0,len=classes.length;i<len;i++){el.classList.add(classes[i])}}else if(!hasClass(el,name)){var className=getClass(el);setClass(el,(className?className+" ":"")+name)}}function removeClass(el,name){if(el.classList!==undefined){el.classList.remove(name)}else{setClass(el,trim((" "+getClass(el)+" ").replace(" "+name+" "," ")))}}function setClass(el,name){if(el.className.baseVal===undefined){el.className=name}else{el.className.baseVal=name}}function getClass(el){if(el.correspondingElement){el=el.correspondingElement}return el.className.baseVal===undefined?el.className:el.className.baseVal}function setOpacity(el,value){if("opacity"in el.style){el.style.opacity=value}else if("filter"in el.style){_setOpacityIE(el,value)}}function _setOpacityIE(el,value){var filter=false,filterName="DXImageTransform.Microsoft.Alpha";try{filter=el.filters.item(filterName)}catch(e){if(value===1){return}}value=Math.round(value*100);if(filter){filter.Enabled=value!==100;filter.Opacity=value}else{el.style.filter+=" progid:"+filterName+"(opacity="+value+")"}}function testProp(props){var style=document.documentElement.style;for(var i=0;i<props.length;i++){if(props[i]in style){return props[i]}}return false}function setTransform(el,offset,scale){var pos=offset||new Point(0,0);el.style[TRANSFORM]=(ie3d?"translate("+pos.x+"px,"+pos.y+"px)":"translate3d("+pos.x+"px,"+pos.y+"px,0)")+(scale?" scale("+scale+")":"")}function setPosition(el,point){el._leaflet_pos=point;if(any3d){setTransform(el,point)}else{el.style.left=point.x+"px";el.style.top=point.y+"px"}}function getPosition(el){return el._leaflet_pos||new Point(0,0)}var disableTextSelection;var enableTextSelection;var _userSelect;if("onselectstart"in document){disableTextSelection=function(){on(window,"selectstart",preventDefault)};enableTextSelection=function(){off(window,"selectstart",preventDefault)}}else{var userSelectProperty=testProp(["userSelect","WebkitUserSelect","OUserSelect","MozUserSelect","msUserSelect"]);disableTextSelection=function(){if(userSelectProperty){var style=document.documentElement.style;_userSelect=style[userSelectProperty];style[userSelectProperty]="none"}};enableTextSelection=function(){if(userSelectProperty){document.documentElement.style[userSelectProperty]=_userSelect;_userSelect=undefined}}}function disableImageDrag(){on(window,"dragstart",preventDefault)}function enableImageDrag(){off(window,"dragstart",preventDefault)}var _outlineElement;var _outlineStyle;function preventOutline(element){while(element.tabIndex===-1){element=element.parentNode}if(!element.style){return}restoreOutline();_outlineElement=element;_outlineStyle=element.style.outline;element.style.outline="none";on(window,"keydown",restoreOutline)}function restoreOutline(){if(!_outlineElement){return}_outlineElement.style.outline=_outlineStyle;_outlineElement=undefined;_outlineStyle=undefined;off(window,"keydown",restoreOutline)}function getSizedParentNode(element){do{element=element.parentNode}while((!element.offsetWidth||!element.offsetHeight)&&element!==document.body);return element}function getScale(element){var rect=element.getBoundingClientRect();return{x:rect.width/element.offsetWidth||1,y:rect.height/element.offsetHeight||1,boundingClientRect:rect}}var DomUtil=(Object.freeze||Object)({TRANSFORM:TRANSFORM,TRANSITION:TRANSITION,TRANSITION_END:TRANSITION_END,get:get,getStyle:getStyle,create:create$1,remove:remove,empty:empty,toFront:toFront,toBack:toBack,hasClass:hasClass,addClass:addClass,removeClass:removeClass,setClass:setClass,getClass:getClass,
setOpacity:setOpacity,testProp:testProp,setTransform:setTransform,setPosition:setPosition,getPosition:getPosition,disableTextSelection:disableTextSelection,enableTextSelection:enableTextSelection,disableImageDrag:disableImageDrag,enableImageDrag:enableImageDrag,preventOutline:preventOutline,restoreOutline:restoreOutline,getSizedParentNode:getSizedParentNode,getScale:getScale});function on(obj,types,fn,context){if(typeof types==="object"){for(var type in types){addOne(obj,type,types[type],fn)}}else{types=splitWords(types);for(var i=0,len=types.length;i<len;i++){addOne(obj,types[i],fn,context)}}return this}var eventsKey="_leaflet_events";function off(obj,types,fn,context){if(typeof types==="object"){for(var type in types){removeOne(obj,type,types[type],fn)}}else if(types){types=splitWords(types);for(var i=0,len=types.length;i<len;i++){removeOne(obj,types[i],fn,context)}}else{for(var j in obj[eventsKey]){removeOne(obj,j,obj[eventsKey][j])}delete obj[eventsKey]}return this}function addOne(obj,type,fn,context){var id=type+stamp(fn)+(context?"_"+stamp(context):"");if(obj[eventsKey]&&obj[eventsKey][id]){return this}var handler=function(e){return fn.call(context||obj,e||window.event)};var originalHandler=handler;if(pointer&&type.indexOf("touch")===0){addPointerListener(obj,type,handler,id)}else if(touch&&type==="dblclick"&&addDoubleTapListener&&!(pointer&&chrome)){addDoubleTapListener(obj,handler,id)}else if("addEventListener"in obj){if(type==="mousewheel"){obj.addEventListener("onwheel"in obj?"wheel":"mousewheel",handler,passiveEvents?{passive:false}:false)}else if(type==="mouseenter"||type==="mouseleave"){handler=function(e){e=e||window.event;if(isExternalTarget(obj,e)){originalHandler(e)}};obj.addEventListener(type==="mouseenter"?"mouseover":"mouseout",handler,false)}else{if(type==="click"&&android){handler=function(e){filterClick(e,originalHandler)}}obj.addEventListener(type,handler,false)}}else if("attachEvent"in obj){obj.attachEvent("on"+type,handler)}obj[eventsKey]=obj[eventsKey]||{};obj[eventsKey][id]=handler}function removeOne(obj,type,fn,context){var id=type+stamp(fn)+(context?"_"+stamp(context):""),handler=obj[eventsKey]&&obj[eventsKey][id];if(!handler){return this}if(pointer&&type.indexOf("touch")===0){removePointerListener(obj,type,id)}else if(touch&&type==="dblclick"&&removeDoubleTapListener&&!(pointer&&chrome)){removeDoubleTapListener(obj,id)}else if("removeEventListener"in obj){if(type==="mousewheel"){obj.removeEventListener("onwheel"in obj?"wheel":"mousewheel",handler,passiveEvents?{passive:false}:false)}else{obj.removeEventListener(type==="mouseenter"?"mouseover":type==="mouseleave"?"mouseout":type,handler,false)}}else if("detachEvent"in obj){obj.detachEvent("on"+type,handler)}obj[eventsKey][id]=null}function stopPropagation(e){if(e.stopPropagation){e.stopPropagation()}else if(e.originalEvent){e.originalEvent._stopped=true}else{e.cancelBubble=true}skipped(e);return this}function disableScrollPropagation(el){addOne(el,"mousewheel",stopPropagation);return this}function disableClickPropagation(el){on(el,"mousedown touchstart dblclick",stopPropagation);addOne(el,"click",fakeStop);return this}function preventDefault(e){if(e.preventDefault){e.preventDefault()}else{e.returnValue=false}return this}function stop(e){preventDefault(e);stopPropagation(e);return this}function getMousePosition(e,container){if(!container){return new Point(e.clientX,e.clientY)}var scale=getScale(container),offset=scale.boundingClientRect;return new Point((e.clientX-offset.left)/scale.x-container.clientLeft,(e.clientY-offset.top)/scale.y-container.clientTop)}var wheelPxFactor=win&&chrome?2*window.devicePixelRatio:gecko?window.devicePixelRatio:1;function getWheelDelta(e){return edge?e.wheelDeltaY/2:e.deltaY&&e.deltaMode===0?-e.deltaY/wheelPxFactor:e.deltaY&&e.deltaMode===1?-e.deltaY*20:e.deltaY&&e.deltaMode===2?-e.deltaY*60:e.deltaX||e.deltaZ?0:e.wheelDelta?(e.wheelDeltaY||e.wheelDelta)/2:e.detail&&Math.abs(e.detail)<32765?-e.detail*20:e.detail?e.detail/-32765*60:0}var skipEvents={};function fakeStop(e){skipEvents[e.type]=true}function skipped(e){var events=skipEvents[e.type];skipEvents[e.type]=false;return events}function isExternalTarget(el,e){var related=e.relatedTarget;if(!related){return true}try{while(related&&related!==el){related=related.parentNode}}catch(err){return false}return related!==el}var lastClick;function filterClick(e,handler){var timeStamp=e.timeStamp||e.originalEvent&&e.originalEvent.timeStamp,elapsed=lastClick&&timeStamp-lastClick;if(elapsed&&elapsed>100&&elapsed<500||e.target._simulatedClick&&!e._simulated){stop(e);return}lastClick=timeStamp;handler(e)}var DomEvent=(Object.freeze||Object)({on:on,off:off,stopPropagation:stopPropagation,disableScrollPropagation:disableScrollPropagation,disableClickPropagation:disableClickPropagation,preventDefault:preventDefault,stop:stop,getMousePosition:getMousePosition,getWheelDelta:getWheelDelta,fakeStop:fakeStop,skipped:skipped,isExternalTarget:isExternalTarget,addListener:on,removeListener:off});var PosAnimation=Evented.extend({run:function(el,newPos,duration,easeLinearity){this.stop();this._el=el;this._inProgress=true;this._duration=duration||.25;this._easeOutPower=1/Math.max(easeLinearity||.5,.2);this._startPos=getPosition(el);this._offset=newPos.subtract(this._startPos);this._startTime=+new Date;this.fire("start");this._animate()},stop:function(){if(!this._inProgress){return}this._step(true);this._complete()},_animate:function(){this._animId=requestAnimFrame(this._animate,this);this._step()},_step:function(round){var elapsed=+new Date-this._startTime,duration=this._duration*1e3;if(elapsed<duration){this._runFrame(this._easeOut(elapsed/duration),round)}else{this._runFrame(1);this._complete()}},_runFrame:function(progress,round){var pos=this._startPos.add(this._offset.multiplyBy(progress));if(round){pos._round()}setPosition(this._el,pos);this.fire("step")},_complete:function(){cancelAnimFrame(this._animId);this._inProgress=false;this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}});var Map=Evented.extend({options:{crs:EPSG3857,center:undefined,zoom:undefined,minZoom:undefined,maxZoom:undefined,layers:[],maxBounds:undefined,renderer:undefined,zoomAnimation:true,zoomAnimationThreshold:4,fadeAnimation:true,markerZoomAnimation:true,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:true},initialize:function(id,options){options=setOptions(this,options);this._handlers=[];this._layers={};this._zoomBoundLayers={};this._sizeChanged=true;this._initContainer(id);this._initLayout();this._onResize=bind(this._onResize,this);this._initEvents();if(options.maxBounds){this.setMaxBounds(options.maxBounds)}if(options.zoom!==undefined){this._zoom=this._limitZoom(options.zoom)}if(options.center&&options.zoom!==undefined){this.setView(toLatLng(options.center),options.zoom,{reset:true})}this.callInitHooks();this._zoomAnimated=TRANSITION&&any3d&&!mobileOpera&&this.options.zoomAnimation;if(this._zoomAnimated){this._createAnimProxy();on(this._proxy,TRANSITION_END,this._catchTransitionEnd,this)}this._addLayers(this.options.layers)},setView:function(center,zoom,options){zoom=zoom===undefined?this._zoom:this._limitZoom(zoom);center=this._limitCenter(toLatLng(center),zoom,this.options.maxBounds);options=options||{};this._stop();if(this._loaded&&!options.reset&&options!==true){if(options.animate!==undefined){options.zoom=extend({animate:options.animate},options.zoom);options.pan=extend({animate:options.animate,duration:options.duration},options.pan)}var moved=this._zoom!==zoom?this._tryAnimatedZoom&&this._tryAnimatedZoom(center,zoom,options.zoom):this._tryAnimatedPan(center,options.pan);if(moved){clearTimeout(this._sizeTimer);return this}}this._resetView(center,zoom);return this},setZoom:function(zoom,options){if(!this._loaded){this._zoom=zoom;return this}return this.setView(this.getCenter(),zoom,{zoom:options})},zoomIn:function(delta,options){delta=delta||(any3d?this.options.zoomDelta:1);return this.setZoom(this._zoom+delta,options)},zoomOut:function(delta,options){delta=delta||(any3d?this.options.zoomDelta:1);return this.setZoom(this._zoom-delta,options)},setZoomAround:function(latlng,zoom,options){var scale=this.getZoomScale(zoom),viewHalf=this.getSize().divideBy(2),containerPoint=latlng instanceof Point?latlng:this.latLngToContainerPoint(latlng),centerOffset=containerPoint.subtract(viewHalf).multiplyBy(1-1/scale),newCenter=this.containerPointToLatLng(viewHalf.add(centerOffset));return this.setView(newCenter,zoom,{zoom:options})},_getBoundsCenterZoom:function(bounds,options){options=options||{};bounds=bounds.getBounds?bounds.getBounds():toLatLngBounds(bounds);var paddingTL=toPoint(options.paddingTopLeft||options.padding||[0,0]),paddingBR=toPoint(options.paddingBottomRight||options.padding||[0,0]),zoom=this.getBoundsZoom(bounds,false,paddingTL.add(paddingBR));zoom=typeof options.maxZoom==="number"?Math.min(options.maxZoom,zoom):zoom;if(zoom===Infinity){return{center:bounds.getCenter(),zoom:zoom}}var paddingOffset=paddingBR.subtract(paddingTL).divideBy(2),swPoint=this.project(bounds.getSouthWest(),zoom),nePoint=this.project(bounds.getNorthEast(),zoom),center=this.unproject(swPoint.add(nePoint).divideBy(2).add(paddingOffset),zoom);return{center:center,zoom:zoom}},fitBounds:function(bounds,options){bounds=toLatLngBounds(bounds);if(!bounds.isValid()){throw new Error("Bounds are not valid.")}var target=this._getBoundsCenterZoom(bounds,options);return this.setView(target.center,target.zoom,options)},fitWorld:function(options){return this.fitBounds([[-90,-180],[90,180]],options)},panTo:function(center,options){return this.setView(center,this._zoom,{pan:options})},panBy:function(offset,options){offset=toPoint(offset).round();options=options||{};if(!offset.x&&!offset.y){return this.fire("moveend")}if(options.animate!==true&&!this.getSize().contains(offset)){this._resetView(this.unproject(this.project(this.getCenter()).add(offset)),this.getZoom());return this}if(!this._panAnim){this._panAnim=new PosAnimation;this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)}if(!options.noMoveStart){this.fire("movestart")}if(options.animate!==false){addClass(this._mapPane,"leaflet-pan-anim");var newPos=this._getMapPanePos().subtract(offset).round();this._panAnim.run(this._mapPane,newPos,options.duration||.25,options.easeLinearity)}else{this._rawPanBy(offset);this.fire("move").fire("moveend")}return this},flyTo:function(targetCenter,targetZoom,options){options=options||{};if(options.animate===false||!any3d){return this.setView(targetCenter,targetZoom,options)}this._stop();var from=this.project(this.getCenter()),to=this.project(targetCenter),size=this.getSize(),startZoom=this._zoom;targetCenter=toLatLng(targetCenter);targetZoom=targetZoom===undefined?startZoom:targetZoom;var w0=Math.max(size.x,size.y),w1=w0*this.getZoomScale(startZoom,targetZoom),u1=to.distanceTo(from)||1,rho=1.42,rho2=rho*rho;function r(i){var s1=i?-1:1,s2=i?w1:w0,t1=w1*w1-w0*w0+s1*rho2*rho2*u1*u1,b1=2*s2*rho2*u1,b=t1/b1,sq=Math.sqrt(b*b+1)-b;var log=sq<1e-9?-18:Math.log(sq);return log}function sinh(n){return(Math.exp(n)-Math.exp(-n))/2}function cosh(n){return(Math.exp(n)+Math.exp(-n))/2}function tanh(n){return sinh(n)/cosh(n)}var r0=r(0);function w(s){return w0*(cosh(r0)/cosh(r0+rho*s))}function u(s){return w0*(cosh(r0)*tanh(r0+rho*s)-sinh(r0))/rho2}function easeOut(t){return 1-Math.pow(1-t,1.5)}var start=Date.now(),S=(r(1)-r0)/rho,duration=options.duration?1e3*options.duration:1e3*S*.8;function frame(){var t=(Date.now()-start)/duration,s=easeOut(t)*S;if(t<=1){this._flyToFrame=requestAnimFrame(frame,this);this._move(this.unproject(from.add(to.subtract(from).multiplyBy(u(s)/u1)),startZoom),this.getScaleZoom(w0/w(s),startZoom),{flyTo:true})}else{this._move(targetCenter,targetZoom)._moveEnd(true)}}this._moveStart(true,options.noMoveStart);frame.call(this);return this},flyToBounds:function(bounds,options){var target=this._getBoundsCenterZoom(bounds,options);return this.flyTo(target.center,target.zoom,options)},setMaxBounds:function(bounds){bounds=toLatLngBounds(bounds);if(!bounds.isValid()){this.options.maxBounds=null;return this.off("moveend",this._panInsideMaxBounds)}else if(this.options.maxBounds){this.off("moveend",this._panInsideMaxBounds)}this.options.maxBounds=bounds;if(this._loaded){this._panInsideMaxBounds()}return this.on("moveend",this._panInsideMaxBounds)},setMinZoom:function(zoom){var oldZoom=this.options.minZoom;this.options.minZoom=zoom;if(this._loaded&&oldZoom!==zoom){this.fire("zoomlevelschange");if(this.getZoom()<this.options.minZoom){return this.setZoom(zoom)}}return this},setMaxZoom:function(zoom){var oldZoom=this.options.maxZoom;this.options.maxZoom=zoom;if(this._loaded&&oldZoom!==zoom){this.fire("zoomlevelschange");if(this.getZoom()>this.options.maxZoom){return this.setZoom(zoom)}}return this},panInsideBounds:function(bounds,options){this._enforcingBounds=true;var center=this.getCenter(),newCenter=this._limitCenter(center,this._zoom,toLatLngBounds(bounds));if(!center.equals(newCenter)){this.panTo(newCenter,options)}this._enforcingBounds=false;return this},panInside:function(latlng,options){options=options||{};var paddingTL=toPoint(options.paddingTopLeft||options.padding||[0,0]),paddingBR=toPoint(options.paddingBottomRight||options.padding||[0,0]),center=this.getCenter(),pixelCenter=this.project(center),pixelPoint=this.project(latlng),pixelBounds=this.getPixelBounds(),halfPixelBounds=pixelBounds.getSize().divideBy(2),paddedBounds=toBounds([pixelBounds.min.add(paddingTL),pixelBounds.max.subtract(paddingBR)]);if(!paddedBounds.contains(pixelPoint)){this._enforcingBounds=true;var diff=pixelCenter.subtract(pixelPoint),newCenter=toPoint(pixelPoint.x+diff.x,pixelPoint.y+diff.y);if(pixelPoint.x<paddedBounds.min.x||pixelPoint.x>paddedBounds.max.x){newCenter.x=pixelCenter.x-diff.x;if(diff.x>0){newCenter.x+=halfPixelBounds.x-paddingTL.x}else{newCenter.x-=halfPixelBounds.x-paddingBR.x}}if(pixelPoint.y<paddedBounds.min.y||pixelPoint.y>paddedBounds.max.y){newCenter.y=pixelCenter.y-diff.y;if(diff.y>0){newCenter.y+=halfPixelBounds.y-paddingTL.y}else{newCenter.y-=halfPixelBounds.y-paddingBR.y}}this.panTo(this.unproject(newCenter),options);this._enforcingBounds=false}return this},invalidateSize:function(options){if(!this._loaded){return this}options=extend({animate:false,pan:true},options===true?{animate:true}:options);var oldSize=this.getSize();this._sizeChanged=true;this._lastCenter=null;var newSize=this.getSize(),oldCenter=oldSize.divideBy(2).round(),newCenter=newSize.divideBy(2).round(),offset=oldCenter.subtract(newCenter);if(!offset.x&&!offset.y){return this}if(options.animate&&options.pan){this.panBy(offset)}else{if(options.pan){this._rawPanBy(offset)}this.fire("move");if(options.debounceMoveend){clearTimeout(this._sizeTimer);this._sizeTimer=setTimeout(bind(this.fire,this,"moveend"),200)}else{this.fire("moveend")}}return this.fire("resize",{oldSize:oldSize,newSize:newSize})},stop:function(){this.setZoom(this._limitZoom(this._zoom));if(!this.options.zoomSnap){this.fire("viewreset")}return this._stop()},locate:function(options){options=this._locateOptions=extend({timeout:1e4,watch:false},options);if(!("geolocation"in navigator)){this._handleGeolocationError({code:0,message:"Geolocation not supported."});return this}var onResponse=bind(this._handleGeolocationResponse,this),onError=bind(this._handleGeolocationError,this);if(options.watch){this._locationWatchId=navigator.geolocation.watchPosition(onResponse,onError,options)}else{navigator.geolocation.getCurrentPosition(onResponse,onError,options)}return this},stopLocate:function(){if(navigator.geolocation&&navigator.geolocation.clearWatch){navigator.geolocation.clearWatch(this._locationWatchId)}if(this._locateOptions){this._locateOptions.setView=false}return this},_handleGeolocationError:function(error){var c=error.code,message=error.message||(c===1?"permission denied":c===2?"position unavailable":"timeout");if(this._locateOptions.setView&&!this._loaded){this.fitWorld()}this.fire("locationerror",{code:c,message:"Geolocation error: "+message+"."})},_handleGeolocationResponse:function(pos){var lat=pos.coords.latitude,lng=pos.coords.longitude,latlng=new LatLng(lat,lng),bounds=latlng.toBounds(pos.coords.accuracy*2),options=this._locateOptions;if(options.setView){var zoom=this.getBoundsZoom(bounds);this.setView(latlng,options.maxZoom?Math.min(zoom,options.maxZoom):zoom)}var data={latlng:latlng,bounds:bounds,timestamp:pos.timestamp};for(var i in pos.coords){if(typeof pos.coords[i]==="number"){data[i]=pos.coords[i]}}this.fire("locationfound",data)},addHandler:function(name,HandlerClass){if(!HandlerClass){return this}var handler=this[name]=new HandlerClass(this);this._handlers.push(handler);if(this.options[name]){handler.enable()}return this},remove:function(){this._initEvents(true);if(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(e){this._container._leaflet_id=undefined;this._containerId=undefined}if(this._locationWatchId!==undefined){this.stopLocate()}this._stop();remove(this._mapPane);if(this._clearControlPos){this._clearControlPos()}if(this._resizeRequest){cancelAnimFrame(this._resizeRequest);this._resizeRequest=null}this._clearHandlers();if(this._loaded){this.fire("unload")}var i;for(i in this._layers){this._layers[i].remove()}for(i in this._panes){remove(this._panes[i])}this._layers=[];this._panes=[];delete this._mapPane;delete this._renderer;return this},createPane:function(name,container){var className="leaflet-pane"+(name?" leaflet-"+name.replace("Pane","")+"-pane":""),pane=create$1("div",className,container||this._mapPane);if(name){this._panes[name]=pane}return pane},getCenter:function(){this._checkIfLoaded();if(this._lastCenter&&!this._moved()){return this._lastCenter}return this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var bounds=this.getPixelBounds(),sw=this.unproject(bounds.getBottomLeft()),ne=this.unproject(bounds.getTopRight());return new LatLngBounds(sw,ne)},getMinZoom:function(){return this.options.minZoom===undefined?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===undefined?this._layersMaxZoom===undefined?Infinity:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(bounds,inside,padding){bounds=toLatLngBounds(bounds);padding=toPoint(padding||[0,0]);var zoom=this.getZoom()||0,min=this.getMinZoom(),max=this.getMaxZoom(),nw=bounds.getNorthWest(),se=bounds.getSouthEast(),size=this.getSize().subtract(padding),boundsSize=toBounds(this.project(se,zoom),this.project(nw,zoom)).getSize(),snap=any3d?this.options.zoomSnap:1,scalex=size.x/boundsSize.x,scaley=size.y/boundsSize.y,scale=inside?Math.max(scalex,scaley):Math.min(scalex,scaley);zoom=this.getScaleZoom(scale,zoom);if(snap){zoom=Math.round(zoom/(snap/100))*(snap/100);zoom=inside?Math.ceil(zoom/snap)*snap:Math.floor(zoom/snap)*snap}return Math.max(min,Math.min(max,zoom))},getSize:function(){if(!this._size||this._sizeChanged){this._size=new Point(this._container.clientWidth||0,this._container.clientHeight||0);this._sizeChanged=false}return this._size.clone()},getPixelBounds:function(center,zoom){var topLeftPoint=this._getTopLeftPoint(center,zoom);return new Bounds(topLeftPoint,topLeftPoint.add(this.getSize()))},getPixelOrigin:function(){this._checkIfLoaded();return this._pixelOrigin},getPixelWorldBounds:function(zoom){return this.options.crs.getProjectedBounds(zoom===undefined?this.getZoom():zoom)},getPane:function(pane){return typeof pane==="string"?this._panes[pane]:pane},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(toZoom,fromZoom){var crs=this.options.crs;fromZoom=fromZoom===undefined?this._zoom:fromZoom;return crs.scale(toZoom)/crs.scale(fromZoom)},getScaleZoom:function(scale,fromZoom){var crs=this.options.crs;fromZoom=fromZoom===undefined?this._zoom:fromZoom;var zoom=crs.zoom(scale*crs.scale(fromZoom));return isNaN(zoom)?Infinity:zoom},project:function(latlng,zoom){zoom=zoom===undefined?this._zoom:zoom;return this.options.crs.latLngToPoint(toLatLng(latlng),zoom)},unproject:function(point,zoom){zoom=zoom===undefined?this._zoom:zoom;return this.options.crs.pointToLatLng(toPoint(point),zoom)},layerPointToLatLng:function(point){var projectedPoint=toPoint(point).add(this.getPixelOrigin());return this.unproject(projectedPoint)},latLngToLayerPoint:function(latlng){var projectedPoint=this.project(toLatLng(latlng))._round();return projectedPoint._subtract(this.getPixelOrigin())},wrapLatLng:function(latlng){return this.options.crs.wrapLatLng(toLatLng(latlng))},wrapLatLngBounds:function(latlng){return this.options.crs.wrapLatLngBounds(toLatLngBounds(latlng))},distance:function(latlng1,latlng2){return this.options.crs.distance(toLatLng(latlng1),toLatLng(latlng2))},containerPointToLayerPoint:function(point){return toPoint(point).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(point){return toPoint(point).add(this._getMapPanePos())},containerPointToLatLng:function(point){var layerPoint=this.containerPointToLayerPoint(toPoint(point));return this.layerPointToLatLng(layerPoint)},latLngToContainerPoint:function(latlng){return this.layerPointToContainerPoint(this.latLngToLayerPoint(toLatLng(latlng)))},mouseEventToContainerPoint:function(e){return getMousePosition(e,this._container)},mouseEventToLayerPoint:function(e){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e))},mouseEventToLatLng:function(e){return this.layerPointToLatLng(this.mouseEventToLayerPoint(e))},_initContainer:function(id){var container=this._container=get(id);if(!container){throw new Error("Map container not found.")}else if(container._leaflet_id){throw new Error("Map container is already initialized.")}on(container,"scroll",this._onScroll,this);this._containerId=stamp(container)},_initLayout:function(){var container=this._container;this._fadeAnimated=this.options.fadeAnimation&&any3d;addClass(container,"leaflet-container"+(touch?" leaflet-touch":"")+(retina?" leaflet-retina":"")+(ielt9?" leaflet-oldie":"")+(safari?" leaflet-safari":"")+(this._fadeAnimated?" leaflet-fade-anim":""));var position=getStyle(container,"position");if(position!=="absolute"&&position!=="relative"&&position!=="fixed"){container.style.position="relative"}this._initPanes();if(this._initControlPos){this._initControlPos()}},_initPanes:function(){var panes=this._panes={};this._paneRenderers={};this._mapPane=this.createPane("mapPane",this._container);setPosition(this._mapPane,new Point(0,0));this.createPane("tilePane");this.createPane("shadowPane");this.createPane("overlayPane");this.createPane("markerPane");this.createPane("tooltipPane");this.createPane("popupPane");if(!this.options.markerZoomAnimation){addClass(panes.markerPane,"leaflet-zoom-hide");addClass(panes.shadowPane,"leaflet-zoom-hide")}},_resetView:function(center,zoom){setPosition(this._mapPane,new Point(0,0));var loading=!this._loaded;this._loaded=true;zoom=this._limitZoom(zoom);this.fire("viewprereset");var zoomChanged=this._zoom!==zoom;this._moveStart(zoomChanged,false)._move(center,zoom)._moveEnd(zoomChanged);this.fire("viewreset");if(loading){this.fire("load")}},_moveStart:function(zoomChanged,noMoveStart){if(zoomChanged){this.fire("zoomstart")}if(!noMoveStart){this.fire("movestart")}return this},_move:function(center,zoom,data){if(zoom===undefined){zoom=this._zoom}var zoomChanged=this._zoom!==zoom;this._zoom=zoom;this._lastCenter=center;this._pixelOrigin=this._getNewPixelOrigin(center);if(zoomChanged||data&&data.pinch){this.fire("zoom",data)}return this.fire("move",data)},_moveEnd:function(zoomChanged){if(zoomChanged){this.fire("zoomend")}return this.fire("moveend")},_stop:function(){cancelAnimFrame(this._flyToFrame);if(this._panAnim){this._panAnim.stop()}return this},_rawPanBy:function(offset){setPosition(this._mapPane,this._getMapPanePos().subtract(offset))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){if(!this._enforcingBounds){this.panInsideBounds(this.options.maxBounds)}},_checkIfLoaded:function(){if(!this._loaded){throw new Error("Set map center and zoom first.")}},_initEvents:function(remove$$1){this._targets={};this._targets[stamp(this._container)]=this;var onOff=remove$$1?off:on;onOff(this._container,"click dblclick mousedown mouseup "+"mouseover mouseout mousemove contextmenu keypress keydown keyup",this._handleDOMEvent,this);if(this.options.trackResize){onOff(window,"resize",this._onResize,this)}if(any3d&&this.options.transform3DLimit){(remove$$1?this.off:this.on).call(this,"moveend",this._onMoveEnd)}},_onResize:function(){cancelAnimFrame(this._resizeRequest);this._resizeRequest=requestAnimFrame(function(){this.invalidateSize({debounceMoveend:true})},this)},_onScroll:function(){this._container.scrollTop=0;this._container.scrollLeft=0},_onMoveEnd:function(){var pos=this._getMapPanePos();if(Math.max(Math.abs(pos.x),Math.abs(pos.y))>=this.options.transform3DLimit){this._resetView(this.getCenter(),this.getZoom())}},_findEventTargets:function(e,type){var targets=[],target,isHover=type==="mouseout"||type==="mouseover",src=e.target||e.srcElement,dragging=false;while(src){target=this._targets[stamp(src)];if(target&&(type==="click"||type==="preclick")&&!e._simulated&&this._draggableMoved(target)){dragging=true;break}if(target&&target.listens(type,true)){if(isHover&&!isExternalTarget(src,e)){break}targets.push(target);if(isHover){break}}if(src===this._container){break}src=src.parentNode}if(!targets.length&&!dragging&&!isHover&&isExternalTarget(src,e)){targets=[this]}return targets},_handleDOMEvent:function(e){if(!this._loaded||skipped(e)){return}var type=e.type;if(type==="mousedown"||type==="keypress"||type==="keyup"||type==="keydown"){preventOutline(e.target||e.srcElement)}this._fireDOMEvent(e,type)},_mouseEvents:["click","dblclick","mouseover","mouseout","contextmenu"],_fireDOMEvent:function(e,type,targets){if(e.type==="click"){var synth=extend({},e);synth.type="preclick";this._fireDOMEvent(synth,synth.type,targets)}if(e._stopped){return}targets=(targets||[]).concat(this._findEventTargets(e,type));if(!targets.length){return}var target=targets[0];if(type==="contextmenu"&&target.listens(type,true)){preventDefault(e)}var data={originalEvent:e};if(e.type!=="keypress"&&e.type!=="keydown"&&e.type!=="keyup"){var isMarker=target.getLatLng&&(!target._radius||target._radius<=10);data.containerPoint=isMarker?this.latLngToContainerPoint(target.getLatLng()):this.mouseEventToContainerPoint(e);data.layerPoint=this.containerPointToLayerPoint(data.containerPoint);data.latlng=isMarker?target.getLatLng():this.layerPointToLatLng(data.layerPoint)}for(var i=0;i<targets.length;i++){targets[i].fire(type,data,true);if(data.originalEvent._stopped||targets[i].options.bubblingMouseEvents===false&&indexOf(this._mouseEvents,type)!==-1){return}}},_draggableMoved:function(obj){obj=obj.dragging&&obj.dragging.enabled()?obj:this;return obj.dragging&&obj.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var i=0,len=this._handlers.length;i<len;i++){this._handlers[i].disable()}},whenReady:function(callback,context){if(this._loaded){callback.call(context||this,{target:this})}else{this.on("load",callback,context)}return this},_getMapPanePos:function(){return getPosition(this._mapPane)||new Point(0,0)},_moved:function(){var pos=this._getMapPanePos();return pos&&!pos.equals([0,0])},_getTopLeftPoint:function(center,zoom){var pixelOrigin=center&&zoom!==undefined?this._getNewPixelOrigin(center,zoom):this.getPixelOrigin();return pixelOrigin.subtract(this._getMapPanePos())},_getNewPixelOrigin:function(center,zoom){var viewHalf=this.getSize()._divideBy(2);return this.project(center,zoom)._subtract(viewHalf)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(latlng,zoom,center){var topLeft=this._getNewPixelOrigin(center,zoom);return this.project(latlng,zoom)._subtract(topLeft)},_latLngBoundsToNewLayerBounds:function(latLngBounds,zoom,center){var topLeft=this._getNewPixelOrigin(center,zoom);return toBounds([this.project(latLngBounds.getSouthWest(),zoom)._subtract(topLeft),this.project(latLngBounds.getNorthWest(),zoom)._subtract(topLeft),this.project(latLngBounds.getSouthEast(),zoom)._subtract(topLeft),this.project(latLngBounds.getNorthEast(),zoom)._subtract(topLeft)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(latlng){return this.latLngToLayerPoint(latlng).subtract(this._getCenterLayerPoint())},_limitCenter:function(center,zoom,bounds){if(!bounds){return center}var centerPoint=this.project(center,zoom),viewHalf=this.getSize().divideBy(2),viewBounds=new Bounds(centerPoint.subtract(viewHalf),centerPoint.add(viewHalf)),offset=this._getBoundsOffset(viewBounds,bounds,zoom);if(offset.round().equals([0,0])){return center}return this.unproject(centerPoint.add(offset),zoom)},_limitOffset:function(offset,bounds){if(!bounds){return offset}var viewBounds=this.getPixelBounds(),newBounds=new Bounds(viewBounds.min.add(offset),viewBounds.max.add(offset));return offset.add(this._getBoundsOffset(newBounds,bounds))},_getBoundsOffset:function(pxBounds,maxBounds,zoom){var projectedMaxBounds=toBounds(this.project(maxBounds.getNorthEast(),zoom),this.project(maxBounds.getSouthWest(),zoom)),minOffset=projectedMaxBounds.min.subtract(pxBounds.min),maxOffset=projectedMaxBounds.max.subtract(pxBounds.max),dx=this._rebound(minOffset.x,-maxOffset.x),dy=this._rebound(minOffset.y,-maxOffset.y);return new Point(dx,dy)},_rebound:function(left,right){return left+right>0?Math.round(left-right)/2:Math.max(0,Math.ceil(left))-Math.max(0,Math.floor(right))},_limitZoom:function(zoom){var min=this.getMinZoom(),max=this.getMaxZoom(),snap=any3d?this.options.zoomSnap:1;if(snap){zoom=Math.round(zoom/snap)*snap}return Math.max(min,Math.min(max,zoom))},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){removeClass(this._mapPane,"leaflet-pan-anim");this.fire("moveend")},_tryAnimatedPan:function(center,options){var offset=this._getCenterOffset(center)._trunc();if((options&&options.animate)!==true&&!this.getSize().contains(offset)){return false}this.panBy(offset,options);return true},_createAnimProxy:function(){var proxy=this._proxy=create$1("div","leaflet-proxy leaflet-zoom-animated");this._panes.mapPane.appendChild(proxy);this.on("zoomanim",function(e){var prop=TRANSFORM,transform=this._proxy.style[prop];setTransform(this._proxy,this.project(e.center,e.zoom),this.getZoomScale(e.zoom,1));if(transform===this._proxy.style[prop]&&this._animatingZoom){this._onZoomTransitionEnd()}},this);this.on("load moveend",this._animMoveEnd,this);this._on("unload",this._destroyAnimProxy,this)},_destroyAnimProxy:function(){remove(this._proxy);this.off("load moveend",this._animMoveEnd,this);delete this._proxy},_animMoveEnd:function(){var c=this.getCenter(),z=this.getZoom();setTransform(this._proxy,this.project(c,z),this.getZoomScale(z,1))},_catchTransitionEnd:function(e){if(this._animatingZoom&&e.propertyName.indexOf("transform")>=0){this._onZoomTransitionEnd()}},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(center,zoom,options){if(this._animatingZoom){return true}options=options||{};if(!this._zoomAnimated||options.animate===false||this._nothingToAnimate()||Math.abs(zoom-this._zoom)>this.options.zoomAnimationThreshold){return false}var scale=this.getZoomScale(zoom),offset=this._getCenterOffset(center)._divideBy(1-1/scale);if(options.animate!==true&&!this.getSize().contains(offset)){return false}requestAnimFrame(function(){this._moveStart(true,false)._animateZoom(center,zoom,true)},this);return true},_animateZoom:function(center,zoom,startAnim,noUpdate){
if(!this._mapPane){return}if(startAnim){this._animatingZoom=true;this._animateToCenter=center;this._animateToZoom=zoom;addClass(this._mapPane,"leaflet-zoom-anim")}this.fire("zoomanim",{center:center,zoom:zoom,noUpdate:noUpdate});setTimeout(bind(this._onZoomTransitionEnd,this),250)},_onZoomTransitionEnd:function(){if(!this._animatingZoom){return}if(this._mapPane){removeClass(this._mapPane,"leaflet-zoom-anim")}this._animatingZoom=false;this._move(this._animateToCenter,this._animateToZoom);requestAnimFrame(function(){this._moveEnd(true)},this)}});function createMap(id,options){return new Map(id,options)}var Control=Class.extend({options:{position:"topright"},initialize:function(options){setOptions(this,options)},getPosition:function(){return this.options.position},setPosition:function(position){var map=this._map;if(map){map.removeControl(this)}this.options.position=position;if(map){map.addControl(this)}return this},getContainer:function(){return this._container},addTo:function(map){this.remove();this._map=map;var container=this._container=this.onAdd(map),pos=this.getPosition(),corner=map._controlCorners[pos];addClass(container,"leaflet-control");if(pos.indexOf("bottom")!==-1){corner.insertBefore(container,corner.firstChild)}else{corner.appendChild(container)}this._map.on("unload",this.remove,this);return this},remove:function(){if(!this._map){return this}remove(this._container);if(this.onRemove){this.onRemove(this._map)}this._map.off("unload",this.remove,this);this._map=null;return this},_refocusOnMap:function(e){if(this._map&&e&&e.screenX>0&&e.screenY>0){this._map.getContainer().focus()}}});var control=function(options){return new Control(options)};Map.include({addControl:function(control){control.addTo(this);return this},removeControl:function(control){control.remove();return this},_initControlPos:function(){var corners=this._controlCorners={},l="leaflet-",container=this._controlContainer=create$1("div",l+"control-container",this._container);function createCorner(vSide,hSide){var className=l+vSide+" "+l+hSide;corners[vSide+hSide]=create$1("div",className,container)}createCorner("top","left");createCorner("top","right");createCorner("bottom","left");createCorner("bottom","right")},_clearControlPos:function(){for(var i in this._controlCorners){remove(this._controlCorners[i])}remove(this._controlContainer);delete this._controlCorners;delete this._controlContainer}});var Layers=Control.extend({options:{collapsed:true,position:"topright",autoZIndex:true,hideSingleBase:false,sortLayers:false,sortFunction:function(layerA,layerB,nameA,nameB){return nameA<nameB?-1:nameB<nameA?1:0}},initialize:function(baseLayers,overlays,options){setOptions(this,options);this._layerControlInputs=[];this._layers=[];this._lastZIndex=0;this._handlingClick=false;for(var i in baseLayers){this._addLayer(baseLayers[i],i)}for(i in overlays){this._addLayer(overlays[i],i,true)}},onAdd:function(map){this._initLayout();this._update();this._map=map;map.on("zoomend",this._checkDisabledLayers,this);for(var i=0;i<this._layers.length;i++){this._layers[i].layer.on("add remove",this._onLayerChange,this)}return this._container},addTo:function(map){Control.prototype.addTo.call(this,map);return this._expandIfNotCollapsed()},onRemove:function(){this._map.off("zoomend",this._checkDisabledLayers,this);for(var i=0;i<this._layers.length;i++){this._layers[i].layer.off("add remove",this._onLayerChange,this)}},addBaseLayer:function(layer,name){this._addLayer(layer,name);return this._map?this._update():this},addOverlay:function(layer,name){this._addLayer(layer,name,true);return this._map?this._update():this},removeLayer:function(layer){layer.off("add remove",this._onLayerChange,this);var obj=this._getLayer(stamp(layer));if(obj){this._layers.splice(this._layers.indexOf(obj),1)}return this._map?this._update():this},expand:function(){addClass(this._container,"leaflet-control-layers-expanded");this._section.style.height=null;var acceptableHeight=this._map.getSize().y-(this._container.offsetTop+50);if(acceptableHeight<this._section.clientHeight){addClass(this._section,"leaflet-control-layers-scrollbar");this._section.style.height=acceptableHeight+"px"}else{removeClass(this._section,"leaflet-control-layers-scrollbar")}this._checkDisabledLayers();return this},collapse:function(){removeClass(this._container,"leaflet-control-layers-expanded");return this},_initLayout:function(){var className="leaflet-control-layers",container=this._container=create$1("div",className),collapsed=this.options.collapsed;container.setAttribute("aria-haspopup",true);disableClickPropagation(container);disableScrollPropagation(container);var section=this._section=create$1("section",className+"-list");if(collapsed){this._map.on("click",this.collapse,this);if(!android){on(container,{mouseenter:this.expand,mouseleave:this.collapse},this)}}var link=this._layersLink=create$1("a",className+"-toggle",container);link.href="#";link.title="Layers";if(touch){on(link,"click",stop);on(link,"click",this.expand,this)}else{on(link,"focus",this.expand,this)}if(!collapsed){this.expand()}this._baseLayersList=create$1("div",className+"-base",section);this._separator=create$1("div",className+"-separator",section);this._overlaysList=create$1("div",className+"-overlays",section);container.appendChild(section)},_getLayer:function(id){for(var i=0;i<this._layers.length;i++){if(this._layers[i]&&stamp(this._layers[i].layer)===id){return this._layers[i]}}},_addLayer:function(layer,name,overlay){if(this._map){layer.on("add remove",this._onLayerChange,this)}this._layers.push({layer:layer,name:name,overlay:overlay});if(this.options.sortLayers){this._layers.sort(bind(function(a,b){return this.options.sortFunction(a.layer,b.layer,a.name,b.name)},this))}if(this.options.autoZIndex&&layer.setZIndex){this._lastZIndex++;layer.setZIndex(this._lastZIndex)}this._expandIfNotCollapsed()},_update:function(){if(!this._container){return this}empty(this._baseLayersList);empty(this._overlaysList);this._layerControlInputs=[];var baseLayersPresent,overlaysPresent,i,obj,baseLayersCount=0;for(i=0;i<this._layers.length;i++){obj=this._layers[i];this._addItem(obj);overlaysPresent=overlaysPresent||obj.overlay;baseLayersPresent=baseLayersPresent||!obj.overlay;baseLayersCount+=!obj.overlay?1:0}if(this.options.hideSingleBase){baseLayersPresent=baseLayersPresent&&baseLayersCount>1;this._baseLayersList.style.display=baseLayersPresent?"":"none"}this._separator.style.display=overlaysPresent&&baseLayersPresent?"":"none";return this},_onLayerChange:function(e){if(!this._handlingClick){this._update()}var obj=this._getLayer(stamp(e.target));var type=obj.overlay?e.type==="add"?"overlayadd":"overlayremove":e.type==="add"?"baselayerchange":null;if(type){this._map.fire(type,obj)}},_createRadioElement:function(name,checked){var radioHtml='<input type="radio" class="leaflet-control-layers-selector" name="'+name+'"'+(checked?' checked="checked"':"")+"/>";var radioFragment=document.createElement("div");radioFragment.innerHTML=radioHtml;return radioFragment.firstChild},_addItem:function(obj){var label=document.createElement("label"),checked=this._map.hasLayer(obj.layer),input;if(obj.overlay){input=document.createElement("input");input.type="checkbox";input.className="leaflet-control-layers-selector";input.defaultChecked=checked}else{input=this._createRadioElement("leaflet-base-layers_"+stamp(this),checked)}this._layerControlInputs.push(input);input.layerId=stamp(obj.layer);on(input,"click",this._onInputClick,this);var name=document.createElement("span");name.innerHTML=" "+obj.name;var holder=document.createElement("div");label.appendChild(holder);holder.appendChild(input);holder.appendChild(name);var container=obj.overlay?this._overlaysList:this._baseLayersList;container.appendChild(label);this._checkDisabledLayers();return label},_onInputClick:function(){var inputs=this._layerControlInputs,input,layer;var addedLayers=[],removedLayers=[];this._handlingClick=true;for(var i=inputs.length-1;i>=0;i--){input=inputs[i];layer=this._getLayer(input.layerId).layer;if(input.checked){addedLayers.push(layer)}else if(!input.checked){removedLayers.push(layer)}}for(i=0;i<removedLayers.length;i++){if(this._map.hasLayer(removedLayers[i])){this._map.removeLayer(removedLayers[i])}}for(i=0;i<addedLayers.length;i++){if(!this._map.hasLayer(addedLayers[i])){this._map.addLayer(addedLayers[i])}}this._handlingClick=false;this._refocusOnMap()},_checkDisabledLayers:function(){var inputs=this._layerControlInputs,input,layer,zoom=this._map.getZoom();for(var i=inputs.length-1;i>=0;i--){input=inputs[i];layer=this._getLayer(input.layerId).layer;input.disabled=layer.options.minZoom!==undefined&&zoom<layer.options.minZoom||layer.options.maxZoom!==undefined&&zoom>layer.options.maxZoom}},_expandIfNotCollapsed:function(){if(this._map&&!this.options.collapsed){this.expand()}return this},_expand:function(){return this.expand()},_collapse:function(){return this.collapse()}});var layers=function(baseLayers,overlays,options){return new Layers(baseLayers,overlays,options)};var Zoom=Control.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"&#x2212;",zoomOutTitle:"Zoom out"},onAdd:function(map){var zoomName="leaflet-control-zoom",container=create$1("div",zoomName+" leaflet-bar"),options=this.options;this._zoomInButton=this._createButton(options.zoomInText,options.zoomInTitle,zoomName+"-in",container,this._zoomIn);this._zoomOutButton=this._createButton(options.zoomOutText,options.zoomOutTitle,zoomName+"-out",container,this._zoomOut);this._updateDisabled();map.on("zoomend zoomlevelschange",this._updateDisabled,this);return container},onRemove:function(map){map.off("zoomend zoomlevelschange",this._updateDisabled,this)},disable:function(){this._disabled=true;this._updateDisabled();return this},enable:function(){this._disabled=false;this._updateDisabled();return this},_zoomIn:function(e){if(!this._disabled&&this._map._zoom<this._map.getMaxZoom()){this._map.zoomIn(this._map.options.zoomDelta*(e.shiftKey?3:1))}},_zoomOut:function(e){if(!this._disabled&&this._map._zoom>this._map.getMinZoom()){this._map.zoomOut(this._map.options.zoomDelta*(e.shiftKey?3:1))}},_createButton:function(html,title,className,container,fn){var link=create$1("a",className,container);link.innerHTML=html;link.href="#";link.title=title;link.setAttribute("role","button");link.setAttribute("aria-label",title);disableClickPropagation(link);on(link,"click",stop);on(link,"click",fn,this);on(link,"click",this._refocusOnMap,this);return link},_updateDisabled:function(){var map=this._map,className="leaflet-disabled";removeClass(this._zoomInButton,className);removeClass(this._zoomOutButton,className);if(this._disabled||map._zoom===map.getMinZoom()){addClass(this._zoomOutButton,className)}if(this._disabled||map._zoom===map.getMaxZoom()){addClass(this._zoomInButton,className)}}});Map.mergeOptions({zoomControl:true});Map.addInitHook(function(){if(this.options.zoomControl){this.zoomControl=new Zoom;this.addControl(this.zoomControl)}});var zoom=function(options){return new Zoom(options)};var Scale=Control.extend({options:{position:"bottomleft",maxWidth:100,metric:true,imperial:true},onAdd:function(map){var className="leaflet-control-scale",container=create$1("div",className),options=this.options;this._addScales(options,className+"-line",container);map.on(options.updateWhenIdle?"moveend":"move",this._update,this);map.whenReady(this._update,this);return container},onRemove:function(map){map.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(options,className,container){if(options.metric){this._mScale=create$1("div",className,container)}if(options.imperial){this._iScale=create$1("div",className,container)}},_update:function(){var map=this._map,y=map.getSize().y/2;var maxMeters=map.distance(map.containerPointToLatLng([0,y]),map.containerPointToLatLng([this.options.maxWidth,y]));this._updateScales(maxMeters)},_updateScales:function(maxMeters){if(this.options.metric&&maxMeters){this._updateMetric(maxMeters)}if(this.options.imperial&&maxMeters){this._updateImperial(maxMeters)}},_updateMetric:function(maxMeters){var meters=this._getRoundNum(maxMeters),label=meters<1e3?meters+" m":meters/1e3+" km";this._updateScale(this._mScale,label,meters/maxMeters)},_updateImperial:function(maxMeters){var maxFeet=maxMeters*3.2808399,maxMiles,miles,feet;if(maxFeet>5280){maxMiles=maxFeet/5280;miles=this._getRoundNum(maxMiles);this._updateScale(this._iScale,miles+" mi",miles/maxMiles)}else{feet=this._getRoundNum(maxFeet);this._updateScale(this._iScale,feet+" ft",feet/maxFeet)}},_updateScale:function(scale,text,ratio){scale.style.width=Math.round(this.options.maxWidth*ratio)+"px";scale.innerHTML=text},_getRoundNum:function(num){var pow10=Math.pow(10,(Math.floor(num)+"").length-1),d=num/pow10;d=d>=10?10:d>=5?5:d>=3?3:d>=2?2:1;return pow10*d}});var scale=function(options){return new Scale(options)};var Attribution=Control.extend({options:{position:"bottomright",prefix:'<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'},initialize:function(options){setOptions(this,options);this._attributions={}},onAdd:function(map){map.attributionControl=this;this._container=create$1("div","leaflet-control-attribution");disableClickPropagation(this._container);for(var i in map._layers){if(map._layers[i].getAttribution){this.addAttribution(map._layers[i].getAttribution())}}this._update();return this._container},setPrefix:function(prefix){this.options.prefix=prefix;this._update();return this},addAttribution:function(text){if(!text){return this}if(!this._attributions[text]){this._attributions[text]=0}this._attributions[text]++;this._update();return this},removeAttribution:function(text){if(!text){return this}if(this._attributions[text]){this._attributions[text]--;this._update()}return this},_update:function(){if(!this._map){return}var attribs=[];for(var i in this._attributions){if(this._attributions[i]){attribs.push(i)}}var prefixAndAttribs=[];if(this.options.prefix){prefixAndAttribs.push(this.options.prefix)}if(attribs.length){prefixAndAttribs.push(attribs.join(", "))}this._container.innerHTML=prefixAndAttribs.join(" | ")}});Map.mergeOptions({attributionControl:true});Map.addInitHook(function(){if(this.options.attributionControl){(new Attribution).addTo(this)}});var attribution=function(options){return new Attribution(options)};Control.Layers=Layers;Control.Zoom=Zoom;Control.Scale=Scale;Control.Attribution=Attribution;control.layers=layers;control.zoom=zoom;control.scale=scale;control.attribution=attribution;var Handler=Class.extend({initialize:function(map){this._map=map},enable:function(){if(this._enabled){return this}this._enabled=true;this.addHooks();return this},disable:function(){if(!this._enabled){return this}this._enabled=false;this.removeHooks();return this},enabled:function(){return!!this._enabled}});Handler.addTo=function(map,name){map.addHandler(name,this);return this};var Mixin={Events:Events};var START=touch?"touchstart mousedown":"mousedown";var END={mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"};var MOVE={mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"};var Draggable=Evented.extend({options:{clickTolerance:3},initialize:function(element,dragStartTarget,preventOutline$$1,options){setOptions(this,options);this._element=element;this._dragStartTarget=dragStartTarget||element;this._preventOutline=preventOutline$$1},enable:function(){if(this._enabled){return}on(this._dragStartTarget,START,this._onDown,this);this._enabled=true},disable:function(){if(!this._enabled){return}if(Draggable._dragging===this){this.finishDrag()}off(this._dragStartTarget,START,this._onDown,this);this._enabled=false;this._moved=false},_onDown:function(e){if(e._simulated||!this._enabled){return}this._moved=false;if(hasClass(this._element,"leaflet-zoom-anim")){return}if(Draggable._dragging||e.shiftKey||e.which!==1&&e.button!==1&&!e.touches){return}Draggable._dragging=this;if(this._preventOutline){preventOutline(this._element)}disableImageDrag();disableTextSelection();if(this._moving){return}this.fire("down");var first=e.touches?e.touches[0]:e,sizedParent=getSizedParentNode(this._element);this._startPoint=new Point(first.clientX,first.clientY);this._parentScale=getScale(sizedParent);on(document,MOVE[e.type],this._onMove,this);on(document,END[e.type],this._onUp,this)},_onMove:function(e){if(e._simulated||!this._enabled){return}if(e.touches&&e.touches.length>1){this._moved=true;return}var first=e.touches&&e.touches.length===1?e.touches[0]:e,offset=new Point(first.clientX,first.clientY)._subtract(this._startPoint);if(!offset.x&&!offset.y){return}if(Math.abs(offset.x)+Math.abs(offset.y)<this.options.clickTolerance){return}offset.x/=this._parentScale.x;offset.y/=this._parentScale.y;preventDefault(e);if(!this._moved){this.fire("dragstart");this._moved=true;this._startPos=getPosition(this._element).subtract(offset);addClass(document.body,"leaflet-dragging");this._lastTarget=e.target||e.srcElement;if(window.SVGElementInstance&&this._lastTarget instanceof SVGElementInstance){this._lastTarget=this._lastTarget.correspondingUseElement}addClass(this._lastTarget,"leaflet-drag-target")}this._newPos=this._startPos.add(offset);this._moving=true;cancelAnimFrame(this._animRequest);this._lastEvent=e;this._animRequest=requestAnimFrame(this._updatePosition,this,true)},_updatePosition:function(){var e={originalEvent:this._lastEvent};this.fire("predrag",e);setPosition(this._element,this._newPos);this.fire("drag",e)},_onUp:function(e){if(e._simulated||!this._enabled){return}this.finishDrag()},finishDrag:function(){removeClass(document.body,"leaflet-dragging");if(this._lastTarget){removeClass(this._lastTarget,"leaflet-drag-target");this._lastTarget=null}for(var i in MOVE){off(document,MOVE[i],this._onMove,this);off(document,END[i],this._onUp,this)}enableImageDrag();enableTextSelection();if(this._moved&&this._moving){cancelAnimFrame(this._animRequest);this.fire("dragend",{distance:this._newPos.distanceTo(this._startPos)})}this._moving=false;Draggable._dragging=false}});function simplify(points,tolerance){if(!tolerance||!points.length){return points.slice()}var sqTolerance=tolerance*tolerance;points=_reducePoints(points,sqTolerance);points=_simplifyDP(points,sqTolerance);return points}function pointToSegmentDistance(p,p1,p2){return Math.sqrt(_sqClosestPointOnSegment(p,p1,p2,true))}function closestPointOnSegment(p,p1,p2){return _sqClosestPointOnSegment(p,p1,p2)}function _simplifyDP(points,sqTolerance){var len=points.length,ArrayConstructor=typeof Uint8Array!==undefined+""?Uint8Array:Array,markers=new ArrayConstructor(len);markers[0]=markers[len-1]=1;_simplifyDPStep(points,markers,sqTolerance,0,len-1);var i,newPoints=[];for(i=0;i<len;i++){if(markers[i]){newPoints.push(points[i])}}return newPoints}function _simplifyDPStep(points,markers,sqTolerance,first,last){var maxSqDist=0,index,i,sqDist;for(i=first+1;i<=last-1;i++){sqDist=_sqClosestPointOnSegment(points[i],points[first],points[last],true);if(sqDist>maxSqDist){index=i;maxSqDist=sqDist}}if(maxSqDist>sqTolerance){markers[index]=1;_simplifyDPStep(points,markers,sqTolerance,first,index);_simplifyDPStep(points,markers,sqTolerance,index,last)}}function _reducePoints(points,sqTolerance){var reducedPoints=[points[0]];for(var i=1,prev=0,len=points.length;i<len;i++){if(_sqDist(points[i],points[prev])>sqTolerance){reducedPoints.push(points[i]);prev=i}}if(prev<len-1){reducedPoints.push(points[len-1])}return reducedPoints}var _lastCode;function clipSegment(a,b,bounds,useLastCode,round){var codeA=useLastCode?_lastCode:_getBitCode(a,bounds),codeB=_getBitCode(b,bounds),codeOut,p,newCode;_lastCode=codeB;while(true){if(!(codeA|codeB)){return[a,b]}if(codeA&codeB){return false}codeOut=codeA||codeB;p=_getEdgeIntersection(a,b,codeOut,bounds,round);newCode=_getBitCode(p,bounds);if(codeOut===codeA){a=p;codeA=newCode}else{b=p;codeB=newCode}}}function _getEdgeIntersection(a,b,code,bounds,round){var dx=b.x-a.x,dy=b.y-a.y,min=bounds.min,max=bounds.max,x,y;if(code&8){x=a.x+dx*(max.y-a.y)/dy;y=max.y}else if(code&4){x=a.x+dx*(min.y-a.y)/dy;y=min.y}else if(code&2){x=max.x;y=a.y+dy*(max.x-a.x)/dx}else if(code&1){x=min.x;y=a.y+dy*(min.x-a.x)/dx}return new Point(x,y,round)}function _getBitCode(p,bounds){var code=0;if(p.x<bounds.min.x){code|=1}else if(p.x>bounds.max.x){code|=2}if(p.y<bounds.min.y){code|=4}else if(p.y>bounds.max.y){code|=8}return code}function _sqDist(p1,p2){var dx=p2.x-p1.x,dy=p2.y-p1.y;return dx*dx+dy*dy}function _sqClosestPointOnSegment(p,p1,p2,sqDist){var x=p1.x,y=p1.y,dx=p2.x-x,dy=p2.y-y,dot=dx*dx+dy*dy,t;if(dot>0){t=((p.x-x)*dx+(p.y-y)*dy)/dot;if(t>1){x=p2.x;y=p2.y}else if(t>0){x+=dx*t;y+=dy*t}}dx=p.x-x;dy=p.y-y;return sqDist?dx*dx+dy*dy:new Point(x,y)}function isFlat(latlngs){return!isArray(latlngs[0])||typeof latlngs[0][0]!=="object"&&typeof latlngs[0][0]!=="undefined"}function _flat(latlngs){console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead.");return isFlat(latlngs)}var LineUtil=(Object.freeze||Object)({simplify:simplify,pointToSegmentDistance:pointToSegmentDistance,closestPointOnSegment:closestPointOnSegment,clipSegment:clipSegment,_getEdgeIntersection:_getEdgeIntersection,_getBitCode:_getBitCode,_sqClosestPointOnSegment:_sqClosestPointOnSegment,isFlat:isFlat,_flat:_flat});function clipPolygon(points,bounds,round){var clippedPoints,edges=[1,4,2,8],i,j,k,a,b,len,edge,p;for(i=0,len=points.length;i<len;i++){points[i]._code=_getBitCode(points[i],bounds)}for(k=0;k<4;k++){edge=edges[k];clippedPoints=[];for(i=0,len=points.length,j=len-1;i<len;j=i++){a=points[i];b=points[j];if(!(a._code&edge)){if(b._code&edge){p=_getEdgeIntersection(b,a,edge,bounds,round);p._code=_getBitCode(p,bounds);clippedPoints.push(p)}clippedPoints.push(a)}else if(!(b._code&edge)){p=_getEdgeIntersection(b,a,edge,bounds,round);p._code=_getBitCode(p,bounds);clippedPoints.push(p)}}points=clippedPoints}return points}var PolyUtil=(Object.freeze||Object)({clipPolygon:clipPolygon});var LonLat={project:function(latlng){return new Point(latlng.lng,latlng.lat)},unproject:function(point){return new LatLng(point.y,point.x)},bounds:new Bounds([-180,-90],[180,90])};var Mercator={R:6378137,R_MINOR:6356752.314245179,bounds:new Bounds([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(latlng){var d=Math.PI/180,r=this.R,y=latlng.lat*d,tmp=this.R_MINOR/r,e=Math.sqrt(1-tmp*tmp),con=e*Math.sin(y);var ts=Math.tan(Math.PI/4-y/2)/Math.pow((1-con)/(1+con),e/2);y=-r*Math.log(Math.max(ts,1e-10));return new Point(latlng.lng*d*r,y)},unproject:function(point){var d=180/Math.PI,r=this.R,tmp=this.R_MINOR/r,e=Math.sqrt(1-tmp*tmp),ts=Math.exp(-point.y/r),phi=Math.PI/2-2*Math.atan(ts);for(var i=0,dphi=.1,con;i<15&&Math.abs(dphi)>1e-7;i++){con=e*Math.sin(phi);con=Math.pow((1-con)/(1+con),e/2);dphi=Math.PI/2-2*Math.atan(ts*con)-phi;phi+=dphi}return new LatLng(phi*d,point.x*d/r)}};var index=(Object.freeze||Object)({LonLat:LonLat,Mercator:Mercator,SphericalMercator:SphericalMercator});var EPSG3395=extend({},Earth,{code:"EPSG:3395",projection:Mercator,transformation:function(){var scale=.5/(Math.PI*Mercator.R);return toTransformation(scale,.5,-scale,.5)}()});var EPSG4326=extend({},Earth,{code:"EPSG:4326",projection:LonLat,transformation:toTransformation(1/180,1,-1/180,.5)});var Simple=extend({},CRS,{projection:LonLat,transformation:toTransformation(1,0,-1,0),scale:function(zoom){return Math.pow(2,zoom)},zoom:function(scale){return Math.log(scale)/Math.LN2},distance:function(latlng1,latlng2){var dx=latlng2.lng-latlng1.lng,dy=latlng2.lat-latlng1.lat;return Math.sqrt(dx*dx+dy*dy)},infinite:true});CRS.Earth=Earth;CRS.EPSG3395=EPSG3395;CRS.EPSG3857=EPSG3857;CRS.EPSG900913=EPSG900913;CRS.EPSG4326=EPSG4326;CRS.Simple=Simple;var Layer=Evented.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:true},addTo:function(map){map.addLayer(this);return this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(obj){if(obj){obj.removeLayer(this)}return this},getPane:function(name){return this._map.getPane(name?this.options[name]||name:this.options.pane)},addInteractiveTarget:function(targetEl){this._map._targets[stamp(targetEl)]=this;return this},removeInteractiveTarget:function(targetEl){delete this._map._targets[stamp(targetEl)];return this},getAttribution:function(){return this.options.attribution},_layerAdd:function(e){var map=e.target;if(!map.hasLayer(this)){return}this._map=map;this._zoomAnimated=map._zoomAnimated;if(this.getEvents){var events=this.getEvents();map.on(events,this);this.once("remove",function(){map.off(events,this)},this)}this.onAdd(map);if(this.getAttribution&&map.attributionControl){map.attributionControl.addAttribution(this.getAttribution())}this.fire("add");map.fire("layeradd",{layer:this})}});Map.include({addLayer:function(layer){if(!layer._layerAdd){throw new Error("The provided object is not a Layer.")}var id=stamp(layer);if(this._layers[id]){return this}this._layers[id]=layer;layer._mapToAdd=this;if(layer.beforeAdd){layer.beforeAdd(this)}this.whenReady(layer._layerAdd,layer);return this},removeLayer:function(layer){var id=stamp(layer);if(!this._layers[id]){return this}if(this._loaded){layer.onRemove(this)}if(layer.getAttribution&&this.attributionControl){this.attributionControl.removeAttribution(layer.getAttribution())}delete this._layers[id];if(this._loaded){this.fire("layerremove",{layer:layer});layer.fire("remove")}layer._map=layer._mapToAdd=null;return this},hasLayer:function(layer){return!!layer&&stamp(layer)in this._layers},eachLayer:function(method,context){for(var i in this._layers){method.call(context,this._layers[i])}return this},_addLayers:function(layers){layers=layers?isArray(layers)?layers:[layers]:[];for(var i=0,len=layers.length;i<len;i++){this.addLayer(layers[i])}},_addZoomLimit:function(layer){if(isNaN(layer.options.maxZoom)||!isNaN(layer.options.minZoom)){this._zoomBoundLayers[stamp(layer)]=layer;this._updateZoomLevels()}},_removeZoomLimit:function(layer){var id=stamp(layer);if(this._zoomBoundLayers[id]){delete this._zoomBoundLayers[id];this._updateZoomLevels()}},_updateZoomLevels:function(){var minZoom=Infinity,maxZoom=-Infinity,oldZoomSpan=this._getZoomSpan();for(var i in this._zoomBoundLayers){var options=this._zoomBoundLayers[i].options;minZoom=options.minZoom===undefined?minZoom:Math.min(minZoom,options.minZoom);maxZoom=options.maxZoom===undefined?maxZoom:Math.max(maxZoom,options.maxZoom)}this._layersMaxZoom=maxZoom===-Infinity?undefined:maxZoom;this._layersMinZoom=minZoom===Infinity?undefined:minZoom;if(oldZoomSpan!==this._getZoomSpan()){this.fire("zoomlevelschange")}if(this.options.maxZoom===undefined&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom){this.setZoom(this._layersMaxZoom)}if(this.options.minZoom===undefined&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom){this.setZoom(this._layersMinZoom)}}});var LayerGroup=Layer.extend({initialize:function(layers,options){setOptions(this,options);this._layers={};var i,len;if(layers){for(i=0,len=layers.length;i<len;i++){this.addLayer(layers[i])}}},addLayer:function(layer){var id=this.getLayerId(layer);this._layers[id]=layer;if(this._map){this._map.addLayer(layer)}return this},removeLayer:function(layer){var id=layer in this._layers?layer:this.getLayerId(layer);if(this._map&&this._layers[id]){this._map.removeLayer(this._layers[id])}delete this._layers[id];return this},hasLayer:function(layer){return!!layer&&(layer in this._layers||this.getLayerId(layer)in this._layers)},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(methodName){var args=Array.prototype.slice.call(arguments,1),i,layer;for(i in this._layers){layer=this._layers[i];if(layer[methodName]){layer[methodName].apply(layer,args)}}return this},onAdd:function(map){this.eachLayer(map.addLayer,map)},onRemove:function(map){this.eachLayer(map.removeLayer,map)},eachLayer:function(method,context){for(var i in this._layers){method.call(context,this._layers[i])}return this},getLayer:function(id){return this._layers[id]},getLayers:function(){var layers=[];this.eachLayer(layers.push,layers);return layers},setZIndex:function(zIndex){return this.invoke("setZIndex",zIndex)},getLayerId:function(layer){return stamp(layer)}});var layerGroup=function(layers,options){return new LayerGroup(layers,options)};var FeatureGroup=LayerGroup.extend({addLayer:function(layer){if(this.hasLayer(layer)){return this}layer.addEventParent(this);LayerGroup.prototype.addLayer.call(this,layer);return this.fire("layeradd",{layer:layer})},removeLayer:function(layer){if(!this.hasLayer(layer)){return this}if(layer in this._layers){layer=this._layers[layer]}layer.removeEventParent(this);LayerGroup.prototype.removeLayer.call(this,layer);return this.fire("layerremove",{layer:layer})},setStyle:function(style){return this.invoke("setStyle",style)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var bounds=new LatLngBounds;for(var id in this._layers){var layer=this._layers[id];bounds.extend(layer.getBounds?layer.getBounds():layer.getLatLng())}return bounds}});var featureGroup=function(layers){return new FeatureGroup(layers)};var Icon=Class.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0]},initialize:function(options){setOptions(this,options)},createIcon:function(oldIcon){return this._createIcon("icon",oldIcon)},createShadow:function(oldIcon){return this._createIcon("shadow",oldIcon)},_createIcon:function(name,oldIcon){var src=this._getIconUrl(name);if(!src){if(name==="icon"){throw new Error("iconUrl not set in Icon options (see the docs).")}return null}var img=this._createImg(src,oldIcon&&oldIcon.tagName==="IMG"?oldIcon:null);this._setIconStyles(img,name);return img},_setIconStyles:function(img,name){var options=this.options;var sizeOption=options[name+"Size"];if(typeof sizeOption==="number"){sizeOption=[sizeOption,sizeOption]}var size=toPoint(sizeOption),anchor=toPoint(name==="shadow"&&options.shadowAnchor||options.iconAnchor||size&&size.divideBy(2,true));img.className="leaflet-marker-"+name+" "+(options.className||"");if(anchor){img.style.marginLeft=-anchor.x+"px";img.style.marginTop=-anchor.y+"px"}if(size){img.style.width=size.x+"px";img.style.height=size.y+"px"}},_createImg:function(src,el){el=el||document.createElement("img");el.src=src;return el},_getIconUrl:function(name){return retina&&this.options[name+"RetinaUrl"]||this.options[name+"Url"]}});function icon(options){return new Icon(options)}var IconDefault=Icon.extend({options:{iconUrl:"marker-icon.png",iconRetinaUrl:"marker-icon-2x.png",shadowUrl:"marker-shadow.png",iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(name){if(!IconDefault.imagePath){IconDefault.imagePath=this._detectIconPath()}return(this.options.imagePath||IconDefault.imagePath)+Icon.prototype._getIconUrl.call(this,name)},_detectIconPath:function(){var el=create$1("div","leaflet-default-icon-path",document.body);var path=getStyle(el,"background-image")||getStyle(el,"backgroundImage");document.body.removeChild(el);if(path===null||path.indexOf("url")!==0){path=""}else{path=path.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")}return path}});var MarkerDrag=Handler.extend({initialize:function(marker){this._marker=marker},addHooks:function(){var icon=this._marker._icon;if(!this._draggable){this._draggable=new Draggable(icon,icon,true)}this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable();addClass(icon,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable();if(this._marker._icon){removeClass(this._marker._icon,"leaflet-marker-draggable");
}},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(e){var marker=this._marker,map=marker._map,speed=this._marker.options.autoPanSpeed,padding=this._marker.options.autoPanPadding,iconPos=getPosition(marker._icon),bounds=map.getPixelBounds(),origin=map.getPixelOrigin();var panBounds=toBounds(bounds.min._subtract(origin).add(padding),bounds.max._subtract(origin).subtract(padding));if(!panBounds.contains(iconPos)){var movement=toPoint((Math.max(panBounds.max.x,iconPos.x)-panBounds.max.x)/(bounds.max.x-panBounds.max.x)-(Math.min(panBounds.min.x,iconPos.x)-panBounds.min.x)/(bounds.min.x-panBounds.min.x),(Math.max(panBounds.max.y,iconPos.y)-panBounds.max.y)/(bounds.max.y-panBounds.max.y)-(Math.min(panBounds.min.y,iconPos.y)-panBounds.min.y)/(bounds.min.y-panBounds.min.y)).multiplyBy(speed);map.panBy(movement,{animate:false});this._draggable._newPos._add(movement);this._draggable._startPos._add(movement);setPosition(marker._icon,this._draggable._newPos);this._onDrag(e);this._panRequest=requestAnimFrame(this._adjustPan.bind(this,e))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng();this._marker.closePopup().fire("movestart").fire("dragstart")},_onPreDrag:function(e){if(this._marker.options.autoPan){cancelAnimFrame(this._panRequest);this._panRequest=requestAnimFrame(this._adjustPan.bind(this,e))}},_onDrag:function(e){var marker=this._marker,shadow=marker._shadow,iconPos=getPosition(marker._icon),latlng=marker._map.layerPointToLatLng(iconPos);if(shadow){setPosition(shadow,iconPos)}marker._latlng=latlng;e.latlng=latlng;e.oldLatLng=this._oldLatLng;marker.fire("move",e).fire("drag",e)},_onDragEnd:function(e){cancelAnimFrame(this._panRequest);delete this._oldLatLng;this._marker.fire("moveend").fire("dragend",e)}});var Marker=Layer.extend({options:{icon:new IconDefault,interactive:true,keyboard:true,title:"",alt:"",zIndexOffset:0,opacity:1,riseOnHover:false,riseOffset:250,pane:"markerPane",shadowPane:"shadowPane",bubblingMouseEvents:false,draggable:false,autoPan:false,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(latlng,options){setOptions(this,options);this._latlng=toLatLng(latlng)},onAdd:function(map){this._zoomAnimated=this._zoomAnimated&&map.options.markerZoomAnimation;if(this._zoomAnimated){map.on("zoomanim",this._animateZoom,this)}this._initIcon();this.update()},onRemove:function(map){if(this.dragging&&this.dragging.enabled()){this.options.draggable=true;this.dragging.removeHooks()}delete this.dragging;if(this._zoomAnimated){map.off("zoomanim",this._animateZoom,this)}this._removeIcon();this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(latlng){var oldLatLng=this._latlng;this._latlng=toLatLng(latlng);this.update();return this.fire("move",{oldLatLng:oldLatLng,latlng:this._latlng})},setZIndexOffset:function(offset){this.options.zIndexOffset=offset;return this.update()},getIcon:function(){return this.options.icon},setIcon:function(icon){this.options.icon=icon;if(this._map){this._initIcon();this.update()}if(this._popup){this.bindPopup(this._popup,this._popup.options)}return this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var pos=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(pos)}return this},_initIcon:function(){var options=this.options,classToAdd="leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");var icon=options.icon.createIcon(this._icon),addIcon=false;if(icon!==this._icon){if(this._icon){this._removeIcon()}addIcon=true;if(options.title){icon.title=options.title}if(icon.tagName==="IMG"){icon.alt=options.alt||""}}addClass(icon,classToAdd);if(options.keyboard){icon.tabIndex="0"}this._icon=icon;if(options.riseOnHover){this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex})}var newShadow=options.icon.createShadow(this._shadow),addShadow=false;if(newShadow!==this._shadow){this._removeShadow();addShadow=true}if(newShadow){addClass(newShadow,classToAdd);newShadow.alt=""}this._shadow=newShadow;if(options.opacity<1){this._updateOpacity()}if(addIcon){this.getPane().appendChild(this._icon)}this._initInteraction();if(newShadow&&addShadow){this.getPane(options.shadowPane).appendChild(this._shadow)}},_removeIcon:function(){if(this.options.riseOnHover){this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex})}remove(this._icon);this.removeInteractiveTarget(this._icon);this._icon=null},_removeShadow:function(){if(this._shadow){remove(this._shadow)}this._shadow=null},_setPos:function(pos){if(this._icon){setPosition(this._icon,pos)}if(this._shadow){setPosition(this._shadow,pos)}this._zIndex=pos.y+this.options.zIndexOffset;this._resetZIndex()},_updateZIndex:function(offset){if(this._icon){this._icon.style.zIndex=this._zIndex+offset}},_animateZoom:function(opt){var pos=this._map._latLngToNewLayerPoint(this._latlng,opt.zoom,opt.center).round();this._setPos(pos)},_initInteraction:function(){if(!this.options.interactive){return}addClass(this._icon,"leaflet-interactive");this.addInteractiveTarget(this._icon);if(MarkerDrag){var draggable=this.options.draggable;if(this.dragging){draggable=this.dragging.enabled();this.dragging.disable()}this.dragging=new MarkerDrag(this);if(draggable){this.dragging.enable()}}},setOpacity:function(opacity){this.options.opacity=opacity;if(this._map){this._updateOpacity()}return this},_updateOpacity:function(){var opacity=this.options.opacity;if(this._icon){setOpacity(this._icon,opacity)}if(this._shadow){setOpacity(this._shadow,opacity)}},_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}});function marker(latlng,options){return new Marker(latlng,options)}var Path=Layer.extend({options:{stroke:true,color:"#3388ff",weight:3,opacity:1,lineCap:"round",lineJoin:"round",dashArray:null,dashOffset:null,fill:false,fillColor:null,fillOpacity:.2,fillRule:"evenodd",interactive:true,bubblingMouseEvents:true},beforeAdd:function(map){this._renderer=map.getRenderer(this)},onAdd:function(){this._renderer._initPath(this);this._reset();this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){if(this._map){this._renderer._updatePath(this)}return this},setStyle:function(style){setOptions(this,style);if(this._renderer){this._renderer._updateStyle(this);if(this.options.stroke&&style&&style.hasOwnProperty("weight")){this._updateBounds()}}return this},bringToFront:function(){if(this._renderer){this._renderer._bringToFront(this)}return this},bringToBack:function(){if(this._renderer){this._renderer._bringToBack(this)}return 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}});var CircleMarker=Path.extend({options:{fill:true,radius:10},initialize:function(latlng,options){setOptions(this,options);this._latlng=toLatLng(latlng);this._radius=this.options.radius},setLatLng:function(latlng){var oldLatLng=this._latlng;this._latlng=toLatLng(latlng);this.redraw();return this.fire("move",{oldLatLng:oldLatLng,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(radius){this.options.radius=this._radius=radius;return this.redraw()},getRadius:function(){return this._radius},setStyle:function(options){var radius=options&&options.radius||this._radius;Path.prototype.setStyle.call(this,options);this.setRadius(radius);return this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng);this._updateBounds()},_updateBounds:function(){var r=this._radius,r2=this._radiusY||r,w=this._clickTolerance(),p=[r+w,r2+w];this._pxBounds=new Bounds(this._point.subtract(p),this._point.add(p))},_update:function(){if(this._map){this._updatePath()}},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(p){return p.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function circleMarker(latlng,options){return new CircleMarker(latlng,options)}var Circle=CircleMarker.extend({initialize:function(latlng,options,legacyOptions){if(typeof options==="number"){options=extend({},legacyOptions,{radius:options})}setOptions(this,options);this._latlng=toLatLng(latlng);if(isNaN(this.options.radius)){throw new Error("Circle radius cannot be NaN")}this._mRadius=this.options.radius},setRadius:function(radius){this._mRadius=radius;return this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var half=[this._radius,this._radiusY||this._radius];return new LatLngBounds(this._map.layerPointToLatLng(this._point.subtract(half)),this._map.layerPointToLatLng(this._point.add(half)))},setStyle:Path.prototype.setStyle,_project:function(){var lng=this._latlng.lng,lat=this._latlng.lat,map=this._map,crs=map.options.crs;if(crs.distance===Earth.distance){var d=Math.PI/180,latR=this._mRadius/Earth.R/d,top=map.project([lat+latR,lng]),bottom=map.project([lat-latR,lng]),p=top.add(bottom).divideBy(2),lat2=map.unproject(p).lat,lngR=Math.acos((Math.cos(latR*d)-Math.sin(lat*d)*Math.sin(lat2*d))/(Math.cos(lat*d)*Math.cos(lat2*d)))/d;if(isNaN(lngR)||lngR===0){lngR=latR/Math.cos(Math.PI/180*lat)}this._point=p.subtract(map.getPixelOrigin());this._radius=isNaN(lngR)?0:p.x-map.project([lat2,lng-lngR]).x;this._radiusY=p.y-top.y}else{var latlng2=crs.unproject(crs.project(this._latlng).subtract([this._mRadius,0]));this._point=map.latLngToLayerPoint(this._latlng);this._radius=this._point.x-map.latLngToLayerPoint(latlng2).x}this._updateBounds()}});function circle(latlng,options,legacyOptions){return new Circle(latlng,options,legacyOptions)}var Polyline=Path.extend({options:{smoothFactor:1,noClip:false},initialize:function(latlngs,options){setOptions(this,options);this._setLatLngs(latlngs)},getLatLngs:function(){return this._latlngs},setLatLngs:function(latlngs){this._setLatLngs(latlngs);return this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(p){var minDistance=Infinity,minPoint=null,closest=_sqClosestPointOnSegment,p1,p2;for(var j=0,jLen=this._parts.length;j<jLen;j++){var points=this._parts[j];for(var i=1,len=points.length;i<len;i++){p1=points[i-1];p2=points[i];var sqDist=closest(p,p1,p2,true);if(sqDist<minDistance){minDistance=sqDist;minPoint=closest(p,p1,p2)}}}if(minPoint){minPoint.distance=Math.sqrt(minDistance)}return minPoint},getCenter:function(){if(!this._map){throw new Error("Must add layer to map before using getCenter()")}var i,halfDist,segDist,dist,p1,p2,ratio,points=this._rings[0],len=points.length;if(!len){return null}for(i=0,halfDist=0;i<len-1;i++){halfDist+=points[i].distanceTo(points[i+1])/2}if(halfDist===0){return this._map.layerPointToLatLng(points[0])}for(i=0,dist=0;i<len-1;i++){p1=points[i];p2=points[i+1];segDist=p1.distanceTo(p2);dist+=segDist;if(dist>halfDist){ratio=(dist-halfDist)/segDist;return this._map.layerPointToLatLng([p2.x-ratio*(p2.x-p1.x),p2.y-ratio*(p2.y-p1.y)])}}},getBounds:function(){return this._bounds},addLatLng:function(latlng,latlngs){latlngs=latlngs||this._defaultShape();latlng=toLatLng(latlng);latlngs.push(latlng);this._bounds.extend(latlng);return this.redraw()},_setLatLngs:function(latlngs){this._bounds=new LatLngBounds;this._latlngs=this._convertLatLngs(latlngs)},_defaultShape:function(){return isFlat(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(latlngs){var result=[],flat=isFlat(latlngs);for(var i=0,len=latlngs.length;i<len;i++){if(flat){result[i]=toLatLng(latlngs[i]);this._bounds.extend(result[i])}else{result[i]=this._convertLatLngs(latlngs[i])}}return result},_project:function(){var pxBounds=new Bounds;this._rings=[];this._projectLatlngs(this._latlngs,this._rings,pxBounds);if(this._bounds.isValid()&&pxBounds.isValid()){this._rawPxBounds=pxBounds;this._updateBounds()}},_updateBounds:function(){var w=this._clickTolerance(),p=new Point(w,w);this._pxBounds=new Bounds([this._rawPxBounds.min.subtract(p),this._rawPxBounds.max.add(p)])},_projectLatlngs:function(latlngs,result,projectedBounds){var flat=latlngs[0]instanceof LatLng,len=latlngs.length,i,ring;if(flat){ring=[];for(i=0;i<len;i++){ring[i]=this._map.latLngToLayerPoint(latlngs[i]);projectedBounds.extend(ring[i])}result.push(ring)}else{for(i=0;i<len;i++){this._projectLatlngs(latlngs[i],result,projectedBounds)}}},_clipPoints:function(){var bounds=this._renderer._bounds;this._parts=[];if(!this._pxBounds||!this._pxBounds.intersects(bounds)){return}if(this.options.noClip){this._parts=this._rings;return}var parts=this._parts,i,j,k,len,len2,segment,points;for(i=0,k=0,len=this._rings.length;i<len;i++){points=this._rings[i];for(j=0,len2=points.length;j<len2-1;j++){segment=clipSegment(points[j],points[j+1],bounds,j,true);if(!segment){continue}parts[k]=parts[k]||[];parts[k].push(segment[0]);if(segment[1]!==points[j+1]||j===len2-2){parts[k].push(segment[1]);k++}}}},_simplifyPoints:function(){var parts=this._parts,tolerance=this.options.smoothFactor;for(var i=0,len=parts.length;i<len;i++){parts[i]=simplify(parts[i],tolerance)}},_update:function(){if(!this._map){return}this._clipPoints();this._simplifyPoints();this._updatePath()},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(p,closed){var i,j,k,len,len2,part,w=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(p)){return false}for(i=0,len=this._parts.length;i<len;i++){part=this._parts[i];for(j=0,len2=part.length,k=len2-1;j<len2;k=j++){if(!closed&&j===0){continue}if(pointToSegmentDistance(p,part[k],part[j])<=w){return true}}}return false}});function polyline(latlngs,options){return new Polyline(latlngs,options)}Polyline._flat=_flat;var Polygon=Polyline.extend({options:{fill:true},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map){throw new Error("Must add layer to map before using getCenter()")}var i,j,p1,p2,f,area,x,y,center,points=this._rings[0],len=points.length;if(!len){return null}area=x=y=0;for(i=0,j=len-1;i<len;j=i++){p1=points[i];p2=points[j];f=p1.y*p2.x-p2.y*p1.x;x+=(p1.x+p2.x)*f;y+=(p1.y+p2.y)*f;area+=f*3}if(area===0){center=points[0]}else{center=[x/area,y/area]}return this._map.layerPointToLatLng(center)},_convertLatLngs:function(latlngs){var result=Polyline.prototype._convertLatLngs.call(this,latlngs),len=result.length;if(len>=2&&result[0]instanceof LatLng&&result[0].equals(result[len-1])){result.pop()}return result},_setLatLngs:function(latlngs){Polyline.prototype._setLatLngs.call(this,latlngs);if(isFlat(this._latlngs)){this._latlngs=[this._latlngs]}},_defaultShape:function(){return isFlat(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var bounds=this._renderer._bounds,w=this.options.weight,p=new Point(w,w);bounds=new Bounds(bounds.min.subtract(p),bounds.max.add(p));this._parts=[];if(!this._pxBounds||!this._pxBounds.intersects(bounds)){return}if(this.options.noClip){this._parts=this._rings;return}for(var i=0,len=this._rings.length,clipped;i<len;i++){clipped=clipPolygon(this._rings[i],bounds,true);if(clipped.length){this._parts.push(clipped)}}},_updatePath:function(){this._renderer._updatePoly(this,true)},_containsPoint:function(p){var inside=false,part,p1,p2,i,j,k,len,len2;if(!this._pxBounds||!this._pxBounds.contains(p)){return false}for(i=0,len=this._parts.length;i<len;i++){part=this._parts[i];for(j=0,len2=part.length,k=len2-1;j<len2;k=j++){p1=part[j];p2=part[k];if(p1.y>p.y!==p2.y>p.y&&p.x<(p2.x-p1.x)*(p.y-p1.y)/(p2.y-p1.y)+p1.x){inside=!inside}}}return inside||Polyline.prototype._containsPoint.call(this,p,true)}});function polygon(latlngs,options){return new Polygon(latlngs,options)}var GeoJSON=FeatureGroup.extend({initialize:function(geojson,options){setOptions(this,options);this._layers={};if(geojson){this.addData(geojson)}},addData:function(geojson){var features=isArray(geojson)?geojson:geojson.features,i,len,feature;if(features){for(i=0,len=features.length;i<len;i++){feature=features[i];if(feature.geometries||feature.geometry||feature.features||feature.coordinates){this.addData(feature)}}return this}var options=this.options;if(options.filter&&!options.filter(geojson)){return this}var layer=geometryToLayer(geojson,options);if(!layer){return this}layer.feature=asFeature(geojson);layer.defaultOptions=layer.options;this.resetStyle(layer);if(options.onEachFeature){options.onEachFeature(geojson,layer)}return this.addLayer(layer)},resetStyle:function(layer){if(layer===undefined){return this.eachLayer(this.resetStyle,this)}layer.options=extend({},layer.defaultOptions);this._setLayerStyle(layer,this.options.style);return this},setStyle:function(style){return this.eachLayer(function(layer){this._setLayerStyle(layer,style)},this)},_setLayerStyle:function(layer,style){if(layer.setStyle){if(typeof style==="function"){style=style(layer.feature)}layer.setStyle(style)}}});function geometryToLayer(geojson,options){var geometry=geojson.type==="Feature"?geojson.geometry:geojson,coords=geometry?geometry.coordinates:null,layers=[],pointToLayer=options&&options.pointToLayer,_coordsToLatLng=options&&options.coordsToLatLng||coordsToLatLng,latlng,latlngs,i,len;if(!coords&&!geometry){return null}switch(geometry.type){case"Point":latlng=_coordsToLatLng(coords);return _pointToLayer(pointToLayer,geojson,latlng,options);case"MultiPoint":for(i=0,len=coords.length;i<len;i++){latlng=_coordsToLatLng(coords[i]);layers.push(_pointToLayer(pointToLayer,geojson,latlng,options))}return new FeatureGroup(layers);case"LineString":case"MultiLineString":latlngs=coordsToLatLngs(coords,geometry.type==="LineString"?0:1,_coordsToLatLng);return new Polyline(latlngs,options);case"Polygon":case"MultiPolygon":latlngs=coordsToLatLngs(coords,geometry.type==="Polygon"?1:2,_coordsToLatLng);return new Polygon(latlngs,options);case"GeometryCollection":for(i=0,len=geometry.geometries.length;i<len;i++){var layer=geometryToLayer({geometry:geometry.geometries[i],type:"Feature",properties:geojson.properties},options);if(layer){layers.push(layer)}}return new FeatureGroup(layers);default:throw new Error("Invalid GeoJSON object.")}}function _pointToLayer(pointToLayerFn,geojson,latlng,options){return pointToLayerFn?pointToLayerFn(geojson,latlng):new Marker(latlng,options&&options.markersInheritOptions&&options)}function coordsToLatLng(coords){return new LatLng(coords[1],coords[0],coords[2])}function coordsToLatLngs(coords,levelsDeep,_coordsToLatLng){var latlngs=[];for(var i=0,len=coords.length,latlng;i<len;i++){latlng=levelsDeep?coordsToLatLngs(coords[i],levelsDeep-1,_coordsToLatLng):(_coordsToLatLng||coordsToLatLng)(coords[i]);latlngs.push(latlng)}return latlngs}function latLngToCoords(latlng,precision){precision=typeof precision==="number"?precision:6;return latlng.alt!==undefined?[formatNum(latlng.lng,precision),formatNum(latlng.lat,precision),formatNum(latlng.alt,precision)]:[formatNum(latlng.lng,precision),formatNum(latlng.lat,precision)]}function latLngsToCoords(latlngs,levelsDeep,closed,precision){var coords=[];for(var i=0,len=latlngs.length;i<len;i++){coords.push(levelsDeep?latLngsToCoords(latlngs[i],levelsDeep-1,closed,precision):latLngToCoords(latlngs[i],precision))}if(!levelsDeep&&closed){coords.push(coords[0])}return coords}function getFeature(layer,newGeometry){return layer.feature?extend({},layer.feature,{geometry:newGeometry}):asFeature(newGeometry)}function asFeature(geojson){if(geojson.type==="Feature"||geojson.type==="FeatureCollection"){return geojson}return{type:"Feature",properties:{},geometry:geojson}}var PointToGeoJSON={toGeoJSON:function(precision){return getFeature(this,{type:"Point",coordinates:latLngToCoords(this.getLatLng(),precision)})}};Marker.include(PointToGeoJSON);Circle.include(PointToGeoJSON);CircleMarker.include(PointToGeoJSON);Polyline.include({toGeoJSON:function(precision){var multi=!isFlat(this._latlngs);var coords=latLngsToCoords(this._latlngs,multi?1:0,false,precision);return getFeature(this,{type:(multi?"Multi":"")+"LineString",coordinates:coords})}});Polygon.include({toGeoJSON:function(precision){var holes=!isFlat(this._latlngs),multi=holes&&!isFlat(this._latlngs[0]);var coords=latLngsToCoords(this._latlngs,multi?2:holes?1:0,true,precision);if(!holes){coords=[coords]}return getFeature(this,{type:(multi?"Multi":"")+"Polygon",coordinates:coords})}});LayerGroup.include({toMultiPoint:function(precision){var coords=[];this.eachLayer(function(layer){coords.push(layer.toGeoJSON(precision).geometry.coordinates)});return getFeature(this,{type:"MultiPoint",coordinates:coords})},toGeoJSON:function(precision){var type=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(type==="MultiPoint"){return this.toMultiPoint(precision)}var isGeometryCollection=type==="GeometryCollection",jsons=[];this.eachLayer(function(layer){if(layer.toGeoJSON){var json=layer.toGeoJSON(precision);if(isGeometryCollection){jsons.push(json.geometry)}else{var feature=asFeature(json);if(feature.type==="FeatureCollection"){jsons.push.apply(jsons,feature.features)}else{jsons.push(feature)}}}});if(isGeometryCollection){return getFeature(this,{geometries:jsons,type:"GeometryCollection"})}return{type:"FeatureCollection",features:jsons}}});function geoJSON(geojson,options){return new GeoJSON(geojson,options)}var geoJson=geoJSON;var ImageOverlay=Layer.extend({options:{opacity:1,alt:"",interactive:false,crossOrigin:false,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(url,bounds,options){this._url=url;this._bounds=toLatLngBounds(bounds);setOptions(this,options)},onAdd:function(){if(!this._image){this._initImage();if(this.options.opacity<1){this._updateOpacity()}}if(this.options.interactive){addClass(this._image,"leaflet-interactive");this.addInteractiveTarget(this._image)}this.getPane().appendChild(this._image);this._reset()},onRemove:function(){remove(this._image);if(this.options.interactive){this.removeInteractiveTarget(this._image)}},setOpacity:function(opacity){this.options.opacity=opacity;if(this._image){this._updateOpacity()}return this},setStyle:function(styleOpts){if(styleOpts.opacity){this.setOpacity(styleOpts.opacity)}return this},bringToFront:function(){if(this._map){toFront(this._image)}return this},bringToBack:function(){if(this._map){toBack(this._image)}return this},setUrl:function(url){this._url=url;if(this._image){this._image.src=url}return this},setBounds:function(bounds){this._bounds=toLatLngBounds(bounds);if(this._map){this._reset()}return this},getEvents:function(){var events={zoom:this._reset,viewreset:this._reset};if(this._zoomAnimated){events.zoomanim=this._animateZoom}return events},setZIndex:function(value){this.options.zIndex=value;this._updateZIndex();return this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var wasElementSupplied=this._url.tagName==="IMG";var img=this._image=wasElementSupplied?this._url:create$1("img");addClass(img,"leaflet-image-layer");if(this._zoomAnimated){addClass(img,"leaflet-zoom-animated")}if(this.options.className){addClass(img,this.options.className)}img.onselectstart=falseFn;img.onmousemove=falseFn;img.onload=bind(this.fire,this,"load");img.onerror=bind(this._overlayOnError,this,"error");if(this.options.crossOrigin||this.options.crossOrigin===""){img.crossOrigin=this.options.crossOrigin===true?"":this.options.crossOrigin}if(this.options.zIndex){this._updateZIndex()}if(wasElementSupplied){this._url=img.src;return}img.src=this._url;img.alt=this.options.alt},_animateZoom:function(e){var scale=this._map.getZoomScale(e.zoom),offset=this._map._latLngBoundsToNewLayerBounds(this._bounds,e.zoom,e.center).min;setTransform(this._image,offset,scale)},_reset:function(){var image=this._image,bounds=new Bounds(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),size=bounds.getSize();setPosition(image,bounds.min);image.style.width=size.x+"px";image.style.height=size.y+"px"},_updateOpacity:function(){setOpacity(this._image,this.options.opacity)},_updateZIndex:function(){if(this._image&&this.options.zIndex!==undefined&&this.options.zIndex!==null){this._image.style.zIndex=this.options.zIndex}},_overlayOnError:function(){this.fire("error");var errorUrl=this.options.errorOverlayUrl;if(errorUrl&&this._url!==errorUrl){this._url=errorUrl;this._image.src=errorUrl}}});var imageOverlay=function(url,bounds,options){return new ImageOverlay(url,bounds,options)};var VideoOverlay=ImageOverlay.extend({options:{autoplay:true,loop:true,keepAspectRatio:true},_initImage:function(){var wasElementSupplied=this._url.tagName==="VIDEO";var vid=this._image=wasElementSupplied?this._url:create$1("video");addClass(vid,"leaflet-image-layer");if(this._zoomAnimated){addClass(vid,"leaflet-zoom-animated")}if(this.options.className){addClass(vid,this.options.className)}vid.onselectstart=falseFn;vid.onmousemove=falseFn;vid.onloadeddata=bind(this.fire,this,"load");if(wasElementSupplied){var sourceElements=vid.getElementsByTagName("source");var sources=[];for(var j=0;j<sourceElements.length;j++){sources.push(sourceElements[j].src)}this._url=sourceElements.length>0?sources:[vid.src];return}if(!isArray(this._url)){this._url=[this._url]}if(!this.options.keepAspectRatio&&vid.style.hasOwnProperty("objectFit")){vid.style["objectFit"]="fill"}vid.autoplay=!!this.options.autoplay;vid.loop=!!this.options.loop;for(var i=0;i<this._url.length;i++){var source=create$1("source");source.src=this._url[i];vid.appendChild(source)}}});function videoOverlay(video,bounds,options){return new VideoOverlay(video,bounds,options)}var SVGOverlay=ImageOverlay.extend({_initImage:function(){var el=this._image=this._url;addClass(el,"leaflet-image-layer");if(this._zoomAnimated){addClass(el,"leaflet-zoom-animated")}if(this.options.className){addClass(el,this.options.className)}el.onselectstart=falseFn;el.onmousemove=falseFn}});function svgOverlay(el,bounds,options){return new SVGOverlay(el,bounds,options)}var DivOverlay=Layer.extend({options:{offset:[0,7],className:"",pane:"popupPane"},initialize:function(options,source){setOptions(this,options);this._source=source},onAdd:function(map){this._zoomAnimated=map._zoomAnimated;if(!this._container){this._initLayout()}if(map._fadeAnimated){setOpacity(this._container,0)}clearTimeout(this._removeTimeout);this.getPane().appendChild(this._container);this.update();if(map._fadeAnimated){setOpacity(this._container,1)}this.bringToFront()},onRemove:function(map){if(map._fadeAnimated){setOpacity(this._container,0);this._removeTimeout=setTimeout(bind(remove,undefined,this._container),200)}else{remove(this._container)}},getLatLng:function(){return this._latlng},setLatLng:function(latlng){this._latlng=toLatLng(latlng);if(this._map){this._updatePosition();this._adjustPan()}return this},getContent:function(){return this._content},setContent:function(content){this._content=content;this.update();return this},getElement:function(){return this._container},update:function(){if(!this._map){return}this._container.style.visibility="hidden";this._updateContent();this._updateLayout();this._updatePosition();this._container.style.visibility="";this._adjustPan()},getEvents:function(){var events={zoom:this._updatePosition,viewreset:this._updatePosition};if(this._zoomAnimated){events.zoomanim=this._animateZoom}return events},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){if(this._map){toFront(this._container)}return this},bringToBack:function(){if(this._map){toBack(this._container)}return this},_prepareOpen:function(parent,layer,latlng){if(!(layer instanceof Layer)){latlng=layer;layer=parent}if(layer instanceof FeatureGroup){for(var id in parent._layers){layer=parent._layers[id];break}}if(!latlng){if(layer.getCenter){latlng=layer.getCenter()}else if(layer.getLatLng){latlng=layer.getLatLng()}else{throw new Error("Unable to get source layer LatLng.")}}this._source=layer;this.update();return latlng},_updateContent:function(){if(!this._content){return}var node=this._contentNode;var content=typeof this._content==="function"?this._content(this._source||this):this._content;if(typeof content==="string"){node.innerHTML=content}else{while(node.hasChildNodes()){node.removeChild(node.firstChild)}node.appendChild(content)}this.fire("contentupdate")},_updatePosition:function(){if(!this._map){return}var pos=this._map.latLngToLayerPoint(this._latlng),offset=toPoint(this.options.offset),anchor=this._getAnchor();if(this._zoomAnimated){setPosition(this._container,pos.add(anchor))}else{offset=offset.add(pos).add(anchor)}var bottom=this._containerBottom=-offset.y,left=this._containerLeft=-Math.round(this._containerWidth/2)+offset.x;this._container.style.bottom=bottom+"px";this._container.style.left=left+"px"},_getAnchor:function(){return[0,0]}});var Popup=DivOverlay.extend({options:{maxWidth:300,minWidth:50,maxHeight:null,autoPan:true,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:false,closeButton:true,autoClose:true,closeOnEscapeKey:true,className:""},openOn:function(map){map.openPopup(this);return this},onAdd:function(map){DivOverlay.prototype.onAdd.call(this,map);map.fire("popupopen",{popup:this});if(this._source){this._source.fire("popupopen",{popup:this},true);if(!(this._source instanceof Path)){this._source.on("preclick",stopPropagation)}}},onRemove:function(map){DivOverlay.prototype.onRemove.call(this,map);map.fire("popupclose",{popup:this});if(this._source){this._source.fire("popupclose",{popup:this},true);if(!(this._source instanceof Path)){this._source.off("preclick",stopPropagation)}}},getEvents:function(){var events=DivOverlay.prototype.getEvents.call(this);if(this.options.closeOnClick!==undefined?this.options.closeOnClick:this._map.options.closePopupOnClick){events.preclick=this._close}if(this.options.keepInView){events.moveend=this._adjustPan}return events},_close:function(){if(this._map){this._map.closePopup(this)}},_initLayout:function(){var prefix="leaflet-popup",container=this._container=create$1("div",prefix+" "+(this.options.className||"")+" leaflet-zoom-animated");var wrapper=this._wrapper=create$1("div",prefix+"-content-wrapper",container);this._contentNode=create$1("div",prefix+"-content",wrapper);disableClickPropagation(wrapper);disableScrollPropagation(this._contentNode);on(wrapper,"contextmenu",stopPropagation);this._tipContainer=create$1("div",prefix+"-tip-container",container);this._tip=create$1("div",prefix+"-tip",this._tipContainer);if(this.options.closeButton){var closeButton=this._closeButton=create$1("a",prefix+"-close-button",container);closeButton.href="#close";closeButton.innerHTML="&#215;";on(closeButton,"click",this._onCloseButtonClick,this)}},_updateLayout:function(){var container=this._contentNode,style=container.style;style.width="";style.whiteSpace="nowrap";var width=container.offsetWidth;width=Math.min(width,this.options.maxWidth);width=Math.max(width,this.options.minWidth);style.width=width+1+"px";style.whiteSpace="";style.height="";var height=container.offsetHeight,maxHeight=this.options.maxHeight,scrolledClass="leaflet-popup-scrolled";if(maxHeight&&height>maxHeight){style.height=maxHeight+"px";addClass(container,scrolledClass)}else{removeClass(container,scrolledClass)}this._containerWidth=this._container.offsetWidth},_animateZoom:function(e){var pos=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center),anchor=this._getAnchor();setPosition(this._container,pos.add(anchor))},_adjustPan:function(){if(!this.options.autoPan){return}if(this._map._panAnim){this._map._panAnim.stop()}var map=this._map,marginBottom=parseInt(getStyle(this._container,"marginBottom"),10)||0,containerHeight=this._container.offsetHeight+marginBottom,containerWidth=this._containerWidth,layerPos=new Point(this._containerLeft,-containerHeight-this._containerBottom);
layerPos._add(getPosition(this._container));var containerPos=map.layerPointToContainerPoint(layerPos),padding=toPoint(this.options.autoPanPadding),paddingTL=toPoint(this.options.autoPanPaddingTopLeft||padding),paddingBR=toPoint(this.options.autoPanPaddingBottomRight||padding),size=map.getSize(),dx=0,dy=0;if(containerPos.x+containerWidth+paddingBR.x>size.x){dx=containerPos.x+containerWidth-size.x+paddingBR.x}if(containerPos.x-dx-paddingTL.x<0){dx=containerPos.x-paddingTL.x}if(containerPos.y+containerHeight+paddingBR.y>size.y){dy=containerPos.y+containerHeight-size.y+paddingBR.y}if(containerPos.y-dy-paddingTL.y<0){dy=containerPos.y-paddingTL.y}if(dx||dy){map.fire("autopanstart").panBy([dx,dy])}},_onCloseButtonClick:function(e){this._close();stop(e)},_getAnchor:function(){return toPoint(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}});var popup=function(options,source){return new Popup(options,source)};Map.mergeOptions({closePopupOnClick:true});Map.include({openPopup:function(popup,latlng,options){if(!(popup instanceof Popup)){popup=new Popup(options).setContent(popup)}if(latlng){popup.setLatLng(latlng)}if(this.hasLayer(popup)){return this}if(this._popup&&this._popup.options.autoClose){this.closePopup()}this._popup=popup;return this.addLayer(popup)},closePopup:function(popup){if(!popup||popup===this._popup){popup=this._popup;this._popup=null}if(popup){this.removeLayer(popup)}return this}});Layer.include({bindPopup:function(content,options){if(content instanceof Popup){setOptions(content,options);this._popup=content;content._source=this}else{if(!this._popup||options){this._popup=new Popup(options,this)}this._popup.setContent(content)}if(!this._popupHandlersAdded){this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup});this._popupHandlersAdded=true}return this},unbindPopup:function(){if(this._popup){this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup});this._popupHandlersAdded=false;this._popup=null}return this},openPopup:function(layer,latlng){if(this._popup&&this._map){latlng=this._popup._prepareOpen(this,layer,latlng);this._map.openPopup(this._popup,latlng)}return this},closePopup:function(){if(this._popup){this._popup._close()}return this},togglePopup:function(target){if(this._popup){if(this._popup._map){this.closePopup()}else{this.openPopup(target)}}return this},isPopupOpen:function(){return this._popup?this._popup.isOpen():false},setPopupContent:function(content){if(this._popup){this._popup.setContent(content)}return this},getPopup:function(){return this._popup},_openPopup:function(e){var layer=e.layer||e.target;if(!this._popup){return}if(!this._map){return}stop(e);if(layer instanceof Path){this.openPopup(e.layer||e.target,e.latlng);return}if(this._map.hasLayer(this._popup)&&this._popup._source===layer){this.closePopup()}else{this.openPopup(layer,e.latlng)}},_movePopup:function(e){this._popup.setLatLng(e.latlng)},_onKeyPress:function(e){if(e.originalEvent.keyCode===13){this._openPopup(e)}}});var Tooltip=DivOverlay.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:false,sticky:false,interactive:false,opacity:.9},onAdd:function(map){DivOverlay.prototype.onAdd.call(this,map);this.setOpacity(this.options.opacity);map.fire("tooltipopen",{tooltip:this});if(this._source){this._source.fire("tooltipopen",{tooltip:this},true)}},onRemove:function(map){DivOverlay.prototype.onRemove.call(this,map);map.fire("tooltipclose",{tooltip:this});if(this._source){this._source.fire("tooltipclose",{tooltip:this},true)}},getEvents:function(){var events=DivOverlay.prototype.getEvents.call(this);if(touch&&!this.options.permanent){events.preclick=this._close}return events},_close:function(){if(this._map){this._map.closeTooltip(this)}},_initLayout:function(){var prefix="leaflet-tooltip",className=prefix+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=create$1("div",className)},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(pos){var map=this._map,container=this._container,centerPoint=map.latLngToContainerPoint(map.getCenter()),tooltipPoint=map.layerPointToContainerPoint(pos),direction=this.options.direction,tooltipWidth=container.offsetWidth,tooltipHeight=container.offsetHeight,offset=toPoint(this.options.offset),anchor=this._getAnchor();if(direction==="top"){pos=pos.add(toPoint(-tooltipWidth/2+offset.x,-tooltipHeight+offset.y+anchor.y,true))}else if(direction==="bottom"){pos=pos.subtract(toPoint(tooltipWidth/2-offset.x,-offset.y,true))}else if(direction==="center"){pos=pos.subtract(toPoint(tooltipWidth/2+offset.x,tooltipHeight/2-anchor.y+offset.y,true))}else if(direction==="right"||direction==="auto"&&tooltipPoint.x<centerPoint.x){direction="right";pos=pos.add(toPoint(offset.x+anchor.x,anchor.y-tooltipHeight/2+offset.y,true))}else{direction="left";pos=pos.subtract(toPoint(tooltipWidth+anchor.x-offset.x,tooltipHeight/2-anchor.y-offset.y,true))}removeClass(container,"leaflet-tooltip-right");removeClass(container,"leaflet-tooltip-left");removeClass(container,"leaflet-tooltip-top");removeClass(container,"leaflet-tooltip-bottom");addClass(container,"leaflet-tooltip-"+direction);setPosition(container,pos)},_updatePosition:function(){var pos=this._map.latLngToLayerPoint(this._latlng);this._setPosition(pos)},setOpacity:function(opacity){this.options.opacity=opacity;if(this._container){setOpacity(this._container,opacity)}},_animateZoom:function(e){var pos=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center);this._setPosition(pos)},_getAnchor:function(){return toPoint(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}});var tooltip=function(options,source){return new Tooltip(options,source)};Map.include({openTooltip:function(tooltip,latlng,options){if(!(tooltip instanceof Tooltip)){tooltip=new Tooltip(options).setContent(tooltip)}if(latlng){tooltip.setLatLng(latlng)}if(this.hasLayer(tooltip)){return this}return this.addLayer(tooltip)},closeTooltip:function(tooltip){if(tooltip){this.removeLayer(tooltip)}return this}});Layer.include({bindTooltip:function(content,options){if(content instanceof Tooltip){setOptions(content,options);this._tooltip=content;content._source=this}else{if(!this._tooltip||options){this._tooltip=new Tooltip(options,this)}this._tooltip.setContent(content)}this._initTooltipInteractions();if(this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)){this.openTooltip()}return this},unbindTooltip:function(){if(this._tooltip){this._initTooltipInteractions(true);this.closeTooltip();this._tooltip=null}return this},_initTooltipInteractions:function(remove$$1){if(!remove$$1&&this._tooltipHandlersAdded){return}var onOff=remove$$1?"off":"on",events={remove:this.closeTooltip,move:this._moveTooltip};if(!this._tooltip.options.permanent){events.mouseover=this._openTooltip;events.mouseout=this.closeTooltip;if(this._tooltip.options.sticky){events.mousemove=this._moveTooltip}if(touch){events.click=this._openTooltip}}else{events.add=this._openTooltip}this[onOff](events);this._tooltipHandlersAdded=!remove$$1},openTooltip:function(layer,latlng){if(this._tooltip&&this._map){latlng=this._tooltip._prepareOpen(this,layer,latlng);this._map.openTooltip(this._tooltip,latlng);if(this._tooltip.options.interactive&&this._tooltip._container){addClass(this._tooltip._container,"leaflet-clickable");this.addInteractiveTarget(this._tooltip._container)}}return this},closeTooltip:function(){if(this._tooltip){this._tooltip._close();if(this._tooltip.options.interactive&&this._tooltip._container){removeClass(this._tooltip._container,"leaflet-clickable");this.removeInteractiveTarget(this._tooltip._container)}}return this},toggleTooltip:function(target){if(this._tooltip){if(this._tooltip._map){this.closeTooltip()}else{this.openTooltip(target)}}return this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(content){if(this._tooltip){this._tooltip.setContent(content)}return this},getTooltip:function(){return this._tooltip},_openTooltip:function(e){var layer=e.layer||e.target;if(!this._tooltip||!this._map){return}this.openTooltip(layer,this._tooltip.options.sticky?e.latlng:undefined)},_moveTooltip:function(e){var latlng=e.latlng,containerPoint,layerPoint;if(this._tooltip.options.sticky&&e.originalEvent){containerPoint=this._map.mouseEventToContainerPoint(e.originalEvent);layerPoint=this._map.containerPointToLayerPoint(containerPoint);latlng=this._map.layerPointToLatLng(layerPoint)}this._tooltip.setLatLng(latlng)}});var DivIcon=Icon.extend({options:{iconSize:[12,12],html:false,bgPos:null,className:"leaflet-div-icon"},createIcon:function(oldIcon){var div=oldIcon&&oldIcon.tagName==="DIV"?oldIcon:document.createElement("div"),options=this.options;if(options.html instanceof Element){empty(div);div.appendChild(options.html)}else{div.innerHTML=options.html!==false?options.html:""}if(options.bgPos){var bgPos=toPoint(options.bgPos);div.style.backgroundPosition=-bgPos.x+"px "+-bgPos.y+"px"}this._setIconStyles(div,"icon");return div},createShadow:function(){return null}});function divIcon(options){return new DivIcon(options)}Icon.Default=IconDefault;var GridLayer=Layer.extend({options:{tileSize:256,opacity:1,updateWhenIdle:mobile,updateWhenZooming:true,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:undefined,maxNativeZoom:undefined,minNativeZoom:undefined,noWrap:false,pane:"tilePane",className:"",keepBuffer:2},initialize:function(options){setOptions(this,options)},onAdd:function(){this._initContainer();this._levels={};this._tiles={};this._resetView();this._update()},beforeAdd:function(map){map._addZoomLimit(this)},onRemove:function(map){this._removeAllTiles();remove(this._container);map._removeZoomLimit(this);this._container=null;this._tileZoom=undefined},bringToFront:function(){if(this._map){toFront(this._container);this._setAutoZIndex(Math.max)}return this},bringToBack:function(){if(this._map){toBack(this._container);this._setAutoZIndex(Math.min)}return this},getContainer:function(){return this._container},setOpacity:function(opacity){this.options.opacity=opacity;this._updateOpacity();return this},setZIndex:function(zIndex){this.options.zIndex=zIndex;this._updateZIndex();return this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();this._update()}return this},getEvents:function(){var events={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};if(!this.options.updateWhenIdle){if(!this._onMove){this._onMove=throttle(this._onMoveEnd,this.options.updateInterval,this)}events.move=this._onMove}if(this._zoomAnimated){events.zoomanim=this._animateZoom}return events},createTile:function(){return document.createElement("div")},getTileSize:function(){var s=this.options.tileSize;return s instanceof Point?s:new Point(s,s)},_updateZIndex:function(){if(this._container&&this.options.zIndex!==undefined&&this.options.zIndex!==null){this._container.style.zIndex=this.options.zIndex}},_setAutoZIndex:function(compare){var layers=this.getPane().children,edgeZIndex=-compare(-Infinity,Infinity);for(var i=0,len=layers.length,zIndex;i<len;i++){zIndex=layers[i].style.zIndex;if(layers[i]!==this._container&&zIndex){edgeZIndex=compare(edgeZIndex,+zIndex)}}if(isFinite(edgeZIndex)){this.options.zIndex=edgeZIndex+compare(-1,1);this._updateZIndex()}},_updateOpacity:function(){if(!this._map){return}if(ielt9){return}setOpacity(this._container,this.options.opacity);var now=+new Date,nextFrame=false,willPrune=false;for(var key in this._tiles){var tile=this._tiles[key];if(!tile.current||!tile.loaded){continue}var fade=Math.min(1,(now-tile.loaded)/200);setOpacity(tile.el,fade);if(fade<1){nextFrame=true}else{if(tile.active){willPrune=true}else{this._onOpaqueTile(tile)}tile.active=true}}if(willPrune&&!this._noPrune){this._pruneTiles()}if(nextFrame){cancelAnimFrame(this._fadeFrame);this._fadeFrame=requestAnimFrame(this._updateOpacity,this)}},_onOpaqueTile:falseFn,_initContainer:function(){if(this._container){return}this._container=create$1("div","leaflet-layer "+(this.options.className||""));this._updateZIndex();if(this.options.opacity<1){this._updateOpacity()}this.getPane().appendChild(this._container)},_updateLevels:function(){var zoom=this._tileZoom,maxZoom=this.options.maxZoom;if(zoom===undefined){return undefined}for(var z in this._levels){if(this._levels[z].el.children.length||z===zoom){this._levels[z].el.style.zIndex=maxZoom-Math.abs(zoom-z);this._onUpdateLevel(z)}else{remove(this._levels[z].el);this._removeTilesAtZoom(z);this._onRemoveLevel(z);delete this._levels[z]}}var level=this._levels[zoom],map=this._map;if(!level){level=this._levels[zoom]={};level.el=create$1("div","leaflet-tile-container leaflet-zoom-animated",this._container);level.el.style.zIndex=maxZoom;level.origin=map.project(map.unproject(map.getPixelOrigin()),zoom).round();level.zoom=zoom;this._setZoomTransform(level,map.getCenter(),map.getZoom());falseFn(level.el.offsetWidth);this._onCreateLevel(level)}this._level=level;return level},_onUpdateLevel:falseFn,_onRemoveLevel:falseFn,_onCreateLevel:falseFn,_pruneTiles:function(){if(!this._map){return}var key,tile;var zoom=this._map.getZoom();if(zoom>this.options.maxZoom||zoom<this.options.minZoom){this._removeAllTiles();return}for(key in this._tiles){tile=this._tiles[key];tile.retain=tile.current}for(key in this._tiles){tile=this._tiles[key];if(tile.current&&!tile.active){var coords=tile.coords;if(!this._retainParent(coords.x,coords.y,coords.z,coords.z-5)){this._retainChildren(coords.x,coords.y,coords.z,coords.z+2)}}}for(key in this._tiles){if(!this._tiles[key].retain){this._removeTile(key)}}},_removeTilesAtZoom:function(zoom){for(var key in this._tiles){if(this._tiles[key].coords.z!==zoom){continue}this._removeTile(key)}},_removeAllTiles:function(){for(var key in this._tiles){this._removeTile(key)}},_invalidateAll:function(){for(var z in this._levels){remove(this._levels[z].el);this._onRemoveLevel(z);delete this._levels[z]}this._removeAllTiles();this._tileZoom=undefined},_retainParent:function(x,y,z,minZoom){var x2=Math.floor(x/2),y2=Math.floor(y/2),z2=z-1,coords2=new Point(+x2,+y2);coords2.z=+z2;var key=this._tileCoordsToKey(coords2),tile=this._tiles[key];if(tile&&tile.active){tile.retain=true;return true}else if(tile&&tile.loaded){tile.retain=true}if(z2>minZoom){return this._retainParent(x2,y2,z2,minZoom)}return false},_retainChildren:function(x,y,z,maxZoom){for(var i=2*x;i<2*x+2;i++){for(var j=2*y;j<2*y+2;j++){var coords=new Point(i,j);coords.z=z+1;var key=this._tileCoordsToKey(coords),tile=this._tiles[key];if(tile&&tile.active){tile.retain=true;continue}else if(tile&&tile.loaded){tile.retain=true}if(z+1<maxZoom){this._retainChildren(i,j,z+1,maxZoom)}}}},_resetView:function(e){var animating=e&&(e.pinch||e.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),animating,animating)},_animateZoom:function(e){this._setView(e.center,e.zoom,true,e.noUpdate)},_clampZoom:function(zoom){var options=this.options;if(undefined!==options.minNativeZoom&&zoom<options.minNativeZoom){return options.minNativeZoom}if(undefined!==options.maxNativeZoom&&options.maxNativeZoom<zoom){return options.maxNativeZoom}return zoom},_setView:function(center,zoom,noPrune,noUpdate){var tileZoom=this._clampZoom(Math.round(zoom));if(this.options.maxZoom!==undefined&&tileZoom>this.options.maxZoom||this.options.minZoom!==undefined&&tileZoom<this.options.minZoom){tileZoom=undefined}var tileZoomChanged=this.options.updateWhenZooming&&tileZoom!==this._tileZoom;if(!noUpdate||tileZoomChanged){this._tileZoom=tileZoom;if(this._abortLoading){this._abortLoading()}this._updateLevels();this._resetGrid();if(tileZoom!==undefined){this._update(center)}if(!noPrune){this._pruneTiles()}this._noPrune=!!noPrune}this._setZoomTransforms(center,zoom)},_setZoomTransforms:function(center,zoom){for(var i in this._levels){this._setZoomTransform(this._levels[i],center,zoom)}},_setZoomTransform:function(level,center,zoom){var scale=this._map.getZoomScale(zoom,level.zoom),translate=level.origin.multiplyBy(scale).subtract(this._map._getNewPixelOrigin(center,zoom)).round();if(any3d){setTransform(level.el,translate,scale)}else{setPosition(level.el,translate)}},_resetGrid:function(){var map=this._map,crs=map.options.crs,tileSize=this._tileSize=this.getTileSize(),tileZoom=this._tileZoom;var bounds=this._map.getPixelWorldBounds(this._tileZoom);if(bounds){this._globalTileRange=this._pxBoundsToTileRange(bounds)}this._wrapX=crs.wrapLng&&!this.options.noWrap&&[Math.floor(map.project([0,crs.wrapLng[0]],tileZoom).x/tileSize.x),Math.ceil(map.project([0,crs.wrapLng[1]],tileZoom).x/tileSize.y)];this._wrapY=crs.wrapLat&&!this.options.noWrap&&[Math.floor(map.project([crs.wrapLat[0],0],tileZoom).y/tileSize.x),Math.ceil(map.project([crs.wrapLat[1],0],tileZoom).y/tileSize.y)]},_onMoveEnd:function(){if(!this._map||this._map._animatingZoom){return}this._update()},_getTiledPixelBounds:function(center){var map=this._map,mapZoom=map._animatingZoom?Math.max(map._animateToZoom,map.getZoom()):map.getZoom(),scale=map.getZoomScale(mapZoom,this._tileZoom),pixelCenter=map.project(center,this._tileZoom).floor(),halfSize=map.getSize().divideBy(scale*2);return new Bounds(pixelCenter.subtract(halfSize),pixelCenter.add(halfSize))},_update:function(center){var map=this._map;if(!map){return}var zoom=this._clampZoom(map.getZoom());if(center===undefined){center=map.getCenter()}if(this._tileZoom===undefined){return}var pixelBounds=this._getTiledPixelBounds(center),tileRange=this._pxBoundsToTileRange(pixelBounds),tileCenter=tileRange.getCenter(),queue=[],margin=this.options.keepBuffer,noPruneRange=new Bounds(tileRange.getBottomLeft().subtract([margin,-margin]),tileRange.getTopRight().add([margin,-margin]));if(!(isFinite(tileRange.min.x)&&isFinite(tileRange.min.y)&&isFinite(tileRange.max.x)&&isFinite(tileRange.max.y))){throw new Error("Attempted to load an infinite number of tiles")}for(var key in this._tiles){var c=this._tiles[key].coords;if(c.z!==this._tileZoom||!noPruneRange.contains(new Point(c.x,c.y))){this._tiles[key].current=false}}if(Math.abs(zoom-this._tileZoom)>1){this._setView(center,zoom);return}for(var j=tileRange.min.y;j<=tileRange.max.y;j++){for(var i=tileRange.min.x;i<=tileRange.max.x;i++){var coords=new Point(i,j);coords.z=this._tileZoom;if(!this._isValidTile(coords)){continue}var tile=this._tiles[this._tileCoordsToKey(coords)];if(tile){tile.current=true}else{queue.push(coords)}}}queue.sort(function(a,b){return a.distanceTo(tileCenter)-b.distanceTo(tileCenter)});if(queue.length!==0){if(!this._loading){this._loading=true;this.fire("loading")}var fragment=document.createDocumentFragment();for(i=0;i<queue.length;i++){this._addTile(queue[i],fragment)}this._level.el.appendChild(fragment)}},_isValidTile:function(coords){var crs=this._map.options.crs;if(!crs.infinite){var bounds=this._globalTileRange;if(!crs.wrapLng&&(coords.x<bounds.min.x||coords.x>bounds.max.x)||!crs.wrapLat&&(coords.y<bounds.min.y||coords.y>bounds.max.y)){return false}}if(!this.options.bounds){return true}var tileBounds=this._tileCoordsToBounds(coords);return toLatLngBounds(this.options.bounds).overlaps(tileBounds)},_keyToBounds:function(key){return this._tileCoordsToBounds(this._keyToTileCoords(key))},_tileCoordsToNwSe:function(coords){var map=this._map,tileSize=this.getTileSize(),nwPoint=coords.scaleBy(tileSize),sePoint=nwPoint.add(tileSize),nw=map.unproject(nwPoint,coords.z),se=map.unproject(sePoint,coords.z);return[nw,se]},_tileCoordsToBounds:function(coords){var bp=this._tileCoordsToNwSe(coords),bounds=new LatLngBounds(bp[0],bp[1]);if(!this.options.noWrap){bounds=this._map.wrapLatLngBounds(bounds)}return bounds},_tileCoordsToKey:function(coords){return coords.x+":"+coords.y+":"+coords.z},_keyToTileCoords:function(key){var k=key.split(":"),coords=new Point(+k[0],+k[1]);coords.z=+k[2];return coords},_removeTile:function(key){var tile=this._tiles[key];if(!tile){return}remove(tile.el);delete this._tiles[key];this.fire("tileunload",{tile:tile.el,coords:this._keyToTileCoords(key)})},_initTile:function(tile){addClass(tile,"leaflet-tile");var tileSize=this.getTileSize();tile.style.width=tileSize.x+"px";tile.style.height=tileSize.y+"px";tile.onselectstart=falseFn;tile.onmousemove=falseFn;if(ielt9&&this.options.opacity<1){setOpacity(tile,this.options.opacity)}if(android&&!android23){tile.style.WebkitBackfaceVisibility="hidden"}},_addTile:function(coords,container){var tilePos=this._getTilePos(coords),key=this._tileCoordsToKey(coords);var tile=this.createTile(this._wrapCoords(coords),bind(this._tileReady,this,coords));this._initTile(tile);if(this.createTile.length<2){requestAnimFrame(bind(this._tileReady,this,coords,null,tile))}setPosition(tile,tilePos);this._tiles[key]={el:tile,coords:coords,current:true};container.appendChild(tile);this.fire("tileloadstart",{tile:tile,coords:coords})},_tileReady:function(coords,err,tile){if(err){this.fire("tileerror",{error:err,tile:tile,coords:coords})}var key=this._tileCoordsToKey(coords);tile=this._tiles[key];if(!tile){return}tile.loaded=+new Date;if(this._map._fadeAnimated){setOpacity(tile.el,0);cancelAnimFrame(this._fadeFrame);this._fadeFrame=requestAnimFrame(this._updateOpacity,this)}else{tile.active=true;this._pruneTiles()}if(!err){addClass(tile.el,"leaflet-tile-loaded");this.fire("tileload",{tile:tile.el,coords:coords})}if(this._noTilesToLoad()){this._loading=false;this.fire("load");if(ielt9||!this._map._fadeAnimated){requestAnimFrame(this._pruneTiles,this)}else{setTimeout(bind(this._pruneTiles,this),250)}}},_getTilePos:function(coords){return coords.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(coords){var newCoords=new Point(this._wrapX?wrapNum(coords.x,this._wrapX):coords.x,this._wrapY?wrapNum(coords.y,this._wrapY):coords.y);newCoords.z=coords.z;return newCoords},_pxBoundsToTileRange:function(bounds){var tileSize=this.getTileSize();return new Bounds(bounds.min.unscaleBy(tileSize).floor(),bounds.max.unscaleBy(tileSize).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var key in this._tiles){if(!this._tiles[key].loaded){return false}}return true}});function gridLayer(options){return new GridLayer(options)}var TileLayer=GridLayer.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:false,zoomReverse:false,detectRetina:false,crossOrigin:false},initialize:function(url,options){this._url=url;options=setOptions(this,options);if(options.detectRetina&&retina&&options.maxZoom>0){options.tileSize=Math.floor(options.tileSize/2);if(!options.zoomReverse){options.zoomOffset++;options.maxZoom--}else{options.zoomOffset--;options.minZoom++}options.minZoom=Math.max(0,options.minZoom)}if(typeof options.subdomains==="string"){options.subdomains=options.subdomains.split("")}if(!android){this.on("tileunload",this._onTileRemove)}},setUrl:function(url,noRedraw){if(this._url===url&&noRedraw===undefined){noRedraw=true}this._url=url;if(!noRedraw){this.redraw()}return this},createTile:function(coords,done){var tile=document.createElement("img");on(tile,"load",bind(this._tileOnLoad,this,done,tile));on(tile,"error",bind(this._tileOnError,this,done,tile));if(this.options.crossOrigin||this.options.crossOrigin===""){tile.crossOrigin=this.options.crossOrigin===true?"":this.options.crossOrigin}tile.alt="";tile.setAttribute("role","presentation");tile.src=this.getTileUrl(coords);return tile},getTileUrl:function(coords){var data={r:retina?"@2x":"",s:this._getSubdomain(coords),x:coords.x,y:coords.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var invertedY=this._globalTileRange.max.y-coords.y;if(this.options.tms){data["y"]=invertedY}data["-y"]=invertedY}return template(this._url,extend(data,this.options))},_tileOnLoad:function(done,tile){if(ielt9){setTimeout(bind(done,this,null,tile),0)}else{done(null,tile)}},_tileOnError:function(done,tile,e){var errorUrl=this.options.errorTileUrl;if(errorUrl&&tile.getAttribute("src")!==errorUrl){tile.src=errorUrl}done(e,tile)},_onTileRemove:function(e){e.tile.onload=null},_getZoomForUrl:function(){var zoom=this._tileZoom,maxZoom=this.options.maxZoom,zoomReverse=this.options.zoomReverse,zoomOffset=this.options.zoomOffset;if(zoomReverse){zoom=maxZoom-zoom}return zoom+zoomOffset},_getSubdomain:function(tilePoint){var index=Math.abs(tilePoint.x+tilePoint.y)%this.options.subdomains.length;return this.options.subdomains[index]},_abortLoading:function(){var i,tile;for(i in this._tiles){if(this._tiles[i].coords.z!==this._tileZoom){tile=this._tiles[i].el;tile.onload=falseFn;tile.onerror=falseFn;if(!tile.complete){tile.src=emptyImageUrl;remove(tile);delete this._tiles[i]}}}},_removeTile:function(key){var tile=this._tiles[key];if(!tile){return}if(!androidStock){tile.el.setAttribute("src",emptyImageUrl)}return GridLayer.prototype._removeTile.call(this,key)},_tileReady:function(coords,err,tile){if(!this._map||tile&&tile.getAttribute("src")===emptyImageUrl){return}return GridLayer.prototype._tileReady.call(this,coords,err,tile)}});function tileLayer(url,options){return new TileLayer(url,options)}var TileLayerWMS=TileLayer.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:false,version:"1.1.1"},options:{crs:null,uppercase:false},initialize:function(url,options){this._url=url;var wmsParams=extend({},this.defaultWmsParams);for(var i in options){if(!(i in this.options)){wmsParams[i]=options[i]}}options=setOptions(this,options);var realRetina=options.detectRetina&&retina?2:1;var tileSize=this.getTileSize();wmsParams.width=tileSize.x*realRetina;wmsParams.height=tileSize.y*realRetina;this.wmsParams=wmsParams},onAdd:function(map){this._crs=this.options.crs||map.options.crs;this._wmsVersion=parseFloat(this.wmsParams.version);var projectionKey=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[projectionKey]=this._crs.code;TileLayer.prototype.onAdd.call(this,map)},getTileUrl:function(coords){var tileBounds=this._tileCoordsToNwSe(coords),crs=this._crs,bounds=toBounds(crs.project(tileBounds[0]),crs.project(tileBounds[1])),min=bounds.min,max=bounds.max,bbox=(this._wmsVersion>=1.3&&this._crs===EPSG4326?[min.y,min.x,max.y,max.x]:[min.x,min.y,max.x,max.y]).join(","),url=TileLayer.prototype.getTileUrl.call(this,coords);return url+getParamString(this.wmsParams,url,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+bbox},setParams:function(params,noRedraw){extend(this.wmsParams,params);if(!noRedraw){this.redraw()}return this}});function tileLayerWMS(url,options){return new TileLayerWMS(url,options)}TileLayer.WMS=TileLayerWMS;tileLayer.wms=tileLayerWMS;var Renderer=Layer.extend({options:{padding:.1,tolerance:0},initialize:function(options){setOptions(this,options);stamp(this);this._layers=this._layers||{}},onAdd:function(){if(!this._container){this._initContainer();if(this._zoomAnimated){addClass(this._container,"leaflet-zoom-animated")}}this.getPane().appendChild(this._container);this._update();this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this);this._destroyContainer()},getEvents:function(){var events={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};if(this._zoomAnimated){events.zoomanim=this._onAnimZoom}return events},_onAnimZoom:function(ev){this._updateTransform(ev.center,ev.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(center,zoom){var scale=this._map.getZoomScale(zoom,this._zoom),position=getPosition(this._container),viewHalf=this._map.getSize().multiplyBy(.5+this.options.padding),currentCenterPoint=this._map.project(this._center,zoom),destCenterPoint=this._map.project(center,zoom),centerOffset=destCenterPoint.subtract(currentCenterPoint),topLeftOffset=viewHalf.multiplyBy(-scale).add(position).add(viewHalf).subtract(centerOffset);if(any3d){setTransform(this._container,topLeftOffset,scale)}else{setPosition(this._container,topLeftOffset)}},_reset:function(){this._update();this._updateTransform(this._center,this._zoom);for(var id in this._layers){this._layers[id]._reset()}},_onZoomEnd:function(){for(var id in this._layers){this._layers[id]._project()}},_updatePaths:function(){for(var id in this._layers){this._layers[id]._update()}},_update:function(){var p=this.options.padding,size=this._map.getSize(),min=this._map.containerPointToLayerPoint(size.multiplyBy(-p)).round();this._bounds=new Bounds(min,min.add(size.multiplyBy(1+p*2)).round());this._center=this._map.getCenter();this._zoom=this._map.getZoom()}});var Canvas=Renderer.extend({getEvents:function(){var events=Renderer.prototype.getEvents.call(this);events.viewprereset=this._onViewPreReset;return events},_onViewPreReset:function(){this._postponeUpdatePaths=true},onAdd:function(){Renderer.prototype.onAdd.call(this);this._draw()},_initContainer:function(){var container=this._container=document.createElement("canvas");on(container,"mousemove",this._onMouseMove,this);on(container,"click dblclick mousedown mouseup contextmenu",this._onClick,this);on(container,"mouseout",this._handleMouseOut,this);this._ctx=container.getContext("2d")},_destroyContainer:function(){cancelAnimFrame(this._redrawRequest);delete this._ctx;remove(this._container);off(this._container);delete this._container},_updatePaths:function(){if(this._postponeUpdatePaths){return}var layer;this._redrawBounds=null;for(var id in this._layers){layer=this._layers[id];layer._update()}this._redraw()},_update:function(){if(this._map._animatingZoom&&this._bounds){return}Renderer.prototype._update.call(this);var b=this._bounds,container=this._container,size=b.getSize(),m=retina?2:1;setPosition(container,b.min);container.width=m*size.x;container.height=m*size.y;container.style.width=size.x+"px";container.style.height=size.y+"px";if(retina){this._ctx.scale(2,2)}this._ctx.translate(-b.min.x,-b.min.y);this.fire("update")},_reset:function(){Renderer.prototype._reset.call(this);if(this._postponeUpdatePaths){this._postponeUpdatePaths=false;this._updatePaths()}},_initPath:function(layer){this._updateDashArray(layer);this._layers[stamp(layer)]=layer;var order=layer._order={layer:layer,prev:this._drawLast,next:null};if(this._drawLast){this._drawLast.next=order}this._drawLast=order;this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(layer){this._requestRedraw(layer)},_removePath:function(layer){var order=layer._order;var next=order.next;var prev=order.prev;if(next){next.prev=prev}else{this._drawLast=prev}if(prev){prev.next=next}else{this._drawFirst=next}delete layer._order;delete this._layers[stamp(layer)];this._requestRedraw(layer)},_updatePath:function(layer){this._extendRedrawBounds(layer);layer._project();layer._update();this._requestRedraw(layer)},_updateStyle:function(layer){this._updateDashArray(layer);this._requestRedraw(layer)},_updateDashArray:function(layer){if(typeof layer.options.dashArray==="string"){var parts=layer.options.dashArray.split(/[, ]+/),dashArray=[],dashValue,i;for(i=0;i<parts.length;i++){dashValue=Number(parts[i]);if(isNaN(dashValue)){return}dashArray.push(dashValue)}layer.options._dashArray=dashArray}else{layer.options._dashArray=layer.options.dashArray}},_requestRedraw:function(layer){if(!this._map){return}this._extendRedrawBounds(layer);this._redrawRequest=this._redrawRequest||requestAnimFrame(this._redraw,this)},_extendRedrawBounds:function(layer){if(layer._pxBounds){var padding=(layer.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new Bounds;this._redrawBounds.extend(layer._pxBounds.min.subtract([padding,padding]));this._redrawBounds.extend(layer._pxBounds.max.add([padding,padding]))}},_redraw:function(){this._redrawRequest=null;if(this._redrawBounds){this._redrawBounds.min._floor();this._redrawBounds.max._ceil()}this._clear();this._draw();
this._redrawBounds=null},_clear:function(){var bounds=this._redrawBounds;if(bounds){var size=bounds.getSize();this._ctx.clearRect(bounds.min.x,bounds.min.y,size.x,size.y)}else{this._ctx.clearRect(0,0,this._container.width,this._container.height)}},_draw:function(){var layer,bounds=this._redrawBounds;this._ctx.save();if(bounds){var size=bounds.getSize();this._ctx.beginPath();this._ctx.rect(bounds.min.x,bounds.min.y,size.x,size.y);this._ctx.clip()}this._drawing=true;for(var order=this._drawFirst;order;order=order.next){layer=order.layer;if(!bounds||layer._pxBounds&&layer._pxBounds.intersects(bounds)){layer._updatePath()}}this._drawing=false;this._ctx.restore()},_updatePoly:function(layer,closed){if(!this._drawing){return}var i,j,len2,p,parts=layer._parts,len=parts.length,ctx=this._ctx;if(!len){return}ctx.beginPath();for(i=0;i<len;i++){for(j=0,len2=parts[i].length;j<len2;j++){p=parts[i][j];ctx[j?"lineTo":"moveTo"](p.x,p.y)}if(closed){ctx.closePath()}}this._fillStroke(ctx,layer)},_updateCircle:function(layer){if(!this._drawing||layer._empty()){return}var p=layer._point,ctx=this._ctx,r=Math.max(Math.round(layer._radius),1),s=(Math.max(Math.round(layer._radiusY),1)||r)/r;if(s!==1){ctx.save();ctx.scale(1,s)}ctx.beginPath();ctx.arc(p.x,p.y/s,r,0,Math.PI*2,false);if(s!==1){ctx.restore()}this._fillStroke(ctx,layer)},_fillStroke:function(ctx,layer){var options=layer.options;if(options.fill){ctx.globalAlpha=options.fillOpacity;ctx.fillStyle=options.fillColor||options.color;ctx.fill(options.fillRule||"evenodd")}if(options.stroke&&options.weight!==0){if(ctx.setLineDash){ctx.setLineDash(layer.options&&layer.options._dashArray||[])}ctx.globalAlpha=options.opacity;ctx.lineWidth=options.weight;ctx.strokeStyle=options.color;ctx.lineCap=options.lineCap;ctx.lineJoin=options.lineJoin;ctx.stroke()}},_onClick:function(e){var point=this._map.mouseEventToLayerPoint(e),layer,clickedLayer;for(var order=this._drawFirst;order;order=order.next){layer=order.layer;if(layer.options.interactive&&layer._containsPoint(point)&&!this._map._draggableMoved(layer)){clickedLayer=layer}}if(clickedLayer){fakeStop(e);this._fireEvent([clickedLayer],e)}},_onMouseMove:function(e){if(!this._map||this._map.dragging.moving()||this._map._animatingZoom){return}var point=this._map.mouseEventToLayerPoint(e);this._handleMouseHover(e,point)},_handleMouseOut:function(e){var layer=this._hoveredLayer;if(layer){removeClass(this._container,"leaflet-interactive");this._fireEvent([layer],e,"mouseout");this._hoveredLayer=null;this._mouseHoverThrottled=false}},_handleMouseHover:function(e,point){if(this._mouseHoverThrottled){return}var layer,candidateHoveredLayer;for(var order=this._drawFirst;order;order=order.next){layer=order.layer;if(layer.options.interactive&&layer._containsPoint(point)){candidateHoveredLayer=layer}}if(candidateHoveredLayer!==this._hoveredLayer){this._handleMouseOut(e);if(candidateHoveredLayer){addClass(this._container,"leaflet-interactive");this._fireEvent([candidateHoveredLayer],e,"mouseover");this._hoveredLayer=candidateHoveredLayer}}if(this._hoveredLayer){this._fireEvent([this._hoveredLayer],e)}this._mouseHoverThrottled=true;setTimeout(L.bind(function(){this._mouseHoverThrottled=false},this),32)},_fireEvent:function(layers,e,type){this._map._fireDOMEvent(e,type||e.type,layers)},_bringToFront:function(layer){var order=layer._order;if(!order){return}var next=order.next;var prev=order.prev;if(next){next.prev=prev}else{return}if(prev){prev.next=next}else if(next){this._drawFirst=next}order.prev=this._drawLast;this._drawLast.next=order;order.next=null;this._drawLast=order;this._requestRedraw(layer)},_bringToBack:function(layer){var order=layer._order;if(!order){return}var next=order.next;var prev=order.prev;if(prev){prev.next=next}else{return}if(next){next.prev=prev}else if(prev){this._drawLast=prev}order.prev=null;order.next=this._drawFirst;this._drawFirst.prev=order;this._drawFirst=order;this._requestRedraw(layer)}});function canvas$1(options){return canvas?new Canvas(options):null}var vmlCreate=function(){try{document.namespaces.add("lvml","urn:schemas-microsoft-com:vml");return function(name){return document.createElement("<lvml:"+name+' class="lvml">')}}catch(e){return function(name){return document.createElement("<"+name+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}();var vmlMixin={_initContainer:function(){this._container=create$1("div","leaflet-vml-container")},_update:function(){if(this._map._animatingZoom){return}Renderer.prototype._update.call(this);this.fire("update")},_initPath:function(layer){var container=layer._container=vmlCreate("shape");addClass(container,"leaflet-vml-shape "+(this.options.className||""));container.coordsize="1 1";layer._path=vmlCreate("path");container.appendChild(layer._path);this._updateStyle(layer);this._layers[stamp(layer)]=layer},_addPath:function(layer){var container=layer._container;this._container.appendChild(container);if(layer.options.interactive){layer.addInteractiveTarget(container)}},_removePath:function(layer){var container=layer._container;remove(container);layer.removeInteractiveTarget(container);delete this._layers[stamp(layer)]},_updateStyle:function(layer){var stroke=layer._stroke,fill=layer._fill,options=layer.options,container=layer._container;container.stroked=!!options.stroke;container.filled=!!options.fill;if(options.stroke){if(!stroke){stroke=layer._stroke=vmlCreate("stroke")}container.appendChild(stroke);stroke.weight=options.weight+"px";stroke.color=options.color;stroke.opacity=options.opacity;if(options.dashArray){stroke.dashStyle=isArray(options.dashArray)?options.dashArray.join(" "):options.dashArray.replace(/( *, *)/g," ")}else{stroke.dashStyle=""}stroke.endcap=options.lineCap.replace("butt","flat");stroke.joinstyle=options.lineJoin}else if(stroke){container.removeChild(stroke);layer._stroke=null}if(options.fill){if(!fill){fill=layer._fill=vmlCreate("fill")}container.appendChild(fill);fill.color=options.fillColor||options.color;fill.opacity=options.fillOpacity}else if(fill){container.removeChild(fill);layer._fill=null}},_updateCircle:function(layer){var p=layer._point.round(),r=Math.round(layer._radius),r2=Math.round(layer._radiusY||r);this._setPath(layer,layer._empty()?"M0 0":"AL "+p.x+","+p.y+" "+r+","+r2+" 0,"+65535*360)},_setPath:function(layer,path){layer._path.v=path},_bringToFront:function(layer){toFront(layer._container)},_bringToBack:function(layer){toBack(layer._container)}};var create$2=vml?vmlCreate:svgCreate;var SVG=Renderer.extend({getEvents:function(){var events=Renderer.prototype.getEvents.call(this);events.zoomstart=this._onZoomStart;return events},_initContainer:function(){this._container=create$2("svg");this._container.setAttribute("pointer-events","none");this._rootGroup=create$2("g");this._container.appendChild(this._rootGroup)},_destroyContainer:function(){remove(this._container);off(this._container);delete this._container;delete this._rootGroup;delete this._svgSize},_onZoomStart:function(){this._update()},_update:function(){if(this._map._animatingZoom&&this._bounds){return}Renderer.prototype._update.call(this);var b=this._bounds,size=b.getSize(),container=this._container;if(!this._svgSize||!this._svgSize.equals(size)){this._svgSize=size;container.setAttribute("width",size.x);container.setAttribute("height",size.y)}setPosition(container,b.min);container.setAttribute("viewBox",[b.min.x,b.min.y,size.x,size.y].join(" "));this.fire("update")},_initPath:function(layer){var path=layer._path=create$2("path");if(layer.options.className){addClass(path,layer.options.className)}if(layer.options.interactive){addClass(path,"leaflet-interactive")}this._updateStyle(layer);this._layers[stamp(layer)]=layer},_addPath:function(layer){if(!this._rootGroup){this._initContainer()}this._rootGroup.appendChild(layer._path);layer.addInteractiveTarget(layer._path)},_removePath:function(layer){remove(layer._path);layer.removeInteractiveTarget(layer._path);delete this._layers[stamp(layer)]},_updatePath:function(layer){layer._project();layer._update()},_updateStyle:function(layer){var path=layer._path,options=layer.options;if(!path){return}if(options.stroke){path.setAttribute("stroke",options.color);path.setAttribute("stroke-opacity",options.opacity);path.setAttribute("stroke-width",options.weight);path.setAttribute("stroke-linecap",options.lineCap);path.setAttribute("stroke-linejoin",options.lineJoin);if(options.dashArray){path.setAttribute("stroke-dasharray",options.dashArray)}else{path.removeAttribute("stroke-dasharray")}if(options.dashOffset){path.setAttribute("stroke-dashoffset",options.dashOffset)}else{path.removeAttribute("stroke-dashoffset")}}else{path.setAttribute("stroke","none")}if(options.fill){path.setAttribute("fill",options.fillColor||options.color);path.setAttribute("fill-opacity",options.fillOpacity);path.setAttribute("fill-rule",options.fillRule||"evenodd")}else{path.setAttribute("fill","none")}},_updatePoly:function(layer,closed){this._setPath(layer,pointsToPath(layer._parts,closed))},_updateCircle:function(layer){var p=layer._point,r=Math.max(Math.round(layer._radius),1),r2=Math.max(Math.round(layer._radiusY),1)||r,arc="a"+r+","+r2+" 0 1,0 ";var d=layer._empty()?"M0 0":"M"+(p.x-r)+","+p.y+arc+r*2+",0 "+arc+-r*2+",0 ";this._setPath(layer,d)},_setPath:function(layer,path){layer._path.setAttribute("d",path)},_bringToFront:function(layer){toFront(layer._path)},_bringToBack:function(layer){toBack(layer._path)}});if(vml){SVG.include(vmlMixin)}function svg$1(options){return svg||vml?new SVG(options):null}Map.include({getRenderer:function(layer){var renderer=layer.options.renderer||this._getPaneRenderer(layer.options.pane)||this.options.renderer||this._renderer;if(!renderer){renderer=this._renderer=this._createRenderer()}if(!this.hasLayer(renderer)){this.addLayer(renderer)}return renderer},_getPaneRenderer:function(name){if(name==="overlayPane"||name===undefined){return false}var renderer=this._paneRenderers[name];if(renderer===undefined){renderer=this._createRenderer({pane:name});this._paneRenderers[name]=renderer}return renderer},_createRenderer:function(options){return this.options.preferCanvas&&canvas$1(options)||svg$1(options)}});var Rectangle=Polygon.extend({initialize:function(latLngBounds,options){Polygon.prototype.initialize.call(this,this._boundsToLatLngs(latLngBounds),options)},setBounds:function(latLngBounds){return this.setLatLngs(this._boundsToLatLngs(latLngBounds))},_boundsToLatLngs:function(latLngBounds){latLngBounds=toLatLngBounds(latLngBounds);return[latLngBounds.getSouthWest(),latLngBounds.getNorthWest(),latLngBounds.getNorthEast(),latLngBounds.getSouthEast()]}});function rectangle(latLngBounds,options){return new Rectangle(latLngBounds,options)}SVG.create=create$2;SVG.pointsToPath=pointsToPath;GeoJSON.geometryToLayer=geometryToLayer;GeoJSON.coordsToLatLng=coordsToLatLng;GeoJSON.coordsToLatLngs=coordsToLatLngs;GeoJSON.latLngToCoords=latLngToCoords;GeoJSON.latLngsToCoords=latLngsToCoords;GeoJSON.getFeature=getFeature;GeoJSON.asFeature=asFeature;Map.mergeOptions({boxZoom:true});var BoxZoom=Handler.extend({initialize:function(map){this._map=map;this._container=map._container;this._pane=map._panes.overlayPane;this._resetStateTimeout=0;map.on("unload",this._destroy,this)},addHooks:function(){on(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){off(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){remove(this._pane);delete this._pane},_resetState:function(){this._resetStateTimeout=0;this._moved=false},_clearDeferredResetState:function(){if(this._resetStateTimeout!==0){clearTimeout(this._resetStateTimeout);this._resetStateTimeout=0}},_onMouseDown:function(e){if(!e.shiftKey||e.which!==1&&e.button!==1){return false}this._clearDeferredResetState();this._resetState();disableTextSelection();disableImageDrag();this._startPoint=this._map.mouseEventToContainerPoint(e);on(document,{contextmenu:stop,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(e){if(!this._moved){this._moved=true;this._box=create$1("div","leaflet-zoom-box",this._container);addClass(this._container,"leaflet-crosshair");this._map.fire("boxzoomstart")}this._point=this._map.mouseEventToContainerPoint(e);var bounds=new Bounds(this._point,this._startPoint),size=bounds.getSize();setPosition(this._box,bounds.min);this._box.style.width=size.x+"px";this._box.style.height=size.y+"px"},_finish:function(){if(this._moved){remove(this._box);removeClass(this._container,"leaflet-crosshair")}enableTextSelection();enableImageDrag();off(document,{contextmenu:stop,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(e){if(e.which!==1&&e.button!==1){return}this._finish();if(!this._moved){return}this._clearDeferredResetState();this._resetStateTimeout=setTimeout(bind(this._resetState,this),0);var bounds=new LatLngBounds(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(bounds).fire("boxzoomend",{boxZoomBounds:bounds})},_onKeyDown:function(e){if(e.keyCode===27){this._finish()}}});Map.addInitHook("addHandler","boxZoom",BoxZoom);Map.mergeOptions({doubleClickZoom:true});var DoubleClickZoom=Handler.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(e){var map=this._map,oldZoom=map.getZoom(),delta=map.options.zoomDelta,zoom=e.originalEvent.shiftKey?oldZoom-delta:oldZoom+delta;if(map.options.doubleClickZoom==="center"){map.setZoom(zoom)}else{map.setZoomAround(e.containerPoint,zoom)}}});Map.addInitHook("addHandler","doubleClickZoom",DoubleClickZoom);Map.mergeOptions({dragging:true,inertia:!android23,inertiaDeceleration:3400,inertiaMaxSpeed:Infinity,easeLinearity:.2,worldCopyJump:false,maxBoundsViscosity:0});var Drag=Handler.extend({addHooks:function(){if(!this._draggable){var map=this._map;this._draggable=new Draggable(map._mapPane,map._container);this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this);this._draggable.on("predrag",this._onPreDragLimit,this);if(map.options.worldCopyJump){this._draggable.on("predrag",this._onPreDragWrap,this);map.on("zoomend",this._onZoomEnd,this);map.whenReady(this._onZoomEnd,this)}}addClass(this._map._container,"leaflet-grab leaflet-touch-drag");this._draggable.enable();this._positions=[];this._times=[]},removeHooks:function(){removeClass(this._map._container,"leaflet-grab");removeClass(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 map=this._map;map._stop();if(this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var bounds=toLatLngBounds(this._map.options.maxBounds);this._offsetLimit=toBounds(this._map.latLngToContainerPoint(bounds.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(bounds.getSouthEast()).multiplyBy(-1).add(this._map.getSize()));this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else{this._offsetLimit=null}map.fire("movestart").fire("dragstart");if(map.options.inertia){this._positions=[];this._times=[]}},_onDrag:function(e){if(this._map.options.inertia){var time=this._lastTime=+new Date,pos=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(pos);this._times.push(time);this._prunePositions(time)}this._map.fire("move",e).fire("drag",e)},_prunePositions:function(time){while(this._positions.length>1&&time-this._times[0]>50){this._positions.shift();this._times.shift()}},_onZoomEnd:function(){var pxCenter=this._map.getSize().divideBy(2),pxWorldCenter=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=pxWorldCenter.subtract(pxCenter).x;this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(value,threshold){return value-(value-threshold)*this._viscosity},_onPreDragLimit:function(){if(!this._viscosity||!this._offsetLimit){return}var offset=this._draggable._newPos.subtract(this._draggable._startPos);var limit=this._offsetLimit;if(offset.x<limit.min.x){offset.x=this._viscousLimit(offset.x,limit.min.x)}if(offset.y<limit.min.y){offset.y=this._viscousLimit(offset.y,limit.min.y)}if(offset.x>limit.max.x){offset.x=this._viscousLimit(offset.x,limit.max.x)}if(offset.y>limit.max.y){offset.y=this._viscousLimit(offset.y,limit.max.y)}this._draggable._newPos=this._draggable._startPos.add(offset)},_onPreDragWrap:function(){var worldWidth=this._worldWidth,halfWidth=Math.round(worldWidth/2),dx=this._initialWorldOffset,x=this._draggable._newPos.x,newX1=(x-halfWidth+dx)%worldWidth+halfWidth-dx,newX2=(x+halfWidth+dx)%worldWidth-halfWidth-dx,newX=Math.abs(newX1+dx)<Math.abs(newX2+dx)?newX1:newX2;this._draggable._absPos=this._draggable._newPos.clone();this._draggable._newPos.x=newX},_onDragEnd:function(e){var map=this._map,options=map.options,noInertia=!options.inertia||this._times.length<2;map.fire("dragend",e);if(noInertia){map.fire("moveend")}else{this._prunePositions(+new Date);var direction=this._lastPos.subtract(this._positions[0]),duration=(this._lastTime-this._times[0])/1e3,ease=options.easeLinearity,speedVector=direction.multiplyBy(ease/duration),speed=speedVector.distanceTo([0,0]),limitedSpeed=Math.min(options.inertiaMaxSpeed,speed),limitedSpeedVector=speedVector.multiplyBy(limitedSpeed/speed),decelerationDuration=limitedSpeed/(options.inertiaDeceleration*ease),offset=limitedSpeedVector.multiplyBy(-decelerationDuration/2).round();if(!offset.x&&!offset.y){map.fire("moveend")}else{offset=map._limitOffset(offset,map.options.maxBounds);requestAnimFrame(function(){map.panBy(offset,{duration:decelerationDuration,easeLinearity:ease,noMoveStart:true,animate:true})})}}}});Map.addInitHook("addHandler","dragging",Drag);Map.mergeOptions({keyboard:true,keyboardPanDelta:80});var Keyboard=Handler.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(map){this._map=map;this._setPanDelta(map.options.keyboardPanDelta);this._setZoomDelta(map.options.zoomDelta)},addHooks:function(){var container=this._map._container;if(container.tabIndex<=0){container.tabIndex="0"}on(container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this);this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks();off(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){return}var body=document.body,docEl=document.documentElement,top=body.scrollTop||docEl.scrollTop,left=body.scrollLeft||docEl.scrollLeft;this._map._container.focus();window.scrollTo(left,top)},_onFocus:function(){this._focused=true;this._map.fire("focus")},_onBlur:function(){this._focused=false;this._map.fire("blur")},_setPanDelta:function(panDelta){var keys=this._panKeys={},codes=this.keyCodes,i,len;for(i=0,len=codes.left.length;i<len;i++){keys[codes.left[i]]=[-1*panDelta,0]}for(i=0,len=codes.right.length;i<len;i++){keys[codes.right[i]]=[panDelta,0]}for(i=0,len=codes.down.length;i<len;i++){keys[codes.down[i]]=[0,panDelta]}for(i=0,len=codes.up.length;i<len;i++){keys[codes.up[i]]=[0,-1*panDelta]}},_setZoomDelta:function(zoomDelta){var keys=this._zoomKeys={},codes=this.keyCodes,i,len;for(i=0,len=codes.zoomIn.length;i<len;i++){keys[codes.zoomIn[i]]=zoomDelta}for(i=0,len=codes.zoomOut.length;i<len;i++){keys[codes.zoomOut[i]]=-zoomDelta}},_addHooks:function(){on(document,"keydown",this._onKeyDown,this)},_removeHooks:function(){off(document,"keydown",this._onKeyDown,this)},_onKeyDown:function(e){if(e.altKey||e.ctrlKey||e.metaKey){return}var key=e.keyCode,map=this._map,offset;if(key in this._panKeys){if(!map._panAnim||!map._panAnim._inProgress){offset=this._panKeys[key];if(e.shiftKey){offset=toPoint(offset).multiplyBy(3)}map.panBy(offset);if(map.options.maxBounds){map.panInsideBounds(map.options.maxBounds)}}}else if(key in this._zoomKeys){map.setZoom(map.getZoom()+(e.shiftKey?3:1)*this._zoomKeys[key])}else if(key===27&&map._popup&&map._popup.options.closeOnEscapeKey){map.closePopup()}else{return}stop(e)}});Map.addInitHook("addHandler","keyboard",Keyboard);Map.mergeOptions({scrollWheelZoom:true,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var ScrollWheelZoom=Handler.extend({addHooks:function(){on(this._map._container,"mousewheel",this._onWheelScroll,this);this._delta=0},removeHooks:function(){off(this._map._container,"mousewheel",this._onWheelScroll,this)},_onWheelScroll:function(e){var delta=getWheelDelta(e);var debounce=this._map.options.wheelDebounceTime;this._delta+=delta;this._lastMousePos=this._map.mouseEventToContainerPoint(e);if(!this._startTime){this._startTime=+new Date}var left=Math.max(debounce-(+new Date-this._startTime),0);clearTimeout(this._timer);this._timer=setTimeout(bind(this._performZoom,this),left);stop(e)},_performZoom:function(){var map=this._map,zoom=map.getZoom(),snap=this._map.options.zoomSnap||0;map._stop();var d2=this._delta/(this._map.options.wheelPxPerZoomLevel*4),d3=4*Math.log(2/(1+Math.exp(-Math.abs(d2))))/Math.LN2,d4=snap?Math.ceil(d3/snap)*snap:d3,delta=map._limitZoom(zoom+(this._delta>0?d4:-d4))-zoom;this._delta=0;this._startTime=null;if(!delta){return}if(map.options.scrollWheelZoom==="center"){map.setZoom(zoom+delta)}else{map.setZoomAround(this._lastMousePos,zoom+delta)}}});Map.addInitHook("addHandler","scrollWheelZoom",ScrollWheelZoom);Map.mergeOptions({tap:true,tapTolerance:15});var Tap=Handler.extend({addHooks:function(){on(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){off(this._map._container,"touchstart",this._onDown,this)},_onDown:function(e){if(!e.touches){return}preventDefault(e);this._fireClick=true;if(e.touches.length>1){this._fireClick=false;clearTimeout(this._holdTimeout);return}var first=e.touches[0],el=first.target;this._startPos=this._newPos=new Point(first.clientX,first.clientY);if(el.tagName&&el.tagName.toLowerCase()==="a"){addClass(el,"leaflet-active")}this._holdTimeout=setTimeout(bind(function(){if(this._isTapValid()){this._fireClick=false;this._onUp();this._simulateEvent("contextmenu",first)}},this),1e3);this._simulateEvent("mousedown",first);on(document,{touchmove:this._onMove,touchend:this._onUp},this)},_onUp:function(e){clearTimeout(this._holdTimeout);off(document,{touchmove:this._onMove,touchend:this._onUp},this);if(this._fireClick&&e&&e.changedTouches){var first=e.changedTouches[0],el=first.target;if(el&&el.tagName&&el.tagName.toLowerCase()==="a"){removeClass(el,"leaflet-active")}this._simulateEvent("mouseup",first);if(this._isTapValid()){this._simulateEvent("click",first)}}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(e){var first=e.touches[0];this._newPos=new Point(first.clientX,first.clientY);this._simulateEvent("mousemove",first)},_simulateEvent:function(type,e){var simulatedEvent=document.createEvent("MouseEvents");simulatedEvent._simulated=true;e.target._simulatedClick=true;simulatedEvent.initMouseEvent(type,true,true,window,1,e.screenX,e.screenY,e.clientX,e.clientY,false,false,false,false,0,null);e.target.dispatchEvent(simulatedEvent)}});if(touch&&!pointer){Map.addInitHook("addHandler","tap",Tap)}Map.mergeOptions({touchZoom:touch&&!android23,bounceAtZoomLimits:true});var TouchZoom=Handler.extend({addHooks:function(){addClass(this._map._container,"leaflet-touch-zoom");on(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){removeClass(this._map._container,"leaflet-touch-zoom");off(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(e){var map=this._map;if(!e.touches||e.touches.length!==2||map._animatingZoom||this._zooming){return}var p1=map.mouseEventToContainerPoint(e.touches[0]),p2=map.mouseEventToContainerPoint(e.touches[1]);this._centerPoint=map.getSize()._divideBy(2);this._startLatLng=map.containerPointToLatLng(this._centerPoint);if(map.options.touchZoom!=="center"){this._pinchStartLatLng=map.containerPointToLatLng(p1.add(p2)._divideBy(2))}this._startDist=p1.distanceTo(p2);this._startZoom=map.getZoom();this._moved=false;this._zooming=true;map._stop();on(document,"touchmove",this._onTouchMove,this);on(document,"touchend",this._onTouchEnd,this);preventDefault(e)},_onTouchMove:function(e){if(!e.touches||e.touches.length!==2||!this._zooming){return}var map=this._map,p1=map.mouseEventToContainerPoint(e.touches[0]),p2=map.mouseEventToContainerPoint(e.touches[1]),scale=p1.distanceTo(p2)/this._startDist;this._zoom=map.getScaleZoom(scale,this._startZoom);if(!map.options.bounceAtZoomLimits&&(this._zoom<map.getMinZoom()&&scale<1||this._zoom>map.getMaxZoom()&&scale>1)){this._zoom=map._limitZoom(this._zoom)}if(map.options.touchZoom==="center"){this._center=this._startLatLng;if(scale===1){return}}else{var delta=p1._add(p2)._divideBy(2)._subtract(this._centerPoint);if(scale===1&&delta.x===0&&delta.y===0){return}this._center=map.unproject(map.project(this._pinchStartLatLng,this._zoom).subtract(delta),this._zoom)}if(!this._moved){map._moveStart(true,false);this._moved=true}cancelAnimFrame(this._animRequest);var moveFn=bind(map._move,map,this._center,this._zoom,{pinch:true,round:false});this._animRequest=requestAnimFrame(moveFn,this,true);preventDefault(e)},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=false;return}this._zooming=false;cancelAnimFrame(this._animRequest);off(document,"touchmove",this._onTouchMove);off(document,"touchend",this._onTouchEnd);if(this._map.options.zoomAnimation){this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),true,this._map.options.zoomSnap)}else{this._map._resetView(this._center,this._map._limitZoom(this._zoom))}}});Map.addInitHook("addHandler","touchZoom",TouchZoom);Map.BoxZoom=BoxZoom;Map.DoubleClickZoom=DoubleClickZoom;Map.Drag=Drag;Map.Keyboard=Keyboard;Map.ScrollWheelZoom=ScrollWheelZoom;Map.Tap=Tap;Map.TouchZoom=TouchZoom;Object.freeze=freeze;exports.version=version;exports.Control=Control;exports.control=control;exports.Browser=Browser;exports.Evented=Evented;exports.Mixin=Mixin;exports.Util=Util;exports.Class=Class;exports.Handler=Handler;exports.extend=extend;exports.bind=bind;exports.stamp=stamp;exports.setOptions=setOptions;exports.DomEvent=DomEvent;exports.DomUtil=DomUtil;exports.PosAnimation=PosAnimation;exports.Draggable=Draggable;exports.LineUtil=LineUtil;exports.PolyUtil=PolyUtil;exports.Point=Point;exports.point=toPoint;exports.Bounds=Bounds;exports.bounds=toBounds;exports.Transformation=Transformation;exports.transformation=toTransformation;exports.Projection=index;exports.LatLng=LatLng;exports.latLng=toLatLng;exports.LatLngBounds=LatLngBounds;exports.latLngBounds=toLatLngBounds;exports.CRS=CRS;exports.GeoJSON=GeoJSON;exports.geoJSON=geoJSON;exports.geoJson=geoJson;exports.Layer=Layer;exports.LayerGroup=LayerGroup;exports.layerGroup=layerGroup;exports.FeatureGroup=FeatureGroup;exports.featureGroup=featureGroup;exports.ImageOverlay=ImageOverlay;exports.imageOverlay=imageOverlay;exports.VideoOverlay=VideoOverlay;exports.videoOverlay=videoOverlay;exports.SVGOverlay=SVGOverlay;exports.svgOverlay=svgOverlay;exports.DivOverlay=DivOverlay;exports.Popup=Popup;exports.popup=popup;exports.Tooltip=Tooltip;exports.tooltip=tooltip;exports.Icon=Icon;exports.icon=icon;exports.DivIcon=DivIcon;exports.divIcon=divIcon;exports.Marker=Marker;exports.marker=marker;exports.TileLayer=TileLayer;exports.tileLayer=tileLayer;exports.GridLayer=GridLayer;exports.gridLayer=gridLayer;exports.SVG=SVG;exports.svg=svg$1;exports.Renderer=Renderer;exports.Canvas=Canvas;exports.canvas=canvas$1;exports.Path=Path;exports.CircleMarker=CircleMarker;exports.circleMarker=circleMarker;exports.Circle=Circle;exports.circle=circle;exports.Polyline=Polyline;exports.polyline=polyline;exports.Polygon=Polygon;exports.polygon=polygon;exports.Rectangle=Rectangle;exports.rectangle=rectangle;exports.Map=Map;exports.map=createMap;var oldL=window.L;exports.noConflict=function(){window.L=oldL;return this};window.L=exports});
// source --> https://businessportal.bg/wp-content/plugins/geodirectory/assets/leaflet/osm.geocode.min.js?ver=2.8.162 
L.gdGeoCode={};L.gdGeoCode.Provider={};L.gdGeoCode.Result=function(x,y,label,bounds,details){this.X=x;this.Y=y;this.Label=label;this.bounds=bounds;if(details)this.details=details};L.Control.gdGeoCode=L.Control.extend({options:{position:"topleft",showMarker:true,showPopup:false,customIcon:false,retainZoomLevel:false,draggable:false},_config:{country:"",searchLabel:"Enter address",notFoundMessage:"Sorry, that address could not be found.",messageHideDelay:3e3,zoomLevel:18},initialize:function(options){L.Util.extend(this.options,options);L.Util.extend(this._config,options)},resetLink:function(extraClass){var link=this._container.querySelector("a");link.className="leaflet-bar-part leaflet-bar-part-single"+" "+extraClass},onAdd:function(map){this._container=L.DomUtil.create("div","leaflet-bar leaflet-control leaflet-control-geosearch");var link=L.DomUtil.create("a","",this._container);link.href="#";link.title=this._config.searchLabel;this.resetLink("glass");var form=L.DomUtil.create("form","displayNone",this._container);var searchbox=L.DomUtil.create("input",null,form);searchbox.type="text";searchbox.placeholder=this._config.searchLabel;this._searchbox=searchbox;var msgbox=L.DomUtil.create("div","leaflet-bar message displayNone",this._container);this._msgbox=msgbox;L.DomEvent.on(link,"click",L.DomEvent.stopPropagation).on(link,"click",L.DomEvent.preventDefault).on(link,"click",function(){if(L.DomUtil.hasClass(form,"displayNone")){L.DomUtil.removeClass(form,"displayNone");searchbox.focus()}else{L.DomUtil.addClass(form,"displayNone")}}).on(link,"dblclick",L.DomEvent.stopPropagation);L.DomEvent.addListener(this._searchbox,"keypress",this._onKeyPress,this).addListener(this._searchbox,"keyup",this._onKeyUp,this).addListener(this._searchbox,"input",this._onInput,this);L.DomEvent.disableClickPropagation(this._container);return this._container},geosearch:function(qry){var that=this;try{var provider=this._config.provider;if(typeof provider.GetLocations=="function"){provider.GetLocations(qry,function(results){return that._processResults(results,qry)})}else{var url=provider.GetServiceUrl(qry);return this.sendRequest(provider,url,qry)}}catch(error){this._printError(error)}},cancelSearch:function(){var form=this._container.querySelector("form");L.DomUtil.addClass(form,"displayNone");this._searchbox.value="";this.resetLink("glass");L.DomUtil.addClass(this._msgbox,"displayNone");this._map._container.focus()},startSearch:function(){this.resetLink("spinner");this.geosearch(this._searchbox.value)},sendRequest:function(provider,url,qry){var that=this;window.parseLocation=function(response){var results=provider.ParseJSON(response);results=that._processResults(results,qry);document.body.removeChild(document.getElementById("getJsonP"));delete window.parseLocation;return results};function getJsonP(url){url=url+"&callback=parseLocation";var script=document.createElement("script");script.id="getJsonP";script.src=url;script.async=true;document.body.appendChild(script)}if(XMLHttpRequest){var xhr=new XMLHttpRequest;if("withCredentials"in xhr){var xhr=new XMLHttpRequest;xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status==200){var response=JSON.parse(xhr.responseText),results=provider.ParseJSON(response);that._processResults(results,qry)}else if(xhr.status==0||xhr.status==400){getJsonP(url)}else{that._printError(xhr.responseText)}}};xhr.open("GET",url,true);xhr.send()}else if(XDomainRequest){var xdr=new XDomainRequest;xdr.onerror=function(err){that._printError(err)};xdr.onload=function(){var response=JSON.parse(xdr.responseText),results=provider.ParseJSON(response);that._processResults(results,qry)};xdr.open("GET",url);xdr.send()}else{getJsonP(url)}}},_processResults:function(results,qry){if(results.length>0){return results[0];this.cancelSearch()}else{this._printError(this._config.notFoundMessage)}return null},_showLocation:function(location,qry){if(this.options.showMarker==true){if(typeof this._positionMarker==="undefined"){this._positionMarker=L.marker([location.Y,location.X],{draggable:this.options.draggable}).addTo(this._map);if(this.options.customIcon){this._positionMarker.setIcon(this.options.customIcon)}if(this.options.showPopup){this._positionMarker.bindPopup(qry).openPopup()}}else{this._positionMarker.setLatLng([location.Y,location.X]);if(this.options.showPopup){this._positionMarker.bindPopup(qry).openPopup()}}}if(!this.options.retainZoomLevel&&location.bounds&&location.bounds.isValid()){this._map.fitBounds(location.bounds)}else{this._map.setView([location.Y,location.X],this._getZoomLevel(),false)}this._map.fireEvent("geosearch_showlocation",{Location:location,Marker:this._positionMarker})},_isShowingError:false,_printError:function(message){alert(message)},_onKeyUp:function(e){var esc=27;if(e.keyCode===esc){this.cancelSearch()}},_getZoomLevel:function(){if(!this.options.retainZoomLevel){return this._config.zoomLevel}return this._map._zoom},_onInput:function(){if(this._isShowingError){this.resetLink("glass");L.DomUtil.addClass(this._msgbox,"displayNone");this._isShowingError=false}},_onKeyPress:function(e){var enterKey=13;if(e.keyCode===enterKey){e.preventDefault();e.stopPropagation();this.startSearch()}}});L.gdGeoCode.Provider.OpenStreetMap=L.Class.extend({options:{},initialize:function(options){options=L.Util.setOptions(this,options)},GetServiceUrl:function(qry){var parameters=L.Util.extend({q:qry,format:"json"},this.options);return(location.protocol==="https:"?"https:":"https:")+"//nominatim.openstreetmap.org/search"+L.Util.getParamString(parameters)},ParseJSON:function(data){var results=[];for(var i=0;i<data.length;i++){var boundingBox=data[i].boundingbox,northEastLatLng=new L.LatLng(boundingBox[1],boundingBox[3]),southWestLatLng=new L.LatLng(boundingBox[0],boundingBox[2]);if(data[i].address)data[i].address.type=data[i].type;results.push(new L.gdGeoCode.Result(data[i].lon,data[i].lat,data[i].display_name,new L.LatLngBounds([northEastLatLng,southWestLatLng]),data[i].address))}return results}});function gd_highlight(data,search,start,end){if(typeof start==="undefined"){start='<span class="gdOH">';end="</span>"}if(typeof end==="undefined"){end="</span>"}search=(search+"").replace(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g,"\\$1");return data.replace(new RegExp("("+search+")","gi"),start+"$1"+end)}function gd_osm_parse_item(item){var formated=item.display_name;item.country="";item.state="";item.city="";item.postcode="";item.country_code="";if(item.address){var address=item.address;if(address.country){item.country=address.country;formated=gd_osm_parse_name(formated,address.country)}if(address.postcode){item.postcode=address.postcode;formated=gd_osm_parse_name(formated,address.postcode)}if(address.country_code=="gb"){if(address.state){item.gb_country=address.state;if(geodir_params.splitUK){formated=gd_osm_parse_name(formated,item.gb_country)}}if(address.county){address.state=address.county}else if(address.state_district){address.state=address.state_district}}if((address.country_code=="bm"||address.country_code=="no"||address.country_code=="se"||address.country_code=="ro")&&!address.state){if(address.county){address.state=address.county}else if(address.state_district){address.state=address.state_district}}if(address.state){item.state=address.state;item.state=item.state.replace(" (state)","");formated=gd_osm_parse_name(formated,address.state)}if(address.county){item.city=address.county;formated=gd_osm_parse_name(formated,address.county)}if(address.state_district){item.city=address.state_district;formated=gd_osm_parse_name(formated,address.state_district)}if(address.city){item.city=address.city;formated=gd_osm_parse_name(formated,address.city)}else if(address.city_district){item.city=address.city_district;formated=gd_osm_parse_name(formated,address.city_district)}else if(address.town){item.city=address.town;formated=gd_osm_parse_name(formated,address.town)}else if(address.municipality&&address.country_code=="ro"){item.city=address.municipality;formated=gd_osm_parse_name(formated,address.municipality)}if(address.country_code=="gb"&&item.city){item.city=item.city.replace("City of ","")}if(address.country_code){item.country_code=address.country_code.toUpperCase()}if(!item.state){if(item.country_code=="JP"&&item.city&&item.city.toLowerCase()=="minato"){item.state="Tokyo";formated=gd_osm_parse_name(formated,item.state)}}if(address.state_district){formated=gd_osm_parse_name(formated,address.state_district)}}if(formated==""){if(item.city){formated=item.city}else{formated=item.display_name}}if(address&&address.house_number&&address.road){item.display_address=address.house_number+" "+address.road}else{item.display_address=formated}return item}function gd_osm_parse_name(name,search){if(name==""||search==""){return name}search=", "+search;var n=name.toLowerCase().lastIndexOf(search.toLowerCase());var pat=new RegExp(search,"i");return name.slice(0,n)+name.slice(n).replace(pat,"")}function geocodePositionOSM(latLon,address,countrycodes,updateMap,callback){data={format:"json",addressdetails:1,limit:1,"accept-language":geodir_params.mapLanguage};if(address){type="search";data.q=address;if(countrycodes){data.countrycodes=countrycodes.toLowerCase()}}else if(latLon&&typeof latLon==="object"){type="reverse";data.lat=latLon.lat;data.lon=latLon.lng}else{return}jQuery.ajax({url:(location.protocol==="https:"?"https:":"https:")+"//nominatim.openstreetmap.org/"+type,dataType:"json",data:data,success:function(data,textStatus,jqXHR){if(type=="search"&&data.length){data=data[0]}console.log(data);data=gd_osm_parse_item(data);console.log(data);if(typeof callback==="function"){callback(data)}else{geocodeResponseOSM(data,updateMap)}},error:function(jqXHR,textStatus,errorThrown){console.log(errorThrown)},complete:function(jqXHR,textStatus){}})};
// source --> https://businessportal.bg/wp-content/plugins/geodirectory/assets/js/goMap.min.js?ver=2.8.162 
window.geodirJSGoMap=true;function geodirGoMapInit(){(function($){if((window.gdSetMap=="google"||window.gdSetMap=="auto")&&window.google&&typeof google.maps!=="undefined"){gdMaps="google"}else if((window.gdSetMap=="osm"||window.gdSetMap=="auto")&&typeof L!=="undefined"&&typeof L.version!=="undefined"){gdMaps="osm"}else{gdMaps=null}window.gdMaps=window.gdMaps||gdMaps;if(window.gdMaps==="google"){console.log("Google Maps API Loaded :)");jQuery("body").addClass("gd-google-maps")}else if(window.gdMaps==="osm"){console.log("Leaflet | OpenStreetMap API Loaded :)");jQuery("body").addClass("gd-osm-gmaps")}else{console.log("Maps API Not Loaded :(");jQuery("body").addClass("gd-no-gmaps")}console.log(window.gdSetMap);console.log(gdMaps);var geocoder=window.gdMaps=="google"&&(typeof google!=="undefined"&&typeof google.maps!=="undefined"&&typeof google.maps.Geocoder!=="undefined")?new google.maps.Geocoder:{};function MyOverlay(map,$this){if(typeof $this!=="undefined"){$this.setMap(map)}else{this.setMap(map)}}MyOverlay.prototype=window.gdMaps=="google"&&(typeof google!=="undefined"&&typeof google.maps!=="undefined"&&typeof google.maps.OverlayView!=="undefined")?new google.maps.OverlayView:{};MyOverlay.prototype.onAdd=function(){};MyOverlay.prototype.onRemove=function(){};MyOverlay.prototype.draw=function(){};$.goMap={};$.fn.goMap=function(options){return this.each(function(){var goMap=$(this).data("goMap");if(!goMap&&window.gdMaps=="google"){var goMapBase=$.extend(true,{},$.goMapBase);$(this).data("goMap",goMapBase.init(this,options));$.goMap=goMapBase}else if(!goMap&&window.gdMaps=="osm"){var osmMapBase=$.extend(true,{},$.osmMapBase);$(this).data("goMap",osmMapBase.init(this,options));$.goMap=osmMapBase}else{$.goMap=goMap}})};$.osmMapBase={defaults:{address:"",latitude:window.gdBaseLat?window.gdBaseLat:56.9,longitude:window.gdBaseLng?window.gdBaseLng:24.1,zoom:parseInt(window.gdBaseZoom)>0?parseInt(window.gdBaseZoom):4,delay:200,hideByClick:true,oneInfoWindow:true,prefixId:"gomarker",polyId:"gopoly",groupId:"gogroup",navigationControl:true,navigationControlOptions:{position:"topleft",style:"DEFAULT"},mapTypeControl:true,mapTypeControlOptions:{position:"topright",style:"DEFAULT"},zoomControl:true,zoomControlOptions:{position:"topleft"},scaleControl:false,scrollwheel:true,fullscreenControl:false,directions:false,directionsResult:null,disableDoubleClickZoom:false,touchZoom:"*",streetViewControl:true,maxClusterRadius:80,streetViewControlOptions:{position:"bottomleft"},markers:[],overlays:[],polyline:{color:"#FF0000",opacity:1,weight:2},polygon:{color:"#FF0000",opacity:1,weight:2,fillColor:"#FF0000",fillOpacity:.2},circle:{color:"#FF0000",opacity:1,weight:2,fillColor:"#FF0000",fillOpacity:.2},rectangle:{color:"#FF0000",opacity:1,weight:2,fillColor:"#FF0000",fillOpacity:.2},maptype:"ROADMAP",html_prepend:"<div class=gomapMarker>",html_append:"</div>",addMarker:false,osmBaseLayer:null,osmOverlays:[]},map:null,count:0,markers:[],polylines:[],polygons:[],circles:[],rectangles:[],tmpMarkers:[],geoMarkers:[],lockGeocode:false,bounds:null,overlays:null,overlay:null,mapId:null,plId:null,pgId:null,cId:null,rId:null,opts:null,centerLatLng:null,init:function(el,options){var opts=$.extend(true,{},$.osmMapBase.defaults,options),baseLayer,customMap;this.mapId=$(el);this.opts=opts;if(opts.address)this.geocode({address:opts.address,center:true});else if(Array.isArray(opts.markers)&&opts.markers.length>0){if(opts.markers[0].address)this.geocode({address:opts.markers[0].address,center:true});else this.centerLatLng=L.latLng(opts.markers[0].latitude,opts.markers[0].longitude)}else this.centerLatLng=L.latLng(opts.latitude,opts.longitude);var myOptions={center:this.centerLatLng,zoom:parseInt(opts.zoom),minZoom:opts.minZoom?opts.minZoom:1,maxZoom:opts.maxZoom>18?18:opts.maxZoom,zoomControl:opts.zoomControl==="0"||!opts.zoomControl?false:true,touchZoom:opts.touchZoom,doubleClickZoom:opts.disableDoubleClickZoom==="0"||!opts.disableDoubleClickZoom?true:false,dragging:typeof opts.dragging!=="undefined"?opts.dragging:!L.Browser.mobile,tap:typeof opts.dragging!=="undefined"?opts.dragging:!L.Browser.mobile,worldCopyJump:true,scrollWheelZoom:opts.scrollwheel==="0"||!opts.scrollwheel?false:opts.scrollwheel,attributionControl:typeof opts.attributionControl!=="undefined"?opts.attributionControl:true,defaultBaseLayer:typeof opts.osmBaseLayer!=="undefined"&&opts.osmBaseLayer?opts.osmBaseLayer:null,defaultOverlays:typeof opts.osmOverlays!=="undefined"&&opts.osmOverlays?opts.osmOverlays:[]};if(myOptions.defaultBaseLayer){try{baseLayer=L.tileLayer.provider(myOptions.defaultBaseLayer);if(baseLayer&&baseLayer._url&&baseLayer._url.indexOf("apikey=")===-1&&!(baseLayer.options&&baseLayer.options.apiKey)){var apikey=typeof opts.osmApiKey!=="undefined"&&opts.osmApiKey?opts.osmApiKey:"5e8a41b90fc240c09f61eb6bbbfb8395";baseLayer._url+=(baseLayer._url.indexOf("?")===-1?"?":"&")+"apikey="+apikey}customMap=true}catch(e){console.log(e)}}if(!baseLayer){var osmUrl="//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",osmAttrib='Map data &copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap</a> contributors',baseLayer=L.tileLayer(osmUrl,{maxZoom:opts.maxZoom,attribution:osmAttrib})}this.map=new L.Map(el,myOptions).addLayer(baseLayer);if(customMap&&myOptions.defaultOverlays&&myOptions.defaultOverlays.length>0){for(var i in myOptions.defaultOverlays){if(myOptions.defaultOverlays[i]){try{L.tileLayer.provider(myOptions.defaultOverlays[i]).addTo(this.map)}catch(e){console.log(e)}}}}if(myOptions.zoomControl&&(zoomPosition=this.parsePosition(opts.zoomControlOptions.position,"topleft"))!=="topleft"){this.map.zoomControl.setPosition(zoomPosition)}if(parseInt(options.marker_cluster)===1&&!options.marker_cluster_server){jQuery("#gdOSMprogress").remove();jQuery("#gdOSMprogressBar").remove();jQuery(el).before('<div id="gdOSMprogress"><div id="gdOSMprogressBar"></div></div>');function gdOSMUpdateProgressBar(processed,total,elapsed,layersArray){processed=Math.min(processed,total);if(elapsed>1e3){jQuery("#gdOSMprogress").show();jQuery("#gdOSMprogressBar").width(Math.round(processed/total*100)+"%")}if(processed===total){jQuery("#gdOSMprogress").hide()}}this.gdlayers=new L.markerClusterGroup({spiderfyOnMaxZoom:true,showCoverageOnHover:false,zoomToBoundsOnClick:true,chunkedLoading:true,maxClusterRadius:parseInt(opts.maxClusterRadius)>0?parseInt(opts.maxClusterRadius):80,chunkProgress:gdOSMUpdateProgressBar})}else{this.gdlayers=new L.featureGroup([])}try{this.oms=new OverlappingMarkerSpiderfier(this.map)}catch(e){}for(var j=0,l=opts.markers.length;j<l;j++)this.createMarker(opts.markers[j]);var goMap=this;if(opts.addMarker==true||opts.addMarker=="multi"){L.DomEvent.addListener(goMap.map,"click",function(event){var options={position:event.latLng,draggable:true};var marker=goMap.createMarker(options);L.DomEvent.addListener(marker,"dblclick",function(event){marker.setMap(null);goMap.removeMarker(marker.id)})})}else if(opts.addMarker=="single"){L.DomEvent.addListener(goMap.map,"click",function(event){if(!goMap.singleMarker){var options={position:event.latLng,draggable:true};var marker=goMap.createMarker(options);goMap.singleMarker=true;L.DomEvent.addListener(marker,"dblclick",function(event){marker.setMap(null);goMap.removeMarker(marker.id);goMap.singleMarker=false})}})}delete opts.markers;delete opts.overlays;return this},ready:function(f){this.map.addOneTimeEventListener("moveend",function(){return f()})},Geocoder:function(options){return new L.Control.gdGeoCode({provider:new L.gdGeoCode.Provider.OpenStreetMap})},geocode:function(address,options){var gdcoder=new L.Control.gdGeoCode({provider:new L.gdGeoCode.Provider.OpenStreetMap});var results=gdcoder.geosearch(address)},parsePosition:function(position,$default){var parsed=position;if(position&&typeof position=="string"){switch(position.toUpperCase()){case"TOP":case"LEFT":case"TOP_LEFT":case"topleft":parsed="topleft";break;case"RIGHT":case"TOP_RIGHT":case"topright":parsed="topright";break;case"BOTTOM":case"BOTTOM_LEFT":case"bottomleft":parsed="bottomleft";break;case"BOTTOM_RIGHT":case"bottomright":parsed="bottomright";break;default:parsed=typeof $default!=="undefined"?$default:parsed;break}}else if(typeof $default!=="undefined"){parsed=$default}return parsed},geoMarker:function(){if(this.geoMarkers.length>0&&!this.lockGeocode){this.lockGeocode=true;var current=this.geoMarkers.splice(0,1);this.geocode({address:current[0].address},current[0])}else if(this.lockGeocode){var goMap=this;setTimeout(function(){goMap.geoMarker()},this.opts.delay)}},setMap:function(options){delete options.mapTypeId;if(options.address){this.geocode({address:options.address,center:true});delete options.address}else if(options.latitude&&options.longitude){options.center=L.latLng(options.latitude,options.longitude);delete options.longitude;delete options.latitude}if(options.mapTypeControlOptions&&options.mapTypeControlOptions.position)options.mapTypeControlOptions.position=options.mapTypeControlOptions.position.toLowerCase();if(options.navigationControlOptions&&options.navigationControlOptions.position)options.navigationControlOptions.position=options.navigationControlOptions.position.toLowerCase();L.Util.setOptions(this.map,options)},getMap:function(){return this.map},setInfoWindow:function(marker,html){var goMap=this;html.content=goMap.opts.html_prepend+html.content+goMap.opts.html_append;var infowindow=marker.bindPopup(html);infowindow.show=false;$(goMap.mapId).data(marker.id+"info",infowindow);if(html.popup){goMap.openWindow(infowindow,marker,html);infowindow.show=true}L.DomEvent.addListener(marker,"click",function(){if(infowindow.show&&goMap.opts.hideByClick){infowindow.close();infowindow.show=false}else{goMap.openWindow(infowindow,marker,html);infowindow.show=true}})},openWindow:function(infowindow,marker,html){if(this.opts.oneInfoWindow)this.clearInfo();if(html.ajax){infowindow.openPopup();$.ajax({url:html.ajax,success:function(html){infowindow.setContent(html)}})}else if(html.id){infowindow.setContent($(html.id).html());infowindow.openPopup()}else{infowindow.openPopup()}},setInfo:function(id,text){var info=$(this.mapId).data(id+"info");if(typeof text=="object")info.setOptions(text);else info.setContent(text)},getInfo:function(id,hideDiv){var info=$(this.mapId).data(id+"info").getContent();if(hideDiv)return $(info).html();else return info},clearInfo:function(){for(var i=0,l=this.markers.length;i<l;i++){var info=$(this.mapId).data(this.markers[i]+"info");if(info){info.popupclose();info.show=false}}},fitBounds:function(type,markers){var goMap=this;if(this.getMarkerCount()!=this.getTmpMarkerCount())setTimeout(function(){goMap.fitBounds(type,markers)},this.opts.delay);else{this.bounds=new L.LatLngBounds([]);if(!type||type&&type=="all"){for(var i=0,l=this.markers.length;i<l;i++){this.bounds.extend($(this.mapId).data(this.markers[i]).position)}}else if(type&&type=="visible"){for(var i=0,l=this.markers.length;i<l;i++){if(this.getVisibleMarker(this.markers[i]))this.bounds.extend($(this.mapId).data(this.markers[i]).position)}}else if(type&&type=="markers"&&Array.isArray(markers)){for(var i=0,l=markers.length;i<l;i++){this.bounds.extend($(this.mapId).data(markers[i]).position)}}this.map.fitBounds(this.bounds)}},getBounds:function(){return this.map.getBounds()},getGDMarkers:function(){return this.gdlayers},getMarkerCount:function(){return this.markers.length},getTmpMarkerCount:function(){return this.tmpMarkers.length},getMarkers:function(type,name){var array=[];switch(type){case"markers":for(var i=0,l=this.markers.length;i<l;i++){var temp=$(this.mapId).data(this.markers[i]);array.push(temp)}break;default:for(var i=0,l=this.markers.length;i<l;i++){var temp=$(this.mapId).data(this.markers[i]).getPosition().toUrlValue();array.push(temp)}break}return array},createMarker:function(marker){if(!marker.geocode){this.count++;if(!marker.id)marker.id=this.opts.prefixId+this.count;this.tmpMarkers.push(marker.id)}if(marker.address&&!marker.geocode){this.geoMarkers.push(marker);this.geoMarker()}else if(marker.latitude&&marker.longitude||marker.position){var options={map:this.map};options.id=marker.id;options.group=marker.group?marker.group:this.opts.groupId;options.zIndex=marker.zIndex?marker.zIndex:0;options.zIndexOrg=marker.zIndexOrg?marker.zIndexOrg:0;if(marker.visible==false)options.visible=marker.visible;if(marker.title)options.title=marker.title;if(marker.alt)options.alt=marker.alt;if(marker.label)options.label=marker.label;if(marker.draggable)options.draggable=marker.draggable;if(marker.icon&&marker.icon.image){options.icon=marker.icon.image;if(marker.icon.shadow)options.shadow=marker.icon.shadow}else if(marker.icon)options.icon=marker.icon;else if(this.opts.icon&&this.opts.icon.image){options.icon=this.opts.icon.image;if(this.opts.icon.shadow)options.shadow=this.opts.icon.shadow}else if(this.opts.icon)options.icon=this.opts.icon;if(options.icon){iconOptions={iconUrl:options.icon,iconSize:null,iconAnchor:[17,0],popupAnchor:null};if(marker.iconSize){iconOptions.iconSize=marker.iconSize}if(marker.iconAnchor){iconOptions.iconAnchor=marker.iconAnchor}if(marker.popupAnchor){iconOptions.popupAnchor=marker.popupAnchor}if(marker.iconRetinaUrl){iconOptions.iconRetinaUrl=marker.iconRetinaUrl}if(marker.shadowUrl){iconOptions.shadowUrl=marker.shadowUrl}if(marker.shadowRetinaUrl){iconOptions.shadowRetinaUrl=marker.shadowRetinaUrl}if(marker.shadowSize){iconOptions.shadowSize=marker.shadowSize}if(marker.shadowAnchor){iconOptions.shadowAnchor=marker.shadowAnchor}if(marker.className){iconOptions.className=marker.className}if(marker.clustered){options.clustered=true;var c="marker-cluster marker-cluster-";if(marker.title<10){c+="small"}else if(marker.title<100){c+="medium"}else{c+="large"}iconOptions.className=c;iconOptions.html="<div><span>"+marker.title+"</span></div>";marker.w=40;marker.h=40}if(!iconOptions.iconSize&&marker.w&&marker.h&&parseInt(marker.w)>0&&parseInt(marker.h)>0){var w=parseFloat(marker.w);var h=parseFloat(marker.h);iconOptions.iconSize=[w,h];iconOptions.iconAnchor=[w/2-1,h];iconOptions.popupAnchor=[0,h*-1+h*.05]}if(marker.clustered){options.icon=new L.DivIcon(iconOptions)}else{options.icon=L.icon(iconOptions)}}else{options.icon=new L.Icon.Default}options.position=marker.position?marker.position:L.latLng(marker.latitude,marker.longitude);var cmarker=new L.Marker(options.position,options);if(marker.html&&!marker.clustered){if(!marker.html.content&&!marker.html.ajax&&!marker.html.id)marker.html={content:marker.html};else if(!marker.html.content)marker.html.content=null;this.setInfoWindow(cmarker,marker.html)}if(marker.addToMap){cmarker.addTo(this.map);return cmarker}this.addMarker(cmarker);return cmarker}},addMarker:function(marker){this.gdlayers.addLayer(marker)},removeMarker:function(marker){if(marker=="map_me"){if(jQuery.goMap.gdUmarker){this.map.removeLayer(jQuery.goMap.gdUmarker);jQuery.goMap.gdUmarker=null}return true}var index=$.inArray(marker,this.markers),current;if(index>-1){this.tmpMarkers.splice(index,1);current=this.markers.splice(index,1);var markerId=current[0];var marker=$(this.mapId).data(markerId);var info=$(this.mapId).data(markerId+"info");marker.setVisible(false);marker.setMap(null);$(this.mapId).removeData(markerId);if(info){info.close();info.show=false;$(this.mapId).removeData(markerId+"info")}return true}return false},clearMarkers:function(){var allMarkers=this.gdlayers;this.gdlayers.eachLayer(function(marker){allMarkers.removeLayer(marker)});this.gdlayers=allMarkers;this.singleMarker=false;this.lockGeocode=false;this.markers=[];this.tmpMarkers=[];this.geoMarkers=[]},isVisible:function(latlng){return this.map.getBounds().contains(latlng)}};$.goMapBase={defaults:{address:"",latitude:window.gdBaseLat?window.gdBaseLat:56.9,longitude:window.gdBaseLng?window.gdBaseLng:24.1,zoom:parseInt(window.gdBaseZoom)>0?parseInt(window.gdBaseZoom):4,delay:200,hideByClick:true,oneInfoWindow:true,prefixId:"gomarker",polyId:"gopoly",groupId:"gogroup",navigationControl:true,navigationControlOptions:{position:"TOP_LEFT",style:"DEFAULT"},mapTypeControl:true,mapTypeControlOptions:{position:"TOP_RIGHT",style:"DEFAULT"},zoomControl:true,zoomControlOptions:{position:"LEFT_CENTER"},cameraControl:false,cameraControlOptions:{position:"LEFT_CENTER"},scaleControl:false,scrollwheel:true,fullscreenControl:false,directions:false,directionsResult:null,disableDoubleClickZoom:false,streetViewControl:true,clickableIcons:true,streetViewControlOptions:{position:"LEFT_CENTER"},markers:[],overlays:[],polyline:{color:"#FF0000",opacity:1,weight:2},polygon:{color:"#FF0000",opacity:1,weight:2,fillColor:"#FF0000",fillOpacity:.2},circle:{color:"#FF0000",opacity:1,weight:2,fillColor:"#FF0000",fillOpacity:.2},rectangle:{color:"#FF0000",opacity:1,weight:2,fillColor:"#FF0000",fillOpacity:.2},maptype:"ROADMAP",html_prepend:"<div class=gomapMarker>",html_append:"</div>",addMarker:false},map:null,count:0,markers:[],polylines:[],polygons:[],circles:[],rectangles:[],tmpMarkers:[],geoMarkers:[],lockGeocode:false,bounds:null,overlays:null,overlay:null,mapId:null,plId:null,pgId:null,cId:null,rId:null,opts:null,centerLatLng:null,init:function(el,options){var opts=$.extend(true,{},$.goMapBase.defaults,options);this.mapId=$(el);this.opts=opts;if(opts.address)this.geocode({address:opts.address,center:true});else if(Array.isArray(opts.markers)&&opts.markers.length>0){if(opts.markers[0].address)this.geocode({address:opts.markers[0].address,center:true});else this.centerLatLng=new google.maps.LatLng(opts.markers[0].latitude,opts.markers[0].longitude)}else this.centerLatLng=new google.maps.LatLng(opts.latitude,opts.longitude);var myOptions={center:this.centerLatLng,disableDoubleClickZoom:opts.disableDoubleClickZoom==="0"||!opts.disableDoubleClickZoom?false:true,mapTypeControl:opts.mapTypeControl==="0"||!opts.mapTypeControl?false:true,streetViewControl:opts.streetViewControl==="0"||!opts.streetViewControl?false:true,streetViewControlOptions:{position:google.maps.ControlPosition[opts.streetViewControlOptions.position.toUpperCase()]},mapTypeControlOptions:{position:google.maps.ControlPosition[opts.mapTypeControlOptions.position.toUpperCase()],style:google.maps.MapTypeControlStyle[opts.mapTypeControlOptions.style.toUpperCase()]},mapTypeId:google.maps.MapTypeId[opts.maptype.toUpperCase()],navigationControl:opts.navigationControl,navigationControlOptions:{position:google.maps.ControlPosition[opts.navigationControlOptions.position.toUpperCase()],style:google.maps.NavigationControlStyle[opts.navigationControlOptions.style.toUpperCase()]},zoomControl:opts.zoomControl==="0"||!opts.zoomControl?false:true,zoomControlOptions:{position:google.maps.ControlPosition[opts.zoomControlOptions.position.toUpperCase()]},cameraControl:opts.cameraControl==="0"||!opts.cameraControl?false:true,cameraControlOptions:{position:google.maps.ControlPosition[opts.cameraControlOptions.position.toUpperCase()]},scaleControl:opts.scaleControl==="0"||!opts.scaleControl?false:true,scrollwheel:opts.scrollwheel==="0"||!opts.scrollwheel?false:true,fullscreenControl:opts.fullscreenControl==="0"||!opts.fullscreenControl?false:true,zoom:parseInt(opts.zoom),minZoom:opts.minZoom?parseInt(opts.minZoom):0,maxZoom:parseInt(opts.maxZoom),clickableIcons:opts.clickableIcons==="0"||!opts.clickableIcons?false:true};this.map=new google.maps.Map(el,myOptions);this.overlay=new MyOverlay(this.map);try{this.oms=new OverlappingMarkerSpiderfier(this.map,{markersWontMove:true,markersWontHide:true,basicFormatEvents:true})}catch(e){}this.overlays={polyline:{id:"plId",array:"polylines",create:"createPolyline"},polygon:{id:"pgId",array:"polygons",create:"createPolygon"},circle:{id:"cId",array:"circles",create:"createCircle"},rectangle:{id:"rId",array:"rectangles",create:"createRectangle"}};this.plId=$('<div style="display:none;"/>').appendTo(this.mapId);this.pgId=$('<div style="display:none;"/>').appendTo(this.mapId);this.cId=$('<div style="display:none;"/>').appendTo(this.mapId);this.rId=$('<div style="display:none;"/>').appendTo(this.mapId);for(var j=0,l=opts.markers.length;j<l;j++)this.createMarker(opts.markers[j]);for(var j=0,l=opts.overlays.length;j<l;j++)this[this.overlays[opts.overlays[j].type].create](opts.overlays[j]);var goMap=this;if(opts.addMarker==true||opts.addMarker=="multi"){google.maps.event.addListener(goMap.map,"click",function(event){var options={position:event.latLng,draggable:true};var marker=goMap.createMarker(options);google.maps.event.addListener(marker,"dblclick",function(event){marker.setMap(null);goMap.removeMarker(marker.id)})})}else if(opts.addMarker=="single"){google.maps.event.addListener(goMap.map,"click",function(event){if(!goMap.singleMarker){var options={position:event.latLng,draggable:true};var marker=goMap.createMarker(options);goMap.singleMarker=true;google.maps.event.addListener(marker,"dblclick",function(event){marker.setMap(null);goMap.removeMarker(marker.id);goMap.singleMarker=false})}})}delete opts.markers;delete opts.overlays;return this},ready:function(f){google.maps.event.addListenerOnce(this.map,"bounds_changed",function(){return f()})},geocode:function(address,options){var goMap=this;setTimeout(function(){geocoder.geocode({address:address.address},function(results,status){if(status==google.maps.GeocoderStatus.OK&&address.center)goMap.map.setCenter(results[0].geometry.location);if(status==google.maps.GeocoderStatus.OK&&options&&options.markerId)options.markerId.setPosition(results[0].geometry.location);else if(status==google.maps.GeocoderStatus.OK&&options){if(goMap.lockGeocode){goMap.lockGeocode=false;options.position=results[0].geometry.location;options.geocode=true;goMap.createMarker(options)}}else if(status==google.maps.GeocoderStatus.OVER_QUERY_LIMIT){goMap.geocode(address,options)}})},this.opts.delay)},geoMarker:function(){if(this.geoMarkers.length>0&&!this.lockGeocode){this.lockGeocode=true;var current=this.geoMarkers.splice(0,1);this.geocode({address:current[0].address},current[0])}else if(this.lockGeocode){var goMap=this;setTimeout(function(){goMap.geoMarker()},this.opts.delay)}},setMap:function(options){delete options.mapTypeId;if(options.address){this.geocode({address:options.address,center:true});delete options.address}else if(options.latitude&&options.longitude){options.center=new google.maps.LatLng(options.latitude,options.longitude);delete options.longitude;delete options.latitude}if(options.mapTypeControlOptions&&options.mapTypeControlOptions.position)options.mapTypeControlOptions.position=google.maps.ControlPosition[options.mapTypeControlOptions.position.toUpperCase()];if(options.mapTypeControlOptions&&options.mapTypeControlOptions.style)options.mapTypeControlOptions.style=google.maps.MapTypeControlStyle[options.mapTypeControlOptions.style.toUpperCase()];if(options.navigationControlOptions&&options.navigationControlOptions.position)options.navigationControlOptions.position=google.maps.ControlPosition[options.navigationControlOptions.position.toUpperCase()];if(options.navigationControlOptions&&options.navigationControlOptions.style)options.navigationControlOptions.style=google.maps.NavigationControlStyle[options.navigationControlOptions.style.toUpperCase()];this.map.setOptions(options)},getMap:function(){return this.map},createListener:function(type,event,data){var target;if(typeof type!="object")type={type:type};if(type.type=="map")target=this.map;else if(type.type=="marker"&&type.marker)target=$(this.mapId).data(type.marker);else if(type.type=="info"&&type.marker)target=$(this.mapId).data(type.marker+"info");if(target)return google.maps.event.addListener(target,event,data);else if((type.type=="marker"||type.type=="info")&&this.getMarkerCount()!=this.getTmpMarkerCount())var goMap=this;setTimeout(function(){goMap.createListener(type,event,data)},this.opts.delay)},removeListener:function(listener){google.maps.event.removeListener(listener)},setInfoWindow:function(marker,html){var goMap=this;html.content=goMap.opts.html_prepend+html.content+goMap.opts.html_append;var infowindow=new google.maps.InfoWindow(html);infowindow.show=false;$(goMap.mapId).data(marker.id+"info",infowindow);if(html.popup){goMap.openWindow(infowindow,marker,html);infowindow.show=true}google.maps.event.addListener(marker,"click",function(){if(infowindow.show&&goMap.opts.hideByClick){infowindow.close();infowindow.show=false}else{goMap.openWindow(infowindow,marker,html);infowindow.show=true}})},openWindow:function(infowindow,marker,html){if(this.opts.oneInfoWindow)this.clearInfo();if(html.ajax){infowindow.open(this.map,marker);$.ajax({url:html.ajax,success:function(html){infowindow.setContent(html)}})}else if(html.id){infowindow.setContent($(html.id).html());infowindow.open(this.map,marker)}else infowindow.open(this.map,marker)},setInfo:function(id,text){var info=$(this.mapId).data(id+"info");if(typeof text=="object")info.setOptions(text);else info.setContent(text)},getInfo:function(id,hideDiv){var info=$(this.mapId).data(id+"info").getContent();if(hideDiv)return $(info).html();else return info},clearInfo:function(){for(var i=0,l=this.markers.length;i<l;i++){var info=$(this.mapId).data(this.markers[i]+"info");if(info){info.close();info.show=false}}},fitBounds:function(type,markers){var goMap=this;if(this.getMarkerCount()!=this.getTmpMarkerCount())setTimeout(function(){goMap.fitBounds(type,markers)},this.opts.delay);else{this.bounds=new google.maps.LatLngBounds;if(!type||type&&type=="all"){for(var i=0,l=this.markers.length;i<l;i++){this.bounds.extend($(this.mapId).data(this.markers[i]).position)}}else if(type&&type=="visible"){for(var i=0,l=this.markers.length;i<l;i++){if(this.getVisibleMarker(this.markers[i]))this.bounds.extend($(this.mapId).data(this.markers[i]).position)}}else if(type&&type=="markers"&&Array.isArray(markers)){for(var i=0,l=markers.length;i<l;i++){this.bounds.extend($(this.mapId).data(markers[i]).position)}}this.map.fitBounds(this.bounds)}},getBounds:function(){return this.map.getBounds()},createPolyline:function(poly){poly.type="polyline";return this.createOverlay(poly)},createPolygon:function(poly){poly.type="polygon";return this.createOverlay(poly)},createCircle:function(poly){poly.type="circle";return this.createOverlay(poly)},createRectangle:function(poly){poly.type="rectangle";return this.createOverlay(poly)},createOverlay:function(poly){var overlay=[];if(!poly.id){this.count++;poly.id=this.opts.polyId+this.count}switch(poly.type){case"polyline":if(poly.coords.length>0){for(var j=0,l=poly.coords.length;j<l;j++)overlay.push(new google.maps.LatLng(poly.coords[j].latitude,poly.coords[j].longitude));overlay=new google.maps.Polyline({map:this.map,path:overlay,strokeColor:poly.color?poly.color:this.opts.polyline.color,strokeOpacity:poly.opacity?poly.opacity:this.opts.polyline.opacity,strokeWeight:poly.weight?poly.weight:this.opts.polyline.weight})}else return false;break;case"polygon":if(poly.coords.length>0){for(var j=0,l=poly.coords.length;j<l;j++)overlay.push(new google.maps.LatLng(poly.coords[j].latitude,poly.coords[j].longitude));overlay=new google.maps.Polygon({map:this.map,path:overlay,strokeColor:poly.color?poly.color:this.opts.polygon.color,strokeOpacity:poly.opacity?poly.opacity:this.opts.polygon.opacity,strokeWeight:poly.weight?poly.weight:this.opts.polygon.weight,fillColor:poly.fillColor?poly.fillColor:this.opts.polygon.fillColor,fillOpacity:poly.fillOpacity?poly.fillOpacity:this.opts.polygon.fillOpacity})}else return false;break;case"circle":overlay=new google.maps.Circle({map:this.map,center:new google.maps.LatLng(poly.latitude,poly.longitude),radius:poly.radius,strokeColor:poly.color?poly.color:this.opts.circle.color,strokeOpacity:poly.opacity?poly.opacity:this.opts.circle.opacity,strokeWeight:poly.weight?poly.weight:this.opts.circle.weight,fillColor:poly.fillColor?poly.fillColor:this.opts.circle.fillColor,fillOpacity:poly.fillOpacity?poly.fillOpacity:this.opts.circle.fillOpacity});break;case"rectangle":overlay=new google.maps.Rectangle({map:this.map,bounds:new google.maps.LatLngBounds(new google.maps.LatLng(poly.sw.latitude,poly.sw.longitude),new google.maps.LatLng(poly.ne.latitude,poly.ne.longitude)),strokeColor:poly.color?poly.color:this.opts.circle.color,strokeOpacity:poly.opacity?poly.opacity:this.opts.circle.opacity,strokeWeight:poly.weight?poly.weight:this.opts.circle.weight,fillColor:poly.fillColor?poly.fillColor:this.opts.circle.fillColor,fillOpacity:poly.fillOpacity?poly.fillOpacity:this.opts.circle.fillOpacity});break;default:return false;break}this.addOverlay(poly,overlay);return overlay},addOverlay:function(poly,overlay){$(this[this.overlays[poly.type].id]).data(poly.id,overlay);this[this.overlays[poly.type].array].push(poly.id)},setOverlay:function(type,overlay,options){overlay=$(this[this.overlays[type].id]).data(overlay);if(options.coords&&options.coords.length>0){var array=[];for(var j=0,l=options.coords.length;j<l;j++)array.push(new google.maps.LatLng(options.coords[j].latitude,options.coords[j].longitude));options.path=array;delete options.coords}else if(options.ne&&options.sw){options.bounds=new google.maps.LatLngBounds(new google.maps.LatLng(options.sw.latitude,options.sw.longitude),new google.maps.LatLng(options.ne.latitude,options.ne.longitude));delete options.ne;delete options.sw}else if(options.latitude&&options.longitude){options.center=new google.maps.LatLng(options.latitude,options.longitude);delete options.latitude;delete options.longitude}overlay.setOptions(options)},showHideOverlay:function(type,overlay,display){if(typeof display==="undefined"){if(this.getVisibleOverlay(type,overlay))display=false;else display=true}if(display)$(this[this.overlays[type].id]).data(overlay).setMap(this.map);else $(this[this.overlays[type].id]).data(overlay).setMap(null)},getVisibleOverlay:function(type,overlay){if($(this[this.overlays[type].id]).data(overlay).getMap())return true;else return false},getOverlaysCount:function(type){return this[this.overlays[type].array].length},removeOverlay:function(type,overlay){var index=$.inArray(overlay,this[this.overlays[type].array]),current;if(index>-1){current=this[this.overlays[type].array].splice(index,1);var markerId=current[0];$(this[this.overlays[type].id]).data(markerId).setMap(null);$(this[this.overlays[type].id]).removeData(markerId);return true}return false},clearOverlays:function(type){for(var i=0,l=this[this.overlays[type].array].length;i<l;i++){var markerId=this[this.overlays[type].array][i];$(this[this.overlays[type].id]).data(markerId).setMap(null);$(this[this.overlays[type].id]).removeData(markerId)}this[this.overlays[type].array]=[]},showHideMarker:function(marker,display){if(typeof display==="undefined"){if(this.getVisibleMarker(marker)){$(this.mapId).data(marker).setVisible(false);var info=$(this.mapId).data(marker+"info");if(info&&info.show){info.close();info.show=false}}else $(this.mapId).data(marker).setVisible(true)}else $(this.mapId).data(marker).setVisible(display)},showHideMarkerByGroup:function(group,display){for(var i=0,l=this.markers.length;i<l;i++){var markerId=this.markers[i];var marker=$(this.mapId).data(markerId);if(marker.group==group){if(typeof display==="undefined"){if(this.getVisibleMarker(markerId)){marker.setVisible(false);var info=$(this.mapId).data(markerId+"info");if(info&&info.show){info.close();info.show=false}}else{marker.setVisible(true)}}else marker.setVisible(display)}}},getVisibleMarker:function(marker){return $(this.mapId).data(marker).getVisible()},getMarkerCount:function(){return this.markers.length},getTmpMarkerCount:function(){return this.tmpMarkers.length},getVisibleMarkerCount:function(){return this.getMarkers("visiblesInMap").length},getMarkerByGroupCount:function(group){return this.getMarkers("group",group).length},getMarkers:function(type,name){var array=[];switch(type){case"json":for(var i=0,l=this.markers.length;i<l;i++){var temp="'"+i+"': '"+$(this.mapId).data(this.markers[i]).getPosition().toUrlValue()+"'";array.push(temp)}array="{'markers':{"+array.join(",")+"}}";break;case"data":for(var i=0,l=this.markers.length;i<l;i++){var temp="marker["+i+"]="+$(this.mapId).data(this.markers[i]).getPosition().toUrlValue();array.push(temp)}array=array.join("&");break;case"visiblesInBounds":for(var i=0,l=this.markers.length;i<l;i++){if(this.isVisible($(this.mapId).data(this.markers[i]).getPosition()))array.push(this.markers[i])}break;case"visiblesInMap":for(var i=0,l=this.markers.length;i<l;i++){if(this.getVisibleMarker(this.markers[i]))array.push(this.markers[i])}break;case"group":if(name)for(var i=0,l=this.markers.length;i<l;i++){if($(this.mapId).data(this.markers[i]).group==name)array.push(this.markers[i])}break;case"markers":for(var i=0,l=this.markers.length;i<l;i++){var temp=$(this.mapId).data(this.markers[i]);array.push(temp)}break;default:for(var i=0,l=this.markers.length;i<l;i++){var temp=$(this.mapId).data(this.markers[i]).getPosition().toUrlValue();array.push(temp)}break}return array},getVisibleMarkers:function(){return this.getMarkers("visiblesInBounds")},createMarker:function(marker){if(!marker.geocode){this.count++;if(!marker.id)marker.id=this.opts.prefixId+this.count;this.tmpMarkers.push(marker.id)}if(marker.address&&!marker.geocode){this.geoMarkers.push(marker);this.geoMarker()}else if(marker.latitude&&marker.longitude||marker.position){var options={map:this.map};options.id=marker.id;options.group=marker.group?marker.group:this.opts.groupId;options.zIndex=marker.zIndex?marker.zIndex:0;options.zIndexOrg=marker.zIndexOrg?marker.zIndexOrg:0;options.optimized=false;if(marker.visible==false)options.visible=marker.visible;if(marker.title)options.title=marker.title;if(marker.label)options.label=marker.label;if(marker.draggable)options.draggable=marker.draggable;if(marker.icon&&marker.icon.image){options.icon=marker.icon.image;if(marker.icon.shadow)options.shadow=marker.icon.shadow}else if(marker.icon)options.icon=marker.icon;else if(this.opts.icon&&this.opts.icon.image){options.icon=this.opts.icon.image;if(this.opts.icon.shadow)options.shadow=this.opts.icon.shadow}else if(this.opts.icon)options.icon=this.opts.icon;options.position=marker.position?marker.position:new google.maps.LatLng(marker.latitude,marker.longitude);if(marker.animation){options.animation=marker.animation}var cmarker=new google.maps.Marker(options);if(marker.html){if(!marker.html.content&&!marker.html.ajax&&!marker.html.id)marker.html={content:marker.html};else if(!marker.html.content)marker.html.content=null;this.setInfoWindow(cmarker,marker.html)}this.addMarker(cmarker);return cmarker}},addMarker:function(marker){$(this.mapId).data(marker.id,marker);this.markers.push(marker.id)},setMarker:function(marker,options){var tmarker=$(this.mapId).data(marker);delete options.id;delete options.visible;if(options.icon){var toption=options.icon;delete options.icon;if(toption&&toption=="default"){if(this.opts.icon&&this.opts.icon.image){options.icon=this.opts.icon.image;if(this.opts.icon.shadow)options.shadow=this.opts.icon.shadow}else if(this.opts.icon)options.icon=this.opts.icon}else if(toption&&toption.image){options.icon=toption.image;if(toption.shadow)options.shadow=toption.shadow}else if(toption)options.icon=toption}if(options.address){this.geocode({address:options.address},{markerId:tmarker});delete options.address;delete options.latitude;delete options.longitude;delete options.position}else if(options.latitude&&options.longitude||options.position){if(!options.position)options.position=new google.maps.LatLng(options.latitude,options.longitude)}tmarker.setOptions(options)},removeMarker:function(marker){var index=$.inArray(marker,this.markers),current;if(index>-1){this.tmpMarkers.splice(index,1);current=this.markers.splice(index,1);var markerId=current[0];var marker=$(this.mapId).data(markerId);var info=$(this.mapId).data(markerId+"info");marker.setVisible(false);marker.setMap(null);$(this.mapId).removeData(markerId);if(info){info.close();info.show=false;$(this.mapId).removeData(markerId+"info")}return true}return false},clearMarkers:function(){for(var i=0,l=this.markers.length;i<l;i++){var markerId=this.markers[i];var marker=$(this.mapId).data(markerId);var info=$(this.mapId).data(markerId+"info");marker.setVisible(false);marker.setMap(null);$(this.mapId).removeData(markerId);if(info){info.close();info.show=false;$(this.mapId).removeData(markerId+"info")}}this.singleMarker=false;this.lockGeocode=false;this.markers=[];this.tmpMarkers=[];this.geoMarkers=[]},clearMarkersDelay:function(){var old_markers=this.markers;setTimeout(function(){for(var i=0,l=old_markers.length;i<l;i++){var markerId=old_markers[i];var marker=$(this.mapId).data(markerId);var info=$(this.mapId).data(markerId+"info");marker.setVisible(false);marker.setMap(null);$(this.mapId).removeData(markerId);if(info){info.close();info.show=false;$(this.mapId).removeData(markerId+"info")}}this.singleMarker=false;this.lockGeocode=false;this.markers=[];this.tmpMarkers=[];this.geoMarkers=[]},3e3)},isVisible:function(latlng){return this.map.getBounds().contains(latlng)}}})(jQuery)}if(!window.gdLoadMap){geodirGoMapInit()}function gdGeoLocateMe(el,type){window.gdLocate="";if(typeof type!="undefined"){window.gdLocate=type}if(navigator.geolocation){navigator.geolocation.getCurrentPosition(gdGeoLocateMeSuccess,gdGeoLocateMeError,{enableHighAccuracy:true,timeout:1e4,maximumAge:0})}else{gdGeoLocateMeError(-1)}}function gdGeoLocateMeSuccess(position){var coords=position.coords||position.coordinate||position;if(coords&&coords.latitude&&coords.longitude){var myLat=coords.latitude,myLng=coords.longitude;var geoAddress=myLat+", "+myLng;if(window.gdMaps=="google"||window.gdMaps=="osm"){if(window.gdLocate&&window.gdLocate=="add-listing"){if(typeof geocodePosition!="undefined"){jQuery("#postmap").goMap();user_address=false;if(window.gdMaps=="google"){jQuery.goMap.map.setCenter(new google.maps.LatLng(myLat,myLng));baseMarker.setPosition(new google.maps.LatLng(myLat,myLng));updateMarkerPosition(baseMarker.getPosition());geocodePosition(baseMarker.getPosition())}else if(window.gdMaps=="osm"){centerMap(new L.latLng(myLat,myLng));baseMarker.setLatLng(new L.latLng(myLat,myLng));updateMarkerPositionOSM(baseMarker.getLatLng());geocodePositionOSM(baseMarker.getLatLng())}}}else{}}}}function gdGeoLocateMeError(err){var msg;switch(err.code){case err.UNKNOWN_ERROR:msg=geodir_params.geoErrUNKNOWN_ERROR;break;case err.PERMISSION_DENINED:msg=geodir_params.geoErrPERMISSION_DENINED;break;case err.POSITION_UNAVAILABLE:msg=geodir_params.geoErrPOSITION_UNAVAILABLE;break;case err.BREAK:msg=geodir_params.geoErrBREAK;break;default:msg=geodir_params.geoErrDEFAULT}alert(msg)};