diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 32872952..c34cc467 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -16,13 +16,13 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Install buildx - uses: docker/setup-buildx-action@v3 + uses: docker/setup-buildx-action@v4 - name: Login to DockerHub - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: username: ${{secrets.DOCKERHUB_USERNAME}} password: ${{secrets.DOCKERHUB_PASSWORD}} @@ -48,7 +48,7 @@ jobs: echo "kimai_version=$version" >> $GITHUB_ENV - name: FPM image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . file: Dockerfile @@ -63,7 +63,7 @@ jobs: push: true - name: Apache image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . file: Dockerfile @@ -79,7 +79,7 @@ jobs: push: true - name: Development image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . file: Dockerfile diff --git a/.github/workflows/lock-threads.yaml b/.github/workflows/lock-threads.yaml index 8adebca5..0cd892ba 100644 --- a/.github/workflows/lock-threads.yaml +++ b/.github/workflows/lock-threads.yaml @@ -16,7 +16,7 @@ jobs: action: runs-on: ubuntu-latest steps: - - uses: dessant/lock-threads@v5 + - uses: dessant/lock-threads@v6 with: process-only: 'issues, prs' github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yaml b/.github/workflows/release-drafter.yaml index b0bdc04a..fe84279d 100644 --- a/.github/workflows/release-drafter.yaml +++ b/.github/workflows/release-drafter.yaml @@ -20,11 +20,11 @@ jobs: update_release_draft: permissions: - contents: write # for release-drafter/release-drafter to create a github release - pull-requests: write # for release-drafter/release-drafter to add label to PR + contents: write # for release-drafter/release-drafter to create a github release + pull-requests: read needs: correct_repository runs-on: ubuntu-latest steps: - - uses: release-drafter/release-drafter@v6 + - uses: release-drafter/release-drafter@v7 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml index 8b369ed6..395d4ad6 100644 --- a/.github/workflows/testing.yaml +++ b/.github/workflows/testing.yaml @@ -25,7 +25,7 @@ jobs: steps: - name: Clone Kimai - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: persist-credentials: false @@ -47,7 +47,7 @@ jobs: run: echo "composer_cache_directory=$(composer config cache-dir)" >> $GITHUB_ENV - name: Cache Composer dependencies - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: "${{ env.composer_cache_directory }}" key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} @@ -104,7 +104,7 @@ jobs: - name: Upload code coverage if: matrix.php == '8.5' - uses: codecov/codecov-action@v5 + uses: codecov/codecov-action@v6 with: token: ${{ secrets.CODECOV_TOKEN }} files: ./coverage.xml diff --git a/.github/workflows/website.yaml b/.github/workflows/website.yaml index 004c3b46..5638262c 100644 --- a/.github/workflows/website.yaml +++ b/.github/workflows/website.yaml @@ -34,7 +34,7 @@ jobs: fi - name: Emit repository_dispatch - uses: peter-evans/repository-dispatch@v3 + uses: peter-evans/repository-dispatch@v4 with: token: ${{ secrets.WEBSITE_ACCESS_TOKEN }} repository: kimai/www.kimai.org diff --git a/assets/js/KimaiPlugin.js b/assets/js/KimaiPlugin.js index ba6c291f..520f1873 100644 --- a/assets/js/KimaiPlugin.js +++ b/assets/js/KimaiPlugin.js @@ -96,6 +96,7 @@ export default class KimaiPlugin { } /** + * @deprecated use the plugin directly * @param {string} title * @returns {string} */ diff --git a/assets/js/forms/KimaiTeamForm.js b/assets/js/forms/KimaiTeamForm.js index d25f70cb..36f5180e 100644 --- a/assets/js/forms/KimaiTeamForm.js +++ b/assets/js/forms/KimaiTeamForm.js @@ -83,7 +83,7 @@ export default class KimaiTeamForm extends KimaiFormPlugin { prototype.dataset['widgetCounter'] = (++counter).toString(); const temp = document.createElement('div'); - temp.innerHTML = newWidget; + temp.innerHTML = ESCAPER.sanitize(newWidget); temp.querySelector('input[type=hidden]').value = option.value; const newNode = temp.firstElementChild; diff --git a/assets/js/plugins/KimaiAPILink.js b/assets/js/plugins/KimaiAPILink.js index 7b7d4e09..05ce498b 100644 --- a/assets/js/plugins/KimaiAPILink.js +++ b/assets/js/plugins/KimaiAPILink.js @@ -74,9 +74,6 @@ export default class KimaiAPILink extends KimaiPlugin { const successHandle = () => { EVENTS.trigger(eventName); document.dispatchEvent(new CustomEvent('kimai.reloadedContent')); - if (attributes['msgSuccess'] !== undefined) { - ALERT.success(attributes['msgSuccess']); - } }; const errorHandle = (error) => { let message = 'action.update.error'; diff --git a/assets/js/plugins/KimaiEscape.js b/assets/js/plugins/KimaiEscape.js index 8bdfa0c3..5778f851 100644 --- a/assets/js/plugins/KimaiEscape.js +++ b/assets/js/plugins/KimaiEscape.js @@ -10,6 +10,7 @@ */ import KimaiPlugin from "../KimaiPlugin"; +import DOMPurify from "dompurify"; export default class KimaiEscape extends KimaiPlugin { @@ -26,14 +27,23 @@ export default class KimaiEscape extends KimaiPlugin { return ''; } - const tagsToReplace = { + const charToReplace = { '&': '&', '<': '<', '>': '>', + '"': '"', }; - return title.replace(/[&<>]/g, function(tag) { - return tagsToReplace[tag] || tag; + return title.replace(/[&<>"]/g, function(tag) { + return charToReplace[tag] || tag; }); } + + /** + * @param {string} html + * @returns {string} + */ + sanitize(html) { + return DOMPurify.sanitize(html); + } } diff --git a/assets/js/widgets/KimaiCalendar.js b/assets/js/widgets/KimaiCalendar.js index 20fae00c..29c5097c 100644 --- a/assets/js/widgets/KimaiCalendar.js +++ b/assets/js/widgets/KimaiCalendar.js @@ -663,7 +663,7 @@ export default class KimaiCalendar { } } - return ` + return escaper.sanitize(`
` + (eventObj.description !== null || eventObj.tags.length > 0 ? '
' : '') + (eventObj.description ? '
' + escaper.escapeForHtml(eventObj.description) + '
' : '') + tags + ` -
`; + `); } /** diff --git a/assets/sass/variables.scss b/assets/sass/variables.scss index 5ef19e9f..f3c9561c 100644 --- a/assets/sass/variables.scss +++ b/assets/sass/variables.scss @@ -22,7 +22,7 @@ .time-off { color: var(--kimai-time-off); } .other, .parental, .unpaid-vacation { color: var(--kimai-other); } -.bg-public-holiday{ background-color: var(--kimai-public-holiday-bg); --tblr-table-bg: var(--kimai-public-holiday-bg); i.fas{ color: var(--kimai-public-holiday); } }; +.bg-public-holiday { background-color: var(--kimai-public-holiday-bg); --tblr-table-bg: var(--kimai-public-holiday-bg); i.fas{ color: var(--kimai-public-holiday); } }; .bg-holiday { background-color: var(--kimai-holiday-bg); --tblr-table-bg: var(--kimai-holiday-bg); i.fas{ color: var(--kimai-holiday); } }; .bg-sickness, .bg-sickness-child { background-color: var(--kimai-sickness-bg); --tblr-table-bg: var(--kimai-sickness-bg); i.fas{ color: var(--kimai-sickness); } }; .bg-time-off { background-color: var(--kimai-time-off-bg); --tblr-table-bg: var(--kimai-time-off-bg); i.fas{ color: var(--kimai-time-off); } }; diff --git a/composer.lock b/composer.lock index e7c7310f..cdd403db 100644 --- a/composer.lock +++ b/composer.lock @@ -1411,16 +1411,16 @@ }, { "name": "doctrine/orm", - "version": "2.20.9", + "version": "2.20.10", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "87f1ba74e04c8694ca00099f3c64706ebac0b114" + "reference": "9fe8ce4bf75fbb7342f35835d9a90640902164db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/87f1ba74e04c8694ca00099f3c64706ebac0b114", - "reference": "87f1ba74e04c8694ca00099f3c64706ebac0b114", + "url": "https://api.github.com/repos/doctrine/orm/zipball/9fe8ce4bf75fbb7342f35835d9a90640902164db", + "reference": "9fe8ce4bf75fbb7342f35835d9a90640902164db", "shasum": "" }, "require": { @@ -1506,9 +1506,9 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/2.20.9" + "source": "https://github.com/doctrine/orm/tree/2.20.10" }, - "time": "2025-11-29T14:03:56+00:00" + "time": "2026-04-02T06:18:54+00:00" }, { "name": "doctrine/persistence", @@ -2335,16 +2335,16 @@ }, { "name": "horstoeko/zugferd", - "version": "v1.0.120", + "version": "v1.0.122", "source": { "type": "git", "url": "https://github.com/horstoeko/zugferd.git", - "reference": "c143ec75a7ffc62e2b64a87d175db9f13ab843c1" + "reference": "b02a6f6b8598b10046bfb7ba6824b7730752a74a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/horstoeko/zugferd/zipball/c143ec75a7ffc62e2b64a87d175db9f13ab843c1", - "reference": "c143ec75a7ffc62e2b64a87d175db9f13ab843c1", + "url": "https://api.github.com/repos/horstoeko/zugferd/zipball/b02a6f6b8598b10046bfb7ba6824b7730752a74a", + "reference": "b02a6f6b8598b10046bfb7ba6824b7730752a74a", "shasum": "" }, "require": { @@ -2403,9 +2403,9 @@ ], "support": { "issues": "https://github.com/horstoeko/zugferd/issues", - "source": "https://github.com/horstoeko/zugferd/tree/v1.0.120" + "source": "https://github.com/horstoeko/zugferd/tree/v1.0.122" }, - "time": "2026-01-07T09:45:19+00:00" + "time": "2026-03-24T17:01:41+00:00" }, { "name": "horstoeko/zugferdublbridge", @@ -2538,16 +2538,16 @@ }, { "name": "jms/serializer", - "version": "3.32.6", + "version": "3.32.7", "source": { "type": "git", "url": "https://github.com/schmittjoh/serializer.git", - "reference": "b02a6c00d8335ef68c163bf7c9e39f396dc5853f" + "reference": "d725ebd288688bb24f47ee467b1299b0fc6d04f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/b02a6c00d8335ef68c163bf7c9e39f396dc5853f", - "reference": "b02a6c00d8335ef68c163bf7c9e39f396dc5853f", + "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/d725ebd288688bb24f47ee467b1299b0fc6d04f8", + "reference": "d725ebd288688bb24f47ee467b1299b0fc6d04f8", "shasum": "" }, "require": { @@ -2623,7 +2623,7 @@ ], "support": { "issues": "https://github.com/schmittjoh/serializer/issues", - "source": "https://github.com/schmittjoh/serializer/tree/3.32.6" + "source": "https://github.com/schmittjoh/serializer/tree/3.32.7" }, "funding": [ { @@ -2635,7 +2635,7 @@ "type": "github" } ], - "time": "2025-11-28T12:37:32+00:00" + "time": "2026-03-11T20:11:17+00:00" }, { "name": "jms/serializer-bundle", @@ -4144,16 +4144,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.6.6", + "version": "5.6.7", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "5cee1d3dfc2d2aa6599834520911d246f656bcb8" + "reference": "31a105931bc8ffa3a123383829772e832fd8d903" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/5cee1d3dfc2d2aa6599834520911d246f656bcb8", - "reference": "5cee1d3dfc2d2aa6599834520911d246f656bcb8", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/31a105931bc8ffa3a123383829772e832fd8d903", + "reference": "31a105931bc8ffa3a123383829772e832fd8d903", "shasum": "" }, "require": { @@ -4202,9 +4202,9 @@ "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "support": { "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.6" + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.7" }, - "time": "2025-12-22T21:13:58+00:00" + "time": "2026-03-18T20:47:46+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -4318,16 +4318,16 @@ }, { "name": "phpoffice/phpspreadsheet", - "version": "2.4.3", + "version": "2.4.4", "source": { "type": "git", "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", - "reference": "3b204d00c19f9d809f8d2374f408b197f37ad0bd" + "reference": "78bf6f0b4945ab31f1935741324ef3f0bf59a6fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/3b204d00c19f9d809f8d2374f408b197f37ad0bd", - "reference": "3b204d00c19f9d809f8d2374f408b197f37ad0bd", + "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/78bf6f0b4945ab31f1935741324ef3f0bf59a6fe", + "reference": "78bf6f0b4945ab31f1935741324ef3f0bf59a6fe", "shasum": "" }, "require": { @@ -4418,9 +4418,9 @@ ], "support": { "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues", - "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/2.4.3" + "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/2.4.4" }, - "time": "2026-01-11T06:08:40+00:00" + "time": "2026-04-10T03:20:38+00:00" }, { "name": "phpoffice/phpword", @@ -5455,16 +5455,16 @@ }, { "name": "symfony/cache", - "version": "v6.4.35", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "77f5eca135d1b5471de4301b99496649e4f62878" + "reference": "5b94fba945d1f9e7929cffd50e7a17f1ac36f10b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/77f5eca135d1b5471de4301b99496649e4f62878", - "reference": "77f5eca135d1b5471de4301b99496649e4f62878", + "url": "https://api.github.com/repos/symfony/cache/zipball/5b94fba945d1f9e7929cffd50e7a17f1ac36f10b", + "reference": "5b94fba945d1f9e7929cffd50e7a17f1ac36f10b", "shasum": "" }, "require": { @@ -5531,7 +5531,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v6.4.35" + "source": "https://github.com/symfony/cache/tree/v6.4.36" }, "funding": [ { @@ -5551,7 +5551,7 @@ "type": "tidelift" } ], - "time": "2026-03-05T20:47:12+00:00" + "time": "2026-03-30T14:52:43+00:00" }, { "name": "symfony/cache-contracts", @@ -5788,16 +5788,16 @@ }, { "name": "symfony/console", - "version": "v6.4.35", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "49257c96304c508223815ee965c251e7c79e614e" + "reference": "9f481cfb580db8bcecc9b2d4c63f3e13df022ad5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/49257c96304c508223815ee965c251e7c79e614e", - "reference": "49257c96304c508223815ee965c251e7c79e614e", + "url": "https://api.github.com/repos/symfony/console/zipball/9f481cfb580db8bcecc9b2d4c63f3e13df022ad5", + "reference": "9f481cfb580db8bcecc9b2d4c63f3e13df022ad5", "shasum": "" }, "require": { @@ -5862,7 +5862,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.35" + "source": "https://github.com/symfony/console/tree/v6.4.36" }, "funding": [ { @@ -5882,7 +5882,7 @@ "type": "tidelift" } ], - "time": "2026-03-06T13:31:08+00:00" + "time": "2026-03-27T15:30:51+00:00" }, { "name": "symfony/css-selector", @@ -5955,16 +5955,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v6.4.35", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "d95712d0e9446b9f244b64811ffb6af7b7434213" + "reference": "cd7881a6dc84b780411199cd0584e1a53a3b9ba7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/d95712d0e9446b9f244b64811ffb6af7b7434213", - "reference": "d95712d0e9446b9f244b64811ffb6af7b7434213", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/cd7881a6dc84b780411199cd0584e1a53a3b9ba7", + "reference": "cd7881a6dc84b780411199cd0584e1a53a3b9ba7", "shasum": "" }, "require": { @@ -6016,7 +6016,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v6.4.35" + "source": "https://github.com/symfony/dependency-injection/tree/v6.4.36" }, "funding": [ { @@ -6036,7 +6036,7 @@ "type": "tidelift" } ], - "time": "2026-02-26T12:16:01+00:00" + "time": "2026-03-30T16:39:36+00:00" }, { "name": "symfony/deprecation-contracts", @@ -6219,16 +6219,16 @@ }, { "name": "symfony/dotenv", - "version": "v6.4.35", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/dotenv.git", - "reference": "148138ead5d7bb582e93a9cc19b134b42a370365" + "reference": "cae019cc92a46fe9e498ea011107f26bdf5d897f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dotenv/zipball/148138ead5d7bb582e93a9cc19b134b42a370365", - "reference": "148138ead5d7bb582e93a9cc19b134b42a370365", + "url": "https://api.github.com/repos/symfony/dotenv/zipball/cae019cc92a46fe9e498ea011107f26bdf5d897f", + "reference": "cae019cc92a46fe9e498ea011107f26bdf5d897f", "shasum": "" }, "require": { @@ -6273,7 +6273,7 @@ "environment" ], "support": { - "source": "https://github.com/symfony/dotenv/tree/v6.4.35" + "source": "https://github.com/symfony/dotenv/tree/v6.4.36" }, "funding": [ { @@ -6293,20 +6293,20 @@ "type": "tidelift" } ], - "time": "2026-02-26T10:15:49+00:00" + "time": "2026-03-30T07:25:04+00:00" }, { "name": "symfony/error-handler", - "version": "v6.4.32", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "8c18400784fcb014dc73c8d5601a9576af7f8ad4" + "reference": "2ea68f0e1835ad6a126f93bbc14cd236c10ab361" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/8c18400784fcb014dc73c8d5601a9576af7f8ad4", - "reference": "8c18400784fcb014dc73c8d5601a9576af7f8ad4", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/2ea68f0e1835ad6a126f93bbc14cd236c10ab361", + "reference": "2ea68f0e1835ad6a126f93bbc14cd236c10ab361", "shasum": "" }, "require": { @@ -6352,7 +6352,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v6.4.32" + "source": "https://github.com/symfony/error-handler/tree/v6.4.36" }, "funding": [ { @@ -6372,20 +6372,20 @@ "type": "tidelift" } ], - "time": "2026-01-19T19:28:19+00:00" + "time": "2026-03-10T15:56:14+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v6.4.32", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "99d7e101826e6610606b9433248f80c1997cd20b" + "reference": "fc828863e26ceec86e2513b5e46aa0b149d76b69" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/99d7e101826e6610606b9433248f80c1997cd20b", - "reference": "99d7e101826e6610606b9433248f80c1997cd20b", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/fc828863e26ceec86e2513b5e46aa0b149d76b69", + "reference": "fc828863e26ceec86e2513b5e46aa0b149d76b69", "shasum": "" }, "require": { @@ -6436,7 +6436,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v6.4.32" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.4.36" }, "funding": [ { @@ -6456,7 +6456,7 @@ "type": "tidelift" } ], - "time": "2026-01-05T11:13:48+00:00" + "time": "2026-03-30T11:18:01+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -6815,16 +6815,16 @@ }, { "name": "symfony/form", - "version": "v6.4.35", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/form.git", - "reference": "37b2f68f4cfb8c35fdd0d5a02ba216b5e119f762" + "reference": "3a38a81150400f0a486f8963e21a195311b30b27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/form/zipball/37b2f68f4cfb8c35fdd0d5a02ba216b5e119f762", - "reference": "37b2f68f4cfb8c35fdd0d5a02ba216b5e119f762", + "url": "https://api.github.com/repos/symfony/form/zipball/3a38a81150400f0a486f8963e21a195311b30b27", + "reference": "3a38a81150400f0a486f8963e21a195311b30b27", "shasum": "" }, "require": { @@ -6892,7 +6892,7 @@ "description": "Allows to easily create, process and reuse HTML forms", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/form/tree/v6.4.35" + "source": "https://github.com/symfony/form/tree/v6.4.36" }, "funding": [ { @@ -6912,20 +6912,20 @@ "type": "tidelift" } ], - "time": "2026-03-04T16:19:23+00:00" + "time": "2026-03-13T14:59:02+00:00" }, { "name": "symfony/framework-bundle", - "version": "v6.4.35", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/framework-bundle.git", - "reference": "2e065db347ef1c2d1d4b916c860f9782c9060221" + "reference": "147b02cfa45dcc74a290462551f5ee5c7fa8ab17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/2e065db347ef1c2d1d4b916c860f9782c9060221", - "reference": "2e065db347ef1c2d1d4b916c860f9782c9060221", + "url": "https://api.github.com/repos/symfony/framework-bundle/zipball/147b02cfa45dcc74a290462551f5ee5c7fa8ab17", + "reference": "147b02cfa45dcc74a290462551f5ee5c7fa8ab17", "shasum": "" }, "require": { @@ -7045,7 +7045,7 @@ "description": "Provides a tight integration between Symfony components and the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/framework-bundle/tree/v6.4.35" + "source": "https://github.com/symfony/framework-bundle/tree/v6.4.36" }, "funding": [ { @@ -7065,20 +7065,20 @@ "type": "tidelift" } ], - "time": "2026-03-06T11:15:58+00:00" + "time": "2026-03-25T17:41:29+00:00" }, { "name": "symfony/http-client", - "version": "v6.4.34", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "0dc71f52e5d35bb045fd0f82b1a80c027971d551" + "reference": "1baea3a592ec5ee1f58de6548a034268d4946db6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/0dc71f52e5d35bb045fd0f82b1a80c027971d551", - "reference": "0dc71f52e5d35bb045fd0f82b1a80c027971d551", + "url": "https://api.github.com/repos/symfony/http-client/zipball/1baea3a592ec5ee1f58de6548a034268d4946db6", + "reference": "1baea3a592ec5ee1f58de6548a034268d4946db6", "shasum": "" }, "require": { @@ -7143,7 +7143,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v6.4.34" + "source": "https://github.com/symfony/http-client/tree/v6.4.36" }, "funding": [ { @@ -7163,7 +7163,7 @@ "type": "tidelift" } ], - "time": "2026-02-18T07:27:25+00:00" + "time": "2026-03-23T20:48:09+00:00" }, { "name": "symfony/http-client-contracts", @@ -7326,16 +7326,16 @@ }, { "name": "symfony/http-kernel", - "version": "v6.4.35", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "ece1a0da7745a5243683f178155c0412c92691eb" + "reference": "4087ec02119de450e9ebb60806d69c6bb8c6e468" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/ece1a0da7745a5243683f178155c0412c92691eb", - "reference": "ece1a0da7745a5243683f178155c0412c92691eb", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/4087ec02119de450e9ebb60806d69c6bb8c6e468", + "reference": "4087ec02119de450e9ebb60806d69c6bb8c6e468", "shasum": "" }, "require": { @@ -7420,7 +7420,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.4.35" + "source": "https://github.com/symfony/http-kernel/tree/v6.4.36" }, "funding": [ { @@ -7440,20 +7440,20 @@ "type": "tidelift" } ], - "time": "2026-03-06T16:28:07+00:00" + "time": "2026-03-31T20:38:11+00:00" }, { "name": "symfony/intl", - "version": "v6.4.34", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/intl.git", - "reference": "ea1b1c555e3f0c6850605307717423ff3a0407ad" + "reference": "026d246f3d2f6136db43d17b4ccb14b34d8e779a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/intl/zipball/ea1b1c555e3f0c6850605307717423ff3a0407ad", - "reference": "ea1b1c555e3f0c6850605307717423ff3a0407ad", + "url": "https://api.github.com/repos/symfony/intl/zipball/026d246f3d2f6136db43d17b4ccb14b34d8e779a", + "reference": "026d246f3d2f6136db43d17b4ccb14b34d8e779a", "shasum": "" }, "require": { @@ -7507,7 +7507,7 @@ "localization" ], "support": { - "source": "https://github.com/symfony/intl/tree/v6.4.34" + "source": "https://github.com/symfony/intl/tree/v6.4.36" }, "funding": [ { @@ -7527,7 +7527,7 @@ "type": "tidelift" } ], - "time": "2026-02-08T20:40:30+00:00" + "time": "2026-03-24T11:36:52+00:00" }, { "name": "symfony/mailer", @@ -7615,16 +7615,16 @@ }, { "name": "symfony/mime", - "version": "v6.4.35", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "b5cce719de25bebd6345c7709774f9ac63ff5cdf" + "reference": "9c31726137c70798f815fb98293ffb8a2a47694c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/b5cce719de25bebd6345c7709774f9ac63ff5cdf", - "reference": "b5cce719de25bebd6345c7709774f9ac63ff5cdf", + "url": "https://api.github.com/repos/symfony/mime/zipball/9c31726137c70798f815fb98293ffb8a2a47694c", + "reference": "9c31726137c70798f815fb98293ffb8a2a47694c", "shasum": "" }, "require": { @@ -7680,7 +7680,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v6.4.35" + "source": "https://github.com/symfony/mime/tree/v6.4.36" }, "funding": [ { @@ -7700,20 +7700,20 @@ "type": "tidelift" } ], - "time": "2026-03-05T11:25:28+00:00" + "time": "2026-03-30T09:31:23+00:00" }, { "name": "symfony/monolog-bridge", - "version": "v6.4.34", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bridge.git", - "reference": "ee2d0150031b7c6ee2a1149fddddef3e7cdec117" + "reference": "f517ebb675534e0f018708e00037867b268ad5b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/ee2d0150031b7c6ee2a1149fddddef3e7cdec117", - "reference": "ee2d0150031b7c6ee2a1149fddddef3e7cdec117", + "url": "https://api.github.com/repos/symfony/monolog-bridge/zipball/f517ebb675534e0f018708e00037867b268ad5b6", + "reference": "f517ebb675534e0f018708e00037867b268ad5b6", "shasum": "" }, "require": { @@ -7763,7 +7763,7 @@ "description": "Provides integration for Monolog with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/monolog-bridge/tree/v6.4.34" + "source": "https://github.com/symfony/monolog-bridge/tree/v6.4.36" }, "funding": [ { @@ -7783,20 +7783,20 @@ "type": "tidelift" } ], - "time": "2026-02-16T20:44:03+00:00" + "time": "2026-03-30T12:54:10+00:00" }, { "name": "symfony/monolog-bundle", - "version": "v3.11.1", + "version": "v3.11.2", "source": { "type": "git", "url": "https://github.com/symfony/monolog-bundle.git", - "reference": "0e675a6e08f791ef960dc9c7e392787111a3f0c1" + "reference": "d87468010570b2ec766152184918ee8d267c7411" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/0e675a6e08f791ef960dc9c7e392787111a3f0c1", - "reference": "0e675a6e08f791ef960dc9c7e392787111a3f0c1", + "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/d87468010570b2ec766152184918ee8d267c7411", + "reference": "d87468010570b2ec766152184918ee8d267c7411", "shasum": "" }, "require": { @@ -7843,7 +7843,7 @@ ], "support": { "issues": "https://github.com/symfony/monolog-bundle/issues", - "source": "https://github.com/symfony/monolog-bundle/tree/v3.11.1" + "source": "https://github.com/symfony/monolog-bundle/tree/v3.11.2" }, "funding": [ { @@ -7863,7 +7863,7 @@ "type": "tidelift" } ], - "time": "2025-12-08T07:58:26+00:00" + "time": "2026-04-02T18:23:01+00:00" }, { "name": "symfony/options-resolver", @@ -8655,16 +8655,16 @@ }, { "name": "symfony/security-bundle", - "version": "v6.4.34", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/security-bundle.git", - "reference": "f67bd24782a80095e9b8953e18d01983b9fe8e34" + "reference": "00ce7236da125b39a24784958861678f7d09ce4c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-bundle/zipball/f67bd24782a80095e9b8953e18d01983b9fe8e34", - "reference": "f67bd24782a80095e9b8953e18d01983b9fe8e34", + "url": "https://api.github.com/repos/symfony/security-bundle/zipball/00ce7236da125b39a24784958861678f7d09ce4c", + "reference": "00ce7236da125b39a24784958861678f7d09ce4c", "shasum": "" }, "require": { @@ -8747,7 +8747,7 @@ "description": "Provides a tight integration of the Security component into the Symfony full-stack framework", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-bundle/tree/v6.4.34" + "source": "https://github.com/symfony/security-bundle/tree/v6.4.36" }, "funding": [ { @@ -8767,20 +8767,20 @@ "type": "tidelift" } ], - "time": "2026-02-22T21:48:58+00:00" + "time": "2026-03-30T13:20:55+00:00" }, { "name": "symfony/security-core", - "version": "v6.4.31", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/security-core.git", - "reference": "fa269ad61a021cc54329dc96e57bed78ba720bfe" + "reference": "1b7db28bcc3655543abfe58764025aef563705cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/security-core/zipball/fa269ad61a021cc54329dc96e57bed78ba720bfe", - "reference": "fa269ad61a021cc54329dc96e57bed78ba720bfe", + "url": "https://api.github.com/repos/symfony/security-core/zipball/1b7db28bcc3655543abfe58764025aef563705cd", + "reference": "1b7db28bcc3655543abfe58764025aef563705cd", "shasum": "" }, "require": { @@ -8837,7 +8837,7 @@ "description": "Symfony Security Component - Core Library", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/security-core/tree/v6.4.31" + "source": "https://github.com/symfony/security-core/tree/v6.4.36" }, "funding": [ { @@ -8857,7 +8857,7 @@ "type": "tidelift" } ], - "time": "2025-12-17T22:32:13+00:00" + "time": "2026-03-31T01:40:43+00:00" }, { "name": "symfony/security-csrf", @@ -9025,16 +9025,16 @@ }, { "name": "symfony/serializer", - "version": "v6.4.35", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "fc13cffae86138d3624eff9013724ea1d3e796b4" + "reference": "90e4e0187dca57331ea301506545aa26895b7787" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/fc13cffae86138d3624eff9013724ea1d3e796b4", - "reference": "fc13cffae86138d3624eff9013724ea1d3e796b4", + "url": "https://api.github.com/repos/symfony/serializer/zipball/90e4e0187dca57331ea301506545aa26895b7787", + "reference": "90e4e0187dca57331ea301506545aa26895b7787", "shasum": "" }, "require": { @@ -9103,7 +9103,7 @@ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v6.4.35" + "source": "https://github.com/symfony/serializer/tree/v6.4.36" }, "funding": [ { @@ -9123,7 +9123,7 @@ "type": "tidelift" } ], - "time": "2026-03-06T11:03:24+00:00" + "time": "2026-03-30T15:37:17+00:00" }, { "name": "symfony/service-contracts", @@ -9550,16 +9550,16 @@ }, { "name": "symfony/twig-bridge", - "version": "v6.4.35", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "352acf608d1c9c00692fc3bba9f445176c14ce0f" + "reference": "3ae963a108fd6fc14d09a7fe5e41fe64d8ac11ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/352acf608d1c9c00692fc3bba9f445176c14ce0f", - "reference": "352acf608d1c9c00692fc3bba9f445176c14ce0f", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/3ae963a108fd6fc14d09a7fe5e41fe64d8ac11ba", + "reference": "3ae963a108fd6fc14d09a7fe5e41fe64d8ac11ba", "shasum": "" }, "require": { @@ -9639,7 +9639,7 @@ "description": "Provides integration for Twig with various Symfony components", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/twig-bridge/tree/v6.4.35" + "source": "https://github.com/symfony/twig-bridge/tree/v6.4.36" }, "funding": [ { @@ -9659,7 +9659,7 @@ "type": "tidelift" } ], - "time": "2026-03-04T15:30:31+00:00" + "time": "2026-03-30T09:31:23+00:00" }, { "name": "symfony/twig-bundle", @@ -9751,16 +9751,16 @@ }, { "name": "symfony/validator", - "version": "v6.4.35", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/validator.git", - "reference": "9dc02b6c7502f7c4b68a741d2826bbec061c5953" + "reference": "14921e87b2bd69dfbd9757cdb1c6974a1316aac5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/9dc02b6c7502f7c4b68a741d2826bbec061c5953", - "reference": "9dc02b6c7502f7c4b68a741d2826bbec061c5953", + "url": "https://api.github.com/repos/symfony/validator/zipball/14921e87b2bd69dfbd9757cdb1c6974a1316aac5", + "reference": "14921e87b2bd69dfbd9757cdb1c6974a1316aac5", "shasum": "" }, "require": { @@ -9828,7 +9828,7 @@ "description": "Provides tools to validate values", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/validator/tree/v6.4.35" + "source": "https://github.com/symfony/validator/tree/v6.4.36" }, "funding": [ { @@ -9848,20 +9848,20 @@ "type": "tidelift" } ], - "time": "2026-03-02T17:53:19+00:00" + "time": "2026-03-26T15:58:46+00:00" }, { "name": "symfony/var-dumper", - "version": "v6.4.32", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "131fc9915e0343052af5ed5040401b481ca192aa" + "reference": "7c8ad9ce4faf6c8a99948e70ce02b601a0439782" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/131fc9915e0343052af5ed5040401b481ca192aa", - "reference": "131fc9915e0343052af5ed5040401b481ca192aa", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/7c8ad9ce4faf6c8a99948e70ce02b601a0439782", + "reference": "7c8ad9ce4faf6c8a99948e70ce02b601a0439782", "shasum": "" }, "require": { @@ -9916,7 +9916,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.4.32" + "source": "https://github.com/symfony/var-dumper/tree/v6.4.36" }, "funding": [ { @@ -9936,20 +9936,20 @@ "type": "tidelift" } ], - "time": "2026-01-01T13:34:06+00:00" + "time": "2026-03-30T15:36:00+00:00" }, { "name": "symfony/var-exporter", - "version": "v6.4.26", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "466fcac5fa2e871f83d31173f80e9c2684743bfc" + "reference": "f9c4a9695a9e2bbc65c920e147d8d7ae28f8d79a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/466fcac5fa2e871f83d31173f80e9c2684743bfc", - "reference": "466fcac5fa2e871f83d31173f80e9c2684743bfc", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/f9c4a9695a9e2bbc65c920e147d8d7ae28f8d79a", + "reference": "f9c4a9695a9e2bbc65c920e147d8d7ae28f8d79a", "shasum": "" }, "require": { @@ -9997,7 +9997,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v6.4.26" + "source": "https://github.com/symfony/var-exporter/tree/v6.4.36" }, "funding": [ { @@ -10017,7 +10017,7 @@ "type": "tidelift" } ], - "time": "2025-09-11T09:57:09+00:00" + "time": "2026-03-10T15:06:19+00:00" }, { "name": "symfony/webpack-encore-bundle", @@ -10228,7 +10228,7 @@ }, { "name": "twig/cssinliner-extra", - "version": "v3.23.0", + "version": "v3.24.0", "source": { "type": "git", "url": "https://github.com/twigphp/cssinliner-extra.git", @@ -10281,7 +10281,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/cssinliner-extra/tree/v3.23.0" + "source": "https://github.com/twigphp/cssinliner-extra/tree/v3.24.0" }, "funding": [ { @@ -10297,16 +10297,16 @@ }, { "name": "twig/extra-bundle", - "version": "v3.23.0", + "version": "v3.24.0", "source": { "type": "git", "url": "https://github.com/twigphp/twig-extra-bundle.git", - "reference": "7a27e784dc56eddfef5e9295829b290ce06f1682" + "reference": "6a621fcb1f28aa9ea7b34a99047ae0cdf5b834c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/7a27e784dc56eddfef5e9295829b290ce06f1682", - "reference": "7a27e784dc56eddfef5e9295829b290ce06f1682", + "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/6a621fcb1f28aa9ea7b34a99047ae0cdf5b834c9", + "reference": "6a621fcb1f28aa9ea7b34a99047ae0cdf5b834c9", "shasum": "" }, "require": { @@ -10355,7 +10355,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.23.0" + "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.24.0" }, "funding": [ { @@ -10367,11 +10367,11 @@ "type": "tidelift" } ], - "time": "2025-12-18T20:46:15+00:00" + "time": "2026-02-07T08:07:38+00:00" }, { "name": "twig/inky-extra", - "version": "v3.23.0", + "version": "v3.24.0", "source": { "type": "git", "url": "https://github.com/twigphp/inky-extra.git", @@ -10425,7 +10425,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/inky-extra/tree/v3.23.0" + "source": "https://github.com/twigphp/inky-extra/tree/v3.24.0" }, "funding": [ { @@ -10441,7 +10441,7 @@ }, { "name": "twig/intl-extra", - "version": "v3.23.0", + "version": "v3.24.0", "source": { "type": "git", "url": "https://github.com/twigphp/intl-extra.git", @@ -10489,7 +10489,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/intl-extra/tree/v3.23.0" + "source": "https://github.com/twigphp/intl-extra/tree/v3.24.0" }, "funding": [ { @@ -10505,7 +10505,7 @@ }, { "name": "twig/string-extra", - "version": "v3.23.0", + "version": "v3.24.0", "source": { "type": "git", "url": "https://github.com/twigphp/string-extra.git", @@ -10556,7 +10556,7 @@ "unicode" ], "support": { - "source": "https://github.com/twigphp/string-extra/tree/v3.23.0" + "source": "https://github.com/twigphp/string-extra/tree/v3.24.0" }, "funding": [ { @@ -10572,16 +10572,16 @@ }, { "name": "twig/twig", - "version": "v3.23.0", + "version": "v3.24.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "a64dc5d2cc7d6cafb9347f6cd802d0d06d0351c9" + "reference": "a6769aefb305efef849dc25c9fd1653358c148f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/a64dc5d2cc7d6cafb9347f6cd802d0d06d0351c9", - "reference": "a64dc5d2cc7d6cafb9347f6cd802d0d06d0351c9", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/a6769aefb305efef849dc25c9fd1653358c148f0", + "reference": "a6769aefb305efef849dc25c9fd1653358c148f0", "shasum": "" }, "require": { @@ -10591,7 +10591,8 @@ "symfony/polyfill-mbstring": "^1.3" }, "require-dev": { - "phpstan/phpstan": "^2.0", + "php-cs-fixer/shim": "^3.0@stable", + "phpstan/phpstan": "^2.0@stable", "psr/container": "^1.0|^2.0", "symfony/phpunit-bridge": "^5.4.9|^6.4|^7.0" }, @@ -10635,7 +10636,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.23.0" + "source": "https://github.com/twigphp/Twig/tree/v3.24.0" }, "funding": [ { @@ -10647,7 +10648,7 @@ "type": "tidelift" } ], - "time": "2026-01-23T21:00:41+00:00" + "time": "2026-03-17T21:31:11+00:00" }, { "name": "webmozart/assert", @@ -11103,16 +11104,16 @@ }, { "name": "doctrine/data-fixtures", - "version": "2.2.0", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/doctrine/data-fixtures.git", - "reference": "7a615ba135e45d67674bb623d90f34f6c7b6bd97" + "reference": "bf7ac3a050b54b261cedfb3d0a44733819062275" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/7a615ba135e45d67674bb623d90f34f6c7b6bd97", - "reference": "7a615ba135e45d67674bb623d90f34f6c7b6bd97", + "url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/bf7ac3a050b54b261cedfb3d0a44733819062275", + "reference": "bf7ac3a050b54b261cedfb3d0a44733819062275", "shasum": "" }, "require": { @@ -11130,12 +11131,14 @@ "doctrine/dbal": "^3.5 || ^4", "doctrine/mongodb-odm": "^1.3.0 || ^2.0.0", "doctrine/orm": "^2.14 || ^3", + "doctrine/phpcr-odm": "^1.8 || ^2.0", "ext-sqlite3": "*", "fig/log-test": "^1", - "phpstan/phpstan": "2.1.31", - "phpunit/phpunit": "10.5.45 || 12.4.0", - "symfony/cache": "^6.4 || ^7", - "symfony/var-exporter": "^6.4 || ^7" + "jackalope/jackalope-fs": "*", + "phpstan/phpstan": "2.1.46", + "phpunit/phpunit": "10.5.63 || 12.5.12", + "symfony/cache": "^6.4 || ^7 || ^8", + "symfony/var-exporter": "^6.4 || ^7 || ^8" }, "suggest": { "alcaeus/mongo-php-adapter": "For using MongoDB ODM 1.3 with PHP 7 (deprecated)", @@ -11166,7 +11169,7 @@ ], "support": { "issues": "https://github.com/doctrine/data-fixtures/issues", - "source": "https://github.com/doctrine/data-fixtures/tree/2.2.0" + "source": "https://github.com/doctrine/data-fixtures/tree/2.2.1" }, "funding": [ { @@ -11182,7 +11185,7 @@ "type": "tidelift" } ], - "time": "2025-10-17T20:06:20+00:00" + "time": "2026-04-01T13:56:01+00:00" }, { "name": "doctrine/doctrine-fixtures-bundle", @@ -11733,11 +11736,11 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.40", + "version": "2.1.46", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9b2c7aeb83a75d8680ea5e7c9b7fca88052b766b", - "reference": "9b2c7aeb83a75d8680ea5e7c9b7fca88052b766b", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a193923fc2d6325ef4e741cf3af8c3e8f54dbf25", + "reference": "a193923fc2d6325ef4e741cf3af8c3e8f54dbf25", "shasum": "" }, "require": { @@ -11782,7 +11785,7 @@ "type": "github" } ], - "time": "2026-02-23T15:04:35+00:00" + "time": "2026-04-01T09:25:14+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -14312,16 +14315,16 @@ }, { "name": "symfony/web-profiler-bundle", - "version": "v6.4.35", + "version": "v6.4.36", "source": { "type": "git", "url": "https://github.com/symfony/web-profiler-bundle.git", - "reference": "ae7fc9802c6eef1fa5078efad3c72db836ffcb9d" + "reference": "6f75b4c748886c8e04a3674225d00eaa51f3842d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/ae7fc9802c6eef1fa5078efad3c72db836ffcb9d", - "reference": "ae7fc9802c6eef1fa5078efad3c72db836ffcb9d", + "url": "https://api.github.com/repos/symfony/web-profiler-bundle/zipball/6f75b4c748886c8e04a3674225d00eaa51f3842d", + "reference": "6f75b4c748886c8e04a3674225d00eaa51f3842d", "shasum": "" }, "require": { @@ -14374,7 +14377,7 @@ "dev" ], "support": { - "source": "https://github.com/symfony/web-profiler-bundle/tree/v6.4.35" + "source": "https://github.com/symfony/web-profiler-bundle/tree/v6.4.36" }, "funding": [ { @@ -14394,7 +14397,7 @@ "type": "tidelift" } ], - "time": "2026-03-03T10:22:09+00:00" + "time": "2026-03-17T09:05:06+00:00" }, { "name": "theseer/tokenizer", diff --git a/package.json b/package.json index 4de2d43c..90e5dfc3 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "bootstrap": "^5.3", "chart.js": "^4", "core-js": "^3", + "dompurify": "^3", "eslint": "^9", "globals": "^15", "gridstack": "^7", diff --git a/phpstan.neon b/phpstan.neon index 0e8903d2..b67c8d47 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1665,11 +1665,6 @@ parameters: count: 1 path: src/Form/Extension/SelectWithApiDataExtension.php - - - message: "#^Parameter \\#1 \\$name of method Symfony\\\\Component\\\\Routing\\\\Generator\\\\UrlGeneratorInterface\\:\\:generate\\(\\) expects string, mixed given\\.$#" - count: 1 - path: src/Form/Extension/SelectWithApiDataExtension.php - - message: "#^Property App\\\\Form\\\\Helper\\\\ActivityHelper\\:\\:\\$pattern \\(string\\|null\\) does not accept bool\\|float\\|int\\|string\\|null\\.$#" count: 1 diff --git a/public/build/app.41748d55.js b/public/build/app.41748d55.js deleted file mode 100644 index beeff41d..00000000 --- a/public/build/app.41748d55.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! For license information please see app.41748d55.js.LICENSE.txt */ -(self.webpackChunkkimai=self.webpackChunkkimai||[]).push([[524],{424:function(t){window,t.exports=function(t){var e={};function n(i){if(e[i])return e[i].exports;var s=e[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)n.d(i,s,function(e){return t[e]}.bind(null,s));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=4)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(e,n,i){void 0===e&&(e=null),void 0===n&&(n=null),void 0===i&&(i="en-US"),this.dateInstance="object"==typeof n&&null!==n?n.parse(e instanceof t?e.clone().toJSDate():e):"string"==typeof n?t.parseDateTime(e,n,i):e?t.parseDateTime(e):t.parseDateTime(new Date),this.lang=i}return t.parseDateTime=function(e,n,i){if(void 0===n&&(n="YYYY-MM-DD"),void 0===i&&(i="en-US"),!e)return new Date(NaN);if(e instanceof Date)return new Date(e);if(e instanceof t)return e.clone().toJSDate();if(/^-?\d{10,}$/.test(e))return t.getDateZeroTime(new Date(Number(e)));if("string"==typeof e){for(var s=[],r=null;null!=(r=t.regex.exec(n));)"\\"!==r[1]&&s.push(r);if(s.length){var o={year:null,month:null,shortMonth:null,longMonth:null,day:null,value:""};s[0].index>0&&(o.value+=".*?");for(var a=0,l=Object.entries(s);at.getTime()&&this.timestamp()=t.getTime()&&this.timestamp()t.getTime()&&this.timestamp()<=e.getTime();case"[]":return this.timestamp()>=t.getTime()&&this.timestamp()<=e.getTime()}},t.prototype.isBefore=function(t,e){switch(void 0===e&&(e="seconds"),e){case"second":case"seconds":return t.getTime()>this.getTime();case"day":case"days":return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()>new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime();case"month":case"months":return new Date(t.getFullYear(),t.getMonth(),1).getTime()>new Date(this.getFullYear(),this.getMonth(),1).getTime();case"year":case"years":return t.getFullYear()>this.getFullYear()}throw new Error("isBefore: Invalid unit!")},t.prototype.isSameOrBefore=function(t,e){switch(void 0===e&&(e="seconds"),e){case"second":case"seconds":return t.getTime()>=this.getTime();case"day":case"days":return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()>=new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime();case"month":case"months":return new Date(t.getFullYear(),t.getMonth(),1).getTime()>=new Date(this.getFullYear(),this.getMonth(),1).getTime()}throw new Error("isSameOrBefore: Invalid unit!")},t.prototype.isAfter=function(t,e){switch(void 0===e&&(e="seconds"),e){case"second":case"seconds":return this.getTime()>t.getTime();case"day":case"days":return new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime()>new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime();case"month":case"months":return new Date(this.getFullYear(),this.getMonth(),1).getTime()>new Date(t.getFullYear(),t.getMonth(),1).getTime();case"year":case"years":return this.getFullYear()>t.getFullYear()}throw new Error("isAfter: Invalid unit!")},t.prototype.isSameOrAfter=function(t,e){switch(void 0===e&&(e="seconds"),e){case"second":case"seconds":return this.getTime()>=t.getTime();case"day":case"days":return new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime()>=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime();case"month":case"months":return new Date(this.getFullYear(),this.getMonth(),1).getTime()>=new Date(t.getFullYear(),t.getMonth(),1).getTime()}throw new Error("isSameOrAfter: Invalid unit!")},t.prototype.isSame=function(t,e){switch(void 0===e&&(e="seconds"),e){case"second":case"seconds":return this.getTime()===t.getTime();case"day":case"days":return new Date(this.getFullYear(),this.getMonth(),this.getDate()).getTime()===new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime();case"month":case"months":return new Date(this.getFullYear(),this.getMonth(),1).getTime()===new Date(t.getFullYear(),t.getMonth(),1).getTime()}throw new Error("isSame: Invalid unit!")},t.prototype.add=function(t,e){switch(void 0===e&&(e="seconds"),e){case"second":case"seconds":this.setSeconds(this.getSeconds()+t);break;case"day":case"days":this.setDate(this.getDate()+t);break;case"month":case"months":this.setMonth(this.getMonth()+t)}return this},t.prototype.subtract=function(t,e){switch(void 0===e&&(e="seconds"),e){case"second":case"seconds":this.setSeconds(this.getSeconds()-t);break;case"day":case"days":this.setDate(this.getDate()-t);break;case"month":case"months":this.setMonth(this.getMonth()-t)}return this},t.prototype.diff=function(t,e){switch(void 0===e&&(e="seconds"),e){default:case"second":case"seconds":return this.getTime()-t.getTime();case"day":case"days":return Math.round((this.timestamp()-t.getTime())/864e5);case"month":case"months":}},t.prototype.format=function(e,n){if(void 0===n&&(n="en-US"),"object"==typeof e)return e.output(this.clone().toJSDate());for(var i="",s=[],r=null;null!=(r=t.regex.exec(e));)"\\"!==r[1]&&s.push(r);if(s.length){s[0].index>0&&(i+=e.substring(0,s[0].index));for(var o=0,a=Object.entries(s);o1&&n.isAfter(e)&&n.setMonth(n.getMonth()-(this.options.numberOfMonths-1)),this.calendars[0]=n.clone()):(e.setDate(1),this.calendars[0]=e.clone())}},e.prototype.bindEvents=function(){document.addEventListener("click",this.onClick.bind(this),!0),this.ui=document.createElement("div"),this.ui.className=l.litepicker,this.ui.style.display="none",this.ui.addEventListener("mouseenter",this.onMouseEnter.bind(this),!0),this.ui.addEventListener("mouseleave",this.onMouseLeave.bind(this),!1),this.options.autoRefresh?(this.options.element instanceof HTMLElement&&this.options.element.addEventListener("keyup",this.onInput.bind(this),!0),this.options.elementEnd instanceof HTMLElement&&this.options.elementEnd.addEventListener("keyup",this.onInput.bind(this),!0)):(this.options.element instanceof HTMLElement&&this.options.element.addEventListener("change",this.onInput.bind(this),!0),this.options.elementEnd instanceof HTMLElement&&this.options.elementEnd.addEventListener("change",this.onInput.bind(this),!0)),this.options.parentEl?this.options.parentEl instanceof HTMLElement?this.options.parentEl.appendChild(this.ui):document.querySelector(this.options.parentEl).appendChild(this.ui):this.options.inlineMode?this.options.element instanceof HTMLInputElement?this.options.element.parentNode.appendChild(this.ui):this.options.element.appendChild(this.ui):document.body.appendChild(this.ui),this.updateInput(),this.init(),"function"==typeof this.options.setup&&this.options.setup.call(this,this),this.render(),this.options.inlineMode&&this.show()},e.prototype.updateInput=function(){if(this.options.element instanceof HTMLInputElement){var t=this.options.startDate,e=this.options.endDate;if(this.options.singleMode&&t)this.options.element.value=t.format(this.options.format,this.options.lang);else if(!this.options.singleMode&&t&&e){var n=t.format(this.options.format,this.options.lang),i=e.format(this.options.format,this.options.lang);this.options.elementEnd instanceof HTMLInputElement?(this.options.element.value=n,this.options.elementEnd.value=i):this.options.element.value=""+n+this.options.delimiter+i}t||e||(this.options.element.value="",this.options.elementEnd instanceof HTMLInputElement&&(this.options.elementEnd.value=""))}},e.prototype.isSamePicker=function(t){return t.closest("."+l.litepicker)===this.ui},e.prototype.shouldShown=function(t){return!t.disabled&&(t===this.options.element||this.options.elementEnd&&t===this.options.elementEnd)},e.prototype.shouldResetDatePicked=function(){return this.options.singleMode||2===this.datePicked.length},e.prototype.shouldSwapDatePicked=function(){return 2===this.datePicked.length&&this.datePicked[0].getTime()>this.datePicked[1].getTime()},e.prototype.shouldCheckLockDays=function(){return this.options.disallowLockDaysInRange&&2===this.datePicked.length},e.prototype.onClick=function(t){var e=t.target;if(t.target.shadowRoot&&(e=t.composedPath()[0]),e&&this.ui)if(this.shouldShown(e))this.show(e);else if(e.closest("."+l.litepicker)||!this.isShowning()){if(this.isSamePicker(e))if(this.emit("before:click",e),this.preventClick)this.preventClick=!1;else{if(e.classList.contains(l.dayItem)){if(t.preventDefault(),e.classList.contains(l.isLocked))return;if(this.shouldResetDatePicked()&&(this.datePicked.length=0),this.datePicked[this.datePicked.length]=new a.DateTime(e.dataset.time),this.shouldSwapDatePicked()){var n=this.datePicked[1].clone();this.datePicked[1]=this.datePicked[0].clone(),this.datePicked[0]=n.clone()}return this.shouldCheckLockDays()&&c.rangeIsLocked(this.datePicked,this.options)&&(this.emit("error:range",this.datePicked),this.datePicked.length=0),this.render(),this.emit.apply(this,r(["preselect"],r(this.datePicked).map(function(t){return t.clone()}))),void(this.options.autoApply&&(this.options.singleMode&&this.datePicked.length?(this.setDate(this.datePicked[0]),this.hide()):this.options.singleMode||2!==this.datePicked.length||(this.setDateRange(this.datePicked[0],this.datePicked[1]),this.hide())))}if(e.classList.contains(l.buttonPreviousMonth)){t.preventDefault();var i=0,s=this.options.switchingMonths||this.options.numberOfMonths;if(this.options.splitView){var o=e.closest("."+l.monthItem);i=c.findNestedMonthItem(o),s=1}return this.calendars[i].setMonth(this.calendars[i].getMonth()-s),this.gotoDate(this.calendars[i],i),void this.emit("change:month",this.calendars[i],i)}if(e.classList.contains(l.buttonNextMonth))return t.preventDefault(),i=0,s=this.options.switchingMonths||this.options.numberOfMonths,this.options.splitView&&(o=e.closest("."+l.monthItem),i=c.findNestedMonthItem(o),s=1),this.calendars[i].setMonth(this.calendars[i].getMonth()+s),this.gotoDate(this.calendars[i],i),void this.emit("change:month",this.calendars[i],i);e.classList.contains(l.buttonCancel)&&(t.preventDefault(),this.hide(),this.emit("button:cancel")),e.classList.contains(l.buttonApply)&&(t.preventDefault(),this.options.singleMode&&this.datePicked.length?this.setDate(this.datePicked[0]):this.options.singleMode||2!==this.datePicked.length||this.setDateRange(this.datePicked[0],this.datePicked[1]),this.hide(),this.emit("button:apply",this.options.startDate,this.options.endDate))}}else this.hide()},e.prototype.showTooltip=function(t,e){var n=this.ui.querySelector("."+l.containerTooltip);n.style.visibility="visible",n.innerHTML=e;var i=this.ui.getBoundingClientRect(),s=n.getBoundingClientRect(),r=t.getBoundingClientRect(),o=r.top,a=r.left;if(this.options.inlineMode&&this.options.parentEl){var c=this.ui.parentNode.getBoundingClientRect();o-=c.top,a-=c.left}else o-=i.top,a-=i.left;o-=s.height,a-=s.width/2,a+=r.width/2,n.style.top=o+"px",n.style.left=a+"px",this.emit("tooltip",n,t)},e.prototype.hideTooltip=function(){this.ui.querySelector("."+l.containerTooltip).style.visibility="hidden"},e.prototype.shouldAllowMouseEnter=function(t){return!this.options.singleMode&&!t.classList.contains(l.isLocked)},e.prototype.shouldAllowRepick=function(){return this.options.elementEnd&&this.options.allowRepick&&this.options.startDate&&this.options.endDate},e.prototype.isDayItem=function(t){return t.classList.contains(l.dayItem)},e.prototype.onMouseEnter=function(t){var e=this,n=t.target;if(this.isDayItem(n)&&this.shouldAllowMouseEnter(n)){if(this.shouldAllowRepick()&&(this.triggerElement===this.options.element?this.datePicked[0]=this.options.endDate.clone():this.triggerElement===this.options.elementEnd&&(this.datePicked[0]=this.options.startDate.clone())),1!==this.datePicked.length)return;var i=this.ui.querySelector("."+l.dayItem+'[data-time="'+this.datePicked[0].getTime()+'"]'),s=this.datePicked[0].clone(),r=new a.DateTime(n.dataset.time),o=!1;if(s.getTime()>r.getTime()){var c=s.clone();s=r.clone(),r=c.clone(),o=!0}if(Array.prototype.slice.call(this.ui.querySelectorAll("."+l.dayItem)).forEach(function(t){var n=new a.DateTime(t.dataset.time),i=e.renderDay(n);n.isBetween(s,r)&&i.classList.add(l.isInRange),t.className=i.className}),n.classList.add(l.isEndDate),o?(i&&i.classList.add(l.isFlipped),n.classList.add(l.isFlipped)):(i&&i.classList.remove(l.isFlipped),n.classList.remove(l.isFlipped)),this.options.showTooltip){var u=r.diff(s,"day")+1;if("function"==typeof this.options.tooltipNumber&&(u=this.options.tooltipNumber.call(this,u)),u>0){var d=this.pluralSelector(u),h=u+" "+(this.options.tooltipText[d]?this.options.tooltipText[d]:"["+d+"]");this.showTooltip(n,h);var p=window.navigator.userAgent,m=/(iphone|ipad)/i.test(p),f=/OS 1([0-2])/i.test(p);m&&f&&n.dispatchEvent(new Event("click"))}else this.hideTooltip()}}},e.prototype.onMouseLeave=function(t){t.target,this.options.allowRepick&&(!this.options.allowRepick||this.options.startDate||this.options.endDate)&&(this.datePicked.length=0,this.render())},e.prototype.onInput=function(t){var e=this.parseInput(),n=e[0],i=e[1],s=this.options.format;if(this.options.elementEnd?n instanceof a.DateTime&&i instanceof a.DateTime&&n.format(s)===this.options.element.value&&i.format(s)===this.options.elementEnd.value:this.options.singleMode?n instanceof a.DateTime&&n.format(s)===this.options.element.value:n instanceof a.DateTime&&i instanceof a.DateTime&&""+n.format(s)+this.options.delimiter+i.format(s)===this.options.element.value){if(i&&n.getTime()>i.getTime()){var r=n.clone();n=i.clone(),i=r.clone()}this.options.startDate=new a.DateTime(n,this.options.format,this.options.lang),i&&(this.options.endDate=new a.DateTime(i,this.options.format,this.options.lang)),this.updateInput(),this.render();var o=n.clone(),l=0;(this.options.elementEnd?n.format(s)===t.target.value:t.target.value.startsWith(n.format(s)))||(o=i.clone(),l=this.options.numberOfMonths-1),this.emit("selected",this.getStartDate(),this.getEndDate()),this.gotoDate(o,l)}},e}(o.Calendar);e.Litepicker=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.findNestedMonthItem=function(t){for(var e=t.parentNode.childNodes,n=0;ny&&((p=document.createElement("option")).value=String(t.getFullYear()),p.text=String(t.getFullYear()),p.selected=!0,p.disabled=!0,g.appendChild(p)),h=y;h>=v;h-=1){p=document.createElement("option");var b=new o.DateTime(new Date(h,0,1,0,0,0));p.value=String(h),p.text=String(h),p.disabled=this.options.minDate&&b.isBefore(new o.DateTime(this.options.minDate),"year")||this.options.maxDate&&b.isAfter(new o.DateTime(this.options.maxDate),"year"),p.selected=t.getFullYear()===h,g.appendChild(p)}if(t.getFullYear()W");for(var D=1;D<=7;D+=1){var x=3+this.options.firstDay+D,S=document.createElement("div");S.innerHTML=this.weekdayName(x),S.title=this.weekdayName(x,"long"),E.appendChild(S)}var O=document.createElement("div");O.className=a.containerDays;var L=this.calcSkipDays(i);this.options.showWeekNumbers&&L&&O.appendChild(this.renderWeekNumber(i));for(var C=0;C1&&1===this.datePicked.length){var s=this.options.minDays-1,r=this.datePicked[0].clone().subtract(s,"day"),c=this.datePicked[0].clone().add(s,"day");t.isBetween(r,this.datePicked[0],"(]")&&e.classList.add(a.isLocked),t.isBetween(this.datePicked[0],c,"[)")&&e.classList.add(a.isLocked)}if(this.options.maxDays&&1===this.datePicked.length){var u=this.options.maxDays;r=this.datePicked[0].clone().subtract(u,"day"),c=this.datePicked[0].clone().add(u,"day"),t.isSameOrBefore(r)&&e.classList.add(a.isLocked),t.isSameOrAfter(c)&&e.classList.add(a.isLocked)}return this.options.selectForward&&1===this.datePicked.length&&t.isBefore(this.datePicked[0])&&e.classList.add(a.isLocked),this.options.selectBackward&&1===this.datePicked.length&&t.isAfter(this.datePicked[0])&&e.classList.add(a.isLocked),l.dateIsLocked(t,this.options,this.datePicked)&&e.classList.add(a.isLocked),this.options.highlightedDays.length&&this.options.highlightedDays.filter(function(e){return e instanceof Array?t.isBetween(e[0],e[1],"[]"):e.isSame(t,"day")}).length&&e.classList.add(a.isHighlighted),e.tabIndex=e.classList.contains("is-locked")?-1:0,this.emit("render:day",e,t),e},e.prototype.renderFooter=function(){var t=document.createElement("div");if(t.className=a.containerFooter,this.options.footerHTML?t.innerHTML=this.options.footerHTML:t.innerHTML='\n \n \n \n ",this.options.singleMode){if(1===this.datePicked.length){var e=this.datePicked[0].format(this.options.format,this.options.lang);t.querySelector("."+a.previewDateRange).innerHTML=e}}else if(1===this.datePicked.length&&t.querySelector("."+a.buttonApply).setAttribute("disabled",""),2===this.datePicked.length){e=this.datePicked[0].format(this.options.format,this.options.lang);var n=this.datePicked[1].format(this.options.format,this.options.lang);t.querySelector("."+a.previewDateRange).innerHTML=""+e+this.options.delimiter+n}return this.emit("render:footer",t),t},e.prototype.renderWeekNumber=function(t){var e=document.createElement("div"),n=t.getWeek(this.options.firstDay);return e.className=a.weekNumber,e.innerHTML=53===n&&0===t.getMonth()?"53 / 1":n,e},e.prototype.renderTooltip=function(){var t=document.createElement("div");return t.className=a.containerTooltip,t},e.prototype.weekdayName=function(t,e){return void 0===e&&(e="short"),new Date(1970,0,t,12,0,0,0).toLocaleString(this.options.lang,{weekday:e})},e.prototype.calcSkipDays=function(t){var e=t.getDay()-this.options.firstDay;return e<0&&(e+=7),e},e}(r.LPCore);e.Calendar=c},function(t,e,n){"use strict";var i,s=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,i=arguments.length;n',nextMonth:'',reset:'\n \n \n '},tooltipText:{one:"day",other:"days"}},n.options=r(r({},n.options),e.element.dataset),Object.keys(n.options).forEach(function(t){"true"!==n.options[t]&&"false"!==n.options[t]||(n.options[t]="true"===n.options[t])});var i=r(r({},n.options.dropdowns),e.dropdowns),s=r(r({},n.options.buttonText),e.buttonText),o=r(r({},n.options.tooltipText),e.tooltipText);n.options=r(r({},n.options),e),n.options.dropdowns=r({},i),n.options.buttonText=r({},s),n.options.tooltipText=r({},o),n.options.elementEnd||(n.options.allowRepick=!1),n.options.lockDays.length&&(n.options.lockDays=a.DateTime.convertArray(n.options.lockDays,n.options.lockDaysFormat)),n.options.highlightedDays.length&&(n.options.highlightedDays=a.DateTime.convertArray(n.options.highlightedDays,n.options.highlightedDaysFormat));var l=n.parseInput(),c=l[0],u=l[1];n.options.startDate&&(n.options.singleMode||n.options.endDate)&&(c=new a.DateTime(n.options.startDate,n.options.format,n.options.lang)),c&&n.options.endDate&&(u=new a.DateTime(n.options.endDate,n.options.format,n.options.lang)),c instanceof a.DateTime&&!isNaN(c.getTime())&&(n.options.startDate=c),n.options.startDate&&u instanceof a.DateTime&&!isNaN(u.getTime())&&(n.options.endDate=u),!n.options.singleMode||n.options.startDate instanceof a.DateTime||(n.options.startDate=null),n.options.singleMode||n.options.startDate instanceof a.DateTime&&n.options.endDate instanceof a.DateTime||(n.options.startDate=null,n.options.endDate=null);for(var d=0;dwindow.innerHeight,c=e.top+r-n.height>=n.height;l&&c&&(o=e.top+r-n.height)}if(/left|right/.test(i[0])||i[1]&&"auto"!==i[1]&&/left|right/.test(i[1]))a=/left|right/.test(i[0])?e[i[0]]+s:e[i[1]]+s,"right"!==i[0]&&"right"!==i[1]||(a-=n.width);else{a=e.left+s,l=e.left+n.width>window.innerWidth;var u=e.right+s-n.width>=0;l&&u&&(a=e.right+s-n.width)}return{left:a,top:o}},e}(o.EventEmitter);e.LPCore=c},function(t,e,n){"use strict";var i,s="object"==typeof Reflect?Reflect:null,r=s&&"function"==typeof s.apply?s.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};i=s&&"function"==typeof s.ownKeys?s.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var l=10;function c(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function u(t,e,n,i){var s,r,o,a;if("function"!=typeof n)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n);if(void 0===(r=t._events)?(r=t._events=Object.create(null),t._eventsCount=0):(void 0!==r.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),r=t._events),o=r[e]),void 0===o)o=r[e]=n,++t._eventsCount;else if("function"==typeof o?o=r[e]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(s=c(t))>0&&o.length>s&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=o.length,a=l,console&&console.warn&&console.warn(a)}return t}function d(){for(var t=[],e=0;e0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[t];if(void 0===l)return!1;if("function"==typeof l)r(l,this,e);else{var c=l.length,u=f(l,c);for(n=0;n=0;r--)if(n[r]===e||n[r].listener===e){o=n[r].listener,s=r;break}if(s<0)return this;0===s?n.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,n){(e=n(9)(!1)).push([t.i,':root{--litepicker-container-months-color-bg: #fff;--litepicker-container-months-box-shadow-color: #ddd;--litepicker-footer-color-bg: #fafafa;--litepicker-footer-box-shadow-color: #ddd;--litepicker-tooltip-color-bg: #fff;--litepicker-month-header-color: #333;--litepicker-button-prev-month-color: #9e9e9e;--litepicker-button-next-month-color: #9e9e9e;--litepicker-button-prev-month-color-hover: #2196f3;--litepicker-button-next-month-color-hover: #2196f3;--litepicker-month-width: calc(var(--litepicker-day-width) * 7);--litepicker-month-weekday-color: #9e9e9e;--litepicker-month-week-number-color: #9e9e9e;--litepicker-day-width: 38px;--litepicker-day-color: #333;--litepicker-day-color-hover: #2196f3;--litepicker-is-today-color: #f44336;--litepicker-is-in-range-color: #bbdefb;--litepicker-is-locked-color: #9e9e9e;--litepicker-is-start-color: #fff;--litepicker-is-start-color-bg: #2196f3;--litepicker-is-end-color: #fff;--litepicker-is-end-color-bg: #2196f3;--litepicker-button-cancel-color: #fff;--litepicker-button-cancel-color-bg: #9e9e9e;--litepicker-button-apply-color: #fff;--litepicker-button-apply-color-bg: #2196f3;--litepicker-button-reset-color: #909090;--litepicker-button-reset-color-hover: #2196f3;--litepicker-highlighted-day-color: #333;--litepicker-highlighted-day-color-bg: #ffeb3b}.show-week-numbers{--litepicker-month-width: calc(var(--litepicker-day-width) * 8)}.litepicker{font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:0.8em;display:none}.litepicker button{border:none;background:none}.litepicker .container__main{display:-webkit-box;display:-ms-flexbox;display:flex}.litepicker .container__months{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;background-color:var(--litepicker-container-months-color-bg);border-radius:5px;-webkit-box-shadow:0 0 5px var(--litepicker-container-months-box-shadow-color);box-shadow:0 0 5px var(--litepicker-container-months-box-shadow-color);width:calc(var(--litepicker-month-width) + 10px);-webkit-box-sizing:content-box;box-sizing:content-box}.litepicker .container__months.columns-2{width:calc((var(--litepicker-month-width) * 2) + 20px)}.litepicker .container__months.columns-3{width:calc((var(--litepicker-month-width) * 3) + 30px)}.litepicker .container__months.columns-4{width:calc((var(--litepicker-month-width) * 4) + 40px)}.litepicker .container__months.split-view .month-item-header .button-previous-month,.litepicker .container__months.split-view .month-item-header .button-next-month{visibility:visible}.litepicker .container__months .month-item{padding:5px;width:var(--litepicker-month-width);-webkit-box-sizing:content-box;box-sizing:content-box}.litepicker .container__months .month-item-header{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;font-weight:500;padding:10px 5px;text-align:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--litepicker-month-header-color)}.litepicker .container__months .month-item-header div{-webkit-box-flex:1;-ms-flex:1;flex:1}.litepicker .container__months .month-item-header div>.month-item-name{margin-right:5px}.litepicker .container__months .month-item-header div>.month-item-year{padding:0}.litepicker .container__months .month-item-header .reset-button{color:var(--litepicker-button-reset-color)}.litepicker .container__months .month-item-header .reset-button>svg{fill:var(--litepicker-button-reset-color)}.litepicker .container__months .month-item-header .reset-button *{pointer-events:none}.litepicker .container__months .month-item-header .reset-button:hover{color:var(--litepicker-button-reset-color-hover)}.litepicker .container__months .month-item-header .reset-button:hover>svg{fill:var(--litepicker-button-reset-color-hover)}.litepicker .container__months .month-item-header .button-previous-month,.litepicker .container__months .month-item-header .button-next-month{visibility:hidden;text-decoration:none;padding:3px 5px;border-radius:3px;-webkit-transition:color 0.3s, border 0.3s;transition:color 0.3s, border 0.3s;cursor:default}.litepicker .container__months .month-item-header .button-previous-month *,.litepicker .container__months .month-item-header .button-next-month *{pointer-events:none}.litepicker .container__months .month-item-header .button-previous-month{color:var(--litepicker-button-prev-month-color)}.litepicker .container__months .month-item-header .button-previous-month>svg,.litepicker .container__months .month-item-header .button-previous-month>img{fill:var(--litepicker-button-prev-month-color)}.litepicker .container__months .month-item-header .button-previous-month:hover{color:var(--litepicker-button-prev-month-color-hover)}.litepicker .container__months .month-item-header .button-previous-month:hover>svg{fill:var(--litepicker-button-prev-month-color-hover)}.litepicker .container__months .month-item-header .button-next-month{color:var(--litepicker-button-next-month-color)}.litepicker .container__months .month-item-header .button-next-month>svg,.litepicker .container__months .month-item-header .button-next-month>img{fill:var(--litepicker-button-next-month-color)}.litepicker .container__months .month-item-header .button-next-month:hover{color:var(--litepicker-button-next-month-color-hover)}.litepicker .container__months .month-item-header .button-next-month:hover>svg{fill:var(--litepicker-button-next-month-color-hover)}.litepicker .container__months .month-item-weekdays-row{display:-webkit-box;display:-ms-flexbox;display:flex;justify-self:center;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;color:var(--litepicker-month-weekday-color)}.litepicker .container__months .month-item-weekdays-row>div{padding:5px 0;font-size:85%;-webkit-box-flex:1;-ms-flex:1;flex:1;width:var(--litepicker-day-width);text-align:center}.litepicker .container__months .month-item:first-child .button-previous-month{visibility:visible}.litepicker .container__months .month-item:last-child .button-next-month{visibility:visible}.litepicker .container__months .month-item.no-previous-month .button-previous-month{visibility:hidden}.litepicker .container__months .month-item.no-next-month .button-next-month{visibility:hidden}.litepicker .container__days{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;justify-self:center;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:center;-webkit-box-sizing:content-box;box-sizing:content-box}.litepicker .container__days>div,.litepicker .container__days>a{padding:5px 0;width:var(--litepicker-day-width)}.litepicker .container__days .day-item{color:var(--litepicker-day-color);text-align:center;text-decoration:none;border-radius:3px;-webkit-transition:color 0.3s, border 0.3s;transition:color 0.3s, border 0.3s;cursor:default}.litepicker .container__days .day-item:hover{color:var(--litepicker-day-color-hover);-webkit-box-shadow:inset 0 0 0 1px var(--litepicker-day-color-hover);box-shadow:inset 0 0 0 1px var(--litepicker-day-color-hover)}.litepicker .container__days .day-item.is-today{color:var(--litepicker-is-today-color)}.litepicker .container__days .day-item.is-locked{color:var(--litepicker-is-locked-color)}.litepicker .container__days .day-item.is-locked:hover{color:var(--litepicker-is-locked-color);-webkit-box-shadow:none;box-shadow:none;cursor:default}.litepicker .container__days .day-item.is-in-range{background-color:var(--litepicker-is-in-range-color);border-radius:0}.litepicker .container__days .day-item.is-start-date{color:var(--litepicker-is-start-color);background-color:var(--litepicker-is-start-color-bg);border-top-left-radius:5px;border-bottom-left-radius:5px;border-top-right-radius:0;border-bottom-right-radius:0}.litepicker .container__days .day-item.is-start-date.is-flipped{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:5px;border-bottom-right-radius:5px}.litepicker .container__days .day-item.is-end-date{color:var(--litepicker-is-end-color);background-color:var(--litepicker-is-end-color-bg);border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:5px;border-bottom-right-radius:5px}.litepicker .container__days .day-item.is-end-date.is-flipped{border-top-left-radius:5px;border-bottom-left-radius:5px;border-top-right-radius:0;border-bottom-right-radius:0}.litepicker .container__days .day-item.is-start-date.is-end-date{border-top-left-radius:5px;border-bottom-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px}.litepicker .container__days .day-item.is-highlighted{color:var(--litepicker-highlighted-day-color);background-color:var(--litepicker-highlighted-day-color-bg)}.litepicker .container__days .week-number{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;color:var(--litepicker-month-week-number-color);font-size:85%}.litepicker .container__footer{text-align:right;padding:10px 5px;margin:0 5px;background-color:var(--litepicker-footer-color-bg);-webkit-box-shadow:inset 0px 3px 3px 0px var(--litepicker-footer-box-shadow-color);box-shadow:inset 0px 3px 3px 0px var(--litepicker-footer-box-shadow-color);border-bottom-left-radius:5px;border-bottom-right-radius:5px}.litepicker .container__footer .preview-date-range{margin-right:10px;font-size:90%}.litepicker .container__footer .button-cancel{background-color:var(--litepicker-button-cancel-color-bg);color:var(--litepicker-button-cancel-color);border:0;padding:3px 7px 4px;border-radius:3px}.litepicker .container__footer .button-cancel *{pointer-events:none}.litepicker .container__footer .button-apply{background-color:var(--litepicker-button-apply-color-bg);color:var(--litepicker-button-apply-color);border:0;padding:3px 7px 4px;border-radius:3px;margin-left:10px;margin-right:10px}.litepicker .container__footer .button-apply:disabled{opacity:0.7}.litepicker .container__footer .button-apply *{pointer-events:none}.litepicker .container__tooltip{position:absolute;margin-top:-4px;padding:4px 8px;border-radius:4px;background-color:var(--litepicker-tooltip-color-bg);-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.25);box-shadow:0 1px 3px rgba(0,0,0,0.25);white-space:nowrap;font-size:11px;pointer-events:none;visibility:hidden}.litepicker .container__tooltip:before{position:absolute;bottom:-5px;left:calc(50% - 5px);border-top:5px solid rgba(0,0,0,0.12);border-right:5px solid transparent;border-left:5px solid transparent;content:""}.litepicker .container__tooltip:after{position:absolute;bottom:-4px;left:calc(50% - 4px);border-top:4px solid var(--litepicker-tooltip-color-bg);border-right:4px solid transparent;border-left:4px solid transparent;content:""}\n',""]),e.locals={showWeekNumbers:"show-week-numbers",litepicker:"litepicker",containerMain:"container__main",containerMonths:"container__months",columns2:"columns-2",columns3:"columns-3",columns4:"columns-4",splitView:"split-view",monthItemHeader:"month-item-header",buttonPreviousMonth:"button-previous-month",buttonNextMonth:"button-next-month",monthItem:"month-item",monthItemName:"month-item-name",monthItemYear:"month-item-year",resetButton:"reset-button",monthItemWeekdaysRow:"month-item-weekdays-row",noPreviousMonth:"no-previous-month",noNextMonth:"no-next-month",containerDays:"container__days",dayItem:"day-item",isToday:"is-today",isLocked:"is-locked",isInRange:"is-in-range",isStartDate:"is-start-date",isFlipped:"is-flipped",isEndDate:"is-end-date",isHighlighted:"is-highlighted",weekNumber:"week-number",containerFooter:"container__footer",previewDateRange:"preview-date-range",buttonCancel:"button-cancel",buttonApply:"button-apply",containerTooltip:"container__tooltip"},t.exports=e},function(t,e,n){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map(function(e){var n=function(t,e){var n,i,s,r=t[1]||"",o=t[3];if(!o)return r;if(e&&"function"==typeof btoa){var a=(n=o,i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),"/*# ".concat(s," */")),l=o.sources.map(function(t){return"/*# sourceURL=".concat(o.sourceRoot||"").concat(t," */")});return[r].concat(l).concat([a]).join("\n")}return[r].join("\n")}(e,t);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n}).join("")},e.i=function(t,n,i){"string"==typeof t&&(t=[[null,t,""]]);var s={};if(i)for(var r=0;rthis.options.endDate.getTime()&&(this.options.endDate=this.options.startDate.clone(),this.options.startDate=new s.DateTime(t,this.options.format,this.options.lang)),this.updateInput())},r.Litepicker.prototype.setDateRange=function(t,e,n){void 0===n&&(n=!1),this.triggerElement=void 0;var i=new s.DateTime(t,this.options.format,this.options.lang),r=new s.DateTime(e,this.options.format,this.options.lang);(this.options.disallowLockDaysInRange?o.rangeIsLocked([i,r],this.options):o.dateIsLocked(i,this.options,[i,r])||o.dateIsLocked(r,this.options,[i,r]))&&!n?this.emit("error:range",[i,r]):(this.setStartDate(i),this.setEndDate(r),this.options.inlineMode&&this.render(),this.updateInput(),this.emit("selected",this.getStartDate(),this.getEndDate()))},r.Litepicker.prototype.gotoDate=function(t,e){void 0===e&&(e=0);var n=new s.DateTime(t);n.setDate(1),this.calendars[e]=n.clone(),this.render()},r.Litepicker.prototype.setLockDays=function(t){this.options.lockDays=s.DateTime.convertArray(t,this.options.lockDaysFormat),this.render()},r.Litepicker.prototype.setHighlightedDays=function(t){this.options.highlightedDays=s.DateTime.convertArray(t,this.options.highlightedDaysFormat),this.render()},r.Litepicker.prototype.setOptions=function(t){delete t.element,delete t.elementEnd,delete t.parentEl,t.startDate&&(t.startDate=new s.DateTime(t.startDate,this.options.format,this.options.lang)),t.endDate&&(t.endDate=new s.DateTime(t.endDate,this.options.format,this.options.lang));var e=i(i({},this.options.dropdowns),t.dropdowns),n=i(i({},this.options.buttonText),t.buttonText),r=i(i({},this.options.tooltipText),t.tooltipText);this.options=i(i({},this.options),t),this.options.dropdowns=i({},e),this.options.buttonText=i({},n),this.options.tooltipText=i({},r),!this.options.singleMode||this.options.startDate instanceof s.DateTime||(this.options.startDate=null,this.options.endDate=null),this.options.singleMode||this.options.startDate instanceof s.DateTime&&this.options.endDate instanceof s.DateTime||(this.options.startDate=null,this.options.endDate=null);for(var o=0;o'),null!==t.url){if(n+='"}this.createFromClickEvent(t,n)}createFromClickEvent(t,e){const n=this.getContextMenuElement();n.classList.contains("action-dropdown")||n.classList.add("action-dropdown"),n.innerHTML=e,n.style.position="fixed",n.style.top=t.clientY+"px",n.style.left=t.clientX+"px";const i=t=>{t.target.classList.contains("dropdown-toggle")||t.target.classList.contains("dropdown-divider")||(n.classList.remove("d-block"),n.classList.contains("d-none")||n.classList.add("d-none"),n.removeEventListener("click",i),document.removeEventListener("click",i))};n.addEventListener("click",i),document.addEventListener("click",i),n.classList.remove("d-none"),n.classList.contains("d-block")||n.classList.add("d-block")}static createForDataTable(t){[].slice.call(document.querySelectorAll(t)).map(t=>{null!==t.querySelector("td.actions div.dropdown-menu")&&t.addEventListener("contextmenu",e=>{let n=e.target;for(;null!==n;){const t=n.tagName.toUpperCase();if("TH"===t||"TABLE"===t||"BODY"===t)return;if("TR"===t)break;n=n.parentNode}if(null===n||!n.matches("table.dataTable tbody tr"))return;const s=n.querySelector("td.actions div.dropdown-menu");if(null===s)return;e.preventDefault();new i(t.dataset.contextMenu).createFromClickEvent(e,s.innerHTML)})})}}},4028:function(t,e,n){n(4975),n(4942),n.g.KimaiPaginatedBoxWidget=n(4100).A,n.g.KimaiReloadPageWidget=n(5170).A,n.g.KimaiColor=n(9997).A,n.g.KimaiStorage=n(5247).A},4100:function(t,e,n){"use strict";n.d(e,{A:function(){return s}});var i=n(2758);class s{constructor(t){this.selector=t;const e=document.querySelector(this.selector);if(void 0!==e.dataset.reload){this.events=e.dataset.reload.split(" ");const t=()=>{let t=null;t=void 0!==document.querySelector(this.selector).dataset.reloadHref?document.querySelector(this.selector).dataset.reloadHref:document.querySelector(this.selector+" ul.pagination li.active a").href,this.loadPage(t)};for(const e of this.events)document.addEventListener(e,t)}document.body.addEventListener("click",t=>{let e=t.target;e.matches(this.selector+" a.pagination-link")||(e=e.parentNode),e.matches(this.selector+" a.pagination-link")&&(t.preventDefault(),this.loadPage(e.href))})}static create(t){return new s(t)}loadPage(t){const e=this.selector;document.dispatchEvent(new CustomEvent("kimai.reloadContent",{detail:this.selector}));const n=()=>{document.dispatchEvent(new Event("kimai.reloadedContent"))};window.kimai.getPlugin("fetch").fetch(t).then(t=>{t.text().then(t=>{const s=document.createElement("div");s.innerHTML=t,document.querySelector(e).replaceWith(this._makeScriptExecutable(s.firstElementChild)),i.A.createForDataTable(e+" table.dataTable"),n()})}).catch(()=>{window.kimai.getPlugin("alert").error("Failed loading selected page"),n()})}_makeScriptExecutable(t){if(void 0!==t.tagName&&"SCRIPT"===t.tagName){const e=document.createElement("script");e.text=t.innerHTML,t.parentNode.replaceChild(e,t)}else for(const e of t.childNodes)this._makeScriptExecutable(e);return t}}},4942:function(t,e,n){"use strict";var i=n(8097);class s{constructor(t){this._translations=t}get(t){return this._translations[t]}has(t){return t in this._translations}}class r{constructor(t){this._configurations=t}get(t){return this._configurations[t]}has(t){return t in this._configurations}isRTL(){return"rtl"===this.get("direction")}getLanguage(){return this.get("locale").replace("_","-")}is24Hours(){return!!this.get("twentyFourHours")}getFirstDayOfWeek(t=!0){void 0===t&&(t=!0);let e=this.get("first_dow_iso");return t||(e%=7),e}}class o{init(){}getId(){return null}setContainer(t){if(!(t instanceof a))throw new Error("Plugin was given an invalid KimaiContainer");this._core=t}getContainer(){return this._core}getConfiguration(t){return this.getContainer().getConfiguration().get(t)}getConfigurations(){return this.getContainer().getConfiguration()}getDateUtils(){return this.getPlugin("date")}getPlugin(t){return this.getContainer().getPlugin(t)}getTranslation(){return this.getContainer().getTranslation()}translate(t){return this.getTranslation().get(t)}escape(t){return this.getPlugin("escape").escapeForHtml(t)}trigger(t,e=null){this.getPlugin("event").trigger(t,e)}fetch(t,e={}){return this.getPlugin("fetch").fetch(t,e)}fetchForm(t,e={},n=null){n=n||t.getAttribute("action");const i=t.getAttribute("method").toUpperCase();if("GET"===i){const i=this.getPlugin("form").convertFormDataToQueryString(t,{},!0);n=n+(n.includes("?")?"&":"?")+i,e={method:"GET",...e}}else"POST"===i&&(e={method:"POST",body:new FormData(t),...e});return this.fetch(n,e)}isMobile(){return Math.max(document.documentElement.clientWidth,window.innerWidth||0)<576}}class a{constructor(t,e){if(!(t instanceof r))throw new Error("Configuration needs to a KimaiConfiguration instance");if(this._configuration=t,!(e instanceof s))throw new Error("Configuration needs to a KimaiTranslation instance");this._translation=e,this._plugins=[]}registerPlugin(t){if(!(t instanceof o))throw new Error("Invalid plugin given, needs to be a KimaiPlugin instance");return t.setContainer(this),this._plugins.push(t),t}getPlugin(t){for(let e of this._plugins)if(null!==e.getId()&&e.getId()===t)return e;throw new Error("Unknown plugin: "+t)}getPlugins(){return this._plugins}getTranslation(){return this._translation}getConfiguration(){return this._configuration}getUser(){return this.getPlugin("user")}}class l extends o{constructor(t){super(),this.dataAttribute=t}getId(){return"datatable-column-visibility"}init(){let t=document.querySelector("["+this.dataAttribute+"]");if(null!==t){this._id=t.getAttribute(this.dataAttribute),this._modal=document.getElementById("modal_"+this._id),this._modal.addEventListener("show.bs.modal",()=>{this._evaluateCheckboxes()}),this._modal.querySelector("button[data-type=save]").addEventListener("click",()=>{this._saveVisibility()}),this._modal.querySelector("button[data-type=reset]").addEventListener("click",t=>{this._resetVisibility(t.currentTarget)}),this._modal.querySelectorAll("input[name=datatable_profile]").forEach(t=>{t.addEventListener("change",()=>{const e=this._modal.getElementsByTagName("form")[0];this.fetchForm(e,{},t.getAttribute("data-href")).then(()=>{localStorage.setItem("kimai_profile",t.getAttribute("value")),document.location.reload()}).catch(()=>{e.setAttribute("action",t.getAttribute("data-href")),e.submit()})})});for(let t of this._modal.querySelectorAll("form input[type=checkbox]"))t.addEventListener("change",()=>{this._changeVisibility(t.getAttribute("name"),t.checked)})}}_evaluateCheckboxes(){const t=this._modal.getElementsByTagName("form")[0],e=document.getElementsByClassName("datatable_"+this._id)[0];for(let n of e.getElementsByTagName("th")){const e=n.getAttribute("data-field");if(null===e)continue;const i=t.querySelector("input[name="+e+"]");null!==i&&(i.checked="none"!==window.getComputedStyle(n).display)}}_saveVisibility(){const t=this._modal.getElementsByTagName("form")[0];this.fetchForm(t).then(()=>{document.location.reload()}).catch(()=>{t.submit()})}_resetVisibility(t){const e=this._modal.getElementsByTagName("form")[0];this.fetchForm(e,{},t.getAttribute("formaction")).then(()=>{document.location.reload()}).catch(()=>{e.setAttribute("action",t.getAttribute("formaction")),e.submit()})}_changeVisibility(t,e){for(const n of document.getElementsByClassName("datatable_"+this._id)){let i=null;for(let s of n.getElementsByClassName("col_"+t)){if(null===i){let t="-none",n="d-table-cell";e||(t="-table-cell",n="d-none"),i="",s.classList.forEach(function(e,n,s){-1===e.indexOf(t)&&(i+=" "+e)}),-1===i.indexOf(n)&&(i+=" "+n)}s.className=i}}}}var c=n(9336);class u extends o{init(){[].slice.call(document.querySelectorAll('[data-toggle="tooltip"]')).map(function(t){return new c.m_(t)});[...document.querySelectorAll(".offcanvas")].map(t=>new c.go(t));this.getContainer().getPlugin("form").activateForm("div.page-wrapper form"),this._registerModalAutofocus("#remote_form_modal"),this.overlay=null,document.addEventListener("kimai.reloadContent",t=>{if(null!==this.overlay)return;let e="div.page-wrapper";void 0!==t.detail&&null!==t.detail&&(e=t.detail);const n=document.createElement("div");n.innerHTML='
',this.overlay=n.firstElementChild,document.querySelector(e).append(this.overlay)}),document.addEventListener("kimai.reloadedContent",()=>{null!==this.overlay&&(this.overlay.remove(),this.overlay=null)})}_registerModalAutofocus(t){if(this.isMobile())return;const e=document.querySelector(t);null!==e&&e.addEventListener("shown.bs.modal",()=>{const t=e.querySelector("form");let n=t.querySelectorAll("[autofocus]");n.length<1&&(n=t.querySelectorAll("input[type=text],input[type=date],textarea,select")),n.length>0&&n[0].focus()})}}var d=n(424);n(8214);class h extends o{supportsForm(t){return!1}activateForm(t){}destroyForm(t){}}class p extends h{constructor(t){super(),this._selector=t}init(){window.disableLitepickerStyles=!0,this._pickers=[]}supportsForm(t){return!0}activateForm(t){const e=this.getConfigurations().getFirstDayOfWeek(!1),n=this.getConfigurations().getLanguage();let i={buttonText:{previousMonth:'',nextMonth:'',apply:this.translate("confirm"),cancel:this.translate("cancel")}};const s=[].slice.call(t.querySelectorAll(this._selector)).map(t=>(void 0===t.dataset.format&&console.log("Trying to bind litepicker to an element without data-format attribute"),void 0!==t.hasAttribute("min")&&(i={...i,minDate:t.getAttribute("min")}),void 0!==t.hasAttribute("max")&&(i={...i,maxDate:t.getAttribute("max")}),i={...i,format:t.dataset.format,showTooltip:!1,element:t,lang:n,autoRefresh:!0,firstDay:e,setup:e=>{e.on("preselect",(t,n)=>{e._wasPreselected=!0}),e.on("selected",(n,i)=>{void 0!==e._wasPreselected&&(t.dispatchEvent(new Event("change",{bubbles:!0})),delete e._wasPreselected)}),void 0!==e.backdrop&&document.body.appendChild(e.backdrop)}},[t,new d.Litepicker(this.prepareOptions(i))]));this._pickers=this._pickers.concat(s)}prepareOptions(t){return{...t,plugins:["mobilefriendly"]}}destroyForm(t){[].slice.call(t.querySelectorAll(this._selector)).map(t=>{for(let e=0;e{this.reloadDatatable()};for(let t of e.split(" "))document.addEventListener(t,n);document.addEventListener("pagination-change",n),document.addEventListener("filter-change",n)}registerContextMenu(t){f.A.createForDataTable(t)}reloadDatatable(){const t=this.getContainer().getPlugin("toolbar").getSelector(),e=document.querySelector(t),n=t=>{const e=document.createElement("div");e.innerHTML=t;const n=e.querySelector(this._contentArea);document.querySelector(this._contentArea).replaceWith(n),this.registerContextMenu(this._selector),document.dispatchEvent(new Event("kimai.reloadedContent"))};document.dispatchEvent(new CustomEvent("kimai.reloadContent",{detail:this._contentArea})),null!==e?this.fetchForm(e).then(t=>{t.text().then(n)}).catch(()=>{e.submit()}):this.fetch(document.location).then(t=>{t.text().then(n)}).catch(()=>{document.location.reload()})}}class v extends o{constructor(t,e){super(),this._formSelector=t,this._actionClass=e}getId(){return"toolbar"}init(){const t=this.getSelector();this._registerPagination(t),this._registerSortableTables(t),this._registerAlternativeSubmitActions(t,this._actionClass),[].slice.call(document.querySelectorAll(t+" input")).map(e=>{e.addEventListener("change",e=>{switch(e.target.id){case"order":case"orderBy":case"page":break;default:document.querySelector(t+" input#page").value=1}}),this.triggerChange()}),[].slice.call(document.querySelectorAll(t+" select")).map(e=>{e.addEventListener("change",e=>{let n=!0;switch(e.target.id){case"customer":null!==document.querySelector(t+" select#project")&&(n=!1);break;case"project":null!==document.querySelector(t+" select#activity")&&(n=!1)}document.querySelector(t+" input#page").value=1,n&&this.triggerChange()})})}_registerAlternativeSubmitActions(t,e){document.addEventListener("click",function(n){let i=n.target;for(;null!==i&&"function"==typeof i.matches&&!i.matches("body");){if(i.classList.contains(e)){const e=document.querySelector(t);if(null===e)return;const s=e.getAttribute("action"),r=e.getAttribute("method");void 0!==i.dataset.target&&(e.target=i.dataset.target),e.action=i.href,void 0!==i.dataset.method&&(e.method=i.dataset.method),e.submit(),e.target="",e.action=s,e.method=r,n.preventDefault(),n.stopPropagation()}i=i.parentNode}})}_registerSortableTables(t){document.body.addEventListener("click",e=>{if(!e.target.matches("th.sortable"))return;let n="DESC",i=e.target.dataset.order;e.target.classList.contains("sorting_desc")&&(n="ASC"),document.querySelector(t+" #orderBy").value=i,document.querySelector(t+" #order").value=n,document.querySelector(t+" #orderBy").dispatchEvent(new Event("change")),document.querySelector(t+" #order").dispatchEvent(new Event("change")),document.dispatchEvent(new Event("filter-change"))})}_registerPagination(t){document.body.addEventListener("click",e=>{if(!(e.target.matches("ul.pagination li a")||null!==e.target.parentNode&&e.target.parentNode.matches("ul.pagination li a")))return;let n=document.querySelector(t+" input#page");if(null===n)return;let i=e.target;i.matches("a")||(i=i.parentNode),e.preventDefault(),e.stopPropagation();let s=i.href.split("/"),r=s[s.length-1];return/\d/.test(r)||(r=1),n.value=r,n.dispatchEvent(new Event("change")),document.dispatchEvent(new Event("pagination-change")),!1})}triggerChange(){document.dispatchEvent(new Event("toolbar-change"))}getSelector(){return this._formSelector}}class y extends o{getId(){return"api"}_headers(){const t=new Headers;return t.append("Content-Type","application/json"),t}get(t,e,n,i){if(void 0!==e){const n=new URLSearchParams(e).toString();""!==n&&(t=t+(t.includes("?")?"&":"?")+n)}void 0===i&&(i=t=>{this.handleError("An error occurred",t)}),this.fetch(t,{method:"GET",headers:this._headers()}).then(t=>{t.json().then(t=>{n(t)})}).catch(t=>{i(t)})}post(t,e,n,i){void 0===i&&(i=t=>{this.handleError("action.update.error",t)}),this.fetch(t,{method:"POST",body:this._parseData(e),headers:this._headers()}).then(t=>{t.json().then(t=>{n(t)})}).catch(t=>{i(t)})}patch(t,e,n,i){void 0===i&&(i=t=>{this.handleError("action.update.error",t)}),this.fetch(t,{method:"PATCH",body:this._parseData(e),headers:this._headers()}).then(t=>{204===t.statusCode?n():t.json().then(t=>{n(t)})}).catch(t=>{i(t)})}delete(t,e,n){void 0===n&&(n=t=>{this.handleError("action.delete.error",t)}),this.fetch(t,{method:"DELETE",headers:this._headers()}).then(()=>{e()}).catch(t=>{n(t)})}_parseData(t){return"object"==typeof t?JSON.stringify(t):t}handleError(t,e){if(void 0===e.headers)return;const n=e.headers.get("content-type");n&&-1!==n.indexOf("application/json")?e.json().then(n=>{let i=n.message;if(400===e.status&&n.errors){let t=[""+i+""];if(n.errors.errors)for(let e of n.errors.errors)t.push(e);if(n.errors.children)for(let e in n.errors.children){let i=n.errors.children[e];if(void 0!==i.errors&&i.errors.length>0)for(let e of i.errors)t.push(e)}t.length>0&&(i=t)}this.getPlugin("alert").error(t,i)}):e.text().then(()=>{const n="["+e.statusCode+"] "+e.statusText;this.getPlugin("alert").error(t,n)})}}class b extends o{addClickHandler(t,e,n){document.body.addEventListener("click",i=>{let s=i.target;for(;null!==s;){const e=s.tagName.toUpperCase();if("BODY"===e)return;if(s.matches(t))break;if("A"===e||"BUTTON"===e||"INPUT"===e||"LABEL"===e)return;for(let t of n)if(s.matches(t))return;s=s.parentNode}if(null===s)return;if(s.isContentEditable||s.parentNode.isContentEditable)return;if(!s.matches(t))return;for(let t of n)if(s.matches(t))return;i.preventDefault(),i.stopPropagation();let r=s.dataset.href;null==r&&(r=s.href),null!=r&&""!==r&&e(r)})}}class _ extends b{constructor(t){super(),this._selector=t}init(){this.addClickHandler(this._selector,function(t){window.location=t},[])}}class w extends b{constructor(t,e){super(),this._selector=t,this._stopSelector=e}getId(){return"modal"}init(){this._isDirty=!1;const t=this._getModalElement();null!==t&&(t.addEventListener("hide.bs.modal",e=>{if(this._isDirty){if(null===t.querySelector(".modal-body .remote_modal_is_dirty_warning")){const e=this.translate("modal.dirty"),n=document.createElement("div");n.innerHTML='

'+e+"

",t.querySelector(".modal-body").prepend(n.firstElementChild)}e.preventDefault()}else this._isDirty=!1,document.dispatchEvent(new Event("modal-hide"))}),t.addEventListener("hidden.bs.modal",()=>{this.getContainer().getPlugin("form").destroyForm(this._getFormIdentifier()),t.querySelector(".modal-body").replaceWith("")}),t.addEventListener("show.bs.modal",()=>{document.dispatchEvent(new Event("modal-show"))}),this.addClickHandler(this._selector,t=>{this.openUrlInModal(t)},this._stopSelector))}_getModal(){return c.aF.getOrCreateInstance(this._getModalElement())}openUrlInModal(t,e){const n=new Headers;n.append("X-Requested-With","Kimai-Modal"),this.fetch(t,{method:"GET",redirect:"follow",headers:n}).then(e=>{if(e.ok)return e.text().then(t=>{this._openFormInModal(t)});window.location=t}).catch(n=>{null==e?window.location=t:e(n)})}_getFormIdentifier(){return"#remote_form_modal .modal-content form"}_getModalElement(){return document.getElementById("remote_form_modal")}_makeScriptExecutable(t){if(void 0!==t.tagName&&"SCRIPT"===t.tagName){const e=document.createElement("script");e.text=t.innerHTML,t.parentNode.replaceChild(e,t)}else for(const e of t.childNodes)this._makeScriptExecutable(e);return t}_openFormInModal(t){const e=this._getFormIdentifier();let n=this._getModalElement();const i=document.createElement("div");i.innerHTML=t;const s=this._makeScriptExecutable(i.querySelector("#form_modal .modal-content"));if(null!==s){let t=n.querySelector(".modal-dialog"),r=i.querySelector(".modal-dialog").classList.contains("modal-lg");r&&!t.classList.contains("modal-lg")&&t.classList.toggle("modal-lg"),!r&&t.classList.contains("modal-lg")&&t.classList.toggle("modal-lg"),n.querySelector(".modal-content").replaceWith(s),[].slice.call(n.querySelectorAll('[data-bs-dismiss="modal"]')).map(t=>{t.addEventListener("click",()=>{this._isDirty=!1,this._getModal().hide()})}),this.getContainer().getPlugin("form").activateForm(e)}let r=i.querySelector("div.alert");null!==r&&n.querySelector(".modal-body").prepend(r);const o=document.querySelector(e);o.addEventListener("change",()=>{this._isDirty=!0}),o.addEventListener("submit",this._getEventHandler()),this._getModal().show()}_getEventHandler(){return void 0===this.eventHandler&&(this.eventHandler=t=>{const e=t.target;if(void 0!==e.target&&""!==e.target)return!0;const n=document.querySelector(this._getFormIdentifier()+" button[type=submit]");n.textContent=n.textContent+" …",n.disabled=!0;const i=e.dataset.formEvent,s=this.getContainer().getPlugin("event");t.preventDefault(),t.stopPropagation();const r=new Headers;r.append("X-Requested-With","Kimai-Modal");const o={headers:r};this.fetchForm(e,o).then(t=>{t.text().then(t=>{const e=document.createElement("div");e.innerHTML=t;let r=!1,o=!1,a=!1;n.textContent=n.textContent.replace(" …",""),n.disabled=!1;const l=e.querySelector("#form_modal .modal-content");null!==l&&(r=null!==l.querySelector(".is-invalid"),r||(r=null!==l.querySelector(".invalid-feedback")),o=null!==l.querySelector("ul.list-unstyled li.text-danger"),a=null!==e.querySelector("div.alert-danger")),r||o||a?this._openFormInModal(t):(s.trigger(i),this._isDirty=!1,this._getModal().hide())})}).catch(t=>{let i=e.dataset.msgError;null!=i&&""!==i||(i="action.update.error");this.getContainer().getPlugin("alert").error(i,t.message),setTimeout(()=>{n.textContent=n.textContent.replace(" …",""),n.disabled=!1},1500)})}),this.eventHandler}}class k extends o{constructor(){super(),this._selector=".ticktac-menu",this._selectorEmpty=".ticktac-menu-empty",this._favIconUrl=null}getId(){return"active-records"}init(){if(null===document.querySelector(this._selector))return;const t=()=>{this.reloadActiveRecords()};document.addEventListener("kimai.timesheetUpdate",t),document.addEventListener("kimai.timesheetDelete",t),document.addEventListener("kimai.activityUpdate",t),document.addEventListener("kimai.activityDelete",t),document.addEventListener("kimai.projectUpdate",t),document.addEventListener("kimai.projectDelete",t),document.addEventListener("kimai.customerUpdate",t),document.addEventListener("kimai.customerDelete",t),this._updateBrowserTitle=!!this.getConfiguration("updateBrowserTitle");const e=()=>{this._updateDuration()};this._updatesHandler=setInterval(e,1e4),document.addEventListener("kimai.timesheetUpdate",e),document.addEventListener("kimai.reloadedContent",e)}_updateDuration(){const t=document.querySelectorAll('[data-since]:not([data-since=""])');if(this._updateBrowserTitle&&this._changeFavicon(t.length>0),0===t.length)return void(this._updateBrowserTitle&&(void 0===document.body.dataset.title?this._updateBrowserTitle=!1:document.title=document.body.dataset.title));const e=this.getDateUtils();let n=[];for(const i of t){const t=e.formatDuration(i.dataset.since);void 0!==i.dataset.replacer&&null!==i.dataset.title&&"?"!==t&&n.push(t),i.textContent=t}0!==n.length&&this._updateBrowserTitle&&(document.title=n.shift())}_setEntries(t){const e=t.length>0;for(let t of document.querySelectorAll(this._selectorEmpty))t.style.display=e?"none":"inline-block";for(let n of document.querySelectorAll(this._selector)){if(n.style.display=e?"inline-block":"none",!e)for(let t of n.querySelectorAll("[data-since]"))t.dataset.since="";const i=n.querySelector(".ticktac-stop");e?(i&&(i.accesskey="s"),this._replaceInNode(n,t[0])):i&&(i.accesskey=null)}this._updateDuration()}_replaceInNode(t,e){const n=this.getDateUtils(),i=t.querySelectorAll("[data-replacer]");for(let s of i){const i=s.dataset.replacer;"url"===i?s.dataset.href=t.dataset.href.replace("000",e.id):"activity"===i?s.innerText=e.activity.name:"project"===i?s.innerText=e.project.name:"customer"===i?s.innerText=e.project.customer.name:"duration"===i&&(s.dataset.since=e.begin,s.innerText=n.formatDuration(e.duration))}}reloadActiveRecords(){const t=this.getContainer().getPlugin("api"),e=document.querySelector(this._selector).dataset.api;t.get(e,{},t=>{this._setEntries(t)})}_changeFavicon(t){const e=document.createElement("canvas"),n=document.getElementById("favicon");null===this._favIconUrl&&(this._favIconUrl=n.href);const i=n.cloneNode(!0);if(e.getContext&&i){const s=window.devicePixelRatio,r=document.createElement("img");e.height=e.width=16*s,r.onload=function(){const r=e.getContext("2d");if(r.drawImage(this,0,0,e.width,e.height),t){const t=5.5*s;r.fillStyle="rgb(182,57,57)",r.fillRect(e.width/2-t/2,e.height/2-t/2,t,t)}i.href=e.toDataURL("image/png"),n.remove(),document.head.appendChild(i)},r.src=this._favIconUrl}}}class T extends o{getId(){return"event"}trigger(t,e=null){if(""!==t)for(const n of t.split(" ")){let t=new Event(n);null!==e&&(t=new CustomEvent(n,{detail:e})),document.dispatchEvent(t)}}}class E extends o{constructor(t){super(),this._selector=t}init(){document.addEventListener("click",t=>{let e=t.target;for(;null!==e&&"function"==typeof e.matches&&!e.matches("body");){if(e.classList.contains(this._selector)){const n=e.dataset;let i=n.href;i||(i=e.getAttribute("href")),void 0!==n.question?this.getContainer().getPlugin("alert").question(n.question,t=>{t&&this._callApi(i,n)}):this._callApi(i,n),t.preventDefault(),t.stopPropagation()}e=e.parentNode}})}_callApi(t,e){const n=e.method,i=e.event,s=this.getContainer().getPlugin("api"),r=this.getContainer().getPlugin("event"),o=this.getContainer().getPlugin("alert"),a=()=>{r.trigger(i),document.dispatchEvent(new CustomEvent("kimai.reloadedContent")),void 0!==e.msgSuccess&&o.success(e.msgSuccess)},l=t=>{let n="action.update.error";void 0!==e.msgError&&(n=e.msgError),document.dispatchEvent(new CustomEvent("kimai.reloadedContent")),s.handleError(n,t)};let c={};if(void 0!==e.payload&&(c=e.payload),document.dispatchEvent(new CustomEvent("kimai.reloadContent")),"PATCH"===n)s.patch(t,c,a,l);else if("POST"===n){let e={};s.post(t,e,a,l)}else"DELETE"===n?s.delete(t,a,l):"GET"===n&&s.get(t,c,a,l)}}class D extends o{getId(){return"alert"}error(t,e){const n=this.getTranslation();n.has(t)&&(t=n.get(t)),t=t.replace("%reason%",""),void 0===e&&(e=null),null!==e&&(n.has(e)&&(e=n.get(e)),Array.isArray(e)&&(e=e.join("
")));const i="alert_global_error",s=document.getElementById(i);null!==s&&c.aF.getOrCreateInstance(s).hide();const r='\n
\n ";this._showModal(r)}warning(t){this._show("warning",t)}success(t){this._toast("success",t)}info(t){this._show("info",t)}_showModal(t){const e=document.body,n=document.createElement("template");n.innerHTML=t.trim();const i=n.content.firstChild;e.appendChild(i);const s=new c.aF(i);i.addEventListener("hidden.bs.modal",function(){e.removeChild(i)}),s.show()}_show(t,e){const n=this.getTranslation();n.has(e)&&(e=n.get(e));const i='\n \n ";this._showModal(i)}_mapClass(t){return"info"===t||"success"===t||"warning"===t||"danger"===t?t:"error"===t?"danger":"primary"}_toast(t,e){const n=this.getTranslation();n.has(e)&&(e=n.get(e));let i='';"success"===t?i='':"warning"===t?i='':"danger"!==t&&"error"!==t||(i='');const s='',r=document.getElementById("toast-container"),o=document.createElement("template");o.innerHTML=s.trim();const a=o.content.firstChild;r.appendChild(a);const l=new c.y8(a);a.addEventListener("hidden.bs.toast",function(){r.removeChild(a)}),l.show()}question(t,e){const n=this.getTranslation();n.has(t)&&(t=n.get(t));const i=this._mapClass("info"),s='\n \n ",r=document.body,o=document.createElement("template");o.innerHTML=s.trim();const a=o.content.firstChild;r.appendChild(a),a.querySelector(".question-confirm").addEventListener("click",()=>{e(!0)}),a.querySelector(".question-cancel").addEventListener("click",()=>{e(!1)});const l=new c.aF(a);a.addEventListener("hidden.bs.modal",()=>{r.removeChild(a)}),l.show()}}function x(t,e){t.split(/\s+/).forEach(t=>{e(t)})}class S{constructor(){this._events={}}on(t,e){x(t,t=>{const n=this._events[t]||[];n.push(e),this._events[t]=n})}off(t,e){var n=arguments.length;0!==n?x(t,t=>{if(1===n)return void delete this._events[t];const i=this._events[t];void 0!==i&&(i.splice(i.indexOf(e),1),this._events[t]=i)}):this._events={}}trigger(t,...e){var n=this;x(t,t=>{const i=n._events[t];void 0!==i&&i.forEach(t=>{t.apply(n,e)})})}}const O=t=>(t=t.filter(Boolean)).length<2?t[0]||"":1==I(t)?"["+t.join("")+"]":"(?:"+t.join("|")+")",L=t=>{if(!M(t))return t.join("");let e="",n=0;const i=()=>{n>1&&(e+="{"+n+"}")};return t.forEach((s,r)=>{s!==t[r-1]?(i(),e+=s,n=1):n++}),i(),e},C=t=>{let e=Array.from(t);return O(e)},M=t=>new Set(t).size!==t.length,A=t=>(t+"").replace(/([\$\(\)\*\+\.\?\[\]\^\{\|\}\\])/gu,"\\$1"),I=t=>t.reduce((t,e)=>Math.max(t,N(e)),0),N=t=>Array.from(t).length,F=t=>{if(1===t.length)return[[t]];let e=[];const n=t.substring(1);return F(n).forEach(function(n){let i=n.slice(0);i[0]=t.charAt(0)+i[0],e.push(i),i=n.slice(0),i.unshift(t.charAt(0)),e.push(i)}),e},P=[[0,65535]];let j,$;const q={},H={"/":"⁄∕",0:"߀",a:"ⱥɐɑ",aa:"ꜳ",ae:"æǽǣ",ao:"ꜵ",au:"ꜷ",av:"ꜹꜻ",ay:"ꜽ",b:"ƀɓƃ",c:"ꜿƈȼↄ",d:"đɗɖᴅƌꮷԁɦ",e:"ɛǝᴇɇ",f:"ꝼƒ",g:"ǥɠꞡᵹꝿɢ",h:"ħⱨⱶɥ",i:"ɨı",j:"ɉȷ",k:"ƙⱪꝁꝃꝅꞣ",l:"łƚɫⱡꝉꝇꞁɭ",m:"ɱɯϻ",n:"ꞥƞɲꞑᴎлԉ",o:"øǿɔɵꝋꝍᴑ",oe:"œ",oi:"ƣ",oo:"ꝏ",ou:"ȣ",p:"ƥᵽꝑꝓꝕρ",q:"ꝗꝙɋ",r:"ɍɽꝛꞧꞃ",s:"ßȿꞩꞅʂ",t:"ŧƭʈⱦꞇ",th:"þ",tz:"ꜩ",u:"ʉ",v:"ʋꝟʌ",vy:"ꝡ",w:"ⱳ",y:"ƴɏỿ",z:"ƶȥɀⱬꝣ",hv:"ƕ"};for(let t in H){let e=H[t]||"";for(let n=0;nt.normalize(e),R=t=>Array.from(t).reduce((t,e)=>t+W(e),""),W=t=>(t=B(t).toLowerCase().replace(V,t=>q[t]||""),B(t,"NFC"));const z=t=>{const e={},n=(t,n)=>{const i=e[t]||new Set,s=new RegExp("^"+C(i)+"$","iu");n.match(s)||(i.add(A(n)),e[t]=i)};for(let e of function*(t){for(const[e,n]of t)for(let t=e;t<=n;t++){let e=String.fromCharCode(t),n=R(e);n!=e.toLowerCase()&&(n.length>3||0!=n.length&&(yield{folded:n,composed:e,code_point:t}))}}(t))n(e.folded,e.folded),n(e.folded,e.composed);return e},U=t=>{const e=z(t),n={};let i=[];for(let t in e){let s=e[t];s&&(n[t]=C(s)),t.length>1&&i.push(A(t))}i.sort((t,e)=>e.length-t.length);const s=O(i);return $=new RegExp("^"+s,"u"),n},Y=(t,e=1)=>(e=Math.max(e,t.length-1),O(F(t).map(t=>((t,e=1)=>{let n=0;return t=t.map(t=>(j[t]&&(n+=t.length),j[t]||t)),n>=e?L(t):""})(t,e)))),Z=(t,e=!0)=>{let n=t.length>1?1:0;return O(t.map(t=>{let i=[];const s=e?t.length():t.length()-1;for(let e=0;e{for(const n of e){if(n.start!=t.start||n.end!=t.end)continue;if(n.substrs.join("")!==t.substrs.join(""))continue;let e=t.parts;const i=t=>{for(const n of e){if(n.start===t.start&&n.substr===t.substr)return!1;if(1!=t.length&&1!=n.length){if(t.startn.start)return!0;if(n.startt.start)return!0}}return!1};if(!(n.parts.filter(i).length>0))return!0}return!1};class J{parts;substrs;start;end;constructor(){this.parts=[],this.substrs=[],this.start=0,this.end=0}add(t){t&&(this.parts.push(t),this.substrs.push(t.substr),this.start=Math.min(t.start,this.start),this.end=Math.max(t.end,this.end))}last(){return this.parts[this.parts.length-1]}length(){return this.parts.length}clone(t,e){let n=new J,i=JSON.parse(JSON.stringify(this.parts)),s=i.pop();for(const t of i)n.add(t);let r=e.substr.substring(0,t-s.start),o=r.length;return n.add({start:s.start,end:s.start+o,length:o,substr:r}),n}}const G=t=>{var e;void 0===j&&(j=U(e||P)),t=R(t);let n="",i=[new J];for(let e=0;e0){a=a.sort((t,e)=>t.length()-e.length());for(let t of a)K(t,i)||i.push(t)}else if(e>0&&1==l.size&&!l.has("3")){n+=Z(i,!1);let t=new J;const e=i[0];e&&t.add(e.last()),i=[t]}}return n+=Z(i,!0),n},Q=(t,e)=>{if(t)return t[e]},X=(t,e)=>{if(t){for(var n,i=e.split(".");(n=i.shift())&&(t=t[n]););return t}},tt=(t,e,n)=>{var i,s;return t?(t+="",null==e.regex||-1===(s=t.search(e.regex))?0:(i=e.string.length/t.length,0===s&&(i+=.5),i*n)):0},et=(t,e)=>{var n=t[e];if("function"==typeof n)return n;n&&!Array.isArray(n)&&(t[e]=[n])},nt=(t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var n in t)t.hasOwnProperty(n)&&e(t[n],n)},it=(t,e)=>"number"==typeof t&&"number"==typeof e?t>e?1:t(e=R(e+"").toLowerCase())?1:e>t?-1:0;class st{items;settings;constructor(t,e){this.items=t,this.settings=e||{diacritics:!0}}tokenize(t,e,n){if(!t||!t.length)return[];const i=[],s=t.split(/\s+/);var r;return n&&(r=new RegExp("^("+Object.keys(n).map(A).join("|")+"):(.*)$")),s.forEach(t=>{let n,s=null,o=null;r&&(n=t.match(r))&&(s=n[1],t=n[2]),t.length>0&&(o=this.settings.diacritics?G(t)||null:A(t),o&&e&&(o="\\b"+o)),i.push({string:t,regex:o?new RegExp(o,"iu"):null,field:s})}),i}getScoreFunction(t,e){var n=this.prepareSearch(t,e);return this._getScoreFunction(n)}_getScoreFunction(t){const e=t.tokens,n=e.length;if(!n)return function(){return 0};const i=t.options.fields,s=t.weights,r=i.length,o=t.getAttrFn;if(!r)return function(){return 1};const a=1===r?function(t,e){const n=i[0].field;return tt(o(e,n),t,s[n]||1)}:function(t,e){var n=0;if(t.field){const i=o(e,t.field);!t.regex&&i?n+=1/r:n+=tt(i,t,1)}else nt(s,(i,s)=>{n+=tt(o(e,s),t,i)});return n/r};return 1===n?function(t){return a(e[0],t)}:"and"===t.options.conjunction?function(t){var i,s=0;for(let n of e){if((i=a(n,t))<=0)return 0;s+=i}return s/n}:function(t){var i=0;return nt(e,e=>{i+=a(e,t)}),i/n}}getSortFunction(t,e){var n=this.prepareSearch(t,e);return this._getSortFunction(n)}_getSortFunction(t){var e,n=[];const i=this,s=t.options,r=!t.query&&s.sort_empty?s.sort_empty:s.sort;if("function"==typeof r)return r.bind(this);const o=function(e,n){return"$score"===e?n.score:t.getAttrFn(i.items[n.id],e)};if(r)for(let e of r)(t.query||"$score"!==e.field)&&n.push(e);if(t.query){e=!0;for(let t of n)if("$score"===t.field){e=!1;break}e&&n.unshift({field:"$score",direction:"desc"})}else n=n.filter(t=>"$score"!==t.field);return n.length?function(t,e){var i,s;for(let r of n){if(s=r.field,i=("desc"===r.direction?-1:1)*it(o(s,t),o(s,e)))return i}return 0}:null}prepareSearch(t,e){const n={};var i=Object.assign({},e);if(et(i,"sort"),et(i,"sort_empty"),i.fields){et(i,"fields");const t=[];i.fields.forEach(e=>{"string"==typeof e&&(e={field:e,weight:1}),t.push(e),n[e.field]="weight"in e?e.weight:1}),i.fields=t}return{options:i,query:t.toLowerCase().trim(),tokens:this.tokenize(t,i.respect_word_boundaries,n),total:0,items:[],weights:n,getAttrFn:i.nesting?X:Q}}search(t,e){var n,i,s=this;i=this.prepareSearch(t,e),e=i.options,t=i.query;const r=e.score||s._getScoreFunction(i);t.length?nt(s.items,(t,s)=>{n=r(t),(!1===e.filter||n>0)&&i.items.push({score:n,id:s})}):nt(s.items,(t,e)=>{i.items.push({score:1,id:e})});const o=s._getSortFunction(i);return o&&i.items.sort(o),i.total=i.items.length,"number"==typeof e.limit&&(i.items=i.items.slice(0,e.limit)),i}}const rt=t=>null==t?null:ot(t),ot=t=>"boolean"==typeof t?t?"1":"0":t+"",at=t=>(t+"").replace(/&/g,"&").replace(//g,">").replace(/"/g,"""),lt=(t,e)=>{var n;return function(i,s){var r=this;n&&(r.loading=Math.max(r.loading-1,0),clearTimeout(n)),n=setTimeout(function(){n=null,r.loadedSearches[i]=!0,t.call(r,i,s)},e)}},ct=(t,e,n)=>{var i,s=t.trigger,r={};for(i of(t.trigger=function(){var n=arguments[0];if(-1===e.indexOf(n))return s.apply(t,arguments);r[n]=arguments},n.apply(t,[]),t.trigger=s,e))i in r&&s.apply(t,r[i])},ut=(t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())},dt=(t,e,n,i)=>{t.addEventListener(e,n,i)},ht=(t,e)=>!!e&&(!!e[t]&&1===(e.altKey?1:0)+(e.ctrlKey?1:0)+(e.shiftKey?1:0)+(e.metaKey?1:0)),pt=(t,e)=>{const n=t.getAttribute("id");return n||(t.setAttribute("id",e),e)},mt=t=>t.replace(/[\\"']/g,"\\$&"),ft=(t,e)=>{e&&t.append(e)},gt=(t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var n in t)t.hasOwnProperty(n)&&e(t[n],n)},vt=t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(yt(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)},yt=t=>"string"==typeof t&&t.indexOf("<")>-1,bt=(t,e)=>{var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!1),t.dispatchEvent(n)},_t=(t,e)=>{Object.assign(t.style,e)},wt=(t,...e)=>{var n=Tt(e);(t=Et(t)).map(t=>{n.map(e=>{t.classList.add(e)})})},kt=(t,...e)=>{var n=Tt(e);(t=Et(t)).map(t=>{n.map(e=>{t.classList.remove(e)})})},Tt=t=>{var e=[];return gt(t,t=>{"string"==typeof t&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},Et=t=>(Array.isArray(t)||(t=[t]),t),Dt=(t,e,n)=>{if(!n||n.contains(t))for(;t&&t.matches;){if(t.matches(e))return t;t=t.parentNode}},xt=(t,e=0)=>e>0?t[t.length-1]:t[0],St=(t,e)=>{if(!t)return-1;e=e||t.nodeName;for(var n=0;t=t.previousElementSibling;)t.matches(e)&&n++;return n},Ot=(t,e)=>{gt(e,(e,n)=>{null==e?t.removeAttribute(n):t.setAttribute(n,""+e)})},Lt=(t,e)=>{t.parentNode&&t.parentNode.replaceChild(e,t)},Ct=(t,e)=>{if(null===e)return;if("string"==typeof e){if(!e.length)return;e=new RegExp(e,"i")}const n=t=>3===t.nodeType?(t=>{var n=t.data.match(e);if(n&&t.data.length>0){var i=document.createElement("span");i.className="highlight";var s=t.splitText(n.index);s.splitText(n[0].length);var r=s.cloneNode(!0);return i.appendChild(r),Lt(s,i),1}return 0})(t):((t=>{1!==t.nodeType||!t.childNodes||/(script|style)/i.test(t.tagName)||"highlight"===t.className&&"SPAN"===t.tagName||Array.from(t.childNodes).forEach(t=>{n(t)})})(t),0);n(t)},Mt="undefined"!=typeof navigator&&/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey";var At={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:null,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,shouldOpen:null,maxOptions:50,maxItems:null,hideSelected:null,duplicates:!1,addPrecedence:!1,selectOnTab:!1,preload:null,allowEmptyOption:!1,refreshThrottle:300,loadThrottle:300,loadingClass:"loading",dataAttr:null,optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"ts-wrapper",controlClass:"ts-control",dropdownClass:"ts-dropdown",dropdownContentClass:"ts-dropdown-content",itemClass:"item",optionClass:"option",dropdownParent:null,controlInput:'',copyClassesToDropdown:!1,placeholder:null,hidePlaceholder:null,shouldLoad:function(t){return t.length>0},render:{}};function It(t,e){var n=Object.assign({},At,e),i=n.dataAttr,s=n.labelField,r=n.valueField,o=n.disabledField,a=n.optgroupField,l=n.optgroupLabelField,c=n.optgroupValueField,u=t.tagName.toLowerCase(),d=t.getAttribute("placeholder")||t.getAttribute("data-placeholder");if(!d&&!n.allowEmptyOption){let e=t.querySelector('option[value=""]');e&&(d=e.textContent)}var h={placeholder:d,options:[],optgroups:[],items:[],maxItems:null};return"select"===u?(()=>{var e,u=h.options,d={},p=1;let m=0;var f=t=>{var e=Object.assign({},t.dataset),n=i&&e[i];return"string"==typeof n&&n.length&&(e=Object.assign(e,JSON.parse(n))),e},g=(t,e)=>{var i=rt(t.value);if(null!=i&&(i||n.allowEmptyOption)){if(d.hasOwnProperty(i)){if(e){var l=d[i][a];l?Array.isArray(l)?l.push(e):d[i][a]=[l,e]:d[i][a]=e}}else{var c=f(t);c[s]=c[s]||t.textContent,c[r]=c[r]||i,c[o]=c[o]||t.disabled,c[a]=c[a]||e,c.$option=t,c.$order=c.$order||++m,d[i]=c,u.push(c)}t.selected&&h.items.push(i)}};h.maxItems=t.hasAttribute("multiple")?null:1,gt(t.children,t=>{var n,i,s;"optgroup"===(e=t.tagName.toLowerCase())?((s=f(n=t))[l]=s[l]||n.getAttribute("label")||"",s[c]=s[c]||p++,s[o]=s[o]||n.disabled,s.$order=s.$order||++m,h.optgroups.push(s),i=s[c],gt(n.children,t=>{g(t,i)})):"option"===e&&g(t)})})():(()=>{const e=t.getAttribute(i);if(e)h.options=JSON.parse(e),gt(h.options,t=>{h.items.push(t[r])});else{var o=t.value.trim()||"";if(!n.allowEmptyOption&&!o.length)return;const e=o.split(n.delimiter);gt(e,t=>{const e={};e[s]=t,e[r]=t,h.options.push(e)}),h.items=e}})(),Object.assign({},At,h,e)}var Nt=0;class Ft extends(function(t){return t.plugins={},class extends t{constructor(){super(...arguments),this.plugins={names:[],settings:{},requested:{},loaded:{}}}static define(e,n){t.plugins[e]={name:e,fn:n}}initializePlugins(t){var e,n;const i=this,s=[];if(Array.isArray(t))t.forEach(t=>{"string"==typeof t?s.push(t):(i.plugins.settings[t.name]=t.options,s.push(t.name))});else if(t)for(e in t)t.hasOwnProperty(e)&&(i.plugins.settings[e]=t[e],s.push(e));for(;n=s.shift();)i.require(n)}loadPlugin(e){var n=this,i=n.plugins,s=t.plugins[e];if(!t.plugins.hasOwnProperty(e))throw new Error('Unable to find "'+e+'" plugin');i.requested[e]=!0,i.loaded[e]=s.fn.apply(n,[n.plugins.settings[e]||{}]),i.names.push(e)}require(t){var e=this,n=e.plugins;if(!e.plugins.loaded.hasOwnProperty(t)){if(n.requested[t])throw new Error('Plugin has circular dependency ("'+t+'")');e.loadPlugin(t)}return n.loaded[t]}}}(S)){constructor(t,e){var n;super(),this.order=0,this.isOpen=!1,this.isDisabled=!1,this.isReadOnly=!1,this.isInvalid=!1,this.isValid=!0,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.ignoreHover=!1,this.hasOptions=!1,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],this.refreshTimeout=null,Nt++;var i=vt(t);if(i.tomselect)throw new Error("Tom Select already initialized on this element");i.tomselect=this,n=(window.getComputedStyle&&window.getComputedStyle(i,null)).getPropertyValue("direction");const s=It(i,e);this.settings=s,this.input=i,this.tabIndex=i.tabIndex||0,this.is_select_tag="select"===i.tagName.toLowerCase(),this.rtl=/rtl/i.test(n),this.inputId=pt(i,"tomselect-"+Nt),this.isRequired=i.required,this.sifter=new st(this.options,{diacritics:s.diacritics}),s.mode=s.mode||(1===s.maxItems?"single":"multi"),"boolean"!=typeof s.hideSelected&&(s.hideSelected="multi"===s.mode),"boolean"!=typeof s.hidePlaceholder&&(s.hidePlaceholder="multi"!==s.mode);var r=s.createFilter;"function"!=typeof r&&("string"==typeof r&&(r=new RegExp(r)),r instanceof RegExp?s.createFilter=t=>r.test(t):s.createFilter=t=>this.settings.duplicates||!this.options[t]),this.initializePlugins(s.plugins),this.setupCallbacks(),this.setupTemplates();const o=vt("
"),a=vt("
"),l=this._render("dropdown"),c=vt('
'),u=this.input.getAttribute("class")||"",d=s.mode;var h;if(wt(o,s.wrapperClass,u,d),wt(a,s.controlClass),ft(o,a),wt(l,s.dropdownClass,d),s.copyClassesToDropdown&&wt(l,u),wt(c,s.dropdownContentClass),ft(l,c),vt(s.dropdownParent||o).appendChild(l),yt(s.controlInput)){h=vt(s.controlInput);gt(["autocorrect","autocapitalize","autocomplete","spellcheck"],t=>{i.getAttribute(t)&&Ot(h,{[t]:i.getAttribute(t)})}),h.tabIndex=-1,a.appendChild(h),this.focus_node=h}else s.controlInput?(h=vt(s.controlInput),this.focus_node=h):(h=vt(""),this.focus_node=a);this.wrapper=o,this.dropdown=l,this.dropdown_content=c,this.control=a,this.control_input=h,this.setup()}setup(){const t=this,e=t.settings,n=t.control_input,i=t.dropdown,s=t.dropdown_content,r=t.wrapper,o=t.control,a=t.input,l=t.focus_node,c={passive:!0},u=t.inputId+"-ts-dropdown";Ot(s,{id:u}),Ot(l,{role:"combobox","aria-haspopup":"listbox","aria-expanded":"false","aria-controls":u});const d=pt(l,t.inputId+"-ts-control"),h="label[for='"+(t=>t.replace(/['"\\]/g,"\\$&"))(t.inputId)+"']",p=document.querySelector(h),m=t.focus.bind(t);if(p){dt(p,"click",m),Ot(p,{for:d});const e=pt(p,t.inputId+"-ts-label");Ot(l,{"aria-labelledby":e}),Ot(s,{"aria-labelledby":e})}if(r.style.width=a.style.width,t.plugins.names.length){const e="plugin-"+t.plugins.names.join(" plugin-");wt([r,i],e)}(null===e.maxItems||e.maxItems>1)&&t.is_select_tag&&Ot(a,{multiple:"multiple"}),e.placeholder&&Ot(n,{placeholder:e.placeholder}),!e.splitOn&&e.delimiter&&(e.splitOn=new RegExp("\\s*"+A(e.delimiter)+"+\\s*")),e.load&&e.loadThrottle&&(e.load=lt(e.load,e.loadThrottle)),dt(i,"mousemove",()=>{t.ignoreHover=!1}),dt(i,"mouseenter",e=>{var n=Dt(e.target,"[data-selectable]",i);n&&t.onOptionHover(e,n)},{capture:!0}),dt(i,"click",e=>{const n=Dt(e.target,"[data-selectable]");n&&(t.onOptionSelect(e,n),ut(e,!0))}),dt(o,"click",e=>{var i=Dt(e.target,"[data-ts-item]",o);i&&t.onItemSelect(e,i)?ut(e,!0):""==n.value&&(t.onClick(),ut(e,!0))}),dt(l,"keydown",e=>t.onKeyDown(e)),dt(n,"keypress",e=>t.onKeyPress(e)),dt(n,"input",e=>t.onInput(e)),dt(l,"blur",e=>t.onBlur(e)),dt(l,"focus",e=>t.onFocus(e)),dt(n,"paste",e=>t.onPaste(e));const f=e=>{const s=e.composedPath()[0];if(!r.contains(s)&&!i.contains(s))return t.isFocused&&t.blur(),void t.inputState();s==n&&t.isOpen?e.stopPropagation():ut(e,!0)},g=()=>{t.isOpen&&t.positionDropdown()};dt(document,"mousedown",f),dt(window,"scroll",g,c),dt(window,"resize",g,c),this._destroy=()=>{document.removeEventListener("mousedown",f),window.removeEventListener("scroll",g),window.removeEventListener("resize",g),p&&p.removeEventListener("click",m)},this.revertSettings={innerHTML:a.innerHTML,tabIndex:a.tabIndex},a.tabIndex=-1,a.insertAdjacentElement("afterend",t.wrapper),t.sync(!1),e.items=[],delete e.optgroups,delete e.options,dt(a,"invalid",()=>{t.isValid&&(t.isValid=!1,t.isInvalid=!0,t.refreshState())}),t.updateOriginalInput(),t.refreshItems(),t.close(!1),t.inputState(),t.isSetup=!0,a.disabled?t.disable():a.readOnly?t.setReadOnly(!0):t.enable(),t.on("change",this.onChange),wt(a,"tomselected","ts-hidden-accessible"),t.trigger("initialize"),!0===e.preload&&t.preload()}setupOptions(t=[],e=[]){this.addOptions(t),gt(e,t=>{this.registerOptionGroup(t)})}setupTemplates(){var t=this,e=t.settings.labelField,n=t.settings.optgroupLabelField,i={optgroup:t=>{let e=document.createElement("div");return e.className="optgroup",e.appendChild(t.options),e},optgroup_header:(t,e)=>'
'+e(t[n])+"
",option:(t,n)=>"
"+n(t[e])+"
",item:(t,n)=>"
"+n(t[e])+"
",option_create:(t,e)=>'
Add '+e(t.input)+"
",no_results:()=>'
No results found
',loading:()=>'
',not_loading:()=>{},dropdown:()=>"
"};t.settings.render=Object.assign({},i,t.settings.render)}setupCallbacks(){var t,e,n={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",item_select:"onItemSelect",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(t in n)(e=this.settings[n[t]])&&this.on(t,e)}sync(t=!0){const e=this,n=t?It(e.input,{delimiter:e.settings.delimiter}):e.settings;e.setupOptions(n.options,n.optgroups),e.setValue(n.items||[],!0),e.lastQuery=null}onClick(){var t=this;if(t.activeItems.length>0)return t.clearActiveItems(),void t.focus();t.isFocused&&t.isOpen?t.blur():t.focus()}onMouseDown(){}onChange(){bt(this.input,"input"),bt(this.input,"change")}onPaste(t){var e=this;e.isInputHidden||e.isLocked?ut(t):e.settings.splitOn&&setTimeout(()=>{var t=e.inputValue();if(t.match(e.settings.splitOn)){var n=t.trim().split(e.settings.splitOn);gt(n,t=>{rt(t)&&(this.options[t]?e.addItem(t):e.createItem(t))})}},0)}onKeyPress(t){var e=this;if(!e.isLocked){var n=String.fromCharCode(t.keyCode||t.which);return e.settings.create&&"multi"===e.settings.mode&&n===e.settings.delimiter?(e.createItem(),void ut(t)):void 0}ut(t)}onKeyDown(t){var e=this;if(e.ignoreHover=!0,e.isLocked)9!==t.keyCode&&ut(t);else{switch(t.keyCode){case 65:if(ht(Mt,t)&&""==e.control_input.value)return ut(t),void e.selectAll();break;case 27:return e.isOpen&&(ut(t,!0),e.close()),void e.clearActiveItems();case 40:if(!e.isOpen&&e.hasOptions)e.open();else if(e.activeOption){let t=e.getAdjacent(e.activeOption,1);t&&e.setActiveOption(t)}return void ut(t);case 38:if(e.activeOption){let t=e.getAdjacent(e.activeOption,-1);t&&e.setActiveOption(t)}return void ut(t);case 13:return void(e.canSelect(e.activeOption)?(e.onOptionSelect(t,e.activeOption),ut(t)):(e.settings.create&&e.createItem()||document.activeElement==e.control_input&&e.isOpen)&&ut(t));case 37:return void e.advanceSelection(-1,t);case 39:return void e.advanceSelection(1,t);case 9:return void(e.settings.selectOnTab&&(e.canSelect(e.activeOption)&&(e.onOptionSelect(t,e.activeOption),ut(t)),e.settings.create&&e.createItem()&&ut(t)));case 8:case 46:return void e.deleteSelection(t)}e.isInputHidden&&!ht(Mt,t)&&ut(t)}}onInput(t){if(this.isLocked)return;const e=this.inputValue();this.lastValue!==e&&(this.lastValue=e,""!=e?(this.refreshTimeout&&window.clearTimeout(this.refreshTimeout),this.refreshTimeout=((t,e)=>e>0?window.setTimeout(t,e):(t.call(null),null))(()=>{this.refreshTimeout=null,this._onInput()},this.settings.refreshThrottle)):this._onInput())}_onInput(){const t=this.lastValue;this.settings.shouldLoad.call(this,t)&&this.load(t),this.refreshOptions(),this.trigger("type",t)}onOptionHover(t,e){this.ignoreHover||this.setActiveOption(e,!1)}onFocus(t){var e=this,n=e.isFocused;if(e.isDisabled||e.isReadOnly)return e.blur(),void ut(t);e.ignoreFocus||(e.isFocused=!0,"focus"===e.settings.preload&&e.preload(),n||e.trigger("focus"),e.activeItems.length||(e.inputState(),e.refreshOptions(!!e.settings.openOnFocus)),e.refreshState())}onBlur(t){if(!1!==document.hasFocus()){var e=this;if(e.isFocused){e.isFocused=!1,e.ignoreFocus=!1;var n=()=>{e.close(),e.setActiveItem(),e.setCaret(e.items.length),e.trigger("blur")};e.settings.create&&e.settings.createOnBlur?e.createItem(null,n):n()}}}onOptionSelect(t,e){var n,i=this;e.parentElement&&e.parentElement.matches("[data-disabled]")||(e.classList.contains("create")?i.createItem(null,()=>{i.settings.closeAfterSelect&&i.close()}):void 0!==(n=e.dataset.value)&&(i.lastQuery=null,i.addItem(n),i.settings.closeAfterSelect&&i.close(),!i.settings.hideSelected&&t.type&&/click/.test(t.type)&&i.setActiveOption(e)))}canSelect(t){return!!(this.isOpen&&t&&this.dropdown_content.contains(t))}onItemSelect(t,e){var n=this;return!n.isLocked&&"multi"===n.settings.mode&&(ut(t),n.setActiveItem(e,t),!0)}canLoad(t){return!!this.settings.load&&!this.loadedSearches.hasOwnProperty(t)}load(t){const e=this;if(!e.canLoad(t))return;wt(e.wrapper,e.settings.loadingClass),e.loading++;const n=e.loadCallback.bind(e);e.settings.load.call(e,t,n)}loadCallback(t,e){const n=this;n.loading=Math.max(n.loading-1,0),n.lastQuery=null,n.clearActiveOption(),n.setupOptions(t,e),n.refreshOptions(n.isFocused&&!n.isInputHidden),n.loading||kt(n.wrapper,n.settings.loadingClass),n.trigger("load",t,e)}preload(){var t=this.wrapper.classList;t.contains("preloaded")||(t.add("preloaded"),this.load(""))}setTextboxValue(t=""){var e=this.control_input;e.value!==t&&(e.value=t,bt(e,"update"),this.lastValue=t)}getValue(){return this.is_select_tag&&this.input.hasAttribute("multiple")?this.items:this.items.join(this.settings.delimiter)}setValue(t,e){ct(this,e?[]:["change"],()=>{this.clear(e),this.addItems(t,e)})}setMaxItems(t){0===t&&(t=null),this.settings.maxItems=t,this.refreshState()}setActiveItem(t,e){var n,i,s,r,o,a,l=this;if("single"!==l.settings.mode){if(!t)return l.clearActiveItems(),void(l.isFocused&&l.inputState());if("click"===(n=e&&e.type.toLowerCase())&&ht("shiftKey",e)&&l.activeItems.length){for(a=l.getLastActive(),(s=Array.prototype.indexOf.call(l.control.children,a))>(r=Array.prototype.indexOf.call(l.control.children,t))&&(o=s,s=r,r=o),i=s;i<=r;i++)t=l.control.children[i],-1===l.activeItems.indexOf(t)&&l.setActiveItemClass(t);ut(e)}else"click"===n&&ht(Mt,e)||"keydown"===n&&ht("shiftKey",e)?t.classList.contains("active")?l.removeActiveItem(t):l.setActiveItemClass(t):(l.clearActiveItems(),l.setActiveItemClass(t));l.inputState(),l.isFocused||l.focus()}}setActiveItemClass(t){const e=this,n=e.control.querySelector(".last-active");n&&kt(n,"last-active"),wt(t,"active last-active"),e.trigger("item_select",t),-1==e.activeItems.indexOf(t)&&e.activeItems.push(t)}removeActiveItem(t){var e=this.activeItems.indexOf(t);this.activeItems.splice(e,1),kt(t,"active")}clearActiveItems(){kt(this.activeItems,"active"),this.activeItems=[]}setActiveOption(t,e=!0){t!==this.activeOption&&(this.clearActiveOption(),t&&(this.activeOption=t,Ot(this.focus_node,{"aria-activedescendant":t.getAttribute("id")}),Ot(t,{"aria-selected":"true"}),wt(t,"active"),e&&this.scrollToOption(t)))}scrollToOption(t,e){if(!t)return;const n=this.dropdown_content,i=n.clientHeight,s=n.scrollTop||0,r=t.offsetHeight,o=t.getBoundingClientRect().top-n.getBoundingClientRect().top+s;o+r>i+s?this.scroll(o-i+r,e):o{t.setActiveItemClass(e)}))}inputState(){var t=this;t.control.contains(t.control_input)&&(Ot(t.control_input,{placeholder:t.settings.placeholder}),t.activeItems.length>0||!t.isFocused&&t.settings.hidePlaceholder&&t.items.length>0?(t.setTextboxValue(),t.isInputHidden=!0):(t.settings.hidePlaceholder&&t.items.length>0&&Ot(t.control_input,{placeholder:""}),t.isInputHidden=!1),t.wrapper.classList.toggle("input-hidden",t.isInputHidden))}inputValue(){return this.control_input.value.trim()}focus(){var t=this;t.isDisabled||t.isReadOnly||(t.ignoreFocus=!0,t.control_input.offsetWidth?t.control_input.focus():t.focus_node.focus(),setTimeout(()=>{t.ignoreFocus=!1,t.onFocus()},0))}blur(){this.focus_node.blur(),this.onBlur()}getScoreFunction(t){return this.sifter.getScoreFunction(t,this.getSearchOptions())}getSearchOptions(){var t=this.settings,e=t.sortField;return"string"==typeof t.sortField&&(e=[{field:t.sortField}]),{fields:t.searchField,conjunction:t.searchConjunction,sort:e,nesting:t.nesting}}search(t){var e,n,i=this,s=this.getSearchOptions();if(i.settings.score&&"function"!=typeof(n=i.settings.score.call(i,t)))throw new Error('Tom Select "score" setting must be a function that returns a function');return t!==i.lastQuery?(i.lastQuery=t,e=i.sifter.search(t,Object.assign(s,{score:n})),i.currentResults=e):e=Object.assign({},i.currentResults),i.settings.hideSelected&&(e.items=e.items.filter(t=>{let e=rt(t.id);return!(e&&-1!==i.items.indexOf(e))})),e}refreshOptions(t=!0){var e,n,i,s,r,o,a,l,c,u;const d={},h=[];var p=this,m=p.inputValue();const f=m===p.lastQuery||""==m&&null==p.lastQuery;var g=p.search(m),v=null,y=p.settings.shouldOpen||!1,b=p.dropdown_content;f&&(v=p.activeOption)&&(c=v.closest("[data-group]")),s=g.items.length,"number"==typeof p.settings.maxOptions&&(s=Math.min(s,p.settings.maxOptions)),s>0&&(y=!0);const _=(t,e)=>{let n=d[t];if(void 0!==n){let t=h[n];if(void 0!==t)return[n,t.fragment]}let i=document.createDocumentFragment();return n=h.length,h.push({fragment:i,order:e,optgroup:t}),[n,i]};for(e=0;e0&&(u=u.cloneNode(!0),Ot(u,{id:a.$id+"-clone-"+n,"aria-selected":null}),u.classList.add("ts-cloned"),kt(u,"active"),p.activeOption&&p.activeOption.dataset.value==s&&c&&c.dataset.group===r.toString()&&(v=u)),l.appendChild(u),""!=r&&(d[r]=i)}}var w;p.settings.lockOptgroupOrder&&h.sort((t,e)=>t.order-e.order),a=document.createDocumentFragment(),gt(h,t=>{let e=t.fragment,n=t.optgroup;if(!e||!e.children.length)return;let i=p.optgroups[n];if(void 0!==i){let t=document.createDocumentFragment(),n=p.render("optgroup_header",i);ft(t,n),ft(t,e);let s=p.render("optgroup",{group:i,options:t});ft(a,s)}else ft(a,e)}),b.innerHTML="",ft(b,a),p.settings.highlight&&(w=b.querySelectorAll("span.highlight"),Array.prototype.forEach.call(w,function(t){var e=t.parentNode;e.replaceChild(t.firstChild,t),e.normalize()}),g.query.length&&g.tokens.length&>(g.tokens,t=>{Ct(b,t.regex)}));var k=t=>{let e=p.render(t,{input:m});return e&&(y=!0,b.insertBefore(e,b.firstChild)),e};if(p.loading?k("loading"):p.settings.shouldLoad.call(p,m)?0===g.items.length&&k("no_results"):k("not_loading"),(l=p.canCreate(m))&&(u=k("option_create")),p.hasOptions=g.items.length>0||l,y){if(g.items.length>0){if(v||"single"!==p.settings.mode||null==p.items[0]||(v=p.getOption(p.items[0])),!b.contains(v)){let t=0;u&&!p.settings.addPrecedence&&(t=1),v=p.selectable()[t]}}else u&&(v=u);t&&!p.isOpen&&(p.open(),p.scrollToOption(v,"auto")),p.setActiveOption(v)}else p.clearActiveOption(),t&&p.isOpen&&p.close(!1)}selectable(){return this.dropdown_content.querySelectorAll("[data-selectable]")}addOption(t,e=!1){const n=this;if(Array.isArray(t))return n.addOptions(t,e),!1;const i=rt(t[n.settings.valueField]);return null!==i&&!n.options.hasOwnProperty(i)&&(t.$order=t.$order||++n.order,t.$id=n.inputId+"-opt-"+t.$order,n.options[i]=t,n.lastQuery=null,e&&(n.userOptions[i]=e,n.trigger("option_add",i,t)),i)}addOptions(t,e=!1){gt(t,t=>{this.addOption(t,e)})}registerOption(t){return this.addOption(t)}registerOptionGroup(t){var e=rt(t[this.settings.optgroupValueField]);return null!==e&&(t.$order=t.$order||++this.order,this.optgroups[e]=t,e)}addOptionGroup(t,e){var n;e[this.settings.optgroupValueField]=t,(n=this.registerOptionGroup(e))&&this.trigger("optgroup_add",n,e)}removeOptionGroup(t){this.optgroups.hasOwnProperty(t)&&(delete this.optgroups[t],this.clearCache(),this.trigger("optgroup_remove",t))}clearOptionGroups(){this.optgroups={},this.clearCache(),this.trigger("optgroup_clear")}updateOption(t,e){const n=this;var i,s;const r=rt(t),o=rt(e[n.settings.valueField]);if(null===r)return;const a=n.options[r];if(null==a)return;if("string"!=typeof o)throw new Error("Value must be set in option data");const l=n.getOption(r),c=n.getItem(r);if(e.$order=e.$order||a.$order,delete n.options[r],n.uncacheValue(o),n.options[o]=e,l){if(n.dropdown_content.contains(l)){const t=n._render("option",e);Lt(l,t),n.activeOption===l&&n.setActiveOption(t)}l.remove()}c&&(-1!==(s=n.items.indexOf(r))&&n.items.splice(s,1,o),i=n._render("item",e),c.classList.contains("active")&&wt(i,"active"),Lt(c,i)),n.lastQuery=null}removeOption(t,e){const n=this;t=ot(t),n.uncacheValue(t),delete n.userOptions[t],delete n.options[t],n.lastQuery=null,n.trigger("option_remove",t),n.removeItem(t,e)}clearOptions(t){const e=(t||this.clearFilter).bind(this);this.loadedSearches={},this.userOptions={},this.clearCache();const n={};gt(this.options,(t,i)=>{e(t,i)&&(n[i]=t)}),this.options=this.sifter.items=n,this.lastQuery=null,this.trigger("option_clear")}clearFilter(t,e){return this.items.indexOf(e)>=0}getOption(t,e=!1){const n=rt(t);if(null===n)return null;const i=this.options[n];if(null!=i){if(i.$div)return i.$div;if(e)return this._render("option",i)}return null}getAdjacent(t,e,n="option"){var i;if(!t)return null;i="item"==n?this.controlChildren():this.dropdown_content.querySelectorAll("[data-selectable]");for(let n=0;n0?i[n+1]:i[n-1];return null}getItem(t){if("object"==typeof t)return t;var e=rt(t);return null!==e?this.control.querySelector(`[data-value="${mt(e)}"]`):null}addItems(t,e){var n=this,i=Array.isArray(t)?t:[t];const s=(i=i.filter(t=>-1===n.items.indexOf(t)))[i.length-1];i.forEach(t=>{n.isPending=t!==s,n.addItem(t,e)})}addItem(t,e){ct(this,e?[]:["change","dropdown_close"],()=>{var n,i;const s=this,r=s.settings.mode,o=rt(t);if((!o||-1===s.items.indexOf(o)||("single"===r&&s.close(),"single"!==r&&s.settings.duplicates))&&null!==o&&s.options.hasOwnProperty(o)&&("single"===r&&s.clear(e),"multi"!==r||!s.isFull())){if(n=s._render("item",s.options[o]),s.control.contains(n)&&(n=n.cloneNode(!0)),i=s.isFull(),s.items.splice(s.caretPos,0,o),s.insertAtCaret(n),s.isSetup){if(!s.isPending&&s.settings.hideSelected){let t=s.getOption(o),e=s.getAdjacent(t,1);e&&s.setActiveOption(e)}s.isPending||s.settings.closeAfterSelect||s.refreshOptions(s.isFocused&&"single"!==r),0!=s.settings.closeAfterSelect&&s.isFull()?s.close():s.isPending||s.positionDropdown(),s.trigger("item_add",o,n),s.isPending||s.updateOriginalInput({silent:e})}(!s.isPending||!i&&s.isFull())&&(s.inputState(),s.refreshState())}})}removeItem(t=null,e){const n=this;if(!(t=n.getItem(t)))return;var i,s;const r=t.dataset.value;i=St(t),t.remove(),t.classList.contains("active")&&(s=n.activeItems.indexOf(t),n.activeItems.splice(s,1),kt(t,"active")),n.items.splice(i,1),n.lastQuery=null,!n.settings.persist&&n.userOptions.hasOwnProperty(r)&&n.removeOption(r,e),i{}){3===arguments.length&&(e=arguments[2]),"function"!=typeof e&&(e=()=>{});var n,i=this,s=i.caretPos;if(t=t||i.inputValue(),!i.canCreate(t))return e(),!1;i.lock();var r=!1,o=t=>{if(i.unlock(),!t||"object"!=typeof t)return e();var n=rt(t[i.settings.valueField]);if("string"!=typeof n)return e();i.setTextboxValue(),i.addOption(t,!0),i.setCaret(s),i.addItem(n),e(t),r=!0};return n="function"==typeof i.settings.create?i.settings.create.call(this,t,o):{[i.settings.labelField]:t,[i.settings.valueField]:t},r||o(n),!0}refreshItems(){var t=this;t.lastQuery=null,t.isSetup&&t.addItems(t.items),t.updateOriginalInput(),t.refreshState()}refreshState(){const t=this;t.refreshValidityState();const e=t.isFull(),n=t.isLocked;t.wrapper.classList.toggle("rtl",t.rtl);const i=t.wrapper.classList;var s;i.toggle("focus",t.isFocused),i.toggle("disabled",t.isDisabled),i.toggle("readonly",t.isReadOnly),i.toggle("required",t.isRequired),i.toggle("invalid",!t.isValid),i.toggle("locked",n),i.toggle("full",e),i.toggle("input-active",t.isFocused&&!t.isInputHidden),i.toggle("dropdown-active",t.isOpen),i.toggle("has-options",(s=t.options,0===Object.keys(s).length)),i.toggle("has-items",t.items.length>0)}refreshValidityState(){var t=this;t.input.validity&&(t.isValid=t.input.validity.valid,t.isInvalid=!t.isValid)}isFull(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems}updateOriginalInput(t={}){const e=this;var n,i;const s=e.input.querySelector('option[value=""]');if(e.is_select_tag){const r=[],o=e.input.querySelectorAll("option:checked").length;function a(t,n,i){return t||(t=vt('")),t!=s&&e.input.append(t),r.push(t),(t!=s||o>0)&&(t.selected=!0),t}e.input.querySelectorAll("option:checked").forEach(t=>{t.selected=!1}),0==e.items.length&&"single"==e.settings.mode?a(s,"",""):e.items.forEach(t=>{if(n=e.options[t],i=n[e.settings.labelField]||"",r.includes(n.$option)){a(e.input.querySelector(`option[value="${mt(t)}"]:not(:checked)`),t,i)}else n.$option=a(n.$option,t,i)})}else e.input.value=e.getValue();e.isSetup&&(t.silent||e.trigger("change",e.getValue()))}open(){var t=this;t.isLocked||t.isOpen||"multi"===t.settings.mode&&t.isFull()||(t.isOpen=!0,Ot(t.focus_node,{"aria-expanded":"true"}),t.refreshState(),_t(t.dropdown,{visibility:"hidden",display:"block"}),t.positionDropdown(),_t(t.dropdown,{visibility:"visible",display:"block"}),t.focus(),t.trigger("dropdown_open",t.dropdown))}close(t=!0){var e=this,n=e.isOpen;t&&(e.setTextboxValue(),"single"===e.settings.mode&&e.items.length&&e.inputState()),e.isOpen=!1,Ot(e.focus_node,{"aria-expanded":"false"}),_t(e.dropdown,{display:"none"}),e.settings.hideSelected&&e.clearActiveOption(),e.refreshState(),n&&e.trigger("dropdown_close",e.dropdown)}positionDropdown(){if("body"===this.settings.dropdownParent){var t=this.control,e=t.getBoundingClientRect(),n=t.offsetHeight+e.top+window.scrollY,i=e.left+window.scrollX;_t(this.dropdown,{width:e.width+"px",top:n+"px",left:i+"px"})}}clear(t){var e=this;if(e.items.length){var n=e.controlChildren();gt(n,t=>{e.removeItem(t,!0)}),e.inputState(),t||e.updateOriginalInput(),e.trigger("clear")}}insertAtCaret(t){const e=this,n=e.caretPos,i=e.control;i.insertBefore(t,i.children[n]||null),e.setCaret(n+1)}deleteSelection(t){var e,n,i,s,r,o=this;e=t&&8===t.keyCode?-1:1,n={start:(r=o.control_input).selectionStart||0,length:(r.selectionEnd||0)-(r.selectionStart||0)};const a=[];if(o.activeItems.length)s=xt(o.activeItems,e),i=St(s),e>0&&i++,gt(o.activeItems,t=>a.push(t));else if((o.isFocused||"single"===o.settings.mode)&&o.items.length){const t=o.controlChildren();let i;e<0&&0===n.start&&0===n.length?i=t[o.caretPos-1]:e>0&&n.start===o.inputValue().length&&(i=t[o.caretPos]),void 0!==i&&a.push(i)}if(!o.shouldDelete(a,t))return!1;for(ut(t,!0),void 0!==i&&o.setCaret(i);a.length;)o.removeItem(a.pop());return o.inputState(),o.positionDropdown(),o.refreshOptions(!1),!0}shouldDelete(t,e){const n=t.map(t=>t.dataset.value);return!(!n.length||"function"==typeof this.settings.onDelete&&!1===this.settings.onDelete(n,e))}advanceSelection(t,e){var n,i,s=this;s.rtl&&(t*=-1),s.inputValue().length||(ht(Mt,e)||ht("shiftKey",e)?(i=(n=s.getLastActive(t))?n.classList.contains("active")?s.getAdjacent(n,t,"item"):n:t>0?s.control_input.nextElementSibling:s.control_input.previousElementSibling)&&(i.classList.contains("active")&&s.removeActiveItem(n),s.setActiveItemClass(i)):s.moveCaret(t))}moveCaret(t){}getLastActive(t){let e=this.control.querySelector(".last-active");if(e)return e;var n=this.control.querySelectorAll(".active");return n?xt(n,t):void 0}setCaret(t){this.caretPos=this.items.length}controlChildren(){return Array.from(this.control.querySelectorAll("[data-ts-item]"))}lock(){this.setLocked(!0)}unlock(){this.setLocked(!1)}setLocked(t=this.isReadOnly||this.isDisabled){this.isLocked=t,this.refreshState()}disable(){this.setDisabled(!0),this.close()}enable(){this.setDisabled(!1)}setDisabled(t){this.focus_node.tabIndex=t?-1:this.tabIndex,this.isDisabled=t,this.input.disabled=t,this.control_input.disabled=t,this.setLocked()}setReadOnly(t){this.isReadOnly=t,this.input.readOnly=t,this.control_input.readOnly=t,this.setLocked()}destroy(){var t=this,e=t.revertSettings;t.trigger("destroy"),t.off(),t.wrapper.remove(),t.dropdown.remove(),t.input.innerHTML=e.innerHTML,t.input.tabIndex=e.tabIndex,kt(t.input,"tomselected","ts-hidden-accessible"),t._destroy(),delete t.input.tomselect}render(t,e){var n,i;const s=this;if("function"!=typeof this.settings.render[t])return null;if(!(i=s.settings.render[t].call(this,e,at)))return null;if(i=vt(i),"option"===t||"option_create"===t?e[s.settings.disabledField]?Ot(i,{"aria-disabled":"true"}):Ot(i,{"data-selectable":""}):"optgroup"===t&&(n=e.group[s.settings.optgroupValueField],Ot(i,{"data-group":n}),e.group[s.settings.disabledField]&&Ot(i,{"data-disabled":""})),"option"===t||"item"===t){const n=ot(e[s.settings.valueField]);Ot(i,{"data-value":n}),"item"===t?(wt(i,s.settings.itemClass),Ot(i,{"data-ts-item":""})):(wt(i,s.settings.optionClass),Ot(i,{role:"option",id:e.$id}),e.$div=i,s.options[n]=e)}return i}_render(t,e){const n=this.render(t,e);if(null==n)throw"HTMLElement expected";return n}clearCache(){gt(this.options,t=>{t.$div&&(t.$div.remove(),delete t.$div)})}uncacheValue(t){const e=this.getOption(t);e&&e.remove()}canCreate(t){return this.settings.create&&t.length>0&&this.settings.createFilter.call(this,t)}hook(t,e,n){var i=this,s=i[e];i[e]=function(){var e,r;return"after"===t&&(e=s.apply(i,arguments)),r=n.apply(i,arguments),"instead"===t?r:("before"===t&&(e=s.apply(i,arguments)),e)}}}const Pt=t=>"boolean"==typeof t?t?"1":"0":t+"",jt=(t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())},$t=t=>"string"==typeof t&&t.indexOf("<")>-1;const qt=t=>"string"==typeof t&&t.indexOf("<")>-1;const Ht=(t,e,n,i)=>{t.addEventListener(e,n,i)},Vt=t=>"string"==typeof t&&t.indexOf("<")>-1,Bt=(t,e)=>{((t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var n in t)t.hasOwnProperty(n)&&e(t[n],n)})(e,(e,n)=>{null==e?t.removeAttribute(n):t.setAttribute(n,""+e)})};const Rt=t=>"string"==typeof t&&t.indexOf("<")>-1;const Wt=t=>{var e=[];return((t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var n in t)t.hasOwnProperty(n)&&e(t[n],n)})(t,t=>{"string"==typeof t&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},zt=t=>(Array.isArray(t)||(t=[t]),t);const Ut=t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(Yt(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)},Yt=t=>"string"==typeof t&&t.indexOf("<")>-1,Zt=t=>{var e=[];return((t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var n in t)t.hasOwnProperty(n)&&e(t[n],n)})(t,t=>{"string"==typeof t&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},Kt=t=>(Array.isArray(t)||(t=[t]),t);const Jt=(t,e,n,i)=>{t.addEventListener(e,n,i)};const Gt=(t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())},Qt=(t,e,n,i)=>{t.addEventListener(e,n,i)},Xt=t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(te(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)},te=t=>"string"==typeof t&&t.indexOf("<")>-1;const ee=t=>{var e=[];return((t,e)=>{if(Array.isArray(t))t.forEach(e);else for(var n in t)t.hasOwnProperty(n)&&e(t[n],n)})(t,t=>{"string"==typeof t&&(t=t.trim().split(/[\t\n\f\r\s]/)),Array.isArray(t)&&(e=e.concat(t))}),e.filter(Boolean)},ne=t=>(Array.isArray(t)||(t=[t]),t);Ft.define("change_listener",function(){var t,e,n,i;t=this.input,e="change",n=()=>{this.sync()},t.addEventListener(e,n,i)}),Ft.define("checkbox_options",function(t){var e=this,n=e.onOptionSelect;e.settings.hideSelected=!1;const i=Object.assign({className:"tomselect-checkbox",checkedClassNames:void 0,uncheckedClassNames:void 0},t);var s=function(t,e){e?(t.checked=!0,i.uncheckedClassNames&&t.classList.remove(...i.uncheckedClassNames),i.checkedClassNames&&t.classList.add(...i.checkedClassNames)):(t.checked=!1,i.checkedClassNames&&t.classList.remove(...i.checkedClassNames),i.uncheckedClassNames&&t.classList.add(...i.uncheckedClassNames))},r=function(t){setTimeout(()=>{var e=t.querySelector("input."+i.className);e instanceof HTMLInputElement&&s(e,t.classList.contains("selected"))},1)};e.hook("after","setupTemplates",()=>{var t=e.settings.render.option;e.settings.render.option=(n,r)=>{var o=(t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if($t(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)})(t.call(e,n,r)),a=document.createElement("input");i.className&&a.classList.add(i.className),a.addEventListener("click",function(t){jt(t)}),a.type="checkbox";const l=null==(c=n[e.settings.valueField])?null:Pt(c);var c;return s(a,!!(l&&e.items.indexOf(l)>-1)),o.prepend(a),o}}),e.on("item_remove",t=>{var n=e.getOption(t);n&&(n.classList.remove("selected"),r(n))}),e.on("item_add",t=>{var n=e.getOption(t);n&&r(n)}),e.hook("instead","onOptionSelect",(t,i)=>{if(i.classList.contains("selected"))return i.classList.remove("selected"),e.removeItem(i.dataset.value),e.refreshOptions(),void jt(t,!0);n.call(e,t,i),r(i)})}),Ft.define("clear_button",function(t){const e=this,n=Object.assign({className:"clear-button",title:"Clear All",html:t=>`
`},t);e.on("initialize",()=>{var t=(t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(qt(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)})(n.html(n));t.addEventListener("click",t=>{e.isLocked||(e.clear(),"single"===e.settings.mode&&e.settings.allowEmptyOption&&e.addItem(""),t.preventDefault(),t.stopPropagation())}),e.control.appendChild(t)})}),Ft.define("drag_drop",function(){var t=this;if("multi"!==t.settings.mode)return;var e=t.lock,n=t.unlock;let i,s=!0;t.hook("after","setupTemplates",()=>{var e=t.settings.render.item;t.settings.render.item=(n,r)=>{const o=(t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(Vt(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)})(e.call(t,n,r));Bt(o,{draggable:"true"});const a=t=>{t.preventDefault(),o.classList.add("ts-drag-over"),l(o,i)},l=(t,e)=>{var n,i,s;void 0!==e&&(((t,e)=>{do{var n;if(t==(e=null==(n=e)?void 0:n.previousElementSibling))return!0}while(e&&e.previousElementSibling);return!1})(e,o)?(i=e,null==(s=(n=t).parentNode)||s.insertBefore(i,n.nextSibling)):((t,e)=>{var n;null==(n=t.parentNode)||n.insertBefore(e,t)})(t,e))};return Ht(o,"mousedown",t=>{s||((t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())})(t),t.stopPropagation()}),Ht(o,"dragstart",t=>{i=o,setTimeout(()=>{o.classList.add("ts-dragging")},0)}),Ht(o,"dragenter",a),Ht(o,"dragover",a),Ht(o,"dragleave",()=>{o.classList.remove("ts-drag-over")}),Ht(o,"dragend",()=>{var e;document.querySelectorAll(".ts-drag-over").forEach(t=>t.classList.remove("ts-drag-over")),null==(e=i)||e.classList.remove("ts-dragging"),i=void 0;var n=[];t.control.querySelectorAll("[data-value]").forEach(t=>{if(t.dataset.value){let e=t.dataset.value;e&&n.push(e)}}),t.setValue(n)}),o}}),t.hook("instead","lock",()=>(s=!1,e.call(t))),t.hook("instead","unlock",()=>(s=!0,n.call(t)))}),Ft.define("dropdown_header",function(t){const e=this,n=Object.assign({title:"Untitled",headerClass:"dropdown-header",titleRowClass:"dropdown-header-title",labelClass:"dropdown-header-label",closeClass:"dropdown-header-close",html:t=>'
'+t.title+'×
'},t);e.on("initialize",()=>{var t=(t=>{if(t.jquery)return t[0];if(t instanceof HTMLElement)return t;if(Rt(t)){var e=document.createElement("template");return e.innerHTML=t.trim(),e.content.firstChild}return document.querySelector(t)})(n.html(n)),i=t.querySelector("."+n.closeClass);i&&i.addEventListener("click",t=>{((t,e=!1)=>{t&&(t.preventDefault(),e&&t.stopPropagation())})(t,!0),e.close()}),e.dropdown.insertBefore(t,e.dropdown.firstChild)})}),Ft.define("caret_position",function(){var t=this;t.hook("instead","setCaret",e=>{"single"!==t.settings.mode&&t.control.contains(t.control_input)?(e=Math.max(0,Math.min(t.items.length,e)))==t.caretPos||t.isPending||t.controlChildren().forEach((n,i)=>{i{if(!t.isFocused)return;const n=t.getLastActive(e);if(n){const i=((t,e)=>{if(!t)return-1;e=e||t.nodeName;for(var n=0;t=t.previousElementSibling;)t.matches(e)&&n++;return n})(n);t.setCaret(e>0?i+1:i),t.setActiveItem(),((t,...e)=>{var n=Wt(e);(t=zt(t)).map(t=>{n.map(e=>{t.classList.remove(e)})})})(n,"last-active")}else t.setCaret(t.caretPos+e)})}),Ft.define("dropdown_input",function(){const t=this;t.settings.shouldOpen=!0,t.hook("before","setup",()=>{t.focus_node=t.control,((t,...e)=>{var n=Zt(e);(t=Kt(t)).map(t=>{n.map(e=>{t.classList.add(e)})})})(t.control_input,"dropdown-input");const e=Ut('");for(var D=1;D<=7;D+=1){var S=3+this.options.firstDay+D,x=document.createElement("div");x.innerHTML=this.weekdayName(S),x.title=this.weekdayName(S,"long"),E.appendChild(x)}var O=document.createElement("div");O.className=a.containerDays;var L=this.calcSkipDays(i);this.options.showWeekNumbers&&L&&O.appendChild(this.renderWeekNumber(i));for(var C=0;C1&&1===this.datePicked.length){var s=this.options.minDays-1,r=this.datePicked[0].clone().subtract(s,"day"),c=this.datePicked[0].clone().add(s,"day");e.isBetween(r,this.datePicked[0],"(]")&&t.classList.add(a.isLocked),e.isBetween(this.datePicked[0],c,"[)")&&t.classList.add(a.isLocked)}if(this.options.maxDays&&1===this.datePicked.length){var u=this.options.maxDays;r=this.datePicked[0].clone().subtract(u,"day"),c=this.datePicked[0].clone().add(u,"day"),e.isSameOrBefore(r)&&t.classList.add(a.isLocked),e.isSameOrAfter(c)&&t.classList.add(a.isLocked)}return this.options.selectForward&&1===this.datePicked.length&&e.isBefore(this.datePicked[0])&&t.classList.add(a.isLocked),this.options.selectBackward&&1===this.datePicked.length&&e.isAfter(this.datePicked[0])&&t.classList.add(a.isLocked),l.dateIsLocked(e,this.options,this.datePicked)&&t.classList.add(a.isLocked),this.options.highlightedDays.length&&this.options.highlightedDays.filter(function(t){return t instanceof Array?e.isBetween(t[0],t[1],"[]"):t.isSame(e,"day")}).length&&t.classList.add(a.isHighlighted),t.tabIndex=t.classList.contains("is-locked")?-1:0,this.emit("render:day",t,e),t},t.prototype.renderFooter=function(){var e=document.createElement("div");if(e.className=a.containerFooter,this.options.footerHTML?e.innerHTML=this.options.footerHTML:e.innerHTML='\n \n \n \n ",this.options.singleMode){if(1===this.datePicked.length){var t=this.datePicked[0].format(this.options.format,this.options.lang);e.querySelector("."+a.previewDateRange).innerHTML=t}}else if(1===this.datePicked.length&&e.querySelector("."+a.buttonApply).setAttribute("disabled",""),2===this.datePicked.length){t=this.datePicked[0].format(this.options.format,this.options.lang);var n=this.datePicked[1].format(this.options.format,this.options.lang);e.querySelector("."+a.previewDateRange).innerHTML=""+t+this.options.delimiter+n}return this.emit("render:footer",e),e},t.prototype.renderWeekNumber=function(e){var t=document.createElement("div"),n=e.getWeek(this.options.firstDay);return t.className=a.weekNumber,t.innerHTML=53===n&&0===e.getMonth()?"53 / 1":n,t},t.prototype.renderTooltip=function(){var e=document.createElement("div");return e.className=a.containerTooltip,e},t.prototype.weekdayName=function(e,t){return void 0===t&&(t="short"),new Date(1970,0,e,12,0,0,0).toLocaleString(this.options.lang,{weekday:t})},t.prototype.calcSkipDays=function(e){var t=e.getDay()-this.options.firstDay;return t<0&&(t+=7),t},t}(r.LPCore);t.Calendar=c},function(e,t,n){"use strict";var i,s=this&&this.__extends||(i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,i=arguments.length;n',nextMonth:'',reset:'\n \n \n '},tooltipText:{one:"day",other:"days"}},n.options=r(r({},n.options),t.element.dataset),Object.keys(n.options).forEach(function(e){"true"!==n.options[e]&&"false"!==n.options[e]||(n.options[e]="true"===n.options[e])});var i=r(r({},n.options.dropdowns),t.dropdowns),s=r(r({},n.options.buttonText),t.buttonText),o=r(r({},n.options.tooltipText),t.tooltipText);n.options=r(r({},n.options),t),n.options.dropdowns=r({},i),n.options.buttonText=r({},s),n.options.tooltipText=r({},o),n.options.elementEnd||(n.options.allowRepick=!1),n.options.lockDays.length&&(n.options.lockDays=a.DateTime.convertArray(n.options.lockDays,n.options.lockDaysFormat)),n.options.highlightedDays.length&&(n.options.highlightedDays=a.DateTime.convertArray(n.options.highlightedDays,n.options.highlightedDaysFormat));var l=n.parseInput(),c=l[0],u=l[1];n.options.startDate&&(n.options.singleMode||n.options.endDate)&&(c=new a.DateTime(n.options.startDate,n.options.format,n.options.lang)),c&&n.options.endDate&&(u=new a.DateTime(n.options.endDate,n.options.format,n.options.lang)),c instanceof a.DateTime&&!isNaN(c.getTime())&&(n.options.startDate=c),n.options.startDate&&u instanceof a.DateTime&&!isNaN(u.getTime())&&(n.options.endDate=u),!n.options.singleMode||n.options.startDate instanceof a.DateTime||(n.options.startDate=null),n.options.singleMode||n.options.startDate instanceof a.DateTime&&n.options.endDate instanceof a.DateTime||(n.options.startDate=null,n.options.endDate=null);for(var d=0;dwindow.innerHeight,c=t.top+r-n.height>=n.height;l&&c&&(o=t.top+r-n.height)}if(/left|right/.test(i[0])||i[1]&&"auto"!==i[1]&&/left|right/.test(i[1]))a=/left|right/.test(i[0])?t[i[0]]+s:t[i[1]]+s,"right"!==i[0]&&"right"!==i[1]||(a-=n.width);else{a=t.left+s,l=t.left+n.width>window.innerWidth;var u=t.right+s-n.width>=0;l&&u&&(a=t.right+s-n.width)}return{left:a,top:o}},t}(o.EventEmitter);t.LPCore=c},function(e,t,n){"use strict";var i,s="object"==typeof Reflect?Reflect:null,r=s&&"function"==typeof s.apply?s.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};i=s&&"function"==typeof s.ownKeys?s.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var l=10;function c(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function u(e,t,n,i){var s,r,o,a;if("function"!=typeof n)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n);if(void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),r=e._events),o=r[t]),void 0===o)o=r[t]=n,++e._eventsCount;else if("function"==typeof o?o=r[t]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(s=c(e))>0&&o.length>s&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,a=l,console&&console.warn&&console.warn(a)}return e}function d(){for(var e=[],t=0;t0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(void 0===l)return!1;if("function"==typeof l)r(l,this,t);else{var c=l.length,u=f(l,c);for(n=0;n=0;r--)if(n[r]===t||n[r].listener===t){o=n[r].listener,s=r;break}if(s<0)return this;0===s?n.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},a.prototype.listeners=function(e){return p(this,e,!0)},a.prototype.rawListeners=function(e){return p(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(e,t,n){(t=n(9)(!1)).push([e.i,':root{--litepicker-container-months-color-bg: #fff;--litepicker-container-months-box-shadow-color: #ddd;--litepicker-footer-color-bg: #fafafa;--litepicker-footer-box-shadow-color: #ddd;--litepicker-tooltip-color-bg: #fff;--litepicker-month-header-color: #333;--litepicker-button-prev-month-color: #9e9e9e;--litepicker-button-next-month-color: #9e9e9e;--litepicker-button-prev-month-color-hover: #2196f3;--litepicker-button-next-month-color-hover: #2196f3;--litepicker-month-width: calc(var(--litepicker-day-width) * 7);--litepicker-month-weekday-color: #9e9e9e;--litepicker-month-week-number-color: #9e9e9e;--litepicker-day-width: 38px;--litepicker-day-color: #333;--litepicker-day-color-hover: #2196f3;--litepicker-is-today-color: #f44336;--litepicker-is-in-range-color: #bbdefb;--litepicker-is-locked-color: #9e9e9e;--litepicker-is-start-color: #fff;--litepicker-is-start-color-bg: #2196f3;--litepicker-is-end-color: #fff;--litepicker-is-end-color-bg: #2196f3;--litepicker-button-cancel-color: #fff;--litepicker-button-cancel-color-bg: #9e9e9e;--litepicker-button-apply-color: #fff;--litepicker-button-apply-color-bg: #2196f3;--litepicker-button-reset-color: #909090;--litepicker-button-reset-color-hover: #2196f3;--litepicker-highlighted-day-color: #333;--litepicker-highlighted-day-color-bg: #ffeb3b}.show-week-numbers{--litepicker-month-width: calc(var(--litepicker-day-width) * 8)}.litepicker{font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;font-size:0.8em;display:none}.litepicker button{border:none;background:none}.litepicker .container__main{display:-webkit-box;display:-ms-flexbox;display:flex}.litepicker .container__months{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;background-color:var(--litepicker-container-months-color-bg);border-radius:5px;-webkit-box-shadow:0 0 5px var(--litepicker-container-months-box-shadow-color);box-shadow:0 0 5px var(--litepicker-container-months-box-shadow-color);width:calc(var(--litepicker-month-width) + 10px);-webkit-box-sizing:content-box;box-sizing:content-box}.litepicker .container__months.columns-2{width:calc((var(--litepicker-month-width) * 2) + 20px)}.litepicker .container__months.columns-3{width:calc((var(--litepicker-month-width) * 3) + 30px)}.litepicker .container__months.columns-4{width:calc((var(--litepicker-month-width) * 4) + 40px)}.litepicker .container__months.split-view .month-item-header .button-previous-month,.litepicker .container__months.split-view .month-item-header .button-next-month{visibility:visible}.litepicker .container__months .month-item{padding:5px;width:var(--litepicker-month-width);-webkit-box-sizing:content-box;box-sizing:content-box}.litepicker .container__months .month-item-header{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;font-weight:500;padding:10px 5px;text-align:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:var(--litepicker-month-header-color)}.litepicker .container__months .month-item-header div{-webkit-box-flex:1;-ms-flex:1;flex:1}.litepicker .container__months .month-item-header div>.month-item-name{margin-right:5px}.litepicker .container__months .month-item-header div>.month-item-year{padding:0}.litepicker .container__months .month-item-header .reset-button{color:var(--litepicker-button-reset-color)}.litepicker .container__months .month-item-header .reset-button>svg{fill:var(--litepicker-button-reset-color)}.litepicker .container__months .month-item-header .reset-button *{pointer-events:none}.litepicker .container__months .month-item-header .reset-button:hover{color:var(--litepicker-button-reset-color-hover)}.litepicker .container__months .month-item-header .reset-button:hover>svg{fill:var(--litepicker-button-reset-color-hover)}.litepicker .container__months .month-item-header .button-previous-month,.litepicker .container__months .month-item-header .button-next-month{visibility:hidden;text-decoration:none;padding:3px 5px;border-radius:3px;-webkit-transition:color 0.3s, border 0.3s;transition:color 0.3s, border 0.3s;cursor:default}.litepicker .container__months .month-item-header .button-previous-month *,.litepicker .container__months .month-item-header .button-next-month *{pointer-events:none}.litepicker .container__months .month-item-header .button-previous-month{color:var(--litepicker-button-prev-month-color)}.litepicker .container__months .month-item-header .button-previous-month>svg,.litepicker .container__months .month-item-header .button-previous-month>img{fill:var(--litepicker-button-prev-month-color)}.litepicker .container__months .month-item-header .button-previous-month:hover{color:var(--litepicker-button-prev-month-color-hover)}.litepicker .container__months .month-item-header .button-previous-month:hover>svg{fill:var(--litepicker-button-prev-month-color-hover)}.litepicker .container__months .month-item-header .button-next-month{color:var(--litepicker-button-next-month-color)}.litepicker .container__months .month-item-header .button-next-month>svg,.litepicker .container__months .month-item-header .button-next-month>img{fill:var(--litepicker-button-next-month-color)}.litepicker .container__months .month-item-header .button-next-month:hover{color:var(--litepicker-button-next-month-color-hover)}.litepicker .container__months .month-item-header .button-next-month:hover>svg{fill:var(--litepicker-button-next-month-color-hover)}.litepicker .container__months .month-item-weekdays-row{display:-webkit-box;display:-ms-flexbox;display:flex;justify-self:center;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;color:var(--litepicker-month-weekday-color)}.litepicker .container__months .month-item-weekdays-row>div{padding:5px 0;font-size:85%;-webkit-box-flex:1;-ms-flex:1;flex:1;width:var(--litepicker-day-width);text-align:center}.litepicker .container__months .month-item:first-child .button-previous-month{visibility:visible}.litepicker .container__months .month-item:last-child .button-next-month{visibility:visible}.litepicker .container__months .month-item.no-previous-month .button-previous-month{visibility:hidden}.litepicker .container__months .month-item.no-next-month .button-next-month{visibility:hidden}.litepicker .container__days{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;justify-self:center;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;text-align:center;-webkit-box-sizing:content-box;box-sizing:content-box}.litepicker .container__days>div,.litepicker .container__days>a{padding:5px 0;width:var(--litepicker-day-width)}.litepicker .container__days .day-item{color:var(--litepicker-day-color);text-align:center;text-decoration:none;border-radius:3px;-webkit-transition:color 0.3s, border 0.3s;transition:color 0.3s, border 0.3s;cursor:default}.litepicker .container__days .day-item:hover{color:var(--litepicker-day-color-hover);-webkit-box-shadow:inset 0 0 0 1px var(--litepicker-day-color-hover);box-shadow:inset 0 0 0 1px var(--litepicker-day-color-hover)}.litepicker .container__days .day-item.is-today{color:var(--litepicker-is-today-color)}.litepicker .container__days .day-item.is-locked{color:var(--litepicker-is-locked-color)}.litepicker .container__days .day-item.is-locked:hover{color:var(--litepicker-is-locked-color);-webkit-box-shadow:none;box-shadow:none;cursor:default}.litepicker .container__days .day-item.is-in-range{background-color:var(--litepicker-is-in-range-color);border-radius:0}.litepicker .container__days .day-item.is-start-date{color:var(--litepicker-is-start-color);background-color:var(--litepicker-is-start-color-bg);border-top-left-radius:5px;border-bottom-left-radius:5px;border-top-right-radius:0;border-bottom-right-radius:0}.litepicker .container__days .day-item.is-start-date.is-flipped{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:5px;border-bottom-right-radius:5px}.litepicker .container__days .day-item.is-end-date{color:var(--litepicker-is-end-color);background-color:var(--litepicker-is-end-color-bg);border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:5px;border-bottom-right-radius:5px}.litepicker .container__days .day-item.is-end-date.is-flipped{border-top-left-radius:5px;border-bottom-left-radius:5px;border-top-right-radius:0;border-bottom-right-radius:0}.litepicker .container__days .day-item.is-start-date.is-end-date{border-top-left-radius:5px;border-bottom-left-radius:5px;border-top-right-radius:5px;border-bottom-right-radius:5px}.litepicker .container__days .day-item.is-highlighted{color:var(--litepicker-highlighted-day-color);background-color:var(--litepicker-highlighted-day-color-bg)}.litepicker .container__days .week-number{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;color:var(--litepicker-month-week-number-color);font-size:85%}.litepicker .container__footer{text-align:right;padding:10px 5px;margin:0 5px;background-color:var(--litepicker-footer-color-bg);-webkit-box-shadow:inset 0px 3px 3px 0px var(--litepicker-footer-box-shadow-color);box-shadow:inset 0px 3px 3px 0px var(--litepicker-footer-box-shadow-color);border-bottom-left-radius:5px;border-bottom-right-radius:5px}.litepicker .container__footer .preview-date-range{margin-right:10px;font-size:90%}.litepicker .container__footer .button-cancel{background-color:var(--litepicker-button-cancel-color-bg);color:var(--litepicker-button-cancel-color);border:0;padding:3px 7px 4px;border-radius:3px}.litepicker .container__footer .button-cancel *{pointer-events:none}.litepicker .container__footer .button-apply{background-color:var(--litepicker-button-apply-color-bg);color:var(--litepicker-button-apply-color);border:0;padding:3px 7px 4px;border-radius:3px;margin-left:10px;margin-right:10px}.litepicker .container__footer .button-apply:disabled{opacity:0.7}.litepicker .container__footer .button-apply *{pointer-events:none}.litepicker .container__tooltip{position:absolute;margin-top:-4px;padding:4px 8px;border-radius:4px;background-color:var(--litepicker-tooltip-color-bg);-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.25);box-shadow:0 1px 3px rgba(0,0,0,0.25);white-space:nowrap;font-size:11px;pointer-events:none;visibility:hidden}.litepicker .container__tooltip:before{position:absolute;bottom:-5px;left:calc(50% - 5px);border-top:5px solid rgba(0,0,0,0.12);border-right:5px solid transparent;border-left:5px solid transparent;content:""}.litepicker .container__tooltip:after{position:absolute;bottom:-4px;left:calc(50% - 4px);border-top:4px solid var(--litepicker-tooltip-color-bg);border-right:4px solid transparent;border-left:4px solid transparent;content:""}\n',""]),t.locals={showWeekNumbers:"show-week-numbers",litepicker:"litepicker",containerMain:"container__main",containerMonths:"container__months",columns2:"columns-2",columns3:"columns-3",columns4:"columns-4",splitView:"split-view",monthItemHeader:"month-item-header",buttonPreviousMonth:"button-previous-month",buttonNextMonth:"button-next-month",monthItem:"month-item",monthItemName:"month-item-name",monthItemYear:"month-item-year",resetButton:"reset-button",monthItemWeekdaysRow:"month-item-weekdays-row",noPreviousMonth:"no-previous-month",noNextMonth:"no-next-month",containerDays:"container__days",dayItem:"day-item",isToday:"is-today",isLocked:"is-locked",isInRange:"is-in-range",isStartDate:"is-start-date",isFlipped:"is-flipped",isEndDate:"is-end-date",isHighlighted:"is-highlighted",weekNumber:"week-number",containerFooter:"container__footer",previewDateRange:"preview-date-range",buttonCancel:"button-cancel",buttonApply:"button-apply",containerTooltip:"container__tooltip"},e.exports=t},function(e,t,n){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=function(e,t){var n,i,s,r=e[1]||"",o=e[3];if(!o)return r;if(t&&"function"==typeof btoa){var a=(n=o,i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),s="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),"/*# ".concat(s," */")),l=o.sources.map(function(e){return"/*# sourceURL=".concat(o.sourceRoot||"").concat(e," */")});return[r].concat(l).concat([a]).join("\n")}return[r].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n}).join("")},t.i=function(e,n,i){"string"==typeof e&&(e=[[null,e,""]]);var s={};if(i)for(var r=0;rthis.options.endDate.getTime()&&(this.options.endDate=this.options.startDate.clone(),this.options.startDate=new s.DateTime(e,this.options.format,this.options.lang)),this.updateInput())},r.Litepicker.prototype.setDateRange=function(e,t,n){void 0===n&&(n=!1),this.triggerElement=void 0;var i=new s.DateTime(e,this.options.format,this.options.lang),r=new s.DateTime(t,this.options.format,this.options.lang);(this.options.disallowLockDaysInRange?o.rangeIsLocked([i,r],this.options):o.dateIsLocked(i,this.options,[i,r])||o.dateIsLocked(r,this.options,[i,r]))&&!n?this.emit("error:range",[i,r]):(this.setStartDate(i),this.setEndDate(r),this.options.inlineMode&&this.render(),this.updateInput(),this.emit("selected",this.getStartDate(),this.getEndDate()))},r.Litepicker.prototype.gotoDate=function(e,t){void 0===t&&(t=0);var n=new s.DateTime(e);n.setDate(1),this.calendars[t]=n.clone(),this.render()},r.Litepicker.prototype.setLockDays=function(e){this.options.lockDays=s.DateTime.convertArray(e,this.options.lockDaysFormat),this.render()},r.Litepicker.prototype.setHighlightedDays=function(e){this.options.highlightedDays=s.DateTime.convertArray(e,this.options.highlightedDaysFormat),this.render()},r.Litepicker.prototype.setOptions=function(e){delete e.element,delete e.elementEnd,delete e.parentEl,e.startDate&&(e.startDate=new s.DateTime(e.startDate,this.options.format,this.options.lang)),e.endDate&&(e.endDate=new s.DateTime(e.endDate,this.options.format,this.options.lang));var t=i(i({},this.options.dropdowns),e.dropdowns),n=i(i({},this.options.buttonText),e.buttonText),r=i(i({},this.options.tooltipText),e.tooltipText);this.options=i(i({},this.options),e),this.options.dropdowns=i({},t),this.options.buttonText=i({},n),this.options.tooltipText=i({},r),!this.options.singleMode||this.options.startDate instanceof s.DateTime||(this.options.startDate=null,this.options.endDate=null),this.options.singleMode||this.options.startDate instanceof s.DateTime&&this.options.endDate instanceof s.DateTime||(this.options.startDate=null,this.options.endDate=null);for(var o=0;o
'),null!==e.url){if(n+='"}this.createFromClickEvent(e,n)}createFromClickEvent(e,t){const n=this.getContextMenuElement();n.classList.contains("action-dropdown")||n.classList.add("action-dropdown"),n.innerHTML=t,n.style.position="fixed",n.style.top=e.clientY+"px",n.style.left=e.clientX+"px";const i=e=>{e.target.classList.contains("dropdown-toggle")||e.target.classList.contains("dropdown-divider")||(n.classList.remove("d-block"),n.classList.contains("d-none")||n.classList.add("d-none"),n.removeEventListener("click",i),document.removeEventListener("click",i))};n.addEventListener("click",i),document.addEventListener("click",i),n.classList.remove("d-none"),n.classList.contains("d-block")||n.classList.add("d-block")}static createForDataTable(e){[].slice.call(document.querySelectorAll(e)).map(e=>{null!==e.querySelector("td.actions div.dropdown-menu")&&e.addEventListener("contextmenu",t=>{let n=t.target;for(;null!==n;){const e=n.tagName.toUpperCase();if("TH"===e||"TABLE"===e||"BODY"===e)return;if("TR"===e)break;n=n.parentNode}if(null===n||!n.matches("table.dataTable tbody tr"))return;const s=n.querySelector("td.actions div.dropdown-menu");if(null===s)return;t.preventDefault();new i(e.dataset.contextMenu).createFromClickEvent(t,s.innerHTML)})})}}},4028:function(e,t,n){n(4975),n(5366),n.g.KimaiPaginatedBoxWidget=n(4100).A,n.g.KimaiReloadPageWidget=n(5170).A,n.g.KimaiColor=n(9997).A,n.g.KimaiStorage=n(5247).A},4100:function(e,t,n){"use strict";n.d(t,{A:function(){return s}});var i=n(2758);class s{constructor(e){this.selector=e;const t=document.querySelector(this.selector);if(void 0!==t.dataset.reload){this.events=t.dataset.reload.split(" ");const e=()=>{let e=null;e=void 0!==document.querySelector(this.selector).dataset.reloadHref?document.querySelector(this.selector).dataset.reloadHref:document.querySelector(this.selector+" ul.pagination li.active a").href,this.loadPage(e)};for(const t of this.events)document.addEventListener(t,e)}document.body.addEventListener("click",e=>{let t=e.target;t.matches(this.selector+" a.pagination-link")||(t=t.parentNode),t.matches(this.selector+" a.pagination-link")&&(e.preventDefault(),this.loadPage(t.href))})}static create(e){return new s(e)}loadPage(e){const t=this.selector;document.dispatchEvent(new CustomEvent("kimai.reloadContent",{detail:this.selector}));const n=()=>{document.dispatchEvent(new Event("kimai.reloadedContent"))};window.kimai.getPlugin("fetch").fetch(e).then(e=>{e.text().then(e=>{const s=document.createElement("div");s.innerHTML=e,document.querySelector(t).replaceWith(this._makeScriptExecutable(s.firstElementChild)),i.A.createForDataTable(t+" table.dataTable"),n()})}).catch(()=>{window.kimai.getPlugin("alert").error("Failed loading selected page"),n()})}_makeScriptExecutable(e){if(void 0!==e.tagName&&"SCRIPT"===e.tagName){const t=document.createElement("script");t.text=e.innerHTML,e.parentNode.replaceChild(t,e)}else for(const t of e.childNodes)this._makeScriptExecutable(t);return e}}},4975:function(e,t,n){"use strict";n.r(t)},5170:function(e,t,n){"use strict";n.d(t,{A:function(){return i}});class i{constructor(e,t){const n=()=>{t?document.location.reload():this._loadPage(document.location)};for(const t of e.split(" "))document.addEventListener(t,n)}static create(e,t){return null==t&&(t=!1),new i(e,t)}_showOverlay(){document.dispatchEvent(new CustomEvent("kimai.reloadContent",{detail:"div.page-wrapper"}))}_hideOverlay(){document.dispatchEvent(new Event("kimai.reloadedContent"))}_loadPage(e){this._showOverlay(),window.kimai.getPlugin("fetch").fetch(e).then(e=>{e.text().then(e=>{const t=document.createElement("div");t.innerHTML=e;const n=t.querySelector("section.content");document.querySelector("section.content").replaceWith(n),document.dispatchEvent(new Event("kimai.reloadPage")),this._hideOverlay()})}).catch(()=>{this._hideOverlay(),document.location=e})}}},5247:function(e,t,n){"use strict";n.d(t,{A:function(){return i}});class i{static set(e,t){window.localStorage.setItem(e,JSON.stringify(t))}static get(e){let t=window.localStorage.getItem(e);return null==t?null:JSON.parse(t)}static remove(e){window.localStorage.removeItem(e)}}},5366:function(e,t,n){"use strict";var i=n(8097);class s{constructor(e){this._translations=e}get(e){return this._translations[e]}has(e){return e in this._translations}}class r{constructor(e){this._configurations=e}get(e){return this._configurations[e]}has(e){return e in this._configurations}isRTL(){return"rtl"===this.get("direction")}getLanguage(){return this.get("locale").replace("_","-")}is24Hours(){return!!this.get("twentyFourHours")}getFirstDayOfWeek(e=!0){void 0===e&&(e=!0);let t=this.get("first_dow_iso");return e||(t%=7),t}}class o{init(){}getId(){return null}setContainer(e){if(!(e instanceof a))throw new Error("Plugin was given an invalid KimaiContainer");this._core=e}getContainer(){return this._core}getConfiguration(e){return this.getContainer().getConfiguration().get(e)}getConfigurations(){return this.getContainer().getConfiguration()}getDateUtils(){return this.getPlugin("date")}getPlugin(e){return this.getContainer().getPlugin(e)}getTranslation(){return this.getContainer().getTranslation()}translate(e){return this.getTranslation().get(e)}escape(e){return this.getPlugin("escape").escapeForHtml(e)}trigger(e,t=null){this.getPlugin("event").trigger(e,t)}fetch(e,t={}){return this.getPlugin("fetch").fetch(e,t)}fetchForm(e,t={},n=null){n=n||e.getAttribute("action");const i=e.getAttribute("method").toUpperCase();if("GET"===i){const i=this.getPlugin("form").convertFormDataToQueryString(e,{},!0);n=n+(n.includes("?")?"&":"?")+i,t={method:"GET",...t}}else"POST"===i&&(t={method:"POST",body:new FormData(e),...t});return this.fetch(n,t)}isMobile(){return Math.max(document.documentElement.clientWidth,window.innerWidth||0)<576}}class a{constructor(e,t){if(!(e instanceof r))throw new Error("Configuration needs to a KimaiConfiguration instance");if(this._configuration=e,!(t instanceof s))throw new Error("Configuration needs to a KimaiTranslation instance");this._translation=t,this._plugins=[]}registerPlugin(e){if(!(e instanceof o))throw new Error("Invalid plugin given, needs to be a KimaiPlugin instance");return e.setContainer(this),this._plugins.push(e),e}getPlugin(e){for(let t of this._plugins)if(null!==t.getId()&&t.getId()===e)return t;throw new Error("Unknown plugin: "+e)}getPlugins(){return this._plugins}getTranslation(){return this._translation}getConfiguration(){return this._configuration}getUser(){return this.getPlugin("user")}}class l extends o{constructor(e){super(),this.dataAttribute=e}getId(){return"datatable-column-visibility"}init(){let e=document.querySelector("["+this.dataAttribute+"]");if(null!==e){this._id=e.getAttribute(this.dataAttribute),this._modal=document.getElementById("modal_"+this._id),this._modal.addEventListener("show.bs.modal",()=>{this._evaluateCheckboxes()}),this._modal.querySelector("button[data-type=save]").addEventListener("click",()=>{this._saveVisibility()}),this._modal.querySelector("button[data-type=reset]").addEventListener("click",e=>{this._resetVisibility(e.currentTarget)}),this._modal.querySelectorAll("input[name=datatable_profile]").forEach(e=>{e.addEventListener("change",()=>{const t=this._modal.getElementsByTagName("form")[0];this.fetchForm(t,{},e.getAttribute("data-href")).then(()=>{localStorage.setItem("kimai_profile",e.getAttribute("value")),document.location.reload()}).catch(()=>{t.setAttribute("action",e.getAttribute("data-href")),t.submit()})})});for(let e of this._modal.querySelectorAll("form input[type=checkbox]"))e.addEventListener("change",()=>{this._changeVisibility(e.getAttribute("name"),e.checked)})}}_evaluateCheckboxes(){const e=this._modal.getElementsByTagName("form")[0],t=document.getElementsByClassName("datatable_"+this._id)[0];for(let n of t.getElementsByTagName("th")){const t=n.getAttribute("data-field");if(null===t)continue;const i=e.querySelector("input[name="+t+"]");null!==i&&(i.checked="none"!==window.getComputedStyle(n).display)}}_saveVisibility(){const e=this._modal.getElementsByTagName("form")[0];this.fetchForm(e).then(()=>{document.location.reload()}).catch(()=>{e.submit()})}_resetVisibility(e){const t=this._modal.getElementsByTagName("form")[0];this.fetchForm(t,{},e.getAttribute("formaction")).then(()=>{document.location.reload()}).catch(()=>{t.setAttribute("action",e.getAttribute("formaction")),t.submit()})}_changeVisibility(e,t){for(const n of document.getElementsByClassName("datatable_"+this._id)){let i=null;for(let s of n.getElementsByClassName("col_"+e)){if(null===i){let e="-none",n="d-table-cell";t||(e="-table-cell",n="d-none"),i="",s.classList.forEach(function(t,n,s){-1===t.indexOf(e)&&(i+=" "+t)}),-1===i.indexOf(n)&&(i+=" "+n)}s.className=i}}}}var c=n(9336);class u extends o{init(){[].slice.call(document.querySelectorAll('[data-toggle="tooltip"]')).map(function(e){return new c.m_(e)});[...document.querySelectorAll(".offcanvas")].map(e=>new c.go(e));this.getContainer().getPlugin("form").activateForm("div.page-wrapper form"),this._registerModalAutofocus("#remote_form_modal"),this.overlay=null,document.addEventListener("kimai.reloadContent",e=>{if(null!==this.overlay)return;let t="div.page-wrapper";void 0!==e.detail&&null!==e.detail&&(t=e.detail);const n=document.createElement("div");n.innerHTML='
',this.overlay=n.firstElementChild,document.querySelector(t).append(this.overlay)}),document.addEventListener("kimai.reloadedContent",()=>{null!==this.overlay&&(this.overlay.remove(),this.overlay=null)})}_registerModalAutofocus(e){if(this.isMobile())return;const t=document.querySelector(e);null!==t&&t.addEventListener("shown.bs.modal",()=>{const e=t.querySelector("form");let n=e.querySelectorAll("[autofocus]");n.length<1&&(n=e.querySelectorAll("input[type=text],input[type=date],textarea,select")),n.length>0&&n[0].focus()})}}var d=n(424);n(8214);class h extends o{supportsForm(e){return!1}activateForm(e){}destroyForm(e){}}class p extends h{constructor(e){super(),this._selector=e}init(){window.disableLitepickerStyles=!0,this._pickers=[]}supportsForm(e){return!0}activateForm(e){const t=this.getConfigurations().getFirstDayOfWeek(!1),n=this.getConfigurations().getLanguage();let i={buttonText:{previousMonth:'',nextMonth:'',apply:this.translate("confirm"),cancel:this.translate("cancel")}};const s=[].slice.call(e.querySelectorAll(this._selector)).map(e=>(void 0===e.dataset.format&&console.log("Trying to bind litepicker to an element without data-format attribute"),void 0!==e.hasAttribute("min")&&(i={...i,minDate:e.getAttribute("min")}),void 0!==e.hasAttribute("max")&&(i={...i,maxDate:e.getAttribute("max")}),i={...i,format:e.dataset.format,showTooltip:!1,element:e,lang:n,autoRefresh:!0,firstDay:t,setup:t=>{t.on("preselect",(e,n)=>{t._wasPreselected=!0}),t.on("selected",(n,i)=>{void 0!==t._wasPreselected&&(e.dispatchEvent(new Event("change",{bubbles:!0})),delete t._wasPreselected)}),void 0!==t.backdrop&&document.body.appendChild(t.backdrop)}},[e,new d.Litepicker(this.prepareOptions(i))]));this._pickers=this._pickers.concat(s)}prepareOptions(e){return{...e,plugins:["mobilefriendly"]}}destroyForm(e){[].slice.call(e.querySelectorAll(this._selector)).map(e=>{for(let t=0;t{this.reloadDatatable()};for(let e of t.split(" "))document.addEventListener(e,n);document.addEventListener("pagination-change",n),document.addEventListener("filter-change",n)}registerContextMenu(e){f.A.createForDataTable(e)}reloadDatatable(){const e=this.getContainer().getPlugin("toolbar").getSelector(),t=document.querySelector(e),n=e=>{const t=document.createElement("div");t.innerHTML=e;const n=t.querySelector(this._contentArea);document.querySelector(this._contentArea).replaceWith(n),this.registerContextMenu(this._selector),document.dispatchEvent(new Event("kimai.reloadedContent"))};document.dispatchEvent(new CustomEvent("kimai.reloadContent",{detail:this._contentArea})),null!==t?this.fetchForm(t).then(e=>{e.text().then(n)}).catch(()=>{t.submit()}):this.fetch(document.location).then(e=>{e.text().then(n)}).catch(()=>{document.location.reload()})}}class v extends o{constructor(e,t){super(),this._formSelector=e,this._actionClass=t}getId(){return"toolbar"}init(){const e=this.getSelector();this._registerPagination(e),this._registerSortableTables(e),this._registerAlternativeSubmitActions(e,this._actionClass),[].slice.call(document.querySelectorAll(e+" input")).map(t=>{t.addEventListener("change",t=>{switch(t.target.id){case"order":case"orderBy":case"page":break;default:document.querySelector(e+" input#page").value=1}}),this.triggerChange()}),[].slice.call(document.querySelectorAll(e+" select")).map(t=>{t.addEventListener("change",t=>{let n=!0;switch(t.target.id){case"customer":null!==document.querySelector(e+" select#project")&&(n=!1);break;case"project":null!==document.querySelector(e+" select#activity")&&(n=!1)}document.querySelector(e+" input#page").value=1,n&&this.triggerChange()})})}_registerAlternativeSubmitActions(e,t){document.addEventListener("click",function(n){let i=n.target;for(;null!==i&&"function"==typeof i.matches&&!i.matches("body");){if(i.classList.contains(t)){const t=document.querySelector(e);if(null===t)return;const s=t.getAttribute("action"),r=t.getAttribute("method");void 0!==i.dataset.target&&(t.target=i.dataset.target),t.action=i.href,void 0!==i.dataset.method&&(t.method=i.dataset.method),t.submit(),t.target="",t.action=s,t.method=r,n.preventDefault(),n.stopPropagation()}i=i.parentNode}})}_registerSortableTables(e){document.body.addEventListener("click",t=>{if(!t.target.matches("th.sortable"))return;let n="DESC",i=t.target.dataset.order;t.target.classList.contains("sorting_desc")&&(n="ASC"),document.querySelector(e+" #orderBy").value=i,document.querySelector(e+" #order").value=n,document.querySelector(e+" #orderBy").dispatchEvent(new Event("change")),document.querySelector(e+" #order").dispatchEvent(new Event("change")),document.dispatchEvent(new Event("filter-change"))})}_registerPagination(e){document.body.addEventListener("click",t=>{if(!(t.target.matches("ul.pagination li a")||null!==t.target.parentNode&&t.target.parentNode.matches("ul.pagination li a")))return;let n=document.querySelector(e+" input#page");if(null===n)return;let i=t.target;i.matches("a")||(i=i.parentNode),t.preventDefault(),t.stopPropagation();let s=i.href.split("/"),r=s[s.length-1];return/\d/.test(r)||(r=1),n.value=r,n.dispatchEvent(new Event("change")),document.dispatchEvent(new Event("pagination-change")),!1})}triggerChange(){document.dispatchEvent(new Event("toolbar-change"))}getSelector(){return this._formSelector}}class y extends o{getId(){return"api"}_headers(){const e=new Headers;return e.append("Content-Type","application/json"),e}get(e,t,n,i){if(void 0!==t){const n=new URLSearchParams(t).toString();""!==n&&(e=e+(e.includes("?")?"&":"?")+n)}void 0===i&&(i=e=>{this.handleError("An error occurred",e)}),this.fetch(e,{method:"GET",headers:this._headers()}).then(e=>{e.json().then(e=>{n(e)})}).catch(e=>{i(e)})}post(e,t,n,i){void 0===i&&(i=e=>{this.handleError("action.update.error",e)}),this.fetch(e,{method:"POST",body:this._parseData(t),headers:this._headers()}).then(e=>{e.json().then(e=>{n(e)})}).catch(e=>{i(e)})}patch(e,t,n,i){void 0===i&&(i=e=>{this.handleError("action.update.error",e)}),this.fetch(e,{method:"PATCH",body:this._parseData(t),headers:this._headers()}).then(e=>{204===e.statusCode?n():e.json().then(e=>{n(e)})}).catch(e=>{i(e)})}delete(e,t,n){void 0===n&&(n=e=>{this.handleError("action.delete.error",e)}),this.fetch(e,{method:"DELETE",headers:this._headers()}).then(()=>{t()}).catch(e=>{n(e)})}_parseData(e){return"object"==typeof e?JSON.stringify(e):e}handleError(e,t){if(void 0===t.headers)return;const n=t.headers.get("content-type");n&&-1!==n.indexOf("application/json")?t.json().then(n=>{let i=n.message;if(400===t.status&&n.errors){let e=[""+i+""];if(n.errors.errors)for(let t of n.errors.errors)e.push(t);if(n.errors.children)for(let t in n.errors.children){let i=n.errors.children[t];if(void 0!==i.errors&&i.errors.length>0)for(let t of i.errors)e.push(t)}e.length>0&&(i=e)}this.getPlugin("alert").error(e,i)}):t.text().then(()=>{const n="["+t.statusCode+"] "+t.statusText;this.getPlugin("alert").error(e,n)})}}class b extends o{addClickHandler(e,t,n){document.body.addEventListener("click",i=>{let s=i.target;for(;null!==s;){const t=s.tagName.toUpperCase();if("BODY"===t)return;if(s.matches(e))break;if("A"===t||"BUTTON"===t||"INPUT"===t||"LABEL"===t)return;for(let e of n)if(s.matches(e))return;s=s.parentNode}if(null===s)return;if(s.isContentEditable||s.parentNode.isContentEditable)return;if(!s.matches(e))return;for(let e of n)if(s.matches(e))return;i.preventDefault(),i.stopPropagation();let r=s.dataset.href;null==r&&(r=s.href),null!=r&&""!==r&&t(r)})}}class _ extends b{constructor(e){super(),this._selector=e}init(){this.addClickHandler(this._selector,function(e){window.location=e},[])}}class w extends b{constructor(e,t){super(),this._selector=e,this._stopSelector=t}getId(){return"modal"}init(){this._isDirty=!1;const e=this._getModalElement();null!==e&&(e.addEventListener("hide.bs.modal",t=>{if(this._isDirty){if(null===e.querySelector(".modal-body .remote_modal_is_dirty_warning")){const t=this.translate("modal.dirty"),n=document.createElement("div");n.innerHTML='

'+t+"

",e.querySelector(".modal-body").prepend(n.firstElementChild)}t.preventDefault()}else this._isDirty=!1,document.dispatchEvent(new Event("modal-hide"))}),e.addEventListener("hidden.bs.modal",()=>{this.getContainer().getPlugin("form").destroyForm(this._getFormIdentifier()),e.querySelector(".modal-body").replaceWith("")}),e.addEventListener("show.bs.modal",()=>{document.dispatchEvent(new Event("modal-show"))}),this.addClickHandler(this._selector,e=>{this.openUrlInModal(e)},this._stopSelector))}_getModal(){return c.aF.getOrCreateInstance(this._getModalElement())}openUrlInModal(e,t){const n=new Headers;n.append("X-Requested-With","Kimai-Modal"),this.fetch(e,{method:"GET",redirect:"follow",headers:n}).then(t=>{if(t.ok)return t.text().then(e=>{this._openFormInModal(e)});window.location=e}).catch(n=>{null==t?window.location=e:t(n)})}_getFormIdentifier(){return"#remote_form_modal .modal-content form"}_getModalElement(){return document.getElementById("remote_form_modal")}_makeScriptExecutable(e){if(void 0!==e.tagName&&"SCRIPT"===e.tagName){const t=document.createElement("script");t.text=e.innerHTML,e.parentNode.replaceChild(t,e)}else for(const t of e.childNodes)this._makeScriptExecutable(t);return e}_openFormInModal(e){const t=this._getFormIdentifier();let n=this._getModalElement();const i=document.createElement("div");i.innerHTML=e;const s=this._makeScriptExecutable(i.querySelector("#form_modal .modal-content"));if(null!==s){let e=n.querySelector(".modal-dialog"),r=i.querySelector(".modal-dialog").classList.contains("modal-lg");r&&!e.classList.contains("modal-lg")&&e.classList.toggle("modal-lg"),!r&&e.classList.contains("modal-lg")&&e.classList.toggle("modal-lg"),n.querySelector(".modal-content").replaceWith(s),[].slice.call(n.querySelectorAll('[data-bs-dismiss="modal"]')).map(e=>{e.addEventListener("click",()=>{this._isDirty=!1,this._getModal().hide()})}),this.getContainer().getPlugin("form").activateForm(t)}let r=i.querySelector("div.alert");null!==r&&n.querySelector(".modal-body").prepend(r);const o=document.querySelector(t);o.addEventListener("change",()=>{this._isDirty=!0}),o.addEventListener("submit",this._getEventHandler()),this._getModal().show()}_getEventHandler(){return void 0===this.eventHandler&&(this.eventHandler=e=>{const t=e.target;if(void 0!==t.target&&""!==t.target)return!0;const n=document.querySelector(this._getFormIdentifier()+" button[type=submit]");n.textContent=n.textContent+" …",n.disabled=!0;const i=t.dataset.formEvent,s=this.getContainer().getPlugin("event");e.preventDefault(),e.stopPropagation();const r=new Headers;r.append("X-Requested-With","Kimai-Modal");const o={headers:r};this.fetchForm(t,o).then(e=>{e.text().then(e=>{const t=document.createElement("div");t.innerHTML=e;let r=!1,o=!1,a=!1;n.textContent=n.textContent.replace(" …",""),n.disabled=!1;const l=t.querySelector("#form_modal .modal-content");null!==l&&(r=null!==l.querySelector(".is-invalid"),r||(r=null!==l.querySelector(".invalid-feedback")),o=null!==l.querySelector("ul.list-unstyled li.text-danger"),a=null!==t.querySelector("div.alert-danger")),r||o||a?this._openFormInModal(e):(s.trigger(i),this._isDirty=!1,this._getModal().hide())})}).catch(e=>{let i=t.dataset.msgError;null!=i&&""!==i||(i="action.update.error");this.getContainer().getPlugin("alert").error(i,e.message),setTimeout(()=>{n.textContent=n.textContent.replace(" …",""),n.disabled=!1},1500)})}),this.eventHandler}}class k extends o{constructor(){super(),this._selector=".ticktac-menu",this._selectorEmpty=".ticktac-menu-empty",this._favIconUrl=null}getId(){return"active-records"}init(){if(null===document.querySelector(this._selector))return;const e=()=>{this.reloadActiveRecords()};document.addEventListener("kimai.timesheetUpdate",e),document.addEventListener("kimai.timesheetDelete",e),document.addEventListener("kimai.activityUpdate",e),document.addEventListener("kimai.activityDelete",e),document.addEventListener("kimai.projectUpdate",e),document.addEventListener("kimai.projectDelete",e),document.addEventListener("kimai.customerUpdate",e),document.addEventListener("kimai.customerDelete",e),this._updateBrowserTitle=!!this.getConfiguration("updateBrowserTitle");const t=()=>{this._updateDuration()};this._updatesHandler=setInterval(t,1e4),document.addEventListener("kimai.timesheetUpdate",t),document.addEventListener("kimai.reloadedContent",t)}_updateDuration(){const e=document.querySelectorAll('[data-since]:not([data-since=""])');if(this._updateBrowserTitle&&this._changeFavicon(e.length>0),0===e.length)return void(this._updateBrowserTitle&&(void 0===document.body.dataset.title?this._updateBrowserTitle=!1:document.title=document.body.dataset.title));const t=this.getDateUtils();let n=[];for(const i of e){const e=t.formatDuration(i.dataset.since);void 0!==i.dataset.replacer&&null!==i.dataset.title&&"?"!==e&&n.push(e),i.textContent=e}0!==n.length&&this._updateBrowserTitle&&(document.title=n.shift())}_setEntries(e){const t=e.length>0;for(let e of document.querySelectorAll(this._selectorEmpty))e.style.display=t?"none":"inline-block";for(let n of document.querySelectorAll(this._selector)){if(n.style.display=t?"inline-block":"none",!t)for(let e of n.querySelectorAll("[data-since]"))e.dataset.since="";const i=n.querySelector(".ticktac-stop");t?(i&&(i.accesskey="s"),this._replaceInNode(n,e[0])):i&&(i.accesskey=null)}this._updateDuration()}_replaceInNode(e,t){const n=this.getDateUtils(),i=e.querySelectorAll("[data-replacer]");for(let s of i){const i=s.dataset.replacer;"url"===i?s.dataset.href=e.dataset.href.replace("000",t.id):"activity"===i?s.innerText=t.activity.name:"project"===i?s.innerText=t.project.name:"customer"===i?s.innerText=t.project.customer.name:"duration"===i&&(s.dataset.since=t.begin,s.innerText=n.formatDuration(t.duration))}}reloadActiveRecords(){const e=this.getContainer().getPlugin("api"),t=document.querySelector(this._selector).dataset.api;e.get(t,{},e=>{this._setEntries(e)})}_changeFavicon(e){const t=document.createElement("canvas"),n=document.getElementById("favicon");null===this._favIconUrl&&(this._favIconUrl=n.href);const i=n.cloneNode(!0);if(t.getContext&&i){const s=window.devicePixelRatio,r=document.createElement("img");t.height=t.width=16*s,r.onload=function(){const r=t.getContext("2d");if(r.drawImage(this,0,0,t.width,t.height),e){const e=5.5*s;r.fillStyle="rgb(182,57,57)",r.fillRect(t.width/2-e/2,t.height/2-e/2,e,e)}i.href=t.toDataURL("image/png"),n.remove(),document.head.appendChild(i)},r.src=this._favIconUrl}}}class T extends o{getId(){return"event"}trigger(e,t=null){if(""!==e)for(const n of e.split(" ")){let e=new Event(n);null!==t&&(e=new CustomEvent(n,{detail:t})),document.dispatchEvent(e)}}}class E extends o{constructor(e){super(),this._selector=e}init(){document.addEventListener("click",e=>{let t=e.target;for(;null!==t&&"function"==typeof t.matches&&!t.matches("body");){if(t.classList.contains(this._selector)){const n=t.dataset;let i=n.href;i||(i=t.getAttribute("href")),void 0!==n.question?this.getContainer().getPlugin("alert").question(n.question,e=>{e&&this._callApi(i,n)}):this._callApi(i,n),e.preventDefault(),e.stopPropagation()}t=t.parentNode}})}_callApi(e,t){const n=t.method,i=t.event,s=this.getContainer().getPlugin("api"),r=this.getContainer().getPlugin("event"),o=(this.getContainer().getPlugin("alert"),()=>{r.trigger(i),document.dispatchEvent(new CustomEvent("kimai.reloadedContent"))}),a=e=>{let n="action.update.error";void 0!==t.msgError&&(n=t.msgError),document.dispatchEvent(new CustomEvent("kimai.reloadedContent")),s.handleError(n,e)};let l={};if(void 0!==t.payload&&(l=t.payload),document.dispatchEvent(new CustomEvent("kimai.reloadContent")),"PATCH"===n)s.patch(e,l,o,a);else if("POST"===n){let t={};s.post(e,t,o,a)}else"DELETE"===n?s.delete(e,o,a):"GET"===n&&s.get(e,l,o,a)}}class D extends o{getId(){return"alert"}error(e,t){const n=this.getTranslation();n.has(e)&&(e=n.get(e)),e=e.replace("%reason%",""),void 0===t&&(t=null),null!==t&&(n.has(t)&&(t=n.get(t)),Array.isArray(t)&&(t=t.join("
")));const i="alert_global_error",s=document.getElementById(i);null!==s&&c.aF.getOrCreateInstance(s).hide();const r='\n
\n ";this._showModal(r)}warning(e){this._show("warning",e)}success(e){this._toast("success",e)}info(e){this._show("info",e)}_showModal(e){const t=document.body,n=document.createElement("template");n.innerHTML=e.trim();const i=n.content.firstChild;t.appendChild(i);const s=new c.aF(i);i.addEventListener("hidden.bs.modal",function(){t.removeChild(i)}),s.show()}_show(e,t){const n=this.getTranslation();n.has(t)&&(t=n.get(t));const i='\n \n ";this._showModal(i)}_mapClass(e){return"info"===e||"success"===e||"warning"===e||"danger"===e?e:"error"===e?"danger":"primary"}_toast(e,t){const n=this.getTranslation();n.has(t)&&(t=n.get(t));let i='';"success"===e?i='':"warning"===e?i='':"danger"!==e&&"error"!==e||(i='');const s='',r=document.getElementById("toast-container"),o=document.createElement("template");o.innerHTML=s.trim();const a=o.content.firstChild;r.appendChild(a);const l=new c.y8(a);a.addEventListener("hidden.bs.toast",function(){r.removeChild(a)}),l.show()}question(e,t){const n=this.getTranslation();n.has(e)&&(e=n.get(e));const i=this._mapClass("info"),s='\n \n ",r=document.body,o=document.createElement("template");o.innerHTML=s.trim();const a=o.content.firstChild;r.appendChild(a),a.querySelector(".question-confirm").addEventListener("click",()=>{t(!0)}),a.querySelector(".question-cancel").addEventListener("click",()=>{t(!1)});const l=new c.aF(a);a.addEventListener("hidden.bs.modal",()=>{r.removeChild(a)}),l.show()}}function S(e,t){e.split(/\s+/).forEach(e=>{t(e)})}class x{constructor(){this._events={}}on(e,t){S(e,e=>{const n=this._events[e]||[];n.push(t),this._events[e]=n})}off(e,t){var n=arguments.length;0!==n?S(e,e=>{if(1===n)return void delete this._events[e];const i=this._events[e];void 0!==i&&(i.splice(i.indexOf(t),1),this._events[e]=i)}):this._events={}}trigger(e,...t){var n=this;S(e,e=>{const i=n._events[e];void 0!==i&&i.forEach(e=>{e.apply(n,t)})})}}const O=e=>(e=e.filter(Boolean)).length<2?e[0]||"":1==I(e)?"["+e.join("")+"]":"(?:"+e.join("|")+")",L=e=>{if(!A(e))return e.join("");let t="",n=0;const i=()=>{n>1&&(t+="{"+n+"}")};return e.forEach((s,r)=>{s!==e[r-1]?(i(),t+=s,n=1):n++}),i(),t},C=e=>{let t=Array.from(e);return O(t)},A=e=>new Set(e).size!==e.length,M=e=>(e+"").replace(/([\$\(\)\*\+\.\?\[\]\^\{\|\}\\])/gu,"\\$1"),I=e=>e.reduce((e,t)=>Math.max(e,N(t)),0),N=e=>Array.from(e).length,P=e=>{if(1===e.length)return[[e]];let t=[];const n=e.substring(1);return P(n).forEach(function(n){let i=n.slice(0);i[0]=e.charAt(0)+i[0],t.push(i),i=n.slice(0),i.unshift(e.charAt(0)),t.push(i)}),t},F=[[0,65535]];let j,R;const $={},H={"/":"⁄∕",0:"߀",a:"ⱥɐɑ",aa:"ꜳ",ae:"æǽǣ",ao:"ꜵ",au:"ꜷ",av:"ꜹꜻ",ay:"ꜽ",b:"ƀɓƃ",c:"ꜿƈȼↄ",d:"đɗɖᴅƌꮷԁɦ",e:"ɛǝᴇɇ",f:"ꝼƒ",g:"ǥɠꞡᵹꝿɢ",h:"ħⱨⱶɥ",i:"ɨı",j:"ɉȷ",k:"ƙⱪꝁꝃꝅꞣ",l:"łƚɫⱡꝉꝇꞁɭ",m:"ɱɯϻ",n:"ꞥƞɲꞑᴎлԉ",o:"øǿɔɵꝋꝍᴑ",oe:"œ",oi:"ƣ",oo:"ꝏ",ou:"ȣ",p:"ƥᵽꝑꝓꝕρ",q:"ꝗꝙɋ",r:"ɍɽꝛꞧꞃ",s:"ßȿꞩꞅʂ",t:"ŧƭʈⱦꞇ",th:"þ",tz:"ꜩ",u:"ʉ",v:"ʋꝟʌ",vy:"ꝡ",w:"ⱳ",y:"ƴɏỿ",z:"ƶȥɀⱬꝣ",hv:"ƕ"};for(let e in H){let t=H[e]||"";for(let n=0;ne.normalize(t),z=e=>Array.from(e).reduce((e,t)=>e+B(t),""),B=e=>(e=V(e).toLowerCase().replace(q,e=>$[e]||""),V(e,"NFC"));const W=e=>{const t={},n=(e,n)=>{const i=t[e]||new Set,s=new RegExp("^"+C(i)+"$","iu");n.match(s)||(i.add(M(n)),t[e]=i)};for(let t of function*(e){for(const[t,n]of e)for(let e=t;e<=n;e++){let t=String.fromCharCode(e),n=z(t);n!=t.toLowerCase()&&(n.length>3||0!=n.length&&(yield{folded:n,composed:t,code_point:e}))}}(e))n(t.folded,t.folded),n(t.folded,t.composed);return t},U=e=>{const t=W(e),n={};let i=[];for(let e in t){let s=t[e];s&&(n[e]=C(s)),e.length>1&&i.push(M(e))}i.sort((e,t)=>t.length-e.length);const s=O(i);return R=new RegExp("^"+s,"u"),n},Y=(e,t=1)=>(t=Math.max(t,e.length-1),O(P(e).map(e=>((e,t=1)=>{let n=0;return e=e.map(e=>(j[e]&&(n+=e.length),j[e]||e)),n>=t?L(e):""})(e,t)))),Z=(e,t=!0)=>{let n=e.length>1?1:0;return O(e.map(e=>{let i=[];const s=t?e.length():e.length()-1;for(let t=0;t{for(const n of t){if(n.start!=e.start||n.end!=e.end)continue;if(n.substrs.join("")!==e.substrs.join(""))continue;let t=e.parts;const i=e=>{for(const n of t){if(n.start===e.start&&n.substr===e.substr)return!1;if(1!=e.length&&1!=n.length){if(e.startn.start)return!0;if(n.starte.start)return!0}}return!1};if(!(n.parts.filter(i).length>0))return!0}return!1};class K{parts;substrs;start;end;constructor(){this.parts=[],this.substrs=[],this.start=0,this.end=0}add(e){e&&(this.parts.push(e),this.substrs.push(e.substr),this.start=Math.min(e.start,this.start),this.end=Math.max(e.end,this.end))}last(){return this.parts[this.parts.length-1]}length(){return this.parts.length}clone(e,t){let n=new K,i=JSON.parse(JSON.stringify(this.parts)),s=i.pop();for(const e of i)n.add(e);let r=t.substr.substring(0,e-s.start),o=r.length;return n.add({start:s.start,end:s.start+o,length:o,substr:r}),n}}const J=e=>{var t;void 0===j&&(j=U(t||F)),e=z(e);let n="",i=[new K];for(let t=0;t0){a=a.sort((e,t)=>e.length()-t.length());for(let e of a)G(e,i)||i.push(e)}else if(t>0&&1==l.size&&!l.has("3")){n+=Z(i,!1);let e=new K;const t=i[0];t&&e.add(t.last()),i=[e]}}return n+=Z(i,!0),n},X=(e,t)=>{if(e)return e[t]},Q=(e,t)=>{if(e){for(var n,i=t.split(".");(n=i.shift())&&(e=e[n]););return e}},ee=(e,t,n)=>{var i,s;return e?(e+="",null==t.regex||-1===(s=e.search(t.regex))?0:(i=t.string.length/e.length,0===s&&(i+=.5),i*n)):0},te=(e,t)=>{var n=e[t];if("function"==typeof n)return n;n&&!Array.isArray(n)&&(e[t]=[n])},ne=(e,t)=>{if(Array.isArray(e))e.forEach(t);else for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)},ie=(e,t)=>"number"==typeof e&&"number"==typeof t?e>t?1:e(t=z(t+"").toLowerCase())?1:t>e?-1:0;class se{items;settings;constructor(e,t){this.items=e,this.settings=t||{diacritics:!0}}tokenize(e,t,n){if(!e||!e.length)return[];const i=[],s=e.split(/\s+/);var r;return n&&(r=new RegExp("^("+Object.keys(n).map(M).join("|")+"):(.*)$")),s.forEach(e=>{let n,s=null,o=null;r&&(n=e.match(r))&&(s=n[1],e=n[2]),e.length>0&&(o=this.settings.diacritics?J(e)||null:M(e),o&&t&&(o="\\b"+o)),i.push({string:e,regex:o?new RegExp(o,"iu"):null,field:s})}),i}getScoreFunction(e,t){var n=this.prepareSearch(e,t);return this._getScoreFunction(n)}_getScoreFunction(e){const t=e.tokens,n=t.length;if(!n)return function(){return 0};const i=e.options.fields,s=e.weights,r=i.length,o=e.getAttrFn;if(!r)return function(){return 1};const a=1===r?function(e,t){const n=i[0].field;return ee(o(t,n),e,s[n]||1)}:function(e,t){var n=0;if(e.field){const i=o(t,e.field);!e.regex&&i?n+=1/r:n+=ee(i,e,1)}else ne(s,(i,s)=>{n+=ee(o(t,s),e,i)});return n/r};return 1===n?function(e){return a(t[0],e)}:"and"===e.options.conjunction?function(e){var i,s=0;for(let n of t){if((i=a(n,e))<=0)return 0;s+=i}return s/n}:function(e){var i=0;return ne(t,t=>{i+=a(t,e)}),i/n}}getSortFunction(e,t){var n=this.prepareSearch(e,t);return this._getSortFunction(n)}_getSortFunction(e){var t,n=[];const i=this,s=e.options,r=!e.query&&s.sort_empty?s.sort_empty:s.sort;if("function"==typeof r)return r.bind(this);const o=function(t,n){return"$score"===t?n.score:e.getAttrFn(i.items[n.id],t)};if(r)for(let t of r)(e.query||"$score"!==t.field)&&n.push(t);if(e.query){t=!0;for(let e of n)if("$score"===e.field){t=!1;break}t&&n.unshift({field:"$score",direction:"desc"})}else n=n.filter(e=>"$score"!==e.field);return n.length?function(e,t){var i,s;for(let r of n){if(s=r.field,i=("desc"===r.direction?-1:1)*ie(o(s,e),o(s,t)))return i}return 0}:null}prepareSearch(e,t){const n={};var i=Object.assign({},t);if(te(i,"sort"),te(i,"sort_empty"),i.fields){te(i,"fields");const e=[];i.fields.forEach(t=>{"string"==typeof t&&(t={field:t,weight:1}),e.push(t),n[t.field]="weight"in t?t.weight:1}),i.fields=e}return{options:i,query:e.toLowerCase().trim(),tokens:this.tokenize(e,i.respect_word_boundaries,n),total:0,items:[],weights:n,getAttrFn:i.nesting?Q:X}}search(e,t){var n,i,s=this;i=this.prepareSearch(e,t),t=i.options,e=i.query;const r=t.score||s._getScoreFunction(i);e.length?ne(s.items,(e,s)=>{n=r(e),(!1===t.filter||n>0)&&i.items.push({score:n,id:s})}):ne(s.items,(e,t)=>{i.items.push({score:1,id:t})});const o=s._getSortFunction(i);return o&&i.items.sort(o),i.total=i.items.length,"number"==typeof t.limit&&(i.items=i.items.slice(0,t.limit)),i}}const re=e=>null==e?null:oe(e),oe=e=>"boolean"==typeof e?e?"1":"0":e+"",ae=e=>(e+"").replace(/&/g,"&").replace(//g,">").replace(/"/g,"""),le=(e,t)=>{var n;return function(i,s){var r=this;n&&(r.loading=Math.max(r.loading-1,0),clearTimeout(n)),n=setTimeout(function(){n=null,r.loadedSearches[i]=!0,e.call(r,i,s)},t)}},ce=(e,t,n)=>{var i,s=e.trigger,r={};for(i of(e.trigger=function(){var n=arguments[0];if(-1===t.indexOf(n))return s.apply(e,arguments);r[n]=arguments},n.apply(e,[]),e.trigger=s,t))i in r&&s.apply(e,r[i])},ue=(e,t=!1)=>{e&&(e.preventDefault(),t&&e.stopPropagation())},de=(e,t,n,i)=>{e.addEventListener(t,n,i)},he=(e,t)=>!!t&&(!!t[e]&&1===(t.altKey?1:0)+(t.ctrlKey?1:0)+(t.shiftKey?1:0)+(t.metaKey?1:0)),pe=(e,t)=>{const n=e.getAttribute("id");return n||(e.setAttribute("id",t),t)},me=e=>e.replace(/[\\"']/g,"\\$&"),fe=(e,t)=>{t&&e.append(t)},ge=(e,t)=>{if(Array.isArray(e))e.forEach(t);else for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)},ve=e=>{if(e.jquery)return e[0];if(e instanceof HTMLElement)return e;if(ye(e)){var t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)},ye=e=>"string"==typeof e&&e.indexOf("<")>-1,be=(e,t)=>{var n=document.createEvent("HTMLEvents");n.initEvent(t,!0,!1),e.dispatchEvent(n)},_e=(e,t)=>{Object.assign(e.style,t)},we=(e,...t)=>{var n=Te(t);(e=Ee(e)).map(e=>{n.map(t=>{e.classList.add(t)})})},ke=(e,...t)=>{var n=Te(t);(e=Ee(e)).map(e=>{n.map(t=>{e.classList.remove(t)})})},Te=e=>{var t=[];return ge(e,e=>{"string"==typeof e&&(e=e.trim().split(/[\t\n\f\r\s]/)),Array.isArray(e)&&(t=t.concat(e))}),t.filter(Boolean)},Ee=e=>(Array.isArray(e)||(e=[e]),e),De=(e,t,n)=>{if(!n||n.contains(e))for(;e&&e.matches;){if(e.matches(t))return e;e=e.parentNode}},Se=(e,t=0)=>t>0?e[e.length-1]:e[0],xe=(e,t)=>{if(!e)return-1;t=t||e.nodeName;for(var n=0;e=e.previousElementSibling;)e.matches(t)&&n++;return n},Oe=(e,t)=>{ge(t,(t,n)=>{null==t?e.removeAttribute(n):e.setAttribute(n,""+t)})},Le=(e,t)=>{e.parentNode&&e.parentNode.replaceChild(t,e)},Ce=(e,t)=>{if(null===t)return;if("string"==typeof t){if(!t.length)return;t=new RegExp(t,"i")}const n=e=>3===e.nodeType?(e=>{var n=e.data.match(t);if(n&&e.data.length>0){var i=document.createElement("span");i.className="highlight";var s=e.splitText(n.index);s.splitText(n[0].length);var r=s.cloneNode(!0);return i.appendChild(r),Le(s,i),1}return 0})(e):((e=>{1!==e.nodeType||!e.childNodes||/(script|style)/i.test(e.tagName)||"highlight"===e.className&&"SPAN"===e.tagName||Array.from(e.childNodes).forEach(e=>{n(e)})})(e),0);n(e)},Ae="undefined"!=typeof navigator&&/Mac/.test(navigator.userAgent)?"metaKey":"ctrlKey";var Me={options:[],optgroups:[],plugins:[],delimiter:",",splitOn:null,persist:!0,diacritics:!0,create:null,createOnBlur:!1,createFilter:null,highlight:!0,openOnFocus:!0,shouldOpen:null,maxOptions:50,maxItems:null,hideSelected:null,duplicates:!1,addPrecedence:!1,selectOnTab:!1,preload:null,allowEmptyOption:!1,refreshThrottle:300,loadThrottle:300,loadingClass:"loading",dataAttr:null,optgroupField:"optgroup",valueField:"value",labelField:"text",disabledField:"disabled",optgroupLabelField:"label",optgroupValueField:"value",lockOptgroupOrder:!1,sortField:"$order",searchField:["text"],searchConjunction:"and",mode:null,wrapperClass:"ts-wrapper",controlClass:"ts-control",dropdownClass:"ts-dropdown",dropdownContentClass:"ts-dropdown-content",itemClass:"item",optionClass:"option",dropdownParent:null,controlInput:'',copyClassesToDropdown:!1,placeholder:null,hidePlaceholder:null,shouldLoad:function(e){return e.length>0},render:{}};function Ie(e,t){var n=Object.assign({},Me,t),i=n.dataAttr,s=n.labelField,r=n.valueField,o=n.disabledField,a=n.optgroupField,l=n.optgroupLabelField,c=n.optgroupValueField,u=e.tagName.toLowerCase(),d=e.getAttribute("placeholder")||e.getAttribute("data-placeholder");if(!d&&!n.allowEmptyOption){let t=e.querySelector('option[value=""]');t&&(d=t.textContent)}var h={placeholder:d,options:[],optgroups:[],items:[],maxItems:null};return"select"===u?(()=>{var t,u=h.options,d={},p=1;let m=0;var f=e=>{var t=Object.assign({},e.dataset),n=i&&t[i];return"string"==typeof n&&n.length&&(t=Object.assign(t,JSON.parse(n))),t},g=(e,t)=>{var i=re(e.value);if(null!=i&&(i||n.allowEmptyOption)){if(d.hasOwnProperty(i)){if(t){var l=d[i][a];l?Array.isArray(l)?l.push(t):d[i][a]=[l,t]:d[i][a]=t}}else{var c=f(e);c[s]=c[s]||e.textContent,c[r]=c[r]||i,c[o]=c[o]||e.disabled,c[a]=c[a]||t,c.$option=e,c.$order=c.$order||++m,d[i]=c,u.push(c)}e.selected&&h.items.push(i)}};h.maxItems=e.hasAttribute("multiple")?null:1,ge(e.children,e=>{var n,i,s;"optgroup"===(t=e.tagName.toLowerCase())?((s=f(n=e))[l]=s[l]||n.getAttribute("label")||"",s[c]=s[c]||p++,s[o]=s[o]||n.disabled,s.$order=s.$order||++m,h.optgroups.push(s),i=s[c],ge(n.children,e=>{g(e,i)})):"option"===t&&g(e)})})():(()=>{const t=e.getAttribute(i);if(t)h.options=JSON.parse(t),ge(h.options,e=>{h.items.push(e[r])});else{var o=e.value.trim()||"";if(!n.allowEmptyOption&&!o.length)return;const t=o.split(n.delimiter);ge(t,e=>{const t={};t[s]=e,t[r]=e,h.options.push(t)}),h.items=t}})(),Object.assign({},Me,h,t)}var Ne=0;class Pe extends(function(e){return e.plugins={},class extends e{constructor(){super(...arguments),this.plugins={names:[],settings:{},requested:{},loaded:{}}}static define(t,n){e.plugins[t]={name:t,fn:n}}initializePlugins(e){var t,n;const i=this,s=[];if(Array.isArray(e))e.forEach(e=>{"string"==typeof e?s.push(e):(i.plugins.settings[e.name]=e.options,s.push(e.name))});else if(e)for(t in e)e.hasOwnProperty(t)&&(i.plugins.settings[t]=e[t],s.push(t));for(;n=s.shift();)i.require(n)}loadPlugin(t){var n=this,i=n.plugins,s=e.plugins[t];if(!e.plugins.hasOwnProperty(t))throw new Error('Unable to find "'+t+'" plugin');i.requested[t]=!0,i.loaded[t]=s.fn.apply(n,[n.plugins.settings[t]||{}]),i.names.push(t)}require(e){var t=this,n=t.plugins;if(!t.plugins.loaded.hasOwnProperty(e)){if(n.requested[e])throw new Error('Plugin has circular dependency ("'+e+'")');t.loadPlugin(e)}return n.loaded[e]}}}(x)){constructor(e,t){var n;super(),this.order=0,this.isOpen=!1,this.isDisabled=!1,this.isReadOnly=!1,this.isInvalid=!1,this.isValid=!0,this.isLocked=!1,this.isFocused=!1,this.isInputHidden=!1,this.isSetup=!1,this.ignoreFocus=!1,this.ignoreHover=!1,this.hasOptions=!1,this.lastValue="",this.caretPos=0,this.loading=0,this.loadedSearches={},this.activeOption=null,this.activeItems=[],this.optgroups={},this.options={},this.userOptions={},this.items=[],this.refreshTimeout=null,Ne++;var i=ve(e);if(i.tomselect)throw new Error("Tom Select already initialized on this element");i.tomselect=this,n=(window.getComputedStyle&&window.getComputedStyle(i,null)).getPropertyValue("direction");const s=Ie(i,t);this.settings=s,this.input=i,this.tabIndex=i.tabIndex||0,this.is_select_tag="select"===i.tagName.toLowerCase(),this.rtl=/rtl/i.test(n),this.inputId=pe(i,"tomselect-"+Ne),this.isRequired=i.required,this.sifter=new se(this.options,{diacritics:s.diacritics}),s.mode=s.mode||(1===s.maxItems?"single":"multi"),"boolean"!=typeof s.hideSelected&&(s.hideSelected="multi"===s.mode),"boolean"!=typeof s.hidePlaceholder&&(s.hidePlaceholder="multi"!==s.mode);var r=s.createFilter;"function"!=typeof r&&("string"==typeof r&&(r=new RegExp(r)),r instanceof RegExp?s.createFilter=e=>r.test(e):s.createFilter=e=>this.settings.duplicates||!this.options[e]),this.initializePlugins(s.plugins),this.setupCallbacks(),this.setupTemplates();const o=ve("
"),a=ve("
"),l=this._render("dropdown"),c=ve('
'),u=this.input.getAttribute("class")||"",d=s.mode;var h;if(we(o,s.wrapperClass,u,d),we(a,s.controlClass),fe(o,a),we(l,s.dropdownClass,d),s.copyClassesToDropdown&&we(l,u),we(c,s.dropdownContentClass),fe(l,c),ve(s.dropdownParent||o).appendChild(l),ye(s.controlInput)){h=ve(s.controlInput);ge(["autocorrect","autocapitalize","autocomplete","spellcheck"],e=>{i.getAttribute(e)&&Oe(h,{[e]:i.getAttribute(e)})}),h.tabIndex=-1,a.appendChild(h),this.focus_node=h}else s.controlInput?(h=ve(s.controlInput),this.focus_node=h):(h=ve(""),this.focus_node=a);this.wrapper=o,this.dropdown=l,this.dropdown_content=c,this.control=a,this.control_input=h,this.setup()}setup(){const e=this,t=e.settings,n=e.control_input,i=e.dropdown,s=e.dropdown_content,r=e.wrapper,o=e.control,a=e.input,l=e.focus_node,c={passive:!0},u=e.inputId+"-ts-dropdown";Oe(s,{id:u}),Oe(l,{role:"combobox","aria-haspopup":"listbox","aria-expanded":"false","aria-controls":u});const d=pe(l,e.inputId+"-ts-control"),h="label[for='"+(e=>e.replace(/['"\\]/g,"\\$&"))(e.inputId)+"']",p=document.querySelector(h),m=e.focus.bind(e);if(p){de(p,"click",m),Oe(p,{for:d});const t=pe(p,e.inputId+"-ts-label");Oe(l,{"aria-labelledby":t}),Oe(s,{"aria-labelledby":t})}if(r.style.width=a.style.width,e.plugins.names.length){const t="plugin-"+e.plugins.names.join(" plugin-");we([r,i],t)}(null===t.maxItems||t.maxItems>1)&&e.is_select_tag&&Oe(a,{multiple:"multiple"}),t.placeholder&&Oe(n,{placeholder:t.placeholder}),!t.splitOn&&t.delimiter&&(t.splitOn=new RegExp("\\s*"+M(t.delimiter)+"+\\s*")),t.load&&t.loadThrottle&&(t.load=le(t.load,t.loadThrottle)),de(i,"mousemove",()=>{e.ignoreHover=!1}),de(i,"mouseenter",t=>{var n=De(t.target,"[data-selectable]",i);n&&e.onOptionHover(t,n)},{capture:!0}),de(i,"click",t=>{const n=De(t.target,"[data-selectable]");n&&(e.onOptionSelect(t,n),ue(t,!0))}),de(o,"click",t=>{var i=De(t.target,"[data-ts-item]",o);i&&e.onItemSelect(t,i)?ue(t,!0):""==n.value&&(e.onClick(),ue(t,!0))}),de(l,"keydown",t=>e.onKeyDown(t)),de(n,"keypress",t=>e.onKeyPress(t)),de(n,"input",t=>e.onInput(t)),de(l,"blur",t=>e.onBlur(t)),de(l,"focus",t=>e.onFocus(t)),de(n,"paste",t=>e.onPaste(t));const f=t=>{const s=t.composedPath()[0];if(!r.contains(s)&&!i.contains(s))return e.isFocused&&e.blur(),void e.inputState();s==n&&e.isOpen?t.stopPropagation():ue(t,!0)},g=()=>{e.isOpen&&e.positionDropdown()};de(document,"mousedown",f),de(window,"scroll",g,c),de(window,"resize",g,c),this._destroy=()=>{document.removeEventListener("mousedown",f),window.removeEventListener("scroll",g),window.removeEventListener("resize",g),p&&p.removeEventListener("click",m)},this.revertSettings={innerHTML:a.innerHTML,tabIndex:a.tabIndex},a.tabIndex=-1,a.insertAdjacentElement("afterend",e.wrapper),e.sync(!1),t.items=[],delete t.optgroups,delete t.options,de(a,"invalid",()=>{e.isValid&&(e.isValid=!1,e.isInvalid=!0,e.refreshState())}),e.updateOriginalInput(),e.refreshItems(),e.close(!1),e.inputState(),e.isSetup=!0,a.disabled?e.disable():a.readOnly?e.setReadOnly(!0):e.enable(),e.on("change",this.onChange),we(a,"tomselected","ts-hidden-accessible"),e.trigger("initialize"),!0===t.preload&&e.preload()}setupOptions(e=[],t=[]){this.addOptions(e),ge(t,e=>{this.registerOptionGroup(e)})}setupTemplates(){var e=this,t=e.settings.labelField,n=e.settings.optgroupLabelField,i={optgroup:e=>{let t=document.createElement("div");return t.className="optgroup",t.appendChild(e.options),t},optgroup_header:(e,t)=>'
'+t(e[n])+"
",option:(e,n)=>"
"+n(e[t])+"
",item:(e,n)=>"
"+n(e[t])+"
",option_create:(e,t)=>'
Add '+t(e.input)+"
",no_results:()=>'
No results found
',loading:()=>'
',not_loading:()=>{},dropdown:()=>"
"};e.settings.render=Object.assign({},i,e.settings.render)}setupCallbacks(){var e,t,n={initialize:"onInitialize",change:"onChange",item_add:"onItemAdd",item_remove:"onItemRemove",item_select:"onItemSelect",clear:"onClear",option_add:"onOptionAdd",option_remove:"onOptionRemove",option_clear:"onOptionClear",optgroup_add:"onOptionGroupAdd",optgroup_remove:"onOptionGroupRemove",optgroup_clear:"onOptionGroupClear",dropdown_open:"onDropdownOpen",dropdown_close:"onDropdownClose",type:"onType",load:"onLoad",focus:"onFocus",blur:"onBlur"};for(e in n)(t=this.settings[n[e]])&&this.on(e,t)}sync(e=!0){const t=this,n=e?Ie(t.input,{delimiter:t.settings.delimiter}):t.settings;t.setupOptions(n.options,n.optgroups),t.setValue(n.items||[],!0),t.lastQuery=null}onClick(){var e=this;if(e.activeItems.length>0)return e.clearActiveItems(),void e.focus();e.isFocused&&e.isOpen?e.blur():e.focus()}onMouseDown(){}onChange(){be(this.input,"input"),be(this.input,"change")}onPaste(e){var t=this;t.isInputHidden||t.isLocked?ue(e):t.settings.splitOn&&setTimeout(()=>{var e=t.inputValue();if(e.match(t.settings.splitOn)){var n=e.trim().split(t.settings.splitOn);ge(n,e=>{re(e)&&(this.options[e]?t.addItem(e):t.createItem(e))})}},0)}onKeyPress(e){var t=this;if(!t.isLocked){var n=String.fromCharCode(e.keyCode||e.which);return t.settings.create&&"multi"===t.settings.mode&&n===t.settings.delimiter?(t.createItem(),void ue(e)):void 0}ue(e)}onKeyDown(e){var t=this;if(t.ignoreHover=!0,t.isLocked)9!==e.keyCode&&ue(e);else{switch(e.keyCode){case 65:if(he(Ae,e)&&""==t.control_input.value)return ue(e),void t.selectAll();break;case 27:return t.isOpen&&(ue(e,!0),t.close()),void t.clearActiveItems();case 40:if(!t.isOpen&&t.hasOptions)t.open();else if(t.activeOption){let e=t.getAdjacent(t.activeOption,1);e&&t.setActiveOption(e)}return void ue(e);case 38:if(t.activeOption){let e=t.getAdjacent(t.activeOption,-1);e&&t.setActiveOption(e)}return void ue(e);case 13:return void(t.canSelect(t.activeOption)?(t.onOptionSelect(e,t.activeOption),ue(e)):(t.settings.create&&t.createItem()||document.activeElement==t.control_input&&t.isOpen)&&ue(e));case 37:return void t.advanceSelection(-1,e);case 39:return void t.advanceSelection(1,e);case 9:return void(t.settings.selectOnTab&&(t.canSelect(t.activeOption)&&(t.onOptionSelect(e,t.activeOption),ue(e)),t.settings.create&&t.createItem()&&ue(e)));case 8:case 46:return void t.deleteSelection(e)}t.isInputHidden&&!he(Ae,e)&&ue(e)}}onInput(e){if(this.isLocked)return;const t=this.inputValue();this.lastValue!==t&&(this.lastValue=t,""!=t?(this.refreshTimeout&&window.clearTimeout(this.refreshTimeout),this.refreshTimeout=((e,t)=>t>0?window.setTimeout(e,t):(e.call(null),null))(()=>{this.refreshTimeout=null,this._onInput()},this.settings.refreshThrottle)):this._onInput())}_onInput(){const e=this.lastValue;this.settings.shouldLoad.call(this,e)&&this.load(e),this.refreshOptions(),this.trigger("type",e)}onOptionHover(e,t){this.ignoreHover||this.setActiveOption(t,!1)}onFocus(e){var t=this,n=t.isFocused;if(t.isDisabled||t.isReadOnly)return t.blur(),void ue(e);t.ignoreFocus||(t.isFocused=!0,"focus"===t.settings.preload&&t.preload(),n||t.trigger("focus"),t.activeItems.length||(t.inputState(),t.refreshOptions(!!t.settings.openOnFocus)),t.refreshState())}onBlur(e){if(!1!==document.hasFocus()){var t=this;if(t.isFocused){t.isFocused=!1,t.ignoreFocus=!1;var n=()=>{t.close(),t.setActiveItem(),t.setCaret(t.items.length),t.trigger("blur")};t.settings.create&&t.settings.createOnBlur?t.createItem(null,n):n()}}}onOptionSelect(e,t){var n,i=this;t.parentElement&&t.parentElement.matches("[data-disabled]")||(t.classList.contains("create")?i.createItem(null,()=>{i.settings.closeAfterSelect&&i.close()}):void 0!==(n=t.dataset.value)&&(i.lastQuery=null,i.addItem(n),i.settings.closeAfterSelect&&i.close(),!i.settings.hideSelected&&e.type&&/click/.test(e.type)&&i.setActiveOption(t)))}canSelect(e){return!!(this.isOpen&&e&&this.dropdown_content.contains(e))}onItemSelect(e,t){var n=this;return!n.isLocked&&"multi"===n.settings.mode&&(ue(e),n.setActiveItem(t,e),!0)}canLoad(e){return!!this.settings.load&&!this.loadedSearches.hasOwnProperty(e)}load(e){const t=this;if(!t.canLoad(e))return;we(t.wrapper,t.settings.loadingClass),t.loading++;const n=t.loadCallback.bind(t);t.settings.load.call(t,e,n)}loadCallback(e,t){const n=this;n.loading=Math.max(n.loading-1,0),n.lastQuery=null,n.clearActiveOption(),n.setupOptions(e,t),n.refreshOptions(n.isFocused&&!n.isInputHidden),n.loading||ke(n.wrapper,n.settings.loadingClass),n.trigger("load",e,t)}preload(){var e=this.wrapper.classList;e.contains("preloaded")||(e.add("preloaded"),this.load(""))}setTextboxValue(e=""){var t=this.control_input;t.value!==e&&(t.value=e,be(t,"update"),this.lastValue=e)}getValue(){return this.is_select_tag&&this.input.hasAttribute("multiple")?this.items:this.items.join(this.settings.delimiter)}setValue(e,t){ce(this,t?[]:["change"],()=>{this.clear(t),this.addItems(e,t)})}setMaxItems(e){0===e&&(e=null),this.settings.maxItems=e,this.refreshState()}setActiveItem(e,t){var n,i,s,r,o,a,l=this;if("single"!==l.settings.mode){if(!e)return l.clearActiveItems(),void(l.isFocused&&l.inputState());if("click"===(n=t&&t.type.toLowerCase())&&he("shiftKey",t)&&l.activeItems.length){for(a=l.getLastActive(),(s=Array.prototype.indexOf.call(l.control.children,a))>(r=Array.prototype.indexOf.call(l.control.children,e))&&(o=s,s=r,r=o),i=s;i<=r;i++)e=l.control.children[i],-1===l.activeItems.indexOf(e)&&l.setActiveItemClass(e);ue(t)}else"click"===n&&he(Ae,t)||"keydown"===n&&he("shiftKey",t)?e.classList.contains("active")?l.removeActiveItem(e):l.setActiveItemClass(e):(l.clearActiveItems(),l.setActiveItemClass(e));l.inputState(),l.isFocused||l.focus()}}setActiveItemClass(e){const t=this,n=t.control.querySelector(".last-active");n&&ke(n,"last-active"),we(e,"active last-active"),t.trigger("item_select",e),-1==t.activeItems.indexOf(e)&&t.activeItems.push(e)}removeActiveItem(e){var t=this.activeItems.indexOf(e);this.activeItems.splice(t,1),ke(e,"active")}clearActiveItems(){ke(this.activeItems,"active"),this.activeItems=[]}setActiveOption(e,t=!0){e!==this.activeOption&&(this.clearActiveOption(),e&&(this.activeOption=e,Oe(this.focus_node,{"aria-activedescendant":e.getAttribute("id")}),Oe(e,{"aria-selected":"true"}),we(e,"active"),t&&this.scrollToOption(e)))}scrollToOption(e,t){if(!e)return;const n=this.dropdown_content,i=n.clientHeight,s=n.scrollTop||0,r=e.offsetHeight,o=e.getBoundingClientRect().top-n.getBoundingClientRect().top+s;o+r>i+s?this.scroll(o-i+r,t):o{e.setActiveItemClass(t)}))}inputState(){var e=this;e.control.contains(e.control_input)&&(Oe(e.control_input,{placeholder:e.settings.placeholder}),e.activeItems.length>0||!e.isFocused&&e.settings.hidePlaceholder&&e.items.length>0?(e.setTextboxValue(),e.isInputHidden=!0):(e.settings.hidePlaceholder&&e.items.length>0&&Oe(e.control_input,{placeholder:""}),e.isInputHidden=!1),e.wrapper.classList.toggle("input-hidden",e.isInputHidden))}inputValue(){return this.control_input.value.trim()}focus(){var e=this;e.isDisabled||e.isReadOnly||(e.ignoreFocus=!0,e.control_input.offsetWidth?e.control_input.focus():e.focus_node.focus(),setTimeout(()=>{e.ignoreFocus=!1,e.onFocus()},0))}blur(){this.focus_node.blur(),this.onBlur()}getScoreFunction(e){return this.sifter.getScoreFunction(e,this.getSearchOptions())}getSearchOptions(){var e=this.settings,t=e.sortField;return"string"==typeof e.sortField&&(t=[{field:e.sortField}]),{fields:e.searchField,conjunction:e.searchConjunction,sort:t,nesting:e.nesting}}search(e){var t,n,i=this,s=this.getSearchOptions();if(i.settings.score&&"function"!=typeof(n=i.settings.score.call(i,e)))throw new Error('Tom Select "score" setting must be a function that returns a function');return e!==i.lastQuery?(i.lastQuery=e,t=i.sifter.search(e,Object.assign(s,{score:n})),i.currentResults=t):t=Object.assign({},i.currentResults),i.settings.hideSelected&&(t.items=t.items.filter(e=>{let t=re(e.id);return!(t&&-1!==i.items.indexOf(t))})),t}refreshOptions(e=!0){var t,n,i,s,r,o,a,l,c,u;const d={},h=[];var p=this,m=p.inputValue();const f=m===p.lastQuery||""==m&&null==p.lastQuery;var g=p.search(m),v=null,y=p.settings.shouldOpen||!1,b=p.dropdown_content;f&&(v=p.activeOption)&&(c=v.closest("[data-group]")),s=g.items.length,"number"==typeof p.settings.maxOptions&&(s=Math.min(s,p.settings.maxOptions)),s>0&&(y=!0);const _=(e,t)=>{let n=d[e];if(void 0!==n){let e=h[n];if(void 0!==e)return[n,e.fragment]}let i=document.createDocumentFragment();return n=h.length,h.push({fragment:i,order:t,optgroup:e}),[n,i]};for(t=0;t0&&(u=u.cloneNode(!0),Oe(u,{id:a.$id+"-clone-"+n,"aria-selected":null}),u.classList.add("ts-cloned"),ke(u,"active"),p.activeOption&&p.activeOption.dataset.value==s&&c&&c.dataset.group===r.toString()&&(v=u)),l.appendChild(u),""!=r&&(d[r]=i)}}var w;p.settings.lockOptgroupOrder&&h.sort((e,t)=>e.order-t.order),a=document.createDocumentFragment(),ge(h,e=>{let t=e.fragment,n=e.optgroup;if(!t||!t.children.length)return;let i=p.optgroups[n];if(void 0!==i){let e=document.createDocumentFragment(),n=p.render("optgroup_header",i);fe(e,n),fe(e,t);let s=p.render("optgroup",{group:i,options:e});fe(a,s)}else fe(a,t)}),b.innerHTML="",fe(b,a),p.settings.highlight&&(w=b.querySelectorAll("span.highlight"),Array.prototype.forEach.call(w,function(e){var t=e.parentNode;t.replaceChild(e.firstChild,e),t.normalize()}),g.query.length&&g.tokens.length&&ge(g.tokens,e=>{Ce(b,e.regex)}));var k=e=>{let t=p.render(e,{input:m});return t&&(y=!0,b.insertBefore(t,b.firstChild)),t};if(p.loading?k("loading"):p.settings.shouldLoad.call(p,m)?0===g.items.length&&k("no_results"):k("not_loading"),(l=p.canCreate(m))&&(u=k("option_create")),p.hasOptions=g.items.length>0||l,y){if(g.items.length>0){if(v||"single"!==p.settings.mode||null==p.items[0]||(v=p.getOption(p.items[0])),!b.contains(v)){let e=0;u&&!p.settings.addPrecedence&&(e=1),v=p.selectable()[e]}}else u&&(v=u);e&&!p.isOpen&&(p.open(),p.scrollToOption(v,"auto")),p.setActiveOption(v)}else p.clearActiveOption(),e&&p.isOpen&&p.close(!1)}selectable(){return this.dropdown_content.querySelectorAll("[data-selectable]")}addOption(e,t=!1){const n=this;if(Array.isArray(e))return n.addOptions(e,t),!1;const i=re(e[n.settings.valueField]);return null!==i&&!n.options.hasOwnProperty(i)&&(e.$order=e.$order||++n.order,e.$id=n.inputId+"-opt-"+e.$order,n.options[i]=e,n.lastQuery=null,t&&(n.userOptions[i]=t,n.trigger("option_add",i,e)),i)}addOptions(e,t=!1){ge(e,e=>{this.addOption(e,t)})}registerOption(e){return this.addOption(e)}registerOptionGroup(e){var t=re(e[this.settings.optgroupValueField]);return null!==t&&(e.$order=e.$order||++this.order,this.optgroups[t]=e,t)}addOptionGroup(e,t){var n;t[this.settings.optgroupValueField]=e,(n=this.registerOptionGroup(t))&&this.trigger("optgroup_add",n,t)}removeOptionGroup(e){this.optgroups.hasOwnProperty(e)&&(delete this.optgroups[e],this.clearCache(),this.trigger("optgroup_remove",e))}clearOptionGroups(){this.optgroups={},this.clearCache(),this.trigger("optgroup_clear")}updateOption(e,t){const n=this;var i,s;const r=re(e),o=re(t[n.settings.valueField]);if(null===r)return;const a=n.options[r];if(null==a)return;if("string"!=typeof o)throw new Error("Value must be set in option data");const l=n.getOption(r),c=n.getItem(r);if(t.$order=t.$order||a.$order,delete n.options[r],n.uncacheValue(o),n.options[o]=t,l){if(n.dropdown_content.contains(l)){const e=n._render("option",t);Le(l,e),n.activeOption===l&&n.setActiveOption(e)}l.remove()}c&&(-1!==(s=n.items.indexOf(r))&&n.items.splice(s,1,o),i=n._render("item",t),c.classList.contains("active")&&we(i,"active"),Le(c,i)),n.lastQuery=null}removeOption(e,t){const n=this;e=oe(e),n.uncacheValue(e),delete n.userOptions[e],delete n.options[e],n.lastQuery=null,n.trigger("option_remove",e),n.removeItem(e,t)}clearOptions(e){const t=(e||this.clearFilter).bind(this);this.loadedSearches={},this.userOptions={},this.clearCache();const n={};ge(this.options,(e,i)=>{t(e,i)&&(n[i]=e)}),this.options=this.sifter.items=n,this.lastQuery=null,this.trigger("option_clear")}clearFilter(e,t){return this.items.indexOf(t)>=0}getOption(e,t=!1){const n=re(e);if(null===n)return null;const i=this.options[n];if(null!=i){if(i.$div)return i.$div;if(t)return this._render("option",i)}return null}getAdjacent(e,t,n="option"){var i;if(!e)return null;i="item"==n?this.controlChildren():this.dropdown_content.querySelectorAll("[data-selectable]");for(let n=0;n0?i[n+1]:i[n-1];return null}getItem(e){if("object"==typeof e)return e;var t=re(e);return null!==t?this.control.querySelector(`[data-value="${me(t)}"]`):null}addItems(e,t){var n=this,i=Array.isArray(e)?e:[e];const s=(i=i.filter(e=>-1===n.items.indexOf(e)))[i.length-1];i.forEach(e=>{n.isPending=e!==s,n.addItem(e,t)})}addItem(e,t){ce(this,t?[]:["change","dropdown_close"],()=>{var n,i;const s=this,r=s.settings.mode,o=re(e);if((!o||-1===s.items.indexOf(o)||("single"===r&&s.close(),"single"!==r&&s.settings.duplicates))&&null!==o&&s.options.hasOwnProperty(o)&&("single"===r&&s.clear(t),"multi"!==r||!s.isFull())){if(n=s._render("item",s.options[o]),s.control.contains(n)&&(n=n.cloneNode(!0)),i=s.isFull(),s.items.splice(s.caretPos,0,o),s.insertAtCaret(n),s.isSetup){if(!s.isPending&&s.settings.hideSelected){let e=s.getOption(o),t=s.getAdjacent(e,1);t&&s.setActiveOption(t)}s.isPending||s.settings.closeAfterSelect||s.refreshOptions(s.isFocused&&"single"!==r),0!=s.settings.closeAfterSelect&&s.isFull()?s.close():s.isPending||s.positionDropdown(),s.trigger("item_add",o,n),s.isPending||s.updateOriginalInput({silent:t})}(!s.isPending||!i&&s.isFull())&&(s.inputState(),s.refreshState())}})}removeItem(e=null,t){const n=this;if(!(e=n.getItem(e)))return;var i,s;const r=e.dataset.value;i=xe(e),e.remove(),e.classList.contains("active")&&(s=n.activeItems.indexOf(e),n.activeItems.splice(s,1),ke(e,"active")),n.items.splice(i,1),n.lastQuery=null,!n.settings.persist&&n.userOptions.hasOwnProperty(r)&&n.removeOption(r,t),i{}){3===arguments.length&&(t=arguments[2]),"function"!=typeof t&&(t=()=>{});var n,i=this,s=i.caretPos;if(e=e||i.inputValue(),!i.canCreate(e))return t(),!1;i.lock();var r=!1,o=e=>{if(i.unlock(),!e||"object"!=typeof e)return t();var n=re(e[i.settings.valueField]);if("string"!=typeof n)return t();i.setTextboxValue(),i.addOption(e,!0),i.setCaret(s),i.addItem(n),t(e),r=!0};return n="function"==typeof i.settings.create?i.settings.create.call(this,e,o):{[i.settings.labelField]:e,[i.settings.valueField]:e},r||o(n),!0}refreshItems(){var e=this;e.lastQuery=null,e.isSetup&&e.addItems(e.items),e.updateOriginalInput(),e.refreshState()}refreshState(){const e=this;e.refreshValidityState();const t=e.isFull(),n=e.isLocked;e.wrapper.classList.toggle("rtl",e.rtl);const i=e.wrapper.classList;var s;i.toggle("focus",e.isFocused),i.toggle("disabled",e.isDisabled),i.toggle("readonly",e.isReadOnly),i.toggle("required",e.isRequired),i.toggle("invalid",!e.isValid),i.toggle("locked",n),i.toggle("full",t),i.toggle("input-active",e.isFocused&&!e.isInputHidden),i.toggle("dropdown-active",e.isOpen),i.toggle("has-options",(s=e.options,0===Object.keys(s).length)),i.toggle("has-items",e.items.length>0)}refreshValidityState(){var e=this;e.input.validity&&(e.isValid=e.input.validity.valid,e.isInvalid=!e.isValid)}isFull(){return null!==this.settings.maxItems&&this.items.length>=this.settings.maxItems}updateOriginalInput(e={}){const t=this;var n,i;const s=t.input.querySelector('option[value=""]');if(t.is_select_tag){const r=[],o=t.input.querySelectorAll("option:checked").length;function a(e,n,i){return e||(e=ve('")),e!=s&&t.input.append(e),r.push(e),(e!=s||o>0)&&(e.selected=!0),e}t.input.querySelectorAll("option:checked").forEach(e=>{e.selected=!1}),0==t.items.length&&"single"==t.settings.mode?a(s,"",""):t.items.forEach(e=>{if(n=t.options[e],i=n[t.settings.labelField]||"",r.includes(n.$option)){a(t.input.querySelector(`option[value="${me(e)}"]:not(:checked)`),e,i)}else n.$option=a(n.$option,e,i)})}else t.input.value=t.getValue();t.isSetup&&(e.silent||t.trigger("change",t.getValue()))}open(){var e=this;e.isLocked||e.isOpen||"multi"===e.settings.mode&&e.isFull()||(e.isOpen=!0,Oe(e.focus_node,{"aria-expanded":"true"}),e.refreshState(),_e(e.dropdown,{visibility:"hidden",display:"block"}),e.positionDropdown(),_e(e.dropdown,{visibility:"visible",display:"block"}),e.focus(),e.trigger("dropdown_open",e.dropdown))}close(e=!0){var t=this,n=t.isOpen;e&&(t.setTextboxValue(),"single"===t.settings.mode&&t.items.length&&t.inputState()),t.isOpen=!1,Oe(t.focus_node,{"aria-expanded":"false"}),_e(t.dropdown,{display:"none"}),t.settings.hideSelected&&t.clearActiveOption(),t.refreshState(),n&&t.trigger("dropdown_close",t.dropdown)}positionDropdown(){if("body"===this.settings.dropdownParent){var e=this.control,t=e.getBoundingClientRect(),n=e.offsetHeight+t.top+window.scrollY,i=t.left+window.scrollX;_e(this.dropdown,{width:t.width+"px",top:n+"px",left:i+"px"})}}clear(e){var t=this;if(t.items.length){var n=t.controlChildren();ge(n,e=>{t.removeItem(e,!0)}),t.inputState(),e||t.updateOriginalInput(),t.trigger("clear")}}insertAtCaret(e){const t=this,n=t.caretPos,i=t.control;i.insertBefore(e,i.children[n]||null),t.setCaret(n+1)}deleteSelection(e){var t,n,i,s,r,o=this;t=e&&8===e.keyCode?-1:1,n={start:(r=o.control_input).selectionStart||0,length:(r.selectionEnd||0)-(r.selectionStart||0)};const a=[];if(o.activeItems.length)s=Se(o.activeItems,t),i=xe(s),t>0&&i++,ge(o.activeItems,e=>a.push(e));else if((o.isFocused||"single"===o.settings.mode)&&o.items.length){const e=o.controlChildren();let i;t<0&&0===n.start&&0===n.length?i=e[o.caretPos-1]:t>0&&n.start===o.inputValue().length&&(i=e[o.caretPos]),void 0!==i&&a.push(i)}if(!o.shouldDelete(a,e))return!1;for(ue(e,!0),void 0!==i&&o.setCaret(i);a.length;)o.removeItem(a.pop());return o.inputState(),o.positionDropdown(),o.refreshOptions(!1),!0}shouldDelete(e,t){const n=e.map(e=>e.dataset.value);return!(!n.length||"function"==typeof this.settings.onDelete&&!1===this.settings.onDelete(n,t))}advanceSelection(e,t){var n,i,s=this;s.rtl&&(e*=-1),s.inputValue().length||(he(Ae,t)||he("shiftKey",t)?(i=(n=s.getLastActive(e))?n.classList.contains("active")?s.getAdjacent(n,e,"item"):n:e>0?s.control_input.nextElementSibling:s.control_input.previousElementSibling)&&(i.classList.contains("active")&&s.removeActiveItem(n),s.setActiveItemClass(i)):s.moveCaret(e))}moveCaret(e){}getLastActive(e){let t=this.control.querySelector(".last-active");if(t)return t;var n=this.control.querySelectorAll(".active");return n?Se(n,e):void 0}setCaret(e){this.caretPos=this.items.length}controlChildren(){return Array.from(this.control.querySelectorAll("[data-ts-item]"))}lock(){this.setLocked(!0)}unlock(){this.setLocked(!1)}setLocked(e=this.isReadOnly||this.isDisabled){this.isLocked=e,this.refreshState()}disable(){this.setDisabled(!0),this.close()}enable(){this.setDisabled(!1)}setDisabled(e){this.focus_node.tabIndex=e?-1:this.tabIndex,this.isDisabled=e,this.input.disabled=e,this.control_input.disabled=e,this.setLocked()}setReadOnly(e){this.isReadOnly=e,this.input.readOnly=e,this.control_input.readOnly=e,this.setLocked()}destroy(){var e=this,t=e.revertSettings;e.trigger("destroy"),e.off(),e.wrapper.remove(),e.dropdown.remove(),e.input.innerHTML=t.innerHTML,e.input.tabIndex=t.tabIndex,ke(e.input,"tomselected","ts-hidden-accessible"),e._destroy(),delete e.input.tomselect}render(e,t){var n,i;const s=this;if("function"!=typeof this.settings.render[e])return null;if(!(i=s.settings.render[e].call(this,t,ae)))return null;if(i=ve(i),"option"===e||"option_create"===e?t[s.settings.disabledField]?Oe(i,{"aria-disabled":"true"}):Oe(i,{"data-selectable":""}):"optgroup"===e&&(n=t.group[s.settings.optgroupValueField],Oe(i,{"data-group":n}),t.group[s.settings.disabledField]&&Oe(i,{"data-disabled":""})),"option"===e||"item"===e){const n=oe(t[s.settings.valueField]);Oe(i,{"data-value":n}),"item"===e?(we(i,s.settings.itemClass),Oe(i,{"data-ts-item":""})):(we(i,s.settings.optionClass),Oe(i,{role:"option",id:t.$id}),t.$div=i,s.options[n]=t)}return i}_render(e,t){const n=this.render(e,t);if(null==n)throw"HTMLElement expected";return n}clearCache(){ge(this.options,e=>{e.$div&&(e.$div.remove(),delete e.$div)})}uncacheValue(e){const t=this.getOption(e);t&&t.remove()}canCreate(e){return this.settings.create&&e.length>0&&this.settings.createFilter.call(this,e)}hook(e,t,n){var i=this,s=i[t];i[t]=function(){var t,r;return"after"===e&&(t=s.apply(i,arguments)),r=n.apply(i,arguments),"instead"===e?r:("before"===e&&(t=s.apply(i,arguments)),t)}}}const Fe=e=>"boolean"==typeof e?e?"1":"0":e+"",je=(e,t=!1)=>{e&&(e.preventDefault(),t&&e.stopPropagation())},Re=e=>"string"==typeof e&&e.indexOf("<")>-1;const $e=e=>"string"==typeof e&&e.indexOf("<")>-1;const He=(e,t,n,i)=>{e.addEventListener(t,n,i)},qe=e=>"string"==typeof e&&e.indexOf("<")>-1,Ve=(e,t)=>{((e,t)=>{if(Array.isArray(e))e.forEach(t);else for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)})(t,(t,n)=>{null==t?e.removeAttribute(n):e.setAttribute(n,""+t)})};const ze=e=>"string"==typeof e&&e.indexOf("<")>-1;const Be=e=>{var t=[];return((e,t)=>{if(Array.isArray(e))e.forEach(t);else for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)})(e,e=>{"string"==typeof e&&(e=e.trim().split(/[\t\n\f\r\s]/)),Array.isArray(e)&&(t=t.concat(e))}),t.filter(Boolean)},We=e=>(Array.isArray(e)||(e=[e]),e);const Ue=e=>{if(e.jquery)return e[0];if(e instanceof HTMLElement)return e;if(Ye(e)){var t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)},Ye=e=>"string"==typeof e&&e.indexOf("<")>-1,Ze=e=>{var t=[];return((e,t)=>{if(Array.isArray(e))e.forEach(t);else for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)})(e,e=>{"string"==typeof e&&(e=e.trim().split(/[\t\n\f\r\s]/)),Array.isArray(e)&&(t=t.concat(e))}),t.filter(Boolean)},Ge=e=>(Array.isArray(e)||(e=[e]),e);const Ke=(e,t,n,i)=>{e.addEventListener(t,n,i)};const Je=(e,t=!1)=>{e&&(e.preventDefault(),t&&e.stopPropagation())},Xe=(e,t,n,i)=>{e.addEventListener(t,n,i)},Qe=e=>{if(e.jquery)return e[0];if(e instanceof HTMLElement)return e;if(et(e)){var t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)},et=e=>"string"==typeof e&&e.indexOf("<")>-1;const tt=e=>{var t=[];return((e,t)=>{if(Array.isArray(e))e.forEach(t);else for(var n in e)e.hasOwnProperty(n)&&t(e[n],n)})(e,e=>{"string"==typeof e&&(e=e.trim().split(/[\t\n\f\r\s]/)),Array.isArray(e)&&(t=t.concat(e))}),t.filter(Boolean)},nt=e=>(Array.isArray(e)||(e=[e]),e);Pe.define("change_listener",function(){var e,t,n,i;e=this.input,t="change",n=()=>{this.sync()},e.addEventListener(t,n,i)}),Pe.define("checkbox_options",function(e){var t=this,n=t.onOptionSelect;t.settings.hideSelected=!1;const i=Object.assign({className:"tomselect-checkbox",checkedClassNames:void 0,uncheckedClassNames:void 0},e);var s=function(e,t){t?(e.checked=!0,i.uncheckedClassNames&&e.classList.remove(...i.uncheckedClassNames),i.checkedClassNames&&e.classList.add(...i.checkedClassNames)):(e.checked=!1,i.checkedClassNames&&e.classList.remove(...i.checkedClassNames),i.uncheckedClassNames&&e.classList.add(...i.uncheckedClassNames))},r=function(e){setTimeout(()=>{var t=e.querySelector("input."+i.className);t instanceof HTMLInputElement&&s(t,e.classList.contains("selected"))},1)};t.hook("after","setupTemplates",()=>{var e=t.settings.render.option;t.settings.render.option=(n,r)=>{var o=(e=>{if(e.jquery)return e[0];if(e instanceof HTMLElement)return e;if(Re(e)){var t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)})(e.call(t,n,r)),a=document.createElement("input");i.className&&a.classList.add(i.className),a.addEventListener("click",function(e){je(e)}),a.type="checkbox";const l=null==(c=n[t.settings.valueField])?null:Fe(c);var c;return s(a,!!(l&&t.items.indexOf(l)>-1)),o.prepend(a),o}}),t.on("item_remove",e=>{var n=t.getOption(e);n&&(n.classList.remove("selected"),r(n))}),t.on("item_add",e=>{var n=t.getOption(e);n&&r(n)}),t.hook("instead","onOptionSelect",(e,i)=>{if(i.classList.contains("selected"))return i.classList.remove("selected"),t.removeItem(i.dataset.value),t.refreshOptions(),void je(e,!0);n.call(t,e,i),r(i)})}),Pe.define("clear_button",function(e){const t=this,n=Object.assign({className:"clear-button",title:"Clear All",html:e=>`
`},e);t.on("initialize",()=>{var e=(e=>{if(e.jquery)return e[0];if(e instanceof HTMLElement)return e;if($e(e)){var t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)})(n.html(n));e.addEventListener("click",e=>{t.isLocked||(t.clear(),"single"===t.settings.mode&&t.settings.allowEmptyOption&&t.addItem(""),e.preventDefault(),e.stopPropagation())}),t.control.appendChild(e)})}),Pe.define("drag_drop",function(){var e=this;if("multi"!==e.settings.mode)return;var t=e.lock,n=e.unlock;let i,s=!0;e.hook("after","setupTemplates",()=>{var t=e.settings.render.item;e.settings.render.item=(n,r)=>{const o=(e=>{if(e.jquery)return e[0];if(e instanceof HTMLElement)return e;if(qe(e)){var t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)})(t.call(e,n,r));Ve(o,{draggable:"true"});const a=e=>{e.preventDefault(),o.classList.add("ts-drag-over"),l(o,i)},l=(e,t)=>{var n,i,s;void 0!==t&&(((e,t)=>{do{var n;if(e==(t=null==(n=t)?void 0:n.previousElementSibling))return!0}while(t&&t.previousElementSibling);return!1})(t,o)?(i=t,null==(s=(n=e).parentNode)||s.insertBefore(i,n.nextSibling)):((e,t)=>{var n;null==(n=e.parentNode)||n.insertBefore(t,e)})(e,t))};return He(o,"mousedown",e=>{s||((e,t=!1)=>{e&&(e.preventDefault(),t&&e.stopPropagation())})(e),e.stopPropagation()}),He(o,"dragstart",e=>{i=o,setTimeout(()=>{o.classList.add("ts-dragging")},0)}),He(o,"dragenter",a),He(o,"dragover",a),He(o,"dragleave",()=>{o.classList.remove("ts-drag-over")}),He(o,"dragend",()=>{var t;document.querySelectorAll(".ts-drag-over").forEach(e=>e.classList.remove("ts-drag-over")),null==(t=i)||t.classList.remove("ts-dragging"),i=void 0;var n=[];e.control.querySelectorAll("[data-value]").forEach(e=>{if(e.dataset.value){let t=e.dataset.value;t&&n.push(t)}}),e.setValue(n)}),o}}),e.hook("instead","lock",()=>(s=!1,t.call(e))),e.hook("instead","unlock",()=>(s=!0,n.call(e)))}),Pe.define("dropdown_header",function(e){const t=this,n=Object.assign({title:"Untitled",headerClass:"dropdown-header",titleRowClass:"dropdown-header-title",labelClass:"dropdown-header-label",closeClass:"dropdown-header-close",html:e=>'
'+e.title+'×
'},e);t.on("initialize",()=>{var e=(e=>{if(e.jquery)return e[0];if(e instanceof HTMLElement)return e;if(ze(e)){var t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstChild}return document.querySelector(e)})(n.html(n)),i=e.querySelector("."+n.closeClass);i&&i.addEventListener("click",e=>{((e,t=!1)=>{e&&(e.preventDefault(),t&&e.stopPropagation())})(e,!0),t.close()}),t.dropdown.insertBefore(e,t.dropdown.firstChild)})}),Pe.define("caret_position",function(){var e=this;e.hook("instead","setCaret",t=>{"single"!==e.settings.mode&&e.control.contains(e.control_input)?(t=Math.max(0,Math.min(e.items.length,t)))==e.caretPos||e.isPending||e.controlChildren().forEach((n,i)=>{i{if(!e.isFocused)return;const n=e.getLastActive(t);if(n){const i=((e,t)=>{if(!e)return-1;t=t||e.nodeName;for(var n=0;e=e.previousElementSibling;)e.matches(t)&&n++;return n})(n);e.setCaret(t>0?i+1:i),e.setActiveItem(),((e,...t)=>{var n=Be(t);(e=We(e)).map(e=>{n.map(t=>{e.classList.remove(t)})})})(n,"last-active")}else e.setCaret(e.caretPos+t)})}),Pe.define("dropdown_input",function(){const e=this;e.settings.shouldOpen=!0,e.hook("before","setup",()=>{e.focus_node=e.control,((e,...t)=>{var n=Ze(t);(e=Ge(e)).map(e=>{n.map(t=>{e.classList.add(t)})})})(e.control_input,"dropdown-input");const t=Ue('