diff --git a/searx/static/themes/simple/js/searxng.min.js b/searx/static/themes/simple/js/searxng.min.js index 60280a835..91dd56647 100644 --- a/searx/static/themes/simple/js/searxng.min.js +++ b/searx/static/themes/simple/js/searxng.min.js @@ -4,7 +4,7 @@ * (C) Copyright Contributors to the searx project (2014 - 2021). * SPDX-License-Identifier: AGPL-3.0-or-later */ -window.searxng=function(t,i){"use strict";if(t.Element){(function(e){e.matches=e.matches||e.matchesSelector||e.webkitMatchesSelector||e.msMatchesSelector||function(e){var t=this,n=(t.parentNode||t.document).querySelectorAll(e),r=-1;while(n[++r]&&n[r]!=t);return!!n[r]}})(Element.prototype)}function s(e,t,n){try{e.call(t,n)}catch(e){console.log(e)}}var a=window.searxng||{};a.on=function(r,e,o,t){t=t||false;if(typeof r!=="string"){r.addEventListener(e,o,t)}else{i.addEventListener(e,function(e){var t=e.target||e.srcElement,n=false;while(t&&t.matches&&t!==i&&!(n=t.matches(r)))t=t.parentElement;if(n)s(o,t,e)},t)}};a.ready=function(e){if(document.readyState!="loading"){e.call(t)}else{t.addEventListener("DOMContentLoaded",e.bind(t))}};a.http=function(r,o,i=null){return new Promise(function(e,t){try{var n=new XMLHttpRequest;n.open(r,o,true);n.timeout=2e4;n.onload=function(){if(n.status==200){e(n.response,n.responseType)}else{t(Error(n.statusText))}};n.onerror=function(){t(Error("Network Error"))};n.onabort=function(){t(Error("Transaction is aborted"))};n.ontimeout=function(){t(Error("Timeout"))};if(i){n.send(i)}else{n.send()}}catch(e){t(e)}})};a.loadStyle=function(e){var t=a.settings.theme_static_path+"/"+e,n="style_"+e.replace(".","_"),r=i.getElementById(n);if(r===null){r=i.createElement("link");r.setAttribute("id",n);r.setAttribute("rel","stylesheet");r.setAttribute("type","text/css");r.setAttribute("href",t);i.body.appendChild(r)}};a.loadScript=function(e,t){var n=a.settings.theme_static_path+"/"+e,r="script_"+e.replace(".","_"),o=i.getElementById(r);if(o===null){o=i.createElement("script");o.setAttribute("id",r);o.setAttribute("src",n);o.onload=t;o.onerror=function(){o.setAttribute("error","1")};i.body.appendChild(o)}else if(!o.hasAttribute("error")){try{t.apply(o,[])}catch(e){console.log(e)}}else{console.log("callback not executed : script '"+n+"' not loaded.")}};a.insertBefore=function(e,t){t.parentNode.insertBefore(e,t)};a.insertAfter=function(e,t){t.parentNode.insertAfter(e,t.nextSibling)};a.on(".close","click",function(){this.parentNode.classList.add("invisible")});function e(){for(var e of i.getElementsByTagName("body")[0].classList.values()){if(e.endsWith("_endpoint")){return e.split("_")[0]}}return""}a.endpoint=e();return a}(window,document);searxng.ready(function(){"use strict";searxng.infinite_scroll_supported="IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype;if(searxng.endpoint!=="results"){return}if(!searxng.infinite_scroll_supported){console.log("IntersectionObserver not supported");return}let i=document;var s=i.getElementById("results").classList.contains("only_template_images");function n(){var e=i.createElement("div");e.classList.add("loader");return e}function r(t,e){t.textContent="";e.forEach(e=>t.appendChild(e))}function o(o){var e=i.querySelector("#pagination form.next_page");if(!e){return}r(i.querySelector("#pagination"),[n()]);var t=new FormData(e);searxng.http("POST",i.querySelector("#search").getAttribute("action"),t).then(function(e){var t=(new DOMParser).parseFromString(e,"text/html");var n=t.querySelectorAll("#urls article");var r=t.querySelector("#pagination");i.querySelector("#pagination").remove();if(n.length>0&&!s){i.querySelector("#urls").appendChild(i.createElement("hr"))}n.forEach(e=>{i.querySelector("#urls").appendChild(e)});if(r){i.querySelector("#results").appendChild(r);o()}}).catch(function(e){console.log(e);var t=i.createElement("div");t.textContent=searxng.settings.translations.error_loading_next_page;t.classList.add("dialog-error");t.setAttribute("role","alert");r(i.querySelector("#pagination"),[t])})}if(searxng.settings.infinite_scroll&&searxng.infinite_scroll_supported){const a={rootMargin:"20rem"};const l="article.result:last-child";const u=new IntersectionObserver(e=>{const t=e[0];if(t.isIntersecting){u.unobserve(t.target);o(()=>u.observe(i.querySelector(l),a))}});u.observe(i.querySelector(l),a)}});searxng.ready(function(){function e(e){while(e!==undefined){if(e.classList.contains("detail")){return true}if(e.classList.contains("result")){return false}e=e.parentNode}return false}function n(e){while(e!==undefined){if(e.classList.contains("result")){return e}e=e.parentNode}return undefined}function r(e){return e&&e.classList.contains("result-images")}searxng.on(".result","click",function(t){if(!e(t.target)){o(this)(true,true);let e=n(t.target);if(r(e)){t.preventDefault();searxng.selectImage(e)}}});searxng.on(".result a","focus",function(t){if(!e(t.target)){let e=n(t.target);if(e&&e.getAttribute("data-vim-selected")===null){o(e)(true)}if(r(e)){searxng.selectImage(e)}}},true);var d={27:{key:"Escape",fun:i,des:"remove focus from the focused input",cat:"Control"},73:{key:"i",fun:f,des:"focus on the search input",cat:"Control"},66:{key:"b",fun:u(-window.innerHeight),des:"scroll one page up",cat:"Navigation"},70:{key:"f",fun:u(window.innerHeight),des:"scroll one page down",cat:"Navigation"},85:{key:"u",fun:u(-window.innerHeight/2),des:"scroll half a page up",cat:"Navigation"},68:{key:"d",fun:u(window.innerHeight/2),des:"scroll half a page down",cat:"Navigation"},71:{key:"g",fun:c(-document.body.scrollHeight,"top"),des:"scroll to the top of the page",cat:"Navigation"},86:{key:"v",fun:c(document.body.scrollHeight,"bottom"),des:"scroll to the bottom of the page",cat:"Navigation"},75:{key:"k",fun:o("up"),des:"select previous search result",cat:"Results"},74:{key:"j",fun:o("down"),des:"select next search result",cat:"Results"},80:{key:"p",fun:l(),des:"go to previous page",cat:"Results"},78:{key:"n",fun:a(),des:"go to next page",cat:"Results"},79:{key:"o",fun:h(false),des:"open search result",cat:"Results"},84:{key:"t",fun:h(true),des:"open the result in a new tab",cat:"Results"},82:{key:"r",fun:t,des:"reload page from the server",cat:"Control"},72:{key:"h",fun:g,des:"toggle help window",cat:"Other"}};if(searxng.settings.hotkeys){searxng.on(document,"keydown",function(e){if(Object.prototype.hasOwnProperty.call(d,e.keyCode)&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.metaKey){var t=e.target.tagName.toLowerCase();if(e.keyCode===27){d[e.keyCode].fun(e)}else{if(e.target===document.body||t==="a"||t==="button"){e.preventDefault();d[e.keyCode].fun()}}}})}function o(f){return function(e,t){var n=document.querySelector(".result[data-vim-selected]"),r=f;if(n===null){n=document.querySelector(".result");if(n===null){return}if(f==="down"||f==="up"){r=n}}var o,i=document.querySelectorAll(".result");if(typeof r!=="string"){o=r}else{switch(r){case"visible":var s=document.documentElement.scrollTop||document.body.scrollTop;var a=s+document.documentElement.clientHeight;for(var l=0;ls){break}}break;case"down":o=n.nextElementSibling;if(o===null){o=i[0]}break;case"up":o=n.previousElementSibling;if(o===null){o=i[i.length-1]}break;case"bottom":o=i[i.length-1];break;case"top":default:o=i[0]}}if(o){n.removeAttribute("data-vim-selected");o.setAttribute("data-vim-selected","true");if(!t){var d=o.querySelector("h3 a")||o.querySelector("a");if(d!==null){d.focus()}}if(!e){p()}}}}function t(){document.location.reload(true)}function i(e){const t=e.target.tagName.toLowerCase();if(document.activeElement&&(t==="input"||t==="select"||t==="textarea")){document.activeElement.blur()}else{searxng.closeDetail()}}function s(t){return function(){var e=document.querySelector(t);if(e){e.click()}}}function a(){return s('nav#pagination .next_page button[type="submit"]')}function l(){return s('nav#pagination .previous_page button[type="submit"]')}function p(){var e=document.querySelector(".result[data-vim-selected]");if(e===null){return}var t=document.documentElement.scrollTop||document.body.scrollTop,n=document.documentElement.clientHeight,r=e.offsetTop,o=r+e.clientHeight,i=120;if(e.previousElementSibling===null&&or-i){window.scroll(window.scrollX,r-i)}else{var s=t+n;if(s a")}if(e!==null){var t=e.getAttribute("href");if(n){window.open(t)}else{window.location.href=t}}}}function m(e){var n={};for(var t in d){var r=d[t];n[r.cat]=n[r.cat]||[];n[r.cat].push(r)}var o=Object.keys(n).sort(function(e,t){return n[t].length-n[e].length});if(o.length===0){return}var i='×';i+="

How to navigate searx with Vim-like hotkeys

";i+="";for(var s=0;s"}i+="";if(!u||l){i+=""}}i+="
";i+="

"+a[0].cat+"

";i+='
    ';for(var c in a){i+="
  • "+a[c].key+" "+a[c].des+"
  • "}i+="
";i+="
";e.innerHTML=i}function g(){var e=document.querySelector("#vim-hotkeys-help");if(e===undefined||e===null){e=document.createElement("div");e.id="vim-hotkeys-help";e.className="dialog-modal";m(e);m(e);m(e);var t=document.getElementsByTagName("body")[0];t.appendChild(e)}else{e.classList.toggle("invisible");return}}searxng.scrollPageToSelected=p;searxng.selectNext=o("down");searxng.selectPrevious=o("up")});(function(e,t,n){"use strict";n.ready(function(){n.on(".searxng_init_map","click",function(e){this.classList.remove("searxng_init_map");var d=this.dataset.leafletTarget;var f=parseFloat(this.dataset.mapLon);var p=parseFloat(this.dataset.mapLat);var h=parseFloat(this.dataset.mapZoom);var m=JSON.parse(this.dataset.mapBoundingbox);var g=JSON.parse(this.dataset.mapGeojson);n.loadStyle("css/leaflet.css");n.loadScript("js/leaflet.js",function(){var e=null;if(m){var t=L.latLng(m[0],m[2]);var n=L.latLng(m[1],m[3]);e=L.latLngBounds(t,n)}var r=L.map(d);var o="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";var i='Map data © OpenStreetMap contributors';var s=new L.TileLayer(o,{minZoom:1,maxZoom:19,attribution:i});var a="https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png";var l='Wikimedia maps | Maps data © OpenStreetMap contributors';var u=new L.TileLayer(a,{minZoom:1,maxZoom:19,attribution:l});if(e){setTimeout(function(){r.fitBounds(e,{maxZoom:17})},0)}else if(f&&p){if(h){r.setView(new L.latLng(p,f),h)}else{r.setView(new L.latLng(p,f),8)}}r.addLayer(s);var c={"OSM Mapnik":s,"OSM Wikimedia":u};L.control.layers(c).addTo(r);if(g){L.geoJson(g).addTo(r)}});e.preventDefault()})})})(window,document,window.searxng);(function(e,i,s){"use strict";if(s.endpoint!=="preferences"){return}s.ready(function(){let o=null;function e(){if(o==null){s.http("GET","engine_descriptions.json").then(function(e){o=JSON.parse(e);for(const[t,n]of Object.entries(o)){let e=i.querySelectorAll('[data-engine-name="'+t+'"] .engine-description');for(const r of e){let e=" ("+s.settings.translations.Source+": "+n[1]+")";r.innerHTML=n[0]+e}}})}}for(const t of i.querySelectorAll("[data-engine-name]")){s.on(t,"mouseenter",e)}})})(window,document,window.searxng);(function(e,a,l){"use strict";if(l.endpoint!=="results"){return}l.ready(function(){a.querySelectorAll("#urls img.image").forEach(e=>e.addEventListener("error",()=>{e.style.display="none";e.error=null}));l.on(".btn-collapse","click",function(){var e=this.getAttribute("data-btn-text-collapsed");var t=this.getAttribute("data-btn-text-not-collapsed");var n=this.getAttribute("data-target");var r=a.querySelector(n);var o=this.innerHTML;if(this.classList.contains("collapsed")){o=o.replace(e,t)}else{o=o.replace(t,e)}this.innerHTML=o;this.classList.toggle("collapsed");r.classList.toggle("invisible")});l.on(".media-loader","click",function(){var e=this.getAttribute("data-target");var t=a.querySelector(e+" > iframe");var n=t.getAttribute("src");if(n===null||n===undefined||n===false){t.setAttribute("src",t.getAttribute("data-src"))}});l.selectImage=function(e){if(e){const t=e.querySelector(".result-images-source img");const n=e.querySelector(".image_thumbnail");const r=e.querySelector(".detail");if(t){const o=t.getAttribute("data-src");if(o){const i=a.createElement("div");const s=new Image;i.classList.add("loader");r.appendChild(i);s.onload=e=>{t.src=o;i.remove()};s.onerror=e=>{i.remove()};s.src=o;t.src=n.src;t.removeAttribute("data-src")}}}a.getElementById("results").classList.add("image-detail-open");l.scrollPageToSelected()};l.closeDetail=function(e){a.getElementById("results").classList.remove("image-detail-open");l.scrollPageToSelected()};l.on(".result-detail-close","click",e=>{e.preventDefault();l.closeDetail()});l.on(".result-detail-previous","click",e=>l.selectPrevious(false));l.on(".result-detail-next","click",e=>l.selectNext(false));e.addEventListener("scroll",function(){var e=a.getElementById("backToTop"),t=document.documentElement.scrollTop||document.body.scrollTop,n=a.getElementById("results");if(e!==null){if(t>=100){n.classList.add("scrolling")}else{n.classList.remove("scrolling")}}},true)})})(window,document,window.searxng);(function(e,n,t){"use strict";var r="q",o;const i=window.matchMedia("only screen and (max-width: 50em)").matches;function s(){if(o.value.length>0){var e=document.getElementById("search");setTimeout(e.submit.bind(e),0)}}function a(t){var e=document.getElementById("clear_search");var n=function(){if(t.value.length===0){e.classList.add("empty")}else{e.classList.remove("empty")}};n();e.addEventListener("click",function(e){t.value="";t.focus();n();e.preventDefault()});t.addEventListener("keyup",n,false)}t.ready(function(){o=n.getElementById(r);if(o!==null){a(o);if(t.settings.autocomplete_provider){t.autocomplete=AutoComplete.call(e,{Url:"./autocompleter",EmptyMessage:t.settings.translations.no_item_found,HttpMethod:t.settings.http_method,HttpHeaders:{"Content-type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},MinChars:t.settings.autocomplete_min,Delay:300,_Position:function(){},_Open:function(){var t=this;Array.prototype.forEach.call(this.DOMResults.getElementsByTagName("li"),function(e){if(e.getAttribute("class")!="locked"){e.onmousedown=function(){t._Select(e)}}})},_Select:function(e){AutoComplete.defaults._Select.call(this,e);var t=e.closest("form");if(t){t.submit()}},_MinChars:function(){if(this.Input.value.indexOf("!")>-1){return 0}else{return AutoComplete.defaults._MinChars.call(this)}},KeyboardMappings:Object.assign({},AutoComplete.defaults.KeyboardMappings,{KeyUpAndDown_up:Object.assign({},AutoComplete.defaults.KeyboardMappings.KeyUpAndDown_up,{Callback:function(e){AutoComplete.defaults.KeyboardMappings.KeyUpAndDown_up.Callback.call(this,e);var t=this.DOMResults.querySelector("li.active");if(t){AutoComplete.defaults._Select.call(this,t)}}}),Tab:Object.assign({},AutoComplete.defaults.KeyboardMappings.Enter,{Conditions:[{Is:9,Not:false}],Callback:function(e){if(this.DOMResults.getAttribute("class").indexOf("open")!=-1){var t=this.DOMResults.querySelector("li.active");if(t!==null){AutoComplete.defaults._Select.call(this,t);e.preventDefault()}}}})})},"#"+r)}AutoComplete.prototype.ajax=function(e,t,n){if(n===void 0){n=true}if(e.$AjaxTimer){window.clearTimeout(e.$AjaxTimer)}if(n===true){e.$AjaxTimer=window.setTimeout(AutoComplete.prototype.ajax.bind(null,e,t,false),e.Delay)}else{if(e.Request){e.Request.abort()}e.Request=t;e.Request.send(encodeURIComponent(e._QueryArg())+"="+encodeURIComponent(e._Pre()))}};if(!i&&document.querySelector(".index_endpoint")){o.focus()}}if(o!==null&&n.querySelector(".help")!=null&&t.settings.search_on_category_select){n.querySelector(".help").className="invisible";t.on("#categories input","change",function(){var e,t=n.querySelectorAll('#categories input[type="checkbox"]');for(e=0;et.appendChild(e))}function o(o){var e=i.querySelector("#pagination form.next_page");if(!e){return}r(i.querySelector("#pagination"),[n()]);var t=new FormData(e);searxng.http("POST",i.querySelector("#search").getAttribute("action"),t).then(function(e){var t=(new DOMParser).parseFromString(e,"text/html");var n=t.querySelectorAll("#urls article");var r=t.querySelector("#pagination");i.querySelector("#pagination").remove();if(n.length>0&&!s){i.querySelector("#urls").appendChild(i.createElement("hr"))}n.forEach(e=>{i.querySelector("#urls").appendChild(e)});if(r){i.querySelector("#results").appendChild(r);o()}}).catch(function(e){console.log(e);var t=i.createElement("div");t.textContent=searxng.settings.translations.error_loading_next_page;t.classList.add("dialog-error");t.setAttribute("role","alert");r(i.querySelector("#pagination"),[t])})}if(searxng.settings.infinite_scroll&&searxng.infinite_scroll_supported){const a={rootMargin:"20rem"};const l="article.result:last-child";const u=new IntersectionObserver(e=>{const t=e[0];if(t.isIntersecting){u.unobserve(t.target);o(()=>u.observe(i.querySelector(l),a))}});u.observe(i.querySelector(l),a)}});searxng.ready(function(){function e(e){while(e!==undefined){if(e.classList.contains("detail")){return true}if(e.classList.contains("result")){return false}e=e.parentNode}return false}function n(e){while(e!==undefined){if(e.classList.contains("result")){return e}e=e.parentNode}return undefined}function r(e){return e&&e.classList.contains("result-images")}searxng.on(".result","click",function(t){if(!e(t.target)){o(this)(true,true);let e=n(t.target);if(r(e)){t.preventDefault();searxng.selectImage(e)}}});searxng.on(".result a","focus",function(t){if(!e(t.target)){let e=n(t.target);if(e&&e.getAttribute("data-vim-selected")===null){o(e)(true)}if(r(e)){searxng.selectImage(e)}}},true);var d={Escape:{key:"ESC",fun:s,des:"remove focus from the focused input",cat:"Control"},ArrowLeft:{key:"⬅",fun:o("up"),des:"Use left arrow to select previous search result",cat:"Results"},ArrowRight:{key:"➡",fun:o("down"),des:"Use right arrow to select next search result",cat:"Results"},h:{key:"h",fun:v,des:"toggle help window",cat:"Other"},i:{key:"i",fun:h,des:"focus on the search input",cat:"Control"},n:{key:"n",fun:l(),des:"go to next page",cat:"Results"},o:{key:"o",fun:m(false),des:"open search result",cat:"Results"},p:{key:"p",fun:u(),des:"go to previous page",cat:"Results"},r:{key:"r",fun:i,des:"reload page from the server",cat:"Control"},t:{key:"t",fun:m(true),des:"open the result in a new tab",cat:"Results"}};var t={b:{key:"b",fun:c(-window.innerHeight),des:"scroll one page up",cat:"Navigation"},f:{key:"f",fun:c(window.innerHeight),des:"scroll one page down",cat:"Navigation"},u:{key:"u",fun:c(-window.innerHeight/2),des:"scroll half a page up",cat:"Navigation"},d:{key:"d",fun:c(window.innerHeight/2),des:"scroll half a page down",cat:"Navigation"},g:{key:"g",fun:f(-document.body.scrollHeight,"top"),des:"scroll to the top of the page",cat:"Navigation"},v:{key:"v",fun:f(document.body.scrollHeight,"bottom"),des:"scroll to the bottom of the page",cat:"Navigation"},k:{key:"k",fun:o("up"),des:"select previous search result",cat:"Results"},j:{key:"j",fun:o("down"),des:"select next search result",cat:"Results"}};if(searxng.settings.hotkeys){Object.assign(d,t)}searxng.on(document,"keydown",function(e){if(Object.prototype.hasOwnProperty.call(d,e.key)&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&!e.metaKey){var t=e.target.tagName.toLowerCase();if(e.key==="Escape"){d[e.key].fun(e)}else{if(e.target===document.body||t==="a"||t==="button"){e.preventDefault();d[e.key].fun()}}}});function o(f){return function(e,t){var n=document.querySelector(".result[data-vim-selected]"),r=f;if(n===null){n=document.querySelector(".result");if(n===null){return}if(f==="down"||f==="up"){r=n}}var o,i=document.querySelectorAll(".result");if(typeof r!=="string"){o=r}else{switch(r){case"visible":var s=document.documentElement.scrollTop||document.body.scrollTop;var a=s+document.documentElement.clientHeight;for(var l=0;ls){break}}break;case"down":o=n.nextElementSibling;if(o===null){o=i[0]}break;case"up":o=n.previousElementSibling;if(o===null){o=i[i.length-1]}break;case"bottom":o=i[i.length-1];break;case"top":default:o=i[0]}}if(o){n.removeAttribute("data-vim-selected");o.setAttribute("data-vim-selected","true");if(!t){var d=o.querySelector("h3 a")||o.querySelector("a");if(d!==null){d.focus()}}if(!e){p()}}}}function i(){document.location.reload(true)}function s(e){const t=e.target.tagName.toLowerCase();if(document.activeElement&&(t==="input"||t==="select"||t==="textarea")){document.activeElement.blur()}else{searxng.closeDetail()}}function a(t){return function(){var e=document.querySelector(t);if(e){e.click()}}}function l(){return a('nav#pagination .next_page button[type="submit"]')}function u(){return a('nav#pagination .previous_page button[type="submit"]')}function p(){var e=document.querySelector(".result[data-vim-selected]");if(e===null){return}var t=document.documentElement.scrollTop||document.body.scrollTop,n=document.documentElement.clientHeight,r=e.offsetTop,o=r+e.clientHeight,i=120;if(e.previousElementSibling===null&&or-i){window.scroll(window.scrollX,r-i)}else{var s=t+n;if(s a")}if(e!==null){var t=e.getAttribute("href");if(n){window.open(t)}else{window.location.href=t}}}}function g(e){var n={};for(var t in d){var r=d[t];n[r.cat]=n[r.cat]||[];n[r.cat].push(r)}var o=Object.keys(n).sort(function(e,t){return n[t].length-n[e].length});if(o.length===0){return}var i='×';i+="

How to navigate SearXNG with hotkeys

";i+="";for(var s=0;s"}i+="";if(!u||l){i+=""}}i+="
";i+="

"+a[0].cat+"

";i+='
    ';for(var c in a){i+="
  • "+a[c].key+" "+a[c].des+"
  • "}i+="
";i+="
";e.innerHTML=i}function v(){var e=document.querySelector("#vim-hotkeys-help");if(e===undefined||e===null){e=document.createElement("div");e.id="vim-hotkeys-help";e.className="dialog-modal";g(e);var t=document.getElementsByTagName("body")[0];t.appendChild(e)}else{e.classList.toggle("invisible");return}}searxng.scrollPageToSelected=p;searxng.selectNext=o("down");searxng.selectPrevious=o("up")});(function(e,t,n){"use strict";n.ready(function(){n.on(".searxng_init_map","click",function(e){this.classList.remove("searxng_init_map");var d=this.dataset.leafletTarget;var f=parseFloat(this.dataset.mapLon);var p=parseFloat(this.dataset.mapLat);var h=parseFloat(this.dataset.mapZoom);var m=JSON.parse(this.dataset.mapBoundingbox);var g=JSON.parse(this.dataset.mapGeojson);n.loadStyle("css/leaflet.css");n.loadScript("js/leaflet.js",function(){var e=null;if(m){var t=L.latLng(m[0],m[2]);var n=L.latLng(m[1],m[3]);e=L.latLngBounds(t,n)}var r=L.map(d);var o="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";var i='Map data © OpenStreetMap contributors';var s=new L.TileLayer(o,{minZoom:1,maxZoom:19,attribution:i});var a="https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png";var l='Wikimedia maps | Maps data © OpenStreetMap contributors';var u=new L.TileLayer(a,{minZoom:1,maxZoom:19,attribution:l});if(e){setTimeout(function(){r.fitBounds(e,{maxZoom:17})},0)}else if(f&&p){if(h){r.setView(new L.latLng(p,f),h)}else{r.setView(new L.latLng(p,f),8)}}r.addLayer(s);var c={"OSM Mapnik":s,"OSM Wikimedia":u};L.control.layers(c).addTo(r);if(g){L.geoJson(g).addTo(r)}});e.preventDefault()})})})(window,document,window.searxng);(function(e,i,s){"use strict";if(s.endpoint!=="preferences"){return}s.ready(function(){let o=null;function e(){if(o==null){s.http("GET","engine_descriptions.json").then(function(e){o=JSON.parse(e);for(const[t,n]of Object.entries(o)){let e=i.querySelectorAll('[data-engine-name="'+t+'"] .engine-description');for(const r of e){let e=" ("+s.settings.translations.Source+": "+n[1]+")";r.innerHTML=n[0]+e}}})}}for(const t of i.querySelectorAll("[data-engine-name]")){s.on(t,"mouseenter",e)}})})(window,document,window.searxng);(function(e,a,l){"use strict";if(l.endpoint!=="results"){return}l.ready(function(){a.querySelectorAll("#urls img.image").forEach(e=>e.addEventListener("error",()=>{e.style.display="none";e.error=null}));l.on(".btn-collapse","click",function(){var e=this.getAttribute("data-btn-text-collapsed");var t=this.getAttribute("data-btn-text-not-collapsed");var n=this.getAttribute("data-target");var r=a.querySelector(n);var o=this.innerHTML;if(this.classList.contains("collapsed")){o=o.replace(e,t)}else{o=o.replace(t,e)}this.innerHTML=o;this.classList.toggle("collapsed");r.classList.toggle("invisible")});l.on(".media-loader","click",function(){var e=this.getAttribute("data-target");var t=a.querySelector(e+" > iframe");var n=t.getAttribute("src");if(n===null||n===undefined||n===false){t.setAttribute("src",t.getAttribute("data-src"))}});l.selectImage=function(e){if(e){const t=e.querySelector(".result-images-source img");const n=e.querySelector(".image_thumbnail");const r=e.querySelector(".detail");if(t){const o=t.getAttribute("data-src");if(o){const i=a.createElement("div");const s=new Image;i.classList.add("loader");r.appendChild(i);s.onload=e=>{t.src=o;i.remove()};s.onerror=e=>{i.remove()};s.src=o;t.src=n.src;t.removeAttribute("data-src")}}}a.getElementById("results").classList.add("image-detail-open");l.scrollPageToSelected()};l.closeDetail=function(e){a.getElementById("results").classList.remove("image-detail-open");l.scrollPageToSelected()};l.on(".result-detail-close","click",e=>{e.preventDefault();l.closeDetail()});l.on(".result-detail-previous","click",e=>l.selectPrevious(false));l.on(".result-detail-next","click",e=>l.selectNext(false));e.addEventListener("scroll",function(){var e=a.getElementById("backToTop"),t=document.documentElement.scrollTop||document.body.scrollTop,n=a.getElementById("results");if(e!==null){if(t>=100){n.classList.add("scrolling")}else{n.classList.remove("scrolling")}}},true)})})(window,document,window.searxng);(function(e,n,t){"use strict";var r="q",o;const i=window.matchMedia("only screen and (max-width: 50em)").matches;function s(){if(o.value.length>0){var e=document.getElementById("search");setTimeout(e.submit.bind(e),0)}}function a(t){var e=document.getElementById("clear_search");var n=function(){if(t.value.length===0){e.classList.add("empty")}else{e.classList.remove("empty")}};n();e.addEventListener("click",function(e){t.value="";t.focus();n();e.preventDefault()});t.addEventListener("keyup",n,false)}t.ready(function(){o=n.getElementById(r);if(o!==null){a(o);if(t.settings.autocomplete_provider){t.autocomplete=AutoComplete.call(e,{Url:"./autocompleter",EmptyMessage:t.settings.translations.no_item_found,HttpMethod:t.settings.http_method,HttpHeaders:{"Content-type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},MinChars:t.settings.autocomplete_min,Delay:300,_Position:function(){},_Open:function(){var t=this;Array.prototype.forEach.call(this.DOMResults.getElementsByTagName("li"),function(e){if(e.getAttribute("class")!="locked"){e.onmousedown=function(){t._Select(e)}}})},_Select:function(e){AutoComplete.defaults._Select.call(this,e);var t=e.closest("form");if(t){t.submit()}},_MinChars:function(){if(this.Input.value.indexOf("!")>-1){return 0}else{return AutoComplete.defaults._MinChars.call(this)}},KeyboardMappings:Object.assign({},AutoComplete.defaults.KeyboardMappings,{KeyUpAndDown_up:Object.assign({},AutoComplete.defaults.KeyboardMappings.KeyUpAndDown_up,{Callback:function(e){AutoComplete.defaults.KeyboardMappings.KeyUpAndDown_up.Callback.call(this,e);var t=this.DOMResults.querySelector("li.active");if(t){AutoComplete.defaults._Select.call(this,t)}}}),Tab:Object.assign({},AutoComplete.defaults.KeyboardMappings.Enter,{Conditions:[{Is:9,Not:false}],Callback:function(e){if(this.DOMResults.getAttribute("class").indexOf("open")!=-1){var t=this.DOMResults.querySelector("li.active");if(t!==null){AutoComplete.defaults._Select.call(this,t);e.preventDefault()}}}})})},"#"+r)}AutoComplete.prototype.ajax=function(e,t,n){if(n===void 0){n=true}if(e.$AjaxTimer){window.clearTimeout(e.$AjaxTimer)}if(n===true){e.$AjaxTimer=window.setTimeout(AutoComplete.prototype.ajax.bind(null,e,t,false),e.Delay)}else{if(e.Request){e.Request.abort()}e.Request=t;e.Request.send(encodeURIComponent(e._QueryArg())+"="+encodeURIComponent(e._Pre()))}};if(!i&&document.querySelector(".index_endpoint")){o.focus()}}if(o!==null&&n.querySelector(".help")!=null&&t.settings.search_on_category_select){n.querySelector(".help").className="invisible";t.on("#categories input","change",function(){var e,t=n.querySelectorAll('#categories input[type="checkbox"]');for(e=0;e element.appendChild(child));\n }\n\n function loadNextPage (callback) {\n var form = d.querySelector('#pagination form.next_page');\n if (!form) {\n return\n }\n replaceChildrenWith(d.querySelector('#pagination'), [ newLoadSpinner() ]);\n var formData = new FormData(form);\n searxng.http('POST', d.querySelector('#search').getAttribute('action'), formData).then(\n function (response) {\n var nextPageDoc = new DOMParser().parseFromString(response, 'text/html');\n var articleList = nextPageDoc.querySelectorAll('#urls article');\n var paginationElement = nextPageDoc.querySelector('#pagination');\n d.querySelector('#pagination').remove();\n if (articleList.length > 0 && !onlyImages) {\n // do not add
element when there are only images\n d.querySelector('#urls').appendChild(d.createElement('hr'));\n }\n articleList.forEach(articleElement => {\n d.querySelector('#urls').appendChild(articleElement);\n });\n if (paginationElement) {\n d.querySelector('#results').appendChild(paginationElement);\n callback();\n }\n }\n ).catch(\n function (err) {\n console.log(err);\n var e = d.createElement('div');\n e.textContent = searxng.settings.translations.error_loading_next_page;\n e.classList.add('dialog-error');\n e.setAttribute('role', 'alert');\n replaceChildrenWith(d.querySelector('#pagination'), [ e ]);\n }\n )\n }\n\n if (searxng.settings.infinite_scroll && searxng.infinite_scroll_supported) {\n const intersectionObserveOptions = {\n rootMargin: \"20rem\",\n };\n const observedSelector = 'article.result:last-child';\n const observer = new IntersectionObserver(entries => {\n const paginationEntry = entries[0];\n if (paginationEntry.isIntersecting) {\n observer.unobserve(paginationEntry.target);\n loadNextPage(() => observer.observe(d.querySelector(observedSelector), intersectionObserveOptions));\n }\n });\n observer.observe(d.querySelector(observedSelector), intersectionObserveOptions);\n }\n\n});\n","/* SPDX-License-Identifier: AGPL-3.0-or-later */\n/* global searxng */\n\nsearxng.ready(function () {\n\n function isElementInDetail (el) {\n while (el !== undefined) {\n if (el.classList.contains('detail')) {\n return true;\n }\n if (el.classList.contains('result')) {\n // we found a result, no need to go to the root of the document:\n // el is not inside a
element\n return false;\n }\n el = el.parentNode;\n }\n return false;\n }\n\n function getResultElement (el) {\n while (el !== undefined) {\n if (el.classList.contains('result')) {\n return el;\n }\n el = el.parentNode;\n }\n return undefined;\n }\n\n function isImageResult (resultElement) {\n return resultElement && resultElement.classList.contains('result-images');\n }\n\n searxng.on('.result', 'click', function (e) {\n if (!isElementInDetail(e.target)) {\n highlightResult(this)(true, true);\n let resultElement = getResultElement(e.target);\n if (isImageResult(resultElement)) {\n e.preventDefault();\n searxng.selectImage(resultElement);\n }\n }\n });\n\n searxng.on('.result a', 'focus', function (e) {\n if (!isElementInDetail(e.target)) {\n let resultElement = getResultElement(e.target);\n if (resultElement && resultElement.getAttribute(\"data-vim-selected\") === null) {\n highlightResult(resultElement)(true);\n }\n if (isImageResult(resultElement)) {\n searxng.selectImage(resultElement);\n }\n }\n }, true);\n\n var vimKeys = {\n 27: {\n key: 'Escape',\n fun: removeFocus,\n des: 'remove focus from the focused input',\n cat: 'Control'\n },\n 73: {\n key: 'i',\n fun: searchInputFocus,\n des: 'focus on the search input',\n cat: 'Control'\n },\n 66: {\n key: 'b',\n fun: scrollPage(-window.innerHeight),\n des: 'scroll one page up',\n cat: 'Navigation'\n },\n 70: {\n key: 'f',\n fun: scrollPage(window.innerHeight),\n des: 'scroll one page down',\n cat: 'Navigation'\n },\n 85: {\n key: 'u',\n fun: scrollPage(-window.innerHeight / 2),\n des: 'scroll half a page up',\n cat: 'Navigation'\n },\n 68: {\n key: 'd',\n fun: scrollPage(window.innerHeight / 2),\n des: 'scroll half a page down',\n cat: 'Navigation'\n },\n 71: {\n key: 'g',\n fun: scrollPageTo(-document.body.scrollHeight, 'top'),\n des: 'scroll to the top of the page',\n cat: 'Navigation'\n },\n 86: {\n key: 'v',\n fun: scrollPageTo(document.body.scrollHeight, 'bottom'),\n des: 'scroll to the bottom of the page',\n cat: 'Navigation'\n },\n 75: {\n key: 'k',\n fun: highlightResult('up'),\n des: 'select previous search result',\n cat: 'Results'\n },\n 74: {\n key: 'j',\n fun: highlightResult('down'),\n des: 'select next search result',\n cat: 'Results'\n },\n 80: {\n key: 'p',\n fun: GoToPreviousPage(),\n des: 'go to previous page',\n cat: 'Results'\n },\n 78: {\n key: 'n',\n fun: GoToNextPage(),\n des: 'go to next page',\n cat: 'Results'\n },\n 79: {\n key: 'o',\n fun: openResult(false),\n des: 'open search result',\n cat: 'Results'\n },\n 84: {\n key: 't',\n fun: openResult(true),\n des: 'open the result in a new tab',\n cat: 'Results'\n },\n 82: {\n key: 'r',\n fun: reloadPage,\n des: 'reload page from the server',\n cat: 'Control'\n },\n 72: {\n key: 'h',\n fun: toggleHelp,\n des: 'toggle help window',\n cat: 'Other'\n }\n };\n\n if (searxng.settings.hotkeys) {\n searxng.on(document, \"keydown\", function (e) {\n // check for modifiers so we don't break browser's hotkeys\n if (Object.prototype.hasOwnProperty.call(vimKeys, e.keyCode) && !e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey) {\n var tagName = e.target.tagName.toLowerCase();\n if (e.keyCode === 27) {\n vimKeys[e.keyCode].fun(e);\n } else {\n if (e.target === document.body || tagName === 'a' || tagName === 'button') {\n e.preventDefault();\n vimKeys[e.keyCode].fun();\n }\n }\n }\n });\n }\n\n function highlightResult (which) {\n return function (noScroll, keepFocus) {\n var current = document.querySelector('.result[data-vim-selected]'),\n effectiveWhich = which;\n if (current === null) {\n // no selection : choose the first one\n current = document.querySelector('.result');\n if (current === null) {\n // no first one : there are no results\n return;\n }\n // replace up/down actions by selecting first one\n if (which === \"down\" || which === \"up\") {\n effectiveWhich = current;\n }\n }\n\n var next, results = document.querySelectorAll('.result');\n\n if (typeof effectiveWhich !== 'string') {\n next = effectiveWhich;\n } else {\n switch (effectiveWhich) {\n case 'visible':\n var top = document.documentElement.scrollTop || document.body.scrollTop;\n var bot = top + document.documentElement.clientHeight;\n\n for (var i = 0; i < results.length; i++) {\n next = results[i];\n var etop = next.offsetTop;\n var ebot = etop + next.clientHeight;\n\n if ((ebot <= bot) && (etop > top)) {\n break;\n }\n }\n break;\n case 'down':\n next = current.nextElementSibling;\n if (next === null) {\n next = results[0];\n }\n break;\n case 'up':\n next = current.previousElementSibling;\n if (next === null) {\n next = results[results.length - 1];\n }\n break;\n case 'bottom':\n next = results[results.length - 1];\n break;\n case 'top':\n /* falls through */\n default:\n next = results[0];\n }\n }\n\n if (next) {\n current.removeAttribute('data-vim-selected');\n next.setAttribute('data-vim-selected', 'true');\n if (!keepFocus) {\n var link = next.querySelector('h3 a') || next.querySelector('a');\n if (link !== null) {\n link.focus();\n }\n }\n if (!noScroll) {\n scrollPageToSelected();\n }\n }\n };\n }\n\n function reloadPage () {\n document.location.reload(true);\n }\n\n function removeFocus (e) {\n const tagName = e.target.tagName.toLowerCase();\n if (document.activeElement && (tagName === 'input' || tagName === 'select' || tagName === 'textarea')) {\n document.activeElement.blur();\n } else {\n searxng.closeDetail();\n }\n }\n\n function pageButtonClick (css_selector) {\n return function () {\n var button = document.querySelector(css_selector);\n if (button) {\n button.click();\n }\n };\n }\n\n function GoToNextPage () {\n return pageButtonClick('nav#pagination .next_page button[type=\"submit\"]');\n }\n\n function GoToPreviousPage () {\n return pageButtonClick('nav#pagination .previous_page button[type=\"submit\"]');\n }\n\n function scrollPageToSelected () {\n var sel = document.querySelector('.result[data-vim-selected]');\n if (sel === null) {\n return;\n }\n var wtop = document.documentElement.scrollTop || document.body.scrollTop,\n wheight = document.documentElement.clientHeight,\n etop = sel.offsetTop,\n ebot = etop + sel.clientHeight,\n offset = 120;\n // first element ?\n if ((sel.previousElementSibling === null) && (ebot < wheight)) {\n // set to the top of page if the first element\n // is fully included in the viewport\n window.scroll(window.scrollX, 0);\n return;\n }\n if (wtop > (etop - offset)) {\n window.scroll(window.scrollX, etop - offset);\n } else {\n var wbot = wtop + wheight;\n if (wbot < (ebot + offset)) {\n window.scroll(window.scrollX, ebot - wheight + offset);\n }\n }\n }\n\n function scrollPage (amount) {\n return function () {\n window.scrollBy(0, amount);\n highlightResult('visible')();\n };\n }\n\n function scrollPageTo (position, nav) {\n return function () {\n window.scrollTo(0, position);\n highlightResult(nav)();\n };\n }\n\n function searchInputFocus () {\n window.scrollTo(0, 0);\n var q = document.querySelector('#q');\n q.focus();\n if (q.setSelectionRange) {\n var len = q.value.length;\n q.setSelectionRange(len, len);\n }\n }\n\n function openResult (newTab) {\n return function () {\n var link = document.querySelector('.result[data-vim-selected] h3 a');\n if (link === null) {\n link = document.querySelector('.result[data-vim-selected] > a');\n }\n if (link !== null) {\n var url = link.getAttribute('href');\n if (newTab) {\n window.open(url);\n } else {\n window.location.href = url;\n }\n }\n };\n }\n\n function initHelpContent (divElement) {\n var categories = {};\n\n for (var k in vimKeys) {\n var key = vimKeys[k];\n categories[key.cat] = categories[key.cat] || [];\n categories[key.cat].push(key);\n }\n\n var sorted = Object.keys(categories).sort(function (a, b) {\n return categories[b].length - categories[a].length;\n });\n\n if (sorted.length === 0) {\n return;\n }\n\n var html = '×';\n html += '

How to navigate searx with Vim-like hotkeys

';\n html += '';\n\n for (var i = 0; i < sorted.length; i++) {\n var cat = categories[sorted[i]];\n\n var lastCategory = i === (sorted.length - 1);\n var first = i % 2 === 0;\n\n if (first) {\n html += '';\n }\n html += ''; // col-sm-*\n\n if (!first || lastCategory) {\n html += ''; // row\n }\n }\n\n html += '
';\n\n html += '

' + cat[0].cat + '

';\n html += '
    ';\n\n for (var cj in cat) {\n html += '
  • ' + cat[cj].key + ' ' + cat[cj].des + '
  • ';\n }\n\n html += '
';\n html += '
';\n\n divElement.innerHTML = html;\n }\n\n function toggleHelp () {\n var helpPanel = document.querySelector('#vim-hotkeys-help');\n if (helpPanel === undefined || helpPanel === null) {\n // first call\n helpPanel = document.createElement('div');\n helpPanel.id = 'vim-hotkeys-help';\n helpPanel.className = 'dialog-modal';\n initHelpContent(helpPanel);\n initHelpContent(helpPanel);\n initHelpContent(helpPanel);\n var body = document.getElementsByTagName('body')[0];\n body.appendChild(helpPanel);\n } else {\n // togggle hidden\n helpPanel.classList.toggle('invisible');\n return;\n }\n }\n\n searxng.scrollPageToSelected = scrollPageToSelected;\n searxng.selectNext = highlightResult('down');\n searxng.selectPrevious = highlightResult('up');\n});\n","/* SPDX-License-Identifier: AGPL-3.0-or-later */\n/* global L */\n(function (w, d, searxng) {\n 'use strict';\n\n searxng.ready(function () {\n searxng.on('.searxng_init_map', 'click', function (event) {\n // no more request\n this.classList.remove(\"searxng_init_map\");\n\n //\n var leaflet_target = this.dataset.leafletTarget;\n var map_lon = parseFloat(this.dataset.mapLon);\n var map_lat = parseFloat(this.dataset.mapLat);\n var map_zoom = parseFloat(this.dataset.mapZoom);\n var map_boundingbox = JSON.parse(this.dataset.mapBoundingbox);\n var map_geojson = JSON.parse(this.dataset.mapGeojson);\n\n searxng.loadStyle('css/leaflet.css');\n searxng.loadScript('js/leaflet.js', function () {\n var map_bounds = null;\n if (map_boundingbox) {\n var southWest = L.latLng(map_boundingbox[0], map_boundingbox[2]);\n var northEast = L.latLng(map_boundingbox[1], map_boundingbox[3]);\n map_bounds = L.latLngBounds(southWest, northEast);\n }\n\n // init map\n var map = L.map(leaflet_target);\n // create the tile layer with correct attribution\n var osmMapnikUrl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';\n var osmMapnikAttrib = 'Map data © OpenStreetMap contributors';\n var osmMapnik = new L.TileLayer(osmMapnikUrl, {minZoom: 1, maxZoom: 19, attribution: osmMapnikAttrib});\n var osmWikimediaUrl = 'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png';\n var osmWikimediaAttrib = 'Wikimedia maps | Maps data © OpenStreetMap contributors';\n var osmWikimedia = new L.TileLayer(osmWikimediaUrl, {minZoom: 1, maxZoom: 19, attribution: osmWikimediaAttrib});\n // init map view\n if (map_bounds) {\n // TODO hack: https://github.com/Leaflet/Leaflet/issues/2021\n // Still useful ?\n setTimeout(function () {\n map.fitBounds(map_bounds, {\n maxZoom: 17\n });\n }, 0);\n } else if (map_lon && map_lat) {\n if (map_zoom) {\n map.setView(new L.latLng(map_lat, map_lon), map_zoom);\n } else {\n map.setView(new L.latLng(map_lat, map_lon), 8);\n }\n }\n\n map.addLayer(osmMapnik);\n\n var baseLayers = {\n \"OSM Mapnik\": osmMapnik,\n \"OSM Wikimedia\": osmWikimedia,\n };\n\n L.control.layers(baseLayers).addTo(map);\n\n if (map_geojson) {\n L.geoJson(map_geojson).addTo(map);\n } /* else if(map_bounds) {\n L.rectangle(map_bounds, {color: \"#ff7800\", weight: 3, fill:false}).addTo(map);\n } */\n });\n\n // this event occour only once per element\n event.preventDefault();\n });\n });\n})(window, document, window.searxng);\n","/* SPDX-License-Identifier: AGPL-3.0-or-later */\n(function (w, d, searxng) {\n 'use strict';\n\n if (searxng.endpoint !== 'preferences') {\n return;\n }\n\n searxng.ready(function () {\n let engine_descriptions = null;\n function load_engine_descriptions () {\n if (engine_descriptions == null) {\n searxng.http(\"GET\", \"engine_descriptions.json\").then(function (content) {\n engine_descriptions = JSON.parse(content);\n for (const [engine_name, description] of Object.entries(engine_descriptions)) {\n let elements = d.querySelectorAll('[data-engine-name=\"' + engine_name + '\"] .engine-description');\n for (const element of elements) {\n let source = ' (' + searxng.settings.translations.Source + ': ' + description[1] + ')';\n element.innerHTML = description[0] + source;\n }\n }\n });\n }\n }\n\n for (const el of d.querySelectorAll('[data-engine-name]')) {\n searxng.on(el, 'mouseenter', load_engine_descriptions);\n }\n });\n})(window, document, window.searxng);\n","/* SPDX-License-Identifier: AGPL-3.0-or-later */\n(function (w, d, searxng) {\n 'use strict';\n\n if (searxng.endpoint !== 'results') {\n return;\n }\n\n searxng.ready(function () {\n d.querySelectorAll('#urls img.image').forEach(\n img =>\n img.addEventListener(\n 'error', () => {\n img.style.display = 'none';\n img.error = null;\n }\n ));\n\n searxng.on('.btn-collapse', 'click', function () {\n var btnLabelCollapsed = this.getAttribute('data-btn-text-collapsed');\n var btnLabelNotCollapsed = this.getAttribute('data-btn-text-not-collapsed');\n var target = this.getAttribute('data-target');\n var targetElement = d.querySelector(target);\n var html = this.innerHTML;\n if (this.classList.contains('collapsed')) {\n html = html.replace(btnLabelCollapsed, btnLabelNotCollapsed);\n } else {\n html = html.replace(btnLabelNotCollapsed, btnLabelCollapsed);\n }\n this.innerHTML = html;\n this.classList.toggle('collapsed');\n targetElement.classList.toggle('invisible');\n });\n\n searxng.on('.media-loader', 'click', function () {\n var target = this.getAttribute('data-target');\n var iframe_load = d.querySelector(target + ' > iframe');\n var srctest = iframe_load.getAttribute('src');\n if (srctest === null || srctest === undefined || srctest === false) {\n iframe_load.setAttribute('src', iframe_load.getAttribute('data-src'));\n }\n });\n\n searxng.selectImage = function (resultElement) {\n /* eslint no-unused-vars: 0 */\n if (resultElement) {\n // load full size image in background\n const imgElement = resultElement.querySelector('.result-images-source img');\n const thumbnailElement = resultElement.querySelector('.image_thumbnail');\n const detailElement = resultElement.querySelector('.detail');\n if (imgElement) {\n const imgSrc = imgElement.getAttribute('data-src');\n if (imgSrc) {\n const loader = d.createElement('div');\n const imgLoader = new Image();\n\n loader.classList.add('loader');\n detailElement.appendChild(loader);\n\n imgLoader.onload = e => {\n imgElement.src = imgSrc;\n loader.remove();\n };\n imgLoader.onerror = e => {\n loader.remove();\n };\n imgLoader.src = imgSrc;\n imgElement.src = thumbnailElement.src;\n imgElement.removeAttribute('data-src');\n }\n }\n }\n d.getElementById('results').classList.add('image-detail-open');\n searxng.scrollPageToSelected();\n }\n\n searxng.closeDetail = function (e) {\n d.getElementById('results').classList.remove('image-detail-open');\n searxng.scrollPageToSelected();\n }\n searxng.on('.result-detail-close', 'click', e => {\n e.preventDefault();\n searxng.closeDetail();\n });\n searxng.on('.result-detail-previous', 'click', e => searxng.selectPrevious(false));\n searxng.on('.result-detail-next', 'click', e => searxng.selectNext(false));\n\n w.addEventListener('scroll', function () {\n var e = d.getElementById('backToTop'),\n scrollTop = document.documentElement.scrollTop || document.body.scrollTop,\n results = d.getElementById('results');\n if (e !== null) {\n if (scrollTop >= 100) {\n results.classList.add('scrolling');\n } else {\n results.classList.remove('scrolling');\n }\n }\n }, true);\n\n });\n\n})(window, document, window.searxng);\n","/* SPDX-License-Identifier: AGPL-3.0-or-later */\n/* global AutoComplete */\n(function (w, d, searxng) {\n 'use strict';\n\n var qinput_id = \"q\", qinput;\n\n const isMobile = window.matchMedia(\"only screen and (max-width: 50em)\").matches;\n\n function submitIfQuery () {\n if (qinput.value.length > 0) {\n var search = document.getElementById('search');\n setTimeout(search.submit.bind(search), 0);\n }\n }\n\n function createClearButton (qinput) {\n var cs = document.getElementById('clear_search');\n var updateClearButton = function () {\n if (qinput.value.length === 0) {\n cs.classList.add(\"empty\");\n } else {\n cs.classList.remove(\"empty\");\n }\n };\n\n // update status, event listener\n updateClearButton();\n cs.addEventListener('click', function (ev) {\n qinput.value = '';\n qinput.focus();\n updateClearButton();\n ev.preventDefault();\n });\n qinput.addEventListener('keyup', updateClearButton, false);\n }\n\n searxng.ready(function () {\n qinput = d.getElementById(qinput_id);\n\n if (qinput !== null) {\n // clear button\n createClearButton(qinput);\n\n // autocompleter\n if (searxng.settings.autocomplete_provider) {\n searxng.autocomplete = AutoComplete.call(w, {\n Url: \"./autocompleter\",\n EmptyMessage: searxng.settings.translations.no_item_found,\n HttpMethod: searxng.settings.http_method,\n HttpHeaders: {\n \"Content-type\": \"application/x-www-form-urlencoded\",\n \"X-Requested-With\": \"XMLHttpRequest\"\n },\n MinChars: searxng.settings.autocomplete_min,\n Delay: 300,\n _Position: function () {},\n _Open: function () {\n var params = this;\n Array.prototype.forEach.call(this.DOMResults.getElementsByTagName(\"li\"), function (li) {\n if (li.getAttribute(\"class\") != \"locked\") {\n li.onmousedown = function () {\n params._Select(li);\n };\n }\n });\n },\n _Select: function (item) {\n AutoComplete.defaults._Select.call(this, item);\n var form = item.closest('form');\n if (form) {\n form.submit();\n }\n },\n _MinChars: function () {\n if (this.Input.value.indexOf('!') > -1) {\n return 0;\n } else {\n return AutoComplete.defaults._MinChars.call(this);\n }\n },\n KeyboardMappings: Object.assign({}, AutoComplete.defaults.KeyboardMappings, {\n \"KeyUpAndDown_up\": Object.assign({}, AutoComplete.defaults.KeyboardMappings.KeyUpAndDown_up, {\n Callback: function (event) {\n AutoComplete.defaults.KeyboardMappings.KeyUpAndDown_up.Callback.call(this, event);\n var liActive = this.DOMResults.querySelector(\"li.active\");\n if (liActive) {\n AutoComplete.defaults._Select.call(this, liActive);\n }\n },\n }),\n \"Tab\": Object.assign({}, AutoComplete.defaults.KeyboardMappings.Enter, {\n Conditions: [{\n Is: 9,\n Not: false\n }],\n Callback: function (event) {\n if (this.DOMResults.getAttribute(\"class\").indexOf(\"open\") != -1) {\n var liActive = this.DOMResults.querySelector(\"li.active\");\n if (liActive !== null) {\n AutoComplete.defaults._Select.call(this, liActive);\n event.preventDefault();\n }\n }\n },\n })\n }),\n }, \"#\" + qinput_id);\n }\n\n /*\n Monkey patch autocomplete.js to fix a bug\n With the POST method, the values are not URL encoded: query like \"1 + 1\" are sent as \"1 1\" since space are URL encoded as plus.\n See HTML specifications:\n * HTML5: https://url.spec.whatwg.org/#concept-urlencoded-serializer\n * HTML4: https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1\n\n autocomplete.js does not URL encode the name and values:\n https://github.com/autocompletejs/autocomplete.js/blob/87069524f3b95e68f1b54d8976868e0eac1b2c83/src/autocomplete.ts#L665\n\n The monkey patch overrides the compiled version of the ajax function.\n See https://github.com/autocompletejs/autocomplete.js/blob/87069524f3b95e68f1b54d8976868e0eac1b2c83/dist/autocomplete.js#L143-L158\n The patch changes only the line 156 from\n params.Request.send(params._QueryArg() + \"=\" + params._Pre());\n to\n params.Request.send(encodeURIComponent(params._QueryArg()) + \"=\" + encodeURIComponent(params._Pre()));\n\n Related to:\n * https://github.com/autocompletejs/autocomplete.js/issues/78\n * https://github.com/searxng/searxng/issues/1695\n */\n AutoComplete.prototype.ajax = function (params, request, timeout) {\n if (timeout === void 0) { timeout = true; }\n if (params.$AjaxTimer) {\n window.clearTimeout(params.$AjaxTimer);\n }\n if (timeout === true) {\n params.$AjaxTimer = window.setTimeout(AutoComplete.prototype.ajax.bind(null, params, request, false), params.Delay);\n } else {\n if (params.Request) {\n params.Request.abort();\n }\n params.Request = request;\n params.Request.send(encodeURIComponent(params._QueryArg()) + \"=\" + encodeURIComponent(params._Pre()));\n }\n };\n\n if (!isMobile && document.querySelector('.index_endpoint')) {\n qinput.focus();\n }\n }\n\n // vanilla js version of search_on_category_select.js\n if (qinput !== null && d.querySelector('.help') != null && searxng.settings.search_on_category_select) {\n d.querySelector('.help').className = 'invisible';\n\n searxng.on('#categories input', 'change', function () {\n var i, categories = d.querySelectorAll('#categories input[type=\"checkbox\"]');\n for (i = 0; i < categories.length; i++) {\n if (categories[i] !== this && categories[i].checked) {\n categories[i].click();\n }\n }\n if (! this.checked) {\n this.click();\n }\n submitIfQuery();\n return false;\n });\n\n searxng.on(d.getElementById('safesearch'), 'change', submitIfQuery);\n searxng.on(d.getElementById('time_range'), 'change', submitIfQuery);\n searxng.on(d.getElementById('language'), 'change', submitIfQuery);\n }\n\n });\n\n})(window, document, window.searxng);\n","(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.AutoComplete = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i @baptistedonaux\n */\nvar AutoComplete = /** @class */ (function () {\n // Constructor\n function AutoComplete(params, selector) {\n if (params === void 0) { params = {}; }\n if (selector === void 0) { selector = \"[data-autocomplete]\"; }\n if (Array.isArray(selector)) {\n selector.forEach(function (s) {\n new AutoComplete(params, s);\n });\n }\n else if (typeof selector == \"string\") {\n var elements = document.querySelectorAll(selector);\n Array.prototype.forEach.call(elements, function (input) {\n new AutoComplete(params, input);\n });\n }\n else {\n var specificParams = AutoComplete.merge(AutoComplete.defaults, params, {\n DOMResults: document.createElement(\"div\")\n });\n AutoComplete.prototype.create(specificParams, selector);\n return specificParams;\n }\n }\n AutoComplete.prototype.create = function (params, element) {\n params.Input = element;\n if (params.Input.nodeName.match(/^INPUT$/i) && (params.Input.hasAttribute(\"type\") === false || params.Input.getAttribute(\"type\").match(/^TEXT|SEARCH$/i))) {\n params.Input.setAttribute(\"autocomplete\", \"off\");\n params._Position(params);\n params.Input.parentNode.appendChild(params.DOMResults);\n params.$Listeners = {\n blur: params._Blur.bind(params),\n destroy: AutoComplete.prototype.destroy.bind(null, params),\n focus: params._Focus.bind(params),\n keyup: AutoComplete.prototype.event.bind(null, params, EventType.KEYUP),\n keydown: AutoComplete.prototype.event.bind(null, params, EventType.KEYDOWN),\n position: params._Position.bind(params)\n };\n for (var event in params.$Listeners) {\n params.Input.addEventListener(event, params.$Listeners[event]);\n }\n }\n };\n AutoComplete.prototype.getEventsByType = function (params, type) {\n var mappings = {};\n for (var key in params.KeyboardMappings) {\n var event = EventType.KEYUP;\n if (params.KeyboardMappings[key].Event !== undefined) {\n event = params.KeyboardMappings[key].Event;\n }\n if (event == type) {\n mappings[key] = params.KeyboardMappings[key];\n }\n }\n return mappings;\n };\n AutoComplete.prototype.event = function (params, type, event) {\n var eventIdentifier = function (condition) {\n if ((match === true && mapping.Operator == ConditionOperator.AND) || (match === false && mapping.Operator == ConditionOperator.OR)) {\n condition = AutoComplete.merge({\n Not: false\n }, condition);\n if (condition.hasOwnProperty(\"Is\")) {\n if (condition.Is == event.keyCode) {\n match = !condition.Not;\n }\n else {\n match = condition.Not;\n }\n }\n else if (condition.hasOwnProperty(\"From\") && condition.hasOwnProperty(\"To\")) {\n if (event.keyCode >= condition.From && event.keyCode <= condition.To) {\n match = !condition.Not;\n }\n else {\n match = condition.Not;\n }\n }\n }\n };\n for (var name in AutoComplete.prototype.getEventsByType(params, type)) {\n var mapping = AutoComplete.merge({\n Operator: ConditionOperator.AND\n }, params.KeyboardMappings[name]), match = ConditionOperator.AND == mapping.Operator;\n mapping.Conditions.forEach(eventIdentifier);\n if (match === true) {\n mapping.Callback.call(params, event);\n }\n }\n };\n AutoComplete.prototype.makeRequest = function (params, callback, callbackErr) {\n var propertyHttpHeaders = Object.getOwnPropertyNames(params.HttpHeaders), request = new XMLHttpRequest(), method = params._HttpMethod(), url = params._Url(), queryParams = params._Pre(), queryParamsStringify = encodeURIComponent(params._QueryArg()) + \"=\" + encodeURIComponent(queryParams);\n if (method.match(/^GET$/i)) {\n if (url.indexOf(\"?\") !== -1) {\n url += \"&\" + queryParamsStringify;\n }\n else {\n url += \"?\" + queryParamsStringify;\n }\n }\n request.open(method, url, true);\n for (var i = propertyHttpHeaders.length - 1; i >= 0; i--) {\n request.setRequestHeader(propertyHttpHeaders[i], params.HttpHeaders[propertyHttpHeaders[i]]);\n }\n request.onreadystatechange = function () {\n if (request.readyState == 4 && request.status == 200) {\n params.$Cache[queryParams] = request.response;\n callback(request.response);\n }\n else if (request.status >= 400) {\n callbackErr();\n }\n };\n return request;\n };\n AutoComplete.prototype.ajax = function (params, request, timeout) {\n if (timeout === void 0) { timeout = true; }\n if (params.$AjaxTimer) {\n window.clearTimeout(params.$AjaxTimer);\n }\n if (timeout === true) {\n params.$AjaxTimer = window.setTimeout(AutoComplete.prototype.ajax.bind(null, params, request, false), params.Delay);\n }\n else {\n if (params.Request) {\n params.Request.abort();\n }\n params.Request = request;\n params.Request.send(params._QueryArg() + \"=\" + params._Pre());\n }\n };\n AutoComplete.prototype.cache = function (params, callback, callbackErr) {\n var response = params._Cache(params._Pre());\n if (response === undefined) {\n var request = AutoComplete.prototype.makeRequest(params, callback, callbackErr);\n AutoComplete.prototype.ajax(params, request);\n }\n else {\n callback(response);\n }\n };\n AutoComplete.prototype.destroy = function (params) {\n for (var event in params.$Listeners) {\n params.Input.removeEventListener(event, params.$Listeners[event]);\n }\n params.DOMResults.parentNode.removeChild(params.DOMResults);\n };\n AutoComplete.merge = function () {\n var merge = {}, tmp;\n for (var i = 0; i < arguments.length; i++) {\n for (tmp in arguments[i]) {\n merge[tmp] = arguments[i][tmp];\n }\n }\n return merge;\n };\n AutoComplete.defaults = {\n Delay: 150,\n EmptyMessage: \"No result here\",\n Highlight: {\n getRegex: function (value) {\n return new RegExp(value, \"ig\");\n },\n transform: function (value) {\n return \"\" + value + \"\";\n }\n },\n HttpHeaders: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n Limit: 0,\n MinChars: 0,\n HttpMethod: \"GET\",\n QueryArg: \"q\",\n Url: null,\n KeyboardMappings: {\n \"Enter\": {\n Conditions: [{\n Is: 13,\n Not: false\n }],\n Callback: function (event) {\n if (this.DOMResults.getAttribute(\"class\").indexOf(\"open\") != -1) {\n var liActive = this.DOMResults.querySelector(\"li.active\");\n if (liActive !== null) {\n event.preventDefault();\n this._Select(liActive);\n this.DOMResults.setAttribute(\"class\", \"autocomplete\");\n }\n }\n },\n Operator: ConditionOperator.AND,\n Event: EventType.KEYDOWN\n },\n \"KeyUpAndDown_down\": {\n Conditions: [{\n Is: 38,\n Not: false\n },\n {\n Is: 40,\n Not: false\n }],\n Callback: function (event) {\n event.preventDefault();\n },\n Operator: ConditionOperator.OR,\n Event: EventType.KEYDOWN\n },\n \"KeyUpAndDown_up\": {\n Conditions: [{\n Is: 38,\n Not: false\n },\n {\n Is: 40,\n Not: false\n }],\n Callback: function (event) {\n event.preventDefault();\n var first = this.DOMResults.querySelector(\"li:first-child:not(.locked)\"), last = this.DOMResults.querySelector(\"li:last-child:not(.locked)\"), active = this.DOMResults.querySelector(\"li.active\");\n if (active) {\n var currentIndex = Array.prototype.indexOf.call(active.parentNode.children, active), position = currentIndex + (event.keyCode - 39), lisCount = this.DOMResults.getElementsByTagName(\"li\").length;\n if (position < 0) {\n position = lisCount - 1;\n }\n else if (position >= lisCount) {\n position = 0;\n }\n active.classList.remove(\"active\");\n active.parentElement.children.item(position).classList.add(\"active\");\n }\n else if (last && event.keyCode == 38) {\n last.classList.add(\"active\");\n }\n else if (first) {\n first.classList.add(\"active\");\n }\n },\n Operator: ConditionOperator.OR,\n Event: EventType.KEYUP\n },\n \"AlphaNum\": {\n Conditions: [{\n Is: 13,\n Not: true\n }, {\n From: 35,\n To: 40,\n Not: true\n }],\n Callback: function () {\n var oldValue = this.Input.getAttribute(\"data-autocomplete-old-value\"), currentValue = this._Pre();\n if (currentValue !== \"\" && currentValue.length >= this._MinChars()) {\n if (!oldValue || currentValue != oldValue) {\n this.DOMResults.setAttribute(\"class\", \"autocomplete open\");\n }\n AutoComplete.prototype.cache(this, function (response) {\n this._Render(this._Post(response));\n this._Open();\n }.bind(this), this._Error);\n }\n else {\n this._Close();\n }\n },\n Operator: ConditionOperator.AND,\n Event: EventType.KEYUP\n }\n },\n DOMResults: null,\n Request: null,\n Input: null,\n /**\n * Return the message when no result returns\n */\n _EmptyMessage: function () {\n var emptyMessage = \"\";\n if (this.Input.hasAttribute(\"data-autocomplete-empty-message\")) {\n emptyMessage = this.Input.getAttribute(\"data-autocomplete-empty-message\");\n }\n else if (this.EmptyMessage !== false) {\n emptyMessage = this.EmptyMessage;\n }\n else {\n emptyMessage = \"\";\n }\n return emptyMessage;\n },\n /**\n * Returns the maximum number of results\n */\n _Limit: function () {\n var limit = this.Input.getAttribute(\"data-autocomplete-limit\");\n if (isNaN(limit) || limit === null) {\n return this.Limit;\n }\n return parseInt(limit, 10);\n },\n /**\n * Returns the minimum number of characters entered before firing ajax\n */\n _MinChars: function () {\n var minchars = this.Input.getAttribute(\"data-autocomplete-minchars\");\n if (isNaN(minchars) || minchars === null) {\n return this.MinChars;\n }\n return parseInt(minchars, 10);\n },\n /**\n * Apply transformation on labels response\n */\n _Highlight: function (label) {\n return label.replace(this.Highlight.getRegex(this._Pre()), this.Highlight.transform);\n },\n /**\n * Returns the HHTP method to use\n */\n _HttpMethod: function () {\n if (this.Input.hasAttribute(\"data-autocomplete-method\")) {\n return this.Input.getAttribute(\"data-autocomplete-method\");\n }\n return this.HttpMethod;\n },\n /**\n * Returns the query param to use\n */\n _QueryArg: function () {\n if (this.Input.hasAttribute(\"data-autocomplete-param-name\")) {\n return this.Input.getAttribute(\"data-autocomplete-param-name\");\n }\n return this.QueryArg;\n },\n /**\n * Returns the URL to use for AJAX request\n */\n _Url: function () {\n if (this.Input.hasAttribute(\"data-autocomplete\")) {\n return this.Input.getAttribute(\"data-autocomplete\");\n }\n return this.Url;\n },\n /**\n * Manage the close\n */\n _Blur: function (now) {\n if (now === void 0) { now = false; }\n if (now) {\n this._Close();\n }\n else {\n var params = this;\n setTimeout(function () {\n params._Blur(true);\n }, 150);\n }\n },\n /**\n * Manage the cache\n */\n _Cache: function (value) {\n return this.$Cache[value];\n },\n /**\n * Manage the open\n */\n _Focus: function () {\n var oldValue = this.Input.getAttribute(\"data-autocomplete-old-value\");\n if ((!oldValue || this.Input.value != oldValue) && this._MinChars() <= this.Input.value.length) {\n this.DOMResults.setAttribute(\"class\", \"autocomplete open\");\n }\n },\n /**\n * Bind all results item if one result is opened\n */\n _Open: function () {\n var params = this;\n Array.prototype.forEach.call(this.DOMResults.getElementsByTagName(\"li\"), function (li) {\n if (li.getAttribute(\"class\") != \"locked\") {\n li.onclick = function () {\n params._Select(li);\n };\n }\n });\n },\n _Close: function () {\n this.DOMResults.setAttribute(\"class\", \"autocomplete\");\n },\n /**\n * Position the results HTML element\n */\n _Position: function () {\n this.DOMResults.setAttribute(\"class\", \"autocomplete\");\n this.DOMResults.setAttribute(\"style\", \"top:\" + (this.Input.offsetTop + this.Input.offsetHeight) + \"px;left:\" + this.Input.offsetLeft + \"px;width:\" + this.Input.clientWidth + \"px;\");\n },\n /**\n * Execute the render of results DOM element\n */\n _Render: function (response) {\n var ul;\n if (typeof response == \"string\") {\n ul = this._RenderRaw(response);\n }\n else {\n ul = this._RenderResponseItems(response);\n }\n if (this.DOMResults.hasChildNodes()) {\n this.DOMResults.removeChild(this.DOMResults.childNodes[0]);\n }\n this.DOMResults.appendChild(ul);\n },\n /**\n * ResponseItems[] rendering\n */\n _RenderResponseItems: function (response) {\n var ul = document.createElement(\"ul\"), li = document.createElement(\"li\"), limit = this._Limit();\n // Order\n if (limit < 0) {\n response = response.reverse();\n }\n else if (limit === 0) {\n limit = response.length;\n }\n for (var item = 0; item < Math.min(Math.abs(limit), response.length); item++) {\n li.innerHTML = response[item].Label;\n li.setAttribute(\"data-autocomplete-value\", response[item].Value);\n ul.appendChild(li);\n li = document.createElement(\"li\");\n }\n return ul;\n },\n /**\n * string response rendering (RAW HTML)\n */\n _RenderRaw: function (response) {\n var ul = document.createElement(\"ul\"), li = document.createElement(\"li\");\n if (response.length > 0) {\n this.DOMResults.innerHTML = response;\n }\n else {\n var emptyMessage = this._EmptyMessage();\n if (emptyMessage !== \"\") {\n li.innerHTML = emptyMessage;\n li.setAttribute(\"class\", \"locked\");\n ul.appendChild(li);\n }\n }\n return ul;\n },\n /**\n * Deal with request response\n */\n _Post: function (response) {\n try {\n var returnResponse = [];\n //JSON return\n var json = JSON.parse(response);\n if (Object.keys(json).length === 0) {\n return \"\";\n }\n if (Array.isArray(json)) {\n for (var i = 0; i < Object.keys(json).length; i++) {\n returnResponse[returnResponse.length] = { \"Value\": json[i], \"Label\": this._Highlight(json[i]) };\n }\n }\n else {\n for (var value in json) {\n returnResponse.push({\n \"Value\": value,\n \"Label\": this._Highlight(json[value])\n });\n }\n }\n return returnResponse;\n }\n catch (event) {\n //HTML return\n return response;\n }\n },\n /**\n * Return the autocomplete value to send (before request)\n */\n _Pre: function () {\n return this.Input.value;\n },\n /**\n * Choice one result item\n */\n _Select: function (item) {\n if (item.hasAttribute(\"data-autocomplete-value\")) {\n this.Input.value = item.getAttribute(\"data-autocomplete-value\");\n }\n else {\n this.Input.value = item.innerHTML;\n }\n this.Input.setAttribute(\"data-autocomplete-old-value\", this.Input.value);\n },\n /**\n * Handle HTTP error on the request\n */\n _Error: function () {\n },\n $AjaxTimer: null,\n $Cache: {},\n $Listeners: {}\n };\n return AutoComplete;\n}());\nmodule.exports = AutoComplete;\n\n},{}]},{},[1])(1)\n});\n"],"names":["window","searxng","w","d","Element","ElementPrototype","matches","matchesSelector","webkitMatchesSelector","msMatchesSelector","selector","node","this","nodes","parentNode","document","querySelectorAll","i","prototype","callbackSafe","callback","el","e","call","exception","console","log","on","obj","eventType","useCapture","addEventListener","target","srcElement","found","parentElement","ready","readyState","bind","http","method","url","data","Promise","resolve","reject","req","XMLHttpRequest","open","timeout","onload","status","response","responseType","Error","statusText","onerror","onabort","ontimeout","send","ex","loadStyle","src","path","settings","theme_static_path","id","replace","s","getElementById","createElement","setAttribute","body","appendChild","loadScript","hasAttribute","apply","insertBefore","newNode","referenceNode","insertAfter","nextSibling","classList","add","getEndpoint","className","getElementsByTagName","values","endsWith","split","endpoint","infinite_scroll_supported","IntersectionObserverEntry","let","onlyImages","contains","newLoadSpinner","loader","replaceChildrenWith","element","children","textContent","forEach","child","loadNextPage","form","querySelector","formData","FormData","getAttribute","then","nextPageDoc","DOMParser","parseFromString","articleList","paginationElement","remove","length","articleElement","catch","err","translations","error_loading_next_page","infinite_scroll","intersectionObserveOptions","rootMargin","observedSelector","observer","IntersectionObserver","entries","paginationEntry","isIntersecting","unobserve","observe","isElementInDetail","undefined","getResultElement","isImageResult","resultElement","highlightResult","preventDefault","selectImage","vimKeys","27","key","fun","removeFocus","des","cat","73","searchInputFocus","66","scrollPage","innerHeight","70","85","68","71","scrollPageTo","scrollHeight","86","75","74","80","GoToPreviousPage","78","GoToNextPage","79","openResult","84","82","reloadPage","72","toggleHelp","hotkeys","Object","hasOwnProperty","keyCode","ctrlKey","altKey","shiftKey","metaKey","tagName","toLowerCase","which","noScroll","keepFocus","current","effectiveWhich","next","results","top","documentElement","scrollTop","bot","clientHeight","etop","offsetTop","ebot","nextElementSibling","previousElementSibling","removeAttribute","link","focus","scrollPageToSelected","location","reload","activeElement","blur","closeDetail","pageButtonClick","css_selector","button","click","sel","wtop","wheight","offset","scroll","scrollX","wbot","amount","scrollBy","position","nav","scrollTo","q","setSelectionRange","len","value","newTab","href","initHelpContent","divElement","categories","k","push","sorted","keys","sort","a","b","html","lastCategory","first","cj","innerHTML","helpPanel","toggle","selectNext","selectPrevious","event","leaflet_target","dataset","leafletTarget","map_lon","parseFloat","mapLon","map_lat","mapLat","map_zoom","mapZoom","map_boundingbox","JSON","parse","mapBoundingbox","map_geojson","mapGeojson","map_bounds","southWest","L","latLng","northEast","latLngBounds","map","osmMapnikUrl","osmMapnikAttrib","osmMapnik","TileLayer","minZoom","maxZoom","attribution","osmWikimediaUrl","osmWikimediaAttrib","osmWikimedia","setTimeout","fitBounds","setView","addLayer","baseLayers","OSM Mapnik","OSM Wikimedia","control","layers","addTo","geoJson","engine_descriptions","load_engine_descriptions","content","engine_name","description","elements","source","Source","img","style","display","error","btnLabelCollapsed","btnLabelNotCollapsed","targetElement","iframe_load","srctest","imgElement","thumbnailElement","detailElement","imgSrc","imgLoader","Image","qinput_id","qinput","isMobile","matchMedia","submitIfQuery","search","submit","createClearButton","cs","updateClearButton","ev","autocomplete_provider","autocomplete","AutoComplete","Url","EmptyMessage","no_item_found","HttpMethod","http_method","HttpHeaders","Content-type","X-Requested-With","MinChars","autocomplete_min","Delay","_Position","_Open","params","Array","DOMResults","li","onmousedown","_Select","item","defaults","closest","_MinChars","Input","indexOf","KeyboardMappings","assign","KeyUpAndDown_up","Callback","liActive","Tab","Enter","Conditions","Is","Not","ajax","request","$AjaxTimer","clearTimeout","Request","abort","encodeURIComponent","_QueryArg","_Pre","search_on_category_select","checked","f","exports","module","define","amd","g","global","self","r","n","t","o","c","require","u","code","p","1","ConditionOperator","EventType","isArray","input","specificParams","merge","create","nodeName","match","$Listeners","_Blur","destroy","_Focus","keyup","KEYUP","keydown","KEYDOWN","getEventsByType","type","mappings","Event","eventIdentifier","condition","mapping","Operator","AND","OR","From","To","name","makeRequest","callbackErr","propertyHttpHeaders","getOwnPropertyNames","_HttpMethod","_Url","queryParams","queryParamsStringify","setRequestHeader","onreadystatechange","$Cache","cache","_Cache","removeEventListener","removeChild","tmp","arguments","Highlight","getRegex","RegExp","transform","Limit","QueryArg","KeyUpAndDown_down","last","active","currentIndex","lisCount","AlphaNum","oldValue","currentValue","_Render","_Post","_Error","_Close","_EmptyMessage","emptyMessage","_Limit","limit","isNaN","parseInt","minchars","_Highlight","label","now","onclick","offsetHeight","offsetLeft","clientWidth","ul","_RenderRaw","_RenderResponseItems","hasChildNodes","childNodes","reverse","Math","min","abs","Label","Value","returnResponse","json"],"mappings":";;;;;GAMAA;OAAOC,QAAU,SAAWC,EAAGC,GAE7B,aAMA,GAAID,EAAEE,QAAS,EACb,SAAWC,GACTA,EAAiBC,QAAUD,EAAiBC,SAC5CD,EAAiBE,iBACjBF,EAAiBG,uBACjBH,EAAiBI,mBACjB,SAAUC,GACR,IAAIC,EAAOC,KAAMC,GAASF,EAAKG,YAAcH,EAAKI,UAAUC,iBAAiBN,CAAQ,EAAGO,EAAI,CAAC,EAC7F,MAAOJ,EAAM,EAAEI,IAAMJ,EAAMI,IAAMN,GACjC,MAAO,CAAC,CAACE,EAAMI,EACjB,CACD,GAAEb,QAAQc,SAAS,CACtB,CAEA,SAASC,EAAcC,EAAUC,EAAIC,GACnC,IACEF,EAASG,KAAKF,EAAIC,CAAC,CAGrB,CAFE,MAAOE,GACPC,QAAQC,IAAIF,CAAS,CACvB,CACF,CAEA,IAAIvB,EAAUD,OAAOC,SAAW,GAEhCA,EAAQ0B,GAAK,SAAUC,EAAKC,EAAWT,EAAUU,GAC/CA,EAAaA,GAAc,MAC3B,GAAI,OAAOF,IAAQ,SAAU,CAE3BA,EAAIG,iBAAiBF,EAAWT,EAAUU,CAAU,CACtD,KAAO,CAEL3B,EAAE4B,iBAAiBF,EAAW,SAAUP,GACtC,IAAID,EAAKC,EAAEU,QAAUV,EAAEW,WAAYC,EAAQ,MAC3C,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AEnX,OAAQpG,CAAC,GAAI,CAC/Csd,EAAeA,EAAelX,QAAU,CAAEiX,MAASE,EAAKvd,GAAIod,MAASzd,KAAKyc,WAAWmB,EAAKvd,EAAE,CAAE,CAClG,CACJ,KACK,CACD,IAAK,IAAIoN,KAASmQ,EAAM,CACpBD,EAAe3P,KAAK,CAChB0P,MAASjQ,EACTgQ,MAASzd,KAAKyc,WAAWmB,EAAKnQ,EAAM,CACxC,CAAC,CACL,CACJ,CACA,OAAOkQ,CAKX,CAHA,MAAO5O,GAEH,OAAOvM,CACX,CACJ,EAIAoU,KAAM,WACF,OAAO5W,KAAKwV,MAAM/H,KACtB,EAIA0H,QAAS,SAAUC,GACf,GAAIA,EAAKrR,aAAa,yBAAyB,EAAG,CAC9C/D,KAAKwV,MAAM/H,MAAQ2H,EAAKnP,aAAa,yBAAyB,CAClE,KACK,CACDjG,KAAKwV,MAAM/H,MAAQ2H,EAAK1G,SAC5B,CACA1O,KAAKwV,MAAM7R,aAAa,8BAA+B3D,KAAKwV,MAAM/H,KAAK,CAC3E,EAIAuO,OAAQ,aAER1F,WAAY,KACZmE,OAAQ,GACR/B,WAAY,EAChB,EACA,OAAO1E,CACX,EAAG,EACHiD,EAAOD,QAAUhD,CAEjB,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAChB,CAAC"} \ No newline at end of file +{"version":3,"file":"searxng.min.js","sources":["../src/js/main/00_toolkit.js","../src/js/main/infinite_scroll.js","../src/js/main/keyboard.js","../src/js/main/mapresult.js","../src/js/main/preferences.js","../src/js/main/results.js","../src/js/main/search.js","../node_modules/autocomplete-js/dist/autocomplete.js"],"sourcesContent":["/**\n * @license\n * (C) Copyright Contributors to the SearXNG project.\n * (C) Copyright Contributors to the searx project (2014 - 2021).\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\nwindow.searxng = (function (w, d) {\n\n 'use strict';\n\n // not invented here tookit with bugs fixed elsewhere\n // purposes : be just good enough and as small as possible\n\n // from https://plainjs.com/javascript/events/live-binding-event-handlers-14/\n if (w.Element) {\n (function (ElementPrototype) {\n ElementPrototype.matches = ElementPrototype.matches ||\n ElementPrototype.matchesSelector ||\n ElementPrototype.webkitMatchesSelector ||\n ElementPrototype.msMatchesSelector ||\n function (selector) {\n var node = this, nodes = (node.parentNode || node.document).querySelectorAll(selector), i = -1;\n while (nodes[++i] && nodes[i] != node);\n return !!nodes[i];\n };\n })(Element.prototype);\n }\n\n function callbackSafe (callback, el, e) {\n try {\n callback.call(el, e);\n } catch (exception) {\n console.log(exception);\n }\n }\n\n var searxng = window.searxng || {};\n\n searxng.on = function (obj, eventType, callback, useCapture) {\n useCapture = useCapture || false;\n if (typeof obj !== 'string') {\n // obj HTMLElement, HTMLDocument\n obj.addEventListener(eventType, callback, useCapture);\n } else {\n // obj is a selector\n d.addEventListener(eventType, function (e) {\n var el = e.target || e.srcElement, found = false;\n while (el && el.matches && el !== d && !(found = el.matches(obj))) el = el.parentElement;\n if (found) callbackSafe(callback, el, e);\n }, useCapture);\n }\n };\n\n searxng.ready = function (callback) {\n if (document.readyState != 'loading') {\n callback.call(w);\n } else {\n w.addEventListener('DOMContentLoaded', callback.bind(w));\n }\n };\n\n searxng.http = function (method, url, data = null) {\n return new Promise(function (resolve, reject) {\n try {\n var req = new XMLHttpRequest();\n req.open(method, url, true);\n req.timeout = 20000;\n\n // On load\n req.onload = function () {\n if (req.status == 200) {\n resolve(req.response, req.responseType);\n } else {\n reject(Error(req.statusText));\n }\n };\n\n // Handle network errors\n req.onerror = function () {\n reject(Error(\"Network Error\"));\n };\n\n req.onabort = function () {\n reject(Error(\"Transaction is aborted\"));\n };\n\n req.ontimeout = function () {\n reject(Error(\"Timeout\"));\n }\n\n // Make the request\n if (data) {\n req.send(data)\n } else {\n req.send();\n }\n } catch (ex) {\n reject(ex);\n }\n });\n };\n\n searxng.loadStyle = function (src) {\n var path = searxng.settings.theme_static_path + \"/\" + src,\n id = \"style_\" + src.replace('.', '_'),\n s = d.getElementById(id);\n if (s === null) {\n s = d.createElement('link');\n s.setAttribute('id', id);\n s.setAttribute('rel', 'stylesheet');\n s.setAttribute('type', 'text/css');\n s.setAttribute('href', path);\n d.body.appendChild(s);\n }\n };\n\n searxng.loadScript = function (src, callback) {\n var path = searxng.settings.theme_static_path + \"/\" + src,\n id = \"script_\" + src.replace('.', '_'),\n s = d.getElementById(id);\n if (s === null) {\n s = d.createElement('script');\n s.setAttribute('id', id);\n s.setAttribute('src', path);\n s.onload = callback;\n s.onerror = function () {\n s.setAttribute('error', '1');\n };\n d.body.appendChild(s);\n } else if (!s.hasAttribute('error')) {\n try {\n callback.apply(s, []);\n } catch (exception) {\n console.log(exception);\n }\n } else {\n console.log(\"callback not executed : script '\" + path + \"' not loaded.\");\n }\n };\n\n searxng.insertBefore = function (newNode, referenceNode) {\n referenceNode.parentNode.insertBefore(newNode, referenceNode);\n };\n\n searxng.insertAfter = function (newNode, referenceNode) {\n referenceNode.parentNode.insertAfter(newNode, referenceNode.nextSibling);\n };\n\n searxng.on('.close', 'click', function () {\n this.parentNode.classList.add('invisible');\n });\n\n function getEndpoint () {\n for (var className of d.getElementsByTagName('body')[0].classList.values()) {\n if (className.endsWith('_endpoint')) {\n return className.split('_')[0];\n }\n }\n return '';\n }\n\n searxng.endpoint = getEndpoint();\n\n return searxng;\n})(window, document);\n","// SPDX-License-Identifier: AGPL-3.0-or-later\n\n/* global searxng */\n\nsearxng.ready(function () {\n 'use strict';\n\n searxng.infinite_scroll_supported = (\n 'IntersectionObserver' in window &&\n 'IntersectionObserverEntry' in window &&\n 'intersectionRatio' in window.IntersectionObserverEntry.prototype);\n\n if (searxng.endpoint !== 'results') {\n return;\n }\n\n if (!searxng.infinite_scroll_supported) {\n console.log('IntersectionObserver not supported');\n return;\n }\n\n let d = document;\n var onlyImages = d.getElementById('results').classList.contains('only_template_images');\n\n function newLoadSpinner () {\n var loader = d.createElement('div');\n loader.classList.add('loader');\n return loader;\n }\n\n function replaceChildrenWith (element, children) {\n element.textContent = '';\n children.forEach(child => element.appendChild(child));\n }\n\n function loadNextPage (callback) {\n var form = d.querySelector('#pagination form.next_page');\n if (!form) {\n return\n }\n replaceChildrenWith(d.querySelector('#pagination'), [ newLoadSpinner() ]);\n var formData = new FormData(form);\n searxng.http('POST', d.querySelector('#search').getAttribute('action'), formData).then(\n function (response) {\n var nextPageDoc = new DOMParser().parseFromString(response, 'text/html');\n var articleList = nextPageDoc.querySelectorAll('#urls article');\n var paginationElement = nextPageDoc.querySelector('#pagination');\n d.querySelector('#pagination').remove();\n if (articleList.length > 0 && !onlyImages) {\n // do not add
element when there are only images\n d.querySelector('#urls').appendChild(d.createElement('hr'));\n }\n articleList.forEach(articleElement => {\n d.querySelector('#urls').appendChild(articleElement);\n });\n if (paginationElement) {\n d.querySelector('#results').appendChild(paginationElement);\n callback();\n }\n }\n ).catch(\n function (err) {\n console.log(err);\n var e = d.createElement('div');\n e.textContent = searxng.settings.translations.error_loading_next_page;\n e.classList.add('dialog-error');\n e.setAttribute('role', 'alert');\n replaceChildrenWith(d.querySelector('#pagination'), [ e ]);\n }\n )\n }\n\n if (searxng.settings.infinite_scroll && searxng.infinite_scroll_supported) {\n const intersectionObserveOptions = {\n rootMargin: \"20rem\",\n };\n const observedSelector = 'article.result:last-child';\n const observer = new IntersectionObserver(entries => {\n const paginationEntry = entries[0];\n if (paginationEntry.isIntersecting) {\n observer.unobserve(paginationEntry.target);\n loadNextPage(() => observer.observe(d.querySelector(observedSelector), intersectionObserveOptions));\n }\n });\n observer.observe(d.querySelector(observedSelector), intersectionObserveOptions);\n }\n\n});\n","/* SPDX-License-Identifier: AGPL-3.0-or-later */\n/* global searxng */\n\nsearxng.ready(function () {\n\n function isElementInDetail (el) {\n while (el !== undefined) {\n if (el.classList.contains('detail')) {\n return true;\n }\n if (el.classList.contains('result')) {\n // we found a result, no need to go to the root of the document:\n // el is not inside a
element\n return false;\n }\n el = el.parentNode;\n }\n return false;\n }\n\n function getResultElement (el) {\n while (el !== undefined) {\n if (el.classList.contains('result')) {\n return el;\n }\n el = el.parentNode;\n }\n return undefined;\n }\n\n function isImageResult (resultElement) {\n return resultElement && resultElement.classList.contains('result-images');\n }\n\n searxng.on('.result', 'click', function (e) {\n if (!isElementInDetail(e.target)) {\n highlightResult(this)(true, true);\n let resultElement = getResultElement(e.target);\n if (isImageResult(resultElement)) {\n e.preventDefault();\n searxng.selectImage(resultElement);\n }\n }\n });\n\n searxng.on('.result a', 'focus', function (e) {\n if (!isElementInDetail(e.target)) {\n let resultElement = getResultElement(e.target);\n if (resultElement && resultElement.getAttribute(\"data-vim-selected\") === null) {\n highlightResult(resultElement)(true);\n }\n if (isImageResult(resultElement)) {\n searxng.selectImage(resultElement);\n }\n }\n }, true);\n\n // these bindings are always on\n var keyBindings = {\n 'Escape': {\n key: 'ESC',\n fun: removeFocus,\n des: 'remove focus from the focused input',\n cat: 'Control'\n },\n 'ArrowLeft': {\n key: '⬅',\n fun: highlightResult('up'),\n des: 'Use left arrow to select previous search result',\n cat: 'Results'\n },\n 'ArrowRight': {\n key: '➡',\n fun: highlightResult('down'),\n des: 'Use right arrow to select next search result',\n cat: 'Results'\n },\n 'h': {\n key: 'h',\n fun: toggleHelp,\n des: 'toggle help window',\n cat: 'Other'\n },\n 'i': {\n key: 'i',\n fun: searchInputFocus,\n des: 'focus on the search input',\n cat: 'Control'\n },\n 'n': {\n key: 'n',\n fun: GoToNextPage(),\n des: 'go to next page',\n cat: 'Results'\n },\n 'o': {\n key: 'o',\n fun: openResult(false),\n des: 'open search result',\n cat: 'Results'\n },\n 'p': {\n key: 'p',\n fun: GoToPreviousPage(),\n des: 'go to previous page',\n cat: 'Results'\n },\n 'r': {\n key: 'r',\n fun: reloadPage,\n des: 'reload page from the server',\n cat: 'Control'\n },\n 't': {\n key: 't',\n fun: openResult(true),\n des: 'open the result in a new tab',\n cat: 'Results'\n },\n }\n\n // these bindings are enabled by user preferences\n var vimKeys = {\n 'b': {\n key: 'b',\n fun: scrollPage(-window.innerHeight),\n des: 'scroll one page up',\n cat: 'Navigation'\n },\n 'f': {\n key: 'f',\n fun: scrollPage(window.innerHeight),\n des: 'scroll one page down',\n cat: 'Navigation'\n },\n 'u': {\n key: 'u',\n fun: scrollPage(-window.innerHeight / 2),\n des: 'scroll half a page up',\n cat: 'Navigation'\n },\n 'd': {\n key: 'd',\n fun: scrollPage(window.innerHeight / 2),\n des: 'scroll half a page down',\n cat: 'Navigation'\n },\n 'g': {\n key: 'g',\n fun: scrollPageTo(-document.body.scrollHeight, 'top'),\n des: 'scroll to the top of the page',\n cat: 'Navigation'\n },\n 'v': {\n key: 'v',\n fun: scrollPageTo(document.body.scrollHeight, 'bottom'),\n des: 'scroll to the bottom of the page',\n cat: 'Navigation'\n },\n 'k': {\n key: 'k',\n fun: highlightResult('up'),\n des: 'select previous search result',\n cat: 'Results'\n },\n 'j': {\n key: 'j',\n fun: highlightResult('down'),\n des: 'select next search result',\n cat: 'Results'\n },\n };\n\n if (searxng.settings.hotkeys) {\n // To add Vim-like key bindings, merge the 'vimKeys' into 'keyBindings'.\n Object.assign(keyBindings, vimKeys);\n }\n\n searxng.on(document, \"keydown\", function (e) {\n // check for modifiers so we don't break browser's hotkeys\n if (\n Object.prototype.hasOwnProperty.call(keyBindings, e.key)\n && !e.ctrlKey && !e.altKey\n && !e.shiftKey && !e.metaKey\n ) {\n var tagName = e.target.tagName.toLowerCase();\n if (e.key === 'Escape') {\n keyBindings[e.key].fun(e);\n } else {\n if (e.target === document.body || tagName === 'a' || tagName === 'button') {\n e.preventDefault();\n keyBindings[e.key].fun();\n }\n }\n }\n });\n\n function highlightResult (which) {\n return function (noScroll, keepFocus) {\n var current = document.querySelector('.result[data-vim-selected]'),\n effectiveWhich = which;\n if (current === null) {\n // no selection : choose the first one\n current = document.querySelector('.result');\n if (current === null) {\n // no first one : there are no results\n return;\n }\n // replace up/down actions by selecting first one\n if (which === \"down\" || which === \"up\") {\n effectiveWhich = current;\n }\n }\n\n var next, results = document.querySelectorAll('.result');\n\n if (typeof effectiveWhich !== 'string') {\n next = effectiveWhich;\n } else {\n switch (effectiveWhich) {\n case 'visible':\n var top = document.documentElement.scrollTop || document.body.scrollTop;\n var bot = top + document.documentElement.clientHeight;\n\n for (var i = 0; i < results.length; i++) {\n next = results[i];\n var etop = next.offsetTop;\n var ebot = etop + next.clientHeight;\n\n if ((ebot <= bot) && (etop > top)) {\n break;\n }\n }\n break;\n case 'down':\n next = current.nextElementSibling;\n if (next === null) {\n next = results[0];\n }\n break;\n case 'up':\n next = current.previousElementSibling;\n if (next === null) {\n next = results[results.length - 1];\n }\n break;\n case 'bottom':\n next = results[results.length - 1];\n break;\n case 'top':\n /* falls through */\n default:\n next = results[0];\n }\n }\n\n if (next) {\n current.removeAttribute('data-vim-selected');\n next.setAttribute('data-vim-selected', 'true');\n if (!keepFocus) {\n var link = next.querySelector('h3 a') || next.querySelector('a');\n if (link !== null) {\n link.focus();\n }\n }\n if (!noScroll) {\n scrollPageToSelected();\n }\n }\n };\n }\n\n function reloadPage () {\n document.location.reload(true);\n }\n\n function removeFocus (e) {\n const tagName = e.target.tagName.toLowerCase();\n if (document.activeElement && (tagName === 'input' || tagName === 'select' || tagName === 'textarea')) {\n document.activeElement.blur();\n } else {\n searxng.closeDetail();\n }\n }\n\n function pageButtonClick (css_selector) {\n return function () {\n var button = document.querySelector(css_selector);\n if (button) {\n button.click();\n }\n };\n }\n\n function GoToNextPage () {\n return pageButtonClick('nav#pagination .next_page button[type=\"submit\"]');\n }\n\n function GoToPreviousPage () {\n return pageButtonClick('nav#pagination .previous_page button[type=\"submit\"]');\n }\n\n function scrollPageToSelected () {\n var sel = document.querySelector('.result[data-vim-selected]');\n if (sel === null) {\n return;\n }\n var wtop = document.documentElement.scrollTop || document.body.scrollTop,\n wheight = document.documentElement.clientHeight,\n etop = sel.offsetTop,\n ebot = etop + sel.clientHeight,\n offset = 120;\n // first element ?\n if ((sel.previousElementSibling === null) && (ebot < wheight)) {\n // set to the top of page if the first element\n // is fully included in the viewport\n window.scroll(window.scrollX, 0);\n return;\n }\n if (wtop > (etop - offset)) {\n window.scroll(window.scrollX, etop - offset);\n } else {\n var wbot = wtop + wheight;\n if (wbot < (ebot + offset)) {\n window.scroll(window.scrollX, ebot - wheight + offset);\n }\n }\n }\n\n function scrollPage (amount) {\n return function () {\n window.scrollBy(0, amount);\n highlightResult('visible')();\n };\n }\n\n function scrollPageTo (position, nav) {\n return function () {\n window.scrollTo(0, position);\n highlightResult(nav)();\n };\n }\n\n function searchInputFocus () {\n window.scrollTo(0, 0);\n var q = document.querySelector('#q');\n q.focus();\n if (q.setSelectionRange) {\n var len = q.value.length;\n q.setSelectionRange(len, len);\n }\n }\n\n function openResult (newTab) {\n return function () {\n var link = document.querySelector('.result[data-vim-selected] h3 a');\n if (link === null) {\n link = document.querySelector('.result[data-vim-selected] > a');\n }\n if (link !== null) {\n var url = link.getAttribute('href');\n if (newTab) {\n window.open(url);\n } else {\n window.location.href = url;\n }\n }\n };\n }\n\n function initHelpContent (divElement) {\n var categories = {};\n\n for (var k in keyBindings) {\n var key = keyBindings[k];\n categories[key.cat] = categories[key.cat] || [];\n categories[key.cat].push(key);\n }\n\n var sorted = Object.keys(categories).sort(function (a, b) {\n return categories[b].length - categories[a].length;\n });\n\n if (sorted.length === 0) {\n return;\n }\n\n var html = '×';\n html += '

How to navigate SearXNG with hotkeys

';\n html += '';\n\n for (var i = 0; i < sorted.length; i++) {\n var cat = categories[sorted[i]];\n\n var lastCategory = i === (sorted.length - 1);\n var first = i % 2 === 0;\n\n if (first) {\n html += '';\n }\n html += ''; // col-sm-*\n\n if (!first || lastCategory) {\n html += ''; // row\n }\n }\n\n html += '
';\n\n html += '

' + cat[0].cat + '

';\n html += '
    ';\n\n for (var cj in cat) {\n html += '
  • ' + cat[cj].key + ' ' + cat[cj].des + '
  • ';\n }\n\n html += '
';\n html += '
';\n\n divElement.innerHTML = html;\n }\n\n function toggleHelp () {\n var helpPanel = document.querySelector('#vim-hotkeys-help');\n if (helpPanel === undefined || helpPanel === null) {\n // first call\n helpPanel = document.createElement('div');\n helpPanel.id = 'vim-hotkeys-help';\n helpPanel.className = 'dialog-modal';\n initHelpContent(helpPanel);\n var body = document.getElementsByTagName('body')[0];\n body.appendChild(helpPanel);\n } else {\n // togggle hidden\n helpPanel.classList.toggle('invisible');\n return;\n }\n }\n\n searxng.scrollPageToSelected = scrollPageToSelected;\n searxng.selectNext = highlightResult('down');\n searxng.selectPrevious = highlightResult('up');\n});\n","/* SPDX-License-Identifier: AGPL-3.0-or-later */\n/* global L */\n(function (w, d, searxng) {\n 'use strict';\n\n searxng.ready(function () {\n searxng.on('.searxng_init_map', 'click', function (event) {\n // no more request\n this.classList.remove(\"searxng_init_map\");\n\n //\n var leaflet_target = this.dataset.leafletTarget;\n var map_lon = parseFloat(this.dataset.mapLon);\n var map_lat = parseFloat(this.dataset.mapLat);\n var map_zoom = parseFloat(this.dataset.mapZoom);\n var map_boundingbox = JSON.parse(this.dataset.mapBoundingbox);\n var map_geojson = JSON.parse(this.dataset.mapGeojson);\n\n searxng.loadStyle('css/leaflet.css');\n searxng.loadScript('js/leaflet.js', function () {\n var map_bounds = null;\n if (map_boundingbox) {\n var southWest = L.latLng(map_boundingbox[0], map_boundingbox[2]);\n var northEast = L.latLng(map_boundingbox[1], map_boundingbox[3]);\n map_bounds = L.latLngBounds(southWest, northEast);\n }\n\n // init map\n var map = L.map(leaflet_target);\n // create the tile layer with correct attribution\n var osmMapnikUrl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';\n var osmMapnikAttrib = 'Map data © OpenStreetMap contributors';\n var osmMapnik = new L.TileLayer(osmMapnikUrl, {minZoom: 1, maxZoom: 19, attribution: osmMapnikAttrib});\n var osmWikimediaUrl = 'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png';\n var osmWikimediaAttrib = 'Wikimedia maps | Maps data © OpenStreetMap contributors';\n var osmWikimedia = new L.TileLayer(osmWikimediaUrl, {minZoom: 1, maxZoom: 19, attribution: osmWikimediaAttrib});\n // init map view\n if (map_bounds) {\n // TODO hack: https://github.com/Leaflet/Leaflet/issues/2021\n // Still useful ?\n setTimeout(function () {\n map.fitBounds(map_bounds, {\n maxZoom: 17\n });\n }, 0);\n } else if (map_lon && map_lat) {\n if (map_zoom) {\n map.setView(new L.latLng(map_lat, map_lon), map_zoom);\n } else {\n map.setView(new L.latLng(map_lat, map_lon), 8);\n }\n }\n\n map.addLayer(osmMapnik);\n\n var baseLayers = {\n \"OSM Mapnik\": osmMapnik,\n \"OSM Wikimedia\": osmWikimedia,\n };\n\n L.control.layers(baseLayers).addTo(map);\n\n if (map_geojson) {\n L.geoJson(map_geojson).addTo(map);\n } /* else if(map_bounds) {\n L.rectangle(map_bounds, {color: \"#ff7800\", weight: 3, fill:false}).addTo(map);\n } */\n });\n\n // this event occour only once per element\n event.preventDefault();\n });\n });\n})(window, document, window.searxng);\n","/* SPDX-License-Identifier: AGPL-3.0-or-later */\n(function (w, d, searxng) {\n 'use strict';\n\n if (searxng.endpoint !== 'preferences') {\n return;\n }\n\n searxng.ready(function () {\n let engine_descriptions = null;\n function load_engine_descriptions () {\n if (engine_descriptions == null) {\n searxng.http(\"GET\", \"engine_descriptions.json\").then(function (content) {\n engine_descriptions = JSON.parse(content);\n for (const [engine_name, description] of Object.entries(engine_descriptions)) {\n let elements = d.querySelectorAll('[data-engine-name=\"' + engine_name + '\"] .engine-description');\n for (const element of elements) {\n let source = ' (' + searxng.settings.translations.Source + ': ' + description[1] + ')';\n element.innerHTML = description[0] + source;\n }\n }\n });\n }\n }\n\n for (const el of d.querySelectorAll('[data-engine-name]')) {\n searxng.on(el, 'mouseenter', load_engine_descriptions);\n }\n });\n})(window, document, window.searxng);\n","/* SPDX-License-Identifier: AGPL-3.0-or-later */\n(function (w, d, searxng) {\n 'use strict';\n\n if (searxng.endpoint !== 'results') {\n return;\n }\n\n searxng.ready(function () {\n d.querySelectorAll('#urls img.image').forEach(\n img =>\n img.addEventListener(\n 'error', () => {\n img.style.display = 'none';\n img.error = null;\n }\n ));\n\n searxng.on('.btn-collapse', 'click', function () {\n var btnLabelCollapsed = this.getAttribute('data-btn-text-collapsed');\n var btnLabelNotCollapsed = this.getAttribute('data-btn-text-not-collapsed');\n var target = this.getAttribute('data-target');\n var targetElement = d.querySelector(target);\n var html = this.innerHTML;\n if (this.classList.contains('collapsed')) {\n html = html.replace(btnLabelCollapsed, btnLabelNotCollapsed);\n } else {\n html = html.replace(btnLabelNotCollapsed, btnLabelCollapsed);\n }\n this.innerHTML = html;\n this.classList.toggle('collapsed');\n targetElement.classList.toggle('invisible');\n });\n\n searxng.on('.media-loader', 'click', function () {\n var target = this.getAttribute('data-target');\n var iframe_load = d.querySelector(target + ' > iframe');\n var srctest = iframe_load.getAttribute('src');\n if (srctest === null || srctest === undefined || srctest === false) {\n iframe_load.setAttribute('src', iframe_load.getAttribute('data-src'));\n }\n });\n\n searxng.selectImage = function (resultElement) {\n /* eslint no-unused-vars: 0 */\n if (resultElement) {\n // load full size image in background\n const imgElement = resultElement.querySelector('.result-images-source img');\n const thumbnailElement = resultElement.querySelector('.image_thumbnail');\n const detailElement = resultElement.querySelector('.detail');\n if (imgElement) {\n const imgSrc = imgElement.getAttribute('data-src');\n if (imgSrc) {\n const loader = d.createElement('div');\n const imgLoader = new Image();\n\n loader.classList.add('loader');\n detailElement.appendChild(loader);\n\n imgLoader.onload = e => {\n imgElement.src = imgSrc;\n loader.remove();\n };\n imgLoader.onerror = e => {\n loader.remove();\n };\n imgLoader.src = imgSrc;\n imgElement.src = thumbnailElement.src;\n imgElement.removeAttribute('data-src');\n }\n }\n }\n d.getElementById('results').classList.add('image-detail-open');\n searxng.scrollPageToSelected();\n }\n\n searxng.closeDetail = function (e) {\n d.getElementById('results').classList.remove('image-detail-open');\n searxng.scrollPageToSelected();\n }\n searxng.on('.result-detail-close', 'click', e => {\n e.preventDefault();\n searxng.closeDetail();\n });\n searxng.on('.result-detail-previous', 'click', e => searxng.selectPrevious(false));\n searxng.on('.result-detail-next', 'click', e => searxng.selectNext(false));\n\n w.addEventListener('scroll', function () {\n var e = d.getElementById('backToTop'),\n scrollTop = document.documentElement.scrollTop || document.body.scrollTop,\n results = d.getElementById('results');\n if (e !== null) {\n if (scrollTop >= 100) {\n results.classList.add('scrolling');\n } else {\n results.classList.remove('scrolling');\n }\n }\n }, true);\n\n });\n\n})(window, document, window.searxng);\n","/* SPDX-License-Identifier: AGPL-3.0-or-later */\n/* global AutoComplete */\n(function (w, d, searxng) {\n 'use strict';\n\n var qinput_id = \"q\", qinput;\n\n const isMobile = window.matchMedia(\"only screen and (max-width: 50em)\").matches;\n\n function submitIfQuery () {\n if (qinput.value.length > 0) {\n var search = document.getElementById('search');\n setTimeout(search.submit.bind(search), 0);\n }\n }\n\n function createClearButton (qinput) {\n var cs = document.getElementById('clear_search');\n var updateClearButton = function () {\n if (qinput.value.length === 0) {\n cs.classList.add(\"empty\");\n } else {\n cs.classList.remove(\"empty\");\n }\n };\n\n // update status, event listener\n updateClearButton();\n cs.addEventListener('click', function (ev) {\n qinput.value = '';\n qinput.focus();\n updateClearButton();\n ev.preventDefault();\n });\n qinput.addEventListener('keyup', updateClearButton, false);\n }\n\n searxng.ready(function () {\n qinput = d.getElementById(qinput_id);\n\n if (qinput !== null) {\n // clear button\n createClearButton(qinput);\n\n // autocompleter\n if (searxng.settings.autocomplete_provider) {\n searxng.autocomplete = AutoComplete.call(w, {\n Url: \"./autocompleter\",\n EmptyMessage: searxng.settings.translations.no_item_found,\n HttpMethod: searxng.settings.http_method,\n HttpHeaders: {\n \"Content-type\": \"application/x-www-form-urlencoded\",\n \"X-Requested-With\": \"XMLHttpRequest\"\n },\n MinChars: searxng.settings.autocomplete_min,\n Delay: 300,\n _Position: function () {},\n _Open: function () {\n var params = this;\n Array.prototype.forEach.call(this.DOMResults.getElementsByTagName(\"li\"), function (li) {\n if (li.getAttribute(\"class\") != \"locked\") {\n li.onmousedown = function () {\n params._Select(li);\n };\n }\n });\n },\n _Select: function (item) {\n AutoComplete.defaults._Select.call(this, item);\n var form = item.closest('form');\n if (form) {\n form.submit();\n }\n },\n _MinChars: function () {\n if (this.Input.value.indexOf('!') > -1) {\n return 0;\n } else {\n return AutoComplete.defaults._MinChars.call(this);\n }\n },\n KeyboardMappings: Object.assign({}, AutoComplete.defaults.KeyboardMappings, {\n \"KeyUpAndDown_up\": Object.assign({}, AutoComplete.defaults.KeyboardMappings.KeyUpAndDown_up, {\n Callback: function (event) {\n AutoComplete.defaults.KeyboardMappings.KeyUpAndDown_up.Callback.call(this, event);\n var liActive = this.DOMResults.querySelector(\"li.active\");\n if (liActive) {\n AutoComplete.defaults._Select.call(this, liActive);\n }\n },\n }),\n \"Tab\": Object.assign({}, AutoComplete.defaults.KeyboardMappings.Enter, {\n Conditions: [{\n Is: 9,\n Not: false\n }],\n Callback: function (event) {\n if (this.DOMResults.getAttribute(\"class\").indexOf(\"open\") != -1) {\n var liActive = this.DOMResults.querySelector(\"li.active\");\n if (liActive !== null) {\n AutoComplete.defaults._Select.call(this, liActive);\n event.preventDefault();\n }\n }\n },\n })\n }),\n }, \"#\" + qinput_id);\n }\n\n /*\n Monkey patch autocomplete.js to fix a bug\n With the POST method, the values are not URL encoded: query like \"1 + 1\" are sent as \"1 1\" since space are URL encoded as plus.\n See HTML specifications:\n * HTML5: https://url.spec.whatwg.org/#concept-urlencoded-serializer\n * HTML4: https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1\n\n autocomplete.js does not URL encode the name and values:\n https://github.com/autocompletejs/autocomplete.js/blob/87069524f3b95e68f1b54d8976868e0eac1b2c83/src/autocomplete.ts#L665\n\n The monkey patch overrides the compiled version of the ajax function.\n See https://github.com/autocompletejs/autocomplete.js/blob/87069524f3b95e68f1b54d8976868e0eac1b2c83/dist/autocomplete.js#L143-L158\n The patch changes only the line 156 from\n params.Request.send(params._QueryArg() + \"=\" + params._Pre());\n to\n params.Request.send(encodeURIComponent(params._QueryArg()) + \"=\" + encodeURIComponent(params._Pre()));\n\n Related to:\n * https://github.com/autocompletejs/autocomplete.js/issues/78\n * https://github.com/searxng/searxng/issues/1695\n */\n AutoComplete.prototype.ajax = function (params, request, timeout) {\n if (timeout === void 0) { timeout = true; }\n if (params.$AjaxTimer) {\n window.clearTimeout(params.$AjaxTimer);\n }\n if (timeout === true) {\n params.$AjaxTimer = window.setTimeout(AutoComplete.prototype.ajax.bind(null, params, request, false), params.Delay);\n } else {\n if (params.Request) {\n params.Request.abort();\n }\n params.Request = request;\n params.Request.send(encodeURIComponent(params._QueryArg()) + \"=\" + encodeURIComponent(params._Pre()));\n }\n };\n\n if (!isMobile && document.querySelector('.index_endpoint')) {\n qinput.focus();\n }\n }\n\n // vanilla js version of search_on_category_select.js\n if (qinput !== null && d.querySelector('.help') != null && searxng.settings.search_on_category_select) {\n d.querySelector('.help').className = 'invisible';\n\n searxng.on('#categories input', 'change', function () {\n var i, categories = d.querySelectorAll('#categories input[type=\"checkbox\"]');\n for (i = 0; i < categories.length; i++) {\n if (categories[i] !== this && categories[i].checked) {\n categories[i].click();\n }\n }\n if (! this.checked) {\n this.click();\n }\n submitIfQuery();\n return false;\n });\n\n searxng.on(d.getElementById('safesearch'), 'change', submitIfQuery);\n searxng.on(d.getElementById('time_range'), 'change', submitIfQuery);\n searxng.on(d.getElementById('language'), 'change', submitIfQuery);\n }\n\n });\n\n})(window, document, window.searxng);\n","(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.AutoComplete = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i @baptistedonaux\n */\nvar AutoComplete = /** @class */ (function () {\n // Constructor\n function AutoComplete(params, selector) {\n if (params === void 0) { params = {}; }\n if (selector === void 0) { selector = \"[data-autocomplete]\"; }\n if (Array.isArray(selector)) {\n selector.forEach(function (s) {\n new AutoComplete(params, s);\n });\n }\n else if (typeof selector == \"string\") {\n var elements = document.querySelectorAll(selector);\n Array.prototype.forEach.call(elements, function (input) {\n new AutoComplete(params, input);\n });\n }\n else {\n var specificParams = AutoComplete.merge(AutoComplete.defaults, params, {\n DOMResults: document.createElement(\"div\")\n });\n AutoComplete.prototype.create(specificParams, selector);\n return specificParams;\n }\n }\n AutoComplete.prototype.create = function (params, element) {\n params.Input = element;\n if (params.Input.nodeName.match(/^INPUT$/i) && (params.Input.hasAttribute(\"type\") === false || params.Input.getAttribute(\"type\").match(/^TEXT|SEARCH$/i))) {\n params.Input.setAttribute(\"autocomplete\", \"off\");\n params._Position(params);\n params.Input.parentNode.appendChild(params.DOMResults);\n params.$Listeners = {\n blur: params._Blur.bind(params),\n destroy: AutoComplete.prototype.destroy.bind(null, params),\n focus: params._Focus.bind(params),\n keyup: AutoComplete.prototype.event.bind(null, params, EventType.KEYUP),\n keydown: AutoComplete.prototype.event.bind(null, params, EventType.KEYDOWN),\n position: params._Position.bind(params)\n };\n for (var event in params.$Listeners) {\n params.Input.addEventListener(event, params.$Listeners[event]);\n }\n }\n };\n AutoComplete.prototype.getEventsByType = function (params, type) {\n var mappings = {};\n for (var key in params.KeyboardMappings) {\n var event = EventType.KEYUP;\n if (params.KeyboardMappings[key].Event !== undefined) {\n event = params.KeyboardMappings[key].Event;\n }\n if (event == type) {\n mappings[key] = params.KeyboardMappings[key];\n }\n }\n return mappings;\n };\n AutoComplete.prototype.event = function (params, type, event) {\n var eventIdentifier = function (condition) {\n if ((match === true && mapping.Operator == ConditionOperator.AND) || (match === false && mapping.Operator == ConditionOperator.OR)) {\n condition = AutoComplete.merge({\n Not: false\n }, condition);\n if (condition.hasOwnProperty(\"Is\")) {\n if (condition.Is == event.keyCode) {\n match = !condition.Not;\n }\n else {\n match = condition.Not;\n }\n }\n else if (condition.hasOwnProperty(\"From\") && condition.hasOwnProperty(\"To\")) {\n if (event.keyCode >= condition.From && event.keyCode <= condition.To) {\n match = !condition.Not;\n }\n else {\n match = condition.Not;\n }\n }\n }\n };\n for (var name in AutoComplete.prototype.getEventsByType(params, type)) {\n var mapping = AutoComplete.merge({\n Operator: ConditionOperator.AND\n }, params.KeyboardMappings[name]), match = ConditionOperator.AND == mapping.Operator;\n mapping.Conditions.forEach(eventIdentifier);\n if (match === true) {\n mapping.Callback.call(params, event);\n }\n }\n };\n AutoComplete.prototype.makeRequest = function (params, callback, callbackErr) {\n var propertyHttpHeaders = Object.getOwnPropertyNames(params.HttpHeaders), request = new XMLHttpRequest(), method = params._HttpMethod(), url = params._Url(), queryParams = params._Pre(), queryParamsStringify = encodeURIComponent(params._QueryArg()) + \"=\" + encodeURIComponent(queryParams);\n if (method.match(/^GET$/i)) {\n if (url.indexOf(\"?\") !== -1) {\n url += \"&\" + queryParamsStringify;\n }\n else {\n url += \"?\" + queryParamsStringify;\n }\n }\n request.open(method, url, true);\n for (var i = propertyHttpHeaders.length - 1; i >= 0; i--) {\n request.setRequestHeader(propertyHttpHeaders[i], params.HttpHeaders[propertyHttpHeaders[i]]);\n }\n request.onreadystatechange = function () {\n if (request.readyState == 4 && request.status == 200) {\n params.$Cache[queryParams] = request.response;\n callback(request.response);\n }\n else if (request.status >= 400) {\n callbackErr();\n }\n };\n return request;\n };\n AutoComplete.prototype.ajax = function (params, request, timeout) {\n if (timeout === void 0) { timeout = true; }\n if (params.$AjaxTimer) {\n window.clearTimeout(params.$AjaxTimer);\n }\n if (timeout === true) {\n params.$AjaxTimer = window.setTimeout(AutoComplete.prototype.ajax.bind(null, params, request, false), params.Delay);\n }\n else {\n if (params.Request) {\n params.Request.abort();\n }\n params.Request = request;\n params.Request.send(params._QueryArg() + \"=\" + params._Pre());\n }\n };\n AutoComplete.prototype.cache = function (params, callback, callbackErr) {\n var response = params._Cache(params._Pre());\n if (response === undefined) {\n var request = AutoComplete.prototype.makeRequest(params, callback, callbackErr);\n AutoComplete.prototype.ajax(params, request);\n }\n else {\n callback(response);\n }\n };\n AutoComplete.prototype.destroy = function (params) {\n for (var event in params.$Listeners) {\n params.Input.removeEventListener(event, params.$Listeners[event]);\n }\n params.DOMResults.parentNode.removeChild(params.DOMResults);\n };\n AutoComplete.merge = function () {\n var merge = {}, tmp;\n for (var i = 0; i < arguments.length; i++) {\n for (tmp in arguments[i]) {\n merge[tmp] = arguments[i][tmp];\n }\n }\n return merge;\n };\n AutoComplete.defaults = {\n Delay: 150,\n EmptyMessage: \"No result here\",\n Highlight: {\n getRegex: function (value) {\n return new RegExp(value, \"ig\");\n },\n transform: function (value) {\n return \"\" + value + \"\";\n }\n },\n HttpHeaders: {\n \"Content-type\": \"application/x-www-form-urlencoded\"\n },\n Limit: 0,\n MinChars: 0,\n HttpMethod: \"GET\",\n QueryArg: \"q\",\n Url: null,\n KeyboardMappings: {\n \"Enter\": {\n Conditions: [{\n Is: 13,\n Not: false\n }],\n Callback: function (event) {\n if (this.DOMResults.getAttribute(\"class\").indexOf(\"open\") != -1) {\n var liActive = this.DOMResults.querySelector(\"li.active\");\n if (liActive !== null) {\n event.preventDefault();\n this._Select(liActive);\n this.DOMResults.setAttribute(\"class\", \"autocomplete\");\n }\n }\n },\n Operator: ConditionOperator.AND,\n Event: EventType.KEYDOWN\n },\n \"KeyUpAndDown_down\": {\n Conditions: [{\n Is: 38,\n Not: false\n },\n {\n Is: 40,\n Not: false\n }],\n Callback: function (event) {\n event.preventDefault();\n },\n Operator: ConditionOperator.OR,\n Event: EventType.KEYDOWN\n },\n \"KeyUpAndDown_up\": {\n Conditions: [{\n Is: 38,\n Not: false\n },\n {\n Is: 40,\n Not: false\n }],\n Callback: function (event) {\n event.preventDefault();\n var first = this.DOMResults.querySelector(\"li:first-child:not(.locked)\"), last = this.DOMResults.querySelector(\"li:last-child:not(.locked)\"), active = this.DOMResults.querySelector(\"li.active\");\n if (active) {\n var currentIndex = Array.prototype.indexOf.call(active.parentNode.children, active), position = currentIndex + (event.keyCode - 39), lisCount = this.DOMResults.getElementsByTagName(\"li\").length;\n if (position < 0) {\n position = lisCount - 1;\n }\n else if (position >= lisCount) {\n position = 0;\n }\n active.classList.remove(\"active\");\n active.parentElement.children.item(position).classList.add(\"active\");\n }\n else if (last && event.keyCode == 38) {\n last.classList.add(\"active\");\n }\n else if (first) {\n first.classList.add(\"active\");\n }\n },\n Operator: ConditionOperator.OR,\n Event: EventType.KEYUP\n },\n \"AlphaNum\": {\n Conditions: [{\n Is: 13,\n Not: true\n }, {\n From: 35,\n To: 40,\n Not: true\n }],\n Callback: function () {\n var oldValue = this.Input.getAttribute(\"data-autocomplete-old-value\"), currentValue = this._Pre();\n if (currentValue !== \"\" && currentValue.length >= this._MinChars()) {\n if (!oldValue || currentValue != oldValue) {\n this.DOMResults.setAttribute(\"class\", \"autocomplete open\");\n }\n AutoComplete.prototype.cache(this, function (response) {\n this._Render(this._Post(response));\n this._Open();\n }.bind(this), this._Error);\n }\n else {\n this._Close();\n }\n },\n Operator: ConditionOperator.AND,\n Event: EventType.KEYUP\n }\n },\n DOMResults: null,\n Request: null,\n Input: null,\n /**\n * Return the message when no result returns\n */\n _EmptyMessage: function () {\n var emptyMessage = \"\";\n if (this.Input.hasAttribute(\"data-autocomplete-empty-message\")) {\n emptyMessage = this.Input.getAttribute(\"data-autocomplete-empty-message\");\n }\n else if (this.EmptyMessage !== false) {\n emptyMessage = this.EmptyMessage;\n }\n else {\n emptyMessage = \"\";\n }\n return emptyMessage;\n },\n /**\n * Returns the maximum number of results\n */\n _Limit: function () {\n var limit = this.Input.getAttribute(\"data-autocomplete-limit\");\n if (isNaN(limit) || limit === null) {\n return this.Limit;\n }\n return parseInt(limit, 10);\n },\n /**\n * Returns the minimum number of characters entered before firing ajax\n */\n _MinChars: function () {\n var minchars = this.Input.getAttribute(\"data-autocomplete-minchars\");\n if (isNaN(minchars) || minchars === null) {\n return this.MinChars;\n }\n return parseInt(minchars, 10);\n },\n /**\n * Apply transformation on labels response\n */\n _Highlight: function (label) {\n return label.replace(this.Highlight.getRegex(this._Pre()), this.Highlight.transform);\n },\n /**\n * Returns the HHTP method to use\n */\n _HttpMethod: function () {\n if (this.Input.hasAttribute(\"data-autocomplete-method\")) {\n return this.Input.getAttribute(\"data-autocomplete-method\");\n }\n return this.HttpMethod;\n },\n /**\n * Returns the query param to use\n */\n _QueryArg: function () {\n if (this.Input.hasAttribute(\"data-autocomplete-param-name\")) {\n return this.Input.getAttribute(\"data-autocomplete-param-name\");\n }\n return this.QueryArg;\n },\n /**\n * Returns the URL to use for AJAX request\n */\n _Url: function () {\n if (this.Input.hasAttribute(\"data-autocomplete\")) {\n return this.Input.getAttribute(\"data-autocomplete\");\n }\n return this.Url;\n },\n /**\n * Manage the close\n */\n _Blur: function (now) {\n if (now === void 0) { now = false; }\n if (now) {\n this._Close();\n }\n else {\n var params = this;\n setTimeout(function () {\n params._Blur(true);\n }, 150);\n }\n },\n /**\n * Manage the cache\n */\n _Cache: function (value) {\n return this.$Cache[value];\n },\n /**\n * Manage the open\n */\n _Focus: function () {\n var oldValue = this.Input.getAttribute(\"data-autocomplete-old-value\");\n if ((!oldValue || this.Input.value != oldValue) && this._MinChars() <= this.Input.value.length) {\n this.DOMResults.setAttribute(\"class\", \"autocomplete open\");\n }\n },\n /**\n * Bind all results item if one result is opened\n */\n _Open: function () {\n var params = this;\n Array.prototype.forEach.call(this.DOMResults.getElementsByTagName(\"li\"), function (li) {\n if (li.getAttribute(\"class\") != \"locked\") {\n li.onclick = function () {\n params._Select(li);\n };\n }\n });\n },\n _Close: function () {\n this.DOMResults.setAttribute(\"class\", \"autocomplete\");\n },\n /**\n * Position the results HTML element\n */\n _Position: function () {\n this.DOMResults.setAttribute(\"class\", \"autocomplete\");\n this.DOMResults.setAttribute(\"style\", \"top:\" + (this.Input.offsetTop + this.Input.offsetHeight) + \"px;left:\" + this.Input.offsetLeft + \"px;width:\" + this.Input.clientWidth + \"px;\");\n },\n /**\n * Execute the render of results DOM element\n */\n _Render: function (response) {\n var ul;\n if (typeof response == \"string\") {\n ul = this._RenderRaw(response);\n }\n else {\n ul = this._RenderResponseItems(response);\n }\n if (this.DOMResults.hasChildNodes()) {\n this.DOMResults.removeChild(this.DOMResults.childNodes[0]);\n }\n this.DOMResults.appendChild(ul);\n },\n /**\n * ResponseItems[] rendering\n */\n _RenderResponseItems: function (response) {\n var ul = document.createElement(\"ul\"), li = document.createElement(\"li\"), limit = this._Limit();\n // Order\n if (limit < 0) {\n response = response.reverse();\n }\n else if (limit === 0) {\n limit = response.length;\n }\n for (var item = 0; item < Math.min(Math.abs(limit), response.length); item++) {\n li.innerHTML = response[item].Label;\n li.setAttribute(\"data-autocomplete-value\", response[item].Value);\n ul.appendChild(li);\n li = document.createElement(\"li\");\n }\n return ul;\n },\n /**\n * string response rendering (RAW HTML)\n */\n _RenderRaw: function (response) {\n var ul = document.createElement(\"ul\"), li = document.createElement(\"li\");\n if (response.length > 0) {\n this.DOMResults.innerHTML = response;\n }\n else {\n var emptyMessage = this._EmptyMessage();\n if (emptyMessage !== \"\") {\n li.innerHTML = emptyMessage;\n li.setAttribute(\"class\", \"locked\");\n ul.appendChild(li);\n }\n }\n return ul;\n },\n /**\n * Deal with request response\n */\n _Post: function (response) {\n try {\n var returnResponse = [];\n //JSON return\n var json = JSON.parse(response);\n if (Object.keys(json).length === 0) {\n return \"\";\n }\n if (Array.isArray(json)) {\n for (var i = 0; i < Object.keys(json).length; i++) {\n returnResponse[returnResponse.length] = { \"Value\": json[i], \"Label\": this._Highlight(json[i]) };\n }\n }\n else {\n for (var value in json) {\n returnResponse.push({\n \"Value\": value,\n \"Label\": this._Highlight(json[value])\n });\n }\n }\n return returnResponse;\n }\n catch (event) {\n //HTML return\n return response;\n }\n },\n /**\n * Return the autocomplete value to send (before request)\n */\n _Pre: function () {\n return this.Input.value;\n },\n /**\n * Choice one result item\n */\n _Select: function (item) {\n if (item.hasAttribute(\"data-autocomplete-value\")) {\n this.Input.value = item.getAttribute(\"data-autocomplete-value\");\n }\n else {\n this.Input.value = item.innerHTML;\n }\n this.Input.setAttribute(\"data-autocomplete-old-value\", this.Input.value);\n },\n /**\n * Handle HTTP error on the request\n */\n _Error: function () {\n },\n $AjaxTimer: null,\n $Cache: {},\n $Listeners: {}\n };\n return AutoComplete;\n}());\nmodule.exports = AutoComplete;\n\n},{}]},{},[1])(1)\n});\n"],"names":["window","searxng","w","d","Element","ElementPrototype","matches","matchesSelector","webkitMatchesSelector","msMatchesSelector","selector","node","this","nodes","parentNode","document","querySelectorAll","i","prototype","callbackSafe","callback","el","e","call","exception","console","log","on","obj","eventType","useCapture","addEventListener","target","srcElement","found","parentElement","ready","readyState","bind","http","method","url","data","Promise","resolve","reject","req","XMLHttpRequest","open","timeout","onload","status","response","responseType","Error","statusText","onerror","onabort","ontimeout","send","ex","loadStyle","src","path","settings","theme_static_path","id","replace","s","getElementById","createElement","setAttribute","body","appendChild","loadScript","hasAttribute","apply","insertBefore","newNode","referenceNode","insertAfter","nextSibling","classList","add","getEndpoint","className","getElementsByTagName","values","endsWith","split","endpoint","infinite_scroll_supported","IntersectionObserverEntry","let","onlyImages","contains","newLoadSpinner","loader","replaceChildrenWith","element","children","textContent","forEach","child","loadNextPage","form","querySelector","formData","FormData","getAttribute","then","nextPageDoc","DOMParser","parseFromString","articleList","paginationElement","remove","length","articleElement","catch","err","translations","error_loading_next_page","infinite_scroll","intersectionObserveOptions","rootMargin","observedSelector","observer","IntersectionObserver","entries","paginationEntry","isIntersecting","unobserve","observe","isElementInDetail","undefined","getResultElement","isImageResult","resultElement","highlightResult","preventDefault","selectImage","keyBindings","Escape","key","fun","removeFocus","des","cat","ArrowLeft","ArrowRight","h","toggleHelp","searchInputFocus","n","GoToNextPage","o","openResult","p","GoToPreviousPage","r","reloadPage","t","vimKeys","b","scrollPage","innerHeight","f","u","g","scrollPageTo","scrollHeight","v","k","j","hotkeys","Object","assign","hasOwnProperty","ctrlKey","altKey","shiftKey","metaKey","tagName","toLowerCase","which","noScroll","keepFocus","current","effectiveWhich","next","results","top","documentElement","scrollTop","bot","clientHeight","etop","offsetTop","ebot","nextElementSibling","previousElementSibling","removeAttribute","link","focus","scrollPageToSelected","location","reload","activeElement","blur","closeDetail","pageButtonClick","css_selector","button","click","sel","wtop","wheight","offset","scroll","scrollX","wbot","amount","scrollBy","position","nav","scrollTo","q","setSelectionRange","len","value","newTab","href","initHelpContent","divElement","categories","push","sorted","keys","sort","a","html","lastCategory","first","cj","innerHTML","helpPanel","toggle","selectNext","selectPrevious","event","leaflet_target","dataset","leafletTarget","map_lon","parseFloat","mapLon","map_lat","mapLat","map_zoom","mapZoom","map_boundingbox","JSON","parse","mapBoundingbox","map_geojson","mapGeojson","map_bounds","southWest","L","latLng","northEast","latLngBounds","map","osmMapnikUrl","osmMapnikAttrib","osmMapnik","TileLayer","minZoom","maxZoom","attribution","osmWikimediaUrl","osmWikimediaAttrib","osmWikimedia","setTimeout","fitBounds","setView","addLayer","baseLayers","OSM Mapnik","OSM Wikimedia","control","layers","addTo","geoJson","engine_descriptions","load_engine_descriptions","content","engine_name","description","elements","source","Source","img","style","display","error","btnLabelCollapsed","btnLabelNotCollapsed","targetElement","iframe_load","srctest","imgElement","thumbnailElement","detailElement","imgSrc","imgLoader","Image","qinput_id","qinput","isMobile","matchMedia","submitIfQuery","search","submit","createClearButton","cs","updateClearButton","ev","autocomplete_provider","autocomplete","AutoComplete","Url","EmptyMessage","no_item_found","HttpMethod","http_method","HttpHeaders","Content-type","X-Requested-With","MinChars","autocomplete_min","Delay","_Position","_Open","params","Array","DOMResults","li","onmousedown","_Select","item","defaults","closest","_MinChars","Input","indexOf","KeyboardMappings","KeyUpAndDown_up","Callback","liActive","Tab","Enter","Conditions","Is","Not","ajax","request","$AjaxTimer","clearTimeout","Request","abort","encodeURIComponent","_QueryArg","_Pre","search_on_category_select","checked","exports","module","define","amd","global","self","c","require","code","1","ConditionOperator","EventType","isArray","input","specificParams","merge","create","nodeName","match","$Listeners","_Blur","destroy","_Focus","keyup","KEYUP","keydown","KEYDOWN","getEventsByType","type","mappings","Event","eventIdentifier","condition","mapping","Operator","AND","OR","keyCode","From","To","name","makeRequest","callbackErr","propertyHttpHeaders","getOwnPropertyNames","_HttpMethod","_Url","queryParams","queryParamsStringify","setRequestHeader","onreadystatechange","$Cache","cache","_Cache","removeEventListener","removeChild","tmp","arguments","Highlight","getRegex","RegExp","transform","Limit","QueryArg","KeyUpAndDown_down","last","active","currentIndex","lisCount","AlphaNum","oldValue","currentValue","_Render","_Post","_Error","_Close","_EmptyMessage","emptyMessage","_Limit","limit","isNaN","parseInt","minchars","_Highlight","label","now","onclick","offsetHeight","offsetLeft","clientWidth","ul","_RenderRaw","_RenderResponseItems","hasChildNodes","childNodes","reverse","Math","min","abs","Label","Value","returnResponse","json"],"mappings":";;;;;GAMAA;OAAOC,QAAU,SAAWC,EAAGC,GAE7B,aAMA,GAAID,EAAEE,QAAS,EACb,SAAWC,GACTA,EAAiBC,QAAUD,EAAiBC,SAC5CD,EAAiBE,iBACjBF,EAAiBG,uBACjBH,EAAiBI,mBACjB,SAAUC,GACR,IAAIC,EAAOC,KAAMC,GAASF,EAAKG,YAAcH,EAAKI,UAAUC,iBAAiBN,CAAQ,EAAGO,EAAI,CAAC,EAC7F,MAAOJ,EAAM,EAAEI,IAAMJ,EAAMI,IAAMN,GACjC,MAAO,CAAC,CAACE,EAAMI,EACjB,CACD,GAAEb,QAAQc,SAAS,CACtB,CAEA,SAASC,EAAcC,EAAUC,EAAIC,GACnC,IACEF,EAASG,KAAKF,EAAIC,CAAC,CAGrB,CAFE,MAAOE,GACPC,QAAQC,IAAIF,CAAS,CACvB,CACF,CAEA,IAAIvB,E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