');$(this).hasClass("via")||($(this).val()===""?i.addClass("d-none"):i.removeClass("d-none"));t()});$(document).on("click",".address-delete-btn",function(n){n.preventDefault();const i=$(this).closest(".address-form"),r=i.find(".address-input");r.val("");r.focus();r.hasClass("via")&&o(this);i.find(".address-result").hide(100,function(){i.append('');this.remove()});$(this).addClass("d-none");t()});$("#address-start").find(".address-input").on("focus input propertychange paste",function(){$(this).val()===""?$(this).closest(".address-form").find(".favorites").collapse("show"):$(this).closest(".address-form").find(".favorites").collapse("hide")});r=null;$(document).on("mousedown",function(n){r=$(n.target)});$(document).on("focus",".address-input",function(){$(this).hasClass("via")||($(this).val()!==""?$(this).parent().find(".address-delete-btn").removeClass("d-none"):$(this).parent().find(".address-delete-btn").addClass("d-none"))});$(document).on("blur",".address-input",function(){const n=$(r);n.hasClass("favorite-btn")||n.hasClass("favorite-delete-btn")||$(this).closest(".address-form").find(".favorites").collapse("hide")});$(document).on("click",".address",function(){map.showAddress($(this).val(),$(this).data("waypoint"))});$(document).on("click",".countries button",function(){if($dropdown=$(this).parent().find("ul"),!$dropdown.children().any(function(){return $(this).hasClass("dropdown-item")})){const n=$(this).parents(".address-form").find(".address-input").data("country");$dropdown.load("/CountriesDropdown",{current:n})}});$(document).on("click",".countries .dropdown-menu a",function(){var i=$(this).find(".flag");$(this).parents(".address-form").find(".address-input").data("country",$(this).data("country"));$(this).parents(".address-form").find(".dropdown-toggle").html(i.clone());const n=$(this).parents(".address-form");n.find(".address-result").hide(100,function(){n.append('');this.remove();t()})});$(document).on("keydown",".countries",function(n){n.keyCode!=13&&$(this).find("button").attr("aria-expanded")=="false"&&$(this).find(".dropdown-toggle").dropdown("toggle");var i=String.fromCharCode(n.keyCode).toLowerCase(),t=$(this).find("a").filter(function(){return $(this).text().toLowerCase().indexOf(i)===0}),r=$(t).is(":focus");r&&(t=$("a:focus").parent().nextAll().find("a").filter(function(){return $(this).text().toLowerCase().indexOf(i)===0}).first(),t.length==0&&(t=$(this).find("a").filter(function(){return $(this).text().toLowerCase().indexOf(i)===0})));t.first().focus()});u=function(n,t){var u=routenetgl.templates.address,f=u(n),i;const r=$("#address-start").find(".address-input");if(i=new routenetgl.Address(n.a),r.data("country",n.c).val(i.getDescr()),t)r.focus(),map.showAddress(i,"start");else{const n=$("#address-start").find(".address-delete-btn");n.removeClass("d-none")}$("#address-start").append(f);$("#address-start").find(".address-result").show(200);$("#address-start").find(".dummy").remove();$("#address-start").find(".countries").find("button").html('