summaryrefslogtreecommitdiff
path: root/searx/static/themes/simple/js/searxng.min.js.map
blob: 345bbe9d901446e4436fb4debde4717c5ab86470 (plain)
1
{"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 <hr> 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 <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, 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: '&#11013;',\n      fun: highlightResult('up'),\n      des: 'Use left arrow to select previous search result',\n      cat: 'Results'\n    },\n    'ArrowRight': {\n      key: '&#10145;',\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      results = Array.from(results);  // convert NodeList to Array for further use\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 = results[results.indexOf(current) + 1] || current;\n          break;\n        case 'up':\n          next = results[results.indexOf(current) - 1] || current;\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 = '<a href=\"#\" class=\"close\" aria-label=\"close\" title=\"close\">×</a>';\n    html += '<h3>How to navigate SearXNG with 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      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  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 = ' (<i>' + searxng.settings.translations.Source + ':&nbsp;' + description[1] + '</i>)';\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<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","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","Array","from","top","documentElement","scrollTop","bot","clientHeight","etop","offsetTop","ebot","indexOf","removeAttribute","link","focus","scrollPageToSelected","location","reload","activeElement","blur","closeDetail","pageButtonClick","css_selector","button","click","sel","wtop","wheight","offset","previousElementSibling","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","DOMResults","li","onmousedown","_Select","item","defaults","closest","_MinChars","Input","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,QAA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