/*! For license information please see view.js.LICENSE.txt */
(()=>{"use strict";window.addEventListener("load",(function(){(function(){if(0!==$("#content.container li .liz-project-title").length){$("#toggle-search, #search-project").tooltip(),$("#toggle-search").click((function(){"#"===$(this).text()?($(this).text("T"),$(".project-keyword").addClass("hide"),$("#search-project-keywords-selected").text("")):($(this).text("#"),$(".project-keyword").removeClass("hide")),$("#content.container .liz-repository-project-item").show(),$("#content.container .liz-repository-title").show(),$("#search-project").keyup()}));var e=function(e,t,r){return r.indexOf(e)===t},t=function(){var t=[];return $(".liz-repository-project-item :visible .keywordList").each((function(){if(""!==$(this).text()){var e=$(this).text().toUpperCase().split(", ");if(s)for(var r=0;r<e.length;r++)t=t.concat(e[r].split("/"));else t=t.concat(e)}})),t.filter(e)},r=function(){var e=o();0===e.length?($("#content.container .liz-repository-project-item").show(),$("#content.container .liz-repository-title").show()):($("#content.container .liz-repository-project-item").hide(),$("#content.container .liz-repository-title").hide(),$(".keywordList").each((function(){var t=!1,r=$(this).text().toUpperCase().split(", ");if(s){for(var o=e.join("/"),i=0;i<r.length;i++)if(-1!==r[i].indexOf(o)){t=!0;break}}else t=e.every((function(e){return-1!==r.indexOf(e)}));t&&($(this).closest(".liz-repository-project-item").show(),$(this).closest(".liz-repository-project-list").prev(".liz-repository-title").show())})))},o=function(){var e=[];return $("#search-project-keywords-selected .keyword-label").each((function(){e.push($(this).text().toUpperCase())})),e},i=function(){var e,r=o();if(0===r.length)$("#search-project-result .project-keyword").removeClass("hide");else{$("#search-project-result .project-keyword").addClass("hide");for(var i=t(),c=0;c<i.length;c++)-1===r.indexOf(i[c])&&$("#search-project-result .project-keyword.hide").filter((function(){return $(this).text().toUpperCase()===i[c]})).removeClass("hide");if(s){$("#search-project-result .project-keyword").addClass("hide");var n=(e=[],$(".liz-repository-project-item :visible .keywordList").each((function(){if(""!==$(this).text())for(var t=$(this).text().toUpperCase().split(", "),r=0;r<t.length;r++)for(var o=t[r].split("/"),i=0;i<o.length-1;i++)e.push([o[i],o[i+1]])})),e),l=r[r.length-1],a=$("#search-project-result .project-keyword.hide");for(let e=0;e<a.length;e++)for(var p=a.eq(e),h=0;h<n.length;h++)n[h][0]===l&&n[h][1]===p.text().toUpperCase()&&p.removeClass("hide")}}$("#search-project-result .project-keyword").each((function(){$(this).text($(this).text())}))};$("#search-project").keyup((function(){$("html").animate({scrollTop:$("#anchor-top-projects").offset().top-$("#header").height()},500);var e=this.value.trim().toUpperCase();"#"===$("#toggle-search").text()?(i(),""===e&&0===o().length?$("#search-project-result .project-keyword").addClass("hide"):$("#search-project-result .project-keyword:visible").each((function(){var t=$(this).text().toUpperCase();if(-1!==t.indexOf(e)){var r=new RegExp(e,"g"),o=t.replace(r,'<span class="highlight">'+e+"</span>");$(this).html(o.toLowerCase())}else $(this).addClass("hide")}))):""===e?($("#content.container .liz-repository-project-item").show(),$("#content.container .liz-repository-title").show()):($("#content.container .liz-repository-project-item").hide(),$("#content.container .liz-repository-title").hide(),$("#content.container li .liz-project-title").filter((function(){return-1!=$(this).text().toUpperCase().indexOf(e)})).closest(".liz-repository-project-item").show(),$("#content.container li .liz-project-title").filter((function(){return-1!=$(this).text().toUpperCase().indexOf(e)})).closest(".liz-repository-project-list").prev(".liz-repository-title").show())}));var s=!1,c=t();if(c.length>0){for(var n=0;n<c.length;n++)if(-1!==c[n].indexOf("/")){s=!0,c=t();break}var l="";for(let e=0;e<c.length;e++)l+='<span class="project-keyword hide">'+c[e].toLowerCase()+"</span>";$("#search-project-result").html(l),$(".project-keyword").click((function(){$("#search-project-keywords-selected").append('<span class="project-keyword"><span class="keyword-label">'+$(this).text()+'</span><span class="remove-keyword">x</span></span>'),$("#search-project-keywords-selected .remove-keyword").click((function(){$(this).parent().remove(),r(),0===$("#search-project-keywords-selected .remove-keyword").length?$("#search-project-result .project-keyword").addClass("hide"):i()})),r(),$("#search-project").val(""),i()}))}else $("#toggle-search").hide().parent().removeClass("input-prepend")}else $("#search").hide()})(),$(".liz-project-show-desc").click((function(){const e=$(this).data("lizmap-modal");return $("#liz-project-modal-"+e).modal("show"),!1}))}))})();
//# sourceMappingURL=view.js.map