searxngRebrandZaclys/searx/static/themes/simple/js/searxng.min.js.map
2021-12-01 21:12:06 +01:00

1 line
86 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"file":"searxng.min.js","sources":["../src/js/main/00_toolkit.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","../../__common__/js/image_layout.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) {\n var req = new XMLHttpRequest(),\n resolve = function() {},\n reject = function() {},\n promise = {\n then: function(callback) { resolve = callback; return promise; },\n catch: function(callback) { reject = callback; return promise; }\n };\n\n try {\n req.open(method, url, true);\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 // Make the request\n req.send();\n } catch (ex) {\n reject(ex);\n }\n\n return promise;\n };\n\n searxng.loadStyle = function(src) {\n var path = searxng.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.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 return searxng;\n})(window, document);\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 <div class=\"detail\"> 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);\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.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) {\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 var link = next.querySelector('h3 a') || next.querySelector('a');\n if (link !== null) {\n link.focus();\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 document.querySelector('#q').focus();\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 = '<a href=\"#\" class=\"close\" aria-label=\"close\" title=\"close\">×</a>';\n html += '<h3>How to navigate searx with Vim-like hotkeys</h3>';\n html += '<table>';\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 += '<tr>';\n }\n html += '<td>';\n\n html += '<h4>' + cat[0].cat + '</h4>';\n html += '<ul class=\"list-unstyled\">';\n\n for (var cj in cat) {\n html += '<li><kbd>' + cat[cj].key + '</kbd> ' + cat[cj].des + '</li>';\n }\n\n html += '</ul>';\n html += '</td>'; // col-sm-*\n\n if (!first || lastCategory) {\n html += '</tr>'; // row\n }\n }\n\n html += '</table>';\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\t\t\tinitHelpContent(helpPanel);\t\t\t\t\t\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 © <a href=\"https://openstreetmap.org\">OpenStreetMap</a> 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 © <a href=\"https://openstreetmap.org\">OpenStreetMap contributors</a>';\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 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 = ' (<i>' + searxng.translations['Source'] + ':&nbsp;' + description[1] + '</i>)';\n element.innerHTML = description[0] + source;\n }\n }\n });\n }\n }\n\n if (d.querySelector('body[class=\"preferences_endpoint\"]')) {\n for(const el of d.querySelectorAll('[data-engine-name]')) {\n searxng.on(el, 'mouseenter', load_engine_descriptions);\n }\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 searxng.ready(function() {\n searxng.image_thumbnail_layout = new searxng.ImageLayout('#urls', '#urls .result-images', 'img.image_thumbnail', 14, 6, 200);\n searxng.image_thumbnail_layout.watch();\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.image_thumbnail_layout.align();\n searxng.scrollPageToSelected();\n }\n\n searxng.closeDetail = function(e) {\n d.getElementById('results').classList.remove('image-detail-open');\n searxng.image_thumbnail_layout.align();\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 firstFocus = true, qinput_id = \"q\", qinput;\n\n function placeCursorAtEnd(element) {\n if (element.setSelectionRange) {\n var len = element.value.length;\n element.setSelectionRange(len, len);\n }\n }\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\tcs.classList.add(\"empty\");\n } else {\n\tcs.classList.remove(\"empty\");\n }\n };\n\n // update status, event listener\n updateClearButton();\n cs.addEventListener('click', function() {\n qinput.value='';\n qinput.focus();\n updateClearButton();\n });\n qinput.addEventListener('keyup', updateClearButton, false);\n }\n\n searxng.ready(function() {\n qinput = d.getElementById(qinput_id);\n\n function placeCursorAtEndOnce() {\n if (firstFocus) {\n placeCursorAtEnd(qinput);\n firstFocus = false;\n } else {\n // e.preventDefault();\n }\n }\n\n if (qinput !== null) {\n // clear button\n createClearButton(qinput);\n \n // autocompleter\n if (searxng.autocompleter) {\n searxng.autocomplete = AutoComplete.call(w, {\n Url: \"./autocompleter\",\n EmptyMessage: searxng.translations.no_item_found,\n HttpMethod: searxng.method,\n HttpHeaders: {\n \"Content-type\": \"application/x-www-form-urlencoded\",\n \"X-Requested-With\": \"XMLHttpRequest\"\n },\n MinChars: 4,\n Delay: 300,\n }, \"#\" + qinput_id);\n\n // hack, see : https://github.com/autocompletejs/autocomplete.js/issues/37\n w.addEventListener('resize', function() {\n var event = new CustomEvent(\"position\");\n qinput.dispatchEvent(event);\n });\n }\n\n qinput.addEventListener('focus', placeCursorAtEndOnce, false);\n qinput.focus();\n }\n\n // vanilla js version of search_on_category_select.js\n if (qinput !== null && d.querySelector('.help') != null && searxng.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","/**\n*\n* Google Image Layout v0.0.1\n* Description, by Anh Trinh.\n* Heavily modified for searx\n* https://ptgamr.github.io/2014-09-12-google-image-layout/\n* https://ptgamr.github.io/google-image-layout/src/google-image-layout.js\n*\n* @license Free to use under the MIT License.\n*\n* @example <caption>Example usage of searxng.ImageLayout class.</caption>\n* searxng.image_thumbnail_layout = new searxng.ImageLayout(\n* '#urls', // container_selector\n* '#urls .result-images', // results_selector\n* 'img.image_thumbnail', // img_selector\n* 14, // verticalMargin\n* 6, // horizontalMargin\n* 200 // maxHeight\n* );\n* searxng.image_thumbnail_layout.watch();\n*/\n\n\n(function (w, d) {\n function ImageLayout(container_selector, results_selector, img_selector, verticalMargin, horizontalMargin, maxHeight) {\n this.container_selector = container_selector;\n this.results_selector = results_selector;\n this.img_selector = img_selector;\n this.verticalMargin = verticalMargin;\n this.horizontalMargin = horizontalMargin;\n this.maxHeight = maxHeight;\n this.isAlignDone = true;\n }\n\n /**\n * Get the height that make all images fit the container\n *\n * width = w1 + w2 + w3 + ... = r1*h + r2*h + r3*h + ...\n *\n * @param {[type]} images the images to be calculated\n * @param {[type]} width the container witdth\n * @param {[type]} margin the margin between each image\n *\n * @return {[type]} the height\n */\n ImageLayout.prototype._getHeigth = function (images, width) {\n var i, img;\n var r = 0;\n\n for (i = 0; i < images.length; i++) {\n img = images[i];\n if ((img.naturalWidth > 0) && (img.naturalHeight > 0)) {\n r += img.naturalWidth / img.naturalHeight;\n } else {\n // assume that not loaded images are square\n r += 1;\n }\n }\n\n return (width - images.length * this.verticalMargin) / r; //have to round down because Firefox will automatically roundup value with number of decimals > 3\n };\n\n ImageLayout.prototype._setSize = function (images, height) {\n var i, img, imgWidth;\n var imagesLength = images.length, resultNode;\n\n for (i = 0; i < imagesLength; i++) {\n img = images[i];\n if ((img.naturalWidth > 0) && (img.naturalHeight > 0)) {\n imgWidth = height * img.naturalWidth / img.naturalHeight;\n } else {\n // not loaded image : make it square as _getHeigth said it\n imgWidth = height;\n }\n img.style.width = imgWidth + 'px';\n img.style.height = height + 'px';\n img.style.marginLeft = this.horizontalMargin + 'px';\n img.style.marginTop = this.horizontalMargin + 'px';\n img.style.marginRight = this.verticalMargin - 7 + 'px'; // -4 is the negative margin of the inline element\n img.style.marginBottom = this.verticalMargin - 7 + 'px';\n resultNode = img.parentNode.parentNode;\n if (!resultNode.classList.contains('js')) {\n resultNode.classList.add('js');\n }\n }\n };\n\n ImageLayout.prototype._alignImgs = function (imgGroup) {\n var isSearching, slice, i, h;\n var containerElement = d.querySelector(this.container_selector);\n var containerCompStyles = window.getComputedStyle(containerElement);\n var containerPaddingLeft = parseInt(containerCompStyles.getPropertyValue('padding-left'), 10);\n var containerPaddingRight = parseInt(containerCompStyles.getPropertyValue('padding-right'), 10);\n var containerWidth = containerElement.clientWidth - containerPaddingLeft - containerPaddingRight;\n\n while (imgGroup.length > 0) {\n isSearching = true;\n for (i = 1; i <= imgGroup.length && isSearching; i++) {\n slice = imgGroup.slice(0, i);\n h = this._getHeigth(slice, containerWidth);\n if (h < this.maxHeight) {\n this._setSize(slice, h);\n // continue with the remaining images\n imgGroup = imgGroup.slice(i);\n isSearching = false;\n }\n }\n if (isSearching) {\n this._setSize(slice, Math.min(this.maxHeight, h));\n break;\n }\n }\n };\n\n ImageLayout.prototype.align = function () {\n var i;\n var results_selectorNode = d.querySelectorAll(this.results_selector);\n var results_length = results_selectorNode.length;\n var previous = null;\n var current = null;\n var imgGroup = [];\n\n for (i = 0; i < results_length; i++) {\n current = results_selectorNode[i];\n if (current.previousElementSibling !== previous && imgGroup.length > 0) {\n // the current image is not connected to previous one\n // so the current image is the start of a new group of images.\n // so call _alignImgs to align the current group\n this._alignImgs(imgGroup);\n // and start a new empty group of images\n imgGroup = [];\n }\n // add the current image to the group (only the img tag)\n imgGroup.push(current.querySelector(this.img_selector));\n // update the previous variable\n previous = current;\n }\n // align the remaining images\n if (imgGroup.length > 0) {\n this._alignImgs(imgGroup);\n }\n };\n\n ImageLayout.prototype.watch = function () {\n var i, img;\n var obj = this;\n var results_nodes = d.querySelectorAll(this.results_selector);\n var results_length = results_nodes.length;\n\n function img_load_error(event) {\n // console.log(\"ERROR can't load: \" + event.originalTarget.src);\n event.originalTarget.src = w.searxng.static_path + w.searxng.theme.img_load_error;\n }\n\n function throttleAlign() {\n if (obj.isAlignDone) {\n obj.isAlignDone = false;\n setTimeout(function () {\n obj.align();\n obj.isAlignDone = true;\n }, 100);\n }\n }\n\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/pageshow_event\n w.addEventListener('pageshow', throttleAlign);\n // https://developer.mozilla.org/en-US/docs/Web/API/FileReader/load_event\n w.addEventListener('load', throttleAlign);\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/resize_event\n w.addEventListener('resize', throttleAlign);\n\n for (i = 0; i < results_length; i++) {\n img = results_nodes[i].querySelector(this.img_selector);\n if (img !== null && img !== undefined) {\n img.addEventListener('load', throttleAlign);\n // https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror\n img.addEventListener('error', throttleAlign);\n if (w.searxng.theme.img_load_error) {\n img.addEventListener('error', img_load_error, {once: true});\n }\n }\n }\n };\n\n w.searxng.ImageLayout = ImageLayout;\n\n}(window, document));\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<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n/*\n * @license MIT\n *\n * Autocomplete.js v2.7.1\n * Developed by Baptiste Donaux\n * http://autocomplete-js.com\n *\n * (c) 2017, Baptiste Donaux\n */\n\"use strict\";\nvar ConditionOperator;\n(function (ConditionOperator) {\n ConditionOperator[ConditionOperator[\"AND\"] = 0] = \"AND\";\n ConditionOperator[ConditionOperator[\"OR\"] = 1] = \"OR\";\n})(ConditionOperator || (ConditionOperator = {}));\nvar EventType;\n(function (EventType) {\n EventType[EventType[\"KEYDOWN\"] = 0] = \"KEYDOWN\";\n EventType[EventType[\"KEYUP\"] = 1] = \"KEYUP\";\n})(EventType || (EventType = {}));\n/**\n * Core\n *\n * @class\n * @author Baptiste Donaux <baptiste.donaux@gmail.com> @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 \"<strong>\" + value + \"</strong>\";\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","req","XMLHttpRequest","resolve","reject","promise","then","catch","open","onload","status","response","responseType","Error","statusText","onerror","onabort","send","ex","loadStyle","src","path","static_path","id","replace","s","getElementById","createElement","setAttribute","body","appendChild","loadScript","hasAttribute","apply","insertBefore","newNode","referenceNode","insertAfter","nextSibling","classList","add","isElementInDetail","undefined","contains","getResultElement","isImageResult","resultElement","highlightResult","let","preventDefault","selectImage","getAttribute","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","current","querySelector","effectiveWhich","next","results","top","documentElement","scrollTop","bot","clientHeight","length","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","newTab","href","initHelpContent","divElement","categories","k","push","sorted","keys","sort","a","b","html","lastCategory","first","cj","innerHTML","helpPanel","className","getElementsByTagName","toggle","selectNext","selectPrevious","event","remove","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","entries","elements","element","source","translations","image_thumbnail_layout","ImageLayout","watch","btnLabelCollapsed","btnLabelNotCollapsed","targetElement","iframe_load","srctest","imgElement","thumbnailElement","detailElement","imgSrc","loader","imgLoader","Image","align","firstFocus","qinput_id","qinput","placeCursorAtEnd","setSelectionRange","len","value","submitIfQuery","search","submit","createClearButton","cs","updateClearButton","placeCursorAtEndOnce","autocompleter","autocomplete","AutoComplete","Url","EmptyMessage","no_item_found","HttpMethod","HttpHeaders","Content-type","X-Requested-With","MinChars","Delay","CustomEvent","dispatchEvent","search_on_category_select","checked","container_selector","results_selector","img_selector","verticalMargin","horizontalMargin","maxHeight","isAlignDone","_getHeigth","images","width","img","r","naturalWidth","naturalHeight","_setSize","height","imgWidth","imagesLength","resultNode","style","marginLeft","marginTop","marginRight","marginBottom","_alignImgs","imgGroup","isSearching","slice","h","containerElement","containerCompStyles","getComputedStyle","containerPaddingLeft","parseInt","getPropertyValue","containerPaddingRight","containerWidth","clientWidth","Math","min","results_selectorNode","results_length","previous","results_nodes","img_load_error","originalTarget","theme","throttleAlign","once","f","exports","module","define","amd","g","global","self","n","t","o","c","require","u","code","p","1","ConditionOperator","EventType","params","Array","isArray","forEach","input","specificParams","merge","defaults","DOMResults","create","Input","nodeName","match","_Position","$Listeners","_Blur","destroy","_Focus","keyup","KEYUP","keydown","KEYDOWN","getEventsByType","type","mappings","KeyboardMappings","Event","eventIdentifier","condition","mapping","Operator","AND","OR","Not","Is","From","To","name","Conditions","Callback","makeRequest","callbackErr","propertyHttpHeaders","getOwnPropertyNames","request","_HttpMethod","_Url","queryParams","_Pre","queryParamsStringify","encodeURIComponent","_QueryArg","indexOf","setRequestHeader","onreadystatechange","$Cache","ajax","timeout","$AjaxTimer","clearTimeout","Request","abort","cache","_Cache","removeEventListener","removeChild","tmp","arguments","Highlight","getRegex","RegExp","transform","Limit","QueryArg","Enter","liActive","_Select","KeyUpAndDown_down","KeyUpAndDown_up","last","active","currentIndex","children","lisCount","item","AlphaNum","oldValue","currentValue","_MinChars","_Render","_Post","_Open","_Error","_Close","_EmptyMessage","emptyMessage","_Limit","limit","isNaN","minchars","_Highlight","label","now","li","onclick","offsetHeight","offsetLeft","ul","_RenderRaw","_RenderResponseItems","hasChildNodes","childNodes","reverse","abs","Label","Value","returnResponse","json"],"mappings":";;;;;GAMAA;OAAOC,QAAU,SAAUC,EAAGC,gBAQ5B,GAAID,EAAEE,QAAS,EACb,SAAUC,GACRA,EAAiBC,QAAUD,EAAiBC,SAC5CD,EAAiBE,iBACjBF,EAAiBG,uBACjBH,EAAiBI,mBACjB,SAASC,GACP,IAAIC,EAAOC,KAAMC,GAASF,EAAKG,YAAcH,EAAKI,UAAUC,iBAAiBN,GAAWO,GAAK,EAC7F,MAAOJ,IAAQI,IAAMJ,EAAMI,IAAMN,GACjC,QAASE,EAAMI,KARnB,CAUGb,QAAQc,WAGb,SAASC,EAAaC,EAAUC,EAAIC,GAClC,IACEF,EAASG,KAAKF,EAAIC,GAClB,MAAOE,GACPC,QAAQC,IAAIF,IAIhB,IAAIvB,EAAUD,OAAOC,SAAW,GAEhCA,EAAQ0B,GAAK,SAASC,EAAKC,EAAWT,EAAUU,GAC9CA,EAAaA,GAAc,MAC3B,UAAWF,IAAQ,SAAU,CAE3BA,EAAIG,iBAAiBF,EAAWT,EAAUU,OACrC,CAEL3B,EAAE4B,iBAAiBF,EAAW,SAASP,GACrC,IAAID,EAAKC,EAAEU,QAAUV,EAAEW,WAAYC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