From bc64c821191bfe94403a9585fc9088ba147de684 Mon Sep 17 00:00:00 2001 From: envoyr Date: Sun, 6 Mar 2022 20:54:36 +0100 Subject: [PATCH] add language to ajax and typeahead --- lib/Froxlor/Ajax/Ajax.php | 64 ++- lib/Froxlor/UI/Panel/UI.php | 2 +- package-lock.json | 266 +++++++++ package.json | 1 + templates/Froxlor/assets/js/main.js | 514 +++++++++++++++++- templates/Froxlor/src/js/components/search.js | 30 + templates/Froxlor/src/js/main.js | 5 +- templates/Froxlor/userarea.html.twig | 14 + 8 files changed, 878 insertions(+), 18 deletions(-) create mode 100644 templates/Froxlor/src/js/components/search.js diff --git a/lib/Froxlor/Ajax/Ajax.php b/lib/Froxlor/Ajax/Ajax.php index 90b2d885..2915e492 100644 --- a/lib/Froxlor/Ajax/Ajax.php +++ b/lib/Froxlor/Ajax/Ajax.php @@ -7,6 +7,7 @@ use Froxlor\Http\HttpClient; use Froxlor\PhpHelper; use Froxlor\Settings; use Froxlor\UI\Panel\UI; +use Froxlor\UI\Request; /** * This file is part of the Froxlor project. @@ -28,6 +29,7 @@ class Ajax protected string $session; protected string $action; protected string $theme; + protected array $lng; /** * @throws Exception @@ -37,6 +39,57 @@ class Ajax $this->session = $_GET['s'] ?? $_POST['s'] ?? null; $this->action = $_GET['action'] ?? $_POST['action'] ?? null; $this->theme = $_GET['theme'] ?? 'Froxlor'; + + $this->initLang(); + } + + /** + * initialize global $lng variable to have + * localized strings available for the ApiCommands + */ + private function initLang() + { + global $lng; + + // query the whole table + $result_stmt = \Froxlor\Database\Database::query("SELECT * FROM `" . TABLE_PANEL_LANGUAGE . "`"); + + $langs = array(); + // presort languages + while ($row = $result_stmt->fetch(\PDO::FETCH_ASSOC)) { + $langs[$row['language']][] = $row; + } + + // set default language before anything else to + // ensure that we can display messages + $language = \Froxlor\Settings::Get('panel.standardlanguage'); + + if (isset($this->user_data['language']) && isset($langs[$this->user_data['language']])) { + // default: use language from session, #277 + $language = $this->user_data['language']; + } elseif (isset($this->user_data['def_language'])) { + $language = $this->user_data['def_language']; + } + + // include every english language file we can get + foreach ($langs['English'] as $value) { + include_once \Froxlor\FileDir::makeSecurePath(\Froxlor\Froxlor::getInstallDir() . '/' . $value['file']); + } + + // now include the selected language if its not english + if ($language != 'English') { + if (isset($langs[$language])) { + foreach ($langs[$language] as $value) { + include_once \Froxlor\FileDir::makeSecurePath(\Froxlor\Froxlor::getInstallDir() . '/' . $value['file']); + } + } + } + + // last but not least include language references file + include_once \Froxlor\FileDir::makeSecurePath(\Froxlor\Froxlor::getInstallDir() . '/lng/lng_references.php'); + + // set array + $this->lng = $lng; } /** @@ -186,10 +239,10 @@ class Ajax private function searchSetting() { - $searchtext = isset($_POST['searchtext']) ? $_POST['searchtext'] : ""; + $searchtext = Request::get('searchtext'); $result = []; - if (strlen($searchtext) > 2) { + if ($searchtext && strlen($searchtext) > 2) { $settings_data = PhpHelper::loadConfigArrayDir(\Froxlor\Froxlor::getInstallDir() . '/actions/admin/settings/'); $results = array(); PhpHelper::recursive_array_search($searchtext, $settings_data, $results); @@ -202,13 +255,14 @@ class Ajax $processed_setting[$settingkey] = true; $sresult = $settings_data[$pk[0]][$pk[1]][$pk[2]][$pk[3]]; $result[] = [ - 'href' => 'admin_settings.php?page=overview&part=' . $pk[1] . '&em=' . $pk[3], - 'title' => (is_array($sresult['label']) ? $sresult['label']['title'] : $sresult['label']) + 'title' => (is_array($sresult['label']) ? $sresult['label']['title'] : $sresult['label']), + 'href' => 'admin_settings.php?page=overview&part=' . $pk[1] . '&em=' . $pk[3] . '&s=' . $this->session, ]; } } } } - echo json_encode($result); + header("Content-type: application/json"); + echo json_encode(['settings' => $result]); } } diff --git a/lib/Froxlor/UI/Panel/UI.php b/lib/Froxlor/UI/Panel/UI.php index dfc3b300..6b820340 100644 --- a/lib/Froxlor/UI/Panel/UI.php +++ b/lib/Froxlor/UI/Panel/UI.php @@ -70,7 +70,7 @@ class UI // Inline-JS is no longer allowed and used // See: http://people.mozilla.org/~bsterne/content-security-policy/index.html // New stuff see: https://www.owasp.org/index.php/List_of_useful_HTTP_headers and https://www.owasp.org/index.php/Content_Security_Policy - $csp_content = "default-src 'self'; script-src 'self' 'unsafe-inline'; connect-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline';"; + $csp_content = "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; connect-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline';"; header("Content-Security-Policy: " . $csp_content); header("X-Content-Security-Policy: " . $csp_content); header("X-WebKit-CSP: " . $csp_content); diff --git a/package-lock.json b/package-lock.json index f2b64c40..1690e2fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "jquery": "^3.6.0" }, "devDependencies": { + "jquery-typeahead": "^2.11.1", "laravel-mix": "^6.0.42", "resolve-url-loader": "^5.0.0", "sass": "^1.49.7", @@ -1652,6 +1653,119 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/register": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.17.0.tgz", + "integrity": "sha512-UNZsMAZ7uKoGHo1HlEXfteEOYssf64n/PNLHGqOKq/bgYcu/4LrQWAHJwSCb3BRZK8Hi5gkJdRcwrGTO2wtRCg==", + "dev": true, + "dependencies": { + "clone-deep": "^4.0.1", + "find-cache-dir": "^2.0.0", + "make-dir": "^2.1.0", + "pirates": "^4.0.5", + "source-map-support": "^0.5.16" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/register/node_modules/find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "dev": true, + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@babel/register/node_modules/find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@babel/register/node_modules/locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@babel/register/node_modules/make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "dependencies": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@babel/register/node_modules/p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@babel/register/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/register/node_modules/pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "dependencies": { + "find-up": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@babel/register/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, "node_modules/@babel/runtime": { "version": "7.17.2", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.2.tgz", @@ -5646,6 +5760,17 @@ "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==" }, + "node_modules/jquery-typeahead": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/jquery-typeahead/-/jquery-typeahead-2.11.1.tgz", + "integrity": "sha512-iuNRruN5bWtck+VPxdCTijD6BD9bVuBj3NCD25vITOdMb7P3fYlkBWcmnLEazD8O+VAtbcJ9aLxRi+qrpopNZA==", + "dev": true, + "dependencies": { + "@babel/register": "^7.6.2", + "jquery": ">=1.7.2", + "lz-string": "^1.4.4" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -5918,6 +6043,15 @@ "node": ">=10" } }, + "node_modules/lz-string": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz", + "integrity": "sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=", + "dev": true, + "bin": { + "lz-string": "bin/bin.js" + } + }, "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -6734,6 +6868,24 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/pirates": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", + "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -10542,6 +10694,91 @@ "esutils": "^2.0.2" } }, + "@babel/register": { + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.17.0.tgz", + "integrity": "sha512-UNZsMAZ7uKoGHo1HlEXfteEOYssf64n/PNLHGqOKq/bgYcu/4LrQWAHJwSCb3BRZK8Hi5gkJdRcwrGTO2wtRCg==", + "dev": true, + "requires": { + "clone-deep": "^4.0.1", + "find-cache-dir": "^2.0.0", + "make-dir": "^2.1.0", + "pirates": "^4.0.5", + "source-map-support": "^0.5.16" + }, + "dependencies": { + "find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + } + }, + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, "@babel/runtime": { "version": "7.17.2", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.2.tgz", @@ -13700,6 +13937,17 @@ "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.6.0.tgz", "integrity": "sha512-JVzAR/AjBvVt2BmYhxRCSYysDsPcssdmTFnzyLEts9qNwmjmu4JTAMYubEfwVOSwpQ1I1sKKFcxhZCI2buerfw==" }, + "jquery-typeahead": { + "version": "2.11.1", + "resolved": "https://registry.npmjs.org/jquery-typeahead/-/jquery-typeahead-2.11.1.tgz", + "integrity": "sha512-iuNRruN5bWtck+VPxdCTijD6BD9bVuBj3NCD25vITOdMb7P3fYlkBWcmnLEazD8O+VAtbcJ9aLxRi+qrpopNZA==", + "dev": true, + "requires": { + "@babel/register": "^7.6.2", + "jquery": ">=1.7.2", + "lz-string": "^1.4.4" + } + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -13916,6 +14164,12 @@ "yallist": "^4.0.0" } }, + "lz-string": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz", + "integrity": "sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=", + "dev": true + }, "make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", @@ -14541,6 +14795,18 @@ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true + }, + "pirates": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz", + "integrity": "sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ==", + "dev": true + }, "pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", diff --git a/package.json b/package.json index f5aebf2d..a83cdcee 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "production": "mix --production" }, "devDependencies": { + "jquery-typeahead": "^2.11.1", "laravel-mix": "^6.0.42", "resolve-url-loader": "^5.0.0", "sass": "^1.49.7", diff --git a/templates/Froxlor/assets/js/main.js b/templates/Froxlor/assets/js/main.js index e8f05b38..ed6155be 100644 --- a/templates/Froxlor/assets/js/main.js +++ b/templates/Froxlor/assets/js/main.js @@ -3231,6 +3231,44 @@ $(document).ready(function () { /***/ }), +/***/ "./templates/Froxlor/src/js/components/search.js": +/*!*******************************************************!*\ + !*** ./templates/Froxlor/src/js/components/search.js ***! + \*******************************************************/ +/***/ (() => { + +$(document).ready(function () { + console.log('included search'); + $.typeahead({ + input: '.js-typeahead-search_v1', + order: "desc", + dynamic: true, + display: ['data.title'], + href: "{{url}}", + emptyTemplate: "No results for {{query}}", + debug: true, + source: { + settings: { + ajax: { + method: "post", + url: "lib/ajax.php?action=searchsetting&theme=" + window.$theme + "&s=" + window.$session, + path: "title", + data: { + searchtext: '{{query}}' + } + } + } + }, + callback: { + onInit: function onInit(node) { + console.log('Typeahead Initiated'); + } + } + }); +}); + +/***/ }), + /***/ "./templates/Froxlor/src/js/components/updatecheck.js": /*!************************************************************!*\ !*** ./templates/Froxlor/src/js/components/updatecheck.js ***! @@ -3242,21 +3280,15 @@ $(document).ready(function () { * updatecheck */ if (document.getElementById('updatecheck')) { - var role = ""; - - if (typeof $("#updatecheck").data("role") !== "undefined") { - role = "&role=" + $("#newsfeed").data("role"); - } - $.ajax({ - url: "lib/ajax.php?action=updatecheck" + role + "&theme=" + window.$theme + "&s=" + window.$session, + url: "lib/ajax.php?action=updatecheck&theme=" + window.$theme + "&s=" + window.$session, type: "GET", success: function success(data) { - $("#newsfeeditems").html(data); + $("#updatecheck").html(data); }, error: function error(request, status, _error) { console.log(request, status, _error); - $("#newsfeeditems").html(''); + $("#updatecheck").html(''); } }); } @@ -3273,15 +3305,22 @@ $(document).ready(function () { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var bootstrap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.esm.js"); +/* harmony import */ var jquery_typeahead_src_jquery_typeahead_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery-typeahead/src/jquery.typeahead.css */ "./node_modules/jquery-typeahead/src/jquery.typeahead.css"); // load bootstrap + // load jquery -window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); +__webpack_require__.g.$ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); + +__webpack_require__(/*! jquery-typeahead */ "./node_modules/jquery-typeahead/dist/jquery.typeahead.min.js"); + $(document).ready(function () { window.$theme = 'Froxlor'; window.$session = $('meta[name="froxlor-session"]').attr('content'); }); // Load components +__webpack_require__(/*! ./components/search */ "./templates/Froxlor/src/js/components/search.js"); + __webpack_require__(/*! ./components/newsfeed */ "./templates/Froxlor/src/js/components/newsfeed.js"); __webpack_require__(/*! ./components/updatecheck */ "./templates/Froxlor/src/js/components/updatecheck.js"); @@ -8313,6 +8352,126 @@ defineJQueryPlugin(Toast); //# sourceMappingURL=bootstrap.esm.js.map +/***/ }), + +/***/ "./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].oneOf[1].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[7].oneOf[1].use[2]!./node_modules/jquery-typeahead/src/jquery.typeahead.css": +/*!**************************************************************************************************************************************************************************************************************************!*\ + !*** ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[7].oneOf[1].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[7].oneOf[1].use[2]!./node_modules/jquery-typeahead/src/jquery.typeahead.css ***! + \**************************************************************************************************************************************************************************************************************************/ +/***/ ((module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js"); +/* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0__); +// Imports + +var ___CSS_LOADER_EXPORT___ = _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_0___default()(function(i){return i[1]}); +// Module +___CSS_LOADER_EXPORT___.push([module.id, ".typeahead__container {\n /**\n * Restore the font weight unset by the previous rule.\n */\n /**\n * Show the overflow in IE.\n * 1. Show the overflow in Edge.\n */\n /**\n * Remove the inheritance of text transform in Edge, Firefox, and IE.\n * 1. Remove the inheritance of text transform in Firefox.\n */\n /**\n * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`\n * controls in Android 4.\n * 2. Correct the inability to style clickable types in iOS and Safari.\n */\n /**\n * Remove the inner border and padding in Firefox.\n */\n /**\n * Restore the focus styles unset by the previous rule.\n */\n /**\n * Change the border, margin, and padding in all browsers (opinionated).\n */\n /**\n * 1. Correct the text wrapping in Edge and IE.\n * 2. Correct the color inheritance from `fieldset` elements in IE.\n * 3. Remove the padding so developers are not caught out when they zero out\n * `fieldset` elements in all browsers.\n */\n /**\n * Remove the default vertical scrollbar in IE.\n */\n /**\n * 1. Add the correct box sizing in IE 10-.\n * 2. Remove the padding in IE 10-.\n */\n /**\n * Correct the cursor style of increment and decrement buttons in Chrome.\n */\n /**\n * 1. Correct the odd appearance in Chrome and Safari.\n * 2. Correct the outline style in Safari.\n */\n /**\n * Correct the text style of placeholders in Chrome, Edge, and Safari.\n */\n /**\n * 1. Correct the inability to style clickable types in iOS and Safari.\n * 2. Change font properties to `inherit` in Safari.\n */\n}\n\n.typeahead__container button,\n.typeahead__container input,\n.typeahead__container optgroup,\n.typeahead__container select,\n.typeahead__container textarea {\n font: inherit;\n /* 1 */\n margin: 0;\n /* 2 */\n}\n\n.typeahead__container optgroup {\n font-weight: bold;\n}\n\n.typeahead__container button,\n.typeahead__container input {\n /* 1 */\n overflow: visible;\n}\n\n.typeahead__container button,\n.typeahead__container select {\n /* 1 */\n text-transform: none;\n}\n\n.typeahead__container button,\n.typeahead__container html [type=\"button\"],\n.typeahead__container [type=\"reset\"],\n.typeahead__container [type=\"submit\"] {\n -webkit-appearance: button;\n /* 2 */\n}\n\n.typeahead__container button::-moz-focus-inner,\n.typeahead__container [type=\"button\"]::-moz-focus-inner,\n.typeahead__container [type=\"reset\"]::-moz-focus-inner,\n.typeahead__container [type=\"submit\"]::-moz-focus-inner {\n border-style: none;\n padding: 0;\n}\n\n.typeahead__container button:-moz-focusring,\n.typeahead__container [type=\"button\"]:-moz-focusring,\n.typeahead__container [type=\"reset\"]:-moz-focusring,\n.typeahead__container [type=\"submit\"]:-moz-focusring {\n outline: 1px dotted ButtonText;\n}\n\n.typeahead__container fieldset {\n border: 1px solid #c0c0c0;\n margin: 0 2px;\n padding: 0.35em 0.625em 0.75em;\n}\n\n.typeahead__container legend {\n box-sizing: border-box;\n /* 1 */\n color: inherit;\n /* 2 */\n display: table;\n /* 1 */\n max-width: 100%;\n /* 1 */\n padding: 0;\n /* 3 */\n white-space: normal;\n /* 1 */\n}\n\n.typeahead__container textarea {\n overflow: auto;\n}\n\n.typeahead__container [type=\"checkbox\"],\n.typeahead__container [type=\"radio\"] {\n box-sizing: border-box;\n /* 1 */\n padding: 0;\n /* 2 */\n}\n\n.typeahead__container [type=\"number\"]::-webkit-inner-spin-button,\n.typeahead__container [type=\"number\"]::-webkit-outer-spin-button {\n height: auto;\n}\n\n.typeahead__container ::-webkit-input-placeholder {\n color: inherit;\n opacity: 0.54;\n}\n\n.typeahead__container ::-webkit-file-upload-button {\n -webkit-appearance: button;\n /* 1 */\n font: inherit;\n /* 2 */\n}\n\n.typeahead__container {\n position: relative;\n font: 1rem Lato, \"Helvetica Neue\", Arial, Helvetica, sans-serif;\n}\n\n.typeahead__container * {\n box-sizing: border-box;\n outline: 0;\n}\n\n.typeahead__query {\n position: relative;\n z-index: 2;\n width: 100%;\n}\n\n.typeahead__filter {\n position: relative;\n}\n\n.typeahead__filter button {\n min-width: 100%;\n white-space: nowrap;\n}\n\n.typeahead__filter button:after {\n display: inline-block;\n margin-left: 4px;\n width: 0;\n height: 0;\n vertical-align: -2px;\n content: \"\";\n border: 4px solid;\n border-right-color: transparent;\n border-bottom-color: transparent;\n border-left-color: transparent;\n}\n\n.typeahead__field {\n display: flex;\n position: relative;\n width: 100%;\n}\n\n.typeahead__button button {\n border-top-right-radius: 2px;\n border-bottom-right-radius: 2px;\n}\n\n.typeahead__field {\n color: #555;\n}\n\n.typeahead__field input,\n.typeahead__field textarea,\n.typeahead__field [contenteditable],\n.typeahead__field .typeahead__hint {\n display: block;\n width: 100%;\n line-height: 1.25;\n min-height: calc(0.5rem * 2 + 1.25rem + 2px);\n padding: 0.5rem 0.75rem;\n background: #fff;\n border: 1px solid #ccc;\n border-radius: 2px 0 0 2px;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n box-sizing: border-box;\n}\n\n.typeahead__field input:focus, .typeahead__field input:active,\n.typeahead__field textarea:focus,\n.typeahead__field textarea:active,\n.typeahead__field [contenteditable]:focus,\n.typeahead__field [contenteditable]:active,\n.typeahead__field .typeahead__hint:focus,\n.typeahead__field .typeahead__hint:active {\n border-color: #66afe9;\n}\n\n.typeahead__container.hint .typeahead__field input,\n.typeahead__container.hint .typeahead__field textarea,\n.typeahead__container.hint .typeahead__field [contenteditable] {\n background: transparent;\n}\n\n.typeahead__container.hint .typeahead__query > :last-child, .typeahead__hint {\n background: #fff;\n}\n\n.typeahead__container button {\n display: inline-block;\n margin-bottom: 0;\n text-align: center;\n touch-action: manipulation;\n cursor: pointer;\n background-color: #fff;\n border: 1px solid #ccc;\n line-height: 1.25;\n padding: 0.5rem 0.75rem;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n color: #555;\n}\n\n.typeahead__container button:hover, .typeahead__container button:focus {\n color: #3c3c3c;\n background-color: #f5f5f5;\n border-color: #b3b3b3;\n}\n\n.typeahead__container button:active, .typeahead__container button.active {\n background-image: none;\n}\n\n.typeahead__container button:focus, .typeahead__container button:active {\n border-color: #66afe9;\n}\n\n.typeahead__container input.disabled,\n.typeahead__container input[disabled],\n.typeahead__container button.disabled,\n.typeahead__container button[disabled] {\n cursor: not-allowed;\n pointer-events: none;\n opacity: 0.65;\n box-shadow: none;\n background-color: #fff;\n border-color: #ccc;\n}\n\n.typeahead__container .typeahead__field input,\n.typeahead__container .typeahead__field textarea,\n.typeahead__container .typeahead__field [contenteditable],\n.typeahead__container .typeahead__field .typeahead__hint,\n.typeahead__container .typeahead__field .typeahead__label-container {\n padding-right: 32px;\n}\n\n.typeahead__filter, .typeahead__button {\n z-index: 1;\n}\n\n.typeahead__filter button, .typeahead__button button {\n margin-left: -1px;\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n}\n\n.typeahead__filter:hover, .typeahead__filter:active, .typeahead__filter:focus, .typeahead__button:hover, .typeahead__button:active, .typeahead__button:focus {\n z-index: 1001;\n}\n\n.typeahead__filter:hover button:focus, .typeahead__filter:hover button:active, .typeahead__filter:active button:focus, .typeahead__filter:active button:active, .typeahead__filter:focus button:focus, .typeahead__filter:focus button:active, .typeahead__button:hover button:focus, .typeahead__button:hover button:active, .typeahead__button:active button:focus, .typeahead__button:active button:active, .typeahead__button:focus button:focus, .typeahead__button:focus button:active {\n z-index: 1001;\n}\n\n.typeahead__filter + .typeahead__button button {\n margin-left: -2px;\n}\n\n.typeahead__container.filter .typeahead__filter {\n z-index: 1001;\n}\n\n.typeahead__list, .typeahead__dropdown {\n position: absolute;\n left: 0;\n z-index: 1000;\n width: 100%;\n min-width: 160px;\n padding: 5px 0;\n margin: 2px 0 0;\n list-style: none;\n text-align: left;\n background-color: #fff;\n border: 1px solid #ccc;\n border-radius: 2px;\n background-clip: padding-box;\n}\n\n.typeahead__result.detached .typeahead__list {\n position: relative;\n z-index: 1041;\n top: initial;\n left: initial;\n}\n\n.typeahead__dropdown {\n right: 0;\n left: initial;\n z-index: 1001;\n}\n\n.typeahead__list > li {\n position: relative;\n border-top: solid 1px #ccc;\n}\n\n.typeahead__list > li:first-child {\n border-top: none;\n}\n\n.typeahead__list .typeahead__item[disabled] > a,\n.typeahead__dropdown .typeahead__dropdown-item[disabled] > a {\n cursor: not-allowed;\n color: #bababa;\n background-color: #fafafa;\n}\n\n.typeahead__list .typeahead__item > a,\n.typeahead__dropdown .typeahead__dropdown-item > a {\n display: block;\n padding: 0.5rem 0.75rem;\n clear: both;\n color: #333;\n text-decoration: none;\n}\n\n.typeahead__list .typeahead__item:not([disabled]) > a:hover,\n.typeahead__list .typeahead__item:not([disabled]) > a:focus,\n.typeahead__list .typeahead__item:not([disabled]).active > a,\n.typeahead__dropdown .typeahead__dropdown-item:not([disabled]) > a:hover,\n.typeahead__dropdown .typeahead__dropdown-item:not([disabled]) > a:focus,\n.typeahead__dropdown .typeahead__dropdown-item:not([disabled]).active > a {\n background-color: #f5f5f5;\n color: #3c3c3c;\n}\n\n.typeahead__list.empty > li {\n padding: 0.5rem 0.75rem;\n color: #333;\n}\n\n.typeahead__list > .typeahead__group {\n border-color: #bfdef6;\n font-weight: bold;\n}\n\n.typeahead__list > .typeahead__group:first-child {\n border-top: solid 1px #bfdef6;\n}\n\n.typeahead__list > .typeahead__group > a,\n.typeahead__list > .typeahead__group > a:hover,\n.typeahead__list > .typeahead__group > a:focus,\n.typeahead__list > .typeahead__group.active > a {\n cursor: default;\n color: #17639f;\n background: #ecf5fc;\n display: block;\n padding: 0.5rem 0.75rem;\n clear: both;\n text-decoration: none;\n}\n\n.typeahead__list > li.typeahead__group + li.typeahead__item {\n border-color: #bfdef6;\n}\n\n.typeahead__container.result .typeahead__list,\n.typeahead__container.filter .typeahead__dropdown,\n.typeahead__container.hint .typeahead__hint,\n.typeahead__container.backdrop + .typeahead__backdrop {\n display: block !important;\n}\n\n.typeahead__container .typeahead__list,\n.typeahead__container .typeahead__dropdown,\n.typeahead__container .typeahead__hint,\n.typeahead__container + .typeahead__backdrop {\n display: none !important;\n}\n\n.typeahead__dropdown li:last-child {\n margin-top: 5px;\n padding-top: 5px;\n border-top: solid 1px #ccc;\n}\n\n.typeahead__cancel-button {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n position: absolute;\n right: 0;\n cursor: pointer;\n line-height: 1.25;\n padding: 0.5rem 0.75rem;\n visibility: hidden;\n}\n\n.typeahead__label .typeahead__cancel-button {\n visibility: visible;\n right: 4px;\n}\n\n.typeahead__container.cancel:not(.loading) .typeahead__cancel-button, .typeahead__label .typeahead__cancel-button {\n visibility: visible;\n}\n\n.typeahead__container.cancel:not(.loading) .typeahead__cancel-button:hover, .typeahead__label .typeahead__cancel-button:hover {\n color: #d0021b;\n}\n\n.typeahead__search-icon {\n padding: 0 1.25rem;\n width: 16px;\n height: 16px;\n background: url(data:image/svg+xml;charset=utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTguMS4xLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDI1MC4zMTMgMjUwLjMxMyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMjUwLjMxMyAyNTAuMzEzOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCI+CjxnIGlkPSJTZWFyY2giPgoJPHBhdGggc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkOyIgZD0iTTI0NC4xODYsMjE0LjYwNGwtNTQuMzc5LTU0LjM3OGMtMC4yODktMC4yODktMC42MjgtMC40OTEtMC45My0wLjc2ICAgYzEwLjctMTYuMjMxLDE2Ljk0NS0zNS42NiwxNi45NDUtNTYuNTU0QzIwNS44MjIsNDYuMDc1LDE1OS43NDcsMCwxMDIuOTExLDBTMCw0Ni4wNzUsMCwxMDIuOTExICAgYzAsNTYuODM1LDQ2LjA3NCwxMDIuOTExLDEwMi45MSwxMDIuOTExYzIwLjg5NSwwLDQwLjMyMy02LjI0NSw1Ni41NTQtMTYuOTQ1YzAuMjY5LDAuMzAxLDAuNDcsMC42NCwwLjc1OSwwLjkyOWw1NC4zOCw1NC4zOCAgIGM4LjE2OSw4LjE2OCwyMS40MTMsOC4xNjgsMjkuNTgzLDBDMjUyLjM1NCwyMzYuMDE3LDI1Mi4zNTQsMjIyLjc3MywyNDQuMTg2LDIxNC42MDR6IE0xMDIuOTExLDE3MC4xNDYgICBjLTM3LjEzNCwwLTY3LjIzNi0zMC4xMDItNjcuMjM2LTY3LjIzNWMwLTM3LjEzNCwzMC4xMDMtNjcuMjM2LDY3LjIzNi02Ny4yMzZjMzcuMTMyLDAsNjcuMjM1LDMwLjEwMyw2Ny4yMzUsNjcuMjM2ICAgQzE3MC4xNDYsMTQwLjA0NCwxNDAuMDQzLDE3MC4xNDYsMTAyLjkxMSwxNzAuMTQ2eiIgZmlsbD0iIzU1NTU1NSIvPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=) no-repeat scroll center center transparent;\n}\n\n.typeahead__container.loading .typeahead__query:before, .typeahead__container.loading .typeahead__query:after {\n transition: all 0s linear, opacity 0.2s ease;\n position: absolute;\n z-index: 3;\n content: \"\";\n top: 50%;\n right: 0.55em;\n margin-top: -0.675rem;\n width: 1.35rem;\n height: 1.35rem;\n box-sizing: border-box;\n border-radius: 500rem;\n border-style: solid;\n border-width: 0.1em;\n}\n\n.typeahead__container.loading .typeahead__query:before {\n border-color: rgba(0, 0, 0, 0.35);\n}\n\n.typeahead__container.loading .typeahead__query:after {\n -webkit-animation: button-spin 0.6s linear;\n animation: button-spin 0.6s linear;\n -webkit-animation-iteration-count: infinite;\n animation-iteration-count: infinite;\n border-color: #fff transparent transparent;\n box-shadow: 0 0 0 1px transparent;\n}\n\n@-webkit-keyframes button-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n\n@keyframes button-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n}\n\n.typeahead__label-container {\n list-style: none;\n position: absolute;\n padding-top: calc(1rem * 0.375);\n padding-left: 6px;\n width: 100%;\n flex-wrap: wrap;\n display: flex;\n}\n\n.typeahead__label {\n display: flex;\n font-size: calc(1rem * 0.875);\n position: relative;\n background: #ecf5fc;\n border: solid 1px #c2e0ff;\n padding-left: 4px;\n border-radius: 2px;\n margin-right: 4px;\n margin-bottom: calc(1rem * 0.375);\n}\n\n.typeahead__label > * {\n align-self: center;\n}\n\n.typeahead__label .typeahead__cancel-button {\n line-height: normal;\n height: auto;\n position: static;\n padding-top: calc(1rem * 0.25 - 1px);\n padding-bottom: calc(1rem * 0.25 + 1px);\n padding-left: 6px;\n padding-right: 6px;\n margin-left: 4px;\n font-size: calc(1rem * 0.875);\n border-left: solid 1px #c2e0ff;\n}\n\n.typeahead__label .typeahead__cancel-button:hover {\n background-color: #d5e9f9;\n}\n", ""]); +// Exports +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___); + + +/***/ }), + +/***/ "./node_modules/css-loader/dist/runtime/api.js": +/*!*****************************************************!*\ + !*** ./node_modules/css-loader/dist/runtime/api.js ***! + \*****************************************************/ +/***/ ((module) => { + +"use strict"; + + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ +// css base code, injected by the css-loader +// eslint-disable-next-line func-names +module.exports = function (cssWithMappingToString) { + var list = []; // return the list of modules as css string + + list.toString = function toString() { + return this.map(function (item) { + var content = cssWithMappingToString(item); + + if (item[2]) { + return "@media ".concat(item[2], " {").concat(content, "}"); + } + + return content; + }).join(""); + }; // import a list of modules into the list + // eslint-disable-next-line func-names + + + list.i = function (modules, mediaQuery, dedupe) { + if (typeof modules === "string") { + // eslint-disable-next-line no-param-reassign + modules = [[null, modules, ""]]; + } + + var alreadyImportedModules = {}; + + if (dedupe) { + for (var i = 0; i < this.length; i++) { + // eslint-disable-next-line prefer-destructuring + var id = this[i][0]; + + if (id != null) { + alreadyImportedModules[id] = true; + } + } + } + + for (var _i = 0; _i < modules.length; _i++) { + var item = [].concat(modules[_i]); + + if (dedupe && alreadyImportedModules[item[0]]) { + // eslint-disable-next-line no-continue + continue; + } + + if (mediaQuery) { + if (!item[2]) { + item[2] = mediaQuery; + } else { + item[2] = "".concat(mediaQuery, " and ").concat(item[2]); + } + } + + list.push(item); + } + }; + + return list; +}; + +/***/ }), + +/***/ "./node_modules/jquery-typeahead/dist/jquery.typeahead.min.js": +/*!********************************************************************!*\ + !*** ./node_modules/jquery-typeahead/dist/jquery.typeahead.min.js ***! + \********************************************************************/ +/***/ ((module, exports, __webpack_require__) => { + +var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! + * jQuery Typeahead + * Copyright (C) 2020 RunningCoder.org + * Licensed under the MIT license + * + * @author Tom Bertrand + * @version 2.11.1 (2020-5-18) + * @link http://www.runningcoder.org/jquerytypeahead/ + */ +!function(e){var t; true?!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_RESULT__ = (function(t){return e(t)}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):0}(function(j){"use strict";function r(t,e){this.rawQuery=t.val()||"",this.query=t.val()||"",this.selector=t[0].selector,this.deferred=null,this.tmpSource={},this.source={},this.dynamicGroups=[],this.hasDynamicGroups=!1,this.generatedGroupCount=0,this.groupBy="group",this.groups=[],this.searchGroups=[],this.generateGroups=[],this.requestGroups=[],this.result=[],this.tmpResult={},this.groupTemplate="",this.resultHtml=null,this.resultCount=0,this.resultCountPerGroup={},this.options=e,this.node=t,this.namespace="."+this.helper.slugify.call(this,this.selector)+".typeahead",this.isContentEditable=void 0!==this.node.attr("contenteditable")&&"false"!==this.node.attr("contenteditable"),this.container=null,this.resultContainer=null,this.item=null,this.items=null,this.comparedItems=null,this.xhr={},this.hintIndex=null,this.filters={dropdown:{},dynamic:{}},this.dropdownFilter={static:[],dynamic:[]},this.dropdownFilterAll=null,this.isDropdownEvent=!1,this.requests={},this.backdrop={},this.hint={},this.label={},this.hasDragged=!1,this.focusOnly=!1,this.displayEmptyTemplate,this.__construct()}var i,s={input:null,minLength:2,maxLength:!(window.Typeahead={version:"2.11.1"}),maxItem:8,dynamic:!1,delay:300,order:null,offset:!1,hint:!1,accent:!1,highlight:!0,multiselect:null,group:!1,groupOrder:null,maxItemPerGroup:null,dropdownFilter:!1,dynamicFilter:null,backdrop:!1,backdropOnFocus:!1,cache:!1,ttl:36e5,compression:!1,searchOnFocus:!1,blurOnTab:!0,resultContainer:null,generateOnLoad:null,mustSelectItem:!1,href:null,display:["display"],template:null,templateValue:null,groupTemplate:null,correlativeTemplate:!1,emptyTemplate:!1,cancelButton:!0,loadingAnimation:!0,asyncResult:!1,filter:!0,matcher:null,source:null,callback:{onInit:null,onReady:null,onShowLayout:null,onHideLayout:null,onSearch:null,onResult:null,onLayoutBuiltBefore:null,onLayoutBuiltAfter:null,onNavigateBefore:null,onNavigateAfter:null,onEnter:null,onLeave:null,onClickBefore:null,onClickAfter:null,onDropdownFilter:null,onSendRequest:null,onReceiveRequest:null,onPopulateSource:null,onCacheSave:null,onSubmit:null,onCancel:null},selector:{container:"typeahead__container",result:"typeahead__result",list:"typeahead__list",group:"typeahead__group",item:"typeahead__item",empty:"typeahead__empty",display:"typeahead__display",query:"typeahead__query",filter:"typeahead__filter",filterButton:"typeahead__filter-button",dropdown:"typeahead__dropdown",dropdownItem:"typeahead__dropdown-item",labelContainer:"typeahead__label-container",label:"typeahead__label",button:"typeahead__button",backdrop:"typeahead__backdrop",hint:"typeahead__hint",cancelButton:"typeahead__cancel-button"},debug:!1},o={from:"ãàáäâẽèéëêìíïîõòóöôùúüûñç",to:"aaaaaeeeeeiiiiooooouuuunc"},n=~window.navigator.appVersion.indexOf("MSIE 9."),a=~window.navigator.appVersion.indexOf("MSIE 10"),l=!!~window.navigator.userAgent.indexOf("Trident")&&~window.navigator.userAgent.indexOf("rv:11");r.prototype={_validateCacheMethod:function(t){var e;if(!0===t)t="localStorage";else if("string"==typeof t&&!~["localStorage","sessionStorage"].indexOf(t))return!1;e=void 0!==window[t];try{window[t].setItem("typeahead","typeahead"),window[t].removeItem("typeahead")}catch(t){e=!1}return e&&t||!1},extendOptions:function(){if(this.options.cache=this._validateCacheMethod(this.options.cache),this.options.compression&&("object"==typeof LZString&&this.options.cache||(this.options.compression=!1)),this.options.maxLength&&!isNaN(this.options.maxLength)||(this.options.maxLength=1/0),void 0!==this.options.maxItem&&~[0,!1].indexOf(this.options.maxItem)&&(this.options.maxItem=1/0),this.options.maxItemPerGroup&&!/^\d+$/.test(this.options.maxItemPerGroup)&&(this.options.maxItemPerGroup=null),this.options.display&&!Array.isArray(this.options.display)&&(this.options.display=[this.options.display]),this.options.multiselect&&(this.items=[],this.comparedItems=[],"string"==typeof this.options.multiselect.matchOn&&(this.options.multiselect.matchOn=[this.options.multiselect.matchOn])),this.options.group&&(Array.isArray(this.options.group)||("string"==typeof this.options.group?this.options.group={key:this.options.group}:"boolean"==typeof this.options.group&&(this.options.group={key:"group"}),this.options.group.key=this.options.group.key||"group")),this.options.highlight&&!~["any",!0].indexOf(this.options.highlight)&&(this.options.highlight=!1),this.options.dropdownFilter&&this.options.dropdownFilter instanceof Object){Array.isArray(this.options.dropdownFilter)||(this.options.dropdownFilter=[this.options.dropdownFilter]);for(var t=0,e=this.options.dropdownFilter.length;te.maxLength&&(e.minLength=e.maxLength),this.options.source[t]=e,this.options.source[t].dynamic&&this.dynamicGroups.push(t),e.cache=void 0!==e.cache?this._validateCacheMethod(e.cache):this.options.cache,e.compression&&("object"==typeof LZString&&e.cache||(e.compression=!1))}return this.hasDynamicGroups=this.options.dynamic||!!this.dynamicGroups.length,!0},init:function(){this.helper.executeCallback.call(this,this.options.callback.onInit,[this.node]),this.container=this.node.closest("."+this.options.selector.container)},delegateEvents:function(){var i=this,t=["focus"+this.namespace,"input"+this.namespace,"propertychange"+this.namespace,"keydown"+this.namespace,"keyup"+this.namespace,"search"+this.namespace,"generate"+this.namespace];j("html").on("touchmove",function(){i.hasDragged=!0}).on("touchstart",function(){i.hasDragged=!1}),this.node.closest("form").on("submit",function(t){if(!i.options.mustSelectItem||!i.helper.isEmpty(i.item))return i.options.backdropOnFocus||i.hideLayout(),i.options.callback.onSubmit?i.helper.executeCallback.call(i,i.options.callback.onSubmit,[i.node,this,i.item||i.items,t]):void 0;t.preventDefault()}).on("reset",function(){setTimeout(function(){i.node.trigger("input"+i.namespace),i.hideLayout()})});var s=!1;if(this.node.attr("placeholder")&&(a||l)){var e=!0;this.node.on("focusin focusout",function(){e=!(this.value||!this.placeholder)}),this.node.on("input",function(t){e&&(t.stopImmediatePropagation(),e=!1)})}this.node.off(this.namespace).on(t.join(" "),function(t,e){switch(t.type){case"generate":i.generateSource(Object.keys(i.options.source));break;case"focus":if(i.focusOnly){i.focusOnly=!1;break}i.options.backdropOnFocus&&(i.buildBackdropLayout(),i.showLayout()),i.options.searchOnFocus&&!i.item&&(i.deferred=j.Deferred(),i.assignQuery(),i.generateSource());break;case"keydown":8===t.keyCode&&i.options.multiselect&&i.options.multiselect.cancelOnBackspace&&""===i.query&&i.items.length?i.cancelMultiselectItem(i.items.length-1,null,t):t.keyCode&&~[9,13,27,38,39,40].indexOf(t.keyCode)&&(s=!0,i.navigate(t));break;case"keyup":n&&i.node[0].value.replace(/^\s+/,"").toString().length=this.options.source[t].minLength&&this.query.length<=this.options.source[t].maxLength){if(this.filters.dropdown&&"group"===this.filters.dropdown.key&&this.filters.dropdown.value!==t)continue;if(this.searchGroups.push(t),!this.options.source[t].dynamic&&this.source[t])continue;this.generateGroups.push(t)}},generateSource:function(t){if(this.filterGenerateSource(),this.generatedGroupCount=0,Array.isArray(t)&&t.length)this.generateGroups=t;else if(!this.generateGroups.length)return void this.node.trigger("search"+this.namespace);if(this.requestGroups=[],this.options.loadingAnimation&&this.container.addClass("loading"),!this.helper.isEmpty(this.xhr)){for(var e in this.xhr)this.xhr.hasOwnProperty(e)&&this.xhr[e].abort();this.xhr={}}for(var i,s,o,n,r,a,l,h=this,c=(e=0,this.generateGroups.length);e(new Date).getTime()?(this.populateSource(a.data,i),l=!0):window[n].removeItem("TYPEAHEAD_"+this.selector+":"+i)}catch(t){}if(l)continue}!o.data||o.ajax?o.ajax&&(this.requests[i]||(this.requests[i]=this.generateRequestObject(i)),this.requestGroups.push(i)):"function"==typeof o.data?(s=o.data.call(this),Array.isArray(s)?h.populateSource(s,i):"function"==typeof s.promise&&function(e){j.when(s).then(function(t){t&&Array.isArray(t)&&h.populateSource(t,e)})}(i)):this.populateSource(j.extend(!0,[],o.data),i)}return this.requestGroups.length&&this.handleRequests(),this.options.asyncResult&&this.searchGroups.length!==this.generateGroups&&this.node.trigger("search"+this.namespace),!!this.generateGroups.length},generateRequestObject:function(s){var o=this,n=this.options.source[s],t={request:{url:n.ajax.url||null,dataType:"json",beforeSend:function(t,e){o.xhr[s]=t;var i=o.requests[s].callback.beforeSend||n.ajax.beforeSend;"function"==typeof i&&i.apply(null,arguments)}},callback:{beforeSend:null,done:null,fail:null,then:null,always:null},extra:{path:n.ajax.path||null,group:s},validForGroup:[s]};if("function"!=typeof n.ajax&&(n.ajax instanceof Object&&(t=this.extendXhrObject(t,n.ajax)),1/g," ").replace(/\s{2,}/," ").trim();for(l=0,h=i.length;l").html(g.replace(/\{\{([\w\-\.]+)(?:\|(\w+))?}}/g,function(t,e){return s.helper.namespace.call(s,e,i[l],"get","")}).trim()).text();o.display?~o.display.indexOf("compiled")||o.display.unshift("compiled"):~this.options.display.indexOf("compiled")||this.options.display.unshift("compiled")}else;}this.options.callback.onPopulateSource&&(i=this.helper.executeCallback.call(this,this.options.callback.onPopulateSource,[this.node,i,t,e])),this.tmpSource[t]=Array.isArray(i)&&i||[];var y=this.options.source[t].cache,v=this.options.source[t].compression,b=this.options.source[t].ttl||this.options.ttl;if(y&&!window[y].getItem("TYPEAHEAD_"+this.selector+":"+t)){this.options.callback.onCacheSave&&(i=this.helper.executeCallback.call(this,this.options.callback.onCacheSave,[this.node,i,t,e]));var k=JSON.stringify({data:i,ttl:(new Date).getTime()+b});v&&(k=LZString.compressToUTF16(k)),window[y].setItem("TYPEAHEAD_"+this.selector+":"+t,k)}this.incrementGeneratedGroup(t)},incrementGeneratedGroup:function(t){if(this.generatedGroupCount++,this.generatedGroupCount===this.generateGroups.length||this.options.asyncResult){this.xhr&&this.xhr[t]&&delete this.xhr[t];for(var e=0,i=this.generateGroups.length;e=this.query.length&&i.filter('[data-index="'+this.hintIndex+'"]').find("a:first")[0].click()}},getTemplateValue:function(i){if(i){var t=i.group&&this.options.source[i.group].templateValue||this.options.templateValue;if("function"==typeof t&&(t=t.call(this)),!t)return this.helper.namespace.call(this,i.matchedKey,i).toString();var s=this;return t.replace(/\{\{([\w\-.]+)}}/gi,function(t,e){return s.helper.namespace.call(s,e,i,"get","")})}},clearActiveItem:function(){this.resultContainer.find("."+this.options.selector.item).removeClass("active")},addActiveItem:function(t){t.addClass("active")},searchResult:function(){this.resetLayout(),!1!==this.helper.executeCallback.call(this,this.options.callback.onSearch,[this.node,this.query])&&(!this.searchGroups.length||this.options.multiselect&&this.options.multiselect.limit&&this.items.length>=this.options.multiselect.limit||this.searchResultData(),this.helper.executeCallback.call(this,this.options.callback.onResult,[this.node,this.query,this.result,this.resultCount,this.resultCountPerGroup]),this.isDropdownEvent&&(this.helper.executeCallback.call(this,this.options.callback.onDropdownFilter,[this.node,this.query,this.filters.dropdown,this.result]),this.isDropdownEvent=!1))},searchResultData:function(){var t,e,i,s,o,n,r,a,l,h,c,p=this.groupBy,u=null,d=this.query.toLowerCase(),f=this.options.maxItem,m=this.options.maxItemPerGroup,g=this.filters.dynamic&&!this.helper.isEmpty(this.filters.dynamic),y="function"==typeof this.options.matcher&&this.options.matcher;this.options.accent&&(d=this.helper.removeAccent.call(this,d));for(var v=0,b=this.searchGroups.length;v=f)||this.options.callback.onResult);k++)if((!g||this.dynamicFilter.validate.apply(this,[this.source[F][k]]))&&null!==(t=this.source[F][k])&&"boolean"!=typeof t&&(!this.options.multiselect||this.isMultiselectUniqueData(t))&&(!this.filters.dropdown||(t[this.filters.dropdown.key]||"").toLowerCase()===(this.filters.dropdown.value||"").toLowerCase())){if((u="group"===p?F:t[p]?t[p]:t.group)&&!this.tmpResult[u]&&(this.tmpResult[u]=[],this.resultCountPerGroup[u]=0),m&&"group"===p&&this.tmpResult[u].length>=m&&!this.options.callback.onResult)break;for(var x=0,C=(S=this.options.source[F].display||this.options.display).length;x=m)break;this.tmpResult[u].push(j.extend(!0,{matchedKey:S[x]},t)),this.resultItemCount++}break}if(!this.options.callback.onResult){if(this.resultItemCount>=f)break;if(m&&this.tmpResult[u].length>=m&&"group"===p)break}}if(this.options.order){var O,S=[];for(var F in this.tmpResult)if(this.tmpResult.hasOwnProperty(F)){for(v=0,b=this.tmpResult[F].length;v",{class:this.options.selector.result}),this.container.append(this.resultContainer)),!this.result.length&&this.generatedGroupCount===this.generateGroups.length)if(this.options.multiselect&&this.options.multiselect.limit&&this.items.length>=this.options.multiselect.limit)h=this.options.multiselect.limitTemplate?"function"==typeof this.options.multiselect.limitTemplate?this.options.multiselect.limitTemplate.call(this,this.query):this.options.multiselect.limitTemplate.replace(/\{\{query}}/gi,j("
").text(this.helper.cleanStringFromScript(this.query)).html()):"Can't select more than "+this.items.length+" items.";else{if(!this.options.emptyTemplate||""===this.query)return;h="function"==typeof this.options.emptyTemplate?this.options.emptyTemplate.call(this,this.query):this.options.emptyTemplate.replace(/\{\{query}}/gi,j("
").text(this.helper.cleanStringFromScript(this.query)).html())}this.displayEmptyTemplate=!!h;var o=this.query.toLowerCase();this.options.accent&&(o=this.helper.removeAccent.call(this,o));var c=this,t=this.groupTemplate||"
    ",p=!1;this.groupTemplate?t=j(t.replace(/<([^>]+)>\{\{(.+?)}}<\/[^>]+>/g,function(t,e,i,s,o){var n="",r="group"===i?c.groups:[i];if(!c.result.length)return!0===p?"":(p=!0,"<"+e+' class="'+c.options.selector.empty+'">'+h+"");for(var a=0,l=r.length;a
      ";return n})):(t=j(t),this.result.length||t.append(h instanceof j?h:'
    • '+h+"
    • ")),t.addClass(this.options.selector.list+(this.helper.isEmpty(this.result)?" empty":""));for(var e,i,n,s,r,a,l,u,d,f,m,g,y,v=this.groupTemplate&&this.result.length&&c.groups||[],b=0,k=this.result.length;b",{class:c.options.selector.group,html:j("",{href:"javascript:;",html:i||e,tabindex:-1}),"data-search-group":e}))),this.groupTemplate&&v.length&&~(m=v.indexOf(e||n.group))&&v.splice(m,1),r=j("
    • ",{class:c.options.selector.item+" "+c.options.selector.group+"-"+this.helper.slugify.call(this,e),disabled:!!n.disabled,"data-group":e,"data-index":b,html:j("",{href:s&&!n.disabled?(g=s,y=n,y.href=c.generateHref.call(c,g,y)):"javascript:;",html:function(){if(a=n.group&&c.options.source[n.group].template||c.options.template)"function"==typeof a&&(a=a.call(c,c.query,n)),l=a.replace(/\{\{([^\|}]+)(?:\|([^}]+))*}}/gi,function(t,e,i){var s=c.helper.cleanStringFromScript(String(c.helper.namespace.call(c,e,n,"get","")));return~(i=i&&i.split("|")||[]).indexOf("slugify")&&(s=c.helper.slugify.call(c,s)),~i.indexOf("raw")||!0===c.options.highlight&&o&&~d.indexOf(e)&&(s=c.helper.highlight.call(c,s,o.split(" "),c.options.accent)),s});else{for(var t=0,e=d.length;t'+c.helper.cleanStringFromScript(String(u.join(" ")))+""}(!0===c.options.highlight&&o&&!a||"any"===c.options.highlight)&&(l=c.helper.highlight.call(c,l,o.split(" "),c.options.accent)),j(this).append(l)}})}),function(t,i,e){e.on("click",function(t,e){i.disabled?t.preventDefault():(e&&"object"==typeof e&&(t.originalEvent=e),c.options.mustSelectItem&&c.helper.isEmpty(i)?t.preventDefault():(c.options.multiselect||(c.item=i),!1!==c.helper.executeCallback.call(c,c.options.callback.onClickBefore,[c.node,j(this),i,t])&&(t.originalEvent&&t.originalEvent.defaultPrevented||t.isDefaultPrevented()||(c.options.multiselect?(c.query=c.rawQuery="",c.addMultiselectItemLayout(i)):(c.focusOnly=!0,c.query=c.rawQuery=c.getTemplateValue.call(c,i),c.isContentEditable&&(c.node.text(c.query),c.helper.setCaretAtEnd(c.node[0]))),c.hideLayout(),c.node.val(c.query).focus(),c.options.cancelButton&&c.toggleCancelButtonVisibility(),c.helper.executeCallback.call(c,c.options.callback.onClickAfter,[c.node,j(this),i,t])))))}),e.on("mouseenter",function(t){i.disabled||(c.clearActiveItem(),c.addActiveItem(j(this))),c.helper.executeCallback.call(c,c.options.callback.onEnter,[c.node,j(this),i,t])}),e.on("mouseleave",function(t){i.disabled||c.clearActiveItem(),c.helper.executeCallback.call(c,c.options.callback.onLeave,[c.node,j(this),i,t])})}(0,n,r),(this.groupTemplate?t.find('[data-group-template="'+e+'"] ul'):t).append(r);if(this.result.length&&v.length)for(b=0,k=v.length;b",{class:this.options.selector.backdrop,css:this.backdrop.css}).insertAfter(this.container)),this.container.addClass("backdrop").css({"z-index":this.backdrop.css["z-index"]+1,position:"relative"}))},buildHintLayout:function(t){if(this.options.hint)if(this.node[0].scrollWidth>Math.ceil(this.node.innerWidth()))this.hint.container&&this.hint.container.val("");else{var e=this,i="",s=(t=t||this.result,this.query.toLowerCase());if(this.options.accent&&(s=this.helper.removeAccent.call(this,s)),this.hintIndex=null,this.searchGroups.length){if(this.hint.container||(this.hint.css=j.extend({"border-color":"transparent",position:"absolute",top:0,display:"inline","z-index":-1,float:"none",color:"silver","box-shadow":"none",cursor:"default","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"},this.options.hint),this.hint.container=j("<"+this.node[0].nodeName+"/>",{type:this.node.attr("type"),class:this.node.attr("class"),readonly:!0,unselectable:"on","aria-hidden":"true",tabindex:-1,click:function(){e.node.focus()}}).addClass(this.options.selector.hint).css(this.hint.css).insertAfter(this.node),this.node.parent().css({position:"relative"})),this.hint.container.css("color",this.hint.css.color),s)for(var o,n,r,a=0,l=t.length;a",{class:this.options.selector.filter,html:function(){j(this).append(j("