From 4acd6d6ca82229a0a7bad60b18efcbaada56de94 Mon Sep 17 00:00:00 2001 From: Konstantin Vyatkin Date: Tue, 22 Oct 2019 17:20:40 -0400 Subject: [PATCH] Improve GitHub actions and fix `package.json` SCSS script (#669) * run actions on dependencies change * add bundlesize token to master run * fix bundlesize commit number * add cypress env * also run on - '.browserslistrc' changes * update node-sass to allow install on Node 12 and trigger events * use script * add group * skip husky on cypress * upgrade csso dependency to make it trim sourcemaps * fix run-p / run-s use * remove commited assets on check * commit assets * remove cypress record * restore recording * reduce bundlesize limits * try to specify key implicity * remove Cypress recording * restore build in bundlesize * regenerate package-json.lock * commit generated assets * handle no-js case in lint * fix lint error --- .github/workflows/bundlesize.yml | 8 +- .github/workflows/cypress.yml | 11 +- .github/workflows/lint.yml | 5 +- .github/workflows/npmpublish.yml | 2 + .github/workflows/unit-tests.yml | 2 + package-lock.json | 3160 ++++++++- package.json | 19 +- public/assets/scripts/choices.js | 9241 ++++++++++++-------------- public/assets/scripts/choices.min.js | 38 +- public/assets/styles/choices.min.css | 2 +- src/scripts/templates.test.js | 28 +- 11 files changed, 7133 insertions(+), 5383 deletions(-) diff --git a/.github/workflows/bundlesize.yml b/.github/workflows/bundlesize.yml index 72b00ca..30fd049 100644 --- a/.github/workflows/bundlesize.yml +++ b/.github/workflows/bundlesize.yml @@ -5,6 +5,8 @@ on: paths: - 'src/scripts/**' - 'src/styles/**' + - 'package-lock.json' + - '.browserslistrc' jobs: measure: @@ -26,13 +28,15 @@ jobs: CYPRESS_INSTALL_BINARY: 0 HUSKY_SKIP_INSTALL: true + # we don't need to build here, as even minized assets expected to be commited + - run: npx bundlesize env: CI: true BUNDLESIZE_GITHUB_TOKEN: ${{secrets.BUNDLESIZE_GITHUB_TOKEN}} CI_REPO_NAME: ${{ github.event.repository.name }} CI_REPO_OWNER: ${{ github.event.organization.login }} - CI_COMMIT_SHA: ${{ github.sha }} - GIT_COMMIT: ${{ github.sha }} + CI_COMMIT_SHA: ${{ github.event.after }} + GIT_COMMIT: ${{ github.event.after }} CI_BRANCH: ${{ github.head_ref }} FORCE_COLOR: 2 diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index e5bb55a..c61cb27 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -15,11 +15,18 @@ jobs: with: node-version: 10 - - name: Build library + - name: Install dependencies run: npm ci + env: + HUSKY_SKIP_INSTALL: true - name: run Cypress - run: npm run test:e2e + run: npx run-p --race start cypress:run env: CI: true + CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} DEBUG: commit-info,cypress:server:record + # https://docs.cypress.io/guides/guides/continuous-integration.html#Environment-variables + COMMIT_INFO_BRANCH: ${{ github.head_ref }} + COMMIT_INFO_AUTHOR: ${{ github.event.sender.login }} + COMMIT_INFO_SHA: ${{ github.event.after }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d26298a..b88bd73 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,6 +4,8 @@ on: pull_request: paths: - 'src/scripts/**' + - package-lock.json + - '.browserslistrc' jobs: eslint: @@ -26,6 +28,7 @@ jobs: - name: run eslint run: | - CHANGED_JS=$(git --no-pager diff --name-only ..origin/master | grep '^src\/scripts\/.*\.js$' | grep -v json) + CHANGED_JS=$(git --no-pager diff --name-only ..origin/master | grep '^src\/scripts\/.*\.js$' | paste -sd " " -) + if [[ -z $(sed -e 's/[[:space:]]*$//' <<<${CHANGED_JS}) ]]; then CHANGED_JS="src/scripts"; fi echo $CHANGED_JS node node_modules/eslint/bin/eslint.js $CHANGED_JS diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml index 3874764..5a5b676 100644 --- a/.github/workflows/npmpublish.yml +++ b/.github/workflows/npmpublish.yml @@ -31,6 +31,7 @@ jobs: CI_COMMIT_SHA: ${{ github.sha }} GIT_COMMIT: ${{ github.sha }} CI_BRANCH: ${{ github.head_ref }} + BUNDLESIZE_GITHUB_TOKEN: ${{secrets.BUNDLESIZE_GITHUB_TOKEN}} FORCE_COLOR: 2 HUSKY_SKIP_INSTALL: true @@ -79,3 +80,4 @@ jobs: files: RELEASE.txt env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 7756548..7fcc66f 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -4,6 +4,8 @@ on: pull_request: paths: - 'src/scripts/**' + - package-lock.json + - '.browserslistrc' jobs: test: diff --git a/package-lock.json b/package-lock.json index 6f212b9..32b35bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1291,24 +1291,13 @@ } }, "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", "dev": true, "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" - }, - "dependencies": { - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - } + "micromatch": "^2.1.5", + "normalize-path": "^2.0.0" } }, "append-transform": { @@ -1352,10 +1341,13 @@ } }, "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } }, "arr-flatten": { "version": "1.1.0", @@ -1419,9 +1411,9 @@ "dev": true }, "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", "dev": true }, "asn1": { @@ -1650,6 +1642,18 @@ "is-data-descriptor": "^1.0.0", "kind-of": "^6.0.2" } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true } } }, @@ -1829,32 +1833,14 @@ } }, "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", "dev": true, "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" } }, "brorand": { @@ -2087,6 +2073,14 @@ "to-object-path": "^0.3.0", "union-value": "^1.0.0", "unset-value": "^1.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } } }, "cachedir": { @@ -2226,46 +2220,20 @@ "dev": true }, "chokidar": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", - "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", + "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", "dev": true, "requires": { - "anymatch": "^2.0.0", - "async-each": "^1.0.1", - "braces": "^2.3.2", - "fsevents": "^1.2.7", - "glob-parent": "^3.1.0", - "inherits": "^2.0.3", + "anymatch": "^1.3.0", + "async-each": "^1.0.0", + "fsevents": "^1.0.0", + "glob-parent": "^2.0.0", + "inherits": "^2.0.1", "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "normalize-path": "^3.0.0", + "is-glob": "^2.0.0", "path-is-absolute": "^1.0.0", - "readdirp": "^2.2.1", - "upath": "^1.1.1" - }, - "dependencies": { - "glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", - "dev": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - }, - "dependencies": { - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - } - } - } + "readdirp": "^2.0.0" } }, "chownr": { @@ -2361,6 +2329,12 @@ "requires": { "is-descriptor": "^0.1.0" } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true } } }, @@ -2786,13 +2760,34 @@ "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", "dev": true }, - "csso": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/csso/-/csso-1.8.2.tgz", - "integrity": "sha1-06BgraXSoWt1Bh+tnZFtCdwvTlA=", + "css-tree": { + "version": "1.0.0-alpha.29", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-1.0.0-alpha.29.tgz", + "integrity": "sha512-sRNb1XydwkW9IOci6iB2xmy8IGCj6r/fr+JWitvJ2JxQRPzN3T4AGGVWCMlVmVwM1gtgALJRmGIlWv5ppnGGkg==", "dev": true, "requires": { + "mdn-data": "~1.1.0", + "source-map": "^0.5.3" + } + }, + "csso": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/csso/-/csso-3.5.1.tgz", + "integrity": "sha512-vrqULLffYU1Q2tLdJvaCYbONStnfkfimRxXNaGjxMldI0C7JPBC4rB1RyjhfdZ4m1frm8pM9uRPKH3d2knZ8gg==", + "dev": true, + "requires": { + "css-tree": "1.0.0-alpha.29" + } + }, + "csso-cli": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/csso-cli/-/csso-cli-2.0.2.tgz", + "integrity": "sha512-/lyDbuXiCYUu6BKAdaX9fQiQXL7Mbhw7lI9G5ZR0A/olgcDzcabUVyOJOvLwXEIstaPMvvMyxbrOJIdGlNyZDA==", + "dev": true, + "requires": { + "chokidar": "^1.6.1", "clap": "^1.0.9", + "csso": "^3.2.0", "source-map": "^0.5.3" } }, @@ -3059,6 +3054,18 @@ "is-data-descriptor": "^1.0.0", "kind-of": "^6.0.2" } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true } } }, @@ -3231,9 +3238,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.290", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.290.tgz", - "integrity": "sha512-pkKffog2KZ5PPcC8ITNXDpucznLFVVLUS2Us0tBF0Qy9114vzDpgWntvFNE1uYEmMUIrWGFu4rDMHwgQAbNYyQ==", + "version": "1.3.292", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.292.tgz", + "integrity": "sha512-hqkem5ANpt6mxVXmhAmlbdG8iicuyM/jEYgmP1tiHPeOLyZoTyGUzrDmJS/xyrrZy9frkW1uQcubicu7f6DS5g==", "dev": true }, "elegant-spinner": { @@ -3451,6 +3458,15 @@ "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, + "glob-parent": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", + "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, "import-fresh": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz", @@ -3461,6 +3477,21 @@ "resolve-from": "^4.0.0" } }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, "resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -3848,53 +3879,21 @@ "dev": true }, "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", "dev": true, "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } + "is-posix-bracket": "^0.1.0" + } + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true, + "requires": { + "fill-range": "^2.1.0" } }, "expand-template": { @@ -4012,68 +4011,12 @@ } }, "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", "dev": true, "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - } + "is-extglob": "^1.0.0" } }, "extract-zip": { @@ -4146,6 +4089,207 @@ "micromatch": "^3.1.10" }, "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, "glob-parent": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", @@ -4166,6 +4310,115 @@ } } } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true } } }, @@ -4215,27 +4468,23 @@ "flat-cache": "^2.0.1" } }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true + }, "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", + "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", "dev": true, "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^3.0.0", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" } }, "finalhandler": { @@ -4300,6 +4549,318 @@ "is-glob": "^4.0.0", "micromatch": "^3.0.4", "resolve-dir": "^1.0.1" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } } }, "flat": { @@ -4370,6 +4931,15 @@ "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", "dev": true }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true, + "requires": { + "for-in": "^1.0.1" + } + }, "foreground-child": { "version": "1.5.6", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-1.5.6.tgz", @@ -5154,13 +5724,23 @@ "path-is-absolute": "^1.0.0" } }, - "glob-parent": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", - "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", "dev": true, "requires": { - "is-glob": "^4.0.1" + "glob-parent": "^2.0.0", + "is-glob": "^2.0.0" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "^2.0.0" } }, "glob-to-regexp": { @@ -5197,6 +5777,12 @@ "kind-of": "^6.0.2", "which": "^1.3.1" } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true } } }, @@ -5384,6 +5970,14 @@ "get-value": "^2.0.6", "has-values": "^1.0.0", "isobject": "^3.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } } }, "has-values": { @@ -5402,6 +5996,26 @@ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", "dev": true }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, "kind-of": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", @@ -5955,23 +6569,6 @@ "dev": true, "requires": { "kind-of": "^3.0.2" - }, - "dependencies": { - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } } }, "is-arrayish": { @@ -6017,23 +6614,6 @@ "dev": true, "requires": { "kind-of": "^3.0.2" - }, - "dependencies": { - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } } }, "is-date-object": { @@ -6067,6 +6647,21 @@ "integrity": "sha1-YTObbyR1/Hcv2cnYP1yFddwVSuE=", "dev": true }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true, + "requires": { + "is-primitive": "^2.0.0" + } + }, "is-extendable": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", @@ -6074,9 +6669,9 @@ "dev": true }, "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", "dev": true }, "is-finite": { @@ -6098,12 +6693,12 @@ } }, "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, "requires": { - "is-extglob": "^2.1.1" + "is-extglob": "^1.0.0" } }, "is-installed-globally": { @@ -6123,29 +6718,12 @@ "dev": true }, "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", "dev": true, "requires": { "kind-of": "^3.0.2" - }, - "dependencies": { - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } } }, "is-obj": { @@ -6170,8 +6748,28 @@ "dev": true, "requires": { "isobject": "^3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } } }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true + }, "is-promise": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", @@ -6251,10 +6849,13 @@ "dev": true }, "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } }, "isstream": { "version": "0.1.2", @@ -6505,10 +7106,21 @@ "dev": true }, "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + }, + "dependencies": { + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + } + } }, "latest-version": { "version": "3.1.0", @@ -6960,6 +7572,12 @@ "object-visit": "^1.0.0" } }, + "math-random": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", + "integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==", + "dev": true + }, "md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -6971,6 +7589,12 @@ "safe-buffer": "^5.1.2" } }, + "mdn-data": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-1.1.4.tgz", + "integrity": "sha512-FSYbp3lyKjyj3E7fMl6rYvUdX0FBXaluGqlFoYESWQlyUTq8R+wp0rkFxoYFqZlHCvsUXGjyJmLQSnXToYhOSA==", + "dev": true + }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -7156,24 +7780,24 @@ "dev": true }, "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", "dev": true, "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" } }, "miller-rabin": { @@ -7428,6 +8052,26 @@ "regex-not": "^1.0.0", "snapdragon": "^0.8.1", "to-regex": "^3.0.1" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } } }, "napi-build-utils": { @@ -7595,9 +8239,9 @@ "dev": true }, "node-releases": { - "version": "1.1.36", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.36.tgz", - "integrity": "sha512-ggXhX6QGyJSjj3r+6ml2LqqC28XOWmKtpb+a15/Zpr9V3yoNazxJNlcQDS9bYaid5FReEWHEgToH1mwoUceWwg==", + "version": "1.1.37", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.37.tgz", + "integrity": "sha512-0EOsAEdn6S2vQdDGBWBpmClm5BCkXVkVOURdnhfg7//rxI2XbleRdKig87WuBrk+0PHZ4OhO58fRm9mzWW4jNw==", "dev": true, "requires": { "semver": "^6.3.0" @@ -7697,6 +8341,88 @@ "update-notifier": "^2.5.0" }, "dependencies": { + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + } + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "chokidar": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", + "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "fsevents": "^1.2.7", + "glob-parent": "^3.1.0", + "inherits": "^2.0.3", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^3.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.2.1", + "upath": "^1.1.1" + } + }, "debug": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", @@ -7704,7 +8430,311 @@ "dev": true, "requires": { "ms": "^2.1.1" + }, + "dependencies": { + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true } } }, @@ -7736,10 +8766,13 @@ } }, "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } }, "normalize-range": { "version": "0.1.2", @@ -7915,21 +8948,6 @@ "requires": { "is-descriptor": "^0.1.0" } - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } } } }, @@ -7958,6 +8976,14 @@ "dev": true, "requires": { "isobject": "^3.0.0" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } } }, "object.assign": { @@ -7994,6 +9020,16 @@ "es-abstract": "^1.5.1" } }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true, + "requires": { + "for-own": "^0.1.4", + "is-extendable": "^0.1.1" + } + }, "object.pick": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", @@ -8001,6 +9037,14 @@ "dev": true, "requires": { "isobject": "^3.0.1" + }, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } } }, "object.values": { @@ -8288,6 +9332,18 @@ "safe-buffer": "^5.1.1" } }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true, + "requires": { + "glob-base": "^0.3.0", + "is-dotfile": "^1.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.0" + } + }, "parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", @@ -8538,6 +9594,88 @@ "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + } + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "chokidar": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", + "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "fsevents": "^1.2.7", + "glob-parent": "^3.1.0", + "inherits": "^2.0.3", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^3.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.2.1", + "upath": "^1.1.1" + } + }, "cliui": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", @@ -8549,6 +9687,15 @@ "wrap-ansi": "^2.0.0" } }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, "execa": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", @@ -8564,6 +9711,157 @@ "strip-eof": "^1.0.0" } }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, "fs-extra": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", @@ -8571,6 +9869,7 @@ "dev": true, "requires": { "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", "universalify": "^0.1.0" } }, @@ -8589,18 +9888,115 @@ "pump": "^3.0.0" } }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, "invert-kv": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-2.0.0.tgz", "integrity": "sha512-wPVv/y/QQ/Uiirj/vh3oP+1Ww+AWehmi1g5fFWGPF6IpCBCDVrhgHRMvrLfdYcwDh3QJbGXDW4JAuzxElLSqKA==", "dev": true }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, "is-fullwidth-code-point": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "dev": true }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, "jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -8610,6 +10006,12 @@ "graceful-fs": "^4.1.6" } }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, "lcid": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-2.0.0.tgz", @@ -8619,6 +10021,39 @@ "invert-kv": "^2.0.0" } }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, "os-locale": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-3.1.0.tgz", @@ -8797,6 +10232,12 @@ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", "dev": true }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true + }, "prettier": { "version": "1.18.2", "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz", @@ -8996,6 +10437,31 @@ "integrity": "sha1-w7d1UZfzW43DUCIoJixMkd22uFc=", "dev": true }, + "randomatic": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", + "integrity": "sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==", + "dev": true, + "requires": { + "is-number": "^4.0.0", + "kind-of": "^6.0.0", + "math-random": "^1.0.1" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + } + } + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -9152,6 +10618,303 @@ "graceful-fs": "^4.1.11", "micromatch": "^3.1.10", "readable-stream": "^2.0.2" + }, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } } }, "redent": { @@ -9197,6 +10960,15 @@ "private": "^0.1.6" } }, + "regex-cache": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "dev": true, + "requires": { + "is-equal-shallow": "^0.1.3" + } + }, "regex-not": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", @@ -10054,6 +11826,18 @@ "is-data-descriptor": "^1.0.0", "kind-of": "^6.0.2" } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true } } }, @@ -10064,23 +11848,6 @@ "dev": true, "requires": { "kind-of": "^3.2.0" - }, - "dependencies": { - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } } }, "source-list-map": { @@ -10758,23 +12525,6 @@ "dev": true, "requires": { "kind-of": "^3.0.2" - }, - "dependencies": { - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } } }, "to-regex": { @@ -10797,6 +12547,17 @@ "requires": { "is-number": "^3.0.0", "repeat-string": "^1.6.1" + }, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + } } }, "toidentifier": { @@ -11093,6 +12854,12 @@ "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true } } }, @@ -11277,6 +13044,386 @@ "chokidar": "^2.0.2", "graceful-fs": "^4.1.2", "neo-async": "^2.5.0" + }, + "dependencies": { + "anymatch": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", + "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "dev": true, + "requires": { + "micromatch": "^3.1.4", + "normalize-path": "^2.1.1" + }, + "dependencies": { + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + } + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "chokidar": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.8.tgz", + "integrity": "sha512-ZmZUazfOzf0Nve7duiCKD23PFSCs4JPoYyccjUFF3aQkQadqBhfzhjkwBH2mNOG9cTBwhamM37EIsIkZw3nRgg==", + "dev": true, + "requires": { + "anymatch": "^2.0.0", + "async-each": "^1.0.1", + "braces": "^2.3.2", + "fsevents": "^1.2.7", + "glob-parent": "^3.1.0", + "inherits": "^2.0.3", + "is-binary-path": "^1.0.0", + "is-glob": "^4.0.0", + "normalize-path": "^3.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.2.1", + "upath": "^1.1.1" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + }, + "dependencies": { + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + } + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-glob": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", + "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + } } }, "webidl-conversions": { @@ -11322,6 +13469,56 @@ "integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==", "dev": true }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, "eslint-scope": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", @@ -11332,6 +13529,251 @@ "estraverse": "^4.1.1" } }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + } + }, + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, "schema-utils": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz", diff --git a/package.json b/package.json index 77dad26..0ae8961 100644 --- a/package.json +++ b/package.json @@ -6,25 +6,26 @@ "types": "./types/index.d.ts", "scripts": { "start": "run-p js:watch css:watch", - "build": "npm run js:build && npm run css:build", + "build": "run-p js:build css:build", "lint": "eslint src/scripts", "coverage": "nyc --reporter=lcov --reporter=text --reporter=text-summary mocha", "bundlesize": "bundlesize", "cypress:run": "$(npm bin)/cypress run", "cypress:open": "$(npm bin)/cypress open", - "test": "npm run test:unit && npm run test:e2e", + "cypress:ci": "cypress run --record --group --ci-build-id $GITHUB_SHA", + "test": "run-s test:unit test:e2e", "test:unit": "mocha", "test:unit:watch": "mocha --watch --inspect=5556", "test:e2e": "run-p --race start cypress:run", "js:watch": "NODE_ENV=development node server.js", "js:build": "webpack --config webpack.config.prod.js", "css:watch": "nodemon -e scss -x \"npm run css:build\"", - "css:build": "run-p css:sass css:prefix css:min", - "css:sass": "node-sass --output-style expanded --include-path scss src/styles/base.scss public/assets/styles/base.css && node-sass --output-style expanded --include-path scss src/styles/choices.scss public/assets/styles/choices.css", + "css:build": "run-s css:sass css:prefix css:min", + "css:sass": "node-sass --output-style expanded --include-path scss src/styles/base.scss public/assets/styles/base.css && node-sass --output-style expanded --include-path scss src/styles/choices.scss public/assets/styles/choices.css", "css:prefix": "postcss public/assets/styles/*.css --use autoprefixer --no-map --env prod --dir public/assets/styles", - "css:min": "csso public/assets/styles/base.css public/assets/styles/base.min.css && csso public/assets/styles/choices.css public/assets/styles/choices.min.css", + "css:min": "csso public/assets/styles/base.css --output public/assets/styles/base.min.css && csso public/assets/styles/choices.css --output public/assets/styles/choices.min.css", "deploy": "git subtree push --prefix public origin gh-pages", - "prepush": "run-p lint test:unit && npm run bundlesize", + "prepush": "run-s lint test:unit bundlesize", "preversion": "npm test", "postversion": "git push --no-verify --atomic", "prepublishOnly": "npm run build" @@ -62,7 +63,7 @@ "babel-loader": "^8.0.6", "bundlesize": "^0.18.0", "chai": "^4.2.0", - "csso": "^1.8.2", + "csso-cli": "2.0.2", "cypress": "3.2.0", "eslint": "^6.5.1", "eslint-config-airbnb-base": "^14.0.0", @@ -75,7 +76,7 @@ "husky": "^3.0.9", "jsdom": "^15.2.0", "mocha": "^6.2.2", - "node-sass": "^4.11.0", + "node-sass": "^4.12.0", "nodemon": "^1.18.10", "npm-run-all": "^4.1.5", "nyc": "^14.1.1", @@ -121,7 +122,7 @@ }, { "path": "public/assets/styles/choices.min.css", - "maxSize": "2 kB" + "maxSize": "1.8 kB" } ] } diff --git a/public/assets/scripts/choices.js b/public/assets/scripts/choices.js index 808b5cd..caa097d 100644 --- a/public/assets/scripts/choices.js +++ b/public/assets/scripts/choices.js @@ -1,14 +1,11 @@ +/*! choices.js v7.1.1 | © 2019 Josh Johnson | https://github.com/jshjohnson/Choices#readme */ (function webpackUniversalModuleDefinition(root, factory) { - //CommonJS2 if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); - //AMD else if(typeof define === 'function' && define.amd) define([], factory); - //CommonJS else if(typeof exports === 'object') exports["Choices"] = factory(); - //Window else root["Choices"] = factory(); })(window, function() { @@ -95,304 +92,66 @@ return /******/ (function(modules) { // webpackBootstrap /******/ /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 8); +/******/ return __webpack_require__(__webpack_require__.s = 5); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! + Copyright (c) 2017 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ +/* global define */ + +(function () { + 'use strict'; + + var hasOwn = {}.hasOwnProperty; + + function classNames () { + var classes = []; + + for (var i = 0; i < arguments.length; i++) { + var arg = arguments[i]; + if (!arg) continue; + + var argType = typeof arg; + + if (argType === 'string' || argType === 'number') { + classes.push(arg); + } else if (Array.isArray(arg) && arg.length) { + var inner = classNames.apply(null, arg); + if (inner) { + classes.push(inner); + } + } else if (argType === 'object') { + for (var key in arg) { + if (hasOwn.call(arg, key) && arg[key]) { + classes.push(key); + } + } + } + } + + return classes.join(' '); + } + + if ( true && module.exports) { + classNames.default = classNames; + module.exports = classNames; + } else if (true) { + // register as 'classnames', consistent with npm package name + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { + return classNames; + }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else {} +}()); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.diff = exports.cloneObject = exports.existsInArray = exports.isIE11 = exports.fetchFromObject = exports.getWindowHeight = exports.dispatchEvent = exports.sortByScore = exports.sortByAlpha = exports.calcWidthOfInput = exports.strToEl = exports.sanitise = exports.isScrolledIntoView = exports.getAdjacentEl = exports.findAncestorByAttrName = exports.wrap = exports.isElement = exports.isType = exports.getType = exports.generateId = exports.generateChars = exports.getRandomNumber = void 0; - -var _this = void 0; - -var getRandomNumber = function getRandomNumber(min, max) { - return Math.floor(Math.random() * (max - min) + min); -}; - -exports.getRandomNumber = getRandomNumber; - -var generateChars = function generateChars(length) { - var chars = ''; - - for (var i = 0; i < length; i++) { - var randomChar = getRandomNumber(0, 36); - chars += randomChar.toString(36); - } - - return chars; -}; - -exports.generateChars = generateChars; - -var generateId = function generateId(element, prefix) { - var id = element.id || element.name && "".concat(element.name, "-").concat(generateChars(2)) || generateChars(4); - id = id.replace(/(:|\.|\[|\]|,)/g, ''); - id = "".concat(prefix, "-").concat(id); - return id; -}; - -exports.generateId = generateId; - -var getType = function getType(obj) { - return Object.prototype.toString.call(obj).slice(8, -1); -}; - -exports.getType = getType; - -var isType = function isType(type, obj) { - return obj !== undefined && obj !== null && getType(obj) === type; -}; - -exports.isType = isType; - -var isElement = function isElement(element) { - return element instanceof Element; -}; - -exports.isElement = isElement; - -var wrap = function wrap(element) { - var wrapper = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document.createElement('div'); - - if (element.nextSibling) { - element.parentNode.insertBefore(wrapper, element.nextSibling); - } else { - element.parentNode.appendChild(wrapper); - } - - return wrapper.appendChild(element); -}; - -exports.wrap = wrap; - -var findAncestorByAttrName = function findAncestorByAttrName(el, attr) { - var target = el; - - while (target) { - if (target.hasAttribute(attr)) { - return target; - } - - target = target.parentElement; - } - - return null; -}; - -exports.findAncestorByAttrName = findAncestorByAttrName; - -var getAdjacentEl = function getAdjacentEl(startEl, className) { - var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - - if (!startEl || !className) { - return; - } - - var parent = startEl.parentNode.parentNode; - var children = Array.from(parent.querySelectorAll(className)); - var startPos = children.indexOf(startEl); - var operatorDirection = direction > 0 ? 1 : -1; - return children[startPos + operatorDirection]; -}; - -exports.getAdjacentEl = getAdjacentEl; - -var isScrolledIntoView = function isScrolledIntoView(el, parent) { - var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1; - - if (!el) { - return; - } - - var isVisible; - - if (direction > 0) { - // In view from bottom - isVisible = parent.scrollTop + parent.offsetHeight >= el.offsetTop + el.offsetHeight; - } else { - // In view from top - isVisible = el.offsetTop >= parent.scrollTop; - } - - return isVisible; -}; - -exports.isScrolledIntoView = isScrolledIntoView; - -var sanitise = function sanitise(value) { - if (!isType('String', value)) { - return value; - } - - return value.replace(/&/g, '&').replace(/>/g, '&rt;').replace(/".concat(sanitise(value), "")); - testEl.style.position = 'absolute'; - testEl.style.padding = '0'; - testEl.style.top = '-9999px'; - testEl.style.left = '-9999px'; - testEl.style.width = 'auto'; - testEl.style.whiteSpace = 'pre'; - - if (document.body.contains(input) && window.getComputedStyle) { - var inputStyle = window.getComputedStyle(input); - - if (inputStyle) { - testEl.style.fontSize = inputStyle.fontSize; - testEl.style.fontFamily = inputStyle.fontFamily; - testEl.style.fontWeight = inputStyle.fontWeight; - testEl.style.fontStyle = inputStyle.fontStyle; - testEl.style.letterSpacing = inputStyle.letterSpacing; - testEl.style.textTransform = inputStyle.textTransform; - testEl.style.paddingLeft = inputStyle.paddingLeft; - testEl.style.paddingRight = inputStyle.paddingRight; - } - } - - document.body.appendChild(testEl); - requestAnimationFrame(function () { - if (value && testEl.offsetWidth !== input.offsetWidth) { - width = testEl.offsetWidth + 4; - } - - document.body.removeChild(testEl); - callback.call(_this, "".concat(width, "px")); - }); - } else { - callback.call(_this, "".concat(width, "px")); - } -}; - -exports.calcWidthOfInput = calcWidthOfInput; - -var sortByAlpha = function sortByAlpha(a, b) { - var labelA = "".concat(a.label || a.value).toLowerCase(); - var labelB = "".concat(b.label || b.value).toLowerCase(); - - if (labelA < labelB) { - return -1; - } - - if (labelA > labelB) { - return 1; - } - - return 0; -}; - -exports.sortByAlpha = sortByAlpha; - -var sortByScore = function sortByScore(a, b) { - return a.score - b.score; -}; - -exports.sortByScore = sortByScore; - -var dispatchEvent = function dispatchEvent(element, type) { - var customArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; - var event = new CustomEvent(type, { - detail: customArgs, - bubbles: true, - cancelable: true - }); - return element.dispatchEvent(event); -}; - -exports.dispatchEvent = dispatchEvent; - -var getWindowHeight = function getWindowHeight() { - var _document = document, - body = _document.body; - var html = document.documentElement; - return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight); -}; - -exports.getWindowHeight = getWindowHeight; - -var fetchFromObject = function fetchFromObject(object, path) { - var index = path.indexOf('.'); - - if (index > -1) { - return fetchFromObject(object[path.substring(0, index)], path.substr(index + 1)); - } - - return object[path]; -}; - -exports.fetchFromObject = fetchFromObject; - -var isIE11 = function isIE11() { - return !!(navigator.userAgent.match(/Trident/) && navigator.userAgent.match(/rv[ :]11/)); -}; - -exports.isIE11 = isIE11; - -var existsInArray = function existsInArray(array, value) { - var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'value'; - return array.some(function (item) { - if (isType('String', value)) { - return item[key] === value.trim(); - } - - return item[key] === value; - }); -}; - -exports.existsInArray = existsInArray; - -var cloneObject = function cloneObject(obj) { - return JSON.parse(JSON.stringify(obj)); -}; - -exports.cloneObject = cloneObject; - -var diff = function diff(a, b) { - var aKeys = Object.keys(a).sort(); - var bKeys = Object.keys(b).sort(); - return aKeys.filter(function (i) { - return bKeys.indexOf(i) < 0; - }); -}; - -exports.diff = diff; - /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { @@ -400,140 +159,143 @@ exports.diff = diff; "use strict"; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.SCROLLING_SPEED = exports.KEY_CODES = exports.ACTION_TYPES = exports.EVENTS = exports.DEFAULT_CONFIG = exports.DEFAULT_CLASSNAMES = void 0; +var isMergeableObject = function isMergeableObject(value) { + return isNonNullObject(value) + && !isSpecial(value) +}; -var _utils = __webpack_require__(0); +function isNonNullObject(value) { + return !!value && typeof value === 'object' +} -var DEFAULT_CLASSNAMES = { - containerOuter: 'choices', - containerInner: 'choices__inner', - input: 'choices__input', - inputCloned: 'choices__input--cloned', - list: 'choices__list', - listItems: 'choices__list--multiple', - listSingle: 'choices__list--single', - listDropdown: 'choices__list--dropdown', - item: 'choices__item', - itemSelectable: 'choices__item--selectable', - itemDisabled: 'choices__item--disabled', - itemChoice: 'choices__item--choice', - placeholder: 'choices__placeholder', - group: 'choices__group', - groupHeading: 'choices__heading', - button: 'choices__button', - activeState: 'is-active', - focusState: 'is-focused', - openState: 'is-open', - disabledState: 'is-disabled', - highlightedState: 'is-highlighted', - hiddenState: 'is-hidden', - flippedState: 'is-flipped', - loadingState: 'is-loading', - noResults: 'has-no-results', - noChoices: 'has-no-choices' +function isSpecial(value) { + var stringValue = Object.prototype.toString.call(value); + + return stringValue === '[object RegExp]' + || stringValue === '[object Date]' + || isReactElement(value) +} + +// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 +var canUseSymbol = typeof Symbol === 'function' && Symbol.for; +var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; + +function isReactElement(value) { + return value.$$typeof === REACT_ELEMENT_TYPE +} + +function emptyTarget(val) { + return Array.isArray(val) ? [] : {} +} + +function cloneUnlessOtherwiseSpecified(value, options) { + return (options.clone !== false && options.isMergeableObject(value)) + ? deepmerge(emptyTarget(value), value, options) + : value +} + +function defaultArrayMerge(target, source, options) { + return target.concat(source).map(function(element) { + return cloneUnlessOtherwiseSpecified(element, options) + }) +} + +function getMergeFunction(key, options) { + if (!options.customMerge) { + return deepmerge + } + var customMerge = options.customMerge(key); + return typeof customMerge === 'function' ? customMerge : deepmerge +} + +function getEnumerableOwnPropertySymbols(target) { + return Object.getOwnPropertySymbols + ? Object.getOwnPropertySymbols(target).filter(function(symbol) { + return target.propertyIsEnumerable(symbol) + }) + : [] +} + +function getKeys(target) { + return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) +} + +// Protects from prototype poisoning and unexpected merging up the prototype chain. +function propertyIsUnsafe(target, key) { + try { + return (key in target) // Properties are safe to merge if they don't exist in the target yet, + && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, + && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. + } catch (unused) { + // Counterintuitively, it's safe to merge any property on a target that causes the `in` operator to throw. + // This happens when trying to copy an object in the source over a plain string in the target. + return false + } +} + +function mergeObject(target, source, options) { + var destination = {}; + if (options.isMergeableObject(target)) { + getKeys(target).forEach(function(key) { + destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); + }); + } + getKeys(source).forEach(function(key) { + if (propertyIsUnsafe(target, key)) { + return + } + + if (!options.isMergeableObject(source[key]) || !target[key]) { + destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); + } else { + destination[key] = getMergeFunction(key, options)(target[key], source[key], options); + } + }); + return destination +} + +function deepmerge(target, source, options) { + options = options || {}; + options.arrayMerge = options.arrayMerge || defaultArrayMerge; + options.isMergeableObject = options.isMergeableObject || isMergeableObject; + // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() + // implementations can use it. The caller may not replace it. + options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; + + var sourceIsArray = Array.isArray(source); + var targetIsArray = Array.isArray(target); + var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; + + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source, options) + } else if (sourceIsArray) { + return options.arrayMerge(target, source, options) + } else { + return mergeObject(target, source, options) + } +} + +deepmerge.all = function deepmergeAll(array, options) { + if (!Array.isArray(array)) { + throw new Error('first argument should be an array') + } + + return array.reduce(function(prev, next) { + return deepmerge(prev, next, options) + }, {}) }; -exports.DEFAULT_CLASSNAMES = DEFAULT_CLASSNAMES; -var DEFAULT_CONFIG = { - items: [], - choices: [], - silent: false, - renderChoiceLimit: -1, - maxItemCount: -1, - addItems: true, - addItemFilterFn: null, - removeItems: true, - removeItemButton: false, - editItems: false, - duplicateItemsAllowed: true, - delimiter: ',', - paste: true, - searchEnabled: true, - searchChoices: true, - searchFloor: 1, - searchResultLimit: 4, - searchFields: ['label', 'value'], - position: 'auto', - resetScrollPosition: true, - shouldSort: true, - shouldSortItems: false, - sortFn: _utils.sortByAlpha, - placeholder: true, - placeholderValue: null, - searchPlaceholderValue: null, - prependValue: null, - appendValue: null, - renderSelectedChoices: 'auto', - loadingText: 'Loading...', - noResultsText: 'No results found', - noChoicesText: 'No choices to choose from', - itemSelectText: 'Press to select', - uniqueItemText: 'Only unique values can be added', - customAddItemText: 'Only values matching specific conditions can be added', - addItemText: function addItemText(value) { - return "Press Enter to add \"".concat((0, _utils.sanitise)(value), "\""); - }, - maxItemText: function maxItemText(maxItemCount) { - return "Only ".concat(maxItemCount, " values can be added"); - }, - itemComparer: function itemComparer(choice, item) { - return choice === item; - }, - fuseOptions: { - includeScore: true - }, - callbackOnInit: null, - callbackOnCreateTemplates: null, - classNames: DEFAULT_CLASSNAMES -}; -exports.DEFAULT_CONFIG = DEFAULT_CONFIG; -var EVENTS = { - showDropdown: 'showDropdown', - hideDropdown: 'hideDropdown', - change: 'change', - choice: 'choice', - search: 'search', - addItem: 'addItem', - removeItem: 'removeItem', - highlightItem: 'highlightItem', - highlightChoice: 'highlightChoice' -}; -exports.EVENTS = EVENTS; -var ACTION_TYPES = { - ADD_CHOICE: 'ADD_CHOICE', - FILTER_CHOICES: 'FILTER_CHOICES', - ACTIVATE_CHOICES: 'ACTIVATE_CHOICES', - CLEAR_CHOICES: 'CLEAR_CHOICES', - ADD_GROUP: 'ADD_GROUP', - ADD_ITEM: 'ADD_ITEM', - REMOVE_ITEM: 'REMOVE_ITEM', - HIGHLIGHT_ITEM: 'HIGHLIGHT_ITEM', - CLEAR_ALL: 'CLEAR_ALL' -}; -exports.ACTION_TYPES = ACTION_TYPES; -var KEY_CODES = { - BACK_KEY: 46, - DELETE_KEY: 8, - ENTER_KEY: 13, - A_KEY: 65, - ESC_KEY: 27, - UP_KEY: 38, - DOWN_KEY: 40, - PAGE_UP_KEY: 33, - PAGE_DOWN_KEY: 34 -}; -exports.KEY_CODES = KEY_CODES; -var SCROLLING_SPEED = 4; -exports.SCROLLING_SPEED = SCROLLING_SPEED; + +var deepmerge_1 = deepmerge; + +module.exports = deepmerge_1; + /***/ }), /* 2 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* WEBPACK VAR INJECTION */(function(global, module) {/* harmony import */ var _ponyfill_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6); +/* WEBPACK VAR INJECTION */(function(global, module) {/* harmony import */ var _ponyfill_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4); /* global window */ @@ -552,3187 +314,10 @@ if (typeof self !== 'undefined') { var result = Object(_ponyfill_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(root); /* harmony default export */ __webpack_exports__["a"] = (result); -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(3), __webpack_require__(14)(module))) +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(7), __webpack_require__(8)(module))) /***/ }), /* 3 */ -/***/ (function(module, exports) { - -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || new Function("return this")(); -} catch (e) { - // This works if the window reference is available - if (typeof window === "object") g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - - -/***/ }), -/* 4 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _utils = __webpack_require__(0); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var WrappedElement = -/*#__PURE__*/ -function () { - function WrappedElement(_ref) { - var element = _ref.element, - classNames = _ref.classNames; - - _classCallCheck(this, WrappedElement); - - Object.assign(this, { - element: element, - classNames: classNames - }); - - if (!(0, _utils.isElement)(element)) { - throw new TypeError('Invalid element passed'); - } - - this.isDisabled = false; - } - - _createClass(WrappedElement, [{ - key: "conceal", - value: function conceal() { - // Hide passed input - this.element.classList.add(this.classNames.input); - this.element.classList.add(this.classNames.hiddenState); // Remove element from tab index - - this.element.tabIndex = '-1'; // Backup original styles if any - - var origStyle = this.element.getAttribute('style'); - - if (origStyle) { - this.element.setAttribute('data-choice-orig-style', origStyle); - } - - this.element.setAttribute('aria-hidden', 'true'); - this.element.setAttribute('data-choice', 'active'); - } - }, { - key: "reveal", - value: function reveal() { - // Reinstate passed element - this.element.classList.remove(this.classNames.input); - this.element.classList.remove(this.classNames.hiddenState); - this.element.removeAttribute('tabindex'); // Recover original styles if any - - var origStyle = this.element.getAttribute('data-choice-orig-style'); - - if (origStyle) { - this.element.removeAttribute('data-choice-orig-style'); - this.element.setAttribute('style', origStyle); - } else { - this.element.removeAttribute('style'); - } - - this.element.removeAttribute('aria-hidden'); - this.element.removeAttribute('data-choice'); // Re-assign values - this is weird, I know - - this.element.value = this.element.value; - } - }, { - key: "enable", - value: function enable() { - this.element.removeAttribute('disabled'); - this.element.disabled = false; - this.isDisabled = false; - } - }, { - key: "disable", - value: function disable() { - this.element.setAttribute('disabled', ''); - this.element.disabled = true; - this.isDisabled = true; - } - }, { - key: "triggerEvent", - value: function triggerEvent(eventType, data) { - (0, _utils.dispatchEvent)(this.element, eventType, data); - } - }, { - key: "value", - get: function get() { - return this.element.value; - } - }]); - - return WrappedElement; -}(); - -exports.default = WrappedElement; - -/***/ }), -/* 5 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// EXTERNAL MODULE: ./node_modules/lodash-es/_freeGlobal.js -var _freeGlobal = __webpack_require__(7); - -// CONCATENATED MODULE: ./node_modules/lodash-es/_root.js - - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = _freeGlobal["a" /* default */] || freeSelf || Function('return this')(); - -/* harmony default export */ var _root = (root); - -// CONCATENATED MODULE: ./node_modules/lodash-es/_Symbol.js - - -/** Built-in value references. */ -var Symbol = _root.Symbol; - -/* harmony default export */ var _Symbol = (Symbol); - -// CONCATENATED MODULE: ./node_modules/lodash-es/_getRawTag.js - - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** Used to check objects for own properties. */ -var _getRawTag_hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var nativeObjectToString = objectProto.toString; - -/** Built-in value references. */ -var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined; - -/** - * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the raw `toStringTag`. - */ -function getRawTag(value) { - var isOwn = _getRawTag_hasOwnProperty.call(value, symToStringTag), - tag = value[symToStringTag]; - - try { - value[symToStringTag] = undefined; - var unmasked = true; - } catch (e) {} - - var result = nativeObjectToString.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag] = tag; - } else { - delete value[symToStringTag]; - } - } - return result; -} - -/* harmony default export */ var _getRawTag = (getRawTag); - -// CONCATENATED MODULE: ./node_modules/lodash-es/_objectToString.js -/** Used for built-in method references. */ -var _objectToString_objectProto = Object.prototype; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var _objectToString_nativeObjectToString = _objectToString_objectProto.toString; - -/** - * Converts `value` to a string using `Object.prototype.toString`. - * - * @private - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - */ -function objectToString(value) { - return _objectToString_nativeObjectToString.call(value); -} - -/* harmony default export */ var _objectToString = (objectToString); - -// CONCATENATED MODULE: ./node_modules/lodash-es/_baseGetTag.js - - - - -/** `Object#toString` result references. */ -var nullTag = '[object Null]', - undefinedTag = '[object Undefined]'; - -/** Built-in value references. */ -var _baseGetTag_symToStringTag = _Symbol ? _Symbol.toStringTag : undefined; - -/** - * The base implementation of `getTag` without fallbacks for buggy environments. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ -function baseGetTag(value) { - if (value == null) { - return value === undefined ? undefinedTag : nullTag; - } - return (_baseGetTag_symToStringTag && _baseGetTag_symToStringTag in Object(value)) - ? _getRawTag(value) - : _objectToString(value); -} - -/* harmony default export */ var _baseGetTag = (baseGetTag); - -// CONCATENATED MODULE: ./node_modules/lodash-es/_overArg.js -/** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ -function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; -} - -/* harmony default export */ var _overArg = (overArg); - -// CONCATENATED MODULE: ./node_modules/lodash-es/_getPrototype.js - - -/** Built-in value references. */ -var getPrototype = _overArg(Object.getPrototypeOf, Object); - -/* harmony default export */ var _getPrototype = (getPrototype); - -// CONCATENATED MODULE: ./node_modules/lodash-es/isObjectLike.js -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return value != null && typeof value == 'object'; -} - -/* harmony default export */ var lodash_es_isObjectLike = (isObjectLike); - -// CONCATENATED MODULE: ./node_modules/lodash-es/isPlainObject.js - - - - -/** `Object#toString` result references. */ -var objectTag = '[object Object]'; - -/** Used for built-in method references. */ -var funcProto = Function.prototype, - isPlainObject_objectProto = Object.prototype; - -/** Used to resolve the decompiled source of functions. */ -var funcToString = funcProto.toString; - -/** Used to check objects for own properties. */ -var isPlainObject_hasOwnProperty = isPlainObject_objectProto.hasOwnProperty; - -/** Used to infer the `Object` constructor. */ -var objectCtorString = funcToString.call(Object); - -/** - * Checks if `value` is a plain object, that is, an object created by the - * `Object` constructor or one with a `[[Prototype]]` of `null`. - * - * @static - * @memberOf _ - * @since 0.8.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - * @example - * - * function Foo() { - * this.a = 1; - * } - * - * _.isPlainObject(new Foo); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'x': 0, 'y': 0 }); - * // => true - * - * _.isPlainObject(Object.create(null)); - * // => true - */ -function isPlainObject(value) { - if (!lodash_es_isObjectLike(value) || _baseGetTag(value) != objectTag) { - return false; - } - var proto = _getPrototype(value); - if (proto === null) { - return true; - } - var Ctor = isPlainObject_hasOwnProperty.call(proto, 'constructor') && proto.constructor; - return typeof Ctor == 'function' && Ctor instanceof Ctor && - funcToString.call(Ctor) == objectCtorString; -} - -/* harmony default export */ var lodash_es_isPlainObject = (isPlainObject); - -// EXTERNAL MODULE: ./node_modules/symbol-observable/es/index.js -var es = __webpack_require__(2); - -// CONCATENATED MODULE: ./node_modules/redux/es/createStore.js - - - -/** - * These are private action types reserved by Redux. - * For any unknown actions, you must return the current state. - * If the current state is undefined, you must return the initial state. - * Do not reference these action types directly in your code. - */ -var ActionTypes = { - INIT: '@@redux/INIT' - - /** - * Creates a Redux store that holds the state tree. - * The only way to change the data in the store is to call `dispatch()` on it. - * - * There should only be a single store in your app. To specify how different - * parts of the state tree respond to actions, you may combine several reducers - * into a single reducer function by using `combineReducers`. - * - * @param {Function} reducer A function that returns the next state tree, given - * the current state tree and the action to handle. - * - * @param {any} [preloadedState] The initial state. You may optionally specify it - * to hydrate the state from the server in universal apps, or to restore a - * previously serialized user session. - * If you use `combineReducers` to produce the root reducer function, this must be - * an object with the same shape as `combineReducers` keys. - * - * @param {Function} [enhancer] The store enhancer. You may optionally specify it - * to enhance the store with third-party capabilities such as middleware, - * time travel, persistence, etc. The only store enhancer that ships with Redux - * is `applyMiddleware()`. - * - * @returns {Store} A Redux store that lets you read the state, dispatch actions - * and subscribe to changes. - */ -};function createStore_createStore(reducer, preloadedState, enhancer) { - var _ref2; - - if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') { - enhancer = preloadedState; - preloadedState = undefined; - } - - if (typeof enhancer !== 'undefined') { - if (typeof enhancer !== 'function') { - throw new Error('Expected the enhancer to be a function.'); - } - - return enhancer(createStore_createStore)(reducer, preloadedState); - } - - if (typeof reducer !== 'function') { - throw new Error('Expected the reducer to be a function.'); - } - - var currentReducer = reducer; - var currentState = preloadedState; - var currentListeners = []; - var nextListeners = currentListeners; - var isDispatching = false; - - function ensureCanMutateNextListeners() { - if (nextListeners === currentListeners) { - nextListeners = currentListeners.slice(); - } - } - - /** - * Reads the state tree managed by the store. - * - * @returns {any} The current state tree of your application. - */ - function getState() { - return currentState; - } - - /** - * Adds a change listener. It will be called any time an action is dispatched, - * and some part of the state tree may potentially have changed. You may then - * call `getState()` to read the current state tree inside the callback. - * - * You may call `dispatch()` from a change listener, with the following - * caveats: - * - * 1. The subscriptions are snapshotted just before every `dispatch()` call. - * If you subscribe or unsubscribe while the listeners are being invoked, this - * will not have any effect on the `dispatch()` that is currently in progress. - * However, the next `dispatch()` call, whether nested or not, will use a more - * recent snapshot of the subscription list. - * - * 2. The listener should not expect to see all state changes, as the state - * might have been updated multiple times during a nested `dispatch()` before - * the listener is called. It is, however, guaranteed that all subscribers - * registered before the `dispatch()` started will be called with the latest - * state by the time it exits. - * - * @param {Function} listener A callback to be invoked on every dispatch. - * @returns {Function} A function to remove this change listener. - */ - function subscribe(listener) { - if (typeof listener !== 'function') { - throw new Error('Expected listener to be a function.'); - } - - var isSubscribed = true; - - ensureCanMutateNextListeners(); - nextListeners.push(listener); - - return function unsubscribe() { - if (!isSubscribed) { - return; - } - - isSubscribed = false; - - ensureCanMutateNextListeners(); - var index = nextListeners.indexOf(listener); - nextListeners.splice(index, 1); - }; - } - - /** - * Dispatches an action. It is the only way to trigger a state change. - * - * The `reducer` function, used to create the store, will be called with the - * current state tree and the given `action`. Its return value will - * be considered the **next** state of the tree, and the change listeners - * will be notified. - * - * The base implementation only supports plain object actions. If you want to - * dispatch a Promise, an Observable, a thunk, or something else, you need to - * wrap your store creating function into the corresponding middleware. For - * example, see the documentation for the `redux-thunk` package. Even the - * middleware will eventually dispatch plain object actions using this method. - * - * @param {Object} action A plain object representing “what changed”. It is - * a good idea to keep actions serializable so you can record and replay user - * sessions, or use the time travelling `redux-devtools`. An action must have - * a `type` property which may not be `undefined`. It is a good idea to use - * string constants for action types. - * - * @returns {Object} For convenience, the same action object you dispatched. - * - * Note that, if you use a custom middleware, it may wrap `dispatch()` to - * return something else (for example, a Promise you can await). - */ - function dispatch(action) { - if (!lodash_es_isPlainObject(action)) { - throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.'); - } - - if (typeof action.type === 'undefined') { - throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?'); - } - - if (isDispatching) { - throw new Error('Reducers may not dispatch actions.'); - } - - try { - isDispatching = true; - currentState = currentReducer(currentState, action); - } finally { - isDispatching = false; - } - - var listeners = currentListeners = nextListeners; - for (var i = 0; i < listeners.length; i++) { - var listener = listeners[i]; - listener(); - } - - return action; - } - - /** - * Replaces the reducer currently used by the store to calculate the state. - * - * You might need this if your app implements code splitting and you want to - * load some of the reducers dynamically. You might also need this if you - * implement a hot reloading mechanism for Redux. - * - * @param {Function} nextReducer The reducer for the store to use instead. - * @returns {void} - */ - function replaceReducer(nextReducer) { - if (typeof nextReducer !== 'function') { - throw new Error('Expected the nextReducer to be a function.'); - } - - currentReducer = nextReducer; - dispatch({ type: ActionTypes.INIT }); - } - - /** - * Interoperability point for observable/reactive libraries. - * @returns {observable} A minimal observable of state changes. - * For more information, see the observable proposal: - * https://github.com/tc39/proposal-observable - */ - function observable() { - var _ref; - - var outerSubscribe = subscribe; - return _ref = { - /** - * The minimal observable subscription method. - * @param {Object} observer Any object that can be used as an observer. - * The observer object should have a `next` method. - * @returns {subscription} An object with an `unsubscribe` method that can - * be used to unsubscribe the observable from the store, and prevent further - * emission of values from the observable. - */ - subscribe: function subscribe(observer) { - if (typeof observer !== 'object') { - throw new TypeError('Expected the observer to be an object.'); - } - - function observeState() { - if (observer.next) { - observer.next(getState()); - } - } - - observeState(); - var unsubscribe = outerSubscribe(observeState); - return { unsubscribe: unsubscribe }; - } - }, _ref[es["a" /* default */]] = function () { - return this; - }, _ref; - } - - // When a store is created, an "INIT" action is dispatched so that every - // reducer returns their initial state. This effectively populates - // the initial state tree. - dispatch({ type: ActionTypes.INIT }); - - return _ref2 = { - dispatch: dispatch, - subscribe: subscribe, - getState: getState, - replaceReducer: replaceReducer - }, _ref2[es["a" /* default */]] = observable, _ref2; -} -// CONCATENATED MODULE: ./node_modules/redux/es/utils/warning.js -/** - * Prints a warning in the console if it exists. - * - * @param {String} message The warning message. - * @returns {void} - */ -function warning(message) { - /* eslint-disable no-console */ - if (typeof console !== 'undefined' && typeof console.error === 'function') { - console.error(message); - } - /* eslint-enable no-console */ - try { - // This error was thrown as a convenience so that if you enable - // "break on all exceptions" in your console, - // it would pause the execution at this line. - throw new Error(message); - /* eslint-disable no-empty */ - } catch (e) {} - /* eslint-enable no-empty */ -} -// CONCATENATED MODULE: ./node_modules/redux/es/combineReducers.js - - - - -function getUndefinedStateErrorMessage(key, action) { - var actionType = action && action.type; - var actionName = actionType && '"' + actionType.toString() + '"' || 'an action'; - - return 'Given action ' + actionName + ', reducer "' + key + '" returned undefined. ' + 'To ignore an action, you must explicitly return the previous state. ' + 'If you want this reducer to hold no value, you can return null instead of undefined.'; -} - -function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) { - var reducerKeys = Object.keys(reducers); - var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer'; - - if (reducerKeys.length === 0) { - return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.'; - } - - if (!lodash_es_isPlainObject(inputState)) { - return 'The ' + argumentName + ' has unexpected type of "' + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + '". Expected argument to be an object with the following ' + ('keys: "' + reducerKeys.join('", "') + '"'); - } - - var unexpectedKeys = Object.keys(inputState).filter(function (key) { - return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]; - }); - - unexpectedKeys.forEach(function (key) { - unexpectedKeyCache[key] = true; - }); - - if (unexpectedKeys.length > 0) { - return 'Unexpected ' + (unexpectedKeys.length > 1 ? 'keys' : 'key') + ' ' + ('"' + unexpectedKeys.join('", "') + '" found in ' + argumentName + '. ') + 'Expected to find one of the known reducer keys instead: ' + ('"' + reducerKeys.join('", "') + '". Unexpected keys will be ignored.'); - } -} - -function assertReducerShape(reducers) { - Object.keys(reducers).forEach(function (key) { - var reducer = reducers[key]; - var initialState = reducer(undefined, { type: ActionTypes.INIT }); - - if (typeof initialState === 'undefined') { - throw new Error('Reducer "' + key + '" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined. If you don\'t want to set a value for this reducer, ' + 'you can use null instead of undefined.'); - } - - var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.'); - if (typeof reducer(undefined, { type: type }) === 'undefined') { - throw new Error('Reducer "' + key + '" returned undefined when probed with a random type. ' + ('Don\'t try to handle ' + ActionTypes.INIT + ' or other actions in "redux/*" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined, but can be null.'); - } - }); -} - -/** - * Turns an object whose values are different reducer functions, into a single - * reducer function. It will call every child reducer, and gather their results - * into a single state object, whose keys correspond to the keys of the passed - * reducer functions. - * - * @param {Object} reducers An object whose values correspond to different - * reducer functions that need to be combined into one. One handy way to obtain - * it is to use ES6 `import * as reducers` syntax. The reducers may never return - * undefined for any action. Instead, they should return their initial state - * if the state passed to them was undefined, and the current state for any - * unrecognized action. - * - * @returns {Function} A reducer function that invokes every reducer inside the - * passed object, and builds a state object with the same shape. - */ -function combineReducers(reducers) { - var reducerKeys = Object.keys(reducers); - var finalReducers = {}; - for (var i = 0; i < reducerKeys.length; i++) { - var key = reducerKeys[i]; - - if (false) {} - - if (typeof reducers[key] === 'function') { - finalReducers[key] = reducers[key]; - } - } - var finalReducerKeys = Object.keys(finalReducers); - - var unexpectedKeyCache = void 0; - if (false) {} - - var shapeAssertionError = void 0; - try { - assertReducerShape(finalReducers); - } catch (e) { - shapeAssertionError = e; - } - - return function combination() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - var action = arguments[1]; - - if (shapeAssertionError) { - throw shapeAssertionError; - } - - if (false) { var warningMessage; } - - var hasChanged = false; - var nextState = {}; - for (var _i = 0; _i < finalReducerKeys.length; _i++) { - var _key = finalReducerKeys[_i]; - var reducer = finalReducers[_key]; - var previousStateForKey = state[_key]; - var nextStateForKey = reducer(previousStateForKey, action); - if (typeof nextStateForKey === 'undefined') { - var errorMessage = getUndefinedStateErrorMessage(_key, action); - throw new Error(errorMessage); - } - nextState[_key] = nextStateForKey; - hasChanged = hasChanged || nextStateForKey !== previousStateForKey; - } - return hasChanged ? nextState : state; - }; -} -// CONCATENATED MODULE: ./node_modules/redux/es/bindActionCreators.js -function bindActionCreator(actionCreator, dispatch) { - return function () { - return dispatch(actionCreator.apply(undefined, arguments)); - }; -} - -/** - * Turns an object whose values are action creators, into an object with the - * same keys, but with every function wrapped into a `dispatch` call so they - * may be invoked directly. This is just a convenience method, as you can call - * `store.dispatch(MyActionCreators.doSomething())` yourself just fine. - * - * For convenience, you can also pass a single function as the first argument, - * and get a function in return. - * - * @param {Function|Object} actionCreators An object whose values are action - * creator functions. One handy way to obtain it is to use ES6 `import * as` - * syntax. You may also pass a single function. - * - * @param {Function} dispatch The `dispatch` function available on your Redux - * store. - * - * @returns {Function|Object} The object mimicking the original object, but with - * every action creator wrapped into the `dispatch` call. If you passed a - * function as `actionCreators`, the return value will also be a single - * function. - */ -function bindActionCreators(actionCreators, dispatch) { - if (typeof actionCreators === 'function') { - return bindActionCreator(actionCreators, dispatch); - } - - if (typeof actionCreators !== 'object' || actionCreators === null) { - throw new Error('bindActionCreators expected an object or a function, instead received ' + (actionCreators === null ? 'null' : typeof actionCreators) + '. ' + 'Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?'); - } - - var keys = Object.keys(actionCreators); - var boundActionCreators = {}; - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var actionCreator = actionCreators[key]; - if (typeof actionCreator === 'function') { - boundActionCreators[key] = bindActionCreator(actionCreator, dispatch); - } - } - return boundActionCreators; -} -// CONCATENATED MODULE: ./node_modules/redux/es/compose.js -/** - * Composes single-argument functions from right to left. The rightmost - * function can take multiple arguments as it provides the signature for - * the resulting composite function. - * - * @param {...Function} funcs The functions to compose. - * @returns {Function} A function obtained by composing the argument functions - * from right to left. For example, compose(f, g, h) is identical to doing - * (...args) => f(g(h(...args))). - */ - -function compose() { - for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) { - funcs[_key] = arguments[_key]; - } - - if (funcs.length === 0) { - return function (arg) { - return arg; - }; - } - - if (funcs.length === 1) { - return funcs[0]; - } - - return funcs.reduce(function (a, b) { - return function () { - return a(b.apply(undefined, arguments)); - }; - }); -} -// CONCATENATED MODULE: ./node_modules/redux/es/applyMiddleware.js -var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - - - -/** - * Creates a store enhancer that applies middleware to the dispatch method - * of the Redux store. This is handy for a variety of tasks, such as expressing - * asynchronous actions in a concise manner, or logging every action payload. - * - * See `redux-thunk` package as an example of the Redux middleware. - * - * Because middleware is potentially asynchronous, this should be the first - * store enhancer in the composition chain. - * - * Note that each middleware will be given the `dispatch` and `getState` functions - * as named arguments. - * - * @param {...Function} middlewares The middleware chain to be applied. - * @returns {Function} A store enhancer applying the middleware. - */ -function applyMiddleware() { - for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) { - middlewares[_key] = arguments[_key]; - } - - return function (createStore) { - return function (reducer, preloadedState, enhancer) { - var store = createStore(reducer, preloadedState, enhancer); - var _dispatch = store.dispatch; - var chain = []; - - var middlewareAPI = { - getState: store.getState, - dispatch: function dispatch(action) { - return _dispatch(action); - } - }; - chain = middlewares.map(function (middleware) { - return middleware(middlewareAPI); - }); - _dispatch = compose.apply(undefined, chain)(store.dispatch); - - return _extends({}, store, { - dispatch: _dispatch - }); - }; - }; -} -// CONCATENATED MODULE: ./node_modules/redux/es/index.js -/* concated harmony reexport createStore */__webpack_require__.d(__webpack_exports__, "createStore", function() { return createStore_createStore; }); -/* concated harmony reexport combineReducers */__webpack_require__.d(__webpack_exports__, "combineReducers", function() { return combineReducers; }); -/* concated harmony reexport bindActionCreators */__webpack_require__.d(__webpack_exports__, "bindActionCreators", function() { return bindActionCreators; }); -/* concated harmony reexport applyMiddleware */__webpack_require__.d(__webpack_exports__, "applyMiddleware", function() { return applyMiddleware; }); -/* concated harmony reexport compose */__webpack_require__.d(__webpack_exports__, "compose", function() { return compose; }); - - - - - - - -/* -* This is a dummy function to check if the function name has been altered by minification. -* If the function has been minified and NODE_ENV !== 'production', warn the user. -*/ -function isCrushed() {} - -if (false) {} - - - -/***/ }), -/* 6 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return symbolObservablePonyfill; }); -function symbolObservablePonyfill(root) { - var result; - var Symbol = root.Symbol; - - if (typeof Symbol === 'function') { - if (Symbol.observable) { - result = Symbol.observable; - } else { - result = Symbol('observable'); - Symbol.observable = result; - } - } else { - result = '@@observable'; - } - - return result; -}; - - -/***/ }), -/* 7 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - -/* harmony default export */ __webpack_exports__["a"] = (freeGlobal); - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(3))) - -/***/ }), -/* 8 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(9); - - -/***/ }), -/* 9 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var _fuse = _interopRequireDefault(__webpack_require__(10)); - -var _deepmerge = _interopRequireDefault(__webpack_require__(11)); - -__webpack_require__(12); - -var _store = _interopRequireDefault(__webpack_require__(13)); - -var _components = __webpack_require__(20); - -var _constants = __webpack_require__(1); - -var _templates = __webpack_require__(27); - -var _choices = __webpack_require__(29); - -var _items = __webpack_require__(30); - -var _groups = __webpack_require__(31); - -var _misc = __webpack_require__(32); - -var _general = __webpack_require__(33); - -var _utils = __webpack_require__(0); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -/** - * Choices - * @author Josh Johnson - */ -var Choices = -/*#__PURE__*/ -function () { - function Choices() { - var _this = this; - - var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '[data-choice]'; - var userConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - _classCallCheck(this, Choices); - - if ((0, _utils.isType)('String', element)) { - var elements = Array.from(document.querySelectorAll(element)); // If there are multiple elements, create a new instance - // for each element besides the first one (as that already has an instance) - - if (elements.length > 1) { - return this._generateInstances(elements, userConfig); - } - } - - this.config = _deepmerge.default.all([_constants.DEFAULT_CONFIG, Choices.userDefaults, userConfig], // When merging array configs, replace with a copy of the userConfig array, - // instead of concatenating with the default array - { - arrayMerge: function arrayMerge(destinationArray, sourceArray) { - return [].concat(sourceArray); - } - }); - var invalidConfigOptions = (0, _utils.diff)(this.config, _constants.DEFAULT_CONFIG); - - if (invalidConfigOptions.length) { - console.warn('Unknown config option(s) passed', invalidConfigOptions.join(', ')); - } - - if (!['auto', 'always'].includes(this.config.renderSelectedChoices)) { - this.config.renderSelectedChoices = 'auto'; - } // Retrieve triggering element (i.e. element with 'data-choice' trigger) - - - var passedElement = (0, _utils.isType)('String', element) ? document.querySelector(element) : element; - - if (!passedElement) { - return console.error('Could not find passed element or passed element was of an invalid type'); - } - - this._isTextElement = passedElement.type === 'text'; - this._isSelectOneElement = passedElement.type === 'select-one'; - this._isSelectMultipleElement = passedElement.type === 'select-multiple'; - this._isSelectElement = this._isSelectOneElement || this._isSelectMultipleElement; - - if (this._isTextElement) { - this.passedElement = new _components.WrappedInput({ - element: passedElement, - classNames: this.config.classNames, - delimiter: this.config.delimiter - }); - } else if (this._isSelectElement) { - this.passedElement = new _components.WrappedSelect({ - element: passedElement, - classNames: this.config.classNames, - template: function template(data) { - return _this.config.templates.option(data); - } - }); - } - - if (!this.passedElement) { - return console.error('Passed element was of an invalid type'); - } - - if (this.config.shouldSortItems === true && this._isSelectOneElement && !this.config.silent) { - console.warn("shouldSortElements: Type of passed element is 'select-one', falling back to false."); - } - - this.initialised = false; - this._store = new _store.default(this.render); - this._initialState = {}; - this._currentState = {}; - this._prevState = {}; - this._currentValue = ''; - this._canSearch = this.config.searchEnabled; - this._isScrollingOnIe = false; - this._highlightPosition = 0; - this._wasTap = true; - this._placeholderValue = this._generatePlaceholderValue(); - this._baseId = (0, _utils.generateId)(this.passedElement.element, 'choices-'); - this._direction = this.passedElement.element.getAttribute('dir') || 'ltr'; - this._idNames = { - itemChoice: 'item-choice' - }; // Assign preset choices from passed object - - this._presetChoices = this.config.choices; // Assign preset items from passed object first - - this._presetItems = this.config.items; // Then add any values passed from attribute - - if (this.passedElement.value) { - this._presetItems = this._presetItems.concat(this.passedElement.value.split(this.config.delimiter)); - } - - this._render = this._render.bind(this); - this._onFocus = this._onFocus.bind(this); - this._onBlur = this._onBlur.bind(this); - this._onKeyUp = this._onKeyUp.bind(this); - this._onKeyDown = this._onKeyDown.bind(this); - this._onClick = this._onClick.bind(this); - this._onTouchMove = this._onTouchMove.bind(this); - this._onTouchEnd = this._onTouchEnd.bind(this); - this._onMouseDown = this._onMouseDown.bind(this); - this._onMouseOver = this._onMouseOver.bind(this); - this._onFormReset = this._onFormReset.bind(this); - this._onAKey = this._onAKey.bind(this); - this._onEnterKey = this._onEnterKey.bind(this); - this._onEscapeKey = this._onEscapeKey.bind(this); - this._onDirectionKey = this._onDirectionKey.bind(this); - this._onDeleteKey = this._onDeleteKey.bind(this); // If element has already been initialised with Choices, fail silently - - if (this.passedElement.element.getAttribute('data-choice') === 'active') { - console.warn('Trying to initialise Choices on element already initialised'); - } // Let's go - - - this.init(); - } - /* ======================================== - = Public functions = - ======================================== */ - - - _createClass(Choices, [{ - key: "init", - value: function init() { - if (this.initialised) { - return; - } - - this._createTemplates(); - - this._createElements(); - - this._createStructure(); // Set initial state (We need to clone the state because some reducers - // modify the inner objects properties in the state) 🤢 - - - this._initialState = (0, _utils.cloneObject)(this._store.state); - - this._store.subscribe(this._render); - - this._render(); - - this._addEventListeners(); - - var shouldDisable = !this.config.addItems || this.passedElement.element.hasAttribute('disabled'); - - if (shouldDisable) { - this.disable(); - } - - this.initialised = true; - var callbackOnInit = this.config.callbackOnInit; // Run callback if it is a function - - if (callbackOnInit && (0, _utils.isType)('Function', callbackOnInit)) { - callbackOnInit.call(this); - } - } - }, { - key: "destroy", - value: function destroy() { - if (!this.initialised) { - return; - } - - this._removeEventListeners(); - - this.passedElement.reveal(); - this.containerOuter.unwrap(this.passedElement.element); - - if (this._isSelectElement) { - this.passedElement.options = this._presetChoices; - } - - this.clearStore(); - this.config.templates = null; - this.initialised = false; - } - }, { - key: "enable", - value: function enable() { - if (this.passedElement.isDisabled) { - this.passedElement.enable(); - } - - if (this.containerOuter.isDisabled) { - this._addEventListeners(); - - this.input.enable(); - this.containerOuter.enable(); - } - - return this; - } - }, { - key: "disable", - value: function disable() { - if (!this.passedElement.isDisabled) { - this.passedElement.disable(); - } - - if (!this.containerOuter.isDisabled) { - this._removeEventListeners(); - - this.input.disable(); - this.containerOuter.disable(); - } - - return this; - } - }, { - key: "highlightItem", - value: function highlightItem(item) { - var runEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - - if (!item) { - return this; - } - - var id = item.id, - _item$groupId = item.groupId, - groupId = _item$groupId === void 0 ? -1 : _item$groupId, - _item$value = item.value, - value = _item$value === void 0 ? '' : _item$value, - _item$label = item.label, - label = _item$label === void 0 ? '' : _item$label; - var group = groupId >= 0 ? this._store.getGroupById(groupId) : null; - - this._store.dispatch((0, _items.highlightItem)(id, true)); - - if (runEvent) { - this.passedElement.triggerEvent(_constants.EVENTS.highlightItem, { - id: id, - value: value, - label: label, - groupValue: group && group.value ? group.value : null - }); - } - - return this; - } - }, { - key: "unhighlightItem", - value: function unhighlightItem(item) { - if (!item) { - return this; - } - - var id = item.id, - _item$groupId2 = item.groupId, - groupId = _item$groupId2 === void 0 ? -1 : _item$groupId2, - _item$value2 = item.value, - value = _item$value2 === void 0 ? '' : _item$value2, - _item$label2 = item.label, - label = _item$label2 === void 0 ? '' : _item$label2; - var group = groupId >= 0 ? this._store.getGroupById(groupId) : null; - - this._store.dispatch((0, _items.highlightItem)(id, false)); - - this.passedElement.triggerEvent(_constants.EVENTS.highlightItem, { - id: id, - value: value, - label: label, - groupValue: group && group.value ? group.value : null - }); - return this; - } - }, { - key: "highlightAll", - value: function highlightAll() { - var _this2 = this; - - this._store.items.forEach(function (item) { - return _this2.highlightItem(item); - }); - - return this; - } - }, { - key: "unhighlightAll", - value: function unhighlightAll() { - var _this3 = this; - - this._store.items.forEach(function (item) { - return _this3.unhighlightItem(item); - }); - - return this; - } - }, { - key: "removeActiveItemsByValue", - value: function removeActiveItemsByValue(value) { - var _this4 = this; - - this._store.activeItems.filter(function (item) { - return item.value === value; - }).forEach(function (item) { - return _this4._removeItem(item); - }); - - return this; - } - }, { - key: "removeActiveItems", - value: function removeActiveItems(excludedId) { - var _this5 = this; - - this._store.activeItems.filter(function (_ref) { - var id = _ref.id; - return id !== excludedId; - }).forEach(function (item) { - return _this5._removeItem(item); - }); - - return this; - } - }, { - key: "removeHighlightedItems", - value: function removeHighlightedItems() { - var _this6 = this; - - var runEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - - this._store.highlightedActiveItems.forEach(function (item) { - _this6._removeItem(item); // If this action was performed by the user - // trigger the event - - - if (runEvent) { - _this6._triggerChange(item.value); - } - }); - - return this; - } - }, { - key: "showDropdown", - value: function showDropdown(preventInputFocus) { - var _this7 = this; - - if (this.dropdown.isActive) { - return this; - } - - requestAnimationFrame(function () { - _this7.dropdown.show(); - - _this7.containerOuter.open(_this7.dropdown.distanceFromTopWindow()); - - if (!preventInputFocus && _this7._canSearch) { - _this7.input.focus(); - } - - _this7.passedElement.triggerEvent(_constants.EVENTS.showDropdown, {}); - }); - return this; - } - }, { - key: "hideDropdown", - value: function hideDropdown(preventInputBlur) { - var _this8 = this; - - if (!this.dropdown.isActive) { - return this; - } - - requestAnimationFrame(function () { - _this8.dropdown.hide(); - - _this8.containerOuter.close(); - - if (!preventInputBlur && _this8._canSearch) { - _this8.input.removeActiveDescendant(); - - _this8.input.blur(); - } - - _this8.passedElement.triggerEvent(_constants.EVENTS.hideDropdown, {}); - }); - return this; - } - }, { - key: "getValue", - value: function getValue() { - var valueOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; - - var values = this._store.activeItems.reduce(function (selectedItems, item) { - var itemValue = valueOnly ? item.value : item; - selectedItems.push(itemValue); - return selectedItems; - }, []); - - return this._isSelectOneElement ? values[0] : values; - } - }, { - key: "setValue", - value: function setValue(args) { - var _this9 = this; - - if (!this.initialised) { - return this; - } - - [].concat(args).forEach(function (value) { - return _this9._setChoiceOrItem(value); - }); - return this; - } - }, { - key: "setChoiceByValue", - value: function setChoiceByValue(value) { - var _this10 = this; - - if (!this.initialised || this._isTextElement) { - return this; - } // If only one value has been passed, convert to array - - - var choiceValue = (0, _utils.isType)('Array', value) ? value : [value]; // Loop through each value and - - choiceValue.forEach(function (val) { - return _this10._findAndSelectChoiceByValue(val); - }); - return this; - } - }, { - key: "setChoices", - value: function setChoices() { - var _this11 = this; - - var choices = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; - var label = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; - var replaceChoices = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; - - if (!this._isSelectElement || !value) { - return this; - } // Clear choices if needed - - - if (replaceChoices) { - this.clearChoices(); - } - - this.containerOuter.removeLoadingState(); - - var addGroupsAndChoices = function addGroupsAndChoices(groupOrChoice) { - if (groupOrChoice.choices) { - _this11._addGroup({ - group: groupOrChoice, - id: groupOrChoice.id || null, - valueKey: value, - labelKey: label - }); - } else { - _this11._addChoice({ - value: groupOrChoice[value], - label: groupOrChoice[label], - isSelected: groupOrChoice.selected, - isDisabled: groupOrChoice.disabled, - customProperties: groupOrChoice.customProperties, - placeholder: groupOrChoice.placeholder - }); - } - }; - - this._setLoading(true); - - choices.forEach(addGroupsAndChoices); - - this._setLoading(false); - - return this; - } - }, { - key: "clearChoices", - value: function clearChoices() { - this._store.dispatch((0, _choices.clearChoices)()); - } - }, { - key: "clearStore", - value: function clearStore() { - this._store.dispatch((0, _misc.clearAll)()); - - return this; - } - }, { - key: "clearInput", - value: function clearInput() { - var shouldSetInputWidth = !this._isSelectOneElement; - this.input.clear(shouldSetInputWidth); - - if (!this._isTextElement && this._canSearch) { - this._isSearching = false; - - this._store.dispatch((0, _choices.activateChoices)(true)); - } - - return this; - } - }, { - key: "ajax", - value: function ajax(fn) { - var _this12 = this; - - if (!this.initialised || !this._isSelectElement || !fn) { - return this; - } - - requestAnimationFrame(function () { - return _this12._handleLoadingState(true); - }); - fn(this._ajaxCallback()); - return this; - } - /* ===== End of Public functions ====== */ - - /* ============================================= - = Private functions = - ============================================= */ - - }, { - key: "_render", - value: function _render() { - if (this._store.isLoading()) { - return; - } - - this._currentState = this._store.state; - var stateChanged = this._currentState.choices !== this._prevState.choices || this._currentState.groups !== this._prevState.groups || this._currentState.items !== this._prevState.items; - var shouldRenderChoices = this._isSelectElement; - var shouldRenderItems = this._currentState.items !== this._prevState.items; - - if (!stateChanged) { - return; - } - - if (shouldRenderChoices) { - this._renderChoices(); - } - - if (shouldRenderItems) { - this._renderItems(); - } - - this._prevState = this._currentState; - } - }, { - key: "_renderChoices", - value: function _renderChoices() { - var _this13 = this; - - var _this$_store = this._store, - activeGroups = _this$_store.activeGroups, - activeChoices = _this$_store.activeChoices; - var choiceListFragment = document.createDocumentFragment(); - this.choiceList.clear(); - - if (this.config.resetScrollPosition) { - requestAnimationFrame(function () { - return _this13.choiceList.scrollToTop(); - }); - } // If we have grouped options - - - if (activeGroups.length >= 1 && !this._isSearching) { - // If we have a placeholder choice along with groups - var activePlaceholders = activeChoices.filter(function (activeChoice) { - return activeChoice.placeholder === true && activeChoice.groupId === -1; - }); - - if (activePlaceholders.length >= 1) { - choiceListFragment = this._createChoicesFragment(activePlaceholders, choiceListFragment); - } - - choiceListFragment = this._createGroupsFragment(activeGroups, activeChoices, choiceListFragment); - } else if (activeChoices.length >= 1) { - choiceListFragment = this._createChoicesFragment(activeChoices, choiceListFragment); - } // If we have choices to show - - - if (choiceListFragment.childNodes && choiceListFragment.childNodes.length > 0) { - var activeItems = this._store.activeItems; - - var canAddItem = this._canAddItem(activeItems, this.input.value); // ...and we can select them - - - if (canAddItem.response) { - // ...append them and highlight the first choice - this.choiceList.append(choiceListFragment); - - this._highlightChoice(); - } else { - // ...otherwise show a notice - this.choiceList.append(this._getTemplate('notice', canAddItem.notice)); - } - } else { - // Otherwise show a notice - var dropdownItem; - var notice; - - if (this._isSearching) { - notice = (0, _utils.isType)('Function', this.config.noResultsText) ? this.config.noResultsText() : this.config.noResultsText; - dropdownItem = this._getTemplate('notice', notice, 'no-results'); - } else { - notice = (0, _utils.isType)('Function', this.config.noChoicesText) ? this.config.noChoicesText() : this.config.noChoicesText; - dropdownItem = this._getTemplate('notice', notice, 'no-choices'); - } - - this.choiceList.append(dropdownItem); - } - } - }, { - key: "_renderItems", - value: function _renderItems() { - var activeItems = this._store.activeItems || []; - this.itemList.clear(); // Create a fragment to store our list items - // (so we don't have to update the DOM for each item) - - var itemListFragment = this._createItemsFragment(activeItems); // If we have items to add, append them - - - if (itemListFragment.childNodes) { - this.itemList.append(itemListFragment); - } - } - }, { - key: "_createGroupsFragment", - value: function _createGroupsFragment(groups, choices, fragment) { - var _this14 = this; - - var groupFragment = fragment || document.createDocumentFragment(); - - var getGroupChoices = function getGroupChoices(group) { - return choices.filter(function (choice) { - if (_this14._isSelectOneElement) { - return choice.groupId === group.id; - } - - return choice.groupId === group.id && (_this14.config.renderSelectedChoices === 'always' || !choice.selected); - }); - }; // If sorting is enabled, filter groups - - - if (this.config.shouldSort) { - groups.sort(this.config.sortFn); - } - - groups.forEach(function (group) { - var groupChoices = getGroupChoices(group); - - if (groupChoices.length >= 1) { - var dropdownGroup = _this14._getTemplate('choiceGroup', group); - - groupFragment.appendChild(dropdownGroup); - - _this14._createChoicesFragment(groupChoices, groupFragment, true); - } - }); - return groupFragment; - } - }, { - key: "_createChoicesFragment", - value: function _createChoicesFragment(choices, fragment) { - var _this15 = this; - - var withinGroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - // Create a fragment to store our list items (so we don't have to update the DOM for each item) - var choicesFragment = fragment || document.createDocumentFragment(); - var _this$config = this.config, - renderSelectedChoices = _this$config.renderSelectedChoices, - searchResultLimit = _this$config.searchResultLimit, - renderChoiceLimit = _this$config.renderChoiceLimit; - var filter = this._isSearching ? _utils.sortByScore : this.config.sortFn; - - var appendChoice = function appendChoice(choice) { - var shouldRender = renderSelectedChoices === 'auto' ? _this15._isSelectOneElement || !choice.selected : true; - - if (shouldRender) { - var dropdownItem = _this15._getTemplate('choice', choice, _this15.config.itemSelectText); - - choicesFragment.appendChild(dropdownItem); - } - }; - - var rendererableChoices = choices; - - if (renderSelectedChoices === 'auto' && !this._isSelectOneElement) { - rendererableChoices = choices.filter(function (choice) { - return !choice.selected; - }); - } // Split array into placeholders and "normal" choices - - - var _rendererableChoices$ = rendererableChoices.reduce(function (acc, choice) { - if (choice.placeholder) { - acc.placeholderChoices.push(choice); - } else { - acc.normalChoices.push(choice); - } - - return acc; - }, { - placeholderChoices: [], - normalChoices: [] - }), - placeholderChoices = _rendererableChoices$.placeholderChoices, - normalChoices = _rendererableChoices$.normalChoices; // If sorting is enabled or the user is searching, filter choices - - - if (this.config.shouldSort || this._isSearching) { - normalChoices.sort(filter); - } - - var choiceLimit = rendererableChoices.length; // Prepend placeholeder - - var sortedChoices = [].concat(placeholderChoices, normalChoices); - - if (this._isSearching) { - choiceLimit = searchResultLimit; - } else if (renderChoiceLimit > 0 && !withinGroup) { - choiceLimit = renderChoiceLimit; - } // Add each choice to dropdown within range - - - for (var i = 0; i < choiceLimit; i += 1) { - if (sortedChoices[i]) { - appendChoice(sortedChoices[i]); - } - } - - return choicesFragment; - } - }, { - key: "_createItemsFragment", - value: function _createItemsFragment(items) { - var _this16 = this; - - var fragment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - // Create fragment to add elements to - var _this$config2 = this.config, - shouldSortItems = _this$config2.shouldSortItems, - sortFn = _this$config2.sortFn, - removeItemButton = _this$config2.removeItemButton; - var itemListFragment = fragment || document.createDocumentFragment(); // If sorting is enabled, filter items - - if (shouldSortItems && !this._isSelectOneElement) { - items.sort(sortFn); - } - - if (this._isTextElement) { - // Update the value of the hidden input - this.passedElement.value = items; - } else { - // Update the options of the hidden input - this.passedElement.options = items; - } - - var addItemToFragment = function addItemToFragment(item) { - // Create new list element - var listItem = _this16._getTemplate('item', item, removeItemButton); // Append it to list - - - itemListFragment.appendChild(listItem); - }; // Add each list item to list - - - items.forEach(function (item) { - return addItemToFragment(item); - }); - return itemListFragment; - } - }, { - key: "_triggerChange", - value: function _triggerChange(value) { - if (value === undefined || value === null) { - return; - } - - this.passedElement.triggerEvent(_constants.EVENTS.change, { - value: value - }); - } - }, { - key: "_selectPlaceholderChoice", - value: function _selectPlaceholderChoice() { - var placeholderChoice = this._store.placeholderChoice; - - if (placeholderChoice) { - this._addItem({ - value: placeholderChoice.value, - label: placeholderChoice.label, - choiceId: placeholderChoice.id, - groupId: placeholderChoice.groupId, - placeholder: placeholderChoice.placeholder - }); - - this._triggerChange(placeholderChoice.value); - } - } - }, { - key: "_handleButtonAction", - value: function _handleButtonAction(activeItems, element) { - if (!activeItems || !element || !this.config.removeItems || !this.config.removeItemButton) { - return; - } - - var itemId = element.parentNode.getAttribute('data-id'); - var itemToRemove = activeItems.find(function (item) { - return item.id === parseInt(itemId, 10); - }); // Remove item associated with button - - this._removeItem(itemToRemove); - - this._triggerChange(itemToRemove.value); - - if (this._isSelectOneElement) { - this._selectPlaceholderChoice(); - } - } - }, { - key: "_handleItemAction", - value: function _handleItemAction(activeItems, element) { - var _this17 = this; - - var hasShiftKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - - if (!activeItems || !element || !this.config.removeItems || this._isSelectOneElement) { - return; - } - - var passedId = element.getAttribute('data-id'); // We only want to select one item with a click - // so we deselect any items that aren't the target - // unless shift is being pressed - - activeItems.forEach(function (item) { - if (item.id === parseInt(passedId, 10) && !item.highlighted) { - _this17.highlightItem(item); - } else if (!hasShiftKey && item.highlighted) { - _this17.unhighlightItem(item); - } - }); // Focus input as without focus, a user cannot do anything with a - // highlighted item - - this.input.focus(); - } - }, { - key: "_handleChoiceAction", - value: function _handleChoiceAction(activeItems, element) { - if (!activeItems || !element) { - return; - } // If we are clicking on an option - - - var id = element.getAttribute('data-id'); - - var choice = this._store.getChoiceById(id); - - var passedKeyCode = activeItems[0] && activeItems[0].keyCode ? activeItems[0].keyCode : null; - var hasActiveDropdown = this.dropdown.isActive; // Update choice keyCode - - choice.keyCode = passedKeyCode; - this.passedElement.triggerEvent(_constants.EVENTS.choice, { - choice: choice - }); - - if (choice && !choice.selected && !choice.disabled) { - var canAddItem = this._canAddItem(activeItems, choice.value); - - if (canAddItem.response) { - this._addItem({ - value: choice.value, - label: choice.label, - choiceId: choice.id, - groupId: choice.groupId, - customProperties: choice.customProperties, - placeholder: choice.placeholder, - keyCode: choice.keyCode - }); - - this._triggerChange(choice.value); - } - } - - this.clearInput(); // We wont to close the dropdown if we are dealing with a single select box - - if (hasActiveDropdown && this._isSelectOneElement) { - this.hideDropdown(true); - this.containerOuter.focus(); - } - } - }, { - key: "_handleBackspace", - value: function _handleBackspace(activeItems) { - if (!this.config.removeItems || !activeItems) { - return; - } - - var lastItem = activeItems[activeItems.length - 1]; - var hasHighlightedItems = activeItems.some(function (item) { - return item.highlighted; - }); // If editing the last item is allowed and there are not other selected items, - // we can edit the item value. Otherwise if we can remove items, remove all selected items - - if (this.config.editItems && !hasHighlightedItems && lastItem) { - this.input.value = lastItem.value; - this.input.setWidth(); - - this._removeItem(lastItem); - - this._triggerChange(lastItem.value); - } else { - if (!hasHighlightedItems) { - // Highlight last item if none already highlighted - this.highlightItem(lastItem, false); - } - - this.removeHighlightedItems(true); - } - } - }, { - key: "_setLoading", - value: function _setLoading(isLoading) { - this._store.dispatch((0, _general.setIsLoading)(isLoading)); - } - }, { - key: "_handleLoadingState", - value: function _handleLoadingState() { - var setLoading = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; - var placeholderItem = this.itemList.getChild(".".concat(this.config.classNames.placeholder)); - - if (setLoading) { - this.disable(); - this.containerOuter.addLoadingState(); - - if (this._isSelectOneElement) { - if (!placeholderItem) { - placeholderItem = this._getTemplate('placeholder', this.config.loadingText); - this.itemList.append(placeholderItem); - } else { - placeholderItem.innerHTML = this.config.loadingText; - } - } else { - this.input.placeholder = this.config.loadingText; - } - } else { - this.enable(); - this.containerOuter.removeLoadingState(); - - if (this._isSelectOneElement) { - placeholderItem.innerHTML = this._placeholderValue || ''; - } else { - this.input.placeholder = this._placeholderValue || ''; - } - } - } - }, { - key: "_handleSearch", - value: function _handleSearch(value) { - if (!value || !this.input.isFocussed) { - return; - } - - var choices = this._store.choices; - var _this$config3 = this.config, - searchFloor = _this$config3.searchFloor, - searchChoices = _this$config3.searchChoices; - var hasUnactiveChoices = choices.some(function (option) { - return !option.active; - }); // Check that we have a value to search and the input was an alphanumeric character - - if (value && value.length >= searchFloor) { - var resultCount = searchChoices ? this._searchChoices(value) : 0; // Trigger search event - - this.passedElement.triggerEvent(_constants.EVENTS.search, { - value: value, - resultCount: resultCount - }); - } else if (hasUnactiveChoices) { - // Otherwise reset choices to active - this._isSearching = false; - - this._store.dispatch((0, _choices.activateChoices)(true)); - } - } - }, { - key: "_canAddItem", - value: function _canAddItem(activeItems, value) { - var canAddItem = true; - var notice = (0, _utils.isType)('Function', this.config.addItemText) ? this.config.addItemText(value) : this.config.addItemText; - - if (!this._isSelectOneElement) { - var isDuplicateValue = (0, _utils.existsInArray)(activeItems, value); - - if (this.config.maxItemCount > 0 && this.config.maxItemCount <= activeItems.length) { - // If there is a max entry limit and we have reached that limit - // don't update - canAddItem = false; - notice = (0, _utils.isType)('Function', this.config.maxItemText) ? this.config.maxItemText(this.config.maxItemCount) : this.config.maxItemText; - } - - if (!this.config.duplicateItemsAllowed && isDuplicateValue && canAddItem) { - canAddItem = false; - notice = (0, _utils.isType)('Function', this.config.uniqueItemText) ? this.config.uniqueItemText(value) : this.config.uniqueItemText; - } - - if (this._isTextElement && this.config.addItems && canAddItem && (0, _utils.isType)('Function', this.config.addItemFilterFn) && !this.config.addItemFilterFn(value)) { - canAddItem = false; - notice = (0, _utils.isType)('Function', this.config.customAddItemText) ? this.config.customAddItemText(value) : this.config.customAddItemText; - } - } - - return { - response: canAddItem, - notice: notice - }; - } - }, { - key: "_ajaxCallback", - value: function _ajaxCallback() { - var _this18 = this; - - return function (results, value, label) { - if (!results || !value) { - return; - } - - var parsedResults = (0, _utils.isType)('Object', results) ? [results] : results; - - if (parsedResults && (0, _utils.isType)('Array', parsedResults) && parsedResults.length) { - // Remove loading states/text - _this18._handleLoadingState(false); - - _this18._setLoading(true); // Add each result as a choice - - - parsedResults.forEach(function (result) { - if (result.choices) { - _this18._addGroup({ - group: result, - id: result.id || null, - valueKey: value, - labelKey: label - }); - } else { - _this18._addChoice({ - value: (0, _utils.fetchFromObject)(result, value), - label: (0, _utils.fetchFromObject)(result, label), - isSelected: result.selected, - isDisabled: result.disabled, - customProperties: result.customProperties, - placeholder: result.placeholder - }); - } - }); - - _this18._setLoading(false); - - if (_this18._isSelectOneElement) { - _this18._selectPlaceholderChoice(); - } - } else { - // No results, remove loading state - _this18._handleLoadingState(false); - } - }; - } - }, { - key: "_searchChoices", - value: function _searchChoices(value) { - var newValue = (0, _utils.isType)('String', value) ? value.trim() : value; - var currentValue = (0, _utils.isType)('String', this._currentValue) ? this._currentValue.trim() : this._currentValue; - - if (newValue.length < 1 && newValue === "".concat(currentValue, " ")) { - return 0; - } // If new value matches the desired length and is not the same as the current value with a space - - - var haystack = this._store.searchableChoices; - var needle = newValue; - var keys = [].concat(this.config.searchFields); - var options = Object.assign(this.config.fuseOptions, { - keys: keys - }); - var fuse = new _fuse.default(haystack, options); - var results = fuse.search(needle); - this._currentValue = newValue; - this._highlightPosition = 0; - this._isSearching = true; - - this._store.dispatch((0, _choices.filterChoices)(results)); - - return results.length; - } - }, { - key: "_addEventListeners", - value: function _addEventListeners() { - window.delegateEvent.add('keyup', this._onKeyUp); - window.delegateEvent.add('keydown', this._onKeyDown); - window.delegateEvent.add('click', this._onClick); - window.delegateEvent.add('touchmove', this._onTouchMove); - window.delegateEvent.add('touchend', this._onTouchEnd); - window.delegateEvent.add('mousedown', this._onMouseDown); - window.delegateEvent.add('mouseover', this._onMouseOver); - - if (this._isSelectOneElement) { - this.containerOuter.element.addEventListener('focus', this._onFocus); - this.containerOuter.element.addEventListener('blur', this._onBlur); - } - - this.input.element.addEventListener('focus', this._onFocus); - this.input.element.addEventListener('blur', this._onBlur); - - if (this.input.element.form) { - this.input.element.form.addEventListener('reset', this._onFormReset); - } - - this.input.addEventListeners(); - } - }, { - key: "_removeEventListeners", - value: function _removeEventListeners() { - window.delegateEvent.remove('keyup', this._onKeyUp); - window.delegateEvent.remove('keydown', this._onKeyDown); - window.delegateEvent.remove('click', this._onClick); - window.delegateEvent.remove('touchmove', this._onTouchMove); - window.delegateEvent.remove('touchend', this._onTouchEnd); - window.delegateEvent.remove('mousedown', this._onMouseDown); - window.delegateEvent.remove('mouseover', this._onMouseOver); - - if (this._isSelectOneElement) { - this.containerOuter.element.removeEventListener('focus', this._onFocus); - this.containerOuter.element.removeEventListener('blur', this._onBlur); - } - - this.input.element.removeEventListener('focus', this._onFocus); - this.input.element.removeEventListener('blur', this._onBlur); - - if (this.input.element.form) { - this.input.element.form.removeEventListener('reset', this._onFormReset); - } - - this.input.removeEventListeners(); - } - }, { - key: "_onKeyDown", - value: function _onKeyDown(event) { - var _keyDownActions; - - var target = event.target, - keyCode = event.keyCode, - ctrlKey = event.ctrlKey, - metaKey = event.metaKey; - - if (target !== this.input.element && !this.containerOuter.element.contains(target)) { - return; - } - - var activeItems = this._store.activeItems; - var hasFocusedInput = this.input.isFocussed; - var hasActiveDropdown = this.dropdown.isActive; - var hasItems = this.itemList.hasChildren; - var keyString = String.fromCharCode(keyCode); - var BACK_KEY = _constants.KEY_CODES.BACK_KEY, - DELETE_KEY = _constants.KEY_CODES.DELETE_KEY, - ENTER_KEY = _constants.KEY_CODES.ENTER_KEY, - A_KEY = _constants.KEY_CODES.A_KEY, - ESC_KEY = _constants.KEY_CODES.ESC_KEY, - UP_KEY = _constants.KEY_CODES.UP_KEY, - DOWN_KEY = _constants.KEY_CODES.DOWN_KEY, - PAGE_UP_KEY = _constants.KEY_CODES.PAGE_UP_KEY, - PAGE_DOWN_KEY = _constants.KEY_CODES.PAGE_DOWN_KEY; - var hasCtrlDownKeyPressed = ctrlKey || metaKey; // If a user is typing and the dropdown is not active - - if (!this._isTextElement && /[a-zA-Z0-9-_ ]/.test(keyString)) { - this.showDropdown(); - } // Map keys to key actions - - - var keyDownActions = (_keyDownActions = {}, _defineProperty(_keyDownActions, A_KEY, this._onAKey), _defineProperty(_keyDownActions, ENTER_KEY, this._onEnterKey), _defineProperty(_keyDownActions, ESC_KEY, this._onEscapeKey), _defineProperty(_keyDownActions, UP_KEY, this._onDirectionKey), _defineProperty(_keyDownActions, PAGE_UP_KEY, this._onDirectionKey), _defineProperty(_keyDownActions, DOWN_KEY, this._onDirectionKey), _defineProperty(_keyDownActions, PAGE_DOWN_KEY, this._onDirectionKey), _defineProperty(_keyDownActions, DELETE_KEY, this._onDeleteKey), _defineProperty(_keyDownActions, BACK_KEY, this._onDeleteKey), _keyDownActions); // If keycode has a function, run it - - if (keyDownActions[keyCode]) { - keyDownActions[keyCode]({ - event: event, - target: target, - keyCode: keyCode, - metaKey: metaKey, - activeItems: activeItems, - hasFocusedInput: hasFocusedInput, - hasActiveDropdown: hasActiveDropdown, - hasItems: hasItems, - hasCtrlDownKeyPressed: hasCtrlDownKeyPressed - }); - } - } - }, { - key: "_onKeyUp", - value: function _onKeyUp(_ref2) { - var target = _ref2.target, - keyCode = _ref2.keyCode; - - if (target !== this.input.element) { - return; - } - - var value = this.input.value; - var activeItems = this._store.activeItems; - - var canAddItem = this._canAddItem(activeItems, value); - - var backKey = _constants.KEY_CODES.BACK_KEY, - deleteKey = _constants.KEY_CODES.DELETE_KEY; // We are typing into a text input and have a value, we want to show a dropdown - // notice. Otherwise hide the dropdown - - if (this._isTextElement) { - var canShowDropdownNotice = canAddItem.notice && value; - - if (canShowDropdownNotice) { - var dropdownItem = this._getTemplate('notice', canAddItem.notice); - - this.dropdown.element.innerHTML = dropdownItem.outerHTML; - this.showDropdown(true); - } else { - this.hideDropdown(true); - } - } else { - var userHasRemovedValue = (keyCode === backKey || keyCode === deleteKey) && !target.value; - var canReactivateChoices = !this._isTextElement && this._isSearching; - var canSearch = this._canSearch && canAddItem.response; - - if (userHasRemovedValue && canReactivateChoices) { - this._isSearching = false; - - this._store.dispatch((0, _choices.activateChoices)(true)); - } else if (canSearch) { - this._handleSearch(this.input.value); - } - } - - this._canSearch = this.config.searchEnabled; - } - }, { - key: "_onAKey", - value: function _onAKey(_ref3) { - var hasItems = _ref3.hasItems, - hasCtrlDownKeyPressed = _ref3.hasCtrlDownKeyPressed; - - // If CTRL + A or CMD + A have been pressed and there are items to select - if (hasCtrlDownKeyPressed && hasItems) { - this._canSearch = false; - var shouldHightlightAll = this.config.removeItems && !this.input.value && this.input.element === document.activeElement; - - if (shouldHightlightAll) { - this.highlightAll(); - } - } - } - }, { - key: "_onEnterKey", - value: function _onEnterKey(_ref4) { - var event = _ref4.event, - target = _ref4.target, - activeItems = _ref4.activeItems, - hasActiveDropdown = _ref4.hasActiveDropdown; - var enterKey = _constants.KEY_CODES.ENTER_KEY; - var targetWasButton = target.hasAttribute('data-button'); - - if (this._isTextElement && target.value) { - var value = this.input.value; - - var canAddItem = this._canAddItem(activeItems, value); - - if (canAddItem.response) { - this.hideDropdown(true); - - this._addItem({ - value: value - }); - - this._triggerChange(value); - - this.clearInput(); - } - } - - if (targetWasButton) { - this._handleButtonAction(activeItems, target); - - event.preventDefault(); - } - - if (hasActiveDropdown) { - var highlightedChoice = this.dropdown.getChild(".".concat(this.config.classNames.highlightedState)); - - if (highlightedChoice) { - // add enter keyCode value - if (activeItems[0]) { - activeItems[0].keyCode = enterKey; // eslint-disable-line no-param-reassign - } - - this._handleChoiceAction(activeItems, highlightedChoice); - } - - event.preventDefault(); - } else if (this._isSelectOneElement) { - this.showDropdown(); - event.preventDefault(); - } - } - }, { - key: "_onEscapeKey", - value: function _onEscapeKey(_ref5) { - var hasActiveDropdown = _ref5.hasActiveDropdown; - - if (hasActiveDropdown) { - this.hideDropdown(true); - this.containerOuter.focus(); - } - } - }, { - key: "_onDirectionKey", - value: function _onDirectionKey(_ref6) { - var event = _ref6.event, - hasActiveDropdown = _ref6.hasActiveDropdown, - keyCode = _ref6.keyCode, - metaKey = _ref6.metaKey; - var downKey = _constants.KEY_CODES.DOWN_KEY, - pageUpKey = _constants.KEY_CODES.PAGE_UP_KEY, - pageDownKey = _constants.KEY_CODES.PAGE_DOWN_KEY; // If up or down key is pressed, traverse through options - - if (hasActiveDropdown || this._isSelectOneElement) { - this.showDropdown(); - this._canSearch = false; - var directionInt = keyCode === downKey || keyCode === pageDownKey ? 1 : -1; - var skipKey = metaKey || keyCode === pageDownKey || keyCode === pageUpKey; - var selectableChoiceIdentifier = '[data-choice-selectable]'; - var nextEl; - - if (skipKey) { - if (directionInt > 0) { - nextEl = Array.from(this.dropdown.element.querySelectorAll(selectableChoiceIdentifier)).pop(); - } else { - nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier); - } - } else { - var currentEl = this.dropdown.element.querySelector(".".concat(this.config.classNames.highlightedState)); - - if (currentEl) { - nextEl = (0, _utils.getAdjacentEl)(currentEl, selectableChoiceIdentifier, directionInt); - } else { - nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier); - } - } - - if (nextEl) { - // We prevent default to stop the cursor moving - // when pressing the arrow - if (!(0, _utils.isScrolledIntoView)(nextEl, this.choiceList.element, directionInt)) { - this.choiceList.scrollToChoice(nextEl, directionInt); - } - - this._highlightChoice(nextEl); - } // Prevent default to maintain cursor position whilst - // traversing dropdown options - - - event.preventDefault(); - } - } - }, { - key: "_onDeleteKey", - value: function _onDeleteKey(_ref7) { - var event = _ref7.event, - target = _ref7.target, - hasFocusedInput = _ref7.hasFocusedInput, - activeItems = _ref7.activeItems; - - // If backspace or delete key is pressed and the input has no value - if (hasFocusedInput && !target.value && !this._isSelectOneElement) { - this._handleBackspace(activeItems); - - event.preventDefault(); - } - } - }, { - key: "_onTouchMove", - value: function _onTouchMove() { - if (this._wasTap) { - this._wasTap = false; - } - } - }, { - key: "_onTouchEnd", - value: function _onTouchEnd(event) { - var _ref8 = event || event.touches[0], - target = _ref8.target; - - var touchWasWithinContainer = this._wasTap && this.containerOuter.element.contains(target); - - if (touchWasWithinContainer) { - var containerWasExactTarget = target === this.containerOuter.element || target === this.containerInner.element; - - if (containerWasExactTarget) { - if (this._isTextElement) { - this.input.focus(); - } else if (this._isSelectMultipleElement) { - this.showDropdown(); - } - } // Prevents focus event firing - - - event.stopPropagation(); - } - - this._wasTap = true; - } - }, { - key: "_onMouseDown", - value: function _onMouseDown(event) { - var target = event.target, - shiftKey = event.shiftKey; // If we have our mouse down on the scrollbar and are on IE11... - - if (this.choiceList.element.contains(target) && (0, _utils.isIE11)()) { - this._isScrollingOnIe = true; - } - - if (!this.containerOuter.element.contains(target) || target === this.input.element) { - return; - } - - var activeItems = this._store.activeItems; - var hasShiftKey = shiftKey; - var buttonTarget = (0, _utils.findAncestorByAttrName)(target, 'data-button'); - var itemTarget = (0, _utils.findAncestorByAttrName)(target, 'data-item'); - var choiceTarget = (0, _utils.findAncestorByAttrName)(target, 'data-choice'); - - if (buttonTarget) { - this._handleButtonAction(activeItems, buttonTarget); - } else if (itemTarget) { - this._handleItemAction(activeItems, itemTarget, hasShiftKey); - } else if (choiceTarget) { - this._handleChoiceAction(activeItems, choiceTarget); - } - - event.preventDefault(); - } - }, { - key: "_onMouseOver", - value: function _onMouseOver(_ref9) { - var target = _ref9.target; - var targetWithinDropdown = target === this.dropdown || this.dropdown.element.contains(target); - var shouldHighlightChoice = targetWithinDropdown && target.hasAttribute('data-choice'); - - if (shouldHighlightChoice) { - this._highlightChoice(target); - } - } - }, { - key: "_onClick", - value: function _onClick(_ref10) { - var target = _ref10.target; - var clickWasWithinContainer = this.containerOuter.element.contains(target); - - if (clickWasWithinContainer) { - if (!this.dropdown.isActive && !this.containerOuter.isDisabled) { - if (this._isTextElement) { - if (document.activeElement !== this.input.element) { - this.input.focus(); - } - } else { - this.showDropdown(); - this.containerOuter.focus(); - } - } else if (this._isSelectOneElement && target !== this.input.element && !this.dropdown.element.contains(target)) { - this.hideDropdown(); - } - } else { - var hasHighlightedItems = this._store.highlightedActiveItems.length > 0; - - if (hasHighlightedItems) { - this.unhighlightAll(); - } - - this.containerOuter.removeFocusState(); - this.hideDropdown(true); - } - } - }, { - key: "_onFocus", - value: function _onFocus(_ref11) { - var _this19 = this; - - var target = _ref11.target; - var focusWasWithinContainer = this.containerOuter.element.contains(target); - - if (!focusWasWithinContainer) { - return; - } - - var focusActions = { - text: function text() { - if (target === _this19.input.element) { - _this19.containerOuter.addFocusState(); - } - }, - 'select-one': function selectOne() { - _this19.containerOuter.addFocusState(); - - if (target === _this19.input.element) { - _this19.showDropdown(true); - } - }, - 'select-multiple': function selectMultiple() { - if (target === _this19.input.element) { - _this19.showDropdown(true); // If element is a select box, the focused element is the container and the dropdown - // isn't already open, focus and show dropdown - - - _this19.containerOuter.addFocusState(); - } - } - }; - focusActions[this.passedElement.element.type](); - } - }, { - key: "_onBlur", - value: function _onBlur(_ref12) { - var _this20 = this; - - var target = _ref12.target; - var blurWasWithinContainer = this.containerOuter.element.contains(target); - - if (blurWasWithinContainer && !this._isScrollingOnIe) { - var activeItems = this._store.activeItems; - var hasHighlightedItems = activeItems.some(function (item) { - return item.highlighted; - }); - var blurActions = { - text: function text() { - if (target === _this20.input.element) { - _this20.containerOuter.removeFocusState(); - - if (hasHighlightedItems) { - _this20.unhighlightAll(); - } - - _this20.hideDropdown(true); - } - }, - 'select-one': function selectOne() { - _this20.containerOuter.removeFocusState(); - - if (target === _this20.input.element || target === _this20.containerOuter.element && !_this20._canSearch) { - _this20.hideDropdown(true); - } - }, - 'select-multiple': function selectMultiple() { - if (target === _this20.input.element) { - _this20.containerOuter.removeFocusState(); - - _this20.hideDropdown(true); - - if (hasHighlightedItems) { - _this20.unhighlightAll(); - } - } - } - }; - blurActions[this.passedElement.element.type](); - } else { - // On IE11, clicking the scollbar blurs our input and thus - // closes the dropdown. To stop this, we refocus our input - // if we know we are on IE *and* are scrolling. - this._isScrollingOnIe = false; - this.input.element.focus(); - } - } - }, { - key: "_onFormReset", - value: function _onFormReset() { - this._store.dispatch((0, _misc.resetTo)(this._initialState)); - } - }, { - key: "_highlightChoice", - value: function _highlightChoice() { - var _this21 = this; - - var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - var choices = Array.from(this.dropdown.element.querySelectorAll('[data-choice-selectable]')); - - if (!choices.length) { - return; - } - - var passedEl = el; - var highlightedChoices = Array.from(this.dropdown.element.querySelectorAll(".".concat(this.config.classNames.highlightedState))); // Remove any highlighted choices - - highlightedChoices.forEach(function (choice) { - choice.classList.remove(_this21.config.classNames.highlightedState); - choice.setAttribute('aria-selected', 'false'); - }); - - if (passedEl) { - this._highlightPosition = choices.indexOf(passedEl); - } else { - // Highlight choice based on last known highlight location - if (choices.length > this._highlightPosition) { - // If we have an option to highlight - passedEl = choices[this._highlightPosition]; - } else { - // Otherwise highlight the option before - passedEl = choices[choices.length - 1]; - } - - if (!passedEl) { - passedEl = choices[0]; - } - } - - passedEl.classList.add(this.config.classNames.highlightedState); - passedEl.setAttribute('aria-selected', 'true'); - this.passedElement.triggerEvent(_constants.EVENTS.highlightChoice, { - el: passedEl - }); - - if (this.dropdown.isActive) { - // IE11 ignores aria-label and blocks virtual keyboard - // if aria-activedescendant is set without a dropdown - this.input.setActiveDescendant(passedEl.id); - this.containerOuter.setActiveDescendant(passedEl.id); - } - } - }, { - key: "_addItem", - value: function _addItem(_ref13) { - var value = _ref13.value, - _ref13$label = _ref13.label, - label = _ref13$label === void 0 ? null : _ref13$label, - _ref13$choiceId = _ref13.choiceId, - choiceId = _ref13$choiceId === void 0 ? -1 : _ref13$choiceId, - _ref13$groupId = _ref13.groupId, - groupId = _ref13$groupId === void 0 ? -1 : _ref13$groupId, - _ref13$customProperti = _ref13.customProperties, - customProperties = _ref13$customProperti === void 0 ? null : _ref13$customProperti, - _ref13$placeholder = _ref13.placeholder, - placeholder = _ref13$placeholder === void 0 ? false : _ref13$placeholder, - _ref13$keyCode = _ref13.keyCode, - keyCode = _ref13$keyCode === void 0 ? null : _ref13$keyCode; - var passedValue = (0, _utils.isType)('String', value) ? value.trim() : value; - var passedKeyCode = keyCode; - var passedCustomProperties = customProperties; - var items = this._store.items; - var passedLabel = label || passedValue; - var passedOptionId = parseInt(choiceId, 10) || -1; - var group = groupId >= 0 ? this._store.getGroupById(groupId) : null; - var id = items ? items.length + 1 : 1; // If a prepended value has been passed, prepend it - - if (this.config.prependValue) { - passedValue = this.config.prependValue + passedValue.toString(); - } // If an appended value has been passed, append it - - - if (this.config.appendValue) { - passedValue += this.config.appendValue.toString(); - } - - this._store.dispatch((0, _items.addItem)({ - value: passedValue, - label: passedLabel, - id: id, - choiceId: passedOptionId, - groupId: groupId, - customProperties: customProperties, - placeholder: placeholder, - keyCode: passedKeyCode - })); - - if (this._isSelectOneElement) { - this.removeActiveItems(id); - } // Trigger change event - - - this.passedElement.triggerEvent(_constants.EVENTS.addItem, { - id: id, - value: passedValue, - label: passedLabel, - customProperties: passedCustomProperties, - groupValue: group && group.value ? group.value : undefined, - keyCode: passedKeyCode - }); - return this; - } - }, { - key: "_removeItem", - value: function _removeItem(item) { - if (!item || !(0, _utils.isType)('Object', item)) { - return this; - } - - var id = item.id, - value = item.value, - label = item.label, - choiceId = item.choiceId, - groupId = item.groupId; - var group = groupId >= 0 ? this._store.getGroupById(groupId) : null; - - this._store.dispatch((0, _items.removeItem)(id, choiceId)); - - if (group && group.value) { - this.passedElement.triggerEvent(_constants.EVENTS.removeItem, { - id: id, - value: value, - label: label, - groupValue: group.value - }); - } else { - this.passedElement.triggerEvent(_constants.EVENTS.removeItem, { - id: id, - value: value, - label: label - }); - } - - return this; - } - }, { - key: "_addChoice", - value: function _addChoice(_ref14) { - var value = _ref14.value, - _ref14$label = _ref14.label, - label = _ref14$label === void 0 ? null : _ref14$label, - _ref14$isSelected = _ref14.isSelected, - isSelected = _ref14$isSelected === void 0 ? false : _ref14$isSelected, - _ref14$isDisabled = _ref14.isDisabled, - isDisabled = _ref14$isDisabled === void 0 ? false : _ref14$isDisabled, - _ref14$groupId = _ref14.groupId, - groupId = _ref14$groupId === void 0 ? -1 : _ref14$groupId, - _ref14$customProperti = _ref14.customProperties, - customProperties = _ref14$customProperti === void 0 ? null : _ref14$customProperti, - _ref14$placeholder = _ref14.placeholder, - placeholder = _ref14$placeholder === void 0 ? false : _ref14$placeholder, - _ref14$keyCode = _ref14.keyCode, - keyCode = _ref14$keyCode === void 0 ? null : _ref14$keyCode; - - if (typeof value === 'undefined' || value === null) { - return; - } // Generate unique id - - - var choices = this._store.choices; - var choiceLabel = label || value; - var choiceId = choices ? choices.length + 1 : 1; - var choiceElementId = "".concat(this._baseId, "-").concat(this._idNames.itemChoice, "-").concat(choiceId); - - this._store.dispatch((0, _choices.addChoice)({ - value: value, - label: choiceLabel, - id: choiceId, - groupId: groupId, - disabled: isDisabled, - elementId: choiceElementId, - customProperties: customProperties, - placeholder: placeholder, - keyCode: keyCode - })); - - if (isSelected) { - this._addItem({ - value: value, - label: choiceLabel, - choiceId: choiceId, - customProperties: customProperties, - placeholder: placeholder, - keyCode: keyCode - }); - } - } - }, { - key: "_addGroup", - value: function _addGroup(_ref15) { - var _this22 = this; - - var group = _ref15.group, - id = _ref15.id, - _ref15$valueKey = _ref15.valueKey, - valueKey = _ref15$valueKey === void 0 ? 'value' : _ref15$valueKey, - _ref15$labelKey = _ref15.labelKey, - labelKey = _ref15$labelKey === void 0 ? 'label' : _ref15$labelKey; - var groupChoices = (0, _utils.isType)('Object', group) ? group.choices : Array.from(group.getElementsByTagName('OPTION')); - var groupId = id || Math.floor(new Date().valueOf() * Math.random()); - var isDisabled = group.disabled ? group.disabled : false; - - if (groupChoices) { - this._store.dispatch((0, _groups.addGroup)(group.label, groupId, true, isDisabled)); - - var addGroupChoices = function addGroupChoices(choice) { - var isOptDisabled = choice.disabled || choice.parentNode && choice.parentNode.disabled; - - _this22._addChoice({ - value: choice[valueKey], - label: (0, _utils.isType)('Object', choice) ? choice[labelKey] : choice.innerHTML, - isSelected: choice.selected, - isDisabled: isOptDisabled, - groupId: groupId, - customProperties: choice.customProperties, - placeholder: choice.placeholder - }); - }; - - groupChoices.forEach(addGroupChoices); - } else { - this._store.dispatch((0, _groups.addGroup)(group.label, group.id, false, group.disabled)); - } - } - }, { - key: "_getTemplate", - value: function _getTemplate(template) { - var _templates$template; - - if (!template) { - return null; - } - - var _this$config4 = this.config, - templates = _this$config4.templates, - classNames = _this$config4.classNames; - - for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - return (_templates$template = templates[template]).call.apply(_templates$template, [this, classNames].concat(args)); - } - }, { - key: "_createTemplates", - value: function _createTemplates() { - var callbackOnCreateTemplates = this.config.callbackOnCreateTemplates; - var userTemplates = {}; - - if (callbackOnCreateTemplates && (0, _utils.isType)('Function', callbackOnCreateTemplates)) { - userTemplates = callbackOnCreateTemplates.call(this, _utils.strToEl); - } - - this.config.templates = (0, _deepmerge.default)(_templates.TEMPLATES, userTemplates); - } - }, { - key: "_createElements", - value: function _createElements() { - this.containerOuter = new _components.Container({ - element: this._getTemplate('containerOuter', this._direction, this._isSelectElement, this._isSelectOneElement, this.config.searchEnabled, this.passedElement.element.type), - classNames: this.config.classNames, - type: this.passedElement.element.type, - position: this.config.position - }); - this.containerInner = new _components.Container({ - element: this._getTemplate('containerInner'), - classNames: this.config.classNames, - type: this.passedElement.element.type, - position: this.config.position - }); - this.input = new _components.Input({ - element: this._getTemplate('input', this._placeholderValue), - classNames: this.config.classNames, - type: this.passedElement.element.type - }); - this.choiceList = new _components.List({ - element: this._getTemplate('choiceList', this._isSelectOneElement) - }); - this.itemList = new _components.List({ - element: this._getTemplate('itemList', this._isSelectOneElement) - }); - this.dropdown = new _components.Dropdown({ - element: this._getTemplate('dropdown'), - classNames: this.config.classNames, - type: this.passedElement.element.type - }); - } - }, { - key: "_createStructure", - value: function _createStructure() { - // Hide original element - this.passedElement.conceal(); // Wrap input in container preserving DOM ordering - - this.containerInner.wrap(this.passedElement.element); // Wrapper inner container with outer container - - this.containerOuter.wrap(this.containerInner.element); - - if (this._isSelectOneElement) { - this.input.placeholder = this.config.searchPlaceholderValue || ''; - } else if (this._placeholderValue) { - this.input.placeholder = this._placeholderValue; - this.input.setWidth(true); - } - - this.containerOuter.element.appendChild(this.containerInner.element); - this.containerOuter.element.appendChild(this.dropdown.element); - this.containerInner.element.appendChild(this.itemList.element); - - if (!this._isTextElement) { - this.dropdown.element.appendChild(this.choiceList.element); - } - - if (!this._isSelectOneElement) { - this.containerInner.element.appendChild(this.input.element); - } else if (this.config.searchEnabled) { - this.dropdown.element.insertBefore(this.input.element, this.dropdown.element.firstChild); - } - - if (this._isSelectElement) { - this._addPredefinedChoices(); - } else if (this._isTextElement) { - this._addPredefinedItems(); - } - } - }, { - key: "_addPredefinedChoices", - value: function _addPredefinedChoices() { - var _this23 = this; - - var passedGroups = this.passedElement.optionGroups; - this._highlightPosition = 0; - this._isSearching = false; - - this._setLoading(true); - - if (passedGroups && passedGroups.length) { - // If we have a placeholder option - var placeholderChoice = this.passedElement.placeholderOption; - - if (placeholderChoice && placeholderChoice.parentNode.tagName === 'SELECT') { - this._addChoice({ - value: placeholderChoice.value, - label: placeholderChoice.innerHTML, - isSelected: placeholderChoice.selected, - isDisabled: placeholderChoice.disabled, - placeholder: true - }); - } - - passedGroups.forEach(function (group) { - return _this23._addGroup({ - group: group, - id: group.id || null - }); - }); - } else { - var passedOptions = this.passedElement.options; - var filter = this.config.sortFn; - var allChoices = this._presetChoices; // Create array of options from option elements - - passedOptions.forEach(function (o) { - allChoices.push({ - value: o.value, - label: o.innerHTML, - selected: o.selected, - disabled: o.disabled || o.parentNode.disabled, - placeholder: o.hasAttribute('placeholder'), - customProperties: o.getAttribute('data-custom-properties') - }); - }); // If sorting is enabled or the user is searching, filter choices - - if (this.config.shouldSort) allChoices.sort(filter); // Determine whether there is a selected choice - - var hasSelectedChoice = allChoices.some(function (choice) { - return choice.selected; - }); - - var handleChoice = function handleChoice(choice, index) { - var value = choice.value, - label = choice.label, - customProperties = choice.customProperties, - placeholder = choice.placeholder; - - if (_this23._isSelectElement) { - // If the choice is actually a group - if (choice.choices) { - _this23._addGroup({ - group: choice, - id: choice.id || null - }); - } else { - // If there is a selected choice already or the choice is not - // the first in the array, add each choice normally - // Otherwise pre-select the first choice in the array if it's a single select - var shouldPreselect = _this23._isSelectOneElement && !hasSelectedChoice && index === 0; - var isSelected = shouldPreselect ? true : choice.selected; - var isDisabled = shouldPreselect ? false : choice.disabled; - - _this23._addChoice({ - value: value, - label: label, - isSelected: isSelected, - isDisabled: isDisabled, - customProperties: customProperties, - placeholder: placeholder - }); - } - } else { - _this23._addChoice({ - value: value, - label: label, - isSelected: choice.selected, - isDisabled: choice.disabled, - customProperties: customProperties, - placeholder: placeholder - }); - } - }; // Add each choice - - - allChoices.forEach(function (choice, index) { - return handleChoice(choice, index); - }); - } - - this._setLoading(false); - } - }, { - key: "_addPredefinedItems", - value: function _addPredefinedItems() { - var _this24 = this; - - var handlePresetItem = function handlePresetItem(item) { - var itemType = (0, _utils.getType)(item); - - if (itemType === 'Object' && item.value) { - _this24._addItem({ - value: item.value, - label: item.label, - choiceId: item.id, - customProperties: item.customProperties, - placeholder: item.placeholder - }); - } else if (itemType === 'String') { - _this24._addItem({ - value: item - }); - } - }; - - this._presetItems.forEach(function (item) { - return handlePresetItem(item); - }); - } - }, { - key: "_setChoiceOrItem", - value: function _setChoiceOrItem(item) { - var _this25 = this; - - var itemType = (0, _utils.getType)(item).toLowerCase(); - var handleType = { - object: function object() { - if (!item.value) { - return; - } // If we are dealing with a select input, we need to create an option first - // that is then selected. For text inputs we can just add items normally. - - - if (!_this25._isTextElement) { - _this25._addChoice({ - value: item.value, - label: item.label, - isSelected: true, - isDisabled: false, - customProperties: item.customProperties, - placeholder: item.placeholder - }); - } else { - _this25._addItem({ - value: item.value, - label: item.label, - choiceId: item.id, - customProperties: item.customProperties, - placeholder: item.placeholder - }); - } - }, - string: function string() { - if (!_this25._isTextElement) { - _this25._addChoice({ - value: item, - label: item, - isSelected: true, - isDisabled: false - }); - } else { - _this25._addItem({ - value: item - }); - } - } - }; - handleType[itemType](); - } - }, { - key: "_findAndSelectChoiceByValue", - value: function _findAndSelectChoiceByValue(val) { - var _this26 = this; - - var choices = this._store.choices; // Check 'value' property exists and the choice isn't already selected - - var foundChoice = choices.find(function (choice) { - return _this26.config.itemComparer(choice.value, val); - }); - - if (foundChoice && !foundChoice.selected) { - this._addItem({ - value: foundChoice.value, - label: foundChoice.label, - choiceId: foundChoice.id, - groupId: foundChoice.groupId, - customProperties: foundChoice.customProperties, - placeholder: foundChoice.placeholder, - keyCode: foundChoice.keyCode - }); - } - } - }, { - key: "_generateInstances", - value: function _generateInstances(elements, config) { - return elements.reduce(function (instances, element) { - instances.push(new Choices(element, config)); - return instances; - }, [this]); - } - }, { - key: "_generatePlaceholderValue", - value: function _generatePlaceholderValue() { - if (this._isSelectOneElement) { - return false; - } - - return this.config.placeholder ? this.config.placeholderValue || this.passedElement.element.getAttribute('placeholder') : false; - } - /* ===== End of Private functions ====== */ - - }]); - - return Choices; -}(); - -Choices.userDefaults = {}; // We cannot export default here due to Webpack: https://github.com/webpack/webpack/issues/3929 - -module.exports = Choices; - -/***/ }), -/* 10 */ /***/ (function(module, exports, __webpack_require__) { /*! @@ -4813,109 +1398,41 @@ module.exports = Fuse; }); /***/ }), -/* 11 */ +/* 4 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -__webpack_require__.r(__webpack_exports__); -var isMergeableObject = function isMergeableObject(value) { - return isNonNullObject(value) - && !isSpecial(value) -}; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return symbolObservablePonyfill; }); +function symbolObservablePonyfill(root) { + var result; + var Symbol = root.Symbol; -function isNonNullObject(value) { - return !!value && typeof value === 'object' -} - -function isSpecial(value) { - var stringValue = Object.prototype.toString.call(value); - - return stringValue === '[object RegExp]' - || stringValue === '[object Date]' - || isReactElement(value) -} - -// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 -var canUseSymbol = typeof Symbol === 'function' && Symbol.for; -var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; - -function isReactElement(value) { - return value.$$typeof === REACT_ELEMENT_TYPE -} - -function emptyTarget(val) { - return Array.isArray(val) ? [] : {} -} - -function cloneUnlessOtherwiseSpecified(value, options) { - return (options.clone !== false && options.isMergeableObject(value)) - ? deepmerge(emptyTarget(value), value, options) - : value -} - -function defaultArrayMerge(target, source, options) { - return target.concat(source).map(function(element) { - return cloneUnlessOtherwiseSpecified(element, options) - }) -} - -function mergeObject(target, source, options) { - var destination = {}; - if (options.isMergeableObject(target)) { - Object.keys(target).forEach(function(key) { - destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); - }); - } - Object.keys(source).forEach(function(key) { - if (!options.isMergeableObject(source[key]) || !target[key]) { - destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); + if (typeof Symbol === 'function') { + if (Symbol.observable) { + result = Symbol.observable; } else { - destination[key] = deepmerge(target[key], source[key], options); + result = Symbol('observable'); + Symbol.observable = result; } - }); - return destination -} - -function deepmerge(target, source, options) { - options = options || {}; - options.arrayMerge = options.arrayMerge || defaultArrayMerge; - options.isMergeableObject = options.isMergeableObject || isMergeableObject; - - var sourceIsArray = Array.isArray(source); - var targetIsArray = Array.isArray(target); - var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; - - if (!sourceAndTargetTypesMatch) { - return cloneUnlessOtherwiseSpecified(source, options) - } else if (sourceIsArray) { - return options.arrayMerge(target, source, options) } else { - return mergeObject(target, source, options) - } -} - -deepmerge.all = function deepmergeAll(array, options) { - if (!Array.isArray(array)) { - throw new Error('first argument should be an array') + result = '@@observable'; } - return array.reduce(function(prev, next) { - return deepmerge(prev, next, options) - }, {}) + return result; }; -var deepmerge_1 = deepmerge; - -/* harmony default export */ __webpack_exports__["default"] = (deepmerge_1); - /***/ }), -/* 12 */ +/* 5 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +module.exports = __webpack_require__(9); +/***/ }), +/* 6 */ +/***/ (function(module, exports) { + window.delegateEvent = function delegateEvent() { var events; var addedListenerTypes; @@ -4965,36 +1482,1241 @@ window.delegateEvent = function delegateEvent() { }(); /***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { +/* 7 */ +/***/ (function(module, exports) { + +var g; + +// This works in non-strict mode +g = (function() { + return this; +})(); + +try { + // This works if eval is allowed (see CSP) + g = g || new Function("return this")(); +} catch (e) { + // This works if the window reference is available + if (typeof window === "object") g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; + + +/***/ }), +/* 8 */ +/***/ (function(module, exports) { + +module.exports = function(originalModule) { + if (!originalModule.webpackPolyfill) { + var module = Object.create(originalModule); + // module.parent = undefined by default + if (!module.children) module.children = []; + Object.defineProperty(module, "loaded", { + enumerable: true, + get: function() { + return module.l; + } + }); + Object.defineProperty(module, "id", { + enumerable: true, + get: function() { + return module.i; + } + }); + Object.defineProperty(module, "exports", { + enumerable: true + }); + module.webpackPolyfill = 1; + } + return module; +}; + + +/***/ }), +/* 9 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; +__webpack_require__.r(__webpack_exports__); + +// EXTERNAL MODULE: ./node_modules/fuse.js/dist/fuse.js +var dist_fuse = __webpack_require__(3); +var fuse_default = /*#__PURE__*/__webpack_require__.n(dist_fuse); + +// EXTERNAL MODULE: ./node_modules/deepmerge/dist/cjs.js +var cjs = __webpack_require__(1); +var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs); + +// EXTERNAL MODULE: ./src/scripts/lib/delegate-events.js +var delegate_events = __webpack_require__(6); + +// EXTERNAL MODULE: ./node_modules/symbol-observable/es/index.js +var es = __webpack_require__(2); + +// CONCATENATED MODULE: ./node_modules/redux/es/redux.js -Object.defineProperty(exports, "__esModule", { - value: true +/** + * These are private action types reserved by Redux. + * For any unknown actions, you must return the current state. + * If the current state is undefined, you must return the initial state. + * Do not reference these action types directly in your code. + */ +var randomString = function randomString() { + return Math.random().toString(36).substring(7).split('').join('.'); +}; + +var ActionTypes = { + INIT: "@@redux/INIT" + randomString(), + REPLACE: "@@redux/REPLACE" + randomString(), + PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() { + return "@@redux/PROBE_UNKNOWN_ACTION" + randomString(); + } +}; + +/** + * @param {any} obj The object to inspect. + * @returns {boolean} True if the argument appears to be a plain object. + */ +function isPlainObject(obj) { + if (typeof obj !== 'object' || obj === null) return false; + var proto = obj; + + while (Object.getPrototypeOf(proto) !== null) { + proto = Object.getPrototypeOf(proto); + } + + return Object.getPrototypeOf(obj) === proto; +} + +/** + * Creates a Redux store that holds the state tree. + * The only way to change the data in the store is to call `dispatch()` on it. + * + * There should only be a single store in your app. To specify how different + * parts of the state tree respond to actions, you may combine several reducers + * into a single reducer function by using `combineReducers`. + * + * @param {Function} reducer A function that returns the next state tree, given + * the current state tree and the action to handle. + * + * @param {any} [preloadedState] The initial state. You may optionally specify it + * to hydrate the state from the server in universal apps, or to restore a + * previously serialized user session. + * If you use `combineReducers` to produce the root reducer function, this must be + * an object with the same shape as `combineReducers` keys. + * + * @param {Function} [enhancer] The store enhancer. You may optionally specify it + * to enhance the store with third-party capabilities such as middleware, + * time travel, persistence, etc. The only store enhancer that ships with Redux + * is `applyMiddleware()`. + * + * @returns {Store} A Redux store that lets you read the state, dispatch actions + * and subscribe to changes. + */ + +function createStore(reducer, preloadedState, enhancer) { + var _ref2; + + if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') { + throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function.'); + } + + if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') { + enhancer = preloadedState; + preloadedState = undefined; + } + + if (typeof enhancer !== 'undefined') { + if (typeof enhancer !== 'function') { + throw new Error('Expected the enhancer to be a function.'); + } + + return enhancer(createStore)(reducer, preloadedState); + } + + if (typeof reducer !== 'function') { + throw new Error('Expected the reducer to be a function.'); + } + + var currentReducer = reducer; + var currentState = preloadedState; + var currentListeners = []; + var nextListeners = currentListeners; + var isDispatching = false; + /** + * This makes a shallow copy of currentListeners so we can use + * nextListeners as a temporary list while dispatching. + * + * This prevents any bugs around consumers calling + * subscribe/unsubscribe in the middle of a dispatch. + */ + + function ensureCanMutateNextListeners() { + if (nextListeners === currentListeners) { + nextListeners = currentListeners.slice(); + } + } + /** + * Reads the state tree managed by the store. + * + * @returns {any} The current state tree of your application. + */ + + + function getState() { + if (isDispatching) { + throw new Error('You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.'); + } + + return currentState; + } + /** + * Adds a change listener. It will be called any time an action is dispatched, + * and some part of the state tree may potentially have changed. You may then + * call `getState()` to read the current state tree inside the callback. + * + * You may call `dispatch()` from a change listener, with the following + * caveats: + * + * 1. The subscriptions are snapshotted just before every `dispatch()` call. + * If you subscribe or unsubscribe while the listeners are being invoked, this + * will not have any effect on the `dispatch()` that is currently in progress. + * However, the next `dispatch()` call, whether nested or not, will use a more + * recent snapshot of the subscription list. + * + * 2. The listener should not expect to see all state changes, as the state + * might have been updated multiple times during a nested `dispatch()` before + * the listener is called. It is, however, guaranteed that all subscribers + * registered before the `dispatch()` started will be called with the latest + * state by the time it exits. + * + * @param {Function} listener A callback to be invoked on every dispatch. + * @returns {Function} A function to remove this change listener. + */ + + + function subscribe(listener) { + if (typeof listener !== 'function') { + throw new Error('Expected the listener to be a function.'); + } + + if (isDispatching) { + throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.'); + } + + var isSubscribed = true; + ensureCanMutateNextListeners(); + nextListeners.push(listener); + return function unsubscribe() { + if (!isSubscribed) { + return; + } + + if (isDispatching) { + throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.'); + } + + isSubscribed = false; + ensureCanMutateNextListeners(); + var index = nextListeners.indexOf(listener); + nextListeners.splice(index, 1); + }; + } + /** + * Dispatches an action. It is the only way to trigger a state change. + * + * The `reducer` function, used to create the store, will be called with the + * current state tree and the given `action`. Its return value will + * be considered the **next** state of the tree, and the change listeners + * will be notified. + * + * The base implementation only supports plain object actions. If you want to + * dispatch a Promise, an Observable, a thunk, or something else, you need to + * wrap your store creating function into the corresponding middleware. For + * example, see the documentation for the `redux-thunk` package. Even the + * middleware will eventually dispatch plain object actions using this method. + * + * @param {Object} action A plain object representing “what changed”. It is + * a good idea to keep actions serializable so you can record and replay user + * sessions, or use the time travelling `redux-devtools`. An action must have + * a `type` property which may not be `undefined`. It is a good idea to use + * string constants for action types. + * + * @returns {Object} For convenience, the same action object you dispatched. + * + * Note that, if you use a custom middleware, it may wrap `dispatch()` to + * return something else (for example, a Promise you can await). + */ + + + function dispatch(action) { + if (!isPlainObject(action)) { + throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.'); + } + + if (typeof action.type === 'undefined') { + throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?'); + } + + if (isDispatching) { + throw new Error('Reducers may not dispatch actions.'); + } + + try { + isDispatching = true; + currentState = currentReducer(currentState, action); + } finally { + isDispatching = false; + } + + var listeners = currentListeners = nextListeners; + + for (var i = 0; i < listeners.length; i++) { + var listener = listeners[i]; + listener(); + } + + return action; + } + /** + * Replaces the reducer currently used by the store to calculate the state. + * + * You might need this if your app implements code splitting and you want to + * load some of the reducers dynamically. You might also need this if you + * implement a hot reloading mechanism for Redux. + * + * @param {Function} nextReducer The reducer for the store to use instead. + * @returns {void} + */ + + + function replaceReducer(nextReducer) { + if (typeof nextReducer !== 'function') { + throw new Error('Expected the nextReducer to be a function.'); + } + + currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT. + // Any reducers that existed in both the new and old rootReducer + // will receive the previous state. This effectively populates + // the new state tree with any relevant data from the old one. + + dispatch({ + type: ActionTypes.REPLACE + }); + } + /** + * Interoperability point for observable/reactive libraries. + * @returns {observable} A minimal observable of state changes. + * For more information, see the observable proposal: + * https://github.com/tc39/proposal-observable + */ + + + function observable() { + var _ref; + + var outerSubscribe = subscribe; + return _ref = { + /** + * The minimal observable subscription method. + * @param {Object} observer Any object that can be used as an observer. + * The observer object should have a `next` method. + * @returns {subscription} An object with an `unsubscribe` method that can + * be used to unsubscribe the observable from the store, and prevent further + * emission of values from the observable. + */ + subscribe: function subscribe(observer) { + if (typeof observer !== 'object' || observer === null) { + throw new TypeError('Expected the observer to be an object.'); + } + + function observeState() { + if (observer.next) { + observer.next(getState()); + } + } + + observeState(); + var unsubscribe = outerSubscribe(observeState); + return { + unsubscribe: unsubscribe + }; + } + }, _ref[es["a" /* default */]] = function () { + return this; + }, _ref; + } // When a store is created, an "INIT" action is dispatched so that every + // reducer returns their initial state. This effectively populates + // the initial state tree. + + + dispatch({ + type: ActionTypes.INIT + }); + return _ref2 = { + dispatch: dispatch, + subscribe: subscribe, + getState: getState, + replaceReducer: replaceReducer + }, _ref2[es["a" /* default */]] = observable, _ref2; +} + +/** + * Prints a warning in the console if it exists. + * + * @param {String} message The warning message. + * @returns {void} + */ +function warning(message) { + /* eslint-disable no-console */ + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error(message); + } + /* eslint-enable no-console */ + + + try { + // This error was thrown as a convenience so that if you enable + // "break on all exceptions" in your console, + // it would pause the execution at this line. + throw new Error(message); + } catch (e) {} // eslint-disable-line no-empty + +} + +function getUndefinedStateErrorMessage(key, action) { + var actionType = action && action.type; + var actionDescription = actionType && "action \"" + String(actionType) + "\"" || 'an action'; + return "Given " + actionDescription + ", reducer \"" + key + "\" returned undefined. " + "To ignore an action, you must explicitly return the previous state. " + "If you want this reducer to hold no value, you can return null instead of undefined."; +} + +function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) { + var reducerKeys = Object.keys(reducers); + var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer'; + + if (reducerKeys.length === 0) { + return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.'; + } + + if (!isPlainObject(inputState)) { + return "The " + argumentName + " has unexpected type of \"" + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\""); + } + + var unexpectedKeys = Object.keys(inputState).filter(function (key) { + return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]; + }); + unexpectedKeys.forEach(function (key) { + unexpectedKeyCache[key] = true; + }); + if (action && action.type === ActionTypes.REPLACE) return; + + if (unexpectedKeys.length > 0) { + return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored."); + } +} + +function assertReducerShape(reducers) { + Object.keys(reducers).forEach(function (key) { + var reducer = reducers[key]; + var initialState = reducer(undefined, { + type: ActionTypes.INIT + }); + + if (typeof initialState === 'undefined') { + throw new Error("Reducer \"" + key + "\" returned undefined during initialization. " + "If the state passed to the reducer is undefined, you must " + "explicitly return the initial state. The initial state may " + "not be undefined. If you don't want to set a value for this reducer, " + "you can use null instead of undefined."); + } + + if (typeof reducer(undefined, { + type: ActionTypes.PROBE_UNKNOWN_ACTION() + }) === 'undefined') { + throw new Error("Reducer \"" + key + "\" returned undefined when probed with a random type. " + ("Don't try to handle " + ActionTypes.INIT + " or other actions in \"redux/*\" ") + "namespace. They are considered private. Instead, you must return the " + "current state for any unknown actions, unless it is undefined, " + "in which case you must return the initial state, regardless of the " + "action type. The initial state may not be undefined, but can be null."); + } + }); +} +/** + * Turns an object whose values are different reducer functions, into a single + * reducer function. It will call every child reducer, and gather their results + * into a single state object, whose keys correspond to the keys of the passed + * reducer functions. + * + * @param {Object} reducers An object whose values correspond to different + * reducer functions that need to be combined into one. One handy way to obtain + * it is to use ES6 `import * as reducers` syntax. The reducers may never return + * undefined for any action. Instead, they should return their initial state + * if the state passed to them was undefined, and the current state for any + * unrecognized action. + * + * @returns {Function} A reducer function that invokes every reducer inside the + * passed object, and builds a state object with the same shape. + */ + + +function combineReducers(reducers) { + var reducerKeys = Object.keys(reducers); + var finalReducers = {}; + + for (var i = 0; i < reducerKeys.length; i++) { + var key = reducerKeys[i]; + + if (false) {} + + if (typeof reducers[key] === 'function') { + finalReducers[key] = reducers[key]; + } + } + + var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same + // keys multiple times. + + var unexpectedKeyCache; + + if (false) {} + + var shapeAssertionError; + + try { + assertReducerShape(finalReducers); + } catch (e) { + shapeAssertionError = e; + } + + return function combination(state, action) { + if (state === void 0) { + state = {}; + } + + if (shapeAssertionError) { + throw shapeAssertionError; + } + + if (false) { var warningMessage; } + + var hasChanged = false; + var nextState = {}; + + for (var _i = 0; _i < finalReducerKeys.length; _i++) { + var _key = finalReducerKeys[_i]; + var reducer = finalReducers[_key]; + var previousStateForKey = state[_key]; + var nextStateForKey = reducer(previousStateForKey, action); + + if (typeof nextStateForKey === 'undefined') { + var errorMessage = getUndefinedStateErrorMessage(_key, action); + throw new Error(errorMessage); + } + + nextState[_key] = nextStateForKey; + hasChanged = hasChanged || nextStateForKey !== previousStateForKey; + } + + return hasChanged ? nextState : state; + }; +} + +function bindActionCreator(actionCreator, dispatch) { + return function () { + return dispatch(actionCreator.apply(this, arguments)); + }; +} +/** + * Turns an object whose values are action creators, into an object with the + * same keys, but with every function wrapped into a `dispatch` call so they + * may be invoked directly. This is just a convenience method, as you can call + * `store.dispatch(MyActionCreators.doSomething())` yourself just fine. + * + * For convenience, you can also pass an action creator as the first argument, + * and get a dispatch wrapped function in return. + * + * @param {Function|Object} actionCreators An object whose values are action + * creator functions. One handy way to obtain it is to use ES6 `import * as` + * syntax. You may also pass a single function. + * + * @param {Function} dispatch The `dispatch` function available on your Redux + * store. + * + * @returns {Function|Object} The object mimicking the original object, but with + * every action creator wrapped into the `dispatch` call. If you passed a + * function as `actionCreators`, the return value will also be a single + * function. + */ + + +function bindActionCreators(actionCreators, dispatch) { + if (typeof actionCreators === 'function') { + return bindActionCreator(actionCreators, dispatch); + } + + if (typeof actionCreators !== 'object' || actionCreators === null) { + throw new Error("bindActionCreators expected an object or a function, instead received " + (actionCreators === null ? 'null' : typeof actionCreators) + ". " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?"); + } + + var boundActionCreators = {}; + + for (var key in actionCreators) { + var actionCreator = actionCreators[key]; + + if (typeof actionCreator === 'function') { + boundActionCreators[key] = bindActionCreator(actionCreator, dispatch); + } + } + + return boundActionCreators; +} + +function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + + return obj; +} + +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + + if (Object.getOwnPropertySymbols) { + keys.push.apply(keys, Object.getOwnPropertySymbols(object)); + } + + if (enumerableOnly) keys = keys.filter(function (sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + return keys; +} + +function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + + if (i % 2) { + ownKeys(source, true).forEach(function (key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(source).forEach(function (key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } + + return target; +} + +/** + * Composes single-argument functions from right to left. The rightmost + * function can take multiple arguments as it provides the signature for + * the resulting composite function. + * + * @param {...Function} funcs The functions to compose. + * @returns {Function} A function obtained by composing the argument functions + * from right to left. For example, compose(f, g, h) is identical to doing + * (...args) => f(g(h(...args))). + */ +function compose() { + for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) { + funcs[_key] = arguments[_key]; + } + + if (funcs.length === 0) { + return function (arg) { + return arg; + }; + } + + if (funcs.length === 1) { + return funcs[0]; + } + + return funcs.reduce(function (a, b) { + return function () { + return a(b.apply(void 0, arguments)); + }; + }); +} + +/** + * Creates a store enhancer that applies middleware to the dispatch method + * of the Redux store. This is handy for a variety of tasks, such as expressing + * asynchronous actions in a concise manner, or logging every action payload. + * + * See `redux-thunk` package as an example of the Redux middleware. + * + * Because middleware is potentially asynchronous, this should be the first + * store enhancer in the composition chain. + * + * Note that each middleware will be given the `dispatch` and `getState` functions + * as named arguments. + * + * @param {...Function} middlewares The middleware chain to be applied. + * @returns {Function} A store enhancer applying the middleware. + */ + +function applyMiddleware() { + for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) { + middlewares[_key] = arguments[_key]; + } + + return function (createStore) { + return function () { + var store = createStore.apply(void 0, arguments); + + var _dispatch = function dispatch() { + throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.'); + }; + + var middlewareAPI = { + getState: store.getState, + dispatch: function dispatch() { + return _dispatch.apply(void 0, arguments); + } + }; + var chain = middlewares.map(function (middleware) { + return middleware(middlewareAPI); + }); + _dispatch = compose.apply(void 0, chain)(store.dispatch); + return _objectSpread2({}, store, { + dispatch: _dispatch + }); + }; + }; +} + +/* + * This is a dummy function to check if the function name has been altered by minification. + * If the function has been minified and NODE_ENV !== 'production', warn the user. + */ + +function isCrushed() {} + +if (false) {} + + + +// CONCATENATED MODULE: ./src/scripts/reducers/items.js +var defaultState = []; +function items_items(state, action) { + if (state === void 0) { + state = defaultState; + } + + switch (action.type) { + case 'ADD_ITEM': + { + // Add object to items array + var newState = [].concat(state, [{ + id: action.id, + choiceId: action.choiceId, + groupId: action.groupId, + value: action.value, + label: action.label, + active: true, + highlighted: false, + customProperties: action.customProperties, + placeholder: action.placeholder || false, + keyCode: null + }]); + return newState.map(function (obj) { + var item = obj; + item.highlighted = false; + return item; + }); + } + + case 'REMOVE_ITEM': + { + // Set item to inactive + return state.map(function (obj) { + var item = obj; + + if (item.id === action.id) { + item.active = false; + } + + return item; + }); + } + + case 'HIGHLIGHT_ITEM': + { + return state.map(function (obj) { + var item = obj; + + if (item.id === action.id) { + item.highlighted = action.highlighted; + } + + return item; + }); + } + + default: + { + return state; + } + } +} +// CONCATENATED MODULE: ./src/scripts/reducers/groups.js +var groups_defaultState = []; +function groups(state, action) { + if (state === void 0) { + state = groups_defaultState; + } + + switch (action.type) { + case 'ADD_GROUP': + { + return [].concat(state, [{ + id: action.id, + value: action.value, + active: action.active, + disabled: action.disabled + }]); + } + + case 'CLEAR_CHOICES': + { + return []; + } + + default: + { + return state; + } + } +} +// CONCATENATED MODULE: ./src/scripts/reducers/choices.js +var choices_defaultState = []; +function choices_choices(state, action) { + if (state === void 0) { + state = choices_defaultState; + } + + switch (action.type) { + case 'ADD_CHOICE': + { + /* + A disabled choice appears in the choice dropdown but cannot be selected + A selected choice has been added to the passed input's value (added as an item) + An active choice appears within the choice dropdown + */ + return [].concat(state, [{ + id: action.id, + elementId: action.elementId, + groupId: action.groupId, + value: action.value, + label: action.label || action.value, + disabled: action.disabled || false, + selected: false, + active: true, + score: 9999, + customProperties: action.customProperties, + placeholder: action.placeholder || false, + keyCode: null + }]); + } + + case 'ADD_ITEM': + { + // If all choices need to be activated + if (action.activateOptions) { + return state.map(function (obj) { + var choice = obj; + choice.active = action.active; + return choice; + }); + } // When an item is added and it has an associated choice, + // we want to disable it so it can't be chosen again + + + if (action.choiceId > -1) { + return state.map(function (obj) { + var choice = obj; + + if (choice.id === parseInt(action.choiceId, 10)) { + choice.selected = true; + } + + return choice; + }); + } + + return state; + } + + case 'REMOVE_ITEM': + { + // When an item is removed and it has an associated choice, + // we want to re-enable it so it can be chosen again + if (action.choiceId > -1) { + return state.map(function (obj) { + var choice = obj; + + if (choice.id === parseInt(action.choiceId, 10)) { + choice.selected = false; + } + + return choice; + }); + } + + return state; + } + + case 'FILTER_CHOICES': + { + return state.map(function (obj) { + var choice = obj; // Set active state based on whether choice is + // within filtered results + + choice.active = action.results.some(function (_ref) { + var item = _ref.item, + score = _ref.score; + + if (item.id === choice.id) { + choice.score = score; + return true; + } + + return false; + }); + return choice; + }); + } + + case 'ACTIVATE_CHOICES': + { + return state.map(function (obj) { + var choice = obj; + choice.active = action.active; + return choice; + }); + } + + case 'CLEAR_CHOICES': + { + return choices_defaultState; + } + + default: + { + return state; + } + } +} +// CONCATENATED MODULE: ./src/scripts/reducers/general.js +var general_defaultState = { + loading: false +}; + +var general = function general(state, action) { + if (state === void 0) { + state = general_defaultState; + } + + switch (action.type) { + case 'SET_IS_LOADING': + { + return { + loading: action.isLoading + }; + } + + default: + { + return state; + } + } +}; + +/* harmony default export */ var reducers_general = (general); +// CONCATENATED MODULE: ./src/scripts/lib/utils.js +var utils_this = undefined; + +var getRandomNumber = function getRandomNumber(min, max) { + return Math.floor(Math.random() * (max - min) + min); +}; +var generateChars = function generateChars(length) { + var chars = ''; + + for (var i = 0; i < length; i++) { + var randomChar = getRandomNumber(0, 36); + chars += randomChar.toString(36); + } + + return chars; +}; +var generateId = function generateId(element, prefix) { + var id = element.id || element.name && element.name + "-" + generateChars(2) || generateChars(4); + id = id.replace(/(:|\.|\[|\]|,)/g, ''); + id = prefix + "-" + id; + return id; +}; +var getType = function getType(obj) { + return Object.prototype.toString.call(obj).slice(8, -1); +}; +var isType = function isType(type, obj) { + return obj !== undefined && obj !== null && getType(obj) === type; +}; +var isElement = function isElement(element) { + return element instanceof Element; +}; +var utils_wrap = function wrap(element, wrapper) { + if (wrapper === void 0) { + wrapper = document.createElement('div'); + } + + if (element.nextSibling) { + element.parentNode.insertBefore(wrapper, element.nextSibling); + } else { + element.parentNode.appendChild(wrapper); + } + + return wrapper.appendChild(element); +}; +var findAncestorByAttrName = function findAncestorByAttrName(el, attr) { + var target = el; + + while (target) { + if (target.hasAttribute(attr)) { + return target; + } + + target = target.parentElement; + } + + return null; +}; +var getAdjacentEl = function getAdjacentEl(startEl, className, direction) { + if (direction === void 0) { + direction = 1; + } + + if (!startEl || !className) { + return; + } + + var parent = startEl.parentNode.parentNode; + var children = Array.from(parent.querySelectorAll(className)); + var startPos = children.indexOf(startEl); + var operatorDirection = direction > 0 ? 1 : -1; + return children[startPos + operatorDirection]; +}; +var isScrolledIntoView = function isScrolledIntoView(el, parent, direction) { + if (direction === void 0) { + direction = 1; + } + + if (!el) { + return; + } + + var isVisible; + + if (direction > 0) { + // In view from bottom + isVisible = parent.scrollTop + parent.offsetHeight >= el.offsetTop + el.offsetHeight; + } else { + // In view from top + isVisible = el.offsetTop >= parent.scrollTop; + } + + return isVisible; +}; +var sanitise = function sanitise(value) { + if (!isType('String', value)) { + return value; + } + + return value.replace(/&/g, '&').replace(/>/g, '&rt;').replace(/" + sanitise(value) + ""); + testEl.style.position = 'absolute'; + testEl.style.padding = '0'; + testEl.style.top = '-9999px'; + testEl.style.left = '-9999px'; + testEl.style.width = 'auto'; + testEl.style.whiteSpace = 'pre'; + + if (document.body.contains(input) && window.getComputedStyle) { + var inputStyle = window.getComputedStyle(input); + + if (inputStyle) { + testEl.style.fontSize = inputStyle.fontSize; + testEl.style.fontFamily = inputStyle.fontFamily; + testEl.style.fontWeight = inputStyle.fontWeight; + testEl.style.fontStyle = inputStyle.fontStyle; + testEl.style.letterSpacing = inputStyle.letterSpacing; + testEl.style.textTransform = inputStyle.textTransform; + testEl.style.paddingLeft = inputStyle.paddingLeft; + testEl.style.paddingRight = inputStyle.paddingRight; + } + } + + document.body.appendChild(testEl); + requestAnimationFrame(function () { + if (value && testEl.offsetWidth !== input.offsetWidth) { + width = testEl.offsetWidth + 4; + } + + document.body.removeChild(testEl); + callback.call(utils_this, width + "px"); + }); + } else { + callback.call(utils_this, width + "px"); + } +}; +var sortByAlpha = function sortByAlpha(a, b) { + var labelA = ("" + (a.label || a.value)).toLowerCase(); + var labelB = ("" + (b.label || b.value)).toLowerCase(); + + if (labelA < labelB) { + return -1; + } + + if (labelA > labelB) { + return 1; + } + + return 0; +}; +var sortByScore = function sortByScore(a, b) { + return a.score - b.score; +}; +var dispatchEvent = function dispatchEvent(element, type, customArgs) { + if (customArgs === void 0) { + customArgs = null; + } + + var event = new CustomEvent(type, { + detail: customArgs, + bubbles: true, + cancelable: true + }); + return element.dispatchEvent(event); +}; +var getWindowHeight = function getWindowHeight() { + var _document = document, + body = _document.body; + var html = document.documentElement; + return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight); +}; +var fetchFromObject = function fetchFromObject(object, path) { + var index = path.indexOf('.'); + + if (index > -1) { + return fetchFromObject(object[path.substring(0, index)], path.substr(index + 1)); + } + + return object[path]; +}; +var isIE11 = function isIE11() { + return !!(navigator.userAgent.match(/Trident/) && navigator.userAgent.match(/rv[ :]11/)); +}; +var existsInArray = function existsInArray(array, value, key) { + if (key === void 0) { + key = 'value'; + } + + return array.some(function (item) { + if (isType('String', value)) { + return item[key] === value.trim(); + } + + return item[key] === value; + }); +}; +var cloneObject = function cloneObject(obj) { + return JSON.parse(JSON.stringify(obj)); +}; +var diff = function diff(a, b) { + var aKeys = Object.keys(a).sort(); + var bKeys = Object.keys(b).sort(); + return aKeys.filter(function (i) { + return bKeys.indexOf(i) < 0; + }); +}; +// CONCATENATED MODULE: ./src/scripts/reducers/index.js + + + + + + +var appReducer = combineReducers({ + items: items_items, + groups: groups, + choices: choices_choices, + general: reducers_general }); -exports.default = void 0; -var _redux = __webpack_require__(5); +var reducers_rootReducer = function rootReducer(passedState, action) { + var state = passedState; // If we are clearing all items, groups and options we reassign + // state and then pass that state to our proper reducer. This isn't + // mutating our actual state + // See: http://stackoverflow.com/a/35641992 -var _index = _interopRequireDefault(__webpack_require__(15)); + if (action.type === 'CLEAR_ALL') { + state = undefined; + } else if (action.type === 'RESET_TO') { + return cloneObject(action.state); + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + return appReducer(state, action); +}; +/* harmony default export */ var reducers = (reducers_rootReducer); +// CONCATENATED MODULE: ./src/scripts/store/store.js function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -var Store = + + + +var store_Store = /*#__PURE__*/ function () { function Store() { - _classCallCheck(this, Store); - - this._store = (0, _redux.createStore)(_index.default, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()); + this._store = createStore(reducers, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()); } /** * Subscribe store to function call (wrapped Redux method) @@ -5003,67 +2725,63 @@ function () { */ - _createClass(Store, [{ - key: "subscribe", - value: function subscribe(onChange) { - this._store.subscribe(onChange); - } - /** - * Dispatch event to store (wrapped Redux method) - * @param {Function} action Action function to trigger - * @return - */ + var _proto = Store.prototype; - }, { - key: "dispatch", - value: function dispatch(action) { - this._store.dispatch(action); - } - /** - * Get store object (wrapping Redux method) - * @return {Object} State - */ + _proto.subscribe = function subscribe(onChange) { + this._store.subscribe(onChange); + } + /** + * Dispatch event to store (wrapped Redux method) + * @param {Function} action Action function to trigger + * @return + */ + ; - }, { - key: "isLoading", + _proto.dispatch = function dispatch(action) { + this._store.dispatch(action); + } + /** + * Get store object (wrapping Redux method) + * @return {Object} State + */ + ; - /** - * Get loading state from store - * @return {Boolean} Loading State - */ - value: function isLoading() { - return this.state.general.loading; - } - /** - * Get single choice by it's ID - * @return {Object} Found choice - */ + /** + * Get loading state from store + * @return {Boolean} Loading State + */ + _proto.isLoading = function isLoading() { + return this.state.general.loading; + } + /** + * Get single choice by it's ID + * @return {Object} Found choice + */ + ; - }, { - key: "getChoiceById", - value: function getChoiceById(id) { - if (id) { - return this.activeChoices.find(function (choice) { - return choice.id === parseInt(id, 10); - }); - } - - return false; - } - /** - * Get group by group id - * @param {Number} id Group ID - * @return {Object} Group data - */ - - }, { - key: "getGroupById", - value: function getGroupById(id) { - return this.groups.find(function (group) { - return group.id === parseInt(id, 10); + _proto.getChoiceById = function getChoiceById(id) { + if (id) { + return this.activeChoices.find(function (choice) { + return choice.id === parseInt(id, 10); }); } - }, { + + return false; + } + /** + * Get group by group id + * @param {Number} id Group ID + * @return {Object} Group data + */ + ; + + _proto.getGroupById = function getGroupById(id) { + return this.groups.find(function (group) { + return group.id === parseInt(id, 10); + }); + }; + + _createClass(Store, [{ key: "state", get: function get() { return this._store.getState(); @@ -5195,456 +2913,8 @@ function () { return Store; }(); -exports.default = Store; - -/***/ }), -/* 14 */ -/***/ (function(module, exports) { - -module.exports = function(originalModule) { - if (!originalModule.webpackPolyfill) { - var module = Object.create(originalModule); - // module.parent = undefined by default - if (!module.children) module.children = []; - Object.defineProperty(module, "loaded", { - enumerable: true, - get: function() { - return module.l; - } - }); - Object.defineProperty(module, "id", { - enumerable: true, - get: function() { - return module.i; - } - }); - Object.defineProperty(module, "exports", { - enumerable: true - }); - module.webpackPolyfill = 1; - } - return module; -}; - - -/***/ }), -/* 15 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _redux = __webpack_require__(5); - -var _items = _interopRequireDefault(__webpack_require__(16)); - -var _groups = _interopRequireDefault(__webpack_require__(17)); - -var _choices = _interopRequireDefault(__webpack_require__(18)); - -var _general = _interopRequireDefault(__webpack_require__(19)); - -var _utils = __webpack_require__(0); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -var appReducer = (0, _redux.combineReducers)({ - items: _items.default, - groups: _groups.default, - choices: _choices.default, - general: _general.default -}); - -var rootReducer = function rootReducer(passedState, action) { - var state = passedState; // If we are clearing all items, groups and options we reassign - // state and then pass that state to our proper reducer. This isn't - // mutating our actual state - // See: http://stackoverflow.com/a/35641992 - - if (action.type === 'CLEAR_ALL') { - state = undefined; - } else if (action.type === 'RESET_TO') { - return (0, _utils.cloneObject)(action.state); - } - - return appReducer(state, action); -}; - -var _default = rootReducer; -exports.default = _default; - -/***/ }), -/* 16 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = items; -exports.defaultState = void 0; -var defaultState = []; -exports.defaultState = defaultState; - -function items() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState; - var action = arguments.length > 1 ? arguments[1] : undefined; - - switch (action.type) { - case 'ADD_ITEM': - { - // Add object to items array - var newState = [].concat(state, [{ - id: action.id, - choiceId: action.choiceId, - groupId: action.groupId, - value: action.value, - label: action.label, - active: true, - highlighted: false, - customProperties: action.customProperties, - placeholder: action.placeholder || false, - keyCode: null - }]); - return newState.map(function (obj) { - var item = obj; - item.highlighted = false; - return item; - }); - } - - case 'REMOVE_ITEM': - { - // Set item to inactive - return state.map(function (obj) { - var item = obj; - - if (item.id === action.id) { - item.active = false; - } - - return item; - }); - } - - case 'HIGHLIGHT_ITEM': - { - return state.map(function (obj) { - var item = obj; - - if (item.id === action.id) { - item.highlighted = action.highlighted; - } - - return item; - }); - } - - default: - { - return state; - } - } -} - -/***/ }), -/* 17 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = groups; -exports.defaultState = void 0; -var defaultState = []; -exports.defaultState = defaultState; - -function groups() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState; - var action = arguments.length > 1 ? arguments[1] : undefined; - - switch (action.type) { - case 'ADD_GROUP': - { - return [].concat(state, [{ - id: action.id, - value: action.value, - active: action.active, - disabled: action.disabled - }]); - } - - case 'CLEAR_CHOICES': - { - return []; - } - - default: - { - return state; - } - } -} - -/***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = choices; -exports.defaultState = void 0; -var defaultState = []; -exports.defaultState = defaultState; - -function choices() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState; - var action = arguments.length > 1 ? arguments[1] : undefined; - - switch (action.type) { - case 'ADD_CHOICE': - { - /* - A disabled choice appears in the choice dropdown but cannot be selected - A selected choice has been added to the passed input's value (added as an item) - An active choice appears within the choice dropdown - */ - return [].concat(state, [{ - id: action.id, - elementId: action.elementId, - groupId: action.groupId, - value: action.value, - label: action.label || action.value, - disabled: action.disabled || false, - selected: false, - active: true, - score: 9999, - customProperties: action.customProperties, - placeholder: action.placeholder || false, - keyCode: null - }]); - } - - case 'ADD_ITEM': - { - // If all choices need to be activated - if (action.activateOptions) { - return state.map(function (obj) { - var choice = obj; - choice.active = action.active; - return choice; - }); - } // When an item is added and it has an associated choice, - // we want to disable it so it can't be chosen again - - - if (action.choiceId > -1) { - return state.map(function (obj) { - var choice = obj; - - if (choice.id === parseInt(action.choiceId, 10)) { - choice.selected = true; - } - - return choice; - }); - } - - return state; - } - - case 'REMOVE_ITEM': - { - // When an item is removed and it has an associated choice, - // we want to re-enable it so it can be chosen again - if (action.choiceId > -1) { - return state.map(function (obj) { - var choice = obj; - - if (choice.id === parseInt(action.choiceId, 10)) { - choice.selected = false; - } - - return choice; - }); - } - - return state; - } - - case 'FILTER_CHOICES': - { - return state.map(function (obj) { - var choice = obj; // Set active state based on whether choice is - // within filtered results - - choice.active = action.results.some(function (_ref) { - var item = _ref.item, - score = _ref.score; - - if (item.id === choice.id) { - choice.score = score; - return true; - } - - return false; - }); - return choice; - }); - } - - case 'ACTIVATE_CHOICES': - { - return state.map(function (obj) { - var choice = obj; - choice.active = action.active; - return choice; - }); - } - - case 'CLEAR_CHOICES': - { - return defaultState; - } - - default: - { - return state; - } - } -} - -/***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = exports.defaultState = void 0; -var defaultState = { - loading: false -}; -exports.defaultState = defaultState; - -var general = function general() { - var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState; - var action = arguments.length > 1 ? arguments[1] : undefined; - - switch (action.type) { - case 'SET_IS_LOADING': - { - return { - loading: action.isLoading - }; - } - - default: - { - return state; - } - } -}; - -var _default = general; -exports.default = _default; - -/***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "Dropdown", { - enumerable: true, - get: function get() { - return _dropdown.default; - } -}); -Object.defineProperty(exports, "Container", { - enumerable: true, - get: function get() { - return _container.default; - } -}); -Object.defineProperty(exports, "Input", { - enumerable: true, - get: function get() { - return _input.default; - } -}); -Object.defineProperty(exports, "List", { - enumerable: true, - get: function get() { - return _list.default; - } -}); -Object.defineProperty(exports, "WrappedInput", { - enumerable: true, - get: function get() { - return _wrappedInput.default; - } -}); -Object.defineProperty(exports, "WrappedSelect", { - enumerable: true, - get: function get() { - return _wrappedSelect.default; - } -}); - -var _dropdown = _interopRequireDefault(__webpack_require__(21)); - -var _container = _interopRequireDefault(__webpack_require__(22)); - -var _input = _interopRequireDefault(__webpack_require__(23)); - -var _list = _interopRequireDefault(__webpack_require__(24)); - -var _wrappedInput = _interopRequireDefault(__webpack_require__(25)); - -var _wrappedSelect = _interopRequireDefault(__webpack_require__(26)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -/***/ }), -/* 21 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } +// CONCATENATED MODULE: ./src/scripts/components/dropdown.js var Dropdown = /*#__PURE__*/ function () { @@ -5652,9 +2922,6 @@ function () { var element = _ref.element, type = _ref.type, classNames = _ref.classNames; - - _classCallCheck(this, Dropdown); - Object.assign(this, { element: element, type: type, @@ -5669,79 +2936,57 @@ function () { */ - _createClass(Dropdown, [{ - key: "distanceFromTopWindow", - value: function distanceFromTopWindow() { - this.dimensions = this.element.getBoundingClientRect(); - this.position = Math.ceil(this.dimensions.top + window.pageYOffset + this.element.offsetHeight); - return this.position; - } - /** - * Find element that matches passed selector - * @return {HTMLElement} - */ + var _proto = Dropdown.prototype; - }, { - key: "getChild", - value: function getChild(selector) { - return this.element.querySelector(selector); - } - /** - * Show dropdown to user by adding active state class - * @return {Object} Class instance - * @public - */ + _proto.distanceFromTopWindow = function distanceFromTopWindow() { + this.dimensions = this.element.getBoundingClientRect(); + this.position = Math.ceil(this.dimensions.top + window.pageYOffset + this.element.offsetHeight); + return this.position; + } + /** + * Find element that matches passed selector + * @return {HTMLElement} + */ + ; - }, { - key: "show", - value: function show() { - this.element.classList.add(this.classNames.activeState); - this.element.setAttribute('aria-expanded', 'true'); - this.isActive = true; - return this; - } - /** - * Hide dropdown from user - * @return {Object} Class instance - * @public - */ + _proto.getChild = function getChild(selector) { + return this.element.querySelector(selector); + } + /** + * Show dropdown to user by adding active state class + * @return {Object} Class instance + * @public + */ + ; - }, { - key: "hide", - value: function hide() { - this.element.classList.remove(this.classNames.activeState); - this.element.setAttribute('aria-expanded', 'false'); - this.isActive = false; - return this; - } - }]); + _proto.show = function show() { + this.element.classList.add(this.classNames.activeState); + this.element.setAttribute('aria-expanded', 'true'); + this.isActive = true; + return this; + } + /** + * Hide dropdown from user + * @return {Object} Class instance + * @public + */ + ; + + _proto.hide = function hide() { + this.element.classList.remove(this.classNames.activeState); + this.element.setAttribute('aria-expanded', 'false'); + this.isActive = false; + return this; + }; return Dropdown; }(); -exports.default = Dropdown; -/***/ }), -/* 22 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +// CONCATENATED MODULE: ./src/scripts/components/container.js -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _utils = __webpack_require__(0); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var Container = +var container_Container = /*#__PURE__*/ function () { function Container(_ref) { @@ -5749,9 +2994,6 @@ function () { type = _ref.type, classNames = _ref.classNames, position = _ref.position; - - _classCallCheck(this, Container); - Object.assign(this, { element: element, classNames: classNames, @@ -5771,226 +3013,196 @@ function () { */ - _createClass(Container, [{ - key: "addEventListeners", - value: function addEventListeners() { - this.element.addEventListener('focus', this._onFocus); - this.element.addEventListener('blur', this._onBlur); + var _proto = Container.prototype; + + _proto.addEventListeners = function addEventListeners() { + this.element.addEventListener('focus', this._onFocus); + this.element.addEventListener('blur', this._onBlur); + } + /** + * Remove event listeners + */ + + /** */ + ; + + _proto.removeEventListeners = function removeEventListeners() { + this.element.removeEventListener('focus', this._onFocus); + this.element.removeEventListener('blur', this._onBlur); + } + /** + * Determine whether container should be flipped + * based on passed dropdown position + * @param {Number} dropdownPos + * @returns + */ + ; + + _proto.shouldFlip = function shouldFlip(dropdownPos, windowHeight) { + if (windowHeight === void 0) { + windowHeight = getWindowHeight(); } - /** - * Remove event listeners - */ - /** */ + if (dropdownPos === undefined) { + return false; + } // If flip is enabled and the dropdown bottom position is + // greater than the window height flip the dropdown. - }, { - key: "removeEventListeners", - value: function removeEventListeners() { - this.element.removeEventListener('focus', this._onFocus); - this.element.removeEventListener('blur', this._onBlur); + + var shouldFlip = false; + + if (this.position === 'auto') { + shouldFlip = dropdownPos >= windowHeight; + } else if (this.position === 'top') { + shouldFlip = true; } - /** - * Determine whether container should be flipped - * based on passed dropdown position - * @param {Number} dropdownPos - * @returns - */ - }, { - key: "shouldFlip", - value: function shouldFlip(dropdownPos) { - var windowHeight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _utils.getWindowHeight)(); + return shouldFlip; + } + /** + * Set active descendant attribute + * @param {Number} activeDescendant ID of active descendant + */ + ; - if (dropdownPos === undefined) { - return false; - } // If flip is enabled and the dropdown bottom position is - // greater than the window height flip the dropdown. + _proto.setActiveDescendant = function setActiveDescendant(activeDescendantID) { + this.element.setAttribute('aria-activedescendant', activeDescendantID); + } + /** + * Remove active descendant attribute + */ + ; + _proto.removeActiveDescendant = function removeActiveDescendant() { + this.element.removeAttribute('aria-activedescendant'); + }; - var shouldFlip = false; + _proto.open = function open(dropdownPos) { + this.element.classList.add(this.classNames.openState); + this.element.setAttribute('aria-expanded', 'true'); + this.isOpen = true; - if (this.position === 'auto') { - shouldFlip = dropdownPos >= windowHeight; - } else if (this.position === 'top') { - shouldFlip = true; - } - - return shouldFlip; + if (this.shouldFlip(dropdownPos)) { + this.element.classList.add(this.classNames.flippedState); + this.isFlipped = true; } - /** - * Set active descendant attribute - * @param {Number} activeDescendant ID of active descendant - */ + }; - }, { - key: "setActiveDescendant", - value: function setActiveDescendant(activeDescendantID) { - this.element.setAttribute('aria-activedescendant', activeDescendantID); - } - /** - * Remove active descendant attribute - */ + _proto.close = function close() { + this.element.classList.remove(this.classNames.openState); + this.element.setAttribute('aria-expanded', 'false'); + this.removeActiveDescendant(); + this.isOpen = false; // A dropdown flips if it does not have space within the page - }, { - key: "removeActiveDescendant", - value: function removeActiveDescendant() { - this.element.removeAttribute('aria-activedescendant'); + if (this.isFlipped) { + this.element.classList.remove(this.classNames.flippedState); + this.isFlipped = false; } - }, { - key: "open", - value: function open(dropdownPos) { - this.element.classList.add(this.classNames.openState); - this.element.setAttribute('aria-expanded', 'true'); - this.isOpen = true; + }; - if (this.shouldFlip(dropdownPos)) { - this.element.classList.add(this.classNames.flippedState); - this.isFlipped = true; - } + _proto.focus = function focus() { + if (!this.isFocussed) { + this.element.focus(); } - }, { - key: "close", - value: function close() { - this.element.classList.remove(this.classNames.openState); - this.element.setAttribute('aria-expanded', 'false'); - this.removeActiveDescendant(); - this.isOpen = false; // A dropdown flips if it does not have space within the page + }; - if (this.isFlipped) { - this.element.classList.remove(this.classNames.flippedState); - this.isFlipped = false; - } - } - }, { - key: "focus", - value: function focus() { - if (!this.isFocussed) { - this.element.focus(); - } - } - }, { - key: "addFocusState", - value: function addFocusState() { - this.element.classList.add(this.classNames.focusState); - } - }, { - key: "removeFocusState", - value: function removeFocusState() { - this.element.classList.remove(this.classNames.focusState); - } - /** - * Remove disabled state - */ + _proto.addFocusState = function addFocusState() { + this.element.classList.add(this.classNames.focusState); + }; - }, { - key: "enable", - value: function enable() { - this.element.classList.remove(this.classNames.disabledState); - this.element.removeAttribute('aria-disabled'); + _proto.removeFocusState = function removeFocusState() { + this.element.classList.remove(this.classNames.focusState); + } + /** + * Remove disabled state + */ + ; - if (this.type === 'select-one') { - this.element.setAttribute('tabindex', '0'); - } + _proto.enable = function enable() { + this.element.classList.remove(this.classNames.disabledState); + this.element.removeAttribute('aria-disabled'); - this.isDisabled = false; + if (this.type === 'select-one') { + this.element.setAttribute('tabindex', '0'); } - /** - * Set disabled state - */ - }, { - key: "disable", - value: function disable() { - this.element.classList.add(this.classNames.disabledState); - this.element.setAttribute('aria-disabled', 'true'); + this.isDisabled = false; + } + /** + * Set disabled state + */ + ; - if (this.type === 'select-one') { - this.element.setAttribute('tabindex', '-1'); - } + _proto.disable = function disable() { + this.element.classList.add(this.classNames.disabledState); + this.element.setAttribute('aria-disabled', 'true'); - this.isDisabled = true; + if (this.type === 'select-one') { + this.element.setAttribute('tabindex', '-1'); } - }, { - key: "wrap", - value: function wrap(element) { - (0, _utils.wrap)(element, this.element); - } - }, { - key: "unwrap", - value: function unwrap(element) { - // Move passed element outside this element - this.element.parentNode.insertBefore(element, this.element); // Remove this element - this.element.parentNode.removeChild(this.element); - } - /** - * Add loading state to element - */ + this.isDisabled = true; + }; - }, { - key: "addLoadingState", - value: function addLoadingState() { - this.element.classList.add(this.classNames.loadingState); - this.element.setAttribute('aria-busy', 'true'); - this.isLoading = true; - } - /** - * Remove loading state from element - */ + _proto.wrap = function wrap(element) { + utils_wrap(element, this.element); + }; - }, { - key: "removeLoadingState", - value: function removeLoadingState() { - this.element.classList.remove(this.classNames.loadingState); - this.element.removeAttribute('aria-busy'); - this.isLoading = false; - } - /** - * Set focussed state - */ + _proto.unwrap = function unwrap(element) { + // Move passed element outside this element + this.element.parentNode.insertBefore(element, this.element); // Remove this element - }, { - key: "_onFocus", - value: function _onFocus() { - this.isFocussed = true; - } - /** - * Remove blurred state - */ + this.element.parentNode.removeChild(this.element); + } + /** + * Add loading state to element + */ + ; - }, { - key: "_onBlur", - value: function _onBlur() { - this.isFocussed = false; - } - }]); + _proto.addLoadingState = function addLoadingState() { + this.element.classList.add(this.classNames.loadingState); + this.element.setAttribute('aria-busy', 'true'); + this.isLoading = true; + } + /** + * Remove loading state from element + */ + ; + + _proto.removeLoadingState = function removeLoadingState() { + this.element.classList.remove(this.classNames.loadingState); + this.element.removeAttribute('aria-busy'); + this.isLoading = false; + } + /** + * Set focussed state + */ + ; + + _proto._onFocus = function _onFocus() { + this.isFocussed = true; + } + /** + * Remove blurred state + */ + ; + + _proto._onBlur = function _onBlur() { + this.isFocussed = false; + }; return Container; }(); -exports.default = Container; -/***/ }), -/* 23 */ -/***/ (function(module, exports, __webpack_require__) { +// CONCATENATED MODULE: ./src/scripts/components/input.js +function input_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -"use strict"; +function input_createClass(Constructor, protoProps, staticProps) { if (protoProps) input_defineProperties(Constructor.prototype, protoProps); if (staticProps) input_defineProperties(Constructor, staticProps); return Constructor; } -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -var _utils = __webpack_require__(0); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var Input = +var input_Input = /*#__PURE__*/ function () { function Input(_ref) { @@ -5998,9 +3210,6 @@ function () { type = _ref.type, classNames = _ref.classNames, placeholderValue = _ref.placeholderValue; - - _classCallCheck(this, Input); - Object.assign(this, { element: element, type: type, @@ -6017,147 +3226,136 @@ function () { this._onBlur = this._onBlur.bind(this); } - _createClass(Input, [{ - key: "addEventListeners", - value: function addEventListeners() { - this.element.addEventListener('input', this._onInput); - this.element.addEventListener('paste', this._onPaste); - this.element.addEventListener('focus', this._onFocus); - this.element.addEventListener('blur', this._onBlur); + var _proto = Input.prototype; - if (this.element.form) { - this.element.form.addEventListener('reset', this._onFormReset); - } + _proto.addEventListeners = function addEventListeners() { + this.element.addEventListener('input', this._onInput); + this.element.addEventListener('paste', this._onPaste); + this.element.addEventListener('focus', this._onFocus); + this.element.addEventListener('blur', this._onBlur); + + if (this.element.form) { + this.element.form.addEventListener('reset', this._onFormReset); } - }, { - key: "removeEventListeners", - value: function removeEventListeners() { - this.element.removeEventListener('input', this._onInput); - this.element.removeEventListener('paste', this._onPaste); - this.element.removeEventListener('focus', this._onFocus); - this.element.removeEventListener('blur', this._onBlur); + }; - if (this.element.form) { - this.element.form.removeEventListener('reset', this._onFormReset); - } + _proto.removeEventListeners = function removeEventListeners() { + this.element.removeEventListener('input', this._onInput); + this.element.removeEventListener('paste', this._onPaste); + this.element.removeEventListener('focus', this._onFocus); + this.element.removeEventListener('blur', this._onBlur); + + if (this.element.form) { + this.element.form.removeEventListener('reset', this._onFormReset); } - }, { - key: "enable", - value: function enable() { - this.element.removeAttribute('disabled'); - this.isDisabled = false; + }; + + _proto.enable = function enable() { + this.element.removeAttribute('disabled'); + this.isDisabled = false; + }; + + _proto.disable = function disable() { + this.element.setAttribute('disabled', ''); + this.isDisabled = true; + }; + + _proto.focus = function focus() { + if (!this.isFocussed) { + this.element.focus(); } - }, { - key: "disable", - value: function disable() { - this.element.setAttribute('disabled', ''); - this.isDisabled = true; + }; + + _proto.blur = function blur() { + if (this.isFocussed) { + this.element.blur(); } - }, { - key: "focus", - value: function focus() { - if (!this.isFocussed) { - this.element.focus(); - } + } + /** + * Set value of input to blank + * @return {Object} Class instance + * @public + */ + ; + + _proto.clear = function clear(setWidth) { + if (setWidth === void 0) { + setWidth = true; } - }, { - key: "blur", - value: function blur() { - if (this.isFocussed) { - this.element.blur(); - } + + if (this.element.value) { + this.element.value = ''; } - /** - * Set value of input to blank - * @return {Object} Class instance - * @public - */ - }, { - key: "clear", - value: function clear() { - var setWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; - - if (this.element.value) { - this.element.value = ''; - } - - if (setWidth) { - this.setWidth(); - } - - return this; + if (setWidth) { + this.setWidth(); } - /** - * Set the correct input width based on placeholder - * value or input value - * @return - */ - }, { - key: "setWidth", - value: function setWidth(enforceWidth) { - var _this = this; + return this; + } + /** + * Set the correct input width based on placeholder + * value or input value + * @return + */ + ; - var callback = function callback(width) { - _this.element.style.width = width; - }; + _proto.setWidth = function setWidth(enforceWidth) { + var _this = this; - if (this._placeholderValue) { - // If there is a placeholder, we only want to set the width of the input when it is a greater - // length than 75% of the placeholder. This stops the input jumping around. - var valueHasDesiredLength = this.element.value.length >= this._placeholderValue.length / 1.25; + var callback = function callback(width) { + _this.element.style.width = width; + }; - if (this.element.value && valueHasDesiredLength || enforceWidth) { - this.calcWidth(callback); - } - } else { - // If there is no placeholder, resize input to contents + if (this._placeholderValue) { + // If there is a placeholder, we only want to set the width of the input when it is a greater + // length than 75% of the placeholder. This stops the input jumping around. + var valueHasDesiredLength = this.element.value.length >= this._placeholderValue.length / 1.25; + + if (this.element.value && valueHasDesiredLength || enforceWidth) { this.calcWidth(callback); } + } else { + // If there is no placeholder, resize input to contents + this.calcWidth(callback); } - }, { - key: "calcWidth", - value: function calcWidth(callback) { - return (0, _utils.calcWidthOfInput)(this.element, callback); - } - }, { - key: "setActiveDescendant", - value: function setActiveDescendant(activeDescendantID) { - this.element.setAttribute('aria-activedescendant', activeDescendantID); - } - }, { - key: "removeActiveDescendant", - value: function removeActiveDescendant() { - this.element.removeAttribute('aria-activedescendant'); - } - }, { - key: "_onInput", - value: function _onInput() { - if (this.type !== 'select-one') { - this.setWidth(); - } - } - }, { - key: "_onPaste", - value: function _onPaste(event) { - var target = event.target; + }; - if (target === this.element && this.preventPaste) { - event.preventDefault(); - } + _proto.calcWidth = function calcWidth(callback) { + return calcWidthOfInput(this.element, callback); + }; + + _proto.setActiveDescendant = function setActiveDescendant(activeDescendantID) { + this.element.setAttribute('aria-activedescendant', activeDescendantID); + }; + + _proto.removeActiveDescendant = function removeActiveDescendant() { + this.element.removeAttribute('aria-activedescendant'); + }; + + _proto._onInput = function _onInput() { + if (this.type !== 'select-one') { + this.setWidth(); } - }, { - key: "_onFocus", - value: function _onFocus() { - this.isFocussed = true; + }; + + _proto._onPaste = function _onPaste(event) { + var target = event.target; + + if (target === this.element && this.preventPaste) { + event.preventDefault(); } - }, { - key: "_onBlur", - value: function _onBlur() { - this.isFocussed = false; - } - }, { + }; + + _proto._onFocus = function _onFocus() { + this.isFocussed = true; + }; + + _proto._onBlur = function _onBlur() { + this.isFocussed = false; + }; + + input_createClass(Input, [{ key: "placeholder", set: function set(placeholder) { this.element.placeholder = placeholder; @@ -6168,43 +3366,138 @@ function () { this.element.value = value; }, get: function get() { - return (0, _utils.sanitise)(this.element.value); + return sanitise(this.element.value); } }]); return Input; }(); -exports.default = Input; -/***/ }), -/* 24 */ -/***/ (function(module, exports, __webpack_require__) { +// CONCATENATED MODULE: ./src/scripts/constants.js -"use strict"; +var DEFAULT_CLASSNAMES = { + containerOuter: 'choices', + containerInner: 'choices__inner', + input: 'choices__input', + inputCloned: 'choices__input--cloned', + list: 'choices__list', + listItems: 'choices__list--multiple', + listSingle: 'choices__list--single', + listDropdown: 'choices__list--dropdown', + item: 'choices__item', + itemSelectable: 'choices__item--selectable', + itemDisabled: 'choices__item--disabled', + itemChoice: 'choices__item--choice', + placeholder: 'choices__placeholder', + group: 'choices__group', + groupHeading: 'choices__heading', + button: 'choices__button', + activeState: 'is-active', + focusState: 'is-focused', + openState: 'is-open', + disabledState: 'is-disabled', + highlightedState: 'is-highlighted', + hiddenState: 'is-hidden', + flippedState: 'is-flipped', + loadingState: 'is-loading', + noResults: 'has-no-results', + noChoices: 'has-no-choices' +}; +var DEFAULT_CONFIG = { + items: [], + choices: [], + silent: false, + renderChoiceLimit: -1, + maxItemCount: -1, + addItems: true, + addItemFilterFn: null, + removeItems: true, + removeItemButton: false, + editItems: false, + duplicateItemsAllowed: true, + delimiter: ',', + paste: true, + searchEnabled: true, + searchChoices: true, + searchFloor: 1, + searchResultLimit: 4, + searchFields: ['label', 'value'], + position: 'auto', + resetScrollPosition: true, + shouldSort: true, + shouldSortItems: false, + sortFn: sortByAlpha, + placeholder: true, + placeholderValue: null, + searchPlaceholderValue: null, + prependValue: null, + appendValue: null, + renderSelectedChoices: 'auto', + loadingText: 'Loading...', + noResultsText: 'No results found', + noChoicesText: 'No choices to choose from', + itemSelectText: 'Press to select', + uniqueItemText: 'Only unique values can be added', + customAddItemText: 'Only values matching specific conditions can be added', + addItemText: function addItemText(value) { + return "Press Enter to add \"" + sanitise(value) + "\""; + }, + maxItemText: function maxItemText(maxItemCount) { + return "Only " + maxItemCount + " values can be added"; + }, + itemComparer: function itemComparer(choice, item) { + return choice === item; + }, + fuseOptions: { + includeScore: true + }, + callbackOnInit: null, + callbackOnCreateTemplates: null, + classNames: DEFAULT_CLASSNAMES +}; +var EVENTS = { + showDropdown: 'showDropdown', + hideDropdown: 'hideDropdown', + change: 'change', + choice: 'choice', + search: 'search', + addItem: 'addItem', + removeItem: 'removeItem', + highlightItem: 'highlightItem', + highlightChoice: 'highlightChoice' +}; +var ACTION_TYPES = { + ADD_CHOICE: 'ADD_CHOICE', + FILTER_CHOICES: 'FILTER_CHOICES', + ACTIVATE_CHOICES: 'ACTIVATE_CHOICES', + CLEAR_CHOICES: 'CLEAR_CHOICES', + ADD_GROUP: 'ADD_GROUP', + ADD_ITEM: 'ADD_ITEM', + REMOVE_ITEM: 'REMOVE_ITEM', + HIGHLIGHT_ITEM: 'HIGHLIGHT_ITEM', + CLEAR_ALL: 'CLEAR_ALL' +}; +var KEY_CODES = { + BACK_KEY: 46, + DELETE_KEY: 8, + ENTER_KEY: 13, + A_KEY: 65, + ESC_KEY: 27, + UP_KEY: 38, + DOWN_KEY: 40, + PAGE_UP_KEY: 33, + PAGE_DOWN_KEY: 34 +}; +var SCROLLING_SPEED = 4; +// CONCATENATED MODULE: ./src/scripts/components/list.js -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -var _constants = __webpack_require__(1); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -var List = +var list_List = /*#__PURE__*/ function () { function List(_ref) { var element = _ref.element; - - _classCallCheck(this, List); - Object.assign(this, { element: element }); @@ -6213,139 +3506,197 @@ function () { this.hasChildren = !!this.element.children; } - _createClass(List, [{ - key: "clear", - value: function clear() { - this.element.innerHTML = ''; - } - }, { - key: "append", - value: function append(node) { - this.element.appendChild(node); - } - }, { - key: "getChild", - value: function getChild(selector) { - return this.element.querySelector(selector); - } - }, { - key: "scrollToTop", - value: function scrollToTop() { - this.element.scrollTop = 0; - } - }, { - key: "scrollToChoice", - value: function scrollToChoice(choice, direction) { - var _this = this; + var _proto = List.prototype; - if (!choice) { - return; + _proto.clear = function clear() { + this.element.innerHTML = ''; + }; + + _proto.append = function append(node) { + this.element.appendChild(node); + }; + + _proto.getChild = function getChild(selector) { + return this.element.querySelector(selector); + }; + + _proto.scrollToTop = function scrollToTop() { + this.element.scrollTop = 0; + }; + + _proto.scrollToChoice = function scrollToChoice(choice, direction) { + var _this = this; + + if (!choice) { + return; + } + + var dropdownHeight = this.element.offsetHeight; + var choiceHeight = choice.offsetHeight; // Distance from bottom of element to top of parent + + var choicePos = choice.offsetTop + choiceHeight; // Scroll position of dropdown + + var containerScrollPos = this.element.scrollTop + dropdownHeight; // Difference between the choice and scroll position + + var endpoint = direction > 0 ? this.element.scrollTop + choicePos - containerScrollPos : choice.offsetTop; + requestAnimationFrame(function (time) { + _this._animateScroll(time, endpoint, direction); + }); + }; + + _proto._scrollDown = function _scrollDown(scrollPos, strength, endpoint) { + var easing = (endpoint - scrollPos) / strength; + var distance = easing > 1 ? easing : 1; + this.element.scrollTop = scrollPos + distance; + }; + + _proto._scrollUp = function _scrollUp(scrollPos, strength, endpoint) { + var easing = (scrollPos - endpoint) / strength; + var distance = easing > 1 ? easing : 1; + this.element.scrollTop = scrollPos - distance; + }; + + _proto._animateScroll = function _animateScroll(time, endpoint, direction) { + var _this2 = this; + + var strength = SCROLLING_SPEED; + var choiceListScrollTop = this.element.scrollTop; + var continueAnimation = false; + + if (direction > 0) { + this._scrollDown(choiceListScrollTop, strength, endpoint); + + if (choiceListScrollTop < endpoint) { + continueAnimation = true; } + } else { + this._scrollUp(choiceListScrollTop, strength, endpoint); - var dropdownHeight = this.element.offsetHeight; - var choiceHeight = choice.offsetHeight; // Distance from bottom of element to top of parent + if (choiceListScrollTop > endpoint) { + continueAnimation = true; + } + } - var choicePos = choice.offsetTop + choiceHeight; // Scroll position of dropdown - - var containerScrollPos = this.element.scrollTop + dropdownHeight; // Difference between the choice and scroll position - - var endpoint = direction > 0 ? this.element.scrollTop + choicePos - containerScrollPos : choice.offsetTop; - requestAnimationFrame(function (time) { - _this._animateScroll(time, endpoint, direction); + if (continueAnimation) { + requestAnimationFrame(function () { + _this2._animateScroll(time, endpoint, direction); }); } - }, { - key: "_scrollDown", - value: function _scrollDown(scrollPos, strength, endpoint) { - var easing = (endpoint - scrollPos) / strength; - var distance = easing > 1 ? easing : 1; - this.element.scrollTop = scrollPos + distance; - } - }, { - key: "_scrollUp", - value: function _scrollUp(scrollPos, strength, endpoint) { - var easing = (scrollPos - endpoint) / strength; - var distance = easing > 1 ? easing : 1; - this.element.scrollTop = scrollPos - distance; - } - }, { - key: "_animateScroll", - value: function _animateScroll(time, endpoint, direction) { - var _this2 = this; - - var strength = _constants.SCROLLING_SPEED; - var choiceListScrollTop = this.element.scrollTop; - var continueAnimation = false; - - if (direction > 0) { - this._scrollDown(choiceListScrollTop, strength, endpoint); - - if (choiceListScrollTop < endpoint) { - continueAnimation = true; - } - } else { - this._scrollUp(choiceListScrollTop, strength, endpoint); - - if (choiceListScrollTop > endpoint) { - continueAnimation = true; - } - } - - if (continueAnimation) { - requestAnimationFrame(function () { - _this2._animateScroll(time, endpoint, direction); - }); - } - } - }]); + }; return List; }(); -exports.default = List; -/***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { +// CONCATENATED MODULE: ./src/scripts/components/wrapped-element.js +function wrapped_element_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -"use strict"; +function wrapped_element_createClass(Constructor, protoProps, staticProps) { if (protoProps) wrapped_element_defineProperties(Constructor.prototype, protoProps); if (staticProps) wrapped_element_defineProperties(Constructor, staticProps); return Constructor; } -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; -var _wrappedElement = _interopRequireDefault(__webpack_require__(4)); +var wrapped_element_WrappedElement = +/*#__PURE__*/ +function () { + function WrappedElement(_ref) { + var element = _ref.element, + classNames = _ref.classNames; + Object.assign(this, { + element: element, + classNames: classNames + }); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + if (!isElement(element)) { + throw new TypeError('Invalid element passed'); + } -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + this.isDisabled = false; + } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + var _proto = WrappedElement.prototype; -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + _proto.conceal = function conceal() { + // Hide passed input + this.element.classList.add(this.classNames.input); + this.element.classList.add(this.classNames.hiddenState); // Remove element from tab index -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + this.element.tabIndex = '-1'; // Backup original styles if any -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + var origStyle = this.element.getAttribute('style'); -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + if (origStyle) { + this.element.setAttribute('data-choice-orig-style', origStyle); + } -function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } + this.element.setAttribute('aria-hidden', 'true'); + this.element.setAttribute('data-choice', 'active'); + }; -function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } + _proto.reveal = function reveal() { + // Reinstate passed element + this.element.classList.remove(this.classNames.input); + this.element.classList.remove(this.classNames.hiddenState); + this.element.removeAttribute('tabindex'); // Recover original styles if any -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + var origStyle = this.element.getAttribute('data-choice-orig-style'); + + if (origStyle) { + this.element.removeAttribute('data-choice-orig-style'); + this.element.setAttribute('style', origStyle); + } else { + this.element.removeAttribute('style'); + } + + this.element.removeAttribute('aria-hidden'); + this.element.removeAttribute('data-choice'); // Re-assign values - this is weird, I know + + this.element.value = this.element.value; + }; + + _proto.enable = function enable() { + this.element.removeAttribute('disabled'); + this.element.disabled = false; + this.isDisabled = false; + }; + + _proto.disable = function disable() { + this.element.setAttribute('disabled', ''); + this.element.disabled = true; + this.isDisabled = true; + }; + + _proto.triggerEvent = function triggerEvent(eventType, data) { + dispatchEvent(this.element, eventType, data); + }; + + wrapped_element_createClass(WrappedElement, [{ + key: "value", + get: function get() { + return this.element.value; + }, + set: function set(value) { + // you must define setter here otherwise it will be readonly property + this.element.value = value; + } + }]); + + return WrappedElement; +}(); + + +// CONCATENATED MODULE: ./src/scripts/components/wrapped-input.js +function wrapped_input_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function wrapped_input_createClass(Constructor, protoProps, staticProps) { if (protoProps) wrapped_input_defineProperties(Constructor.prototype, protoProps); if (staticProps) wrapped_input_defineProperties(Constructor, staticProps); return Constructor; } + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var WrappedInput = /*#__PURE__*/ function (_WrappedElement) { - _inherits(WrappedInput, _WrappedElement); + _inheritsLoose(WrappedInput, _WrappedElement); function WrappedInput(_ref) { var _this; @@ -6353,18 +3704,15 @@ function (_WrappedElement) { var element = _ref.element, classNames = _ref.classNames, delimiter = _ref.delimiter; - - _classCallCheck(this, WrappedInput); - - _this = _possibleConstructorReturn(this, _getPrototypeOf(WrappedInput).call(this, { + _this = _WrappedElement.call(this, { element: element, classNames: classNames - })); + }) || this; _this.delimiter = delimiter; return _this; } - _createClass(WrappedInput, [{ + wrapped_input_createClass(WrappedInput, [{ key: "value", set: function set(items) { var itemValues = items.map(function (_ref2) { @@ -6374,56 +3722,29 @@ function (_WrappedElement) { var joinedValues = itemValues.join(this.delimiter); this.element.setAttribute('value', joinedValues); this.element.value = joinedValues; - } // @todo figure out why we need this? Perhaps a babel issue - , + }, get: function get() { - return _get(_getPrototypeOf(WrappedInput.prototype), "value", this); + return this.element.value; } }]); return WrappedInput; -}(_wrappedElement.default); - -exports.default = WrappedInput; - -/***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +}(wrapped_element_WrappedElement); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; +// CONCATENATED MODULE: ./src/scripts/components/wrapped-select.js +function wrapped_select_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -var _wrappedElement = _interopRequireDefault(__webpack_require__(4)); +function wrapped_select_createClass(Constructor, protoProps, staticProps) { if (protoProps) wrapped_select_defineProperties(Constructor.prototype, protoProps); if (staticProps) wrapped_select_defineProperties(Constructor, staticProps); return Constructor; } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +function wrapped_select_inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } - -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } - -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var WrappedSelect = /*#__PURE__*/ function (_WrappedElement) { - _inherits(WrappedSelect, _WrappedElement); + wrapped_select_inheritsLoose(WrappedSelect, _WrappedElement); function WrappedSelect(_ref) { var _this; @@ -6431,24 +3752,22 @@ function (_WrappedElement) { var element = _ref.element, classNames = _ref.classNames, template = _ref.template; - - _classCallCheck(this, WrappedSelect); - - _this = _possibleConstructorReturn(this, _getPrototypeOf(WrappedSelect).call(this, { + _this = _WrappedElement.call(this, { element: element, classNames: classNames - })); + }) || this; _this.template = template; return _this; } - _createClass(WrappedSelect, [{ - key: "appendDocFragment", - value: function appendDocFragment(fragment) { - this.element.innerHTML = ''; - this.element.appendChild(fragment); - } - }, { + var _proto = WrappedSelect.prototype; + + _proto.appendDocFragment = function appendDocFragment(fragment) { + this.element.innerHTML = ''; + this.element.appendChild(fragment); + }; + + wrapped_select_createClass(WrappedSelect, [{ key: "placeholderOption", get: function get() { return this.element.querySelector('option[value=""]') || // Backward compatibility layer for the non-standard placeholder attribute supported in older versions. @@ -6486,29 +3805,23 @@ function (_WrappedElement) { }]); return WrappedSelect; -}(_wrappedElement.default); - -exports.default = WrappedSelect; - -/***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; +}(wrapped_element_WrappedElement); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = exports.TEMPLATES = void 0; +// CONCATENATED MODULE: ./src/scripts/components/index.js -var _classnames = _interopRequireDefault(__webpack_require__(28)); -var _utils = __webpack_require__(0); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + + + +// EXTERNAL MODULE: ./node_modules/classnames/index.js +var classnames = __webpack_require__(0); +var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); + +// CONCATENATED MODULE: ./src/scripts/templates.js + var TEMPLATES = { containerOuter: function containerOuter(globalClasses, direction, isSelectElement, isSelectOneElement, searchEnabled, passedElementType) { @@ -6521,147 +3834,80 @@ var TEMPLATES = { ariaAutoComplete = 'aria-autocomplete="list"'; } - return (0, _utils.strToEl)("\n \n \n ")); + return strToEl("\n \n \n "); }, containerInner: function containerInner(globalClasses) { - return (0, _utils.strToEl)("\n
\n ")); + return strToEl("\n
\n "); }, itemList: function itemList(globalClasses, isSelectOneElement) { var _classNames; - var localClasses = (0, _classnames.default)(globalClasses.list, (_classNames = {}, _defineProperty(_classNames, globalClasses.listSingle, isSelectOneElement), _defineProperty(_classNames, globalClasses.listItems, !isSelectOneElement), _classNames)); - return (0, _utils.strToEl)("\n
\n ")); + var localClasses = classnames_default()(globalClasses.list, (_classNames = {}, _classNames[globalClasses.listSingle] = isSelectOneElement, _classNames[globalClasses.listItems] = !isSelectOneElement, _classNames)); + return strToEl("\n
\n "); }, placeholder: function placeholder(globalClasses, value) { - return (0, _utils.strToEl)("\n
\n ").concat(value, "\n
\n ")); + return strToEl("\n
\n " + value + "\n
\n "); }, item: function item(globalClasses, data, removeItemButton) { var _classNames2; var ariaSelected = data.active ? 'aria-selected="true"' : ''; var ariaDisabled = data.disabled ? 'aria-disabled="true"' : ''; - var localClasses = (0, _classnames.default)(globalClasses.item, (_classNames2 = {}, _defineProperty(_classNames2, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames2, globalClasses.itemSelectable, !data.highlighted), _defineProperty(_classNames2, globalClasses.placeholder, data.placeholder), _classNames2)); + var localClasses = classnames_default()(globalClasses.item, (_classNames2 = {}, _classNames2[globalClasses.highlightedState] = data.highlighted, _classNames2[globalClasses.itemSelectable] = !data.highlighted, _classNames2[globalClasses.placeholder] = data.placeholder, _classNames2)); if (removeItemButton) { var _classNames3; - localClasses = (0, _classnames.default)(globalClasses.item, (_classNames3 = {}, _defineProperty(_classNames3, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames3, globalClasses.itemSelectable, !data.disabled), _defineProperty(_classNames3, globalClasses.placeholder, data.placeholder), _classNames3)); - return (0, _utils.strToEl)("\n \n ").concat(data.label, "\n Remove item\n \n \n ")); + localClasses = classnames_default()(globalClasses.item, (_classNames3 = {}, _classNames3[globalClasses.highlightedState] = data.highlighted, _classNames3[globalClasses.itemSelectable] = !data.disabled, _classNames3[globalClasses.placeholder] = data.placeholder, _classNames3)); + return strToEl("\n \n " + data.label + "\n Remove item\n \n \n "); } - return (0, _utils.strToEl)("\n \n ").concat(data.label, "\n \n ")); + return strToEl("\n \n " + data.label + "\n \n "); }, choiceList: function choiceList(globalClasses, isSelectOneElement) { var ariaMultiSelectable = !isSelectOneElement ? 'aria-multiselectable="true"' : ''; - return (0, _utils.strToEl)("\n \n \n ")); + return strToEl("\n \n \n "); }, choiceGroup: function choiceGroup(globalClasses, data) { + var _classNames4; + var ariaDisabled = data.disabled ? 'aria-disabled="true"' : ''; - var localClasses = (0, _classnames.default)(globalClasses.group, _defineProperty({}, globalClasses.itemDisabled, data.disabled)); - return (0, _utils.strToEl)("\n \n
").concat(data.value, "
\n \n ")); + var localClasses = classnames_default()(globalClasses.group, (_classNames4 = {}, _classNames4[globalClasses.itemDisabled] = data.disabled, _classNames4)); + return strToEl("\n \n
" + data.value + "
\n \n "); }, choice: function choice(globalClasses, data, itemSelectText) { var _classNames5; var role = data.groupId > 0 ? 'role="treeitem"' : 'role="option"'; - var localClasses = (0, _classnames.default)(globalClasses.item, globalClasses.itemChoice, (_classNames5 = {}, _defineProperty(_classNames5, globalClasses.itemDisabled, data.disabled), _defineProperty(_classNames5, globalClasses.itemSelectable, !data.disabled), _defineProperty(_classNames5, globalClasses.placeholder, data.placeholder), _classNames5)); - return (0, _utils.strToEl)("\n \n ").concat(data.label, "\n \n ")); + var localClasses = classnames_default()(globalClasses.item, globalClasses.itemChoice, (_classNames5 = {}, _classNames5[globalClasses.itemDisabled] = data.disabled, _classNames5[globalClasses.itemSelectable] = !data.disabled, _classNames5[globalClasses.placeholder] = data.placeholder, _classNames5)); + return strToEl("\n \n " + data.label + "\n \n "); }, input: function input(globalClasses, placeholderValue) { - var localClasses = (0, _classnames.default)(globalClasses.input, globalClasses.inputCloned); - return (0, _utils.strToEl)("\n \n ")); + var localClasses = classnames_default()(globalClasses.input, globalClasses.inputCloned); + return strToEl("\n \n "); }, dropdown: function dropdown(globalClasses) { - var localClasses = (0, _classnames.default)(globalClasses.list, globalClasses.listDropdown); - return (0, _utils.strToEl)("\n \n \n ")); + var localClasses = classnames_default()(globalClasses.list, globalClasses.listDropdown); + return strToEl("\n \n \n "); }, - notice: function notice(globalClasses, label) { + notice: function notice(globalClasses, label, type) { var _classNames6; - var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; - var localClasses = (0, _classnames.default)(globalClasses.item, globalClasses.itemChoice, (_classNames6 = {}, _defineProperty(_classNames6, globalClasses.noResults, type === 'no-results'), _defineProperty(_classNames6, globalClasses.noChoices, type === 'no-choices'), _classNames6)); - return (0, _utils.strToEl)("\n
\n ").concat(label, "\n
\n ")); + if (type === void 0) { + type = ''; + } + + var localClasses = classnames_default()(globalClasses.item, globalClasses.itemChoice, (_classNames6 = {}, _classNames6[globalClasses.noResults] = type === 'no-results', _classNames6[globalClasses.noChoices] = type === 'no-choices', _classNames6)); + return strToEl("\n
\n " + label + "\n
\n "); }, option: function option(data) { - return (0, _utils.strToEl)("\n \n ")); + return strToEl("\n \n "); } }; -exports.TEMPLATES = TEMPLATES; -var _default = TEMPLATES; -exports.default = _default; +/* harmony default export */ var templates = (TEMPLATES); +// CONCATENATED MODULE: ./src/scripts/actions/choices.js -/***/ }), -/* 28 */ -/***/ (function(module, exports, __webpack_require__) { - -var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! - Copyright (c) 2017 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames -*/ -/* global define */ - -(function () { - 'use strict'; - - var hasOwn = {}.hasOwnProperty; - - function classNames () { - var classes = []; - - for (var i = 0; i < arguments.length; i++) { - var arg = arguments[i]; - if (!arg) continue; - - var argType = typeof arg; - - if (argType === 'string' || argType === 'number') { - classes.push(arg); - } else if (Array.isArray(arg) && arg.length) { - var inner = classNames.apply(null, arg); - if (inner) { - classes.push(inner); - } - } else if (argType === 'object') { - for (var key in arg) { - if (hasOwn.call(arg, key) && arg[key]) { - classes.push(key); - } - } - } - } - - return classes.join(' '); - } - - if ( true && module.exports) { - classNames.default = classNames; - module.exports = classNames; - } else if (true) { - // register as 'classnames', consistent with npm package name - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { - return classNames; - }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else {} -}()); - - -/***/ }), -/* 29 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.clearChoices = exports.activateChoices = exports.filterChoices = exports.addChoice = void 0; - -var _constants = __webpack_require__(1); - -var addChoice = function addChoice(_ref) { +var choices_addChoice = function addChoice(_ref) { var value = _ref.value, label = _ref.label, id = _ref.id, @@ -6672,7 +3918,7 @@ var addChoice = function addChoice(_ref) { placeholder = _ref.placeholder, keyCode = _ref.keyCode; return { - type: _constants.ACTION_TYPES.ADD_CHOICE, + type: ACTION_TYPES.ADD_CHOICE, value: value, label: label, id: id, @@ -6684,51 +3930,30 @@ var addChoice = function addChoice(_ref) { keyCode: keyCode }; }; - -exports.addChoice = addChoice; - -var filterChoices = function filterChoices(results) { +var choices_filterChoices = function filterChoices(results) { return { - type: _constants.ACTION_TYPES.FILTER_CHOICES, + type: ACTION_TYPES.FILTER_CHOICES, results: results }; }; +var choices_activateChoices = function activateChoices(active) { + if (active === void 0) { + active = true; + } -exports.filterChoices = filterChoices; - -var activateChoices = function activateChoices() { - var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; return { - type: _constants.ACTION_TYPES.ACTIVATE_CHOICES, + type: ACTION_TYPES.ACTIVATE_CHOICES, active: active }; }; - -exports.activateChoices = activateChoices; - -var clearChoices = function clearChoices() { +var choices_clearChoices = function clearChoices() { return { - type: _constants.ACTION_TYPES.CLEAR_CHOICES + type: ACTION_TYPES.CLEAR_CHOICES }; }; +// CONCATENATED MODULE: ./src/scripts/actions/items.js -exports.clearChoices = clearChoices; - -/***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.highlightItem = exports.removeItem = exports.addItem = void 0; - -var _constants = __webpack_require__(1); - -var addItem = function addItem(_ref) { +var items_addItem = function addItem(_ref) { var value = _ref.value, label = _ref.label, id = _ref.id, @@ -6738,7 +3963,7 @@ var addItem = function addItem(_ref) { placeholder = _ref.placeholder, keyCode = _ref.keyCode; return { - type: _constants.ACTION_TYPES.ADD_ITEM, + type: ACTION_TYPES.ADD_ITEM, value: value, label: label, id: id, @@ -6749,97 +3974,46 @@ var addItem = function addItem(_ref) { keyCode: keyCode }; }; - -exports.addItem = addItem; - -var removeItem = function removeItem(id, choiceId) { +var items_removeItem = function removeItem(id, choiceId) { return { - type: _constants.ACTION_TYPES.REMOVE_ITEM, + type: ACTION_TYPES.REMOVE_ITEM, id: id, choiceId: choiceId }; }; - -exports.removeItem = removeItem; - -var highlightItem = function highlightItem(id, highlighted) { +var items_highlightItem = function highlightItem(id, highlighted) { return { - type: _constants.ACTION_TYPES.HIGHLIGHT_ITEM, + type: ACTION_TYPES.HIGHLIGHT_ITEM, id: id, highlighted: highlighted }; }; - -exports.highlightItem = highlightItem; - -/***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.addGroup = void 0; - -var _constants = __webpack_require__(1); +// CONCATENATED MODULE: ./src/scripts/actions/groups.js /* eslint-disable import/prefer-default-export */ -var addGroup = function addGroup(value, id, active, disabled) { + +var groups_addGroup = function addGroup(value, id, active, disabled) { return { - type: _constants.ACTION_TYPES.ADD_GROUP, + type: ACTION_TYPES.ADD_GROUP, value: value, id: id, active: active, disabled: disabled }; }; - -exports.addGroup = addGroup; - -/***/ }), -/* 32 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.resetTo = exports.clearAll = void 0; - +// CONCATENATED MODULE: ./src/scripts/actions/misc.js var clearAll = function clearAll() { return { type: 'CLEAR_ALL' }; }; - -exports.clearAll = clearAll; - var resetTo = function resetTo(state) { return { type: 'RESET_TO', state: state }; }; - -exports.resetTo = resetTo; - -/***/ }), -/* 33 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.setIsLoading = void 0; - +// CONCATENATED MODULE: ./src/scripts/actions/general.js /* eslint-disable import/prefer-default-export */ var setIsLoading = function setIsLoading(isLoading) { return { @@ -6847,9 +4021,2144 @@ var setIsLoading = function setIsLoading(isLoading) { isLoading: isLoading }; }; +// CONCATENATED MODULE: ./src/scripts/choices.js -exports.setIsLoading = setIsLoading; + + + + + + + + + + + + +/** + * Choices + * @author Josh Johnson + */ + +var choices_Choices = +/*#__PURE__*/ +function () { + function Choices(element, userConfig) { + var _this = this; + + if (element === void 0) { + element = '[data-choice]'; + } + + if (userConfig === void 0) { + userConfig = {}; + } + + if (isType('String', element)) { + var elements = Array.from(document.querySelectorAll(element)); // If there are multiple elements, create a new instance + // for each element besides the first one (as that already has an instance) + + if (elements.length > 1) { + return this._generateInstances(elements, userConfig); + } + } + + this.config = cjs_default.a.all([DEFAULT_CONFIG, Choices.userDefaults, userConfig], // When merging array configs, replace with a copy of the userConfig array, + // instead of concatenating with the default array + { + arrayMerge: function arrayMerge(destinationArray, sourceArray) { + return [].concat(sourceArray); + } + }); + var invalidConfigOptions = diff(this.config, DEFAULT_CONFIG); + + if (invalidConfigOptions.length) { + console.warn('Unknown config option(s) passed', invalidConfigOptions.join(', ')); + } + + if (!['auto', 'always'].includes(this.config.renderSelectedChoices)) { + this.config.renderSelectedChoices = 'auto'; + } // Retrieve triggering element (i.e. element with 'data-choice' trigger) + + + var passedElement = isType('String', element) ? document.querySelector(element) : element; + + if (!passedElement) { + if (!this.config.silent) { + console.error('Could not find passed element or passed element was of an invalid type'); + } + + return; + } + + this._isTextElement = passedElement.type === 'text'; + this._isSelectOneElement = passedElement.type === 'select-one'; + this._isSelectMultipleElement = passedElement.type === 'select-multiple'; + this._isSelectElement = this._isSelectOneElement || this._isSelectMultipleElement; + + if (this._isTextElement) { + this.passedElement = new WrappedInput({ + element: passedElement, + classNames: this.config.classNames, + delimiter: this.config.delimiter + }); + } else if (this._isSelectElement) { + this.passedElement = new WrappedSelect({ + element: passedElement, + classNames: this.config.classNames, + template: function template(data) { + return _this.config.templates.option(data); + } + }); + } + + if (!this.passedElement) { + return console.error('Passed element was of an invalid type'); + } + + this.initialised = false; + this._store = new store_Store(this.render); + this._initialState = {}; + this._currentState = {}; + this._prevState = {}; + this._currentValue = ''; + this._canSearch = this.config.searchEnabled; + this._isScrollingOnIe = false; + this._highlightPosition = 0; + this._wasTap = true; + this._placeholderValue = this._generatePlaceholderValue(); + this._baseId = generateId(this.passedElement.element, 'choices-'); + this._direction = this.passedElement.element.getAttribute('dir') || 'ltr'; + this._idNames = { + itemChoice: 'item-choice' + }; // Assign preset choices from passed object + + this._presetChoices = this.config.choices; // Assign preset items from passed object first + + this._presetItems = this.config.items; // Then add any values passed from attribute + + if (this.passedElement.value) { + this._presetItems = this._presetItems.concat(this.passedElement.value.split(this.config.delimiter)); + } + + this._render = this._render.bind(this); + this._onFocus = this._onFocus.bind(this); + this._onBlur = this._onBlur.bind(this); + this._onKeyUp = this._onKeyUp.bind(this); + this._onKeyDown = this._onKeyDown.bind(this); + this._onClick = this._onClick.bind(this); + this._onTouchMove = this._onTouchMove.bind(this); + this._onTouchEnd = this._onTouchEnd.bind(this); + this._onMouseDown = this._onMouseDown.bind(this); + this._onMouseOver = this._onMouseOver.bind(this); + this._onFormReset = this._onFormReset.bind(this); + this._onAKey = this._onAKey.bind(this); + this._onEnterKey = this._onEnterKey.bind(this); + this._onEscapeKey = this._onEscapeKey.bind(this); + this._onDirectionKey = this._onDirectionKey.bind(this); + this._onDeleteKey = this._onDeleteKey.bind(this); + + if (!this.config.silent) { + if (this.config.shouldSortItems === true && this._isSelectOneElement) { + console.warn("shouldSortElements: Type of passed element is 'select-one', falling back to false."); + } // If element has already been initialised with Choices, fail silently + + + if (this.passedElement.element.getAttribute('data-choice') === 'active') { + console.warn('Trying to initialise Choices on element already initialised'); + } + } // Let's go + + + this.init(); + } + /* ======================================== + = Public functions = + ======================================== */ + + + var _proto = Choices.prototype; + + _proto.init = function init() { + if (this.initialised) { + return; + } + + this._createTemplates(); + + this._createElements(); + + this._createStructure(); // Set initial state (We need to clone the state because some reducers + // modify the inner objects properties in the state) 🤢 + + + this._initialState = cloneObject(this._store.state); + + this._store.subscribe(this._render); + + this._render(); + + this._addEventListeners(); + + var shouldDisable = !this.config.addItems || this.passedElement.element.hasAttribute('disabled'); + + if (shouldDisable) { + this.disable(); + } + + this.initialised = true; + var callbackOnInit = this.config.callbackOnInit; // Run callback if it is a function + + if (callbackOnInit && isType('Function', callbackOnInit)) { + callbackOnInit.call(this); + } + }; + + _proto.destroy = function destroy() { + if (!this.initialised) { + return; + } + + this._removeEventListeners(); + + this.passedElement.reveal(); + this.containerOuter.unwrap(this.passedElement.element); + + if (this._isSelectElement) { + this.passedElement.options = this._presetChoices; + } + + this.clearStore(); + this.config.templates = null; + this.initialised = false; + }; + + _proto.enable = function enable() { + if (this.passedElement.isDisabled) { + this.passedElement.enable(); + } + + if (this.containerOuter.isDisabled) { + this._addEventListeners(); + + this.input.enable(); + this.containerOuter.enable(); + } + + return this; + }; + + _proto.disable = function disable() { + if (!this.passedElement.isDisabled) { + this.passedElement.disable(); + } + + if (!this.containerOuter.isDisabled) { + this._removeEventListeners(); + + this.input.disable(); + this.containerOuter.disable(); + } + + return this; + }; + + _proto.highlightItem = function highlightItem(item, runEvent) { + if (runEvent === void 0) { + runEvent = true; + } + + if (!item) { + return this; + } + + var id = item.id, + _item$groupId = item.groupId, + groupId = _item$groupId === void 0 ? -1 : _item$groupId, + _item$value = item.value, + value = _item$value === void 0 ? '' : _item$value, + _item$label = item.label, + label = _item$label === void 0 ? '' : _item$label; + var group = groupId >= 0 ? this._store.getGroupById(groupId) : null; + + this._store.dispatch(items_highlightItem(id, true)); + + if (runEvent) { + this.passedElement.triggerEvent(EVENTS.highlightItem, { + id: id, + value: value, + label: label, + groupValue: group && group.value ? group.value : null + }); + } + + return this; + }; + + _proto.unhighlightItem = function unhighlightItem(item) { + if (!item) { + return this; + } + + var id = item.id, + _item$groupId2 = item.groupId, + groupId = _item$groupId2 === void 0 ? -1 : _item$groupId2, + _item$value2 = item.value, + value = _item$value2 === void 0 ? '' : _item$value2, + _item$label2 = item.label, + label = _item$label2 === void 0 ? '' : _item$label2; + var group = groupId >= 0 ? this._store.getGroupById(groupId) : null; + + this._store.dispatch(items_highlightItem(id, false)); + + this.passedElement.triggerEvent(EVENTS.highlightItem, { + id: id, + value: value, + label: label, + groupValue: group && group.value ? group.value : null + }); + return this; + }; + + _proto.highlightAll = function highlightAll() { + var _this2 = this; + + this._store.items.forEach(function (item) { + return _this2.highlightItem(item); + }); + + return this; + }; + + _proto.unhighlightAll = function unhighlightAll() { + var _this3 = this; + + this._store.items.forEach(function (item) { + return _this3.unhighlightItem(item); + }); + + return this; + }; + + _proto.removeActiveItemsByValue = function removeActiveItemsByValue(value) { + var _this4 = this; + + this._store.activeItems.filter(function (item) { + return item.value === value; + }).forEach(function (item) { + return _this4._removeItem(item); + }); + + return this; + }; + + _proto.removeActiveItems = function removeActiveItems(excludedId) { + var _this5 = this; + + this._store.activeItems.filter(function (_ref) { + var id = _ref.id; + return id !== excludedId; + }).forEach(function (item) { + return _this5._removeItem(item); + }); + + return this; + }; + + _proto.removeHighlightedItems = function removeHighlightedItems(runEvent) { + var _this6 = this; + + if (runEvent === void 0) { + runEvent = false; + } + + this._store.highlightedActiveItems.forEach(function (item) { + _this6._removeItem(item); // If this action was performed by the user + // trigger the event + + + if (runEvent) { + _this6._triggerChange(item.value); + } + }); + + return this; + }; + + _proto.showDropdown = function showDropdown(preventInputFocus) { + var _this7 = this; + + if (this.dropdown.isActive) { + return this; + } + + requestAnimationFrame(function () { + _this7.dropdown.show(); + + _this7.containerOuter.open(_this7.dropdown.distanceFromTopWindow()); + + if (!preventInputFocus && _this7._canSearch) { + _this7.input.focus(); + } + + _this7.passedElement.triggerEvent(EVENTS.showDropdown, {}); + }); + return this; + }; + + _proto.hideDropdown = function hideDropdown(preventInputBlur) { + var _this8 = this; + + if (!this.dropdown.isActive) { + return this; + } + + requestAnimationFrame(function () { + _this8.dropdown.hide(); + + _this8.containerOuter.close(); + + if (!preventInputBlur && _this8._canSearch) { + _this8.input.removeActiveDescendant(); + + _this8.input.blur(); + } + + _this8.passedElement.triggerEvent(EVENTS.hideDropdown, {}); + }); + return this; + }; + + _proto.getValue = function getValue(valueOnly) { + if (valueOnly === void 0) { + valueOnly = false; + } + + var values = this._store.activeItems.reduce(function (selectedItems, item) { + var itemValue = valueOnly ? item.value : item; + selectedItems.push(itemValue); + return selectedItems; + }, []); + + return this._isSelectOneElement ? values[0] : values; + }; + + _proto.setValue = function setValue(args) { + var _this9 = this; + + if (!this.initialised) { + return this; + } + + [].concat(args).forEach(function (value) { + return _this9._setChoiceOrItem(value); + }); + return this; + }; + + _proto.setChoiceByValue = function setChoiceByValue(value) { + var _this10 = this; + + if (!this.initialised || this._isTextElement) { + return this; + } // If only one value has been passed, convert to array + + + var choiceValue = isType('Array', value) ? value : [value]; // Loop through each value and + + choiceValue.forEach(function (val) { + return _this10._findAndSelectChoiceByValue(val); + }); + return this; + }; + + _proto.setChoices = function setChoices(choices, value, label, replaceChoices) { + var _this11 = this; + + if (choices === void 0) { + choices = []; + } + + if (value === void 0) { + value = ''; + } + + if (label === void 0) { + label = ''; + } + + if (replaceChoices === void 0) { + replaceChoices = false; + } + + if (!this._isSelectElement || !value) { + return this; + } // Clear choices if needed + + + if (replaceChoices) { + this.clearChoices(); + } + + this.containerOuter.removeLoadingState(); + + var addGroupsAndChoices = function addGroupsAndChoices(groupOrChoice) { + if (groupOrChoice.choices) { + _this11._addGroup({ + group: groupOrChoice, + id: groupOrChoice.id || null, + valueKey: value, + labelKey: label + }); + } else { + _this11._addChoice({ + value: groupOrChoice[value], + label: groupOrChoice[label], + isSelected: groupOrChoice.selected, + isDisabled: groupOrChoice.disabled, + customProperties: groupOrChoice.customProperties, + placeholder: groupOrChoice.placeholder + }); + } + }; + + this._setLoading(true); + + choices.forEach(addGroupsAndChoices); + + this._setLoading(false); + + return this; + }; + + _proto.clearChoices = function clearChoices() { + this._store.dispatch(choices_clearChoices()); + }; + + _proto.clearStore = function clearStore() { + this._store.dispatch(clearAll()); + + return this; + }; + + _proto.clearInput = function clearInput() { + var shouldSetInputWidth = !this._isSelectOneElement; + this.input.clear(shouldSetInputWidth); + + if (!this._isTextElement && this._canSearch) { + this._isSearching = false; + + this._store.dispatch(choices_activateChoices(true)); + } + + return this; + }; + + _proto.ajax = function ajax(fn) { + var _this12 = this; + + if (!this.initialised || !this._isSelectElement || !fn) { + return this; + } + + requestAnimationFrame(function () { + return _this12._handleLoadingState(true); + }); + fn(this._ajaxCallback()); + return this; + } + /* ===== End of Public functions ====== */ + + /* ============================================= + = Private functions = + ============================================= */ + ; + + _proto._render = function _render() { + if (this._store.isLoading()) { + return; + } + + this._currentState = this._store.state; + var stateChanged = this._currentState.choices !== this._prevState.choices || this._currentState.groups !== this._prevState.groups || this._currentState.items !== this._prevState.items; + var shouldRenderChoices = this._isSelectElement; + var shouldRenderItems = this._currentState.items !== this._prevState.items; + + if (!stateChanged) { + return; + } + + if (shouldRenderChoices) { + this._renderChoices(); + } + + if (shouldRenderItems) { + this._renderItems(); + } + + this._prevState = this._currentState; + }; + + _proto._renderChoices = function _renderChoices() { + var _this13 = this; + + var _this$_store = this._store, + activeGroups = _this$_store.activeGroups, + activeChoices = _this$_store.activeChoices; + var choiceListFragment = document.createDocumentFragment(); + this.choiceList.clear(); + + if (this.config.resetScrollPosition) { + requestAnimationFrame(function () { + return _this13.choiceList.scrollToTop(); + }); + } // If we have grouped options + + + if (activeGroups.length >= 1 && !this._isSearching) { + // If we have a placeholder choice along with groups + var activePlaceholders = activeChoices.filter(function (activeChoice) { + return activeChoice.placeholder === true && activeChoice.groupId === -1; + }); + + if (activePlaceholders.length >= 1) { + choiceListFragment = this._createChoicesFragment(activePlaceholders, choiceListFragment); + } + + choiceListFragment = this._createGroupsFragment(activeGroups, activeChoices, choiceListFragment); + } else if (activeChoices.length >= 1) { + choiceListFragment = this._createChoicesFragment(activeChoices, choiceListFragment); + } // If we have choices to show + + + if (choiceListFragment.childNodes && choiceListFragment.childNodes.length > 0) { + var activeItems = this._store.activeItems; + + var canAddItem = this._canAddItem(activeItems, this.input.value); // ...and we can select them + + + if (canAddItem.response) { + // ...append them and highlight the first choice + this.choiceList.append(choiceListFragment); + + this._highlightChoice(); + } else { + // ...otherwise show a notice + this.choiceList.append(this._getTemplate('notice', canAddItem.notice)); + } + } else { + // Otherwise show a notice + var dropdownItem; + var notice; + + if (this._isSearching) { + notice = isType('Function', this.config.noResultsText) ? this.config.noResultsText() : this.config.noResultsText; + dropdownItem = this._getTemplate('notice', notice, 'no-results'); + } else { + notice = isType('Function', this.config.noChoicesText) ? this.config.noChoicesText() : this.config.noChoicesText; + dropdownItem = this._getTemplate('notice', notice, 'no-choices'); + } + + this.choiceList.append(dropdownItem); + } + }; + + _proto._renderItems = function _renderItems() { + var activeItems = this._store.activeItems || []; + this.itemList.clear(); // Create a fragment to store our list items + // (so we don't have to update the DOM for each item) + + var itemListFragment = this._createItemsFragment(activeItems); // If we have items to add, append them + + + if (itemListFragment.childNodes) { + this.itemList.append(itemListFragment); + } + }; + + _proto._createGroupsFragment = function _createGroupsFragment(groups, choices, fragment) { + var _this14 = this; + + var groupFragment = fragment || document.createDocumentFragment(); + + var getGroupChoices = function getGroupChoices(group) { + return choices.filter(function (choice) { + if (_this14._isSelectOneElement) { + return choice.groupId === group.id; + } + + return choice.groupId === group.id && (_this14.config.renderSelectedChoices === 'always' || !choice.selected); + }); + }; // If sorting is enabled, filter groups + + + if (this.config.shouldSort) { + groups.sort(this.config.sortFn); + } + + groups.forEach(function (group) { + var groupChoices = getGroupChoices(group); + + if (groupChoices.length >= 1) { + var dropdownGroup = _this14._getTemplate('choiceGroup', group); + + groupFragment.appendChild(dropdownGroup); + + _this14._createChoicesFragment(groupChoices, groupFragment, true); + } + }); + return groupFragment; + }; + + _proto._createChoicesFragment = function _createChoicesFragment(choices, fragment, withinGroup) { + var _this15 = this; + + if (withinGroup === void 0) { + withinGroup = false; + } + + // Create a fragment to store our list items (so we don't have to update the DOM for each item) + var choicesFragment = fragment || document.createDocumentFragment(); + var _this$config = this.config, + renderSelectedChoices = _this$config.renderSelectedChoices, + searchResultLimit = _this$config.searchResultLimit, + renderChoiceLimit = _this$config.renderChoiceLimit; + var filter = this._isSearching ? sortByScore : this.config.sortFn; + + var appendChoice = function appendChoice(choice) { + var shouldRender = renderSelectedChoices === 'auto' ? _this15._isSelectOneElement || !choice.selected : true; + + if (shouldRender) { + var dropdownItem = _this15._getTemplate('choice', choice, _this15.config.itemSelectText); + + choicesFragment.appendChild(dropdownItem); + } + }; + + var rendererableChoices = choices; + + if (renderSelectedChoices === 'auto' && !this._isSelectOneElement) { + rendererableChoices = choices.filter(function (choice) { + return !choice.selected; + }); + } // Split array into placeholders and "normal" choices + + + var _rendererableChoices$ = rendererableChoices.reduce(function (acc, choice) { + if (choice.placeholder) { + acc.placeholderChoices.push(choice); + } else { + acc.normalChoices.push(choice); + } + + return acc; + }, { + placeholderChoices: [], + normalChoices: [] + }), + placeholderChoices = _rendererableChoices$.placeholderChoices, + normalChoices = _rendererableChoices$.normalChoices; // If sorting is enabled or the user is searching, filter choices + + + if (this.config.shouldSort || this._isSearching) { + normalChoices.sort(filter); + } + + var choiceLimit = rendererableChoices.length; // Prepend placeholeder + + var sortedChoices = [].concat(placeholderChoices, normalChoices); + + if (this._isSearching) { + choiceLimit = searchResultLimit; + } else if (renderChoiceLimit > 0 && !withinGroup) { + choiceLimit = renderChoiceLimit; + } // Add each choice to dropdown within range + + + for (var i = 0; i < choiceLimit; i += 1) { + if (sortedChoices[i]) { + appendChoice(sortedChoices[i]); + } + } + + return choicesFragment; + }; + + _proto._createItemsFragment = function _createItemsFragment(items, fragment) { + var _this16 = this; + + if (fragment === void 0) { + fragment = null; + } + + // Create fragment to add elements to + var _this$config2 = this.config, + shouldSortItems = _this$config2.shouldSortItems, + sortFn = _this$config2.sortFn, + removeItemButton = _this$config2.removeItemButton; + var itemListFragment = fragment || document.createDocumentFragment(); // If sorting is enabled, filter items + + if (shouldSortItems && !this._isSelectOneElement) { + items.sort(sortFn); + } + + if (this._isTextElement) { + // Update the value of the hidden input + this.passedElement.value = items; + } else { + // Update the options of the hidden input + this.passedElement.options = items; + } + + var addItemToFragment = function addItemToFragment(item) { + // Create new list element + var listItem = _this16._getTemplate('item', item, removeItemButton); // Append it to list + + + itemListFragment.appendChild(listItem); + }; // Add each list item to list + + + items.forEach(function (item) { + return addItemToFragment(item); + }); + return itemListFragment; + }; + + _proto._triggerChange = function _triggerChange(value) { + if (value === undefined || value === null) { + return; + } + + this.passedElement.triggerEvent(EVENTS.change, { + value: value + }); + }; + + _proto._selectPlaceholderChoice = function _selectPlaceholderChoice() { + var placeholderChoice = this._store.placeholderChoice; + + if (placeholderChoice) { + this._addItem({ + value: placeholderChoice.value, + label: placeholderChoice.label, + choiceId: placeholderChoice.id, + groupId: placeholderChoice.groupId, + placeholder: placeholderChoice.placeholder + }); + + this._triggerChange(placeholderChoice.value); + } + }; + + _proto._handleButtonAction = function _handleButtonAction(activeItems, element) { + if (!activeItems || !element || !this.config.removeItems || !this.config.removeItemButton) { + return; + } + + var itemId = element.parentNode.getAttribute('data-id'); + var itemToRemove = activeItems.find(function (item) { + return item.id === parseInt(itemId, 10); + }); // Remove item associated with button + + this._removeItem(itemToRemove); + + this._triggerChange(itemToRemove.value); + + if (this._isSelectOneElement) { + this._selectPlaceholderChoice(); + } + }; + + _proto._handleItemAction = function _handleItemAction(activeItems, element, hasShiftKey) { + var _this17 = this; + + if (hasShiftKey === void 0) { + hasShiftKey = false; + } + + if (!activeItems || !element || !this.config.removeItems || this._isSelectOneElement) { + return; + } + + var passedId = element.getAttribute('data-id'); // We only want to select one item with a click + // so we deselect any items that aren't the target + // unless shift is being pressed + + activeItems.forEach(function (item) { + if (item.id === parseInt(passedId, 10) && !item.highlighted) { + _this17.highlightItem(item); + } else if (!hasShiftKey && item.highlighted) { + _this17.unhighlightItem(item); + } + }); // Focus input as without focus, a user cannot do anything with a + // highlighted item + + this.input.focus(); + }; + + _proto._handleChoiceAction = function _handleChoiceAction(activeItems, element) { + if (!activeItems || !element) { + return; + } // If we are clicking on an option + + + var id = element.getAttribute('data-id'); + + var choice = this._store.getChoiceById(id); + + var passedKeyCode = activeItems[0] && activeItems[0].keyCode ? activeItems[0].keyCode : null; + var hasActiveDropdown = this.dropdown.isActive; // Update choice keyCode + + choice.keyCode = passedKeyCode; + this.passedElement.triggerEvent(EVENTS.choice, { + choice: choice + }); + + if (choice && !choice.selected && !choice.disabled) { + var canAddItem = this._canAddItem(activeItems, choice.value); + + if (canAddItem.response) { + this._addItem({ + value: choice.value, + label: choice.label, + choiceId: choice.id, + groupId: choice.groupId, + customProperties: choice.customProperties, + placeholder: choice.placeholder, + keyCode: choice.keyCode + }); + + this._triggerChange(choice.value); + } + } + + this.clearInput(); // We wont to close the dropdown if we are dealing with a single select box + + if (hasActiveDropdown && this._isSelectOneElement) { + this.hideDropdown(true); + this.containerOuter.focus(); + } + }; + + _proto._handleBackspace = function _handleBackspace(activeItems) { + if (!this.config.removeItems || !activeItems) { + return; + } + + var lastItem = activeItems[activeItems.length - 1]; + var hasHighlightedItems = activeItems.some(function (item) { + return item.highlighted; + }); // If editing the last item is allowed and there are not other selected items, + // we can edit the item value. Otherwise if we can remove items, remove all selected items + + if (this.config.editItems && !hasHighlightedItems && lastItem) { + this.input.value = lastItem.value; + this.input.setWidth(); + + this._removeItem(lastItem); + + this._triggerChange(lastItem.value); + } else { + if (!hasHighlightedItems) { + // Highlight last item if none already highlighted + this.highlightItem(lastItem, false); + } + + this.removeHighlightedItems(true); + } + }; + + _proto._setLoading = function _setLoading(isLoading) { + this._store.dispatch(setIsLoading(isLoading)); + }; + + _proto._handleLoadingState = function _handleLoadingState(setLoading) { + if (setLoading === void 0) { + setLoading = true; + } + + var placeholderItem = this.itemList.getChild("." + this.config.classNames.placeholder); + + if (setLoading) { + this.disable(); + this.containerOuter.addLoadingState(); + + if (this._isSelectOneElement) { + if (!placeholderItem) { + placeholderItem = this._getTemplate('placeholder', this.config.loadingText); + this.itemList.append(placeholderItem); + } else { + placeholderItem.innerHTML = this.config.loadingText; + } + } else { + this.input.placeholder = this.config.loadingText; + } + } else { + this.enable(); + this.containerOuter.removeLoadingState(); + + if (this._isSelectOneElement) { + placeholderItem.innerHTML = this._placeholderValue || ''; + } else { + this.input.placeholder = this._placeholderValue || ''; + } + } + }; + + _proto._handleSearch = function _handleSearch(value) { + if (!value || !this.input.isFocussed) { + return; + } + + var choices = this._store.choices; + var _this$config3 = this.config, + searchFloor = _this$config3.searchFloor, + searchChoices = _this$config3.searchChoices; + var hasUnactiveChoices = choices.some(function (option) { + return !option.active; + }); // Check that we have a value to search and the input was an alphanumeric character + + if (value && value.length >= searchFloor) { + var resultCount = searchChoices ? this._searchChoices(value) : 0; // Trigger search event + + this.passedElement.triggerEvent(EVENTS.search, { + value: value, + resultCount: resultCount + }); + } else if (hasUnactiveChoices) { + // Otherwise reset choices to active + this._isSearching = false; + + this._store.dispatch(choices_activateChoices(true)); + } + }; + + _proto._canAddItem = function _canAddItem(activeItems, value) { + var canAddItem = true; + var notice = isType('Function', this.config.addItemText) ? this.config.addItemText(value) : this.config.addItemText; + + if (!this._isSelectOneElement) { + var isDuplicateValue = existsInArray(activeItems, value); + + if (this.config.maxItemCount > 0 && this.config.maxItemCount <= activeItems.length) { + // If there is a max entry limit and we have reached that limit + // don't update + canAddItem = false; + notice = isType('Function', this.config.maxItemText) ? this.config.maxItemText(this.config.maxItemCount) : this.config.maxItemText; + } + + if (!this.config.duplicateItemsAllowed && isDuplicateValue && canAddItem) { + canAddItem = false; + notice = isType('Function', this.config.uniqueItemText) ? this.config.uniqueItemText(value) : this.config.uniqueItemText; + } + + if (this._isTextElement && this.config.addItems && canAddItem && isType('Function', this.config.addItemFilterFn) && !this.config.addItemFilterFn(value)) { + canAddItem = false; + notice = isType('Function', this.config.customAddItemText) ? this.config.customAddItemText(value) : this.config.customAddItemText; + } + } + + return { + response: canAddItem, + notice: notice + }; + }; + + _proto._ajaxCallback = function _ajaxCallback() { + var _this18 = this; + + return function (results, value, label) { + if (!results || !value) { + return; + } + + var parsedResults = isType('Object', results) ? [results] : results; + + if (parsedResults && isType('Array', parsedResults) && parsedResults.length) { + // Remove loading states/text + _this18._handleLoadingState(false); + + _this18._setLoading(true); // Add each result as a choice + + + parsedResults.forEach(function (result) { + if (result.choices) { + _this18._addGroup({ + group: result, + id: result.id || null, + valueKey: value, + labelKey: label + }); + } else { + _this18._addChoice({ + value: fetchFromObject(result, value), + label: fetchFromObject(result, label), + isSelected: result.selected, + isDisabled: result.disabled, + customProperties: result.customProperties, + placeholder: result.placeholder + }); + } + }); + + _this18._setLoading(false); + + if (_this18._isSelectOneElement) { + _this18._selectPlaceholderChoice(); + } + } else { + // No results, remove loading state + _this18._handleLoadingState(false); + } + }; + }; + + _proto._searchChoices = function _searchChoices(value) { + var newValue = isType('String', value) ? value.trim() : value; + var currentValue = isType('String', this._currentValue) ? this._currentValue.trim() : this._currentValue; + + if (newValue.length < 1 && newValue === currentValue + " ") { + return 0; + } // If new value matches the desired length and is not the same as the current value with a space + + + var haystack = this._store.searchableChoices; + var needle = newValue; + var keys = [].concat(this.config.searchFields); + var options = Object.assign(this.config.fuseOptions, { + keys: keys + }); + var fuse = new fuse_default.a(haystack, options); + var results = fuse.search(needle); + this._currentValue = newValue; + this._highlightPosition = 0; + this._isSearching = true; + + this._store.dispatch(choices_filterChoices(results)); + + return results.length; + }; + + _proto._addEventListeners = function _addEventListeners() { + window.delegateEvent.add('keyup', this._onKeyUp); + window.delegateEvent.add('keydown', this._onKeyDown); + window.delegateEvent.add('click', this._onClick); + window.delegateEvent.add('touchmove', this._onTouchMove); + window.delegateEvent.add('touchend', this._onTouchEnd); + window.delegateEvent.add('mousedown', this._onMouseDown); + window.delegateEvent.add('mouseover', this._onMouseOver); + + if (this._isSelectOneElement) { + this.containerOuter.element.addEventListener('focus', this._onFocus); + this.containerOuter.element.addEventListener('blur', this._onBlur); + } + + this.input.element.addEventListener('focus', this._onFocus); + this.input.element.addEventListener('blur', this._onBlur); + + if (this.input.element.form) { + this.input.element.form.addEventListener('reset', this._onFormReset); + } + + this.input.addEventListeners(); + }; + + _proto._removeEventListeners = function _removeEventListeners() { + window.delegateEvent.remove('keyup', this._onKeyUp); + window.delegateEvent.remove('keydown', this._onKeyDown); + window.delegateEvent.remove('click', this._onClick); + window.delegateEvent.remove('touchmove', this._onTouchMove); + window.delegateEvent.remove('touchend', this._onTouchEnd); + window.delegateEvent.remove('mousedown', this._onMouseDown); + window.delegateEvent.remove('mouseover', this._onMouseOver); + + if (this._isSelectOneElement) { + this.containerOuter.element.removeEventListener('focus', this._onFocus); + this.containerOuter.element.removeEventListener('blur', this._onBlur); + } + + this.input.element.removeEventListener('focus', this._onFocus); + this.input.element.removeEventListener('blur', this._onBlur); + + if (this.input.element.form) { + this.input.element.form.removeEventListener('reset', this._onFormReset); + } + + this.input.removeEventListeners(); + }; + + _proto._onKeyDown = function _onKeyDown(event) { + var _keyDownActions; + + var target = event.target, + keyCode = event.keyCode, + ctrlKey = event.ctrlKey, + metaKey = event.metaKey; + + if (target !== this.input.element && !this.containerOuter.element.contains(target)) { + return; + } + + var activeItems = this._store.activeItems; + var hasFocusedInput = this.input.isFocussed; + var hasActiveDropdown = this.dropdown.isActive; + var hasItems = this.itemList.hasChildren; + var keyString = String.fromCharCode(keyCode); + var BACK_KEY = KEY_CODES.BACK_KEY, + DELETE_KEY = KEY_CODES.DELETE_KEY, + ENTER_KEY = KEY_CODES.ENTER_KEY, + A_KEY = KEY_CODES.A_KEY, + ESC_KEY = KEY_CODES.ESC_KEY, + UP_KEY = KEY_CODES.UP_KEY, + DOWN_KEY = KEY_CODES.DOWN_KEY, + PAGE_UP_KEY = KEY_CODES.PAGE_UP_KEY, + PAGE_DOWN_KEY = KEY_CODES.PAGE_DOWN_KEY; + var hasCtrlDownKeyPressed = ctrlKey || metaKey; // If a user is typing and the dropdown is not active + + if (!this._isTextElement && /[a-zA-Z0-9-_ ]/.test(keyString)) { + this.showDropdown(); + } // Map keys to key actions + + + var keyDownActions = (_keyDownActions = {}, _keyDownActions[A_KEY] = this._onAKey, _keyDownActions[ENTER_KEY] = this._onEnterKey, _keyDownActions[ESC_KEY] = this._onEscapeKey, _keyDownActions[UP_KEY] = this._onDirectionKey, _keyDownActions[PAGE_UP_KEY] = this._onDirectionKey, _keyDownActions[DOWN_KEY] = this._onDirectionKey, _keyDownActions[PAGE_DOWN_KEY] = this._onDirectionKey, _keyDownActions[DELETE_KEY] = this._onDeleteKey, _keyDownActions[BACK_KEY] = this._onDeleteKey, _keyDownActions); // If keycode has a function, run it + + if (keyDownActions[keyCode]) { + keyDownActions[keyCode]({ + event: event, + target: target, + keyCode: keyCode, + metaKey: metaKey, + activeItems: activeItems, + hasFocusedInput: hasFocusedInput, + hasActiveDropdown: hasActiveDropdown, + hasItems: hasItems, + hasCtrlDownKeyPressed: hasCtrlDownKeyPressed + }); + } + }; + + _proto._onKeyUp = function _onKeyUp(_ref2) { + var target = _ref2.target, + keyCode = _ref2.keyCode; + + if (target !== this.input.element) { + return; + } + + var value = this.input.value; + var activeItems = this._store.activeItems; + + var canAddItem = this._canAddItem(activeItems, value); + + var backKey = KEY_CODES.BACK_KEY, + deleteKey = KEY_CODES.DELETE_KEY; // We are typing into a text input and have a value, we want to show a dropdown + // notice. Otherwise hide the dropdown + + if (this._isTextElement) { + var canShowDropdownNotice = canAddItem.notice && value; + + if (canShowDropdownNotice) { + var dropdownItem = this._getTemplate('notice', canAddItem.notice); + + this.dropdown.element.innerHTML = dropdownItem.outerHTML; + this.showDropdown(true); + } else { + this.hideDropdown(true); + } + } else { + var userHasRemovedValue = (keyCode === backKey || keyCode === deleteKey) && !target.value; + var canReactivateChoices = !this._isTextElement && this._isSearching; + var canSearch = this._canSearch && canAddItem.response; + + if (userHasRemovedValue && canReactivateChoices) { + this._isSearching = false; + + this._store.dispatch(choices_activateChoices(true)); + } else if (canSearch) { + this._handleSearch(this.input.value); + } + } + + this._canSearch = this.config.searchEnabled; + }; + + _proto._onAKey = function _onAKey(_ref3) { + var hasItems = _ref3.hasItems, + hasCtrlDownKeyPressed = _ref3.hasCtrlDownKeyPressed; + + // If CTRL + A or CMD + A have been pressed and there are items to select + if (hasCtrlDownKeyPressed && hasItems) { + this._canSearch = false; + var shouldHightlightAll = this.config.removeItems && !this.input.value && this.input.element === document.activeElement; + + if (shouldHightlightAll) { + this.highlightAll(); + } + } + }; + + _proto._onEnterKey = function _onEnterKey(_ref4) { + var event = _ref4.event, + target = _ref4.target, + activeItems = _ref4.activeItems, + hasActiveDropdown = _ref4.hasActiveDropdown; + var enterKey = KEY_CODES.ENTER_KEY; + var targetWasButton = target.hasAttribute('data-button'); + + if (this._isTextElement && target.value) { + var value = this.input.value; + + var canAddItem = this._canAddItem(activeItems, value); + + if (canAddItem.response) { + this.hideDropdown(true); + + this._addItem({ + value: value + }); + + this._triggerChange(value); + + this.clearInput(); + } + } + + if (targetWasButton) { + this._handleButtonAction(activeItems, target); + + event.preventDefault(); + } + + if (hasActiveDropdown) { + var highlightedChoice = this.dropdown.getChild("." + this.config.classNames.highlightedState); + + if (highlightedChoice) { + // add enter keyCode value + if (activeItems[0]) { + activeItems[0].keyCode = enterKey; // eslint-disable-line no-param-reassign + } + + this._handleChoiceAction(activeItems, highlightedChoice); + } + + event.preventDefault(); + } else if (this._isSelectOneElement) { + this.showDropdown(); + event.preventDefault(); + } + }; + + _proto._onEscapeKey = function _onEscapeKey(_ref5) { + var hasActiveDropdown = _ref5.hasActiveDropdown; + + if (hasActiveDropdown) { + this.hideDropdown(true); + this.containerOuter.focus(); + } + }; + + _proto._onDirectionKey = function _onDirectionKey(_ref6) { + var event = _ref6.event, + hasActiveDropdown = _ref6.hasActiveDropdown, + keyCode = _ref6.keyCode, + metaKey = _ref6.metaKey; + var downKey = KEY_CODES.DOWN_KEY, + pageUpKey = KEY_CODES.PAGE_UP_KEY, + pageDownKey = KEY_CODES.PAGE_DOWN_KEY; // If up or down key is pressed, traverse through options + + if (hasActiveDropdown || this._isSelectOneElement) { + this.showDropdown(); + this._canSearch = false; + var directionInt = keyCode === downKey || keyCode === pageDownKey ? 1 : -1; + var skipKey = metaKey || keyCode === pageDownKey || keyCode === pageUpKey; + var selectableChoiceIdentifier = '[data-choice-selectable]'; + var nextEl; + + if (skipKey) { + if (directionInt > 0) { + nextEl = Array.from(this.dropdown.element.querySelectorAll(selectableChoiceIdentifier)).pop(); + } else { + nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier); + } + } else { + var currentEl = this.dropdown.element.querySelector("." + this.config.classNames.highlightedState); + + if (currentEl) { + nextEl = getAdjacentEl(currentEl, selectableChoiceIdentifier, directionInt); + } else { + nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier); + } + } + + if (nextEl) { + // We prevent default to stop the cursor moving + // when pressing the arrow + if (!isScrolledIntoView(nextEl, this.choiceList.element, directionInt)) { + this.choiceList.scrollToChoice(nextEl, directionInt); + } + + this._highlightChoice(nextEl); + } // Prevent default to maintain cursor position whilst + // traversing dropdown options + + + event.preventDefault(); + } + }; + + _proto._onDeleteKey = function _onDeleteKey(_ref7) { + var event = _ref7.event, + target = _ref7.target, + hasFocusedInput = _ref7.hasFocusedInput, + activeItems = _ref7.activeItems; + + // If backspace or delete key is pressed and the input has no value + if (hasFocusedInput && !target.value && !this._isSelectOneElement) { + this._handleBackspace(activeItems); + + event.preventDefault(); + } + }; + + _proto._onTouchMove = function _onTouchMove() { + if (this._wasTap) { + this._wasTap = false; + } + }; + + _proto._onTouchEnd = function _onTouchEnd(event) { + var _ref8 = event || event.touches[0], + target = _ref8.target; + + var touchWasWithinContainer = this._wasTap && this.containerOuter.element.contains(target); + + if (touchWasWithinContainer) { + var containerWasExactTarget = target === this.containerOuter.element || target === this.containerInner.element; + + if (containerWasExactTarget) { + if (this._isTextElement) { + this.input.focus(); + } else if (this._isSelectMultipleElement) { + this.showDropdown(); + } + } // Prevents focus event firing + + + event.stopPropagation(); + } + + this._wasTap = true; + }; + + _proto._onMouseDown = function _onMouseDown(event) { + var target = event.target, + shiftKey = event.shiftKey; // If we have our mouse down on the scrollbar and are on IE11... + + if (this.choiceList.element.contains(target) && isIE11()) { + this._isScrollingOnIe = true; + } + + if (!this.containerOuter.element.contains(target) || target === this.input.element) { + return; + } + + var activeItems = this._store.activeItems; + var hasShiftKey = shiftKey; + var buttonTarget = findAncestorByAttrName(target, 'data-button'); + var itemTarget = findAncestorByAttrName(target, 'data-item'); + var choiceTarget = findAncestorByAttrName(target, 'data-choice'); + + if (buttonTarget) { + this._handleButtonAction(activeItems, buttonTarget); + } else if (itemTarget) { + this._handleItemAction(activeItems, itemTarget, hasShiftKey); + } else if (choiceTarget) { + this._handleChoiceAction(activeItems, choiceTarget); + } + + event.preventDefault(); + }; + + _proto._onMouseOver = function _onMouseOver(_ref9) { + var target = _ref9.target; + var targetWithinDropdown = target === this.dropdown || this.dropdown.element.contains(target); + var shouldHighlightChoice = targetWithinDropdown && target.hasAttribute('data-choice'); + + if (shouldHighlightChoice) { + this._highlightChoice(target); + } + }; + + _proto._onClick = function _onClick(_ref10) { + var target = _ref10.target; + var clickWasWithinContainer = this.containerOuter.element.contains(target); + + if (clickWasWithinContainer) { + if (!this.dropdown.isActive && !this.containerOuter.isDisabled) { + if (this._isTextElement) { + if (document.activeElement !== this.input.element) { + this.input.focus(); + } + } else { + this.showDropdown(); + this.containerOuter.focus(); + } + } else if (this._isSelectOneElement && target !== this.input.element && !this.dropdown.element.contains(target)) { + this.hideDropdown(); + } + } else { + var hasHighlightedItems = this._store.highlightedActiveItems.length > 0; + + if (hasHighlightedItems) { + this.unhighlightAll(); + } + + this.containerOuter.removeFocusState(); + this.hideDropdown(true); + } + }; + + _proto._onFocus = function _onFocus(_ref11) { + var _this19 = this; + + var target = _ref11.target; + var focusWasWithinContainer = this.containerOuter.element.contains(target); + + if (!focusWasWithinContainer) { + return; + } + + var focusActions = { + text: function text() { + if (target === _this19.input.element) { + _this19.containerOuter.addFocusState(); + } + }, + 'select-one': function selectOne() { + _this19.containerOuter.addFocusState(); + + if (target === _this19.input.element) { + _this19.showDropdown(true); + } + }, + 'select-multiple': function selectMultiple() { + if (target === _this19.input.element) { + _this19.showDropdown(true); // If element is a select box, the focused element is the container and the dropdown + // isn't already open, focus and show dropdown + + + _this19.containerOuter.addFocusState(); + } + } + }; + focusActions[this.passedElement.element.type](); + }; + + _proto._onBlur = function _onBlur(_ref12) { + var _this20 = this; + + var target = _ref12.target; + var blurWasWithinContainer = this.containerOuter.element.contains(target); + + if (blurWasWithinContainer && !this._isScrollingOnIe) { + var activeItems = this._store.activeItems; + var hasHighlightedItems = activeItems.some(function (item) { + return item.highlighted; + }); + var blurActions = { + text: function text() { + if (target === _this20.input.element) { + _this20.containerOuter.removeFocusState(); + + if (hasHighlightedItems) { + _this20.unhighlightAll(); + } + + _this20.hideDropdown(true); + } + }, + 'select-one': function selectOne() { + _this20.containerOuter.removeFocusState(); + + if (target === _this20.input.element || target === _this20.containerOuter.element && !_this20._canSearch) { + _this20.hideDropdown(true); + } + }, + 'select-multiple': function selectMultiple() { + if (target === _this20.input.element) { + _this20.containerOuter.removeFocusState(); + + _this20.hideDropdown(true); + + if (hasHighlightedItems) { + _this20.unhighlightAll(); + } + } + } + }; + blurActions[this.passedElement.element.type](); + } else { + // On IE11, clicking the scollbar blurs our input and thus + // closes the dropdown. To stop this, we refocus our input + // if we know we are on IE *and* are scrolling. + this._isScrollingOnIe = false; + this.input.element.focus(); + } + }; + + _proto._onFormReset = function _onFormReset() { + this._store.dispatch(resetTo(this._initialState)); + }; + + _proto._highlightChoice = function _highlightChoice(el) { + var _this21 = this; + + if (el === void 0) { + el = null; + } + + var choices = Array.from(this.dropdown.element.querySelectorAll('[data-choice-selectable]')); + + if (!choices.length) { + return; + } + + var passedEl = el; + var highlightedChoices = Array.from(this.dropdown.element.querySelectorAll("." + this.config.classNames.highlightedState)); // Remove any highlighted choices + + highlightedChoices.forEach(function (choice) { + choice.classList.remove(_this21.config.classNames.highlightedState); + choice.setAttribute('aria-selected', 'false'); + }); + + if (passedEl) { + this._highlightPosition = choices.indexOf(passedEl); + } else { + // Highlight choice based on last known highlight location + if (choices.length > this._highlightPosition) { + // If we have an option to highlight + passedEl = choices[this._highlightPosition]; + } else { + // Otherwise highlight the option before + passedEl = choices[choices.length - 1]; + } + + if (!passedEl) { + passedEl = choices[0]; + } + } + + passedEl.classList.add(this.config.classNames.highlightedState); + passedEl.setAttribute('aria-selected', 'true'); + this.passedElement.triggerEvent(EVENTS.highlightChoice, { + el: passedEl + }); + + if (this.dropdown.isActive) { + // IE11 ignores aria-label and blocks virtual keyboard + // if aria-activedescendant is set without a dropdown + this.input.setActiveDescendant(passedEl.id); + this.containerOuter.setActiveDescendant(passedEl.id); + } + }; + + _proto._addItem = function _addItem(_ref13) { + var value = _ref13.value, + _ref13$label = _ref13.label, + label = _ref13$label === void 0 ? null : _ref13$label, + _ref13$choiceId = _ref13.choiceId, + choiceId = _ref13$choiceId === void 0 ? -1 : _ref13$choiceId, + _ref13$groupId = _ref13.groupId, + groupId = _ref13$groupId === void 0 ? -1 : _ref13$groupId, + _ref13$customProperti = _ref13.customProperties, + customProperties = _ref13$customProperti === void 0 ? null : _ref13$customProperti, + _ref13$placeholder = _ref13.placeholder, + placeholder = _ref13$placeholder === void 0 ? false : _ref13$placeholder, + _ref13$keyCode = _ref13.keyCode, + keyCode = _ref13$keyCode === void 0 ? null : _ref13$keyCode; + var passedValue = isType('String', value) ? value.trim() : value; + var passedKeyCode = keyCode; + var passedCustomProperties = customProperties; + var items = this._store.items; + var passedLabel = label || passedValue; + var passedOptionId = parseInt(choiceId, 10) || -1; + var group = groupId >= 0 ? this._store.getGroupById(groupId) : null; + var id = items ? items.length + 1 : 1; // If a prepended value has been passed, prepend it + + if (this.config.prependValue) { + passedValue = this.config.prependValue + passedValue.toString(); + } // If an appended value has been passed, append it + + + if (this.config.appendValue) { + passedValue += this.config.appendValue.toString(); + } + + this._store.dispatch(items_addItem({ + value: passedValue, + label: passedLabel, + id: id, + choiceId: passedOptionId, + groupId: groupId, + customProperties: customProperties, + placeholder: placeholder, + keyCode: passedKeyCode + })); + + if (this._isSelectOneElement) { + this.removeActiveItems(id); + } // Trigger change event + + + this.passedElement.triggerEvent(EVENTS.addItem, { + id: id, + value: passedValue, + label: passedLabel, + customProperties: passedCustomProperties, + groupValue: group && group.value ? group.value : undefined, + keyCode: passedKeyCode + }); + return this; + }; + + _proto._removeItem = function _removeItem(item) { + if (!item || !isType('Object', item)) { + return this; + } + + var id = item.id, + value = item.value, + label = item.label, + choiceId = item.choiceId, + groupId = item.groupId; + var group = groupId >= 0 ? this._store.getGroupById(groupId) : null; + + this._store.dispatch(items_removeItem(id, choiceId)); + + if (group && group.value) { + this.passedElement.triggerEvent(EVENTS.removeItem, { + id: id, + value: value, + label: label, + groupValue: group.value + }); + } else { + this.passedElement.triggerEvent(EVENTS.removeItem, { + id: id, + value: value, + label: label + }); + } + + return this; + }; + + _proto._addChoice = function _addChoice(_ref14) { + var value = _ref14.value, + _ref14$label = _ref14.label, + label = _ref14$label === void 0 ? null : _ref14$label, + _ref14$isSelected = _ref14.isSelected, + isSelected = _ref14$isSelected === void 0 ? false : _ref14$isSelected, + _ref14$isDisabled = _ref14.isDisabled, + isDisabled = _ref14$isDisabled === void 0 ? false : _ref14$isDisabled, + _ref14$groupId = _ref14.groupId, + groupId = _ref14$groupId === void 0 ? -1 : _ref14$groupId, + _ref14$customProperti = _ref14.customProperties, + customProperties = _ref14$customProperti === void 0 ? null : _ref14$customProperti, + _ref14$placeholder = _ref14.placeholder, + placeholder = _ref14$placeholder === void 0 ? false : _ref14$placeholder, + _ref14$keyCode = _ref14.keyCode, + keyCode = _ref14$keyCode === void 0 ? null : _ref14$keyCode; + + if (typeof value === 'undefined' || value === null) { + return; + } // Generate unique id + + + var choices = this._store.choices; + var choiceLabel = label || value; + var choiceId = choices ? choices.length + 1 : 1; + var choiceElementId = this._baseId + "-" + this._idNames.itemChoice + "-" + choiceId; + + this._store.dispatch(choices_addChoice({ + value: value, + label: choiceLabel, + id: choiceId, + groupId: groupId, + disabled: isDisabled, + elementId: choiceElementId, + customProperties: customProperties, + placeholder: placeholder, + keyCode: keyCode + })); + + if (isSelected) { + this._addItem({ + value: value, + label: choiceLabel, + choiceId: choiceId, + customProperties: customProperties, + placeholder: placeholder, + keyCode: keyCode + }); + } + }; + + _proto._addGroup = function _addGroup(_ref15) { + var _this22 = this; + + var group = _ref15.group, + id = _ref15.id, + _ref15$valueKey = _ref15.valueKey, + valueKey = _ref15$valueKey === void 0 ? 'value' : _ref15$valueKey, + _ref15$labelKey = _ref15.labelKey, + labelKey = _ref15$labelKey === void 0 ? 'label' : _ref15$labelKey; + var groupChoices = isType('Object', group) ? group.choices : Array.from(group.getElementsByTagName('OPTION')); + var groupId = id || Math.floor(new Date().valueOf() * Math.random()); + var isDisabled = group.disabled ? group.disabled : false; + + if (groupChoices) { + this._store.dispatch(groups_addGroup(group.label, groupId, true, isDisabled)); + + var addGroupChoices = function addGroupChoices(choice) { + var isOptDisabled = choice.disabled || choice.parentNode && choice.parentNode.disabled; + + _this22._addChoice({ + value: choice[valueKey], + label: isType('Object', choice) ? choice[labelKey] : choice.innerHTML, + isSelected: choice.selected, + isDisabled: isOptDisabled, + groupId: groupId, + customProperties: choice.customProperties, + placeholder: choice.placeholder + }); + }; + + groupChoices.forEach(addGroupChoices); + } else { + this._store.dispatch(groups_addGroup(group.label, group.id, false, group.disabled)); + } + }; + + _proto._getTemplate = function _getTemplate(template) { + var _templates$template; + + if (!template) { + return null; + } + + var _this$config4 = this.config, + templates = _this$config4.templates, + classNames = _this$config4.classNames; + + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + return (_templates$template = templates[template]).call.apply(_templates$template, [this, classNames].concat(args)); + }; + + _proto._createTemplates = function _createTemplates() { + var callbackOnCreateTemplates = this.config.callbackOnCreateTemplates; + var userTemplates = {}; + + if (callbackOnCreateTemplates && isType('Function', callbackOnCreateTemplates)) { + userTemplates = callbackOnCreateTemplates.call(this, strToEl); + } + + this.config.templates = cjs_default()(TEMPLATES, userTemplates); + }; + + _proto._createElements = function _createElements() { + this.containerOuter = new container_Container({ + element: this._getTemplate('containerOuter', this._direction, this._isSelectElement, this._isSelectOneElement, this.config.searchEnabled, this.passedElement.element.type), + classNames: this.config.classNames, + type: this.passedElement.element.type, + position: this.config.position + }); + this.containerInner = new container_Container({ + element: this._getTemplate('containerInner'), + classNames: this.config.classNames, + type: this.passedElement.element.type, + position: this.config.position + }); + this.input = new input_Input({ + element: this._getTemplate('input', this._placeholderValue), + classNames: this.config.classNames, + type: this.passedElement.element.type + }); + this.choiceList = new list_List({ + element: this._getTemplate('choiceList', this._isSelectOneElement) + }); + this.itemList = new list_List({ + element: this._getTemplate('itemList', this._isSelectOneElement) + }); + this.dropdown = new Dropdown({ + element: this._getTemplate('dropdown'), + classNames: this.config.classNames, + type: this.passedElement.element.type + }); + }; + + _proto._createStructure = function _createStructure() { + // Hide original element + this.passedElement.conceal(); // Wrap input in container preserving DOM ordering + + this.containerInner.wrap(this.passedElement.element); // Wrapper inner container with outer container + + this.containerOuter.wrap(this.containerInner.element); + + if (this._isSelectOneElement) { + this.input.placeholder = this.config.searchPlaceholderValue || ''; + } else if (this._placeholderValue) { + this.input.placeholder = this._placeholderValue; + this.input.setWidth(true); + } + + this.containerOuter.element.appendChild(this.containerInner.element); + this.containerOuter.element.appendChild(this.dropdown.element); + this.containerInner.element.appendChild(this.itemList.element); + + if (!this._isTextElement) { + this.dropdown.element.appendChild(this.choiceList.element); + } + + if (!this._isSelectOneElement) { + this.containerInner.element.appendChild(this.input.element); + } else if (this.config.searchEnabled) { + this.dropdown.element.insertBefore(this.input.element, this.dropdown.element.firstChild); + } + + if (this._isSelectElement) { + this._addPredefinedChoices(); + } else if (this._isTextElement) { + this._addPredefinedItems(); + } + }; + + _proto._addPredefinedChoices = function _addPredefinedChoices() { + var _this23 = this; + + var passedGroups = this.passedElement.optionGroups; + this._highlightPosition = 0; + this._isSearching = false; + + this._setLoading(true); + + if (passedGroups && passedGroups.length) { + // If we have a placeholder option + var placeholderChoice = this.passedElement.placeholderOption; + + if (placeholderChoice && placeholderChoice.parentNode.tagName === 'SELECT') { + this._addChoice({ + value: placeholderChoice.value, + label: placeholderChoice.innerHTML, + isSelected: placeholderChoice.selected, + isDisabled: placeholderChoice.disabled, + placeholder: true + }); + } + + passedGroups.forEach(function (group) { + return _this23._addGroup({ + group: group, + id: group.id || null + }); + }); + } else { + var passedOptions = this.passedElement.options; + var filter = this.config.sortFn; + var allChoices = this._presetChoices; // Create array of options from option elements + + passedOptions.forEach(function (o) { + allChoices.push({ + value: o.value, + label: o.innerHTML, + selected: o.selected, + disabled: o.disabled || o.parentNode.disabled, + placeholder: o.hasAttribute('placeholder'), + customProperties: o.getAttribute('data-custom-properties') + }); + }); // If sorting is enabled or the user is searching, filter choices + + if (this.config.shouldSort) allChoices.sort(filter); // Determine whether there is a selected choice + + var hasSelectedChoice = allChoices.some(function (choice) { + return choice.selected; + }); + + var handleChoice = function handleChoice(choice, index) { + var value = choice.value, + label = choice.label, + customProperties = choice.customProperties, + placeholder = choice.placeholder; + + if (_this23._isSelectElement) { + // If the choice is actually a group + if (choice.choices) { + _this23._addGroup({ + group: choice, + id: choice.id || null + }); + } else { + // If there is a selected choice already or the choice is not + // the first in the array, add each choice normally + // Otherwise pre-select the first choice in the array if it's a single select + var shouldPreselect = _this23._isSelectOneElement && !hasSelectedChoice && index === 0; + var isSelected = shouldPreselect ? true : choice.selected; + var isDisabled = shouldPreselect ? false : choice.disabled; + + _this23._addChoice({ + value: value, + label: label, + isSelected: isSelected, + isDisabled: isDisabled, + customProperties: customProperties, + placeholder: placeholder + }); + } + } else { + _this23._addChoice({ + value: value, + label: label, + isSelected: choice.selected, + isDisabled: choice.disabled, + customProperties: customProperties, + placeholder: placeholder + }); + } + }; // Add each choice + + + allChoices.forEach(function (choice, index) { + return handleChoice(choice, index); + }); + } + + this._setLoading(false); + }; + + _proto._addPredefinedItems = function _addPredefinedItems() { + var _this24 = this; + + var handlePresetItem = function handlePresetItem(item) { + var itemType = getType(item); + + if (itemType === 'Object' && item.value) { + _this24._addItem({ + value: item.value, + label: item.label, + choiceId: item.id, + customProperties: item.customProperties, + placeholder: item.placeholder + }); + } else if (itemType === 'String') { + _this24._addItem({ + value: item + }); + } + }; + + this._presetItems.forEach(function (item) { + return handlePresetItem(item); + }); + }; + + _proto._setChoiceOrItem = function _setChoiceOrItem(item) { + var _this25 = this; + + var itemType = getType(item).toLowerCase(); + var handleType = { + object: function object() { + if (!item.value) { + return; + } // If we are dealing with a select input, we need to create an option first + // that is then selected. For text inputs we can just add items normally. + + + if (!_this25._isTextElement) { + _this25._addChoice({ + value: item.value, + label: item.label, + isSelected: true, + isDisabled: false, + customProperties: item.customProperties, + placeholder: item.placeholder + }); + } else { + _this25._addItem({ + value: item.value, + label: item.label, + choiceId: item.id, + customProperties: item.customProperties, + placeholder: item.placeholder + }); + } + }, + string: function string() { + if (!_this25._isTextElement) { + _this25._addChoice({ + value: item, + label: item, + isSelected: true, + isDisabled: false + }); + } else { + _this25._addItem({ + value: item + }); + } + } + }; + handleType[itemType](); + }; + + _proto._findAndSelectChoiceByValue = function _findAndSelectChoiceByValue(val) { + var _this26 = this; + + var choices = this._store.choices; // Check 'value' property exists and the choice isn't already selected + + var foundChoice = choices.find(function (choice) { + return _this26.config.itemComparer(choice.value, val); + }); + + if (foundChoice && !foundChoice.selected) { + this._addItem({ + value: foundChoice.value, + label: foundChoice.label, + choiceId: foundChoice.id, + groupId: foundChoice.groupId, + customProperties: foundChoice.customProperties, + placeholder: foundChoice.placeholder, + keyCode: foundChoice.keyCode + }); + } + }; + + _proto._generateInstances = function _generateInstances(elements, config) { + return elements.reduce(function (instances, element) { + instances.push(new Choices(element, config)); + return instances; + }, [this]); + }; + + _proto._generatePlaceholderValue = function _generatePlaceholderValue() { + if (this._isSelectOneElement) { + return false; + } + + return this.config.placeholder ? this.config.placeholderValue || this.passedElement.element.getAttribute('placeholder') : false; + } + /* ===== End of Private functions ====== */ + ; + + return Choices; +}(); + +choices_Choices.userDefaults = {}; +/* harmony default export */ var scripts_choices = __webpack_exports__["default"] = (choices_Choices); /***/ }) -/******/ ]); +/******/ ])["default"]; }); \ No newline at end of file diff --git a/public/assets/scripts/choices.min.js b/public/assets/scripts/choices.min.js index f794766..17349d3 100644 --- a/public/assets/scripts/choices.min.js +++ b/public/assets/scripts/choices.min.js @@ -1,5 +1,10 @@ -/*! choices.js v7.1.0 | (c) 2019 Josh Johnson | https://github.com/jshjohnson/Choices#readme */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Choices=t():e.Choices=t()}(window,function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)i.d(n,o,function(t){return e[t]}.bind(null,o));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/public/assets/scripts/",i(i.s=8)}([function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.diff=t.cloneObject=t.existsInArray=t.isIE11=t.fetchFromObject=t.getWindowHeight=t.dispatchEvent=t.sortByScore=t.sortByAlpha=t.calcWidthOfInput=t.strToEl=t.sanitise=t.isScrolledIntoView=t.getAdjacentEl=t.findAncestorByAttrName=t.wrap=t.isElement=t.isType=t.getType=t.generateId=t.generateChars=t.getRandomNumber=void 0;var n=function(e,t){return Math.floor(Math.random()*(t-e)+e)};t.getRandomNumber=n;var o=function(e){for(var t="",i=0;i1&&void 0!==arguments[1]?arguments[1]:document.createElement("div");return e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),t.appendChild(e)};t.findAncestorByAttrName=function(e,t){for(var i=e;i;){if(i.hasAttribute(t))return i;i=i.parentElement}return null};t.getAdjacentEl=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e&&t){var n=e.parentNode.parentNode,o=Array.from(n.querySelectorAll(t)),r=o.indexOf(e);return o[r+(i>0?1:-1)]}};t.isScrolledIntoView=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e)return i>0?t.scrollTop+t.offsetHeight>=e.offsetTop+e.offsetHeight:e.offsetTop>=t.scrollTop};var a=function(e){return s("String",e)?e.replace(/&/g,"&").replace(/>/g,"&rt;").replace(/".concat(a(i),""));if(o.style.position="absolute",o.style.padding="0",o.style.top="-9999px",o.style.left="-9999px",o.style.width="auto",o.style.whiteSpace="pre",document.body.contains(e)&&window.getComputedStyle){var r=window.getComputedStyle(e);r&&(o.style.fontSize=r.fontSize,o.style.fontFamily=r.fontFamily,o.style.fontWeight=r.fontWeight,o.style.fontStyle=r.fontStyle,o.style.letterSpacing=r.letterSpacing,o.style.textTransform=r.textTransform,o.style.paddingLeft=r.paddingLeft,o.style.paddingRight=r.paddingRight)}document.body.appendChild(o),requestAnimationFrame(function(){i&&o.offsetWidth!==e.offsetWidth&&(n=o.offsetWidth+4),document.body.removeChild(o),t.call(void 0,"".concat(n,"px"))})}else t.call(void 0,"".concat(n,"px"))};t.sortByAlpha=function(e,t){var i="".concat(e.label||e.value).toLowerCase(),n="".concat(t.label||t.value).toLowerCase();return in?1:0};t.sortByScore=function(e,t){return e.score-t.score};t.dispatchEvent=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0});return e.dispatchEvent(n)};t.getWindowHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)};t.fetchFromObject=function e(t,i){var n=i.indexOf(".");return n>-1?e(t[i.substring(0,n)],i.substr(n+1)):t[i]};t.isIE11=function(){return!(!navigator.userAgent.match(/Trident/)||!navigator.userAgent.match(/rv[ :]11/))};t.existsInArray=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"value";return e.some(function(e){return s("String",t)?e[i]===t.trim():e[i]===t})};t.cloneObject=function(e){return JSON.parse(JSON.stringify(e))};t.diff=function(e,t){var i=Object.keys(e).sort(),n=Object.keys(t).sort();return i.filter(function(e){return n.indexOf(e)<0})}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SCROLLING_SPEED=t.KEY_CODES=t.ACTION_TYPES=t.EVENTS=t.DEFAULT_CONFIG=t.DEFAULT_CLASSNAMES=void 0;var n=i(0),o={containerOuter:"choices",containerInner:"choices__inner",input:"choices__input",inputCloned:"choices__input--cloned",list:"choices__list",listItems:"choices__list--multiple",listSingle:"choices__list--single",listDropdown:"choices__list--dropdown",item:"choices__item",itemSelectable:"choices__item--selectable",itemDisabled:"choices__item--disabled",itemChoice:"choices__item--choice",placeholder:"choices__placeholder",group:"choices__group",groupHeading:"choices__heading",button:"choices__button",activeState:"is-active",focusState:"is-focused",openState:"is-open",disabledState:"is-disabled",highlightedState:"is-highlighted",hiddenState:"is-hidden",flippedState:"is-flipped",loadingState:"is-loading",noResults:"has-no-results",noChoices:"has-no-choices"};t.DEFAULT_CLASSNAMES=o;var r={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,addItems:!0,addItemFilterFn:null,removeItems:!0,removeItemButton:!1,editItems:!1,duplicateItemsAllowed:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,shouldSort:!0,shouldSortItems:!1,sortFn:n.sortByAlpha,placeholder:!0,placeholderValue:null,searchPlaceholderValue:null,prependValue:null,appendValue:null,renderSelectedChoices:"auto",loadingText:"Loading...",noResultsText:"No results found",noChoicesText:"No choices to choose from",itemSelectText:"Press to select",uniqueItemText:"Only unique values can be added",customAddItemText:"Only values matching specific conditions can be added",addItemText:function(e){return'Press Enter to add "'.concat((0,n.sanitise)(e),'"')},maxItemText:function(e){return"Only ".concat(e," values can be added")},itemComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},callbackOnInit:null,callbackOnCreateTemplates:null,classNames:o};t.DEFAULT_CONFIG=r;t.EVENTS={showDropdown:"showDropdown",hideDropdown:"hideDropdown",change:"change",choice:"choice",search:"search",addItem:"addItem",removeItem:"removeItem",highlightItem:"highlightItem",highlightChoice:"highlightChoice"};t.ACTION_TYPES={ADD_CHOICE:"ADD_CHOICE",FILTER_CHOICES:"FILTER_CHOICES",ACTIVATE_CHOICES:"ACTIVATE_CHOICES",CLEAR_CHOICES:"CLEAR_CHOICES",ADD_GROUP:"ADD_GROUP",ADD_ITEM:"ADD_ITEM",REMOVE_ITEM:"REMOVE_ITEM",HIGHLIGHT_ITEM:"HIGHLIGHT_ITEM",CLEAR_ALL:"CLEAR_ALL"};t.KEY_CODES={BACK_KEY:46,DELETE_KEY:8,ENTER_KEY:13,A_KEY:65,ESC_KEY:27,UP_KEY:38,DOWN_KEY:40,PAGE_UP_KEY:33,PAGE_DOWN_KEY:34};t.SCROLLING_SPEED=4},function(e,t,i){"use strict";(function(e,n){var o,r=i(6);o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:n;var s=Object(r.a)(o);t.a=s}).call(this,i(3),i(14)(e))},function(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=i(0);function o(e,t){for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(s)throw s;for(var n=!1,o={},a=0;a0&&void 0!==arguments[0]?arguments[0]:"[data-choice]",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,p.isType)("String",i)){var l=Array.from(document.querySelectorAll(i));if(l.length>1)return this._generateInstances(l,n)}this.config=o.default.all([a.DEFAULT_CONFIG,e.userDefaults,n],{arrayMerge:function(e,t){return[].concat(t)}});var c=(0,p.diff)(this.config,a.DEFAULT_CONFIG);c.length&&console.warn("Unknown config option(s) passed",c.join(", ")),["auto","always"].includes(this.config.renderSelectedChoices)||(this.config.renderSelectedChoices="auto");var u=(0,p.isType)("String",i)?document.querySelector(i):i;return u?(this._isTextElement="text"===u.type,this._isSelectOneElement="select-one"===u.type,this._isSelectMultipleElement="select-multiple"===u.type,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._isTextElement?this.passedElement=new s.WrappedInput({element:u,classNames:this.config.classNames,delimiter:this.config.delimiter}):this._isSelectElement&&(this.passedElement=new s.WrappedSelect({element:u,classNames:this.config.classNames,template:function(e){return t.config.templates.option(e)}})),this.passedElement?(!0===this.config.shouldSortItems&&this._isSelectOneElement&&!this.config.silent&&console.warn("shouldSortElements: Type of passed element is 'select-one', falling back to false."),this.initialised=!1,this._store=new r.default(this.render),this._initialState={},this._currentState={},this._prevState={},this._currentValue="",this._canSearch=this.config.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=(0,p.generateId)(this.passedElement.element,"choices-"),this._direction=this.passedElement.element.getAttribute("dir")||"ltr",this._idNames={itemChoice:"item-choice"},this._presetChoices=this.config.choices,this._presetItems=this.config.items,this.passedElement.value&&(this._presetItems=this._presetItems.concat(this.passedElement.value.split(this.config.delimiter))),this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onClick=this._onClick.bind(this),this._onTouchMove=this._onTouchMove.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseOver=this._onMouseOver.bind(this),this._onFormReset=this._onFormReset.bind(this),this._onAKey=this._onAKey.bind(this),this._onEnterKey=this._onEnterKey.bind(this),this._onEscapeKey=this._onEscapeKey.bind(this),this._onDirectionKey=this._onDirectionKey.bind(this),this._onDeleteKey=this._onDeleteKey.bind(this),"active"===this.passedElement.element.getAttribute("data-choice")&&console.warn("Trying to initialise Choices on element already initialised"),void this.init()):console.error("Passed element was of an invalid type")):console.error("Could not find passed element or passed element was of an invalid type")}var t,i,v;return t=e,(i=[{key:"init",value:function(){if(!this.initialised){this._createTemplates(),this._createElements(),this._createStructure(),this._initialState=(0,p.cloneObject)(this._store.state),this._store.subscribe(this._render),this._render(),this._addEventListeners(),(!this.config.addItems||this.passedElement.element.hasAttribute("disabled"))&&this.disable(),this.initialised=!0;var e=this.config.callbackOnInit;e&&(0,p.isType)("Function",e)&&e.call(this)}}},{key:"destroy",value:function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this._isSelectElement&&(this.passedElement.options=this._presetChoices),this.clearStore(),this.config.templates=null,this.initialised=!1)}},{key:"enable",value:function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this}},{key:"disable",value:function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this}},{key:"highlightItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return this;var i=e.id,n=e.groupId,o=void 0===n?-1:n,r=e.value,s=void 0===r?"":r,l=e.label,c=void 0===l?"":l,h=o>=0?this._store.getGroupById(o):null;return this._store.dispatch((0,u.highlightItem)(i,!0)),t&&this.passedElement.triggerEvent(a.EVENTS.highlightItem,{id:i,value:s,label:c,groupValue:h&&h.value?h.value:null}),this}},{key:"unhighlightItem",value:function(e){if(!e)return this;var t=e.id,i=e.groupId,n=void 0===i?-1:i,o=e.value,r=void 0===o?"":o,s=e.label,l=void 0===s?"":s,c=n>=0?this._store.getGroupById(n):null;return this._store.dispatch((0,u.highlightItem)(t,!1)),this.passedElement.triggerEvent(a.EVENTS.highlightItem,{id:t,value:r,label:l,groupValue:c&&c.value?c.value:null}),this}},{key:"highlightAll",value:function(){var e=this;return this._store.items.forEach(function(t){return e.highlightItem(t)}),this}},{key:"unhighlightAll",value:function(){var e=this;return this._store.items.forEach(function(t){return e.unhighlightItem(t)}),this}},{key:"removeActiveItemsByValue",value:function(e){var t=this;return this._store.activeItems.filter(function(t){return t.value===e}).forEach(function(e){return t._removeItem(e)}),this}},{key:"removeActiveItems",value:function(e){var t=this;return this._store.activeItems.filter(function(t){return t.id!==e}).forEach(function(e){return t._removeItem(e)}),this}},{key:"removeHighlightedItems",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._store.highlightedActiveItems.forEach(function(i){e._removeItem(i),t&&e._triggerChange(i.value)}),this}},{key:"showDropdown",value:function(e){var t=this;return this.dropdown.isActive?this:(requestAnimationFrame(function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow()),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent(a.EVENTS.showDropdown,{})}),this)}},{key:"hideDropdown",value:function(e){var t=this;return this.dropdown.isActive?(requestAnimationFrame(function(){t.dropdown.hide(),t.containerOuter.close(),!e&&t._canSearch&&(t.input.removeActiveDescendant(),t.input.blur()),t.passedElement.triggerEvent(a.EVENTS.hideDropdown,{})}),this):this}},{key:"getValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this._store.activeItems.reduce(function(t,i){var n=e?i.value:i;return t.push(n),t},[]);return this._isSelectOneElement?t[0]:t}},{key:"setValue",value:function(e){var t=this;return this.initialised?([].concat(e).forEach(function(e){return t._setChoiceOrItem(e)}),this):this}},{key:"setChoiceByValue",value:function(e){var t=this;return!this.initialised||this._isTextElement?this:(((0,p.isType)("Array",e)?e:[e]).forEach(function(e){return t._findAndSelectChoiceByValue(e)}),this)}},{key:"setChoices",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this._isSelectElement||!i)return this;o&&this.clearChoices(),this.containerOuter.removeLoadingState();return this._setLoading(!0),t.forEach(function(t){t.choices?e._addGroup({group:t,id:t.id||null,valueKey:i,labelKey:n}):e._addChoice({value:t[i],label:t[n],isSelected:t.selected,isDisabled:t.disabled,customProperties:t.customProperties,placeholder:t.placeholder})}),this._setLoading(!1),this}},{key:"clearChoices",value:function(){this._store.dispatch((0,c.clearChoices)())}},{key:"clearStore",value:function(){return this._store.dispatch((0,d.clearAll)()),this}},{key:"clearInput",value:function(){var e=!this._isSelectOneElement;return this.input.clear(e),!this._isTextElement&&this._canSearch&&(this._isSearching=!1,this._store.dispatch((0,c.activateChoices)(!0))),this}},{key:"ajax",value:function(e){var t=this;return this.initialised&&this._isSelectElement&&e?(requestAnimationFrame(function(){return t._handleLoadingState(!0)}),e(this._ajaxCallback()),this):this}},{key:"_render",value:function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||this._currentState.items!==this._prevState.items,t=this._isSelectElement,i=this._currentState.items!==this._prevState.items;e&&(t&&this._renderChoices(),i&&this._renderItems(),this._prevState=this._currentState)}}},{key:"_renderChoices",value:function(){var e=this,t=this._store,i=t.activeGroups,n=t.activeChoices,o=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame(function(){return e.choiceList.scrollToTop()}),i.length>=1&&!this._isSearching){var r=n.filter(function(e){return!0===e.placeholder&&-1===e.groupId});r.length>=1&&(o=this._createChoicesFragment(r,o)),o=this._createGroupsFragment(i,n,o)}else n.length>=1&&(o=this._createChoicesFragment(n,o));if(o.childNodes&&o.childNodes.length>0){var s=this._store.activeItems,a=this._canAddItem(s,this.input.value);a.response?(this.choiceList.append(o),this._highlightChoice()):this.choiceList.append(this._getTemplate("notice",a.notice))}else{var l,c;this._isSearching?(c=(0,p.isType)("Function",this.config.noResultsText)?this.config.noResultsText():this.config.noResultsText,l=this._getTemplate("notice",c,"no-results")):(c=(0,p.isType)("Function",this.config.noChoicesText)?this.config.noChoicesText():this.config.noChoicesText,l=this._getTemplate("notice",c,"no-choices")),this.choiceList.append(l)}}},{key:"_renderItems",value:function(){var e=this._store.activeItems||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)}},{key:"_createGroupsFragment",value:function(e,t,i){var n=this,o=i||document.createDocumentFragment();return this.config.shouldSort&&e.sort(this.config.sortFn),e.forEach(function(e){var i=function(e){return t.filter(function(t){return n._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===n.config.renderSelectedChoices||!t.selected)})}(e);if(i.length>=1){var r=n._getTemplate("choiceGroup",e);o.appendChild(r),n._createChoicesFragment(i,o,!0)}}),o}},{key:"_createChoicesFragment",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=t||document.createDocumentFragment(),r=this.config,s=r.renderSelectedChoices,a=r.searchResultLimit,l=r.renderChoiceLimit,c=this._isSearching?p.sortByScore:this.config.sortFn,u=function(e){if("auto"!==s||(i._isSelectOneElement||!e.selected)){var t=i._getTemplate("choice",e,i.config.itemSelectText);o.appendChild(t)}},h=e;"auto"!==s||this._isSelectOneElement||(h=e.filter(function(e){return!e.selected}));var d=h.reduce(function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e},{placeholderChoices:[],normalChoices:[]}),f=d.placeholderChoices,v=d.normalChoices;(this.config.shouldSort||this._isSearching)&&v.sort(c);var m=h.length,g=[].concat(f,v);this._isSearching?m=a:l>0&&!n&&(m=l);for(var _=0;_1&&void 0!==arguments[1]?arguments[1]:null,n=this.config,o=n.shouldSortItems,r=n.sortFn,s=n.removeItemButton,a=i||document.createDocumentFragment();o&&!this._isSelectOneElement&&e.sort(r),this._isTextElement?this.passedElement.value=e:this.passedElement.options=e;return e.forEach(function(e){return function(e){var i=t._getTemplate("item",e,s);a.appendChild(i)}(e)}),a}},{key:"_triggerChange",value:function(e){null!=e&&this.passedElement.triggerEvent(a.EVENTS.change,{value:e})}},{key:"_selectPlaceholderChoice",value:function(){var e=this._store.placeholderChoice;e&&(this._addItem({value:e.value,label:e.label,choiceId:e.id,groupId:e.groupId,placeholder:e.placeholder}),this._triggerChange(e.value))}},{key:"_handleButtonAction",value:function(e,t){if(e&&t&&this.config.removeItems&&this.config.removeItemButton){var i=t.parentNode.getAttribute("data-id"),n=e.find(function(e){return e.id===parseInt(i,10)});this._removeItem(n),this._triggerChange(n.value),this._isSelectOneElement&&this._selectPlaceholderChoice()}}},{key:"_handleItemAction",value:function(e,t){var i=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e&&t&&this.config.removeItems&&!this._isSelectOneElement){var o=t.getAttribute("data-id");e.forEach(function(e){e.id!==parseInt(o,10)||e.highlighted?!n&&e.highlighted&&i.unhighlightItem(e):i.highlightItem(e)}),this.input.focus()}}},{key:"_handleChoiceAction",value:function(e,t){if(e&&t){var i=t.getAttribute("data-id"),n=this._store.getChoiceById(i),o=e[0]&&e[0].keyCode?e[0].keyCode:null,r=this.dropdown.isActive;if(n.keyCode=o,this.passedElement.triggerEvent(a.EVENTS.choice,{choice:n}),n&&!n.selected&&!n.disabled)this._canAddItem(e,n.value).response&&(this._addItem({value:n.value,label:n.label,choiceId:n.id,groupId:n.groupId,customProperties:n.customProperties,placeholder:n.placeholder,keyCode:n.keyCode}),this._triggerChange(n.value));this.clearInput(),r&&this._isSelectOneElement&&(this.hideDropdown(!0),this.containerOuter.focus())}}},{key:"_handleBackspace",value:function(e){if(this.config.removeItems&&e){var t=e[e.length-1],i=e.some(function(e){return e.highlighted});this.config.editItems&&!i&&t?(this.input.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(i||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}}},{key:"_setLoading",value:function(e){this._store.dispatch((0,f.setIsLoading)(e))}},{key:"_handleLoadingState",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.itemList.getChild(".".concat(this.config.classNames.placeholder));e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._getTemplate("placeholder",this.config.loadingText),this.itemList.append(t)):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t.innerHTML=this._placeholderValue||"":this.input.placeholder=this._placeholderValue||"")}},{key:"_handleSearch",value:function(e){if(e&&this.input.isFocussed){var t=this._store.choices,i=this.config,n=i.searchFloor,o=i.searchChoices,r=t.some(function(e){return!e.active});if(e&&e.length>=n){var s=o?this._searchChoices(e):0;this.passedElement.triggerEvent(a.EVENTS.search,{value:e,resultCount:s})}else r&&(this._isSearching=!1,this._store.dispatch((0,c.activateChoices)(!0)))}}},{key:"_canAddItem",value:function(e,t){var i=!0,n=(0,p.isType)("Function",this.config.addItemText)?this.config.addItemText(t):this.config.addItemText;if(!this._isSelectOneElement){var o=(0,p.existsInArray)(e,t);this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(i=!1,n=(0,p.isType)("Function",this.config.maxItemText)?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),!this.config.duplicateItemsAllowed&&o&&i&&(i=!1,n=(0,p.isType)("Function",this.config.uniqueItemText)?this.config.uniqueItemText(t):this.config.uniqueItemText),this._isTextElement&&this.config.addItems&&i&&(0,p.isType)("Function",this.config.addItemFilterFn)&&!this.config.addItemFilterFn(t)&&(i=!1,n=(0,p.isType)("Function",this.config.customAddItemText)?this.config.customAddItemText(t):this.config.customAddItemText)}return{response:i,notice:n}}},{key:"_ajaxCallback",value:function(){var e=this;return function(t,i,n){if(t&&i){var o=(0,p.isType)("Object",t)?[t]:t;o&&(0,p.isType)("Array",o)&&o.length?(e._handleLoadingState(!1),e._setLoading(!0),o.forEach(function(t){t.choices?e._addGroup({group:t,id:t.id||null,valueKey:i,labelKey:n}):e._addChoice({value:(0,p.fetchFromObject)(t,i),label:(0,p.fetchFromObject)(t,n),isSelected:t.selected,isDisabled:t.disabled,customProperties:t.customProperties,placeholder:t.placeholder})}),e._setLoading(!1),e._isSelectOneElement&&e._selectPlaceholderChoice()):e._handleLoadingState(!1)}}}},{key:"_searchChoices",value:function(e){var t=(0,p.isType)("String",e)?e.trim():e,i=(0,p.isType)("String",this._currentValue)?this._currentValue.trim():this._currentValue;if(t.length<1&&t==="".concat(i," "))return 0;var o=this._store.searchableChoices,r=t,s=[].concat(this.config.searchFields),a=Object.assign(this.config.fuseOptions,{keys:s}),l=new n.default(o,a).search(r);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch((0,c.filterChoices)(l)),l.length}},{key:"_addEventListeners",value:function(){window.delegateEvent.add("keyup",this._onKeyUp),window.delegateEvent.add("keydown",this._onKeyDown),window.delegateEvent.add("click",this._onClick),window.delegateEvent.add("touchmove",this._onTouchMove),window.delegateEvent.add("touchend",this._onTouchEnd),window.delegateEvent.add("mousedown",this._onMouseDown),window.delegateEvent.add("mouseover",this._onMouseOver),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus),this.containerOuter.element.addEventListener("blur",this._onBlur)),this.input.element.addEventListener("focus",this._onFocus),this.input.element.addEventListener("blur",this._onBlur),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset),this.input.addEventListeners()}},{key:"_removeEventListeners",value:function(){window.delegateEvent.remove("keyup",this._onKeyUp),window.delegateEvent.remove("keydown",this._onKeyDown),window.delegateEvent.remove("click",this._onClick),window.delegateEvent.remove("touchmove",this._onTouchMove),window.delegateEvent.remove("touchend",this._onTouchEnd),window.delegateEvent.remove("mousedown",this._onMouseDown),window.delegateEvent.remove("mouseover",this._onMouseOver),this._isSelectOneElement&&(this.containerOuter.element.removeEventListener("focus",this._onFocus),this.containerOuter.element.removeEventListener("blur",this._onBlur)),this.input.element.removeEventListener("focus",this._onFocus),this.input.element.removeEventListener("blur",this._onBlur),this.input.element.form&&this.input.element.form.removeEventListener("reset",this._onFormReset),this.input.removeEventListeners()}},{key:"_onKeyDown",value:function(e){var t,i=e.target,n=e.keyCode,o=e.ctrlKey,r=e.metaKey;if(i===this.input.element||this.containerOuter.element.contains(i)){var s=this._store.activeItems,l=this.input.isFocussed,c=this.dropdown.isActive,u=this.itemList.hasChildren,h=String.fromCharCode(n),d=a.KEY_CODES.BACK_KEY,f=a.KEY_CODES.DELETE_KEY,p=a.KEY_CODES.ENTER_KEY,v=a.KEY_CODES.A_KEY,g=a.KEY_CODES.ESC_KEY,_=a.KEY_CODES.UP_KEY,y=a.KEY_CODES.DOWN_KEY,b=a.KEY_CODES.PAGE_UP_KEY,E=a.KEY_CODES.PAGE_DOWN_KEY,S=o||r;!this._isTextElement&&/[a-zA-Z0-9-_ ]/.test(h)&&this.showDropdown();var I=(m(t={},v,this._onAKey),m(t,p,this._onEnterKey),m(t,g,this._onEscapeKey),m(t,_,this._onDirectionKey),m(t,b,this._onDirectionKey),m(t,y,this._onDirectionKey),m(t,E,this._onDirectionKey),m(t,f,this._onDeleteKey),m(t,d,this._onDeleteKey),t);I[n]&&I[n]({event:e,target:i,keyCode:n,metaKey:r,activeItems:s,hasFocusedInput:l,hasActiveDropdown:c,hasItems:u,hasCtrlDownKeyPressed:S})}}},{key:"_onKeyUp",value:function(e){var t=e.target,i=e.keyCode;if(t===this.input.element){var n=this.input.value,o=this._store.activeItems,r=this._canAddItem(o,n),s=a.KEY_CODES.BACK_KEY,l=a.KEY_CODES.DELETE_KEY;if(this._isTextElement){if(r.notice&&n){var u=this._getTemplate("notice",r.notice);this.dropdown.element.innerHTML=u.outerHTML,this.showDropdown(!0)}else this.hideDropdown(!0)}else{var h=(i===s||i===l)&&!t.value,d=!this._isTextElement&&this._isSearching,f=this._canSearch&&r.response;h&&d?(this._isSearching=!1,this._store.dispatch((0,c.activateChoices)(!0))):f&&this._handleSearch(this.input.value)}this._canSearch=this.config.searchEnabled}}},{key:"_onAKey",value:function(e){var t=e.hasItems;e.hasCtrlDownKeyPressed&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())}},{key:"_onEnterKey",value:function(e){var t=e.event,i=e.target,n=e.activeItems,o=e.hasActiveDropdown,r=a.KEY_CODES.ENTER_KEY,s=i.hasAttribute("data-button");if(this._isTextElement&&i.value){var l=this.input.value;this._canAddItem(n,l).response&&(this.hideDropdown(!0),this._addItem({value:l}),this._triggerChange(l),this.clearInput())}if(s&&(this._handleButtonAction(n,i),t.preventDefault()),o){var c=this.dropdown.getChild(".".concat(this.config.classNames.highlightedState));c&&(n[0]&&(n[0].keyCode=r),this._handleChoiceAction(n,c)),t.preventDefault()}else this._isSelectOneElement&&(this.showDropdown(),t.preventDefault())}},{key:"_onEscapeKey",value:function(e){e.hasActiveDropdown&&(this.hideDropdown(!0),this.containerOuter.focus())}},{key:"_onDirectionKey",value:function(e){var t=e.event,i=e.hasActiveDropdown,n=e.keyCode,o=e.metaKey,r=a.KEY_CODES.DOWN_KEY,s=a.KEY_CODES.PAGE_UP_KEY,l=a.KEY_CODES.PAGE_DOWN_KEY;if(i||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var c,u=n===r||n===l?1:-1;if(o||n===l||n===s)c=u>0?Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]")).pop():this.dropdown.element.querySelector("[data-choice-selectable]");else{var h=this.dropdown.element.querySelector(".".concat(this.config.classNames.highlightedState));c=h?(0,p.getAdjacentEl)(h,"[data-choice-selectable]",u):this.dropdown.element.querySelector("[data-choice-selectable]")}c&&((0,p.isScrolledIntoView)(c,this.choiceList.element,u)||this.choiceList.scrollToChoice(c,u),this._highlightChoice(c)),t.preventDefault()}}},{key:"_onDeleteKey",value:function(e){var t=e.event,i=e.target,n=e.hasFocusedInput,o=e.activeItems;!n||i.value||this._isSelectOneElement||(this._handleBackspace(o),t.preventDefault())}},{key:"_onTouchMove",value:function(){this._wasTap&&(this._wasTap=!1)}},{key:"_onTouchEnd",value:function(e){var t=(e||e.touches[0]).target;this._wasTap&&this.containerOuter.element.contains(t)&&((t===this.containerOuter.element||t===this.containerInner.element)&&(this._isTextElement?this.input.focus():this._isSelectMultipleElement&&this.showDropdown()),e.stopPropagation());this._wasTap=!0}},{key:"_onMouseDown",value:function(e){var t=e.target,i=e.shiftKey;if(this.choiceList.element.contains(t)&&(0,p.isIE11)()&&(this._isScrollingOnIe=!0),this.containerOuter.element.contains(t)&&t!==this.input.element){var n=this._store.activeItems,o=i,r=(0,p.findAncestorByAttrName)(t,"data-button"),s=(0,p.findAncestorByAttrName)(t,"data-item"),a=(0,p.findAncestorByAttrName)(t,"data-choice");r?this._handleButtonAction(n,r):s?this._handleItemAction(n,s,o):a&&this._handleChoiceAction(n,a),e.preventDefault()}}},{key:"_onMouseOver",value:function(e){var t=e.target;(t===this.dropdown||this.dropdown.element.contains(t))&&t.hasAttribute("data-choice")&&this._highlightChoice(t)}},{key:"_onClick",value:function(e){var t=e.target;this.containerOuter.element.contains(t)?this.dropdown.isActive||this.containerOuter.isDisabled?this._isSelectOneElement&&t!==this.input.element&&!this.dropdown.element.contains(t)&&this.hideDropdown():this._isTextElement?document.activeElement!==this.input.element&&this.input.focus():(this.showDropdown(),this.containerOuter.focus()):(this._store.highlightedActiveItems.length>0&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))}},{key:"_onFocus",value:function(e){var t=this,i=e.target;this.containerOuter.element.contains(i)&&{text:function(){i===t.input.element&&t.containerOuter.addFocusState()},"select-one":function(){t.containerOuter.addFocusState(),i===t.input.element&&t.showDropdown(!0)},"select-multiple":function(){i===t.input.element&&(t.showDropdown(!0),t.containerOuter.addFocusState())}}[this.passedElement.element.type]()}},{key:"_onBlur",value:function(e){var t=this,i=e.target;if(this.containerOuter.element.contains(i)&&!this._isScrollingOnIe){var n=this._store.activeItems.some(function(e){return e.highlighted});({text:function(){i===t.input.element&&(t.containerOuter.removeFocusState(),n&&t.unhighlightAll(),t.hideDropdown(!0))},"select-one":function(){t.containerOuter.removeFocusState(),(i===t.input.element||i===t.containerOuter.element&&!t._canSearch)&&t.hideDropdown(!0)},"select-multiple":function(){i===t.input.element&&(t.containerOuter.removeFocusState(),t.hideDropdown(!0),n&&t.unhighlightAll())}})[this.passedElement.element.type]()}else this._isScrollingOnIe=!1,this.input.element.focus()}},{key:"_onFormReset",value:function(){this._store.dispatch((0,d.resetTo)(this._initialState))}},{key:"_highlightChoice",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(i.length){var n=t;Array.from(this.dropdown.element.querySelectorAll(".".concat(this.config.classNames.highlightedState))).forEach(function(t){t.classList.remove(e.config.classNames.highlightedState),t.setAttribute("aria-selected","false")}),n?this._highlightPosition=i.indexOf(n):(n=i.length>this._highlightPosition?i[this._highlightPosition]:i[i.length-1])||(n=i[0]),n.classList.add(this.config.classNames.highlightedState),n.setAttribute("aria-selected","true"),this.passedElement.triggerEvent(a.EVENTS.highlightChoice,{el:n}),this.dropdown.isActive&&(this.input.setActiveDescendant(n.id),this.containerOuter.setActiveDescendant(n.id))}}},{key:"_addItem",value:function(e){var t=e.value,i=e.label,n=void 0===i?null:i,o=e.choiceId,r=void 0===o?-1:o,s=e.groupId,l=void 0===s?-1:s,c=e.customProperties,h=void 0===c?null:c,d=e.placeholder,f=void 0!==d&&d,v=e.keyCode,m=void 0===v?null:v,g=(0,p.isType)("String",t)?t.trim():t,_=m,y=h,b=this._store.items,E=n||g,S=parseInt(r,10)||-1,I=l>=0?this._store.getGroupById(l):null,O=b?b.length+1:1;return this.config.prependValue&&(g=this.config.prependValue+g.toString()),this.config.appendValue&&(g+=this.config.appendValue.toString()),this._store.dispatch((0,u.addItem)({value:g,label:E,id:O,choiceId:S,groupId:l,customProperties:h,placeholder:f,keyCode:_})),this._isSelectOneElement&&this.removeActiveItems(O),this.passedElement.triggerEvent(a.EVENTS.addItem,{id:O,value:g,label:E,customProperties:y,groupValue:I&&I.value?I.value:void 0,keyCode:_}),this}},{key:"_removeItem",value:function(e){if(!e||!(0,p.isType)("Object",e))return this;var t=e.id,i=e.value,n=e.label,o=e.choiceId,r=e.groupId,s=r>=0?this._store.getGroupById(r):null;return this._store.dispatch((0,u.removeItem)(t,o)),s&&s.value?this.passedElement.triggerEvent(a.EVENTS.removeItem,{id:t,value:i,label:n,groupValue:s.value}):this.passedElement.triggerEvent(a.EVENTS.removeItem,{id:t,value:i,label:n}),this}},{key:"_addChoice",value:function(e){var t=e.value,i=e.label,n=void 0===i?null:i,o=e.isSelected,r=void 0!==o&&o,s=e.isDisabled,a=void 0!==s&&s,l=e.groupId,u=void 0===l?-1:l,h=e.customProperties,d=void 0===h?null:h,f=e.placeholder,p=void 0!==f&&f,v=e.keyCode,m=void 0===v?null:v;if(null!=t){var g=this._store.choices,_=n||t,y=g?g.length+1:1,b="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(y);this._store.dispatch((0,c.addChoice)({value:t,label:_,id:y,groupId:u,disabled:a,elementId:b,customProperties:d,placeholder:p,keyCode:m})),r&&this._addItem({value:t,label:_,choiceId:y,customProperties:d,placeholder:p,keyCode:m})}}},{key:"_addGroup",value:function(e){var t=this,i=e.group,n=e.id,o=e.valueKey,r=void 0===o?"value":o,s=e.labelKey,a=void 0===s?"label":s,l=(0,p.isType)("Object",i)?i.choices:Array.from(i.getElementsByTagName("OPTION")),c=n||Math.floor((new Date).valueOf()*Math.random()),u=!!i.disabled&&i.disabled;if(l){this._store.dispatch((0,h.addGroup)(i.label,c,!0,u));l.forEach(function(e){var i=e.disabled||e.parentNode&&e.parentNode.disabled;t._addChoice({value:e[r],label:(0,p.isType)("Object",e)?e[a]:e.innerHTML,isSelected:e.selected,isDisabled:i,groupId:c,customProperties:e.customProperties,placeholder:e.placeholder})})}else this._store.dispatch((0,h.addGroup)(i.label,i.id,!1,i.disabled))}},{key:"_getTemplate",value:function(e){var t;if(!e)return null;for(var i=this.config,n=i.templates,o=i.classNames,r=arguments.length,s=new Array(r>1?r-1:0),a=1;a0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=[],n=-1,o=-1,r=0,s=e.length;r=t&&i.push([n,o]),n=-1)}return e[r-1]&&r-n>=t&&i.push([n,r-1]),i}},"./src/bitap/bitap_pattern_alphabet.js": +/*! no static exports found */function(e,t){e.exports=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=[],n=-1,s=-1,r=0,o=e.length;r=t&&i.push([n,s]),n=-1)}return e[r-1]&&r-n>=t&&i.push([n,r-1]),i}},"./src/bitap/bitap_pattern_alphabet.js": /*!*********************************************!*\ !*** ./src/bitap/bitap_pattern_alphabet.js ***! \*********************************************/ -/*! no static exports found */function(e,t){e.exports=function(e){for(var t={},i=e.length,n=0;n2&&void 0!==arguments[2]?arguments[2]:/ +/g,o=new RegExp(t.replace(i,"\\$&").replace(n,"|")),r=e.match(o),s=!!r,a=[];if(s)for(var l=0,c=r.length;l2&&void 0!==arguments[2]?arguments[2]:/ +/g,s=new RegExp(t.replace(i,"\\$&").replace(n,"|")),r=e.match(s),o=!!r,a=[];if(o)for(var l=0,c=r.length;l=P;M-=1){var N=M-1,F=i[e.charAt(N)];if(F&&(E[N]=1),j[M]=(j[M+1]<<1|1)&F,0!==A&&(j[M]|=(C[M+1]|C[M])<<1|1|C[M+1]),j[M]&k&&(w=n(t,{errors:A,currentLocation:N,expectedLocation:m,distance:c}))<=_){if(_=w,(y=N)<=m)break;P=Math.max(1,2*m-y)}}if(n(t,{errors:A+1,currentLocation:m,expectedLocation:m,distance:c})>_)break;C=j}return{isMatch:y>=0,score:0===w?.001:w,matchedIndices:o(E,v)}}},"./src/bitap/index.js": +/*! no static exports found */function(e,t,i){var n=i(/*! ./bitap_score */"./src/bitap/bitap_score.js"),s=i(/*! ./bitap_matched_indices */"./src/bitap/bitap_matched_indices.js");e.exports=function(e,t,i,r){for(var o=r.location,a=void 0===o?0:o,l=r.distance,c=void 0===l?100:l,h=r.threshold,u=void 0===h?.6:h,d=r.findAllMatches,p=void 0!==d&&d,f=r.minMatchCharLength,m=void 0===f?1:f,v=a,g=e.length,_=u,b=e.indexOf(t,v),y=t.length,E=[],S=0;S=D;j-=1){var M=j-1,N=i[e.charAt(M)];if(N&&(E[M]=1),F[j]=(F[j+1]<<1|1)&N,0!==T&&(F[j]|=(C[j+1]|C[j])<<1|1|C[j+1]),F[j]&x&&(O=n(t,{errors:T,currentLocation:M,expectedLocation:v,distance:c}))<=_){if(_=O,(b=M)<=v)break;D=Math.max(1,2*v-b)}}if(n(t,{errors:T+1,currentLocation:v,expectedLocation:v,distance:c})>_)break;C=F}return{isMatch:b>=0,score:0===O?.001:O,matchedIndices:s(E,m)}}},"./src/bitap/index.js": /*!****************************!*\ !*** ./src/bitap/index.js ***! \****************************/ -/*! no static exports found */function(e,t,i){function n(e,t){for(var i=0;ii)return o(e,this.pattern,n);var s=this.options,a=s.location,l=s.distance,c=s.threshold,u=s.findAllMatches,h=s.minMatchCharLength;return r(e,this.pattern,this.patternAlphabet,{location:a,distance:l,threshold:c,findAllMatches:u,minMatchCharLength:h})}}])&&n(t.prototype,i),a&&n(t,a),e}();e.exports=a},"./src/helpers/deep_value.js": +/*! no static exports found */function(e,t,i){function n(e,t){for(var i=0;ii)return s(e,this.pattern,n);var o=this.options,a=o.location,l=o.distance,c=o.threshold,h=o.findAllMatches,u=o.minMatchCharLength;return r(e,this.pattern,this.patternAlphabet,{location:a,distance:l,threshold:c,findAllMatches:h,minMatchCharLength:u})}}])&&n(t.prototype,i),a&&n(t,a),e}();e.exports=a},"./src/helpers/deep_value.js": /*!***********************************!*\ !*** ./src/helpers/deep_value.js ***! \***********************************/ -/*! no static exports found */function(e,t,i){var n=i(/*! ./is_array */"./src/helpers/is_array.js");e.exports=function(e,t){return function e(t,i,o){if(i){var r=i.indexOf("."),s=i,a=null;-1!==r&&(s=i.slice(0,r),a=i.slice(r+1));var l=t[s];if(null!=l)if(a||"string"!=typeof l&&"number"!=typeof l)if(n(l))for(var c=0,u=l.length;c1&&void 0!==arguments[1]?arguments[1]:{limit:!1};this._log('---------\nSearch pattern: "'.concat(e,'"'));var i=this._prepareSearchers(e),n=i.tokenSearchers,o=i.fullSearcher,r=this._search(n,o),s=r.weights,a=r.results;return this._computeScore(s,a),this.options.shouldSort&&this._sort(a),t.limit&&"number"==typeof t.limit&&(a=a.slice(0,t.limit)),this._format(a)}},{key:"_prepareSearchers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var i=e.split(this.options.tokenSeparator),n=0,o=i.length;n0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,i=this.list,n={},o=[];if("string"==typeof i[0]){for(var r=0,s=i.length;r1)throw new Error("Key weight has to be > 0 and <= 1");f=f.name}else a[f]={weight:1};this._analyze({key:f,value:this.options.getFn(u,f),record:u,index:l},{resultMap:n,results:o,tokenSearchers:e,fullSearcher:t})}return{weights:a,results:o}}},{key:"_analyze",value:function(e,t){var i=e.key,n=e.arrayIndex,o=void 0===n?-1:n,r=e.value,s=e.record,l=e.index,c=t.tokenSearchers,u=void 0===c?[]:c,h=t.fullSearcher,d=void 0===h?[]:h,f=t.resultMap,p=void 0===f?{}:f,v=t.results,m=void 0===v?[]:v;if(null!=r){var g=!1,_=-1,y=0;if("string"==typeof r){this._log("\nKey: ".concat(""===i?"-":i));var b=d.search(r);if(this._log('Full text: "'.concat(r,'", score: ').concat(b.score)),this.options.tokenize){for(var E=r.split(this.options.tokenSeparator),S=[],I=0;I-1&&(P=(P+_)/2),this._log("Score average:",P);var D=!this.options.tokenize||!this.options.matchAllTokens||y>=u.length;if(this._log("\nCheck Matches: ".concat(D)),(g||b.isMatch)&&D){var j=p[l];j?j.output.push({key:i,arrayIndex:o,value:r,score:P,matchedIndices:b.matchedIndices}):(p[l]={item:s,output:[{key:i,arrayIndex:o,value:r,score:P,matchedIndices:b.matchedIndices}]},m.push(p[l]))}}else if(a(r))for(var M=0,N=r.length;M-1&&(s.arrayIndex=r.arrayIndex),t.matches.push(s)}}}),this.options.includeScore&&o.push(function(e,t){t.score=e.score});for(var r=0,s=e.length;r0&&void 0!==arguments[0]?arguments[0]:n,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_ITEM":var i=[].concat(e,[{id:t.id,choiceId:t.choiceId,groupId:t.groupId,value:t.value,label:t.label,active:!0,highlighted:!1,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]);return i.map(function(e){var t=e;return t.highlighted=!1,t});case"REMOVE_ITEM":return e.map(function(e){var i=e;return i.id===t.id&&(i.active=!1),i});case"HIGHLIGHT_ITEM":return e.map(function(e){var i=e;return i.id===t.id&&(i.highlighted=t.highlighted),i});default:return e}},t.defaultState=void 0;var n=[];t.defaultState=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_GROUP":return[].concat(e,[{id:t.id,value:t.value,active:t.active,disabled:t.disabled}]);case"CLEAR_CHOICES":return[];default:return e}},t.defaultState=void 0;var n=[];t.defaultState=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_CHOICE":return[].concat(e,[{id:t.id,elementId:t.elementId,groupId:t.groupId,value:t.value,label:t.label||t.value,disabled:t.disabled||!1,selected:!1,active:!0,score:9999,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]);case"ADD_ITEM":return t.activateOptions?e.map(function(e){var i=e;return i.active=t.active,i}):t.choiceId>-1?e.map(function(e){var i=e;return i.id===parseInt(t.choiceId,10)&&(i.selected=!0),i}):e;case"REMOVE_ITEM":return t.choiceId>-1?e.map(function(e){var i=e;return i.id===parseInt(t.choiceId,10)&&(i.selected=!1),i}):e;case"FILTER_CHOICES":return e.map(function(e){var i=e;return i.active=t.results.some(function(e){var t=e.item,n=e.score;return t.id===i.id&&(i.score=n,!0)}),i});case"ACTIVATE_CHOICES":return e.map(function(e){var i=e;return i.active=t.active,i});case"CLEAR_CHOICES":return n;default:return e}},t.defaultState=void 0;var n=[];t.defaultState=n},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.defaultState=void 0;var n={loading:!1};t.defaultState=n;var o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_IS_LOADING":return{loading:t.isLoading};default:return e}};t.default=o},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Dropdown",{enumerable:!0,get:function(){return n.default}}),Object.defineProperty(t,"Container",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"Input",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"List",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"WrappedInput",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"WrappedSelect",{enumerable:!0,get:function(){return l.default}});var n=c(i(21)),o=c(i(22)),r=c(i(23)),s=c(i(24)),a=c(i(25)),l=c(i(26));function c(e){return e&&e.__esModule?e:{default:e}}},function(e,t,i){"use strict";function n(e,t){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:(0,n.getWindowHeight)();if(void 0===e)return!1;var i=!1;return"auto"===this.position?i=e>=t:"top"===this.position&&(i=!0),i}},{key:"setActiveDescendant",value:function(e){this.element.setAttribute("aria-activedescendant",e)}},{key:"removeActiveDescendant",value:function(){this.element.removeAttribute("aria-activedescendant")}},{key:"open",value:function(e){this.element.classList.add(this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(e)&&(this.element.classList.add(this.classNames.flippedState),this.isFlipped=!0)}},{key:"close",value:function(){this.element.classList.remove(this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(this.element.classList.remove(this.classNames.flippedState),this.isFlipped=!1)}},{key:"focus",value:function(){this.isFocussed||this.element.focus()}},{key:"addFocusState",value:function(){this.element.classList.add(this.classNames.focusState)}},{key:"removeFocusState",value:function(){this.element.classList.remove(this.classNames.focusState)}},{key:"enable",value:function(){this.element.classList.remove(this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),"select-one"===this.type&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1}},{key:"disable",value:function(){this.element.classList.add(this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),"select-one"===this.type&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0}},{key:"wrap",value:function(e){(0,n.wrap)(e,this.element)}},{key:"unwrap",value:function(e){this.element.parentNode.insertBefore(e,this.element),this.element.parentNode.removeChild(this.element)}},{key:"addLoadingState",value:function(){this.element.classList.add(this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0}},{key:"removeLoadingState",value:function(){this.element.classList.remove(this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1}},{key:"_onFocus",value:function(){this.isFocussed=!0}},{key:"_onBlur",value:function(){this.isFocussed=!1}}])&&o(t.prototype,i),r&&o(t,r),e}();t.default=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=i(0);function o(e,t){for(var i=0;i0&&void 0!==arguments[0])||arguments[0];return this.element.value&&(this.element.value=""),e&&this.setWidth(),this}},{key:"setWidth",value:function(e){var t=this,i=function(e){t.element.style.width=e};if(this._placeholderValue){var n=this.element.value.length>=this._placeholderValue.length/1.25;(this.element.value&&n||e)&&this.calcWidth(i)}else this.calcWidth(i)}},{key:"calcWidth",value:function(e){return(0,n.calcWidthOfInput)(this.element,e)}},{key:"setActiveDescendant",value:function(e){this.element.setAttribute("aria-activedescendant",e)}},{key:"removeActiveDescendant",value:function(){this.element.removeAttribute("aria-activedescendant")}},{key:"_onInput",value:function(){"select-one"!==this.type&&this.setWidth()}},{key:"_onPaste",value:function(e){e.target===this.element&&this.preventPaste&&e.preventDefault()}},{key:"_onFocus",value:function(){this.isFocussed=!0}},{key:"_onBlur",value:function(){this.isFocussed=!1}},{key:"placeholder",set:function(e){this.element.placeholder=e}},{key:"value",set:function(e){this.element.value=e},get:function(){return(0,n.sanitise)(this.element.value)}}])&&o(t.prototype,i),r&&o(t,r),e}();t.default=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=i(1);function o(e,t){for(var i=0;i0?this.element.scrollTop+r-s:e.offsetTop;requestAnimationFrame(function(e){i._animateScroll(e,a,t)})}}},{key:"_scrollDown",value:function(e,t,i){var n=(i-e)/t,o=n>1?n:1;this.element.scrollTop=e+o}},{key:"_scrollUp",value:function(e,t,i){var n=(e-i)/t,o=n>1?n:1;this.element.scrollTop=e-o}},{key:"_animateScroll",value:function(e,t,i){var o=this,r=n.SCROLLING_SPEED,s=this.element.scrollTop,a=!1;i>0?(this._scrollDown(s,r,t),st&&(a=!0)),a&&requestAnimationFrame(function(){o._animateScroll(e,t,i)})}}])&&o(t.prototype,i),r&&o(t,r),e}();t.default=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,o=(n=i(4))&&n.__esModule?n:{default:n};function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var i=0;i