diff --git a/CHANGELOG.md b/CHANGELOG.md index 4492dba..fd38249 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,12 @@ All notable changes to Tolk are documented in this file. - **Translate from origin** is a button in the field's header (the book icon) instead of an item in the field's actions menu, so one field takes one click. It asks first only when the field holds text of its own: an empty field, or one that still shows the origin's text, is translated at once. While a translation runs, the buttons are disabled instead of hidden. +### Fixed + +- On Statamic 6.36, which keeps each entry's whole family of localizations in memory for the rest of a request, planning and estimating a run over a large collection kept every entry it had read in memory instead of one batch at a time. Tolk now forgets that cache between batches too. +- On Statamic 6.36, a model select that takes a typed model (in the translation options and the settings, for users who may edit Tolk's settings) no longer opens its list as soon as it gets the keyboard focus. The open list kept taking the focus back, so Tab could not leave the field, and in the translation options Esc closed the whole dialog; the list also covered the options below it. It opens on a click, an arrow key or typing, as before 6.36. +- On Statamic 6.36, the descriptions under the checkboxes of the translation options, **Translate into…** and the site profile's terms are readable in dark mode again. + ## 1.0.0 - 2026-10-15 ### Added diff --git a/TASKS.md b/TASKS.md index e6e50ca..dbb86f3 100644 --- a/TASKS.md +++ b/TASKS.md @@ -2566,3 +2566,5 @@ Owner decision 2026-10-14 (reproduced by failing tests first): a run went on thr Owner decision 2026-10-14 (D5 kept, reproduced by failing tests first): a copy of the origin's text saved over a field Tolk translated (a form that still held it, saved after a run or an automatic update translated the field, or an inherited Bard field set back to inherit that rewrote itself) read manual with an unchanged source, so its item read up to date while the field was in the source language, and nothing pointed to it. `StatusResolver` now flags such a field `FieldStatusInfo::$sameAsOrigin` (manual, a machine record, `T == C` with text; `C` is walked only for those fields), which `needsAttention()` counts, so the item reads **attention** on the Overview, in `tolk:status` and in the origin's list; Translate and Update still leave it alone (D5). `editor/status` sends `same_as_origin` per field, and the banner names the fields ("Title holds the text of the origin again. Translate it, or mark it as up to date to keep it.") with **Translate it** / **Translate them** (`translations.translate()` with `mode: all`, those fields and `overwriteManual`, so a field typed into is still skipped and Undo restores the copy); "Mark manual fields as up to date" writes a baseline, which is no machine record, and clears the flag. §A6 rule 3 and the item status amended; `docs/statuses.md` ("Needs attention", item statuses, "A copy saved over a translation"), `docs/troubleshooting.md`, `docs/editor.md`, `docs/cli.md` (`tolk:baseline`) and the changelog. Tests: `StatusResolverTest` +1 (failed before), `EditorStatusTest` +1 (the payload key; failed before), the pinning test in `TargetTranslatorTest` now expects attention, `statuses.test.js` +1, `EditorBanner.test.js` +2. Owner decision 2026-10-15: the repository is public, so `docs/research/` was removed from every commit with `git filter-repo` before tagging 1.0.0 and is git-ignored; the reports stay in the owner's working copy. The commits of pull requests #1 and #2 still hold it on GitHub until GitHub Support removes them. T11.7 done 2026-10-20: at the owner's request, "Translate from origin" is a quick action, a `dictionary-language-book` icon button in the field's header with the title as tooltip and `aria-label`, disabled instead of hidden while a translation runs (`disabled()`, `BUSY`); `run` asks first only when the form's value has text that is not the origin's (`replacesText()`: `textsOf()` and `sameText()` with `originValues`) and otherwise translates at once (`start()`); Cancel and Esc give the focus back to the header's button with that `aria-label`, and a focus the disabled button lost moves into the banner. Tests: `fieldActions.test.js` 34 (5 new, 4 changed: quick with the icon; disabled, not hidden, in each phase and through a computed; enabled without a base form; at once on '', null, an empty Bard paragraph and the origin's text; asks on the localization's own and on typed text; asks without a base form and reports it; the focus into the banner after a direct translation, back to the button on Cancel), 9 mutations each fail a test; `tests/Browser/field-action.spec.js` (3: the button in the same headers as before and in none of the others, typed title with the confirmation, both buttons disabled during the translation, the untranslated Bard field without a dialog, the focus in the banner after it). Docs: `docs/editor.md`, README, `docs/marketplace-listing.md`, `CHANGELOG.md`; the docs site's editor page, introduction and `field-action` screenshots. Vitest 772 passed, Pest 4,008 passed, Pint clean, `npm run cp:build` committed; browser 69 passed, 4 skipped, 2 failed in `editor-push.spec.js`: "Update translations changes only the edited paragraph" (a Bard image stored wrapped in a paragraph) fails on 1.0.0 too whenever the spec runs after `editor-options.spec.js` and passes alone, and "Translate into…" (the button not disabled after typing) failed only in the full run and passed in four reruns; neither is caused by this task, both left open. Sandbox restored. +Review fix 2026-10-20 (found by CI on the merge of T11.7, which `composer update` ran on Statamic 6.36.0; reproduced locally by updating Statamic first): 6.36 memoizes `Entry::descendants()` per request under `entry-all-descendants-{id}` (statamic/cms#15645), next to `directDescendants()`'s `entry-descendants-{id}`, and `in()` and `existsIn()` read it. `EntryMemo`'s pattern did not know the key, so `RunPlanner` planning and estimating a large collection held every listed family again (`RunPlannerTest`'s two memory tests: 49 and 11 entries alive instead of at most 1). `EntryMemo::KEYS` now matches `entry-(all-)?descendants-`, and `Target::fresh()`'s comment names the key. `StacheRefreshTest` planted only the old key, which 6.36's `existsIn()` no longer reads; it plants both, and so do `RunTranslateTest`'s stale worker, `StateWriterTest`, `EntryFamiliesTest` and `TranslateCommandTest`'s check, so each still holds what it says on 6.35 and 6.36. `ContentWriter::refreshStache()` drops the whole Blink instance and needed no change. `composer.lock` moves to Statamic 6.36.0 (with Laravel 13.38), so the local suite runs what CI and new installs get. Pest 4,008 passed on 6.36; the six changed files pass on 6.35 from the old lock; the planner tests fail again with the old pattern. +Review fix 2026-10-20 (the browser suite on Statamic 6.36.0, six scenarios failing that pass on 6.35.0; each traced in core's diff of the two tags): (1) since statamic/cms#15249 a taggable `Combobox` opens its list when it gains the focus without a pointer from outside it, and the list's `unmount-auto-focus` puts the focus back into the field when the list closes, which opens it again: Tab never leaves the field, and in a `Modal` Esc closes the modal with the list. A Statamic bug, to be reported. In the translation options the list opened over the checkboxes for users who may type a model (the keyboard pass never reached Close, and the click on Overwrite manual edits never landed). `resources/js/combobox.js` `shouldOpenDropdown()`, passed to the three model selects (the options' model and reviewer, the settings' `ModelSelect`), refuses an opening while a `focus` event is dispatched (`globalThis.event`), so the list opens on a click, a key or typing as before; core's prop exists in 6.35 too. 6.36's `Modal` `autofocus` prop was tried and dropped: the trap stays once Tab reaches the field. (2) #14667 dropped the checkbox description's `dark:text-gray-200`, so in dark mode it fails axe's contrast check (another Statamic bug to report): the six checkboxes with a description (the options, Translate into…, the site profile's terms) pass `dark:[&_p]:text-gray-400!` (core's `Description` colour), which core's `Checkbox` merges into its container, keeping its `aria-describedby`. (3) #14336 keeps a disabled quick field action focusable (`aria-disabled`), so after a translation without the confirmation the focus stays on the button instead of moving into the banner: `field-action.spec.js` accepts either, and the comment in `fieldActions.js` says so. (4) #15249 offers typed text as `Add "…"`: `editor-options.spec.js` accepts both wordings; picking it still commits the model. (5) 6.36's build shortens class names, so core's `PipelineStopped` logs as `pq`: `settings.spec.js` reads the name from `__STATAMIC__.savePipeline`. Vitest 775 passed (`combobox.test.js` 3), Pest 4,008 passed, the four specs 23 passed on 6.36; Tab passes through the settings' and the options' model selects with their lists closed, and Arrow Down opens them. diff --git a/composer.lock b/composer.lock index 53dc750..3f0be1f 100644 --- a/composer.lock +++ b/composer.lock @@ -261,16 +261,16 @@ }, { "name": "composer/semver", - "version": "3.5.0", + "version": "3.5.1", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "f7a296f4c4cf8cb8bb83e35d6951a406bb11afa5" + "reference": "528948210cc46f967a4b98e83b19e76f2b504993" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/f7a296f4c4cf8cb8bb83e35d6951a406bb11afa5", - "reference": "f7a296f4c4cf8cb8bb83e35d6951a406bb11afa5", + "url": "https://api.github.com/repos/composer/semver/zipball/528948210cc46f967a4b98e83b19e76f2b504993", + "reference": "528948210cc46f967a4b98e83b19e76f2b504993", "shasum": "" }, "require": { @@ -322,7 +322,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.5.0" + "source": "https://github.com/composer/semver/tree/3.5.1" }, "funding": [ { @@ -334,7 +334,7 @@ "type": "github" } ], - "time": "2026-09-24T14:38:51+00:00" + "time": "2026-10-05T13:12:12+00:00" }, { "name": "dasprid/enum", @@ -676,16 +676,16 @@ }, { "name": "dragonmantank/cron-expression", - "version": "v3.6.0", + "version": "v3.6.1", "source": { "type": "git", "url": "https://github.com/dragonmantank/cron-expression.git", - "reference": "d61a8a9604ec1f8c3d150d09db6ce98b32675013" + "reference": "4189372ffeff09bf14f731f67a9de90c7b413ebe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/d61a8a9604ec1f8c3d150d09db6ce98b32675013", - "reference": "d61a8a9604ec1f8c3d150d09db6ce98b32675013", + "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/4189372ffeff09bf14f731f67a9de90c7b413ebe", + "reference": "4189372ffeff09bf14f731f67a9de90c7b413ebe", "shasum": "" }, "require": { @@ -696,8 +696,8 @@ }, "require-dev": { "phpstan/extension-installer": "^1.4.3", - "phpstan/phpstan": "^1.12.32|^2.1.31", - "phpunit/phpunit": "^8.5.48|^9.0" + "phpstan/phpstan": "^2.1.31", + "phpunit/phpunit": "^11.5.43 || ^12.4" }, "type": "library", "extra": { @@ -728,7 +728,7 @@ ], "support": { "issues": "https://github.com/dragonmantank/cron-expression/issues", - "source": "https://github.com/dragonmantank/cron-expression/tree/v3.6.0" + "source": "https://github.com/dragonmantank/cron-expression/tree/v3.6.1" }, "funding": [ { @@ -736,7 +736,7 @@ "type": "github" } ], - "time": "2025-10-31T18:51:33+00:00" + "time": "2026-10-19T17:53:57+00:00" }, { "name": "egulias/email-validator", @@ -940,22 +940,22 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.15.5", + "version": "7.16.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "ee80339fd9177ba44c49cdb653ff02a4d1106b9a" + "reference": "ffb62ec787050ae4fa9449cdd6b80335db69bda2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ee80339fd9177ba44c49cdb653ff02a4d1106b9a", - "reference": "ee80339fd9177ba44c49cdb653ff02a4d1106b9a", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ffb62ec787050ae4fa9449cdd6b80335db69bda2", + "reference": "ffb62ec787050ae4fa9449cdd6b80335db69bda2", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^2.5.3", - "guzzlehttp/psr7": "^2.13.1", + "guzzlehttp/promises": "^2.6", + "guzzlehttp/psr7": "^2.13.2", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.5 || ^3.0", @@ -1048,7 +1048,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.15.5" + "source": "https://github.com/guzzle/guzzle/tree/7.16.0" }, "funding": [ { @@ -1064,20 +1064,20 @@ "type": "tidelift" } ], - "time": "2026-08-24T09:21:06+00:00" + "time": "2026-10-18T13:38:36+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.5.3", + "version": "2.6.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "cde49999552d185d64715fe9c1f77a2aadd2f9f1" + "reference": "3d88c829bd5f13d13847b39067dbf09a60af2154" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/cde49999552d185d64715fe9c1f77a2aadd2f9f1", - "reference": "cde49999552d185d64715fe9c1f77a2aadd2f9f1", + "url": "https://api.github.com/repos/guzzle/promises/zipball/3d88c829bd5f13d13847b39067dbf09a60af2154", + "reference": "3d88c829bd5f13d13847b39067dbf09a60af2154", "shasum": "" }, "require": { @@ -1132,7 +1132,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.5.3" + "source": "https://github.com/guzzle/promises/tree/2.6.0" }, "funding": [ { @@ -1148,20 +1148,20 @@ "type": "tidelift" } ], - "time": "2026-08-24T09:11:28+00:00" + "time": "2026-10-18T12:46:59+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.13.1", + "version": "2.13.2", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "95e7828100de18b4e269fb1703be530082d5166d" + "reference": "adee536f95101929f262b8c59e8a61472f347d58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/95e7828100de18b4e269fb1703be530082d5166d", - "reference": "95e7828100de18b4e269fb1703be530082d5166d", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/adee536f95101929f262b8c59e8a61472f347d58", + "reference": "adee536f95101929f262b8c59e8a61472f347d58", "shasum": "" }, "require": { @@ -1251,7 +1251,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.13.1" + "source": "https://github.com/guzzle/psr7/tree/2.13.2" }, "funding": [ { @@ -1267,7 +1267,7 @@ "type": "tidelift" } ], - "time": "2026-08-24T09:13:11+00:00" + "time": "2026-10-17T23:49:46+00:00" }, { "name": "guzzlehttp/uri-template", @@ -1497,16 +1497,16 @@ }, { "name": "intervention/image", - "version": "4.3.3", + "version": "4.4.0", "source": { "type": "git", "url": "https://github.com/Intervention/image.git", - "reference": "b25085af6275b94173c4ba43cfc34ae42bd9e8d2" + "reference": "ddf4d8438493b1e5b98c8f95986cdc127c2b752b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Intervention/image/zipball/b25085af6275b94173c4ba43cfc34ae42bd9e8d2", - "reference": "b25085af6275b94173c4ba43cfc34ae42bd9e8d2", + "url": "https://api.github.com/repos/Intervention/image/zipball/ddf4d8438493b1e5b98c8f95986cdc127c2b752b", + "reference": "ddf4d8438493b1e5b98c8f95986cdc127c2b752b", "shasum": "" }, "require": { @@ -1518,7 +1518,8 @@ "intervention/coding-standard": "^1", "mockery/mockery": "^1.6", "phpstan/phpstan": "^2.1", - "phpunit/phpunit": "^12.0" + "phpunit/phpunit": "^12.0", + "psr/http-message": "^2" }, "suggest": { "ext-exif": "Recommended to be able to read EXIF data properly." @@ -1552,7 +1553,7 @@ ], "support": { "issues": "https://github.com/Intervention/image/issues", - "source": "https://github.com/Intervention/image/tree/4.3.3" + "source": "https://github.com/Intervention/image/tree/4.4.0" }, "funding": [ { @@ -1568,7 +1569,7 @@ "type": "ko_fi" } ], - "time": "2026-09-26T06:48:23+00:00" + "time": "2026-10-17T07:53:40+00:00" }, { "name": "james-heinrich/getid3", @@ -1639,16 +1640,16 @@ }, { "name": "laragraph/utils", - "version": "v2.3.1", + "version": "v2.3.2", "source": { "type": "git", "url": "https://github.com/laragraph/utils.git", - "reference": "0c32d90566658ab5a1979b13e8ab6c13b375c91f" + "reference": "de97efc4d493a2eef33786afff7b94df89c7ab5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laragraph/utils/zipball/0c32d90566658ab5a1979b13e8ab6c13b375c91f", - "reference": "0c32d90566658ab5a1979b13e8ab6c13b375c91f", + "url": "https://api.github.com/repos/laragraph/utils/zipball/de97efc4d493a2eef33786afff7b94df89c7ab5d", + "reference": "de97efc4d493a2eef33786afff7b94df89c7ab5d", "shasum": "" }, "require": { @@ -1693,7 +1694,7 @@ "issues": "https://github.com/laragraph/utils/issues", "source": "https://github.com/laragraph/utils" }, - "time": "2026-03-04T07:16:49+00:00" + "time": "2026-10-12T13:34:26+00:00" }, { "name": "laravel/ai", @@ -1778,16 +1779,16 @@ }, { "name": "laravel/framework", - "version": "v13.34.0", + "version": "v13.38.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "c829b4982d29344cbcf1d7ad78eb5d2bb8ae66c4" + "reference": "c42f9abd4a3d2f9a3cd6be109255ddce8092ceb8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/c829b4982d29344cbcf1d7ad78eb5d2bb8ae66c4", - "reference": "c829b4982d29344cbcf1d7ad78eb5d2bb8ae66c4", + "url": "https://api.github.com/repos/laravel/framework/zipball/c42f9abd4a3d2f9a3cd6be109255ddce8092ceb8", + "reference": "c42f9abd4a3d2f9a3cd6be109255ddce8092ceb8", "shasum": "" }, "require": { @@ -1808,7 +1809,7 @@ "guzzlehttp/promises": "^2.0.3 || ^3.0", "guzzlehttp/psr7": "^2.9 || ^3.0", "guzzlehttp/uri-template": "^1.0 || ^2.0", - "laravel/prompts": "^0.3.11", + "laravel/prompts": "^0.3.25", "laravel/serializable-closure": "^2.0.10", "league/commonmark": "^2.8.1", "league/flysystem": "^3.25.1", @@ -1894,7 +1895,7 @@ "aws/aws-sdk-php": "^3.322.9", "ext-gmp": "*", "fakerphp/faker": "^1.24", - "intervention/image": "^4.0", + "intervention/image": "^4.2", "laravel/pint": "^1.18", "league/flysystem-aws-s3-v3": "^3.25.1", "league/flysystem-ftp": "^3.25.1", @@ -1903,10 +1904,10 @@ "league/flysystem-sftp-v3": "^3.25.1", "mockery/mockery": "^1.6.10", "opis/json-schema": "^2.4.1", - "orchestra/testbench-core": "^11.5.0", + "orchestra/testbench-core": "^11.6.0", "pda/pheanstalk": "^7.0.0 || ^8.0.0", "php-http/discovery": "^1.15", - "phpstan/phpstan": "2.2.15", + "phpstan/phpstan": "2.3.1", "phpunit/phpunit": "^11.5.50 || ^12.5.8 || ^13.0.3", "predis/predis": "^2.3 || ^3.0", "rector/rector": "2.6.3", @@ -1933,7 +1934,7 @@ "ext-redis": "Required to use the Redis cache and queue drivers (^4.0 || ^5.0 || ^6.0).", "fakerphp/faker": "Required to generate fake data using the fake() helper (^1.23).", "filp/whoops": "Required for friendly error pages in development (^2.14.3).", - "intervention/image": "Required to use the image processing features (^4.0).", + "intervention/image": "Required to use the image processing features (^4.2).", "laravel/tinker": "Required to use the tinker console command (^2.0).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^3.25.1).", "league/flysystem-ftp": "Required to use the Flysystem FTP driver (^3.25.1).", @@ -2005,20 +2006,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2026-09-29T12:46:21+00:00" + "time": "2026-10-20T10:45:58+00:00" }, { "name": "laravel/prompts", - "version": "v0.3.24", + "version": "v0.3.26", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "5d3cdef29e93ca3b62b1871359db3078cd99908b" + "reference": "2d1e9bf6bab8d3f383c254db7f2b4ea8816d55e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/5d3cdef29e93ca3b62b1871359db3078cd99908b", - "reference": "5d3cdef29e93ca3b62b1871359db3078cd99908b", + "url": "https://api.github.com/repos/laravel/prompts/zipball/2d1e9bf6bab8d3f383c254db7f2b4ea8816d55e0", + "reference": "2d1e9bf6bab8d3f383c254db7f2b4ea8816d55e0", "shasum": "" }, "require": { @@ -2061,10 +2062,9 @@ ], "description": "Add beautiful and user-friendly forms to your command-line applications.", "support": { - "issues": "https://github.com/laravel/prompts/issues", - "source": "https://github.com/laravel/prompts/tree/v0.3.24" + "source": "https://github.com/laravel/prompts/tree/v0.3.26" }, - "time": "2026-08-20T12:55:36+00:00" + "time": "2026-10-09T14:45:13+00:00" }, { "name": "laravel/serializable-closure", @@ -2129,16 +2129,16 @@ }, { "name": "league/commonmark", - "version": "2.10.3", + "version": "2.10.4", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "6efbd9c472b91db0a3350fcd601c8332c2382e1f" + "reference": "40821b7606d8d946bac57dbd2290076c722e3a65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/6efbd9c472b91db0a3350fcd601c8332c2382e1f", - "reference": "6efbd9c472b91db0a3350fcd601c8332c2382e1f", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/40821b7606d8d946bac57dbd2290076c722e3a65", + "reference": "40821b7606d8d946bac57dbd2290076c722e3a65", "shasum": "" }, "require": { @@ -2232,7 +2232,7 @@ "type": "tidelift" } ], - "time": "2026-09-21T13:07:34+00:00" + "time": "2026-10-17T19:59:50+00:00" }, { "name": "league/config", @@ -2541,20 +2541,20 @@ }, { "name": "league/glide", - "version": "4.1.0", + "version": "4.2.0", "source": { "type": "git", "url": "https://github.com/thephpleague/glide.git", - "reference": "54643c4c55ce6dc7f8a11d9c643340051d54c4d9" + "reference": "704e51e1bf4af99a9efd6d3083d7fab41718e8f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/glide/zipball/54643c4c55ce6dc7f8a11d9c643340051d54c4d9", - "reference": "54643c4c55ce6dc7f8a11d9c643340051d54c4d9", + "url": "https://api.github.com/repos/thephpleague/glide/zipball/704e51e1bf4af99a9efd6d3083d7fab41718e8f1", + "reference": "704e51e1bf4af99a9efd6d3083d7fab41718e8f1", "shasum": "" }, "require": { - "intervention/image": "^4.0", + "intervention/image": "^4.2", "league/flysystem": "^3.0", "php": "^8.3", "psr/http-message": "^1.0|^2.0" @@ -2601,9 +2601,9 @@ ], "support": { "issues": "https://github.com/thephpleague/glide/issues", - "source": "https://github.com/thephpleague/glide/tree/4.1.0" + "source": "https://github.com/thephpleague/glide/tree/4.2.0" }, - "time": "2026-07-16T13:53:07+00:00" + "time": "2026-10-10T07:30:54+00:00" }, { "name": "league/mime-type-detection", @@ -2663,20 +2663,21 @@ }, { "name": "league/uri", - "version": "7.8.1", + "version": "7.9.0", "source": { "type": "git", "url": "https://github.com/thephpleague/uri.git", - "reference": "08cf38e3924d4f56238125547b5720496fac8fd4" + "reference": "fcc872a3d872aa13f935e0cd1887b9abb06da07f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri/zipball/08cf38e3924d4f56238125547b5720496fac8fd4", - "reference": "08cf38e3924d4f56238125547b5720496fac8fd4", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/fcc872a3d872aa13f935e0cd1887b9abb06da07f", + "reference": "fcc872a3d872aa13f935e0cd1887b9abb06da07f", "shasum": "" }, "require": { - "league/uri-interfaces": "^7.8.1", + "ext-mbstring": "*", + "league/uri-interfaces": "^7.9.0", "php": "^8.1", "psr/http-factory": "^1" }, @@ -2749,7 +2750,7 @@ "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", "issues": "https://github.com/thephpleague/uri-src/issues", - "source": "https://github.com/thephpleague/uri/tree/7.8.1" + "source": "https://github.com/thephpleague/uri/tree/7.9.0" }, "funding": [ { @@ -2757,20 +2758,20 @@ "type": "github" } ], - "time": "2026-03-15T20:22:25+00:00" + "time": "2026-10-16T15:19:33+00:00" }, { "name": "league/uri-interfaces", - "version": "7.8.1", + "version": "7.9.0", "source": { "type": "git", "url": "https://github.com/thephpleague/uri-interfaces.git", - "reference": "85d5c77c5d6d3af6c54db4a78246364908f3c928" + "reference": "eb5f6d24e6a4fe0a8e9c78ded4eb1dfff1404f58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/85d5c77c5d6d3af6c54db4a78246364908f3c928", - "reference": "85d5c77c5d6d3af6c54db4a78246364908f3c928", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/eb5f6d24e6a4fe0a8e9c78ded4eb1dfff1404f58", + "reference": "eb5f6d24e6a4fe0a8e9c78ded4eb1dfff1404f58", "shasum": "" }, "require": { @@ -2833,7 +2834,7 @@ "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", "issues": "https://github.com/thephpleague/uri-src/issues", - "source": "https://github.com/thephpleague/uri-interfaces/tree/7.8.1" + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.9.0" }, "funding": [ { @@ -2841,7 +2842,7 @@ "type": "github" } ], - "time": "2026-03-08T20:05:35+00:00" + "time": "2026-10-16T15:19:33+00:00" }, { "name": "maennchen/zipstream-php", @@ -3082,16 +3083,16 @@ }, { "name": "nesbot/carbon", - "version": "3.14.2", + "version": "3.15.0", "source": { "type": "git", "url": "https://github.com/CarbonPHP/carbon.git", - "reference": "94cfc34887f07ab5c0efa07914c8f527544e3224" + "reference": "217d38553209bdb44e01590d9e9a2e4df8354cce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/94cfc34887f07ab5c0efa07914c8f527544e3224", - "reference": "94cfc34887f07ab5c0efa07914c8f527544e3224", + "url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/217d38553209bdb44e01590d9e9a2e4df8354cce", + "reference": "217d38553209bdb44e01590d9e9a2e4df8354cce", "shasum": "" }, "require": { @@ -3101,6 +3102,7 @@ "psr/clock": "^1.0", "symfony/clock": "^6.3.12 || ^7.0 || ^8.0", "symfony/polyfill-mbstring": "^1.0", + "symfony/polyfill-time": "^1.0", "symfony/translation": "^4.4.18 || ^5.2.1 || ^6.0 || ^7.0 || ^8.0" }, "provide": { @@ -3183,7 +3185,7 @@ "type": "tidelift" } ], - "time": "2026-10-02T07:26:52+00:00" + "time": "2026-10-18T18:27:53+00:00" }, { "name": "nette/schema", @@ -5150,16 +5152,16 @@ }, { "name": "statamic/cms", - "version": "v6.35.0", + "version": "v6.36.0", "source": { "type": "git", "url": "https://github.com/statamic/cms.git", - "reference": "03a5a9f776b6a514c4215bf35dc5977a5efe068c" + "reference": "6ae4bca7bcbd05e2583c80da88c67bb7c07cac0f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/statamic/cms/zipball/03a5a9f776b6a514c4215bf35dc5977a5efe068c", - "reference": "03a5a9f776b6a514c4215bf35dc5977a5efe068c", + "url": "https://api.github.com/repos/statamic/cms/zipball/6ae4bca7bcbd05e2583c80da88c67bb7c07cac0f", + "reference": "6ae4bca7bcbd05e2583c80da88c67bb7c07cac0f", "shasum": "" }, "require": { @@ -5181,7 +5183,7 @@ "nesbot/carbon": "^3.0", "pragmarx/google2fa": "^8.0 || ^9.0", "rebing/graphql-laravel": "^9.15", - "rhukster/dom-sanitizer": "^1.0.10", + "rhukster/dom-sanitizer": "^1.0.19", "spatie/blink": "^1.3", "spatie/error-solutions": "^1.0 || ^2.0", "statamic/stringy": "^3.1.2", @@ -5203,7 +5205,7 @@ "doctrine/dbal": "^3.6", "fakerphp/faker": "~1.10", "google/cloud-translate": "^1.6", - "larastan/larastan": "^3.10", + "larastan/larastan": "^3.12.3", "laravel/pao": "^1.1", "laravel/pint": "1.16.0", "laravel/socialite": "^5.28", @@ -5258,7 +5260,7 @@ ], "support": { "issues": "https://github.com/statamic/cms/issues", - "source": "https://github.com/statamic/cms/tree/v6.35.0" + "source": "https://github.com/statamic/cms/tree/v6.36.0" }, "funding": [ { @@ -5266,7 +5268,7 @@ "type": "github" } ], - "time": "2026-10-01T20:10:24+00:00" + "time": "2026-10-16T16:29:10+00:00" }, { "name": "statamic/stringy", @@ -5393,16 +5395,16 @@ }, { "name": "symfony/clock", - "version": "v8.1.0", + "version": "v8.1.9", "source": { "type": "git", "url": "https://github.com/symfony/clock.git", - "reference": "701ef4de9705d6c32292ebee5e8044094a09fbf6" + "reference": "945ea3b64d6da9c1c2c354fe5c07b27455df6442" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/clock/zipball/701ef4de9705d6c32292ebee5e8044094a09fbf6", - "reference": "701ef4de9705d6c32292ebee5e8044094a09fbf6", + "url": "https://api.github.com/repos/symfony/clock/zipball/945ea3b64d6da9c1c2c354fe5c07b27455df6442", + "reference": "945ea3b64d6da9c1c2c354fe5c07b27455df6442", "shasum": "" }, "require": { @@ -5446,7 +5448,7 @@ "time" ], "support": { - "source": "https://github.com/symfony/clock/tree/v8.1.0" + "source": "https://github.com/symfony/clock/tree/v8.1.9" }, "funding": [ { @@ -5466,20 +5468,20 @@ "type": "tidelift" } ], - "time": "2026-05-29T05:06:50+00:00" + "time": "2026-10-12T14:32:04+00:00" }, { "name": "symfony/console", - "version": "v8.1.8", + "version": "v8.1.9", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "4b81146e3ee248ea969186f85499b54fbc78db08" + "reference": "630e74196a2635ec0f06c12bd3fb47cfedf85157" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/4b81146e3ee248ea969186f85499b54fbc78db08", - "reference": "4b81146e3ee248ea969186f85499b54fbc78db08", + "url": "https://api.github.com/repos/symfony/console/zipball/630e74196a2635ec0f06c12bd3fb47cfedf85157", + "reference": "630e74196a2635ec0f06c12bd3fb47cfedf85157", "shasum": "" }, "require": { @@ -5546,7 +5548,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v8.1.8" + "source": "https://github.com/symfony/console/tree/v8.1.9" }, "funding": [ { @@ -5566,7 +5568,7 @@ "type": "tidelift" } ], - "time": "2026-09-18T16:00:27+00:00" + "time": "2026-10-12T19:11:16+00:00" }, { "name": "symfony/css-selector", @@ -6025,16 +6027,16 @@ }, { "name": "symfony/http-foundation", - "version": "v8.1.8", + "version": "v8.1.9", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "662f5257658d4f60deff1bc790e9f2c68cb391bf" + "reference": "7850897fb8659f98491b03be79ac48600bdaf9ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/662f5257658d4f60deff1bc790e9f2c68cb391bf", - "reference": "662f5257658d4f60deff1bc790e9f2c68cb391bf", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/7850897fb8659f98491b03be79ac48600bdaf9ab", + "reference": "7850897fb8659f98491b03be79ac48600bdaf9ab", "shasum": "" }, "require": { @@ -6082,7 +6084,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v8.1.8" + "source": "https://github.com/symfony/http-foundation/tree/v8.1.9" }, "funding": [ { @@ -6102,20 +6104,20 @@ "type": "tidelift" } ], - "time": "2026-09-24T07:13:53+00:00" + "time": "2026-10-08T16:57:43+00:00" }, { "name": "symfony/http-kernel", - "version": "v8.1.8", + "version": "v8.1.9", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "51c014e881d8b4ce61e56c0d4105f65b50df786a" + "reference": "55c6935bb4c004a72b55f723e79d5404881dcad3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/51c014e881d8b4ce61e56c0d4105f65b50df786a", - "reference": "51c014e881d8b4ce61e56c0d4105f65b50df786a", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/55c6935bb4c004a72b55f723e79d5404881dcad3", + "reference": "55c6935bb4c004a72b55f723e79d5404881dcad3", "shasum": "" }, "require": { @@ -6192,7 +6194,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/v8.1.8" + "source": "https://github.com/symfony/http-kernel/tree/v8.1.9" }, "funding": [ { @@ -6212,20 +6214,20 @@ "type": "tidelift" } ], - "time": "2026-09-29T14:08:01+00:00" + "time": "2026-10-14T06:47:03+00:00" }, { "name": "symfony/lock", - "version": "v8.1.8", + "version": "v8.1.9", "source": { "type": "git", "url": "https://github.com/symfony/lock.git", - "reference": "a57c18e351998f9964dff24713f7138a01d53703" + "reference": "2b3f8c256882bf6b8d69a0ca1557e9b7c810e548" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/lock/zipball/a57c18e351998f9964dff24713f7138a01d53703", - "reference": "a57c18e351998f9964dff24713f7138a01d53703", + "url": "https://api.github.com/repos/symfony/lock/zipball/2b3f8c256882bf6b8d69a0ca1557e9b7c810e548", + "reference": "2b3f8c256882bf6b8d69a0ca1557e9b7c810e548", "shasum": "" }, "require": { @@ -6274,7 +6276,7 @@ "semaphore" ], "support": { - "source": "https://github.com/symfony/lock/tree/v8.1.8" + "source": "https://github.com/symfony/lock/tree/v8.1.9" }, "funding": [ { @@ -6294,7 +6296,7 @@ "type": "tidelift" } ], - "time": "2026-09-18T16:00:27+00:00" + "time": "2026-10-04T15:24:21+00:00" }, { "name": "symfony/mailer", @@ -6547,16 +6549,16 @@ }, { "name": "symfony/polyfill-deepclone", - "version": "v1.43.0", + "version": "v1.43.2", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-deepclone.git", - "reference": "8db92c5508a3f7f82d8688d32f0a4868a26e58ad" + "reference": "82274308b59f6e96f53a3fb37fc40877d843e5a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-deepclone/zipball/8db92c5508a3f7f82d8688d32f0a4868a26e58ad", - "reference": "8db92c5508a3f7f82d8688d32f0a4868a26e58ad", + "url": "https://api.github.com/repos/symfony/polyfill-deepclone/zipball/82274308b59f6e96f53a3fb37fc40877d843e5a5", + "reference": "82274308b59f6e96f53a3fb37fc40877d843e5a5", "shasum": "" }, "require": { @@ -6610,7 +6612,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-deepclone/tree/v1.43.0" + "source": "https://github.com/symfony/polyfill-deepclone/tree/v1.43.2" }, "funding": [ { @@ -6630,7 +6632,7 @@ "type": "tidelift" } ], - "time": "2026-09-30T09:07:27+00:00" + "time": "2026-10-14T07:17:09+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -7375,6 +7377,89 @@ ], "time": "2026-09-25T15:46:47+00:00" }, + { + "name": "symfony/polyfill-time", + "version": "v1.42.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-time.git", + "reference": "ac9f1ed802dd58f37e720388130c088434aa09fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-time/zipball/ac9f1ed802dd58f37e720388130c088434aa09fc", + "reference": "ac9f1ed802dd58f37e720388130c088434aa09fc", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Time\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Philippe Nyamagana Butera", + "email": "nyamsprod@gmail.com" + }, + { + "name": "Tim Düsterhus", + "email": "tim@tideways-gmbh.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Time API added to PHP 8.6", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "duration", + "polyfill", + "portable", + "shim", + "time" + ], + "support": { + "source": "https://github.com/symfony/polyfill-time/tree/v1.42.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-08-07T13:08:13+00:00" + }, { "name": "symfony/polyfill-uuid", "version": "v1.43.0", @@ -7460,16 +7545,16 @@ }, { "name": "symfony/process", - "version": "v8.1.7", + "version": "v8.1.9", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "10823b09358e690df4ff943e24e8492bb1019fc3" + "reference": "59a682fd049b2d4d37c444f5ac21b7d01b8c7189" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/10823b09358e690df4ff943e24e8492bb1019fc3", - "reference": "10823b09358e690df4ff943e24e8492bb1019fc3", + "url": "https://api.github.com/repos/symfony/process/zipball/59a682fd049b2d4d37c444f5ac21b7d01b8c7189", + "reference": "59a682fd049b2d4d37c444f5ac21b7d01b8c7189", "shasum": "" }, "require": { @@ -7501,7 +7586,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v8.1.7" + "source": "https://github.com/symfony/process/tree/v8.1.9" }, "funding": [ { @@ -7521,7 +7606,7 @@ "type": "tidelift" } ], - "time": "2026-09-02T12:40:29+00:00" + "time": "2026-10-08T16:57:43+00:00" }, { "name": "symfony/property-access", @@ -7692,16 +7777,16 @@ }, { "name": "symfony/routing", - "version": "v8.1.8", + "version": "v8.1.9", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "e46d741c56485441f37104a3e7eace4e17ed91f9" + "reference": "edb06fb6ced3c1faaaed74c1c6c0f176a614c330" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/e46d741c56485441f37104a3e7eace4e17ed91f9", - "reference": "e46d741c56485441f37104a3e7eace4e17ed91f9", + "url": "https://api.github.com/repos/symfony/routing/zipball/edb06fb6ced3c1faaaed74c1c6c0f176a614c330", + "reference": "edb06fb6ced3c1faaaed74c1c6c0f176a614c330", "shasum": "" }, "require": { @@ -7748,7 +7833,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v8.1.8" + "source": "https://github.com/symfony/routing/tree/v8.1.9" }, "funding": [ { @@ -7768,20 +7853,20 @@ "type": "tidelift" } ], - "time": "2026-09-28T19:13:15+00:00" + "time": "2026-10-12T12:37:13+00:00" }, { "name": "symfony/serializer", - "version": "v8.1.8", + "version": "v8.1.9", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "df54c4fe859d945eb633d2c5e6a410ce535f21e4" + "reference": "bc6f84d67225d7a25d56af6d4bd52e9e34997a96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/df54c4fe859d945eb633d2c5e6a410ce535f21e4", - "reference": "df54c4fe859d945eb633d2c5e6a410ce535f21e4", + "url": "https://api.github.com/repos/symfony/serializer/zipball/bc6f84d67225d7a25d56af6d4bd52e9e34997a96", + "reference": "bc6f84d67225d7a25d56af6d4bd52e9e34997a96", "shasum": "" }, "require": { @@ -7847,7 +7932,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/v8.1.8" + "source": "https://github.com/symfony/serializer/tree/v8.1.9" }, "funding": [ { @@ -7867,7 +7952,7 @@ "type": "tidelift" } ], - "time": "2026-09-28T09:40:25+00:00" + "time": "2026-10-12T19:11:16+00:00" }, { "name": "symfony/service-contracts", @@ -7958,16 +8043,16 @@ }, { "name": "symfony/string", - "version": "v8.1.7", + "version": "v8.1.9", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "d950140b5f56f31901e5b7a0c04ffc3a3deb943c" + "reference": "07fb208558f941eab50ec49c89c2a6a93fb11f01" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/d950140b5f56f31901e5b7a0c04ffc3a3deb943c", - "reference": "d950140b5f56f31901e5b7a0c04ffc3a3deb943c", + "url": "https://api.github.com/repos/symfony/string/zipball/07fb208558f941eab50ec49c89c2a6a93fb11f01", + "reference": "07fb208558f941eab50ec49c89c2a6a93fb11f01", "shasum": "" }, "require": { @@ -8024,7 +8109,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v8.1.7" + "source": "https://github.com/symfony/string/tree/v8.1.9" }, "funding": [ { @@ -8044,7 +8129,7 @@ "type": "tidelift" } ], - "time": "2026-09-11T14:51:16+00:00" + "time": "2026-10-03T15:16:03+00:00" }, { "name": "symfony/translation", @@ -8305,16 +8390,16 @@ }, { "name": "symfony/uid", - "version": "v8.1.8", + "version": "v8.1.9", "source": { "type": "git", "url": "https://github.com/symfony/uid.git", - "reference": "f412a0b5edd75eb3104a93bd0d11fd2ea3da34e4" + "reference": "cb487cf30380f0b0b090973bb9c0588193c06685" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/uid/zipball/f412a0b5edd75eb3104a93bd0d11fd2ea3da34e4", - "reference": "f412a0b5edd75eb3104a93bd0d11fd2ea3da34e4", + "url": "https://api.github.com/repos/symfony/uid/zipball/cb487cf30380f0b0b090973bb9c0588193c06685", + "reference": "cb487cf30380f0b0b090973bb9c0588193c06685", "shasum": "" }, "require": { @@ -8359,7 +8444,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/uid/tree/v8.1.8" + "source": "https://github.com/symfony/uid/tree/v8.1.9" }, "funding": [ { @@ -8379,20 +8464,20 @@ "type": "tidelift" } ], - "time": "2026-09-23T17:45:45+00:00" + "time": "2026-10-12T14:32:04+00:00" }, { "name": "symfony/var-dumper", - "version": "v8.1.7", + "version": "v8.1.9", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "741a8c4c948b0bb9bd3653daacd3644c73c40ea5" + "reference": "b8c168c764c09f5d931f290c9dbdd13f1bf142f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/741a8c4c948b0bb9bd3653daacd3644c73c40ea5", - "reference": "741a8c4c948b0bb9bd3653daacd3644c73c40ea5", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/b8c168c764c09f5d931f290c9dbdd13f1bf142f3", + "reference": "b8c168c764c09f5d931f290c9dbdd13f1bf142f3", "shasum": "" }, "require": { @@ -8446,7 +8531,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v8.1.7" + "source": "https://github.com/symfony/var-dumper/tree/v8.1.9" }, "funding": [ { @@ -8466,26 +8551,26 @@ "type": "tidelift" } ], - "time": "2026-09-03T16:02:27+00:00" + "time": "2026-10-13T05:48:51+00:00" }, { "name": "symfony/var-exporter", - "version": "v8.1.6", + "version": "v8.1.9", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "802362f41128c430fd6685491e1fb72127fae78a" + "reference": "3717217839a76f6fa284931a224c4cada514da2a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/802362f41128c430fd6685491e1fb72127fae78a", - "reference": "802362f41128c430fd6685491e1fb72127fae78a", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/3717217839a76f6fa284931a224c4cada514da2a", + "reference": "3717217839a76f6fa284931a224c4cada514da2a", "shasum": "" }, "require": { "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/polyfill-deepclone": "^1.40" + "symfony/polyfill-deepclone": "^1.43.1" }, "require-dev": { "symfony/property-access": "^7.4|^8.0", @@ -8529,7 +8614,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v8.1.6" + "source": "https://github.com/symfony/var-exporter/tree/v8.1.9" }, "funding": [ { @@ -8549,20 +8634,20 @@ "type": "tidelift" } ], - "time": "2026-08-29T06:30:03+00:00" + "time": "2026-10-07T07:28:40+00:00" }, { "name": "symfony/yaml", - "version": "v8.1.8", + "version": "v8.1.9", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "030e96eed0303223bfca3af9109e9e64830b6ec3" + "reference": "6107ee26a25215c3df3af0a3315e56bb4fd0b7db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/030e96eed0303223bfca3af9109e9e64830b6ec3", - "reference": "030e96eed0303223bfca3af9109e9e64830b6ec3", + "url": "https://api.github.com/repos/symfony/yaml/zipball/6107ee26a25215c3df3af0a3315e56bb4fd0b7db", + "reference": "6107ee26a25215c3df3af0a3315e56bb4fd0b7db", "shasum": "" }, "require": { @@ -8605,7 +8690,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v8.1.8" + "source": "https://github.com/symfony/yaml/tree/v8.1.9" }, "funding": [ { @@ -8625,7 +8710,7 @@ "type": "tidelift" } ], - "time": "2026-09-26T06:33:49+00:00" + "time": "2026-10-12T12:37:13+00:00" }, { "name": "thecodingmachine/safe", @@ -8827,16 +8912,16 @@ }, { "name": "ueberdosis/tiptap-php", - "version": "2.2.0", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/ueberdosis/tiptap-php.git", - "reference": "5a2e8155c5b09c9ad4efd480550270a6924865b9" + "reference": "242a7a150c1233a01622e050152699382fb20bea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ueberdosis/tiptap-php/zipball/5a2e8155c5b09c9ad4efd480550270a6924865b9", - "reference": "5a2e8155c5b09c9ad4efd480550270a6924865b9", + "url": "https://api.github.com/repos/ueberdosis/tiptap-php/zipball/242a7a150c1233a01622e050152699382fb20bea", + "reference": "242a7a150c1233a01622e050152699382fb20bea", "shasum": "" }, "require": { @@ -8876,7 +8961,7 @@ ], "support": { "issues": "https://github.com/ueberdosis/tiptap-php/issues", - "source": "https://github.com/ueberdosis/tiptap-php/tree/2.2.0" + "source": "https://github.com/ueberdosis/tiptap-php/tree/2.2.1" }, "funding": [ { @@ -8892,19 +8977,19 @@ "type": "open_collective" } ], - "time": "2026-08-31T07:00:09+00:00" + "time": "2026-10-19T10:48:00+00:00" }, { "name": "vlucas/phpdotenv", "version": "v5.7.0", "source": { "type": "git", - "url": "https://github.com/vlucas/phpdotenv.git", + "url": "https://github.com/phpdotenv/phpdotenv.git", "reference": "301c07936b16d88628b126b01d082ba153cf4c40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/301c07936b16d88628b126b01d082ba153cf4c40", + "url": "https://api.github.com/repos/phpdotenv/phpdotenv/zipball/301c07936b16d88628b126b01d082ba153cf4c40", "reference": "301c07936b16d88628b126b01d082ba153cf4c40", "shasum": "" }, @@ -9215,16 +9300,16 @@ }, { "name": "webmozart/assert", - "version": "2.4.1", + "version": "2.5.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "2ccb7c2e821038c03a3e6e1700c570c158c55f70" + "reference": "8a163706bbcac613733dba03f51e13b5eb1bb819" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/2ccb7c2e821038c03a3e6e1700c570c158c55f70", - "reference": "2ccb7c2e821038c03a3e6e1700c570c158c55f70", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/8a163706bbcac613733dba03f51e13b5eb1bb819", + "reference": "8a163706bbcac613733dba03f51e13b5eb1bb819", "shasum": "" }, "require": { @@ -9275,22 +9360,22 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/2.4.1" + "source": "https://github.com/webmozarts/assert/tree/2.5.0" }, - "time": "2026-06-15T15:31:57+00:00" + "time": "2026-10-05T23:14:19+00:00" }, { "name": "webonyx/graphql-php", - "version": "v15.37.2", + "version": "v15.38.1", "source": { "type": "git", "url": "https://github.com/webonyx/graphql-php.git", - "reference": "f2a5d802213eb231d17a21badbda22b01435f177" + "reference": "32edc67af119b709d020f93447729afd503fe56a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/f2a5d802213eb231d17a21badbda22b01435f177", - "reference": "f2a5d802213eb231d17a21badbda22b01435f177", + "url": "https://api.github.com/repos/webonyx/graphql-php/zipball/32edc67af119b709d020f93447729afd503fe56a", + "reference": "32edc67af119b709d020f93447729afd503fe56a", "shasum": "" }, "require": { @@ -9303,13 +9388,13 @@ "amphp/http-server": "^2.1 || ^3", "dms/phpunit-arraysubset-asserts": "dev-master", "ergebnis/composer-normalize": "^2.28", - "friendsofphp/php-cs-fixer": "3.95.18", + "friendsofphp/php-cs-fixer": "3.95.27", "mll-lab/php-cs-fixer-config": "5.13.0", "nyholm/psr7": "^1.5", "phpbench/phpbench": "^1.2", "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "2.2.8", - "phpstan/phpstan-phpunit": "2.0.18", + "phpstan/phpstan": "2.2.17", + "phpstan/phpstan-phpunit": "2.0.21", "phpstan/phpstan-strict-rules": "2.0.12", "phpunit/phpunit": "^9.5 || ^10.5.21 || ^11", "psr/http-message": "^1 || ^2", @@ -9345,7 +9430,7 @@ ], "support": { "issues": "https://github.com/webonyx/graphql-php/issues", - "source": "https://github.com/webonyx/graphql-php/tree/v15.37.2" + "source": "https://github.com/webonyx/graphql-php/tree/v15.38.1" }, "funding": [ { @@ -9357,7 +9442,7 @@ "type": "open_collective" } ], - "time": "2026-08-14T06:29:42+00:00" + "time": "2026-10-12T14:31:33+00:00" }, { "name": "wilderborn/partyline", diff --git a/resources/dist/build/assets/cp-DwecAxz4.css b/resources/dist/build/assets/cp-Bpgkw0bR.css similarity index 89% rename from resources/dist/build/assets/cp-DwecAxz4.css rename to resources/dist/build/assets/cp-Bpgkw0bR.css index ea51330..0ea8743 100644 --- a/resources/dist/build/assets/cp-DwecAxz4.css +++ b/resources/dist/build/assets/cp-Bpgkw0bR.css @@ -1,2 +1,2 @@ /*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */ -@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial}}}@layer addon-theme{:root,:host{--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-100:oklch(93.6% .032 17.717);--color-red-600:oklch(57.7% .245 27.325);--color-red-900:oklch(39.6% .141 25.723);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-900:oklch(41.4% .112 45.904);--color-green-100:oklch(96.2% .044 156.743);--color-green-300:oklch(87.1% .15 154.449);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-900:oklch(39.3% .095 152.535);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-600:oklch(54.6% .245 262.881);--color-gray-300:var(--theme-color-gray-300);--color-gray-700:var(--theme-color-gray-700);--spacing:.25rem;--text-xs:.825rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--radius-sm:.25rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--max-width-page:85rem}}@layer addon-utilities{.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.fixed{position:fixed}.static{position:static}.col-span-3{grid-column:span 3/span 3}.\!container{width:100%!important}@media (width>=15rem){.\!container{max-width:15rem!important}}@media (width>=20rem){.\!container{max-width:20rem!important}}@media (width>=30rem){.\!container{max-width:30rem!important}}@media (width>=40rem){.\!container{max-width:40rem!important}}@media (width>=48rem){.\!container{max-width:48rem!important}}@media (width>=64rem){.\!container{max-width:64rem!important}}@media (width>=80rem){.\!container{max-width:80rem!important}}@media (width>=96rem){.\!container{max-width:96rem!important}}@media (width>=120rem){.\!container{max-width:120rem!important}}.container{width:100%}@media (width>=15rem){.container{max-width:15rem}}@media (width>=20rem){.container{max-width:20rem}}@media (width>=30rem){.container{max-width:30rem}}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}@media (width>=120rem){.container{max-width:120rem}}.mx-auto{margin-inline:auto}.ms-6{margin-inline-start:calc(var(--spacing) * 6)}.ms-auto{margin-inline-start:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-full{height:100%}.w-56{width:calc(var(--spacing) * 56)}.w-full{width:100%}.max-w-page{max-width:var(--max-width-page)}.shrink-0{flex-shrink:0}.list-disc{list-style-type:disc}.grid-cols-\[auto_1fr\]{grid-template-columns:auto 1fr}.grid-cols-\[auto_auto_minmax\(0\,1fr\)\]{grid-template-columns:auto auto minmax(0,1fr)}.grid-cols-subgrid{grid-template-columns:subgrid}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-end{justify-content:flex-end}.gap-1{gap:var(--spacing)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-x-10{column-gap:calc(var(--spacing) * 10)}.gap-y-1{row-gap:var(--spacing)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-gray-200>:not(:last-child)){border-color:var(--theme-color-gray-200)}.self-start{align-self:flex-start}.justify-self-start{justify-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-gray-200{border-color:var(--theme-color-gray-200)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-gray-50{background-color:var(--theme-color-gray-50)}.bg-gray-200{background-color:var(--theme-color-gray-200)}.bg-green-100{background-color:var(--color-green-100)}.bg-red-100{background-color:var(--color-red-100)}.p-3{padding:calc(var(--spacing) * 3)}.py-3{padding-block:calc(var(--spacing) * 3)}.ps-5{padding-inline-start:calc(var(--spacing) * 5)}.ps-6{padding-inline-start:calc(var(--spacing) * 6)}.pt-1{padding-top:var(--spacing)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pb-1{padding-bottom:var(--spacing)}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-600{color:var(--color-amber-600)}.text-blue-600{color:var(--color-blue-600)}.text-gray-500{color:var(--theme-color-gray-500)}.text-gray-600{color:var(--theme-color-gray-600)}.text-green-600{color:var(--color-green-600)}.text-green-900{color:var(--color-green-900)}.text-red-600{color:var(--color-red-600)}.text-red-900{color:var(--color-red-900)}.lowercase{text-transform:lowercase}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.decoration-green-700\/60{text-decoration-color:#00813899}@supports (color:color-mix(in lab, red, red)){.decoration-green-700\/60{-webkit-text-decoration-color:color-mix(in oklab, var(--color-green-700) 60%, transparent);-webkit-text-decoration-color:color-mix(in oklab, var(--color-green-700) 60%, transparent);-webkit-text-decoration-color:color-mix(in oklab, var(--color-green-700) 60%, transparent);text-decoration-color:color-mix(in oklab, var(--color-green-700) 60%, transparent)}}.opacity-50{opacity:.5}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition-\[width\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.first\:pt-0:first-child{padding-top:0}.last\:pb-0:last-child{padding-bottom:0}@media (hover:hover){.hover\:text-gray-900:hover{color:var(--theme-color-gray-900)}.hover\:underline:hover{text-decoration-line:underline}}@media (width>=40rem){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:gap-4{gap:calc(var(--spacing) * 4)}.sm\:self-auto{align-self:auto}}@media (width>=64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}:where(.dark\:divide-gray-700:where(.dark,.dark *)>:not(:last-child)),.dark\:border-gray-700:where(.dark,.dark *){border-color:var(--theme-color-gray-700)}.dark\:bg-amber-900\/40\!:where(.dark,.dark *){background-color:#7b330666!important}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-900\/40\!:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-amber-900) 40%, transparent)!important}}.dark\:bg-blue-400\!:where(.dark,.dark *){background-color:var(--color-blue-400)!important}.dark\:bg-gray-700:where(.dark,.dark *){background-color:var(--theme-color-gray-700)}.dark\:bg-gray-900:where(.dark,.dark *){background-color:var(--theme-color-gray-900)}.dark\:bg-green-900\/40\!:where(.dark,.dark *){background-color:#0d542b66!important}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-900\/40\!:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-green-900) 40%, transparent)!important}}.dark\:bg-red-900\/40\!:where(.dark,.dark *){background-color:#82181a66!important}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-900\/40\!:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-red-900) 40%, transparent)!important}}.dark\:text-blue-400:where(.dark,.dark *){color:var(--color-blue-400)}.dark\:text-gray-400:where(.dark,.dark *){color:var(--theme-color-gray-400)}.dark\:text-green-100:where(.dark,.dark *){color:var(--color-green-100)}.dark\:text-red-100:where(.dark,.dark *){color:var(--color-red-100)}.dark\:decoration-green-300\/60:where(.dark,.dark *){text-decoration-color:#7bf1a899}@supports (color:color-mix(in lab, red, red)){.dark\:decoration-green-300\/60:where(.dark,.dark *){-webkit-text-decoration-color:color-mix(in oklab, var(--color-green-300) 60%, transparent);-webkit-text-decoration-color:color-mix(in oklab, var(--color-green-300) 60%, transparent);-webkit-text-decoration-color:color-mix(in oklab, var(--color-green-300) 60%, transparent);text-decoration-color:color-mix(in oklab, var(--color-green-300) 60%, transparent)}}@media (hover:hover){.dark\:hover\:text-gray-200:where(.dark,.dark *):hover{color:var(--theme-color-gray-200)}}}:root{--animation-timing-function-fast-out-slow-in:cubic-bezier(.4,0,.2,1);--color-button-active:hsl(from var(--color-gray-300) h s l / .45)}.dark{--color-button-active:hsl(from var(--color-gray-700) h s l / .45)}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false} +@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial}}}@layer addon-theme{:root,:host{--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-100:oklch(93.6% .032 17.717);--color-red-600:oklch(57.7% .245 27.325);--color-red-900:oklch(39.6% .141 25.723);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-600:oklch(66.6% .179 58.318);--color-amber-900:oklch(41.4% .112 45.904);--color-green-100:oklch(96.2% .044 156.743);--color-green-300:oklch(87.1% .15 154.449);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-900:oklch(39.3% .095 152.535);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-600:oklch(54.6% .245 262.881);--color-gray-300:var(--theme-color-gray-300);--color-gray-700:var(--theme-color-gray-700);--spacing:.25rem;--text-xs:.825rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--radius-sm:.25rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--max-width-page:85rem}}@layer addon-utilities{.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.fixed{position:fixed}.static{position:static}.col-span-3{grid-column:span 3/span 3}.\!container{width:100%!important}@media (width>=15rem){.\!container{max-width:15rem!important}}@media (width>=20rem){.\!container{max-width:20rem!important}}@media (width>=30rem){.\!container{max-width:30rem!important}}@media (width>=40rem){.\!container{max-width:40rem!important}}@media (width>=48rem){.\!container{max-width:48rem!important}}@media (width>=64rem){.\!container{max-width:64rem!important}}@media (width>=80rem){.\!container{max-width:80rem!important}}@media (width>=96rem){.\!container{max-width:96rem!important}}@media (width>=120rem){.\!container{max-width:120rem!important}}.container{width:100%}@media (width>=15rem){.container{max-width:15rem}}@media (width>=20rem){.container{max-width:20rem}}@media (width>=30rem){.container{max-width:30rem}}@media (width>=40rem){.container{max-width:40rem}}@media (width>=48rem){.container{max-width:48rem}}@media (width>=64rem){.container{max-width:64rem}}@media (width>=80rem){.container{max-width:80rem}}@media (width>=96rem){.container{max-width:96rem}}@media (width>=120rem){.container{max-width:120rem}}.mx-auto{margin-inline:auto}.ms-6{margin-inline-start:calc(var(--spacing) * 6)}.ms-auto{margin-inline-start:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-full{height:100%}.w-56{width:calc(var(--spacing) * 56)}.w-full{width:100%}.max-w-page{max-width:var(--max-width-page)}.shrink-0{flex-shrink:0}.list-disc{list-style-type:disc}.grid-cols-\[auto_1fr\]{grid-template-columns:auto 1fr}.grid-cols-\[auto_auto_minmax\(0\,1fr\)\]{grid-template-columns:auto auto minmax(0,1fr)}.grid-cols-subgrid{grid-template-columns:subgrid}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-end{justify-content:flex-end}.gap-1{gap:var(--spacing)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-x-10{column-gap:calc(var(--spacing) * 10)}.gap-y-1{row-gap:var(--spacing)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-gray-200>:not(:last-child)){border-color:var(--theme-color-gray-200)}.self-start{align-self:flex-start}.justify-self-start{justify-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-gray-200{border-color:var(--theme-color-gray-200)}.bg-amber-100{background-color:var(--color-amber-100)}.bg-blue-600{background-color:var(--color-blue-600)}.bg-gray-50{background-color:var(--theme-color-gray-50)}.bg-gray-200{background-color:var(--theme-color-gray-200)}.bg-green-100{background-color:var(--color-green-100)}.bg-red-100{background-color:var(--color-red-100)}.p-3{padding:calc(var(--spacing) * 3)}.py-3{padding-block:calc(var(--spacing) * 3)}.ps-5{padding-inline-start:calc(var(--spacing) * 5)}.ps-6{padding-inline-start:calc(var(--spacing) * 6)}.pt-1{padding-top:var(--spacing)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pb-1{padding-bottom:var(--spacing)}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-600{color:var(--color-amber-600)}.text-blue-600{color:var(--color-blue-600)}.text-gray-500{color:var(--theme-color-gray-500)}.text-gray-600{color:var(--theme-color-gray-600)}.text-green-600{color:var(--color-green-600)}.text-green-900{color:var(--color-green-900)}.text-red-600{color:var(--color-red-600)}.text-red-900{color:var(--color-red-900)}.lowercase{text-transform:lowercase}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.decoration-green-700\/60{text-decoration-color:#00813899}@supports (color:color-mix(in lab, red, red)){.decoration-green-700\/60{-webkit-text-decoration-color:color-mix(in oklab, var(--color-green-700) 60%, transparent);-webkit-text-decoration-color:color-mix(in oklab, var(--color-green-700) 60%, transparent);-webkit-text-decoration-color:color-mix(in oklab, var(--color-green-700) 60%, transparent);text-decoration-color:color-mix(in oklab, var(--color-green-700) 60%, transparent)}}.opacity-50{opacity:.5}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition-\[width\]{transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.first\:pt-0:first-child{padding-top:0}.last\:pb-0:last-child{padding-bottom:0}@media (hover:hover){.hover\:text-gray-900:hover{color:var(--theme-color-gray-900)}.hover\:underline:hover{text-decoration-line:underline}}@media (width>=40rem){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:gap-4{gap:calc(var(--spacing) * 4)}.sm\:self-auto{align-self:auto}}@media (width>=64rem){.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}:where(.dark\:divide-gray-700:where(.dark,.dark *)>:not(:last-child)),.dark\:border-gray-700:where(.dark,.dark *){border-color:var(--theme-color-gray-700)}.dark\:bg-amber-900\/40\!:where(.dark,.dark *){background-color:#7b330666!important}@supports (color:color-mix(in lab, red, red)){.dark\:bg-amber-900\/40\!:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-amber-900) 40%, transparent)!important}}.dark\:bg-blue-400\!:where(.dark,.dark *){background-color:var(--color-blue-400)!important}.dark\:bg-gray-700:where(.dark,.dark *){background-color:var(--theme-color-gray-700)}.dark\:bg-gray-900:where(.dark,.dark *){background-color:var(--theme-color-gray-900)}.dark\:bg-green-900\/40\!:where(.dark,.dark *){background-color:#0d542b66!important}@supports (color:color-mix(in lab, red, red)){.dark\:bg-green-900\/40\!:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-green-900) 40%, transparent)!important}}.dark\:bg-red-900\/40\!:where(.dark,.dark *){background-color:#82181a66!important}@supports (color:color-mix(in lab, red, red)){.dark\:bg-red-900\/40\!:where(.dark,.dark *){background-color:color-mix(in oklab, var(--color-red-900) 40%, transparent)!important}}.dark\:text-blue-400:where(.dark,.dark *){color:var(--color-blue-400)}.dark\:text-gray-400:where(.dark,.dark *){color:var(--theme-color-gray-400)}.dark\:text-green-100:where(.dark,.dark *){color:var(--color-green-100)}.dark\:text-red-100:where(.dark,.dark *){color:var(--color-red-100)}.dark\:decoration-green-300\/60:where(.dark,.dark *){text-decoration-color:#7bf1a899}@supports (color:color-mix(in lab, red, red)){.dark\:decoration-green-300\/60:where(.dark,.dark *){-webkit-text-decoration-color:color-mix(in oklab, var(--color-green-300) 60%, transparent);-webkit-text-decoration-color:color-mix(in oklab, var(--color-green-300) 60%, transparent);-webkit-text-decoration-color:color-mix(in oklab, var(--color-green-300) 60%, transparent);text-decoration-color:color-mix(in oklab, var(--color-green-300) 60%, transparent)}}@media (hover:hover){.dark\:hover\:text-gray-200:where(.dark,.dark *):hover{color:var(--theme-color-gray-200)}}.dark\:\[\&_p\]\:text-gray-400\!:where(.dark,.dark *) p{color:var(--theme-color-gray-400)!important}}:root{--animation-timing-function-fast-out-slow-in:cubic-bezier(.4,0,.2,1);--color-button-active:hsl(from var(--color-gray-300) h s l / .45)}.dark{--color-button-active:hsl(from var(--color-gray-700) h s l / .45)}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false} diff --git a/resources/dist/build/assets/cp-C2SnXUZQ.js b/resources/dist/build/assets/cp-C2SnXUZQ.js new file mode 100644 index 0000000..5e63572 --- /dev/null +++ b/resources/dist/build/assets/cp-C2SnXUZQ.js @@ -0,0 +1,2 @@ +var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},{AfterSaveHooks:n,BeforeSaveHooks:r,Pipeline:i,PipelineStopped:a,Request:o}=__STATAMIC__.savePipeline,{BaseTransition:s,BaseTransitionPropsValidators:c,Comment:l,DeprecationTypes:u,EffectScope:d,ErrorCodes:f,ErrorTypeStrings:p,Fragment:m,KeepAlive:h,ReactiveEffect:g,Static:_,Suspense:v,Teleport:y,Text:b,TrackOpTypes:x,Transition:S,TransitionGroup:C,TriggerOpTypes:w,VueElement:ee,__esModule:T,assertNumber:E,callWithAsyncErrorHandling:te,callWithErrorHandling:D,camelize:ne,capitalize:re,cloneVNode:ie,compatUtils:ae,compile:oe,computed:O,createApp:se,createBlock:k,createCommentVNode:A,createElementBlock:j,createElementVNode:M,createHydrationRenderer:ce,createPropsRestProxy:le,createRenderer:ue,createSSRApp:de,createSlots:fe,createStaticVNode:pe,createTextVNode:N,createVNode:P,customRef:me,defineAsyncComponent:he,defineComponent:ge,defineCustomElement:_e,defineEmits:ve,defineExpose:ye,defineModel:be,defineOptions:xe,defineProps:Se,defineSSRCustomElement:Ce,defineSlots:we,devtools:Te,effect:Ee,effectScope:De,getCurrentInstance:Oe,getCurrentScope:ke,getCurrentWatcher:Ae,getTransitionRawChildren:je,guardReactiveProps:Me,h:Ne,handleError:Pe,hasInjectionContext:Fe,hydrate:Ie,hydrateOnIdle:Le,hydrateOnInteraction:Re,hydrateOnMediaQuery:ze,hydrateOnVisible:Be,initCustomFormatter:Ve,initDirectivesForSSR:He,inject:Ue,isMemoSame:We,isProxy:Ge,isReactive:Ke,isReadonly:qe,isRef:Je,isRuntimeOnly:Ye,isShallow:Xe,isVNode:Ze,markRaw:Qe,mergeDefaults:$e,mergeModels:et,mergeProps:tt,nextTick:nt,nodeOps:rt,normalizeClass:it,normalizeProps:at,normalizeStyle:ot,onActivated:st,onBeforeMount:ct,onBeforeUnmount:lt,onBeforeUpdate:ut,onDeactivated:dt,onErrorCaptured:ft,onMounted:pt,onRenderTracked:mt,onRenderTriggered:ht,onScopeDispose:gt,onServerPrefetch:_t,onUnmounted:vt,onUpdated:yt,onWatcherCleanup:bt,openBlock:F,patchProp:xt,popScopeId:St,provide:Ct,proxyRefs:wt,pushScopeId:Tt,queuePostFlushCb:Et,reactive:Dt,readonly:Ot,ref:I,registerRuntimeCompiler:kt,render:At,renderList:L,renderSlot:jt,resolveComponent:Mt,resolveDirective:Nt,resolveDynamicComponent:Pt,resolveFilter:Ft,resolveTransitionHooks:It,setBlockTracking:Lt,setDevtoolsHook:Rt,setTransitionHooks:zt,shallowReactive:Bt,shallowReadonly:Vt,shallowRef:Ht,ssrContextKey:Ut,ssrUtils:Wt,stop:Gt,toDisplayString:R,toHandlerKey:Kt,toHandlers:qt,toRaw:Jt,toRef:Yt,toRefs:Xt,toValue:Zt,transformVNodeArgs:Qt,triggerRef:$t,unref:z,useAttrs:en,useCssModule:tn,useCssVars:nn,useHost:rn,useId:an,useModel:on,useSSRContext:sn,useShadowRoot:cn,useSlots:ln,useTemplateRef:un,useTransitionState:dn,vModelCheckbox:fn,vModelDynamic:pn,vModelRadio:mn,vModelSelect:hn,vModelText:gn,vShow:_n,version:vn,warn:yn,watch:bn,watchEffect:xn,watchPostEffect:Sn,watchSyncEffect:Cn,withAsyncContext:wn,withCtx:B,withDefaults:Tn,withDirectives:En,withKeys:Dn,withMemo:On,withModifiers:kn,withScopeId:An}=window.Vue,{Alert:jn,AuthCard:Mn,AutocompleteEditor:Nn,Avatar:Pn,Badge:Fn,Button:V,ButtonGroup:In,Calendar:Ln,Card:H,CardList:Rn,CardListItem:zn,CardPanel:Bn,CharacterCounter:Vn,Checkbox:Hn,CheckboxGroup:Un,CodeEditor:Wn,Combobox:Gn,CommandPaletteItem:Kn,ConfirmationModal:qn,ContentDirection:Jn,useContentDirection:Yn,useUiDirection:Xn,Context:Zn,ContextFooter:Qn,ContextHeader:$n,ContextItem:er,ContextLabel:tr,ContextMenu:nr,ContextSeparator:rr,CreateForm:ir,DatePicker:ar,DateRangePicker:or,Description:U,DocsCallout:sr,DragHandle:cr,Dropdown:lr,DropdownItem:ur,DropdownLabel:dr,DropdownMenu:fr,DropdownSeparator:pr,DropdownFooter:mr,DropdownHeader:hr,Editable:gr,ErrorMessage:_r,EmptyStateItem:vr,EmptyStateMenu:yr,Field:br,Header:xr,Heading:W,HoverCard:Sr,Icon:Cr,Input:wr,InputGroup:Tr,InputGroupAppend:Er,InputGroupPrepend:Dr,Label:Or,Listing:kr,ListingCustomizeColumns:Ar,ListingFilters:jr,ListingHeaderCell:Mr,ListingPagination:Nr,ListingPresets:Pr,ListingPresetTrigger:Fr,ListingRowActions:Ir,ListingSearch:Lr,ListingTable:Rr,ListingTableBody:zr,ListingTableHead:Br,ListingToggleAll:Vr,LivePreview:Hr,LivePreviewPopout:Ur,MiddleEllipsis:Wr,Modal:Gr,ModalClose:Kr,ModalTitle:qr,Pagination:Jr,Panel:Yr,PanelFooter:Xr,PanelHeader:Zr,Popover:Qr,PublishComponents:$r,PublishContainer:ei,publishContextKey:ti,injectPublishContext:ni,PublishField:ri,PublishFields:ii,PublishFieldsProvider:ai,PublishForm:oi,PublishLocalizations:si,PublishSections:ci,PublishTabs:li,Radio:ui,RadioGroup:di,Select:fi,Separator:pi,Slider:mi,Skeleton:hi,SplitterGroup:gi,SplitterPanel:_i,SplitterResizeHandle:vi,StatusIndicator:yi,Subheading:bi,Switch:xi,TabContent:Si,Stack:Ci,StackClose:wi,StackHeader:Ti,StackFooter:Ei,StackContent:Di,Table:Oi,TableCell:G,TableColumn:K,TableColumns:ki,TableRow:Ai,TableRows:ji,TabList:Mi,TabProvider:Ni,Tabs:Pi,TabTrigger:Fi,Text:q,Textarea:Ii,TimePicker:Li,TimezoneHoverCard:Ri,Timezones:zi,ToggleGroup:Bi,ToggleItem:Vi,Widget:Hi,registerIconSet:Ui,registerIconSetFromStrings:Wi}=__STATAMIC__.ui,Gi=/(<\/?\d+>|||\s+)/,Ki=/^(?:<\/?\d+>||)$/,qi=/^\s+$/;function Ji(e){return String(e??``).split(Gi).filter(e=>e!==``).map(e=>({text:e,kind:qi.test(e)?`space`:Ki.test(e)?`placeholder`:`word`}))}function Yi(e,t){let n=new Set,r=new Set;if(e.length*t.length>25e4)return[n,r];let i=t.length+1,a=new Uint32Array((e.length+1)*i);for(let n=e.length-1;n>=0;n--)for(let r=t.length-1;r>=0;r--)a[n*i+r]=e[n]===t[r]?a[(n+1)*i+r+1]+1:Math.max(a[(n+1)*i+r],a[n*i+r+1]);for(let o=0,s=0;o=a[o*i+s+1]?o++:s++;return[n,r]}function Xi(e,t){let n=0,r=e.map(e=>({...e,changed:e.kind!==`space`&&!t.has(n++)}));return r.forEach((e,t)=>{e.kind===`space`&&(e.changed=!!(r[t-1]?.changed&&r[t+1]?.changed))}),r}function Zi(e,t){let n=Ji(e),r=Ji(t),i=e=>e.filter(e=>e.kind!==`space`).map(e=>e.text),[a,o]=Yi(i(n),i(r));return{before:Xi(n,a),after:Xi(r,o)}}var J=t({ApiError:()=>Qi,asMap:()=>Y,get:()=>$i,normalizeError:()=>ra,post:()=>ea}),Qi=class extends Error{constructor({status:e,code:t,message:n,data:r}){super(n),this.name=`ApiError`,this.status=e,this.code=t,this.data=r}};function Y(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function $i(e,t={}){return na(`get`,e,{params:t})}function ea(e,t={}){return na(`post`,e,t)}function ta(){return Statamic.$app.config.globalProperties.$axios}async function na(e,t,n){let r=ta(),i=/^https?:\/\//i.test(t)?t:cp_url(`tolk/${t.replace(/^\/+/,``)}`);try{return(await r[e](i,n)).data}catch(e){throw ra(e)}}function ra(e){let t=e?.response,n=t?.data!==null&&typeof t?.data==`object`?t.data:null,r=t?.status??0;return new Qi({status:r,code:typeof n?.code==`string`?n.code:null,message:typeof n?.message==`string`&&n.message!==``?n.message:ia(r),data:n})}function ia(e){return e===0?__(`The server could not be reached.`):__(`The request failed with status :status.`,{status:e})}var aa={untranslated:{text:e=>__n(`:count field untranslated|:count fields untranslated`,e),description:()=>__(`Not translated yet. Translate fills them in.`)},outdated:{text:e=>__n(`:count field outdated|:count fields outdated`,e),description:()=>__(`The source changed since they were translated, or part of their text is still untranslated. Update translates them again.`)},manual:{text:e=>__n(`:count field edited by hand|:count fields edited by hand`,e),description:()=>__(`Edited by hand. Translate and Update leave them alone.`)},attention:{text:e=>__n(`:count needs attention|:count need attention`,e),description:()=>__(`Edited by hand, and the source changed since or they hold its text again. Check them against the source.`)},untracked:{text:e=>__n(`:count untracked|:count untracked`,e),description:()=>__(`Edited by hand before their translation was tracked, so a change to the source cannot be detected. Mark them as up to date to track them.`)},current:{text:e=>__n(`:count field up to date|:count fields up to date`,e),description:()=>__(`Translated and up to date with the source.`)}},oa={missing:`red`,untranslated:`orange`,outdated:`amber`,attention:`purple`,manual:`sky`,untracked:`default`,current:`green`};function sa(e){return oa[e]??`default`}function ca(e){return{missing:__(`Missing`),untranslated:__(`Untranslated`),outdated:__(`Outdated`),attention:__(`Needs attention`),current:__(`Up to date`)}[e]??e}function la(e={}){return Object.entries(aa).filter(([t])=>(e[t]??0)>0).map(([t,n])=>({key:t,count:e[t],text:n.text(e[t]),description:n.description()}))}function ua(e){let t=e?.defaults??{};return!(t.providers_configured||t.fake_engine)||!t.translator}function da(e){if(e?.translatable!==!0)return{visible:!1,reason:e?.reason??null,setup:!1,translator:null,localization:null,origin:null};let t=ua(e);return{visible:!0,reason:null,setup:t,translator:e.defaults?.translator??null,localization:e.localization?fa(e.localization,t):null,origin:e.origin?ya(e.origin,t):null}}function fa(e,t){let n=e.counts??{},r=la(n),i=Object.entries(e.fields??{}),a=i.filter(([,e])=>e.incomplete).map(([e,t])=>({handle:e,label:t.label})),o=i.filter(([,e])=>e.same_as_origin).map(([e,t])=>({handle:e,label:t.label})),s=(e.out_of_scope??[]).filter(e=>e.reason===`not_localizable`).map(({handle:e,label:t})=>({handle:e,label:t})),c=ma(e,r);return{source:e.source,target:e.target,status:e.status,label:ca(e.status),parts:r,summary:c,lead:r.length>0?__(`From :source:`,{source:e.source?.name??``}):c,incomplete:a,incompleteNote:a.length?ha(a):null,copies:o,copiesNote:o.length?ga(o):null,translateCopies:!t&&o.length>0,translateCopiesLabel:__n(`Translate it|Translate them`,o.length),notLocalizable:s,hint:s.length?_a(va(s),s.length):null,translate:!t&&(n.untranslated??0)>0,update:!t&&(n.outdated??0)>0,autoUpdated:pa(e.auto_updated,e.source)}}function pa(e,t){let n=Date.parse(e?.at??``);if(Number.isNaN(n))return null;let r={source:t?.name??``,date:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(n)};return e.unpublished?__(`Updated automatically from :source on :date, not published yet.`,r):__(`Updated automatically from :source on :date.`,r)}function ma(e,t){let n=e.source?.name??``;return t.length===0?__(`Nothing to translate from :source.`,{source:n}):t.every(e=>e.key===`current`)?__(`Up to date with :source.`,{source:n}):__(`From :source: :parts.`,{source:n,parts:t.map(e=>e.text).join(`, `)})}function ha(e){return __n(`:fields is partly untranslated. Update translates the rest.|:fields are partly untranslated. Update translates the rest.`,e.length,{fields:va(e)})}function ga(e){return __n(`:fields holds the text of the origin again. Translate it, or mark it as up to date to keep it.|:fields hold the text of the origin again. Translate them, or mark them as up to date to keep them.`,e.length,{fields:va(e)})}function _a(e,t){return __n(`:fields is not translated because it is not localizable.|:fields are not translated because they are not localizable.`,t,{fields:e})}function va(e){return e.map(e=>e.label).join(`, `)}function ya(e,t){let n=(e.localizations??[]).map(e=>{let t=!e.exists,n=e.counts??{},r=t?[]:la(n),i=typeof e.error==`string`&&e.error!==``;return{site:e.site,name:e.name,exists:e.exists,status:e.status,label:i?__(`Unreadable`):ca(e.status),color:i?`red`:sa(e.status),parts:r,summary:i?e.error:ba(e,r),editUrl:e.edit_url??null,translate:!i&&(t||(n.untranslated??0)>0),update:!i&&!t&&(n.outdated??0)>0}});return{localizations:n,upToDate:n.length>0&&n.every(e=>e.status===`current`),translateInto:!t&&n.some(e=>e.translate),update:!t&&n.some(e=>e.update),translatesPublished:e.translates_published===!0,unpublishedChanges:e.unpublished_changes===!0,autoUpdate:{save:__(`Translations are updated automatically each time this entry is saved.`),publish:__(`Translations are updated automatically when this entry is published.`)}[e.auto_update]??null}}function ba(e,t){return e.exists?t.length===0?__(`Nothing to translate.`):t.every(e=>e.key===`current`)?null:t.map(e=>e.text).join(`, `):__(`Not created yet.`)}function xa(e,t=globalThis.Statamic?.$config?.get(`tolk.models`)){if(typeof t?.[e]==`string`)return t[e];let n=e.indexOf(`:`);return n===-1?e:e.slice(n+1)}function Sa(e,t){let n=Y(t?.localization?.fields);return e.map(e=>n[e]?.label??e).join(`, `)}function Ca(e,t=null,{retry:n=!1}={}){if(!e)return null;let r=e.kind===`review`,i=e.delivered.length,a=e.corrections?.length??0,o=Object.keys(e.skipped).filter(t=>e.skipped[t]===`edited`),s=Object.keys(e.skipped).filter(t=>e.skipped[t]===`hidden`),c=Object.keys(e.planSkipped??{}).filter(t=>e.planSkipped[t]===`manual`),l=Object.keys(e.failed);return{translated:r?null:Ta(i,wa(e)),reviewed:Ea(e,a),corrections:a,reviewSkipped:e.reviewSkipped?.length?__(`Part of the text could not be reviewed and was kept as it was.`):null,incomplete:e.incomplete.length?__n(`:fields is partly untranslated. Update translates the rest after you save.|:fields are partly untranslated. Update translates the rest after you save.`,e.incomplete.length,{fields:Sa(e.incomplete,t)}):null,edited:o.length?__n(`:fields was skipped because you edited it.|:fields were skipped because you edited them.`,o.length,{fields:Sa(o,t)}):null,hidden:s.length?Oa(s,r,t):null,manual:c.length?ka(c,r,t):null,failed:l.length?Da(l,r,n,t):null,cancelled:e.cancelled?r?__(`The review was cancelled before it finished.`):__(`The translation was cancelled before it finished.`):null,unsaved:i>0?__(`Not saved yet. Check the fields, then save.`):null}}function wa(e){let t=e.models.filter(t=>t!==e.reviewer);return(t.length?t:e.models).map(e=>xa(e)).join(`, `)}function Ta(e,t){return e===0?__(`No fields were translated.`):t?__n(`:count field translated with :model.|:count fields translated with :model.`,e,{model:t}):__n(`:count field translated.|:count fields translated.`,e)}function Ea(e,t){if(e.kind===`review`&&(e.planned??[]).length===0)return __(`There was nothing to review: no field holds a translation that is up to date.`);if(!e.reviewer||!e.reviewedUnits?.length)return null;let n=xa(e.reviewer);return t>0?__n(`Reviewed with :model: :count correction.|Reviewed with :model: :count corrections.`,t,{model:n}):__(`Reviewed with :model: nothing to correct.`,{model:n})}function Da(e,t,n,r){let i=Sa(e,r);return n?t?__n(`:fields could not be reviewed. Retry reviews it again.|:fields could not be reviewed. Retry reviews them again.`,e.length,{fields:i}):__n(`:fields could not be translated. Retry translates it again.|:fields could not be translated. Retry translates them again.`,e.length,{fields:i}):t?__n(`:fields could not be reviewed.|:fields could not be reviewed.`,e.length,{fields:i}):__n(`:fields could not be translated.|:fields could not be translated.`,e.length,{fields:i})}function Oa(e,t,n){let r=Sa(e,n);return t?__n(`:fields was not reviewed because it is hidden. Show it and review again.|:fields were not reviewed because they are hidden. Show them and review again.`,e.length,{fields:r}):__n(`:fields was skipped because it is hidden. Show it and translate again.|:fields were skipped because they are hidden. Show them and translate again.`,e.length,{fields:r})}function ka(e,t,n){let r=Sa(e,n);return t?__n(`:fields was not reviewed because it was edited by hand. Overwrite manual edits in the options reviews it too.|:fields were not reviewed because they were edited by hand. Overwrite manual edits in the options reviews them too.`,e.length,{fields:r}):__n(`:fields was skipped because it was edited by hand. Overwrite manual edits in the options replaces it.|:fields were skipped because they were edited by hand. Overwrite manual edits in the options replaces them.`,e.length,{fields:r})}var Aa={class:`space-y-6`},ja={class:`space-y-2 text-sm`},Ma={class:`text-xs font-medium text-gray-500 dark:text-gray-400`},Na={class:`whitespace-pre-wrap`,"data-tolk-change-before":``},Pa={class:`text-xs font-medium text-gray-500 dark:text-gray-400`},Fa={class:`whitespace-pre-wrap`,"data-tolk-change-after":``},Ia={class:`text-xs font-medium text-gray-500 dark:text-gray-400`},La={class:`whitespace-pre-wrap`,"data-tolk-change-reason":``},Ra={class:`flex items-center justify-end gap-3 pt-3 pb-1`},za={__name:`ChangesModal`,props:{modal:{type:Object,required:!0},corrections:{type:Array,default:()=>[]},reviewer:{type:String,default:null}},setup(e){let t=e,n=O(()=>t.corrections.map(e=>({...e,key:`${e.handle}:${e.id}`,diff:Zi(e.before,e.after)})));function r(e,t){return e.kind===`placeholder`?[`font-mono text-xs text-gray-500 dark:text-gray-400`,e.changed&&`rounded-sm bg-amber-100 dark:bg-amber-900/40!`]:e.changed?t===`before`?`rounded-sm bg-red-100 text-red-900 line-through dark:bg-red-900/40! dark:text-red-100`:`rounded-sm bg-green-100 text-green-900 underline decoration-green-700/60 dark:bg-green-900/40! dark:text-green-100 dark:decoration-green-300/60`:null}return(t,i)=>(F(),k(z(Gr),{open:``,title:t.__(`Changes by the reviewer`),icon:`dictionary-language-book`,"data-tolk-changes":``,onDismissed:i[1]||=t=>e.modal.dismissed(),"onUpdate:open":i[2]||=t=>e.modal.closed(t)},{footer:B(()=>[M(`div`,Ra,[P(z(V),{variant:`primary`,text:t.__(`Close`),"data-tolk-changes-action":`close`,onClick:i[0]||=t=>e.modal.hide()},null,8,[`text`])])]),default:B(()=>[M(`div`,Aa,[e.reviewer?(F(),k(z(U),{key:0},{default:B(()=>[N(R(t.__(`Corrected by :model. The corrections are in the form; nothing is saved until you press Save.`,{model:z(xa)(e.reviewer)})),1)]),_:1})):A(``,!0),(F(!0),j(m,null,L(n.value,e=>(F(),j(`div`,{key:e.key,class:`space-y-2`,"data-tolk-change":``},[P(z(W),{"data-tolk-change-label":``},{default:B(()=>[N(R(e.label),1)]),_:2},1024),M(`dl`,ja,[M(`div`,null,[M(`dt`,Ma,R(t.__(`Before`)),1),M(`dd`,Na,[(F(!0),j(m,null,L(e.diff.before,(e,t)=>(F(),k(Pt(e.changed?`del`:`span`),{key:t,class:it(r(e,`before`)),"data-tolk-removed":e.changed&&e.kind!==`space`?``:null},{default:B(()=>[N(R(e.text),1)]),_:2},1032,[`class`,`data-tolk-removed`]))),128))])]),M(`div`,null,[M(`dt`,Pa,R(t.__(`After`)),1),M(`dd`,Fa,[(F(!0),j(m,null,L(e.diff.after,(e,t)=>(F(),k(Pt(e.changed?`ins`:`span`),{key:t,class:it(r(e,`after`)),"data-tolk-added":e.changed&&e.kind!==`space`?``:null},{default:B(()=>[N(R(e.text),1)]),_:2},1032,[`class`,`data-tolk-added`]))),128))])]),M(`div`,null,[M(`dt`,Ia,R(t.__(`Reason`)),1),M(`dd`,La,R(e.reason),1)])])]))),128))])]),_:1},8,[`title`]))}},Ba=[`aria-label`,`aria-valuemax`,`aria-valuenow`],Va={__name:`ProgressBar`,props:{value:{type:Number,default:0},max:{type:Number,default:0},label:{type:String,required:!0}},setup(e){let t=e,n=O(()=>t.max>0?Math.min(100,Math.round(t.value/t.max*100)):0);return(t,r)=>(F(),j(`div`,{role:`progressbar`,"aria-label":e.label,"aria-valuemin":`0`,"aria-valuemax":e.max,"aria-valuenow":e.value,class:`h-1.5 w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700`,"data-tolk-progress":``},[M(`div`,{class:`h-full rounded-full bg-blue-600 transition-[width] duration-300 dark:bg-blue-400!`,style:ot({width:`${n.value}%`})},null,4)],8,Ba))}},X=`base`;function Ha(){let e=Bt(new Map),t=!1;function n(e=Statamic.$events){t||(t=!0,e.$on(`publish-container-created`,r),e.$on(`publish-container-destroyed`,i))}function r(t){let n=(e.get(t.name)?.mounted??0)+1;e.set(t.name,{payload:t,context:null,clean:null,mounted:n})}function i({name:t}){let n=e.get(t);n&&(n.mounted>1?e.set(t,{...n,mounted:n.mounted-1}):e.delete(t))}function a(t,n){let r=e.get(t)??{payload:null,context:null,clean:null,mounted:0};e.set(t,{...r,...n})}function o(t,n){a(t,{context:n,clean:e.get(t)?.clean??Z(n.values.value)})}function s(e){let t=c(e);t!==null&&a(e,{clean:Z(t)})}function c(t){let n=e.get(t);return(n?.context??n?.payload)?.values?.value??null}function l(t){let n=e.get(t)?.clean,r=c(t);return!n||r===null?[]:[...new Set([...Object.keys(r),...Object.keys(n)])].filter(e=>!ro(r[e],n[e]))}return{listen:n,attachContext:o,refreshClean:s,dirtyHandles:l,context:t=>e.get(t)?.context??null,payload:t=>e.get(t)?.payload??null,base:()=>e.get(`base`)?.context??null,others:()=>[...e.keys()].filter(e=>e!==X)}}var Ua=Ha();function Z(e){return Array.isArray(e)?e.map(Z):typeof e!=`object`||!e?e:Object.fromEntries(Object.keys(e).map(t=>[t,Z(e[t])]))}var Wa=new Set([`type`,`id`,`_id`,`marks`]),Ga=new Set([`type`,`attrs`,`content`,`marks`,`text`]),Ka=e=>e.replace(/\r\n?/g,` +`),qa=e=>typeof e==`boolean`||typeof e==`number`,Ja=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Ya(e){if(typeof e==`string`)return e===``?null:Ka(e);if(Array.isArray(e))return e.length>0&&e.every(Za)?Qa(e):Xa(e);if(typeof e!=`object`||!e)return null;let t=Object.keys(e).filter(e=>!Wa.has(e)).sort().map(t=>[t,Ya(e[t])]).filter(([,e])=>e!==null);return t.length?Object.fromEntries(t):null}function Xa(e){let t=e.map(Ya);for(;t.length&&t[t.length-1]===null;)t.pop();return t.length?t:null}function Za(e){return typeof e==`object`&&!!e&&typeof e.type==`string`&&Object.keys(e).every(e=>Ga.has(e))}function Qa(e){let t=[],n=[],r=e=>{n.length&&(t.push(n.length===1&&n[0].marks.length===0?Ka(n[0].text):n.map($a)),n=[]),e!==null&&t.push(e)},i=e=>{let t=typeof e.text==`string`?e.text:``;if(t===``)return;let r=no(Array.isArray(e.marks)?e.marks:[]),i=JSON.stringify(r),a=n[n.length-1];a?.key===i?a.text+=t:n.push({key:i,marks:r,text:t,title:eo(e.marks)})},a=e=>{Za(e)?e.type===`text`?i(e):(r(Ya(e.attrs)),r(eo(e.marks)),(Array.isArray(e.content)?e.content:[]).forEach(a),r(null)):r(Ya(e))};return e.forEach(a),r(null),t.length?t:null}function $a({marks:e,text:t,title:n}){return e.length===0?Ka(t):n===null?{text:Ka(t)}:{text:Ka(t),title:n}}function eo(e){let t=(Array.isArray(e)?e:[]).find(e=>Ja(e)&&e.type===`link`),n=Ja(t?.attrs)?t.attrs.title:null;return typeof n==`string`&&n.trim()!==``?Ka(n):null}var to=e=>e==null||e===``||typeof e==`object`&&Object.keys(e).length===0;function no(e){return Array.isArray(e)?e.map(no):qa(e)?String(e):Ja(e)?Object.fromEntries(Object.keys(e).sort().map(t=>[t,no(e[t])]).filter(([,e])=>!to(e))):e??null}function ro(e,t){return JSON.stringify(Ya(e))===JSON.stringify(Ya(t))}function io(e,t){return Array.isArray(e)&&Array.isArray(t)?e.every((e,n)=>n>=t.length||io(e,t[n])):Ja(e)&&Ja(t)?Object.keys(e).every(n=>Wa.has(n)||!Object.hasOwn(t,n)||io(e[n],t[n])):!(qa(e)||qa(t))||e===t}function ao(e,t){return ro(e,t)&&io(e,t)}var oo=2e3,so=1e3,co=100,lo=50,uo=e=>new Promise(t=>setTimeout(t,e)),fo=e=>typeof e==`function`?e:()=>e,po=(e,t,n)=>()=>e.reference.value===t&&n();async function mo(e,t,n){let r=()=>600-(t()-e());for(let e=r();e>0;e=r())await n(e)}function ho(e,t,n){return Object.hasOwn(t,n)?!ro(e.values.value[n],t[n]):e.values.value[n]!==void 0}function go(e,t,n){return n===null&&typeof e.values.value[t]==`string`?``:Z(n)}function _o(e,t){return e.hiddenFields?.value?.[t]?.omitValue===!0}function vo(e,t){for(let[n,r]of Object.entries(t))r.pending||r.sync||r.localizedBefore||(_o(e,n)?e.localizedFields.value.includes(n)&&(Ao(e,n,!1),r.leftOut=!0):r.leftOut&&=(Ao(e,n,!0),!1))}function yo(e,t){let n=e.localizedFields.value;return Object.keys(t).filter(e=>t[e].leftOut||n.includes(e))}function bo(e,t){return!!t&&!t.pending&&t.plan!==e.delivered?.plan}function xo(e,t,n={}){let r=e.localizedFields.value;return{reference:e.reference.value,dirty:Statamic.$dirty.has(e.name.value),fields:Object.fromEntries(t.map(t=>[t,{value:Z(e.values.value[t]),meta:Z(e.meta.value[t]),localized:r.includes(t),delivered:n[t]?Z(n[t]):null}]))}}async function So(e,t,{reference:n,plan:r,lastChangeAt:i=0,planValues:a={},delivered:o,now:s=Date.now,sleep:c=uo,active:l=()=>!0}){let u=Object.keys(t??{}),d={stale:!1,applied:[],skipped:{},repeated:[]},f=()=>(d.stale=!0,d.applied=[],d.skipped=Object.fromEntries(u.map(e=>[e,`stale`])),d),p=po(e,n,l);if(!p()||(await mo(fo(i),s,c),!p()))return f();let m=[],h={};for(let n of u){let i=t[n];if(o[n]?.plan===r){d.repeated.push(n);continue}if(ho(e,a,n)){d.skipped[n]=`edited`;continue}if(!i.sync&&_o(e,n)){d.skipped[n]=`hidden`;continue}o[n]={plan:r,value:void 0,pending:!0,incomplete:!!i.incomplete,sync:!!i.sync,localizedBefore:o[n]?.localizedBefore??e.localizedFields.value.includes(n)},i.meta!==void 0&&e.setFieldMeta(n,Z(i.meta)),h[n]=go(e,n,i.value),e.setFieldValue(n,Z(h[n])),i.sync?(Ao(e,n,!1),Statamic.$dirty.add(e.name.value),m.push(n)):(e.desyncField(n),e.localizedFields.value.includes(n)||(Ao(e,n,!0),Statamic.$dirty.add(e.name.value))),d.applied.push(n)}if(!d.applied.length)return d;if(await c(300),!p())return d.applied.forEach(e=>delete o[e]),f();m.filter(t=>ao(e.values.value[t],h[t])).forEach(t=>Ao(e,t,!1));for(let t of d.applied){let n=e.values.value[t];o[t]={...o[t],value:ro(n,h[t])?Z(n):h[t],pending:!1}}return d}async function Co(e,t,n,{registry:r=Ua,sleep:i=uo}={}){let a={restored:[],kept:[]};if(!t||e.reference.value!==t.reference)return a;for(let[r,i]of Object.entries(t.fields)){let t=n[r];if(bo(i,t)){if(!ro(e.values.value[r],t.value)){a.kept.push(r);continue}a.restored.push(r)}}if(!a.restored.length)return a;e.withoutDirtying(()=>{for(let r of a.restored){let i=t.fields[r];e.setFieldMeta(r,Z(i.meta)),e.setFieldValue(r,go(e,r,i.value)),Ao(e,r,i.localized),i.delivered?n[r]=Z(i.delivered):delete n[r]}});let o=()=>{if(e.reference.value!==t.reference)return;let n=a.restored.filter(n=>!ao(e.values.value[n],t.fields[n].value));a.restored.filter(e=>t.fields[e].localized||!n.includes(e)).forEach(n=>Ao(e,n,t.fields[n].localized)),!t.dirty&&!n.length&&r.dirtyHandles(e.name.value).length===0&&Statamic.$dirty.remove(e.name.value)};return o(),await i(300),o(),a}function wo(e,t,n){if(!t||e.reference.value!==t.reference)return[];let r=n.filter(e=>Object.hasOwn(t.fields,e));return r.length&&e.withoutDirtying(()=>{for(let n of r){let r=t.fields[n];e.setFieldMeta(n,Z(r.meta)),e.setFieldValue(n,go(e,n,r.value)),Ao(e,n,r.localized)}}),r}async function To(e,t,{reference:n,lastChangeAt:r=0,now:i=Date.now,sleep:a=uo,active:o=()=>!0}={}){let s=fo(r),c=po(e,n,o),l=()=>s()+oo-i();if(!c())return{stale:!0,kept:!1,reset:!1};if(!Do(e,t))return{stale:!1,kept:!1,reset:!1};for(await mo(s,i,a);c()&&!Oo(e)&&l()>0;)await a(Math.min(co,l()));let u=Oo(e);return!c()||!await ko(e,t,{sleep:a,current:c})?{stale:!0,kept:!1,reset:u}:{stale:!1,kept:!0,reset:u}}async function Eo(e,t,{reference:n,sleep:r=uo,active:i=()=>!0}={}){let a=po(e,n,i);return!Do(e,t)||(await r(so),!a()||e.values.value.slug===t&&!Oo(e))?!1:ko(e,t,{sleep:r,current:a})}function Do(e,t){return typeof t==`string`&&t!==``&&Object.hasOwn(e.values.value??{},`slug`)}function Oo(e){return e.meta.value?.slug?.auto===!0}async function ko(e,t,{sleep:n,current:r}){return Oo(e)&&e.values.value.slug===t&&(e.setFieldValue(`slug`,``),await n(lo),!r())?!1:(e.values.value.slug!==t&&e.setFieldValue(`slug`,t),!0)}function Ao(e,t,n){let r=e.localizedFields.value,i=r.indexOf(t);n&&i===-1?r.push(t):!n&&i!==-1&&r.splice(i,1)}var jo=2e3,Mo=5;function No(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=()=>{clearTimeout(i),t?.removeEventListener(`abort`,r),n()},i=setTimeout(r,e);t?.addEventListener(`abort`,r,{once:!0})})}function Po(e){let t=e?.status??0;return t===429||t===503?`wait`:t===409&&e.code===`busy`?`busy`:t===409&&e.code===`source_changed`||t===410||t===502?`stop`:`fail`}function Fo(e,t=``){return{status:e?.status??0,code:e?.code??null,message:e?.message||t}}var Io=e=>Object.entries(Y(e)),Lo=({id:e,fields:t})=>({id:e,fields:t});async function Ro({api:e=J,plan:t,concurrency:n=1,onFields:r=()=>{},onProgress:i=()=>{},signal:a=null,finishing:o=()=>!0,sleep:s=No,maxWaits:c=5,busyMs:l=jo,maxBusyWaits:u=60}){let d=Math.max(1,Math.floor(Number(n))||1),f=[...t.units??[]],p=new Set(f.map(e=>e.id)),m={total:f.length,done:0,waiting:0},h=new Map,g=[],_=[],v=[],y={},b=new Set,x=new Set,S=new Set,C=new Set,w={},ee=null,T=()=>ee!==null||!!a?.aborted,E=()=>i({...m});function te(){if(!T())return f.shift();let e=ee===null&&o()?f.findIndex(e=>!p.has(e.id)):-1;return e===-1?null:f.splice(e,1)[0]}function D(e){let t=Io(e).map(([e,t])=>(h.set(e,t),e));t.length&&g.push(Promise.resolve().then(()=>r(e)).then(e=>({handles:t,result:e}),e=>({handles:t,error:e})))}function ne(e,t){D(t?.fields);for(let[e,n]of Io(t?.failed))y[e]=n;(Array.isArray(t?.warnings)?t.warnings:[]).forEach(e=>b.add(e)),(Array.isArray(t?.unchanged)?t.unchanged:[]).forEach(e=>x.add(e)),t?.reviewed===!0&&S.add(e.id),t?.review_skipped===!0&&C.add(e.id);for(let[e,n]of Io(t?.usage))w[e]=Bo(w[e]??{},n);let n=Array.isArray(t?.spawned)?t.spawned:[];f.push(...n),m.total+=n.length}async function re(n){let r=0,i=0;for(;;)try{return ne(n,await e.post(`editor/unit`,{plan:t.plan,unit:n.id}))}catch(e){let t=Po(e),o=t===`wait`&&r0?Number(e.data.retry_after):Mo;if(m.waiting++,E(),await s(t===`wait`?d*1e3:l,a),m.waiting--,E(),T()){v.push(Lo(n));return}}}return D(t.ready),E(),await new Promise(e=>{let t=0,n=()=>{let r;for(;t{t--,m.done++,E(),n()});t===0&&e()};n()}),v.push(...f.map(Lo)),zo(await Promise.all(g),{received:h,failed:y,failedUnits:_,cancelledUnits:v,warnings:[...b],unchanged:x,reviewedUnits:[...S],reviewSkipped:[...C],usage:w,stopped:ee,aborted:!!a?.aborted,progress:m})}function zo(e,{received:t,failed:n,failedUnits:r,cancelledUnits:i,warnings:a,unchanged:o,reviewedUnits:s,reviewSkipped:c,usage:l,stopped:u,aborted:d,progress:f}){let p=[],m={},h=!1;for(let{handles:t,result:r,error:i}of e){if(i){t.forEach(e=>n[e]??=`not_filled`);continue}h||=r?.stale===!0;for(let e of r?.applied??(r?[]:t))p.includes(e)||p.push(e);Object.assign(m,r?.skipped??{})}for(let e of r)for(let t of e.fields??[])!p.includes(t)&&!(t in m)&&(n[t]??=e.error?.code??`failed`);return p.forEach(e=>delete n[e]),{delivered:p,incomplete:p.filter(e=>t.get(e)?.incomplete===!0),skipped:m,failed:n,failedUnits:r,cancelledUnits:i,warnings:a,corrections:p.flatMap(e=>{let n=t.get(e)?.corrections;return Array.isArray(n)?n.map(t=>({handle:e,...t})):[]}),unchanged:[...o].filter(e=>!p.includes(e)),reviewedUnits:s,reviewSkipped:c,usage:l,models:Object.keys(l),stopped:u,aborted:d,stale:h,units:{total:f.total,done:f.done}}}function Bo(e,t){let n={...e};for(let[e,r]of Io(t))typeof r==`number`&&(n[e]=(n[e]??0)+r);return n}var Vo=t({BACKOFF_MS:()=>Uo,FINAL_STATUSES:()=>Ho,IDLE_MS:()=>Go,MAX_BACKOFF_MS:()=>Wo,MAX_RETRIES:()=>5,POLL_MS:()=>Ko,backoff:()=>ns,estimateLoop:()=>ls,isFinal:()=>Zo,latest:()=>Qo,nonce:()=>Jo,pollState:()=>cs,retryable:()=>ts,startApplyLoop:()=>os,startLanes:()=>as}),Ho=[`completed`,`completed_with_errors`,`cancelled`,`aborted`],Uo=1e3,Wo=3e4,Go=1e3,Ko=2e3,qo=null;function Jo(){return qo??=Array.from(crypto.getRandomValues(new Uint8Array(12)),e=>e.toString(16).padStart(2,`0`)).join(``),qo}var Yo=new WeakMap;function Xo(e,t,n){let r=Yo.get(e)??new Map,i=r.get(t),a=i?i.then(n):new Promise(e=>e(n())),o=a.then(()=>{},()=>{});return Yo.set(e,r),r.set(t,o),o.then(()=>r.get(t)===o&&r.delete(t)),a}function Zo(e){return Ho.includes(e?.run?.status)}function Qo(e){let t=null;return n=>{t!==null&&$o(n,t)||(t=n,e(n))}}function $o(e,t){let n=es(e),r=es(t);return n=500}function ns(e,t=Uo){return Math.min(t*2**Math.max(0,e-1),Wo)}function rs(e,t){return e==null?t:Math.max(0,Number(e)||0)*1e3}async function is(e,{retries:t,backoffMs:n,sleep:r,signal:i}){for(let a=1;;a++)try{return{response:await e()}}catch(e){if(i?.aborted)return{};if(a>t||!ts(e))return{error:Fo(e)};if(await r(ns(a,n),i),i?.aborted)return{}}}function as({api:e=J,urls:t,lanes:n=1,nonce:r=Jo(),onState:i=()=>{},onFailure:a=()=>{},signal:o=null,query:s=()=>({}),sleep:c=No,retries:l=5,backoffMs:u=Uo,idleMs:d=Go}){let f=Math.max(1,Math.floor(Number(n))||1),p=new Map,m=new Set,h=[],g=[],_=()=>!!o?.aborted,v=e=>m.forEach(t=>t(e)),y=()=>[...p.values()].filter(e=>e===`running`).length;function b(e,t){let n={lane:e,error:t};return g.push(n),a(n),`failed`}let x=n=>Xo(e,`${t.tick} ${r} ${n}`,()=>_()?null:e.post(t.tick,{...s(),nonce:r,lane:n}));async function S(e){for(;!_();){let{response:t,error:n}=await is(()=>x(e),{retries:l,backoffMs:u,sleep:c,signal:o});if(_())break;if(n)return b(e,n);if(i(t),v({lane:e,state:t}),Zo(t)||t?.report?.remains!==!0)return`finished`;await c(rs(t.report.wait,d),o)}return`aborted`}function C(e,t){p.set(e,t),v({lane:e,ended:t}),y()===0&&h.splice(0).forEach(e=>e())}function w(e){p.set(e,`running`),S(e).catch(t=>b(e,Fo(t))).then(t=>C(e,t))}for(let e=1;e<=f;e++)w(e);return{get active(){return y()},failed:g,restart(){if(_())return 0;let e=[...p].filter(([,e])=>e===`finished`).map(([e])=>e);return e.forEach(w),e.length},idle(){return y()===0?Promise.resolve():new Promise(e=>h.push(e))},subscribe(e){return m.add(e),()=>m.delete(e)}}}async function os({api:e=J,urls:t,lanes:n=null,onState:r=()=>{},onFailure:i=()=>{},signal:a=null,query:o=()=>({}),sleep:s=No,retries:c=5,backoffMs:l=Uo,idleMs:u=Go}){let d=()=>!!a?.aborted,f=null,p=!1,m=null,h=n?.subscribe(e=>{(e.ended||Number(Y(e.state?.counts).translated)>0)&&(p=!0,m?.())})??(()=>{}),g=()=>new Promise(e=>{let t=()=>{m=null,a?.removeEventListener(`abort`,t),e()};m=t,a?.addEventListener(`abort`,t,{once:!0})});try{for(;!d();){p=!1;let{response:m,error:h}=await is(()=>e.post(t.apply,o()),{retries:c,backoffMs:l,sleep:s,signal:a});if(d())break;if(h)return i({error:h}),{state:f,error:h};if(f=m,r(m),Zo(m))break;if(n&&ss(m)&&n.restart(),m?.report?.remains===!0)await s(rs(m.report.wait,u),a);else if(n?.active)p||await g();else break}}finally{h()}return{state:f,error:null}}function ss(e){let t=e?.run;return t?.status===`running`&&t?.driver===`browser`&&Number(Y(e.counts).pending)>0}async function cs({api:e=J,url:t,interval:n=Ko,onState:r=()=>{},onFailure:i=()=>{},signal:a=null,query:o=()=>({}),sleep:s=No,retries:c=5,backoffMs:l=Uo}){let u=null;for(;!a?.aborted;){let{response:d,error:f}=await is(()=>e.get(t,o()),{retries:c,backoffMs:l,sleep:s,signal:a});if(a?.aborted)break;if(f)return i({error:f}),{state:u,error:f};if(u=d,r(d),Zo(d))break;await s(n,a)}return{state:u,error:null}}async function ls({api:e=J,url:t,estimate:n=null,onEstimate:r=()=>{},onFailure:i=()=>{},signal:a=null,sleep:o=No,retries:s=5,backoffMs:c=Uo}){let l=n,u=n===null?0:n.next===null?null:Math.max(0,Math.floor(Number(n.next))||0);for(;u!==null&&!a?.aborted;){let{response:n,error:d}=await is(()=>e.post(t,{from:u}),{retries:s,backoffMs:c,sleep:o,signal:a});if(a?.aborted)break;if(d)return i({error:d}),{estimate:l,error:d};l=n,r(n),u=Number.isInteger(n?.next)?n.next:null}return{estimate:l,error:null}}var us=[`pending`,`translating`,`translated`,`applying`,`done`,`skipped`,`failed`],ds=[`pending`,`translating`,`translated`,`applying`],fs={pending:`default`,running:`blue`,completed:`green`,completed_with_errors:`orange`,cancelled:`amber`,aborted:`red`},ps={pending:`default`,translating:`blue`,translated:`sky`,applying:`blue`,done:`green`,skipped:`default`,failed:`red`};function ms(e){return{pending:__(`Not started`),running:__(`Running`),completed:__(`Completed`),completed_with_errors:__(`Completed with errors`),cancelled:__(`Cancelled`),aborted:__(`Aborted`)}[e]??e}function hs(e){return fs[e]??`default`}function gs(e){return{pending:__(`Waiting`),translating:__(`Translating`),translated:__(`Translated, not saved yet`),applying:__(`Saving`),done:__(`Done`),skipped:__(`Skipped`),failed:__(`Failed`)}[e]??e}function _s(e){return ps[e]??`default`}function vs(e){return{entry:__(`Entries`),term:__(`Terms`),globals:__(`Global sets`),nav:__(`Navigation`)}[e]??e}function ys(e=[]){let t=Object.fromEntries((Array.isArray(e)?e:[]).map(e=>[e.handle,e.name]));return e=>t[e]??e}function Q(e,t=void 0){return new Intl.NumberFormat(t).format(Number(e)||0)}function bs(e,t=void 0){let n=Number(e)||0,r=n>0&&n<.01?{maximumSignificantDigits:2}:{minimumFractionDigits:2,maximumFractionDigits:2};return new Intl.NumberFormat(t,{style:`currency`,currency:`USD`,...r}).format(n)}function xs(e,t=void 0){let n=Date.parse(e??``);return Number.isNaN(n)?``:new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(n)}function Ss(e){let t={...Object.fromEntries(us.map(e=>[e,0])),...Y(e?.counts)},n=us.reduce((e,n)=>e+(Number(t[n])||0),0),r=ds.reduce((e,n)=>e+(Number(t[n])||0),0);return{counts:t,total:n,finished:n-r,unfinished:r}}function Cs(e){let t=e?.run??{},{counts:n,unfinished:r}=Ss(e),i=Zo(e),a=t.status===`running`&&!!e?.stalled;return{start:t.status===`pending`,cancel:t.status===`running`,resume:a||[`cancelled`,`aborted`].includes(t.status)&&r>0,retry:i&&n.failed>0,takeOver:a&&t.driver===`queue`}}function ws(e,t){let n=[t];return e.skipped>0&&n.push(__n(`:count skipped|:count skipped`,e.skipped)),e.failed>0&&n.push(__n(`:count failed|:count failed`,e.failed)),n.join(`, `)}function Ts(e){let t=e?.run??{};if(!Zo(e))return null;let{counts:n}=Ss(e),r=ws(n,__n(`:count done|:count done`,n.done));return{status:t.status,variant:{completed:`success`,completed_with_errors:`warning`,cancelled:`warning`,aborted:`error`}[t.status],text:{completed:__(`The run is complete: :items.`,{items:r}),completed_with_errors:__(`The run is complete, with errors: :items.`,{items:r}),cancelled:__(`The run was cancelled: :items.`,{items:r}),aborted:__(`The run was stopped: :items.`,{items:r})}[t.status],error:t.error??null}}function Es(e,t=e=>e){return(Array.isArray(e)?e:[]).map(({type:e,site:n,counts:r})=>{let i=Ss({counts:r});return{key:`${e}|${n}`,type:vs(e),site:t(n),total:i.total,skipped:i.counts.skipped,done:i.counts.done,failed:i.counts.failed}})}function Ds(e){let t={excluded_collection:e=>__n(`:count target is in a collection excluded in the settings.|:count targets are in collections excluded in the settings.`,e),site_not_in_collection:e=>__n(`:count target is in a site its collection does not have.|:count targets are in sites their collection does not have.`,e),unauthorized:e=>__n(`:count target is one you may not edit.|:count targets are ones you may not edit.`,e),from_site:e=>__n(`:count target is a navigation in the site it is translated from.|:count targets are navigations in the site they are translated from.`,e)};return Object.entries(Y(e?.skipped)).filter(([,e])=>Number(e)>0).map(([e,n])=>({reason:e,text:t[e]?.(Number(n))??__(`:count targets left out: :reason.`,{count:n,reason:e.replaceAll(`_`,` `)})}))}function Os(e){let t=(Array.isArray(e?.out_of_scope)?e.out_of_scope:[]).filter(e=>e.reason===`not_localizable`);if(t.length===0)return null;let n=new Set(t.map(e=>e.container));return _a(t.map(e=>n.size>1?`${e.label||e.handle} (${e.container})`:e.label||e.handle).join(`, `),t.length)}function ks(e,t=e=>e){let n=t=>Array.isArray(e?.[t])?e[t]:[],r=n(`collections`),i=n(`taxonomies`),a=n(`globals`),o=n(`navs`),s=n(`entry_ids`).length,c=n(`term_ids`).length,l=[],u=(e,t)=>{e.includes(`*`)?l.push(t):e.length>0&&l.push(e.join(`, `))};return u(r,__(`All collections`)),s>0&&l.push(__n(`:count selected entry|:count selected entries`,s)),u(i,__(`All taxonomies`)),c>0&&l.push(__n(`:count selected term|:count selected terms`,c)),u(a,__(`All global sets`)),u(o,__(`All navigation`)),{what:l.join(`, `)||__(`Nothing selected`),sites:n(`sites`).map(t).join(`, `),automatic:e?.automatic===!0}}function As(e,t={}){let n=e=>e?Y(t)[e]??e:null,r=[{key:`mode`,label:__(`Translate`),value:{missing:__(`Only what is not translated yet`),update:__(`Also update outdated translations`),all:__(`Retranslate everything`),review:__(`Review existing translations`)}[e?.mode]??e?.mode??``},{key:`translator`,label:__(`Model`),value:n(e?.translator)??__(`Default`)},{key:`review`,label:__(`Review`),value:e?.review?n(e?.reviewer)??__(`On`):__(`Off`)},{key:`overwrite_manual`,label:__(`Manual edits`),value:e?.overwrite_manual?__(`Overwritten`):__(`Kept`)},{key:`new_status`,label:__(`New localizations`),value:e?.new_status===`mirror`?__(`Same as origin`):__(`Drafts`)}];return e?.publish_changes&&r.push({key:`publish_changes`,label:__(`Revisions`),value:__(`Changes are published`)}),r}function js(e,t=0){if(!e)return null;let n=Number.isInteger(e.next)?e.next:null,r={done:Math.min(n??0,t),total:t};return{finished:n===null,progress:n===null?null:__(`:done of :total items`,r),partial:n===null?null:__(`Only :done of :total items were estimated before the run started.`,r),segments:Number(e.segments)||0,chars:Number(e.chars)||0,inputTokens:Number(e.input_tokens)||0,outputTokens:Number(e.output_tokens)||0,cost:e.cost===null||e.cost===void 0?null:Number(e.cost)}}function Ms(e,t={}){let n=Object.entries(Y(e?.usage)).map(([e,n])=>({model:Y(t)[e]??e,input:Number(n?.input)||0,output:Number(n?.output)||0,calls:Number(n?.calls)||0}));return{rows:n,input:n.reduce((e,t)=>e+t.input,0),output:n.reduce((e,t)=>e+t.output,0),calls:n.reduce((e,t)=>e+t.calls,0),cost:e?.cost===null||e?.cost===void 0?null:Number(e.cost)}}var Ns={current:()=>__(`up to date`),outdated:()=>__(`outdated, not updated in this mode`),untranslated:()=>__(`not translated yet`),manual:()=>__(`edited by hand, kept`),target_changed:()=>__(`edited meanwhile, kept`),not_applicable:()=>__(`empty in the source`),not_requested:()=>__(`not requested`),origin_untranslated:()=>__(`not translated in its source yet`),structure_differs:()=>__(`its structure differs from the source`),no_corrections:()=>__(`reviewed, nothing to correct`),review_skipped:()=>__(`could not be reviewed`)},Ps={invalid:()=>__(`the model kept breaking its formatting`),missing:()=>__(`the model left it out`),too_long:()=>__(`the model's answer was cut off`),refused:()=>__(`the model refused it`),request_rejected:()=>__(`the provider rejected the request`)},Fs={nothing_to_do:()=>__(`Nothing to do.`),dependency_failed:()=>__(`An item it depends on failed.`),unauthorized:()=>__(`You may not edit it.`),target_changed:()=>__(`Edited by someone while it was being translated.`),no_corrections:()=>__(`Reviewed, nothing to correct.`),source_changed:()=>__(`Its source changed, so it is translated again.`)};function Is(e,t=e=>e){let n=Object.entries(Y(e?.fields)),r=e=>n.filter(([,t])=>t===e).map(([e])=>e),i=[`applied`,`incomplete`,`partly_reviewed`],a=n.filter(([,e])=>i.includes(e)).length,o=([,e])=>Object.hasOwn(Ps,e),s=n.filter(o).map(([e,t])=>({handle:e,reason:Ps[t]()})),c=n.filter(e=>!i.includes(e[1])&&!o(e)).map(([e,t])=>({handle:e,reason:Ns[t]?.()??String(t).replaceAll(`_`,` `)})),l=e?.reason?Fs[e.reason]?.()??null:null,u=Object.entries(Y(e?.corrections)).flatMap(([e,t])=>(Array.isArray(t)?t:[]).map(t=>({...t,handle:e,label:e})));return{index:e?.index,title:e?.title||e?.source_id||``,site:t(e?.target_site),status:e?.status,statusLabel:gs(e?.status),statusColor:_s(e?.status),editUrl:e?.edit_url??null,applied:a>0?__n(`:count field saved|:count fields saved`,a):null,incomplete:r(`incomplete`),failed:s,notReviewed:r(`partly_reviewed`),kept:c,reason:l,error:e?.error??null,rootPage:e?.root_page?.edit_url?{title:e.root_page.title||``,url:e.root_page.edit_url}:null,warnings:Array.isArray(e?.warnings)?e.warnings:[],corrected:u.length>0?__n(`:count correction|:count corrections`,u.length):null,corrections:u}}function Ls(e,t){let n=t?.page;return Number.isInteger(n)&&n{},onEstimate:i=()=>{},onFailures:a=()=>{},query:o=()=>({}),api:s=J,ticker:c=Vo}){let l=null,u=()=>{},d=null,f=null,p=[],m=null,h=!1,g=null;function _(e){p=[...p,e],a(p)}function v(){return!!(d&&d.active>0||f)}function y(){let e=m?.run??{};return e.status===`running`&&e.driver===`browser`&&v()}function b(){let e=n!==null&&y();e!==h&&(h=e,e?Statamic.$dirty.add(n):Statamic.$dirty.remove(n))}function x(){l?.abort(),l=null,d=null,f=null,b()}function S(e){x(),u=c.latest(C),w(e,!0)}function C(e){m=e,r(e),b(),Zo(e)?g=null:zs(e)!==g&&(x(),w(e,!1))}function w(n,r){let i=new AbortController;l=i,p=[],a(p),g=zs(n),r&&u(n);let m=n?.run??{},h={onState:u,onFailure:_,signal:i.signal,query:o};if(g===`estimate`)ee(m.estimate??null,i.signal);else if(g===`drive`){d=c.startLanes({api:s,urls:e,lanes:t,...h}),d.subscribe(e=>e.ended&&b());let n=c.startApplyLoop({api:s,urls:e,lanes:d,...h}).catch(e=>_({error:Fo(e)})).finally(()=>{f===n&&(f=null,b())});f=n,b()}else g===`poll`&&c.pollState({api:s,url:e.state,...h}).catch(e=>_({error:Fo(e)}))}async function ee(t,n){try{let{error:r}=await c.estimateLoop({api:s,url:e.estimate,estimate:t,onEstimate:i,onFailure:_,signal:n});!r&&!n.aborted&&await T()}catch(e){n.aborted||_({error:Fo(e)})}}async function T(){let t=l?.signal,n=await s.get(e.state,o());return t&&!t.aborted&&u(n),n}async function E(e,t=!0){let n=await s.post(e,o());return t?S(n):u(n),n}return{follow:S,refresh:T,stop:x,start:()=>E(e.start),cancel:()=>E(e.cancel,!1),resume:()=>E(e.resume),retry:()=>E(e.retry),takeOver:()=>E(e.take_over),get active(){return v()},get driving(){return y()},get failures(){return p}}}function zs(e){let t=e?.run??{};return t.status===`pending`?`estimate`:t.status===`running`?t.driver===`browser`?`drive`:`poll`:null}var Bs=[`idle`,`offer`,`planning`,`working`,`done`,`error`];function Vs(){return{reference:null,status:null,phase:`idle`,progress:{total:0,done:0,waiting:0,cancelling:!1},summary:null,snapshot:null,delivered:{},lastChangeAt:0,planReference:null,error:null,request:null,notSaved:[],created:!1,slugKept:!1,push:null}}var Hs=null;function Us(){return Hs??=Statamic.$pinia.defineStore(`tolk-editor`,{state:()=>({containers:{}}),getters:{phaseOf:e=>t=>e.containers[t]?.phase??`idle`},actions:{container(e){return this.containers[e]??=Vs(),this.containers[e]},switched(e,t,n=Date.now()){this.containers[e]={...Vs(),reference:t,lastChangeAt:n}},saved(e,t=Date.now()){let n=this.container(e),r={...n.delivered};return n.lastChangeAt=Math.max(n.lastChangeAt,t),Object.keys(r).forEach(e=>delete n.delivered[e]),r},setPhase(e,t,n=null){if(!Bs.includes(t))throw Error(`Unknown editor phase [${t}].`);let r=this.container(e);r.phase=t,r.error=t===`error`?n:null},clearResult(e){Object.assign(this.container(e),{summary:null,snapshot:null,request:null}),this.setPhase(e,`idle`)},forget(e){delete this.containers[e]}}}),Hs()}var Ws=[`starting`,`running`,`expecting`],Gs=[1e3,2e3,4e3,8e3,15e3];function Ks(e){let t=e?.origin?.auto_update_sites??[];return(e?.origin?.localizations??[]).filter(e=>t.includes(e.site)).filter(e=>!e.exists||[`untranslated`,`outdated`].includes(e.status)).map(e=>e.site)}function qs(e){return(e?.localizations??[]).filter(e=>e.translate).map(({site:e,name:t,exists:n,summary:r})=>({site:e,name:t,missing:!n,summary:r}))}function Js(e){return(e?.localizations??[]).filter(e=>e.update).map(e=>e.site)}function Ys(e,{dirty:t=!1,term:n=!1}={}){return e?.translatesPublished&&(t||e.unpublishedChanges)?__(`Publish first: the translations are made from the published entry.`):t?n?__(`Save first: the translations are made from the saved term.`):__(`Save first: the translations are made from the saved entry.`):null}function Xs(e,{term:t=!1}={}){return t?__(`The saved term is translated and saved in each language you choose. This form stays as it is.`):e?.translatesPublished?__(`The published entry is translated and saved in each language you choose. This form stays as it is.`):__(`The saved entry is translated and saved in each language you choose. This form stays as it is.`)}function Zs(e){return(e?.origin?.localizations??[]).filter(e=>!e.exists).map(e=>e.site)}function Qs(e,t){if(!e)return null;let n=new Map((t?.origin?.localizations??[]).map(e=>[e.site,e])),r=e=>n.get(e)?.name??e,i=e.state,a=(e.sites?.length?e.sites:i?.run?.scope?.sites??[]).map(r),o=Ss(i),s=i?Zo(i):!1,c=s?Ts(i):null,l=s?(e.missing??[]).filter(e=>n.get(e)?.exists):[],u=i?.run?.driver??e.driver,d=e.phase===`running`&&i?.run?.status===`running`&&!!i.stalled,f=d&&u===`queue`;return{sites:a.join(`, `),automatic:!!e.automatic,progress:o,keepOpen:e.phase===`running`&&u===`browser`,stalled:d?$s(f):null,takeOver:f,failure:e.failures?.length?e.failures.at(-1).error?.message??null:null,error:e.phase===`error`?e.error?.message??null:null,result:c&&{...c,text:ec(c.status,o.counts),items:(i.items??[]).map(e=>{let t=Is(e,r);return{...t,handle:e.target_site,editUrl:n.get(e.target_site)?.edit_url??t.editUrl}})},reload:l.length>0}}function $s(e){return e?__(`No queue worker has worked on these translations for a while. Start a queue worker, or translate them in this page instead.`):__(`The process that updates these translations has not worked on them for a while and may have stopped. Cancel it, then start the translations again.`)}function ec(e,t){let n=ws(t,__n(`:count saved|:count saved`,t.done));return{completed:__(`The translations are done: :items.`,{items:n}),completed_with_errors:__(`The translations are done, with errors: :items.`,{items:n}),cancelled:__(`The translations were cancelled: :items.`,{items:n}),aborted:__(`The translations were stopped: :items.`,{items:n})}[e]}function tc({store:e=Us,api:t=J,createFollower:n=Rs,wait:r=e=>new Promise(t=>setTimeout(t,e)),delays:i=Gs}={}){let a=new Map,o=new Set,s=0;function c(t){return Object.values(e().containers).filter(e=>e.push?.run===t)}function l(e,t){for(let n of c(e))n.push.state=t,Zo(t)&&n.push.phase===`running`&&(n.push.phase=`finished`,n.push.cancelling=!1,d(n.reference));Zo(t)&&a.delete(e)}function u(e,t){for(let n of c(e))n.push.failures=t}async function d(n){try{let r=await t.get(`editor/status`,{reference:n});for(let t of Object.values(e().containers))t.reference===n&&(t.status=r)}catch(e){e?.status!==403&&Statamic.$toast.error(__(`The translation status could not be updated: :message`,{message:e?.message??``}))}}function f(e,{run:t=null,driver:n=null,automatic:r=!1,sites:i=null,missing:a=[]}){return{phase:e,run:t,driver:n,automatic:r,sites:i,state:null,failures:[],missing:a,cancelling:!1,takingOver:!1,error:null}}function p(t,n,r,i=null){e().container(t).push=f(`running`,{run:n.run,driver:n.driver,automatic:n.automatic===!0,sites:i,missing:r})}function m(e){return e?.push?.run?a.get(e.push.run)??null:null}function h(e,t){let r=a.get(e.run);r||(r=n({urls:e.urls,lanes:e.lanes,onState:t=>l(e.run,t),onFailures:t=>u(e.run,t)}),a.set(e.run,r)),o.has(e.run)||r.follow(t)}function g(e){return o.add(e),a.get(e)?.stop(),t=>{o.delete(e),a.get(e)?.follow(t)}}async function _(n,{reference:r,sites:i,mode:a,overwriteManual:o=!1,review:s=null,newStatus:c=null}){let l=e().container(n);if(Ws.includes(l.push?.phase)||l.reference!==r)return null;let u=Zs(l.status).filter(e=>i.includes(e));l.push=f(`starting`,{sites:i,missing:u});try{let l=await t.post(`editor/push`,{reference:r,sites:i,mode:a,overwrite_manual:o,review:s,new_status:c});return e().containers[n]?.reference===r&&p(n,l,u,i),h(l,l.state),l}catch(t){let i=e().containers[n];return i?.reference===r?t?.code===`run_active`&&t.data?.active_run?(i.push=null,await v(n,{active_run:t.data.active_run,origin:i.status?.origin}),null):(i.push={...i.push,phase:`error`,error:Fo(t)},null):null}}async function v(n,r){let i=r?.active_run,a=e().containers[n];if(!i||!a||a.push?.run===i.run)return;let o=a.reference;p(n,i,Zs(r));try{h(i,await t.get(i.urls.state))}catch(t){let r=e().containers[n];r?.reference===o&&r.push?.run===i.run&&(r.push.failures=[{error:Fo(t)}])}}async function y(n,a,{published:o=!1}={}){let c=e().containers[n],l=c?.reference;if(a?.active_run){await v(n,a);return}let u=Ks(a),d=o?!!a?.origin?.auto_update:a?.origin?.auto_update===`save`;if(!c||!d||u.length===0||Ws.includes(c.push?.phase))return;let p=++s;c.push={...f(`expecting`,{automatic:!0,sites:u}),expecting:p};let m=()=>{let t=e().containers[n];return t?.reference===l&&t.push?.phase===`expecting`&&t.push.expecting===p?t:null};for(let e of i){if(await r(e),!m())return;let i=null;try{i=await t.get(`editor/status`,{reference:l})}catch{}let a=m();if(!a||i===null){a&&(a.push=null);return}if(a.status=i,i.active_run){a.push=null,await v(n,i);return}if(Ks(i).length===0){a.push=f(`updated`,{automatic:!0,sites:u});return}}let h=m();h&&(h.push=null)}async function b(t){let n=e().containers[t],r=m(n);if(r){n.push.failures=[];try{r.follow(await r.refresh())}catch(e){n.push.failures=[{error:Fo(e)}]}}}async function x(t){let n=e().containers[t],r=m(n);if(r){n.push.cancelling=!0;try{await r.cancel()}catch(e){n.push.cancelling=!1,Statamic.$toast.error(e.message)}}}async function S(t){let n=e().containers[t],r=m(n),i=n?.push;if(r&&!i.takingOver){i.takingOver=!0;try{await r.takeOver()}catch(e){Statamic.$toast.error(e.message)}finally{i.takingOver=!1}}}function C(t){let n=e().containers[t];n&&!Ws.includes(n.push?.phase)&&(n.push=null)}return{start:_,adopt:v,afterSave:y,resume:b,cancel:x,takeOver:S,dismiss:C,lend:g,following:e=>a.has(e)}}var nc=tc(),rc=[`planning`,`working`],ic=[`source_changed`,`plan_expired`,`target_missing`],ac=`edited_in_form`;function oc(e,t=()=>Statamic.$progress){return t()?.names?.().includes(`${e}-entry-publish-form`)??!1}function sc(){return __(`The form is being saved. Try again when the save has finished.`)}function cc(e,t,n){return!!t&&!t.pending&&ro(e.values.value[n],t.value)}function lc(e,t,{name:n,registry:r,delivered:i={}}){let a=Y(t?.localization?.fields),o=e.originValues?.value??{},s=new Set(r.dirtyHandles(n));for(let[t,n]of Object.entries(a))n?.status===`untranslated`&&Object.hasOwn(o,t)&&!ro(e.values.value[t],o[t])&&s.add(t);return[...s].filter(t=>Object.hasOwn(a,t)&&!cc(e,i[t],t))}function uc(e,t){let n=Y(t?.localization?.fields);return e.localizedFields.value.filter(e=>Object.hasOwn(n,e))}function dc(e,{overwriteManual:t=!1}={}){let n=Object.values(e?.delivered??{}).some(e=>!e.pending&&!e.sync),r=e?.status?.localization?.counts??{};return n||(r.current??0)>0||t&&(r.manual??0)>0}function fc(e){let t=new Set([...e?.delivered??[],...Object.keys(e?.skipped??{}),...e?.unchanged??[]]);return(e?.planned??[]).filter(e=>!t.has(e))}function pc(e){if(e?.phase===`error`)return!0;let t=e?.summary?.failed??{};return e?.phase===`done`&&fc(e.summary).some(e=>Object.hasOwn(t,e))}function mc(e){let t=e?.status?.localization;return e?.created&&!e.slugKept&&!t?.translate_slug?t?.origin_slug??null:null}function hc(e){let t=e?.snapshot?.fields;return t?Object.entries(t).some(([t,n])=>bo(n,e.delivered?.[t])):!1}function gc(e,t){return __n(`:fields was changed after the translation and was kept.|:fields were changed after the translation and were kept.`,e.length,{fields:Sa(e,t)})}function _c(e){return Object.entries(Y(e))}function vc(e){return Object.fromEntries(_c(e).filter(([,e])=>e===ac).map(([e])=>[e,`edited`]))}function yc(e){return Object.fromEntries(_c(e).filter(([,e])=>e!==ac))}function bc(e,t){return e.replace===!0&&(e.fields??[]).includes(t)}function xc(e,{reference:t,skip:n}){return{reference:t,mode:e.mode,overwrite_manual:e.overwriteManual,fields:e.fields,skip:n,translator:e.translator,review:e.review,reviewer:e.reviewer}}function Sc(e,{reference:t,handles:n,values:r}){return{reference:t,values:Object.fromEntries(n.map(e=>[e,r[e]])),overwrite_manual:e.overwriteManual,reviewer:e.reviewer}}function Cc(e,t){let n=t.snapshot,r=!1;if(!n||n.reference!==e.reference)return e;for(let[i,a]of Object.entries(n.fields))bo(a,t.delivered[i])&&(e.fields[i]=a,r=!0);return r&&(e.dirty=n.dirty),e}function wc({store:e=Us,registry:t=Ua,api:n=J,concurrency:r=()=>Statamic.$config.get(`tolk.concurrency`),run:i=Ro,fill:a=So,undoFill:o=Co,keepSlug:s=To,recheckSlug:c=Eo,saving:l=oc,toast:u=()=>Statamic.$toast}={}){let d=new Map,f=new Set;function p(e){return l(e)?(u().error(sc()),!0):!1}function m(t){let n=d.get(t),r=e();n&&(d.delete(t),n.controller.abort()),rc.includes(r.containers[t]?.phase)&&r.setPhase(t,`idle`)}function h(t){let n=d.get(t),r=e().containers[t];n&&!n.controller.signal.aborted&&r?.phase===`working`&&(n.controller.abort(),r.progress={...r.progress,cancelling:!0})}async function g(o,l,{continuing:u=!1}={}){let f=e(),m=t.context(o),h=f.container(o);if(!m||rc.includes(h.phase)||d.has(o)||!m.reference.value||p(o))return null;let g=m.reference.value,_={},v=new AbortController,y=()=>d.get(o)?.token===_,b=()=>y()&&f.containers[o]===h&&m.reference.value===g,x=()=>f.containers[o]?.lastChangeAt??0,S=mc(h),C=l.kind===`review`,w=C?l.fields??uc(m,h.status):l.fields,ee=xo(m,w??Object.keys(m.values.value),h.delivered),T=Z(m.values.value),E=C?[]:lc(m,h.status,{name:o,registry:t,delivered:h.delivered}).filter(e=>!bc(l,e)),[te,D]=C?[`editor/review`,Sc(l,{reference:g,handles:w,values:T})]:[`editor/plan`,xc(l,{reference:g,skip:E})];u&&Cc(ee,h),d.set(o,{token:_,controller:v}),Object.assign(h,{request:l,snapshot:ee,summary:null,notSaved:[],planReference:g,progress:Vs().progress}),f.setPhase(o,`planning`);let ne=S?s(m,S,{reference:g,lastChangeAt:x,active:y}):null;ne?.catch(()=>{});try{let e=await n.post(te,D);if(!b())return null;if(ne){if(await ne,!b())return null;h.slugKept=!0}f.setPhase(o,`working`),h.progress={...Vs().progress,total:e.units?.length??0};let t={reference:g,plan:e.plan,lastChangeAt:x,planValues:T,delivered:h.delivered,active:y},s=await i({api:n,plan:e,concurrency:r(),signal:v.signal,finishing:y,onFields:e=>a(m,e,t),onProgress:e=>{b()&&(h.progress={...e,cancelling:v.signal.aborted})}});if(ne&&s.delivered.length&&b()&&await c(m,S,{reference:g,active:y}),!b())return null;let u={...s,kind:l.kind,reviewer:e.reviewer??null,plan:e.plan,planned:Array.isArray(e.fields)?e.fields:[],skipped:{...vc(e.skipped),...s.skipped},planSkipped:yc(e.skipped),warnings:[...new Set([...Array.isArray(e.warnings)?e.warnings:[],...s.warnings??[]])],cancelled:v.signal.aborted};return h.summary=u,f.setPhase(o,s.stopped?`error`:`done`,s.stopped),u}catch(e){return b()&&f.setPhase(o,`error`,Fo(e,__(`Something went wrong.`))),null}finally{y()&&d.delete(o)}}function _(e,{mode:t=`missing`,fields:n=null,overwriteManual:r=!1,translator:i=null,review:a=null,reviewer:o=null,replace:s=!1}={}){return g(e,{kind:`translate`,mode:t,fields:n,overwriteManual:r,translator:i,review:a,reviewer:o,replace:s})}function v(e,{fields:t=null,overwriteManual:n=!1,reviewer:r=null}={}){return g(e,{kind:`review`,fields:t,overwriteManual:n,reviewer:r})}function y(t){let n=e().containers[t];if(!n?.request||rc.includes(n.phase))return null;let r=n.summary?fc(n.summary):n.request.fields;return r!==null&&r.length===0?(e().setPhase(t,`done`),null):g(t,{...n.request,fields:r},{continuing:!0})}async function b(n){let r=e(),i=r.containers[n],a=t.context(n);if(!a||!i?.snapshot||rc.includes(i.phase)||f.has(n)||p(n))return null;f.add(n);try{let e=await o(a,i.snapshot,i.delivered,{registry:t});return r.containers[n]===i&&r.clearResult(n),e}finally{f.delete(n)}}return{translate:_,review:v,retry:y,cancel:h,abort:m,undo:b,running:e=>d.has(e),current:e=>d.get(e)?.token??null,saving:e=>l(e)}}var $=wc(),Tc=`tolk-banner`;function Ec(e){return typeof e==`string`&&e.startsWith(`term::`)}function Dc(e,t){return[`idle`,`done`,`error`].includes(e)&&!!t?.localization&&!t?.setup}function Oc(e){let t=e?.reference?.value;return e?.name===`base`&&typeof t==`string`&&(t.startsWith(`entry::`)||Ec(t))&&Statamic.$config.get(`tolk.multisite`)===!0&&Statamic.$permissions.has(`translate content`)}function kc({store:e=Us,abort:t=e=>$.abort(e)}={}){let n=new Map,r=!1;function i(e=Statamic.$events){r||(r=!0,e.$on(`publish-container-created`,a),e.$on(`publish-container-destroyed`,o))}function a(e){let t=null;s(e.name),Oc(e)&&(t=e.pushComponent(Tc,{props:{containerName:e.name}})),n.set(e.name,[...n.get(e.name)??[],t])}function o({name:e}){let[t,...r]=n.get(e)??[];t?.destroy(),r.length?n.set(e,r):(n.delete(e),s(e))}function s(n){t(n),e().forget(n)}return{listen:i,pushed:e=>(n.get(e)??[]).filter(Boolean).length}}var Ac=kc();function jc({name:e,ctx:t,store:n=Us(),registry:r=Ua,loadStatus:i=e=>$i(`editor/status`,{reference:e}),now:a=Date.now,settleMs:o=600,onSwitch:s=e=>$.abort(e),onStatus:c=(e,t)=>nc.adopt(e,t)}){let l=I(null),u=!!t.reference.value&&n.container(e).reference===t.reference.value;r.attachContext(e,t);let d=r=>t.reference.value===r&&n.containers[e]?.reference===r;async function f(r){if(l.value=null,!t.readOnly?.value)try{let t=await i(r);d(r)&&(n.container(e).status=t,c(e,t))}catch(e){d(r)&&e?.status!==403&&(l.value=e)}}function p(t){let i=a();s(e),n.switched(e,t,i),r.refreshClean(e),setTimeout(()=>{n.containers[e]?.lastChangeAt===i&&d(t)&&r.refreshClean(e)},o),f(t)}return{failure:l,stop:bn(()=>[t.reference.value,t.site.value],([t],r)=>{if(t){if(r===void 0&&u){n.container(e).status===null&&f(t);return}p(t)}},{immediate:!0,flush:`post`})}}function Mc(){let e=!1,t=!1,n=Dt({open:!1,show(){e?t=!0:n.open=!0},hide(){t=!1,e||(n.open=!1)},dismissed(){e=!0},closed(r){r||(e=!1,n.open=!1,t&&(t=!1,nt(()=>n.open=!0)))}});return n}var Nc={class:`space-y-2 ps-6`,"data-tolk-push":``},Pc={class:`sr-only`,"aria-live":`polite`,"data-tolk-push-announcement":``},Fc={key:0,class:`flex flex-wrap items-center gap-2 pt-1`,"data-tolk-push-actions":``},Ic={key:3,class:`flex flex-wrap items-center gap-2`,"data-tolk-push-phase":`updated`},Lc={key:4,class:`space-y-2`,"data-tolk-push-phase":`running`},Rc={class:`flex flex-wrap items-center justify-between gap-2`},zc={key:1,class:`flex flex-wrap items-center gap-2`,"data-tolk-push-stalled":``},Bc={key:2,class:`flex flex-wrap items-center gap-2`,"data-tolk-push-failure":``},Vc=[`data-tolk-push-status`],Hc={class:`space-y-1`},Uc=[`data-tolk-push-item`,`data-tolk-push-item-status`],Wc=[`href`],Gc=[`href`],Kc={class:`flex flex-wrap gap-2`},qc={key:6,class:`flex flex-wrap items-center gap-2`,"data-tolk-push-phase":`error`},Jc={class:`space-y-6`},Yc={class:`space-y-3`},Xc=[`data-tolk-push-site`],Zc={class:`flex items-center justify-end gap-3 pt-3 pb-1`},Qc={__name:`OriginPush`,props:{containerName:{type:String,required:!0},reference:{type:String,required:!0},origin:{type:Object,required:!0},status:{type:Object,default:null},dirty:{type:Boolean,default:!1}},setup(e){let t=e,n=Us(),r=O(()=>n.containers[t.containerName]?.push??null),i=O(()=>Qs(r.value,t.status)),a=O(()=>Ws.includes(r.value?.phase)),o=O(()=>!a.value&&(t.origin.translateInto||t.origin.update)),s=O(()=>qs(t.origin)),c=Mc(),l=I([]),u=I(`draft`),d=I(!1),f=O(()=>s.value.some(e=>e.missing&&l.value.includes(e.site))),p=O(()=>Ec(t.reference)),h=O(()=>Ys(t.origin,{dirty:t.dirty,term:p.value})),g=O(()=>Xs(t.origin,{term:p.value}));function _(){l.value=s.value.map(e=>e.site),u.value=t.status?.defaults?.new_status===`mirror`?`mirror`:`draft`,d.value=t.status?.defaults?.review===!0,c.show()}function v(e,t){l.value=t?[...new Set([...l.value,e])]:l.value.filter(t=>t!==e)}function y(){c.hide(),nc.start(t.containerName,{reference:t.reference,sites:s.value.map(e=>e.site).filter(e=>l.value.includes(e)),mode:`missing`,review:d.value,newStatus:f.value?u.value:null})}function b(){nc.start(t.containerName,{reference:t.reference,sites:Js(t.origin),mode:`update`})}let x=O(()=>i.value?.automatic?__(`Updating the translations automatically into :sites…`,{sites:i.value.sites}):__(`Translating into :sites…`,{sites:i.value.sites})),S=O(()=>__(`The translations into :sites were updated automatically.`,{sites:i.value?.sites??``})),C=O(()=>{switch(r.value?.phase){case`starting`:return __(`Starting the translation…`);case`expecting`:return x.value;case`updated`:return S.value;case`running`:return i.value.failure?__(`The translations stopped: :message`,{message:i.value.failure}):i.value.stalled??x.value;case`error`:return i.value?.error??``;default:return i.value?.result?.text??``}});function w(){window.location.reload()}return(t,n)=>(F(),j(`div`,Nc,[M(`p`,Pc,R(C.value),1),o.value?(F(),j(`div`,Fc,[e.origin.translateInto?(F(),k(z(V),{key:0,variant:`primary`,size:`sm`,disabled:e.dirty,"data-tolk-action":`translate-into`,onClick:_},{default:B(()=>[N(R(t.__(`Translate into…`)),1)]),_:1},8,[`disabled`])):A(``,!0),e.origin.update?(F(),k(z(V),{key:1,size:`sm`,disabled:e.dirty,"data-tolk-action":`update-translations`,onClick:b},{default:B(()=>[N(R(t.__(`Update translations`)),1)]),_:1},8,[`disabled`])):A(``,!0),h.value?(F(),k(z(U),{key:2,"data-tolk-save-first":``},{default:B(()=>[N(R(h.value),1)]),_:1})):A(``,!0)])):A(``,!0),r.value?.phase===`starting`?(F(),k(z(q),{key:1,as:`p`,"data-tolk-push-phase":`starting`},{default:B(()=>[N(R(t.__(`Starting the translation…`)),1)]),_:1})):A(``,!0),r.value?.phase===`expecting`?(F(),k(z(q),{key:2,as:`p`,"data-tolk-push-phase":`expecting`},{default:B(()=>[N(R(x.value),1)]),_:1})):A(``,!0),r.value?.phase===`updated`?(F(),j(`div`,Ic,[P(z(q),null,{default:B(()=>[N(R(S.value),1)]),_:1}),P(z(V),{size:`sm`,variant:`ghost`,"data-tolk-action":`push-close`,onClick:n[0]||=t=>z(nc).dismiss(e.containerName)},{default:B(()=>[N(R(t.__(`Close`)),1)]),_:1})])):A(``,!0),r.value?.phase===`running`?(F(),j(`div`,Lc,[M(`div`,Rc,[r.value.cancelling?(F(),k(z(q),{key:0},{default:B(()=>[N(R(t.__(`Cancelling. Translations already being saved are still saved.`)),1)]),_:1})):(F(),k(z(q),{key:1,"data-tolk-push-working":``},{default:B(()=>[N(R(x.value),1)]),_:1})),P(z(V),{size:`sm`,variant:`ghost`,disabled:r.value.cancelling,"data-tolk-action":`push-cancel`,onClick:n[1]||=t=>z(nc).cancel(e.containerName)},{default:B(()=>[N(R(t.__(`Cancel`)),1)]),_:1},8,[`disabled`])]),P(Va,{value:i.value.progress.finished,max:i.value.progress.total,label:t.__(`Translation progress`)},null,8,[`value`,`max`,`label`]),P(z(U),{"data-tolk-push-progress":``},{default:B(()=>[N(R(t.__(`:finished of :total translations finished.`,{finished:i.value.progress.finished,total:i.value.progress.total})),1)]),_:1}),i.value.keepOpen?(F(),k(z(U),{key:0},{default:B(()=>[N(R(p.value?t.__(`Keep this page open until the translations are saved. If you leave, they continue when you open this term again.`):t.__(`Keep this page open until the translations are saved. If you leave, they continue when you open this entry again.`)),1)]),_:1})):A(``,!0),i.value.stalled?(F(),j(`div`,zc,[P(z(Cr),{name:`warning-diamond`,class:`size-4 shrink-0 text-amber-600`,"aria-hidden":`true`}),P(z(q),null,{default:B(()=>[N(R(i.value.stalled),1)]),_:1}),i.value.takeOver?(F(),k(z(V),{key:0,size:`sm`,disabled:r.value.takingOver||r.value.cancelling,loading:r.value.takingOver,"data-tolk-action":`push-take-over`,onClick:n[2]||=t=>z(nc).takeOver(e.containerName)},{default:B(()=>[N(R(t.__(`Translate in this page instead`)),1)]),_:1},8,[`disabled`,`loading`])):A(``,!0)])):A(``,!0),i.value.failure?(F(),j(`div`,Bc,[P(z(Cr),{name:`warning-diamond`,class:`size-4 shrink-0 text-red-600`,"aria-hidden":`true`}),P(z(q),{variant:`danger`},{default:B(()=>[N(R(t.__(`The translations stopped: :message`,{message:i.value.failure})),1)]),_:1}),P(z(V),{size:`sm`,"data-tolk-action":`push-resume`,onClick:n[3]||=t=>z(nc).resume(e.containerName)},{default:B(()=>[N(R(t.__(`Try again`)),1)]),_:1})])):A(``,!0)])):A(``,!0),i.value?.result?(F(),j(`div`,{key:5,class:`space-y-2`,"data-tolk-push-result":``,"data-tolk-push-status":i.value.result.status},[P(z(q),{as:`p`},{default:B(()=>[N(R(i.value.result.text),1)]),_:1}),i.value.result.error?(F(),k(z(q),{key:0,as:`p`,variant:`danger`},{default:B(()=>[N(R(i.value.result.error),1)]),_:1})):A(``,!0),M(`ul`,Hc,[(F(!0),j(m,null,L(i.value.result.items,e=>(F(),j(`li`,{key:e.index,class:`flex flex-wrap items-center gap-2`,"data-tolk-push-item":e.handle,"data-tolk-push-item-status":e.status},[e.editUrl?(F(),j(`a`,{key:0,href:e.editUrl,class:`text-sm font-medium underline`},R(e.site),9,Wc)):(F(),k(z(q),{key:1,variant:`strong`},{default:B(()=>[N(R(e.site),1)]),_:2},1024)),P(z(Fn),{text:e.statusLabel,color:e.statusColor},null,8,[`text`,`color`]),e.error||e.reason?(F(),k(z(U),{key:2},{default:B(()=>[N(R(e.error??e.reason)+` `,1),e.rootPage?(F(),j(`a`,{key:0,href:e.rootPage.url,class:`font-medium underline`,"data-tolk-root-page":``},R(t.__(`Open :title`,{title:e.rootPage.title})),9,Gc)):A(``,!0)]),_:2},1024)):A(``,!0)],8,Uc))),128))]),i.value.reload?(F(),k(z(U),{key:1},{default:B(()=>[N(R(t.__(`Reload the page to see the new localizations in the Sites panel.`)),1)]),_:1})):A(``,!0),M(`div`,Kc,[i.value.reload?(F(),k(z(V),{key:0,size:`sm`,variant:`primary`,"data-tolk-action":`reload`,onClick:w},{default:B(()=>[N(R(t.__(`Reload`)),1)]),_:1})):A(``,!0),P(z(V),{size:`sm`,variant:`ghost`,"data-tolk-action":`push-close`,onClick:n[4]||=t=>z(nc).dismiss(e.containerName)},{default:B(()=>[N(R(t.__(`Close`)),1)]),_:1})])],8,Vc)):A(``,!0),r.value?.phase===`error`?(F(),j(`div`,qc,[P(z(Cr),{name:`warning-diamond`,class:`size-4 shrink-0 text-red-600`,"aria-hidden":`true`}),P(z(q),{variant:`danger`,"data-tolk-push-error":``},{default:B(()=>[N(R(i.value.error),1)]),_:1}),P(z(V),{size:`sm`,variant:`ghost`,"data-tolk-action":`push-close`,onClick:n[5]||=t=>z(nc).dismiss(e.containerName)},{default:B(()=>[N(R(t.__(`Close`)),1)]),_:1})])):A(``,!0),z(c).open?(F(),k(z(Gr),{key:7,open:``,title:t.__(`Translate into other languages`),icon:`dictionary-language-book`,"data-tolk-push-modal":``,onDismissed:n[9]||=e=>z(c).dismissed(),"onUpdate:open":n[10]||=e=>z(c).closed(e)},{footer:B(()=>[M(`div`,Zc,[P(z(V),{variant:`ghost`,text:t.__(`Cancel`),"data-tolk-push-action":`close`,onClick:n[8]||=e=>z(c).hide()},null,8,[`text`]),P(z(V),{variant:`primary`,text:t.__(`Translate`),disabled:l.value.length===0,"data-tolk-push-action":`translate`,onClick:y},null,8,[`text`,`disabled`])])]),default:B(()=>[M(`div`,Jc,[P(z(q),{as:`p`},{default:B(()=>[N(R(g.value),1)]),_:1}),M(`div`,Yc,[(F(!0),j(m,null,L(s.value,e=>(F(),j(`div`,{key:e.site,"data-tolk-push-site":e.site},[P(z(Hn),{"model-value":l.value.includes(e.site),label:e.name,description:e.summary,class:`dark:[&_p]:text-gray-400!`,"onUpdate:modelValue":t=>v(e.site,t)},null,8,[`model-value`,`label`,`description`,`onUpdate:modelValue`])],8,Xc))),128))]),f.value?(F(),k(z(br),{key:0,id:`tolk-push-status`,label:t.__(`New localizations`)},{default:B(()=>[P(z(di),{modelValue:u.value,"onUpdate:modelValue":n[6]||=e=>u.value=e,appearance:`inline`,"data-tolk-push-new-status":``},{default:B(()=>[P(z(ui),{value:`draft`,label:t.__(`Drafts`)},null,8,[`label`]),P(z(ui),{value:`mirror`,label:t.__(`Same as origin`)},null,8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`label`])):A(``,!0),P(z(Hn),{modelValue:d.value,"onUpdate:modelValue":n[7]||=e=>d.value=e,label:t.__(`Review after translating`),description:t.__(`A second model checks each translation and corrects it before it is saved.`),class:`dark:[&_p]:text-gray-400!`},null,8,[`modelValue`,`label`,`description`])])]),_:1},8,[`title`])):A(``,!0)]))}},$c=`tolk.offer`,el=null;function tl(e,t,{preferences:n=()=>Statamic.$preferences,toast:r=()=>Statamic.$toast}={}){let i=()=>new Promise(r=>r(n().set(e,t))).then(()=>!0,()=>(r().error(__(`Your choice could not be saved.`)),!1)),a=el?el.then(i):i();return el=a,a.then(()=>{el===a&&(el=null)}),a}function nl(e=Statamic.$preferences){return e.get($c,!0)!==!1}function rl(e,t=Statamic.$preferences){return e?.offer===!0&&nl(t)&&da(e).localization?.translate===!0}function il(e){let t=da(e);return{count:e?.localization?.counts?.untranslated??0,source:t.localization?.source?.name??``,target:t.localization?.target?.name??``,translator:t.translator}}var al=350;function ol({store:e=Us,registry:t=Ua,translations:n=$,preferences:r=()=>Statamic.$preferences,toast:i=()=>Statamic.$toast,openAfterMs:a=al,clock:o=()=>Date.now(),wait:s=(e,t)=>setTimeout(e,t)}={}){let c=null,l=!1;function u(e=Statamic.$events){l||(l=!0,e.$on(`localization.created`,d))}function d(n){let r=n?.container?.name,i=t.context(r)?.reference?.value;if(r!==`base`||!i)return;m();let s=e(),l=o()+a;if(f(s,r,i,l))return;let u=bn(()=>{let e=s.containers[r];return[e?.reference,e?.status]},()=>{f(s,r,i,l)&&(u(),c===u&&(c=null))});c=u}function f(e,n,r,i){let a=e.containers[n];return a?.reference===r?(a.created=!0,a.status!==null&&(p(e,n,r,i),!0)):t.context(n)?.reference?.value!==r}function p(e,t,n,i){let a=i-o();if(a>0){s(()=>p(e,t,n,i),a);return}let c=e.containers[t];c?.reference===n&&c.phase===`idle`&&rl(c.status,r())&&e.setPhase(t,`offer`)}function m(){c?.(),c=null}function h(t,n){let a=e();return a.phaseOf(t)===`offer`&&(n&&tl($c,!1,{preferences:r,toast:i}),a.setPhase(t,`idle`),!0)}function g(e,{dontOfferAgain:t=!1}={}){return h(e,t)?n.translate(e,{mode:`missing`}):null}function _(e,{dontOfferAgain:t=!1}={}){h(e,t)}return{listen:u,created:d,accept:g,decline:_,waiting:e=>e===`base`&&c!==null}}var sl=ol(),cl={class:`space-y-1`},ll={class:`flex items-center justify-end gap-3 pt-3 pb-1`},ul={__name:`TranslateOffer`,props:{containerName:{type:String,required:!0},status:{type:Object,default:null},open:{type:Boolean,default:!1}},setup(e){let t=e,n=I(!1),r=O(()=>il(t.status));bn(()=>t.open,e=>{e&&(n.value=!1)});function i(){sl.accept(t.containerName,{dontOfferAgain:n.value})}function a(){sl.decline(t.containerName,{dontOfferAgain:n.value})}return(t,o)=>(F(),k(z(Gr),{open:e.open,title:t.__(`Translate this entry?`),icon:`dictionary-language-book`,"data-tolk-offer":``,onDismissed:a},{footer:B(()=>[M(`div`,ll,[P(z(V),{variant:`ghost`,text:t.__(`Not now`),"data-tolk-offer-action":`decline`,onClick:a},null,8,[`text`]),P(z(V),{variant:`primary`,text:t.__(`Translate`),"data-tolk-offer-action":`translate`,onClick:i},null,8,[`text`])])]),default:B(()=>[M(`div`,cl,[P(z(q),{as:`p`,"data-tolk-offer-text":``},{default:B(()=>[N(R(t.__n(`Translate :count field from :source into :target. Nothing is saved until you press Save.|Translate :count fields from :source into :target. Nothing is saved until you press Save.`,r.value.count,{source:r.value.source,target:r.value.target})),1)]),_:1}),r.value.translator?(F(),k(z(U),{key:0,"data-tolk-offer-model":``},{default:B(()=>[N(R(t.__(`Model: :model`,{model:z(xa)(r.value.translator)})),1)]),_:1})):A(``,!0)]),P(z(Hn),{modelValue:n.value,"onUpdate:modelValue":o[0]||=e=>n.value=e,label:t.__(`Don't offer again`)},null,8,[`modelValue`,`label`])]),_:1},8,[`open`,`title`]))}};function dl(e=globalThis.event){return e?.type!==`focus`}function fl(){return dl()}var pl=`automatic`;function ml(e){return typeof e==`string`&&e.trim()!==``?e.trim():null}function hl(e){return/^[^\s:]+:\S+$/.test(e)}function gl(e){return{quality:__(`Quality`),fast:__(`Fast`)}[e]??null}function _l(e,t){return{value:e,label:e,note:Y(t)[e.split(`:`)[0]]?.[0]?.configured===!1?__(`No API key`):__(`Custom model`),disabled:!1}}function vl(e,t){let n=[{value:pl,label:e?.automatic||__(`Automatic`),note:null,disabled:!1}],r=e?.fake_engine===!0;for(let t of Object.values(Y(e?.catalog)).flat())n.push({value:t.value,label:t.label,note:t.configured?gl(t.tier):__(`No API key`),disabled:!t.configured&&!r});let i=ml(t);return i&&!n.some(e=>e.value===i)&&n.push(_l(i,e?.catalog)),n}function yl(e,t){if(e===null||e===`automatic`)return null;let n=t.find(t=>t.value===e);if(n)return n.disabled?void 0:n.value;let r=typeof e==`string`?e.trim():``;return hl(r)?r:void 0}var bl=`tolk.editor.translator`,xl=`tolk.editor.reviewer`;function Sl(e,t){let n=e.get(t,null);return typeof n==`string`&&n!==``?n:null}function Cl(e=Statamic.$preferences,t=bl){let n=Sl(e,t);return n!==null&&hl(n)?n:null}function wl(e,{fakeEngine:t=!1,defaultModel:n=null,extra:r=[]}={}){let i=[];for(let r of Object.values(Y(e)).flat())(r.configured||t)&&i.push({value:r.value,label:r.value===n?__(`:model (default)`,{model:r.label}):r.label});for(let e of r)e&&!i.some(t=>t.value===e)&&i.push({value:e,label:e===n?__(`:model (default)`,{model:e}):e});return i}function Tl(e,t,n){if(t.some(t=>t.value===e))return e;let r=typeof e==`string`?e.trim():``;return hl(r)?r:n}function El(e,{remembered:t=null,defaultModel:n=null}={}){let r=t=>t!==null&&e.some(e=>e.value===t);return r(t)?t:r(n)?n:e[0]?.value??null}function Dl(e,t){return e&&e!==t?e:null}function Ol(e,t,n){return n?e||null:Dl(e,t)}function kl({model:e=null,defaultModel:t=null,retranslate:n=!1,overwriteManual:r=!1,review:i=null,reviewer:a=null,defaultReviewer:o=null}={}){let s=Dl(e,t);return{mode:n?`all`:`update`,overwriteManual:r,translator:s,review:i,reviewer:i===!0?Ol(a,o,s):null}}function Al({reviewer:e=null,defaultReviewer:t=null,overwriteManual:n=!1}={}){return{overwriteManual:n,reviewer:Dl(e,t)}}function jl(e){let t=e?.localization?.counts??{},n=Object.values(e?.localization?.fields??{}).filter(e=>e.incomplete).length;return{markCurrent:(t.attention??0)+(t.untracked??0)>0,protect:(t.current??0)+(t.outdated??0)-n>0}}function Ml(e,t){return e===0?__(`No field needed changing.`):t?__n(`:count field is now protected from updates.|:count fields are now protected from updates.`,e):__n(`:count field marked as up to date.|:count fields marked as up to date.`,e)}function Nl({store:e=Us,registry:t=Ua,api:n=J,translations:r=$,preferences:i=()=>Statamic.$preferences,toast:a=()=>Statamic.$toast}={}){let o=null;function s(){return o??=n.get(`models`).catch(e=>{throw o=null,e}),o}function c(e,t){t!==Sl(i(),e)&&tl(e,t,{preferences:i,toast:a})}function l(t,n={}){let i=kl(n);return rc.includes(e().phaseOf(t))?null:(c(bl,i.translator),i.review===!0&&c(xl,Dl(n.reviewer,n.defaultReviewer)),r.translate(t,i))}function u(t,n={}){let i=Al(n);return rc.includes(e().phaseOf(t))?null:(c(xl,i.reviewer),r.review(t,i))}async function d(r,{protect:i=!1}={}){let o=e().containers[r],s=t.context(r)?.reference?.value??null;if(!o||!s||o.reference!==s||rc.includes(o.phase))return null;try{let{baselined:e=0,...t}=await n.post(`editor/baseline`,{reference:s,protect:i});return o.status=t,a().success(Ml(e,i)),e}catch(e){return a().error(e?.message||__(`Something went wrong.`)),null}}function f(e){return tl($c,e,{preferences:i,toast:a})}return{loadModels:s,translate:l,review:u,baseline:d,setOffers:f}}var Pl=Nl(),Fl={class:`space-y-4`},Il={class:`space-y-3`},Ll={class:`grid gap-4 sm:grid-cols-2`},Rl={class:`space-y-3`},zl={key:0,class:`space-y-3 border-t border-gray-200 pt-4 dark:border-gray-700`,"aria-labelledby":`tolk-options-state-heading`,"data-tolk-options-state":``},Bl={key:0,class:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`},Vl={key:1,class:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`},Hl={key:1,class:`flex items-start justify-between gap-4 border-t border-gray-200 pt-4 dark:border-gray-700`,"data-tolk-options-offer":``},Ul={class:`space-y-0.5`},Wl={class:`flex items-center justify-end gap-3 pt-3 pb-1`},Gl={__name:`TranslateOptions`,props:{containerName:{type:String,required:!0},status:{type:Object,default:null}},setup(e){let t=e,n=Us(),r=O(()=>Ec(n.containers[t.containerName]?.reference)),i=Mc(),a=I(!1),o=I(null),s=I(null),c=I(null),l=I(null),u=I(!1),d=I(!1),f=I(!1),p=I(!0),h=I(!1),g=!!Statamic.$config.get(`tolk.settingsUrl`),_=O(()=>s.value?.defaults?.translator??t.status?.defaults?.translator??null),v=O(()=>s.value?.defaults?.reviewer??null),y=O(()=>Cl()),b=O(()=>Cl(Statamic.$preferences,xl));function x(e,n,r){return wl(s.value?.catalog,{fakeEngine:t.status?.defaults?.fake_engine===!0,defaultModel:e,extra:g?[e,n,r]:[e]})}let S=O(()=>x(_.value,y.value,c.value)),C=O(()=>x(v.value,b.value,l.value)),w=O(()=>dc(n.containers[t.containerName],{overwriteManual:f.value})),ee=O(()=>u.value||w.value),T=O(()=>jl(t.status)),E=O(()=>t.status?.offer===!0);async function te(){d.value=!1,f.value=!1,u.value=t.status?.defaults?.review===!0,o.value=null,p.value=nl(),i.show(),a.value=!0;try{s.value=await Pl.loadModels()}catch(e){o.value=e.message}finally{a.value=!1}c.value=El(S.value,{remembered:y.value,defaultModel:_.value}),l.value=El(C.value,{remembered:b.value,defaultModel:v.value})}function D(){i.hide(),Pl.translate(t.containerName,{model:c.value,defaultModel:_.value,retranslate:d.value,overwriteManual:f.value,review:u.value,reviewer:l.value,defaultReviewer:v.value})}function ne(){i.hide(),Pl.review(t.containerName,{reviewer:l.value,defaultReviewer:v.value,overwriteManual:f.value})}async function re(e){h.value=!0;try{await Pl.baseline(t.containerName,{protect:e})!==null&&i.hide()}finally{h.value=!1}}async function ie(e){p.value=e,await Pl.setOffers(e)||(p.value=!e)}return(e,t)=>(F(),j(m,null,[P(z(V),{size:`sm`,variant:`ghost`,icon:`sliders-horizontal`,text:e.__(`Options`),"data-tolk-action":`options`,onClick:te},null,8,[`text`]),z(i).open?(F(),k(z(Gr),{key:0,open:``,title:e.__(`Translation options`),icon:`sliders-horizontal`,"data-tolk-options":``,onDismissed:t[8]||=e=>z(i).dismissed(),"onUpdate:open":t[9]||=e=>z(i).closed(e)},{footer:B(()=>[M(`div`,Wl,[P(z(V),{variant:`ghost`,text:e.__(`Close`),"data-tolk-options-action":`close`,onClick:t[7]||=e=>z(i).hide()},null,8,[`text`]),w.value?(F(),k(z(V),{key:0,text:e.__(`Review`),disabled:a.value||!l.value,"data-tolk-options-action":`review`,onClick:ne},null,8,[`text`,`disabled`])):A(``,!0),P(z(V),{variant:`primary`,text:e.__(`Translate`),disabled:a.value||!c.value,"data-tolk-options-action":`translate`,onClick:D},null,8,[`text`,`disabled`])])]),default:B(()=>[M(`div`,Fl,[M(`div`,Il,[M(`div`,Ll,[P(z(br),{id:`tolk-options-model`,label:e.__(`Model`)},{default:B(()=>[P(z(Gn),{id:`tolk-options-model`,"model-value":c.value,options:S.value,taggable:z(g),"should-open-dropdown":z(fl),disabled:a.value,placeholder:a.value?e.__(`Loading…`):e.__(`Choose a model`),"data-tolk-options-model":``,"onUpdate:modelValue":t[0]||=e=>c.value=z(Tl)(e,S.value,c.value)},null,8,[`model-value`,`options`,`taggable`,`should-open-dropdown`,`disabled`,`placeholder`])]),_:1},8,[`label`]),P(z(br),{id:`tolk-options-reviewer`,label:e.__(`Reviewer`),"data-tolk-options-review":``},{default:B(()=>[P(z(Gn),{id:`tolk-options-reviewer`,"model-value":l.value,options:C.value,taggable:z(g),"should-open-dropdown":z(fl),disabled:a.value||!ee.value,placeholder:a.value?e.__(`Loading…`):e.__(`Choose a model`),"data-tolk-options-reviewer":``,"onUpdate:modelValue":t[1]||=e=>l.value=z(Tl)(e,C.value,l.value)},null,8,[`model-value`,`options`,`taggable`,`should-open-dropdown`,`disabled`,`placeholder`])]),_:1},8,[`label`])]),z(g)?(F(),k(z(U),{key:0},{default:B(()=>[N(R(e.__(`You may also type a model outside the list, as provider:model.`)),1)]),_:1})):A(``,!0),o.value?(F(),k(z(q),{key:1,as:`p`,variant:`danger`,"data-tolk-options-failure":``},{default:B(()=>[N(R(e.__(`The models could not be loaded: :message`,{message:o.value})),1)]),_:1})):A(``,!0)]),M(`div`,Rl,[P(z(Hn),{modelValue:d.value,"onUpdate:modelValue":t[2]||=e=>d.value=e,label:e.__(`Retranslate everything`),description:e.__(`Also translates the fields that are up to date again.`),class:`dark:[&_p]:text-gray-400!`},null,8,[`modelValue`,`label`,`description`]),P(z(Hn),{modelValue:f.value,"onUpdate:modelValue":t[3]||=e=>f.value=e,label:e.__(`Overwrite manual edits`),description:e.__(`Also replaces the text of fields edited by hand.`),class:`dark:[&_p]:text-gray-400!`},null,8,[`modelValue`,`label`,`description`]),P(z(Hn),{modelValue:u.value,"onUpdate:modelValue":t[4]||=e=>u.value=e,label:e.__(`Review after translating`),description:e.__(`The reviewer checks the new translation and corrects it.`),class:`dark:[&_p]:text-gray-400!`},null,8,[`modelValue`,`label`,`description`])]),T.value.markCurrent||T.value.protect?(F(),j(`section`,zl,[P(z(W),{id:`tolk-options-state-heading`,level:2,text:e.__(`Translation status`)},null,8,[`text`]),T.value.markCurrent?(F(),j(`div`,Bl,[P(z(U),null,{default:B(()=>[N(R(e.__(`Records that the fields edited by hand match the current source, so a later change to the source is flagged.`)),1)]),_:1}),P(z(V),{size:`sm`,class:`shrink-0 self-start sm:self-auto`,text:e.__(`Mark manual fields as up to date`),disabled:h.value,"data-tolk-action":`mark-current`,onClick:t[5]||=e=>re(!1)},null,8,[`text`,`disabled`])])):A(``,!0),T.value.protect?(F(),j(`div`,Vl,[P(z(U),null,{default:B(()=>[N(R(e.__(`Treats the translated fields as edited by hand, so Translate and Update leave them alone.`)),1)]),_:1}),P(z(V),{size:`sm`,class:`shrink-0 self-start sm:self-auto`,text:r.value?e.__(`Protect this term from updates`):e.__(`Protect this entry from updates`),disabled:h.value,"data-tolk-action":`protect`,onClick:t[6]||=e=>re(!0)},null,8,[`text`,`disabled`])])):A(``,!0)])):A(``,!0),E.value&&!r.value?(F(),j(`div`,Hl,[M(`div`,Ul,[P(z(Or),{for:`tolk-options-offer`,text:e.__(`Offer to translate new localizations`)},null,8,[`text`]),P(z(U),{id:`tolk-options-offer-description`},{default:B(()=>[N(R(e.__(`Asks whether to translate each localization you create. Only for your account.`)),1)]),_:1})]),P(z(xi),{id:`tolk-options-offer`,"model-value":p.value,"aria-describedby":`tolk-options-offer-description`,"onUpdate:modelValue":ie},null,8,[`model-value`])])):A(``,!0)])]),_:1},8,[`title`])):A(``,!0)],64))}},Kl=`localizable`,ql={ok:{color:`green`,icon:`checkmark`,class:`text-green-600`},warning:{color:`amber`,icon:`alert-warning-exclamation-mark`,class:`text-amber-600`},error:{color:`red`,icon:`warning-diamond`,class:`text-red-600`}};function Jl(e){return`tolk-audit-${e}`}function Yl(e){return e?`${e}#${Jl(Kl)}`:null}function Xl(e){return{ok:__(`OK`),warning:__(`Warning`),error:__(`Error`)}[e]??e}function Zl(e){return{label:Xl(e),...ql[e]??ql.warning}}function Ql(e){let t=(Array.isArray(e)?e:[]).flatMap(e=>e.items??[]),n=t.filter(e=>e.level===`error`).length,r=t.filter(e=>e.level===`warning`).length;if(n===0&&r===0)return{level:`ok`,text:__(`Everything is set up. Tolk found nothing to change.`)};let i=[n>0?__n(`:count error|:count errors`,n):null,r>0?__n(`:count warning|:count warnings`,r):null].filter(Boolean);return{level:n>0?`error`:`warning`,text:__(`The audit found :problems. Errors keep Tolk from translating; warnings leave something untranslated or slower than it could be.`,{problems:i.join(`, `)})}}function $l(e,t){return e?.id===`localizable`?t?__(`A text field that is not localizable is shared by every site, so Tolk does not translate it. Choose the fields that hold text in each language and make them localizable.`):__(`A text field that is not localizable is shared by every site, so Tolk does not translate it. Someone who may edit the Tolk settings and blueprints can make them localizable here, or with php please tolk:doctor --fix-localizable.`):e?.detail??``}function eu(e){return typeof e?.namespace==`string`&&typeof e?.blueprint==`string`&&Array.isArray(e?.fields)}function tu(e){return`${e.namespace}|${e.blueprint}`}function nu(e){let t=Array.isArray(e?.fields)?e.fields:[];return{editable:t.filter(e=>!e.fieldset),imported:t.filter(e=>!!e.fieldset)}}function ru(e){return e.label&&e.label!==e.handle?`${e.label} (${e.handle})`:e.handle}function iu(e){return __(`From the fieldset :fieldset: make it localizable in the fieldset, which changes every blueprint that imports it.`,{fieldset:e.fieldset})}function au(e,t){let n=new Set(Array.isArray(t)?t:[]);return nu(e).editable.map(e=>e.handle).filter(e=>n.has(e))}function ou(e,t){let n=nu(e).editable.filter(e=>t.includes(e.handle)).map(ru).join(`, `);return __n(`This changes the blueprint file of :blueprint: :fields becomes localizable, so each site keeps its own value and Tolk translates it. Existing localizations keep the value they inherit until they are translated or edited.|This changes the blueprint file of :blueprint: :fields become localizable, so each site keeps its own value and Tolk translates them. Existing localizations keep the values they inherit until they are translated or edited.`,t.length,{blueprint:e.name,fields:n})}function su(e){return e>0?__n(`:count field is now localizable.|:count fields are now localizable.`,e):__(`Nothing changed: the fields were already localizable.`)}function cu(e,t){return __n(`:fields was not saved because it was hidden when you saved. Show it and translate it again.|:fields were not saved because they were hidden when you saved. Show them and translate them again.`,e.length,{fields:Sa(e,t)})}function lu({PipelineStopped:e,store:t=Us,registry:n=Ua,api:r=J,now:i=Date.now,running:a=e=>$.current(e),stop:o=e=>$.abort(e),onConfirmed:s=(e,t,n)=>nc.afterSave(e,t,n)}){let c=!1,l=null;function u(e=Statamic.$hooks){if(!c){c=!0;for(let t of[`entry`,`term`])e.on(`${t}.saving`,d),e.on(`${t}.saved`,f);e.on(`entry.published`,m)}}function d(r,i){let o=t(),s=a(X);if(rc.includes(o.phaseOf(`base`))&&s){l!==s&&(l=s,Statamic.$toast.error(__(`A translation is in progress. Wait for it to finish, or cancel it.`))),i(new e);return}let c=n.context(X),u=o.containers[X];c&&u?.reference&&u.reference===c.reference.value&&vo(c,u.delivered),r()}async function f(e,t,n){try{await p(n)}catch(e){console.error(e)}finally{e()}}async function p(e){let a=t(),o=a.containers[X],c=uu(e,o);if(!o?.reference||c!==o.reference)return;let l=n.context(X),u=a.saved(X,i()),d=l?.reference.value===c?yo(l,u):Object.keys(u);n.refreshClean(X),(o.phase===`done`||o.phase===`error`)&&a.clearResult(X);try{let{not_saved:e=[],...t}=await r.post(`editor/confirm`,{reference:c,delivered:d}),n=a.containers[X];n?.reference===c&&(n.status=t,n.notSaved=e,s(X,t)),e.length&&Statamic.$toast.error(cu(e,t),{duration:1e4})}catch(e){e?.status!==403&&Statamic.$toast.error(__(`The translation status could not be updated: :message`,{message:e?.message??``}))}}function m(e,t,n){try{h(n)}catch(e){console.error(e)}g(n).catch(e=>console.error(e)),e()}function h(e){let r=t(),s=r.containers[X];if(!s?.reference||uu(e,s)!==s.reference)return;let c=s.phase,l=rc.includes(c)&&!!a(`base`),u=Object.keys(s.delivered),d=n.context(X);o(X),d&&u.length&&wo(d,s.snapshot,u),r.saved(X,i()),(u.length||![`idle`,`offer`].includes(c))&&r.clearResult(X),(u.length||l)&&Statamic.$toast.info(__(`Publishing discarded the unsaved translation. Translate again to fill in the form.`))}async function g(e){let n=t().containers[X],i=uu(e,n);if(n?.reference&&i===n.reference)try{let e=await r.get(`editor/status`,{reference:i}),n=t().containers[X];n?.reference===i&&(n.status=e,s(X,e,{published:!0}))}catch(e){e?.status!==403&&Statamic.$toast.error(__(`The translation status could not be updated: :message`,{message:e?.message??``}))}}return{listen:u,saving:d,saved:f,published:m}}function uu(e,t){let n=e?.response?.data?.data;return typeof n?.reference==`string`?n.reference:typeof n?.id==`string`&&t?.reference?.startsWith(`term::${n.id}::`)?t.reference:e?.reference??null}var du=`[data-tolk-offer], [data-tolk-options], [data-tolk-changes], [data-tolk-push-modal]`,fu=`[data-tolk-action]:not([disabled])`,pu=`[data-tolk-focus]`,mu=`button:not([disabled]), [href], [tabindex="0"]`;function hu(e,{modals:t=null,doc:n=globalThis.document,wait:r=setTimeout,delays:i=[0,400]}={}){let a=null;function o(){let r=n?.activeElement,i=e();return!!(r&&i&&(i.contains(r)||t&&r.closest?.(t)))}function s(){return!n.activeElement||n.activeElement===n.body||n.activeElement===a}function c(){let t=e();if(!t?.isConnected||!s())return;let n=t.querySelector(fu),r=n??t.querySelector(pu)??t.querySelector(mu);r?.focus(),a=n?null:r}return{holds:o,restore:c,changing(){o()&&i.forEach(e=>r(c,e))}}}var gu={class:`sr-only`,"aria-live":`polite`,"data-tolk-announcement":``},_u={key:0,class:`flex items-center gap-2`},vu={key:0,class:`space-y-2`,"data-tolk-localization":``},yu={class:`flex flex-wrap items-center justify-between gap-x-6 gap-y-3`},bu={class:`flex flex-wrap items-center gap-2`},xu={key:0,class:`flex flex-wrap items-center gap-2`,"data-tolk-actions":``},Su={key:2,class:`flex flex-wrap items-center gap-2`,"data-tolk-copies":``},Cu=[`href`],wu={key:1,class:`flex items-center gap-2`,tabindex:`-1`,"data-tolk-focus":``,"data-tolk-phase":`planning`},Tu={key:2,class:`space-y-2`,"data-tolk-phase":`working`},Eu={class:`flex flex-wrap items-center justify-between gap-2`},Du={key:3,class:`space-y-1`,"data-tolk-phase":`error`},Ou={class:`flex items-center gap-2`},ku={key:4,class:`space-y-1`,"data-tolk-summary":``},Au={key:1,class:`flex flex-wrap items-center gap-2`},ju={key:5,class:`flex flex-wrap gap-2`},Mu={key:6,class:`flex items-center gap-2`,"data-tolk-not-saved":``},Nu={key:7,class:`space-y-2`,"data-tolk-origin":``},Pu={class:`flex items-center gap-2`},Fu={class:`grid grid-cols-[auto_auto_minmax(0,1fr)] items-center gap-x-3 gap-y-1.5 ps-6`},Iu=[`data-tolk-site`],Lu=[`href`],Ru=[`href`],zu={__name:`EditorBanner`,props:{containerName:{type:String,required:!0}},setup(e){let t=e,n=ni(),r=Us(),i=t.containerName,{failure:a,stop:o}=jc({name:i,ctx:n,store:r});lt(o);let s=O(()=>r.containers[i]??null),c=O(()=>s.value?.phase??`idle`),l=Yl(Statamic.$config.get(`tolk.auditUrl`)),u=O(()=>da(s.value?.status??null)),d=O(()=>hc(s.value)),f=O(()=>pc(s.value)),p=O(()=>ic.includes(s.value?.error?.code)),h=O(()=>Ca(s.value?.summary??null,s.value?.status??null,{retry:f.value&&!p.value})),g=O(()=>s.value?.notSaved?.length?cu(s.value.notSaved,s.value.status):null),_=O(()=>Dc(c.value,u.value)),v=O(()=>dc(s.value)),y=O(()=>{let e=s.value?.request;return e?.kind===`translate`&&e.fields?.length===1?Sa(e.fields,s.value.status):null}),b=O(()=>{let e=u.value.localization?.target?.name??``;return s.value?.progress?.cancelling?__(`Cancelling. Fields already on their way are still filled in.`):s.value?.request?.kind===`review`?__(`Reviewing the translation…`):y.value?__(`Translating :field into :site…`,{field:y.value,site:e}):__(`Translating into :site…`,{site:e})}),x=O(()=>{switch(c.value){case`planning`:return __(`Preparing the translation…`);case`working`:return b.value;case`error`:return s.value?.error?.message??``;case`done`:return[h.value?.translated,h.value?.reviewed].filter(Boolean).join(` `);default:return``}}),S=Mc();bn(()=>s.value?.summary,()=>S.hide());let C=O(()=>!!u.value.origin?.upToDate&&!u.value.localization&&!s.value?.push),w=O(()=>!n.readOnly.value&&(a.value!==null||u.value.visible&&!C.value)),ee=O(()=>Ua.dirtyHandles(i).length>0),T=Statamic.$config.get(`tolk.settingsUrl`),E=O(()=>Ec(s.value?.reference)),te=I(null),D=hu(()=>te.value?.$el??null,{modals:du});bn([c,()=>s.value?.push?.phase],()=>D.changing()),bn(w,e=>{!e&&D.holds()&&nt(()=>document.getElementById(`content-card`)?.focus())});function ne(e){$.translate(i,{mode:e})}function re(){$.translate(i,{mode:`all`,fields:u.value.localization.copies.map(e=>e.handle),overwriteManual:!0})}async function ie(){let e=D.holds(),t=await $.undo(i);e&&(await nt(),D.restore()),t?.kept.length&&Statamic.$toast.info(gc(t.kept,s.value?.status))}return(e,t)=>{let n=Nt(`tooltip`);return w.value?(F(),k(z(H),{key:0,ref_key:`card`,ref:te,class:`mb-6 space-y-3`,"data-tolk-banner":``},{default:B(()=>[M(`p`,gu,R(x.value),1),z(a)?(F(),j(`div`,_u,[P(z(Cr),{name:`warning-diamond`,class:`size-4 shrink-0 text-red-600`,"aria-hidden":`true`}),P(z(q),{variant:`danger`},{default:B(()=>[N(R(e.__(`The translation status could not be loaded: :message`,{message:z(a).message})),1)]),_:1})])):(F(),j(m,{key:1},[u.value.localization?(F(),j(`div`,vu,[M(`div`,yu,[M(`div`,bu,[P(z(Cr),{name:`dictionary-language-book`,class:`size-4 shrink-0 text-gray-500`,"aria-hidden":`true`}),P(z(q),null,{default:B(()=>[N(R(u.value.localization.lead),1)]),_:1}),(F(!0),j(m,null,L(u.value.localization.parts,e=>En((F(),k(z(Fn),{key:e.key,text:e.text,color:z(sa)(e.key),tabindex:`0`,"data-tolk-part":e.key},null,8,[`text`,`color`,`data-tolk-part`])),[[n,e.description]])),128))]),_.value?(F(),j(`div`,xu,[c.value===`idle`?(F(),j(m,{key:0},[u.value.localization.translate?(F(),k(z(V),{key:0,variant:`primary`,size:`sm`,"data-tolk-action":`translate`,onClick:t[0]||=e=>ne(`missing`)},{default:B(()=>[N(R(e.__(`Translate`)),1)]),_:1})):A(``,!0),u.value.localization.update?(F(),k(z(V),{key:1,size:`sm`,"data-tolk-action":`update`,onClick:t[1]||=e=>ne(`update`)},{default:B(()=>[N(R(e.__(`Update`)),1)]),_:1})):A(``,!0)],64)):A(``,!0),v.value?(F(),k(z(V),{key:1,size:`sm`,"data-tolk-action":`review`,onClick:t[2]||=e=>z($).review(z(i))},{default:B(()=>[N(R(e.__(`Review`)),1)]),_:1})):A(``,!0),P(Gl,{"container-name":z(i),status:s.value.status},null,8,[`container-name`,`status`])])):A(``,!0)]),u.value.localization.autoUpdated?(F(),k(z(U),{key:0,"data-tolk-auto-updated":``},{default:B(()=>[N(R(u.value.localization.autoUpdated),1)]),_:1})):A(``,!0),u.value.localization.incompleteNote?(F(),k(z(U),{key:1},{default:B(()=>[N(R(u.value.localization.incompleteNote),1)]),_:1})):A(``,!0),u.value.localization.copiesNote?(F(),j(`div`,Su,[P(z(U),null,{default:B(()=>[N(R(u.value.localization.copiesNote),1)]),_:1}),_.value&&c.value===`idle`&&u.value.localization.translateCopies?(F(),k(z(V),{key:0,size:`sm`,"data-tolk-action":`translate-copies`,onClick:re},{default:B(()=>[N(R(u.value.localization.translateCopiesLabel),1)]),_:1})):A(``,!0)])):A(``,!0),u.value.localization.hint?(F(),k(z(U),{key:3,"data-tolk-not-localizable":``},{default:B(()=>[N(R(u.value.localization.hint)+` `,1),z(l)?(F(),j(`a`,{key:0,href:z(l),"data-tolk-audit-link":``},R(e.__(`Open the setup audit`)),9,Cu)):(F(),j(m,{key:1},[N(R(e.__(`Run php please tolk:doctor for details.`)),1)],64))]),_:1})):A(``,!0)])):A(``,!0),c.value===`planning`?(F(),j(`div`,wu,[P(z(q),null,{default:B(()=>[N(R(e.__(`Preparing the translation…`)),1)]),_:1})])):A(``,!0),c.value===`working`?(F(),j(`div`,Tu,[M(`div`,Eu,[P(z(q),{"data-tolk-working-field":y.value?``:null},{default:B(()=>[N(R(b.value),1)]),_:1},8,[`data-tolk-working-field`]),P(z(V),{size:`sm`,variant:`ghost`,disabled:s.value.progress.cancelling,"data-tolk-action":`cancel`,onClick:t[3]||=e=>z($).cancel(z(i))},{default:B(()=>[N(R(e.__(`Cancel`)),1)]),_:1},8,[`disabled`])]),P(Va,{value:s.value.progress.done,max:s.value.progress.total,label:s.value.request?.kind===`review`?e.__(`Review progress`):e.__(`Translation progress`)},null,8,[`value`,`max`,`label`]),s.value.progress.waiting?(F(),k(z(U),{key:0},{default:B(()=>[N(R(e.__(`The provider asked to wait. Trying again shortly.`)),1)]),_:1})):A(``,!0)])):A(``,!0),c.value===`error`?(F(),j(`div`,Du,[M(`div`,Ou,[P(z(Cr),{name:`warning-diamond`,class:`size-4 shrink-0 text-red-600`,"aria-hidden":`true`}),P(z(q),{variant:`danger`,"data-tolk-error":``},{default:B(()=>[N(R(s.value.error?.message),1)]),_:1})])])):A(``,!0),h.value&&(c.value===`done`||c.value===`error`)?(F(),j(`div`,ku,[h.value.translated?(F(),k(z(q),{key:0,as:`p`,"data-tolk-summary-translated":``},{default:B(()=>[N(R(h.value.translated),1)]),_:1})):A(``,!0),h.value.reviewed?(F(),j(`div`,Au,[P(z(q),{"data-tolk-summary-reviewed":``},{default:B(()=>[N(R(h.value.reviewed),1)]),_:1}),h.value.corrections?(F(),k(z(V),{key:0,size:`sm`,variant:`ghost`,"data-tolk-action":`view-changes`,onClick:t[4]||=e=>z(S).show()},{default:B(()=>[N(R(e.__(`View changes`)),1)]),_:1})):A(``,!0)])):A(``,!0),h.value.reviewSkipped?(F(),k(z(U),{key:2,"data-tolk-summary-review-skipped":``},{default:B(()=>[N(R(h.value.reviewSkipped),1)]),_:1})):A(``,!0),h.value.cancelled?(F(),k(z(U),{key:3},{default:B(()=>[N(R(h.value.cancelled),1)]),_:1})):A(``,!0),h.value.incomplete?(F(),k(z(U),{key:4,"data-tolk-summary-incomplete":``},{default:B(()=>[N(R(h.value.incomplete),1)]),_:1})):A(``,!0),h.value.edited?(F(),k(z(U),{key:5,"data-tolk-summary-edited":``},{default:B(()=>[N(R(h.value.edited),1)]),_:1})):A(``,!0),h.value.hidden?(F(),k(z(U),{key:6,"data-tolk-summary-hidden":``},{default:B(()=>[N(R(h.value.hidden),1)]),_:1})):A(``,!0),h.value.manual?(F(),k(z(U),{key:7,"data-tolk-summary-manual":``},{default:B(()=>[N(R(h.value.manual),1)]),_:1})):A(``,!0),h.value.failed?(F(),k(z(U),{key:8,"data-tolk-summary-failed":``},{default:B(()=>[N(R(h.value.failed),1)]),_:1})):A(``,!0),h.value.unsaved?(F(),k(z(U),{key:9,"data-tolk-summary-unsaved":``},{default:B(()=>[N(R(h.value.unsaved),1)]),_:1})):A(``,!0)])):A(``,!0),f.value||c.value===`done`&&d.value?(F(),j(`div`,ju,[f.value?(F(),k(z(V),{key:0,size:`sm`,variant:`primary`,"data-tolk-action":`retry`,onClick:t[5]||=e=>z($).retry(z(i))},{default:B(()=>[N(R(p.value?e.__(`Start again`):e.__(`Retry`)),1)]),_:1})):A(``,!0),d.value?(F(),k(z(V),{key:1,size:`sm`,"data-tolk-action":`undo`,onClick:ie},{default:B(()=>[N(R(e.__(`Undo`)),1)]),_:1})):A(``,!0)])):A(``,!0),g.value?(F(),j(`div`,Mu,[P(z(Cr),{name:`warning-diamond`,class:`size-4 shrink-0 text-amber-600`,"aria-hidden":`true`}),P(z(q),null,{default:B(()=>[N(R(g.value),1)]),_:1})])):A(``,!0),u.value.origin?(F(),j(`div`,Nu,[M(`div`,Pu,[P(z(Cr),{name:`dictionary-language-book`,class:`size-4 shrink-0 text-gray-500`,"aria-hidden":`true`}),P(z(q),null,{default:B(()=>[N(R(E.value?e.__(`Translations of this term:`):e.__(`Translations of this entry:`)),1)]),_:1})]),M(`ul`,Fu,[(F(!0),j(m,null,L(u.value.origin.localizations,e=>(F(),j(`li`,{key:e.site,class:`col-span-3 grid grid-cols-subgrid items-center`,"data-tolk-site":e.site},[e.editUrl?(F(),j(`a`,{key:0,href:e.editUrl,class:`text-sm font-medium underline`},R(e.name),9,Lu)):(F(),k(z(q),{key:1,variant:`strong`},{default:B(()=>[N(R(e.name),1)]),_:2},1024)),P(z(Fn),{text:e.label,color:e.color,class:`justify-self-start`},null,8,[`text`,`color`]),e.exists&&e.summary?(F(),k(z(U),{key:2},{default:B(()=>[N(R(e.summary),1)]),_:2},1024)):A(``,!0)],8,Iu))),128))]),u.value.origin.autoUpdate?(F(),k(z(U),{key:0,class:`ps-6`,"data-tolk-auto-update":``},{default:B(()=>[N(R(u.value.origin.autoUpdate),1)]),_:1})):A(``,!0),P(Qc,{"container-name":z(i),reference:s.value.reference,origin:u.value.origin,status:s.value.status,dirty:ee.value},null,8,[`container-name`,`reference`,`origin`,`status`,`dirty`])])):A(``,!0),u.value.localization?(F(),k(ul,{key:8,"container-name":z(i),status:s.value.status,open:c.value===`offer`},null,8,[`container-name`,`status`,`open`])):A(``,!0),z(S).open?(F(),k(za,{key:9,modal:z(S),corrections:s.value.summary?.corrections??[],reviewer:s.value.summary?.reviewer??null},null,8,[`modal`,`corrections`,`reviewer`])):A(``,!0),u.value.setup?(F(),k(z(U),{key:10,"data-tolk-setup":``},{default:B(()=>[N(R(e.__(`Translation is not set up yet.`))+` `,1),z(T)?(F(),j(`a`,{key:0,href:z(T)},R(e.__(`Open the Tolk settings`)),9,Ru)):(F(),j(m,{key:1},[N(R(e.__(`Ask an administrator to configure a provider in the Tolk settings.`)),1)],64))]),_:1})):A(``,!0)],64))]),_:1},512)):A(``,!0)}}},Bu={class:`flex items-center justify-end gap-3 pt-3 pb-1`},Vu={__name:`TranslateFieldConfirm`,emits:[`confirm`,`cancel`],setup(e,{emit:t}){let n=t,r=Mc(),i=!1;pt(()=>r.show());function a(e){i||(i=!0,n(e))}function o(e){r.hide(),a(e)}function s(e){r.closed(e),e||a(`cancel`)}return(e,t)=>z(r).open?(F(),k(z(Gr),{key:0,open:``,title:e.__(`Translate from origin`),"data-tolk-field-confirm":``,onDismissed:t[2]||=e=>z(r).dismissed(),"onUpdate:open":s},{footer:B(()=>[M(`div`,Bu,[P(z(V),{variant:`ghost`,text:e.__(`Cancel`),"data-tolk-field-confirm-action":`cancel`,onClick:t[0]||=e=>o(`cancel`)},null,8,[`text`]),P(z(V),{variant:`primary`,text:e.__(`Translate`),"data-tolk-field-confirm-action":`translate`,onClick:t[1]||=e=>o(`confirm`)},null,8,[`text`])])]),default:B(()=>[P(z(q),{as:`p`},{default:B(()=>[N(R(e.__(`The current content of this field will be replaced.`)),1)]),_:1})]),_:1},8,[`title`])):A(``,!0)}},Hu=`tolk-translate-field-confirm`;function Uu(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>Uu(e,t[n]));if(e===null||t===null||typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&Uu(e[n],t[n]))}function Wu({registry:e=Ua,store:t=Us,translations:n=$,fieldActions:r=()=>Statamic.$fieldActions,config:i=()=>Statamic.$config,permissions:a=()=>Statamic.$permissions,toast:o=()=>Statamic.$toast,components:s=()=>Statamic.$components,doc:c=()=>globalThis.document,wait:l=setTimeout}={}){let u=!1;function d({vm:n,fieldPathPrefix:r,handle:i,config:o,isReadOnly:s}){if(r||s||!o?.localizable||!a().has(`translate content`)||n&&n.publishContainer?.name!==`base`||e.others().length>0)return!1;let c=e.base(),l=t().containers[X],u=l?.status;if(!c||c.readOnly?.value||!u?.localization||l.reference!==c.reference.value)return!1;let d=Y(u.localization.fields)[i];return!ua(u)&&Object.hasOwn(c.originValues?.value??{},i)&&!!d&&d.status!==`not_applicable`}function f(){return rc.includes(t().containers[X]?.phase)}function p({handle:t,value:n}){let r=e.base()?.originValues?.value??{};return Ya(n)!==null&&!ro(n,r[t])}async function m({handle:r,value:i}){let a=e.base(),s=t();if(!a||!Uu(i,a.values.value[r])){o().error(Ec(s.containers.base?.reference)?__(`This field is not part of the term being translated.`):__(`This field is not part of the entry being translated.`));return}if(rc.includes(s.phaseOf(`base`))||n.running(`base`)){o().error(__(`A translation is already running. Try again when it has finished.`));return}if(n.saving(`base`)){o().error(sc());return}let c=s.containers[X],l=await n.translate(X,{mode:`all`,fields:[r],overwriteManual:!0,replace:!0});if(s.containers.base===c){if(c.phase===`error`){o().error(c.error?.message||__(`Something went wrong.`));return}if(l&&!l.cancelled&&!l.delivered.includes(r)){let e=Ca(l,c.status);o().error(e.failed??e.edited??e.hidden??e.translated)}}}function h(e){return[...([...c()?.querySelectorAll(`label[for]`)??[]].find(t=>t.getAttribute(`for`)===`field_${e}`)?.closest(`[data-ui-input-group]`)?.querySelector(`[data-ui-field-header]`))?.querySelectorAll(`button[aria-label]`)??[]].find(e=>e.getAttribute(`aria-label`)===b())??null}function g(){let e=c()?.querySelector(`[data-tolk-banner]`);return e?.querySelector(`[data-tolk-action="cancel"]`)??e?.querySelector(`[data-tolk-focus]`)??null}function _(e){for(let t of[0,400])l(()=>{let t=c()?.activeElement;(!t||t===c().body)&&e()?.focus()},t)}function v(e){m(e).catch(()=>o().error(__(`Something went wrong.`))),_(()=>g()??h(e.handle))}function y(e){if(!p(e)){v(e);return}let t=s().append(Hu,{props:{}});t.on(`confirm`,()=>{t.destroy(),v(e)}),t.on(`cancel`,()=>{t.destroy(),_(()=>h(e.handle))})}function b(){return __(`Translate from origin`)}let x={get title(){return b()},quick:!0,icon:`dictionary-language-book`,visible:d,disabled:f,run:y};function S(){if(!u){u=!0;for(let e of i().get(`tolk.fieldtypes`)??[])r().add(`${e}-fieldtype`,x)}}return{register:S,action:x,visible:d,disabled:f,run:y}}var Gu=Wu(),{Fieldtype:Ku,IndexFieldtype:qu,FieldtypeMixin:Ju,HasActionsMixin:Yu,HasInputOptionsMixin:Xu,HasPreferencesMixin:Zu,IndexFieldtypeMixin:Qu,InlineEditForm:$u,DateFormatter:ed,NumberFormatter:td,ItemActions:nd,RelatedItem:rd,RestoreRevision:id,RevisionHistory:ad,RevisionPreview:od,SaveButtonOptions:sd,SortableList:cd,requireElevatedSession:ld,requireElevatedSessionIf:ud,clone:dd,debounce:fd,deepClone:pd,resetValuesFromResponse:md}=__STATAMIC__.core,hd=[`data-tolk-model-note`],gd={__name:`ModelSelect`,props:Ku.props,emits:Ku.emits,setup(e,{expose:t,emit:n}){let r=n,i=e,{expose:a,isReadOnly:o,update:s}=Ku.use(r,i),c=O(()=>vl(i.meta,i.value)),l=O(()=>ml(i.value)??`automatic`);function u(e){let t=yl(e,c.value);t!==void 0&&t!==ml(i.value)&&s(t)}return t(a),(e,t)=>(F(),k(z(Gn),{id:e.id,"model-value":l.value,options:c.value,"read-only":z(o),placeholder:e.__(`Choose a model`),taggable:``,"should-open-dropdown":z(fl),"data-tolk-model-select":``,"onUpdate:modelValue":u},{option:B(e=>[M(`span`,{class:it([`truncate`,{"opacity-50":e.disabled}])},R(e.label),3),e.note?(F(),j(`span`,{key:0,class:it([`ms-auto shrink-0 text-xs text-gray-500 dark:text-gray-400`,{"opacity-50":e.disabled}]),"data-tolk-model-note":e.value},R(e.note),11,hd)):A(``,!0)]),_:1},8,[`id`,`model-value`,`options`,`read-only`,`placeholder`,`should-open-dropdown`]))}};function _d(e){let t=e?.fake_engine===!0;return(Array.isArray(e?.providers)?e.providers:[]).map(e=>{let n=e.configured===!0;return{provider:e.provider,label:e.label,badge:vd(n),source:yd(e.source),hint:n?null:bd(e.env),testable:n||t}})}function vd(e){return e?{text:__(`Configured`),color:`green`}:{text:__(`No API key`),color:`default`}}function yd(e){return{ai:__(`The key comes from config/ai.php, which Tolk shares with the rest of the site.`),addon:__(`The key is Tolk's own, from the addon's config.`)}[e]??null}function bd(e){return e?.ai?__(`Add :variable to the .env file, or :override to give Tolk a key of its own.`,{variable:e.ai,override:e.addon}):null}function xd(e){if(e?.ok!==!0)return{ok:!1,text:e?.error||__(`The test failed.`)};let t={model:e.label||e.model,ms:e.latency_ms};return{ok:!0,text:e.fake?__(`The fake engine answered for :model in :ms ms, without calling the provider.`,t):__(`:model answered in :ms ms.`,t)}}async function Sd(e,t=J){try{return await t.post(`providers/test`,{provider:e})}catch(e){return{ok:!1,error:e.message}}}var Cd={class:`divide-y divide-gray-200 dark:divide-gray-700`,"data-tolk-providers":``},wd=[`data-tolk-provider`],Td={class:`flex flex-wrap items-center gap-2`},Ed={__name:`ProvidersStatus`,props:Ku.props,emits:Ku.emits,setup(e,{expose:t,emit:n}){let r=n,i=e,{expose:a}=Ku.use(r,i),o=O(()=>_d(i.meta)),s=Dt({}),c=Dt({});async function l(e){s[e]=!0,c[e]=null;try{c[e]=xd(await Sd(e))}finally{s[e]=!1}}return t(a),(e,t)=>(F(),j(`div`,Cd,[(F(!0),j(m,null,L(o.value,t=>(F(),j(`div`,{key:t.provider,class:`space-y-1 py-3 first:pt-0 last:pb-0`,"data-tolk-provider":t.provider},[M(`div`,Td,[P(z(q),{variant:`strong`},{default:B(()=>[N(R(t.label),1)]),_:2},1024),P(z(Fn),{text:t.badge.text,color:t.badge.color,"data-tolk-provider-status":``},null,8,[`text`,`color`]),t.testable?(F(),k(z(V),{key:0,class:`ms-auto`,size:`sm`,text:e.__(`Test connection`),loading:!!s[t.provider],disabled:!!s[t.provider],"data-tolk-provider-test":``,onClick:e=>l(t.provider)},null,8,[`text`,`loading`,`disabled`,`onClick`])):A(``,!0)]),t.source?(F(),k(z(U),{key:0},{default:B(()=>[N(R(t.source),1)]),_:2},1024)):A(``,!0),t.hint?(F(),k(z(U),{key:1},{default:B(()=>[N(R(t.hint),1)]),_:2},1024)):A(``,!0),c[t.provider]?(F(),k(z(q),{key:2,variant:c[t.provider].ok?`success`:`danger`,"data-tolk-provider-result":c[t.provider].ok?`ok`:`failed`},{default:B(()=>[N(R(c[t.provider].text),1)]),_:2},1032,[`variant`,`data-tolk-provider-result`])):A(``,!0)],8,wd))),128))]))}},{asMap:Dd}=J,Od=`glossary`;function kd(e,t=J){let n=Dd(e),r=Object.hasOwn(n,`translator_model`)?{model:n.translator_model||null}:{};return t.post(`site-profile/generate`,r)}function Ad(e){return typeof e==`string`&&e.trim()!==``}function jd(e){return String(e??``).normalize(`NFKD`).toLowerCase().replace(/\p{Mn}+/gu,``).replace(/[\s\p{Z}]+/gu,` `).trim()}function Md(e){let t=e?.site;return Array.isArray(t)?t.length===0:!t}function Nd(e){return new Set((Array.isArray(e)?e:[]).filter(Md).map(e=>jd(e?.term)).filter(e=>e!==``))}function Pd(e,t,n={}){let r=Nd(t);return(Array.isArray(e)?e:[]).map(e=>{let t=r.has(jd(e));return{term:e,inGlossary:t,chosen:!t&&n[e]!==!0}})}function Fd(){return Array.from(crypto.getRandomValues(new Uint8Array(12)),e=>`abcdefghijklmnopqrstuvwxyz0123456789`[e%36]).join(``)}function Id(e){return JSON.parse(JSON.stringify(e??{}))}function Ld(e,t,n,r=Fd){let i=Array.isArray(t)?t:[],a=Dd(n),o=Nd(i),s={...Dd(a.existing)},c=[];for(let t of e){let e=jd(t);if(e===``||o.has(e))continue;let n=r();o.add(e),s[n]=Id(Dd(a.new)),c.push({...Id(Dd(a.defaults)),term:t.trim(),do_not_translate:!0,_id:n})}return{rows:[...i,...c],meta:{...a,existing:s},added:c.map(e=>e.term)}}var Rd={class:`space-y-3`,"data-tolk-site-profile":``},zd={key:0,class:`flex flex-wrap items-center gap-3`},Bd={key:3,class:`space-y-2`,"data-tolk-site-profile-terms":``},Vd={class:`space-y-1`},Hd=[`data-tolk-site-profile-term`],Ud={class:`flex flex-wrap items-center gap-3`},Wd={class:`list-disc ps-5 text-sm`},Gd=[`data-tolk-site-profile-term`],Kd={__name:`SiteProfile`,props:Ku.props,emits:Ku.emits,setup(e,{expose:t,emit:n}){let r=n,i=e,{expose:a,isReadOnly:o,update:s}=Ku.use(r,i),c=ni(),l=I(!1),u=I(!1),d=I(null),f=I(null),p=I(null),h=Dt({}),g=O(()=>Y(c?.values.value)),_=O(()=>!o.value&&Object.hasOwn(g.value,`glossary`)&&Object.hasOwn(Y(c?.meta.value),`glossary`)),v=O(()=>Pd(f.value?.terms,g.value[Od],h)),y=O(()=>v.value.filter(e=>e.chosen).map(e=>e.term));function b(){Ad(i.value)?u.value=!0:x()}async function x(){u.value=!1,l.value=!0,d.value=null;try{let e=await kd(g.value);s(e.profile),f.value={label:e.label||e.model,terms:Array.isArray(e.terms)?e.terms:[]},p.value=null,Object.keys(h).forEach(e=>delete h[e])}catch(e){d.value=e.message}finally{l.value=!1}}function S(e,t){h[e]=!t}function C(){let e=Ld(y.value,g.value[Od],c.meta.value[Od]);c.setFieldMeta(Od,e.meta),c.setFieldValue(Od,e.rows),p.value=e.added.length}return t(a),(e,t)=>(F(),j(`div`,Rd,[P(z(Ii),{id:e.id,name:e.handle,"model-value":e.value,"read-only":z(o),rows:8,"onUpdate:modelValue":z(s)},null,8,[`id`,`name`,`model-value`,`read-only`,`onUpdate:modelValue`]),z(o)?A(``,!0):(F(),j(`div`,zd,[P(z(V),{size:`sm`,icon:`ai-sparks`,text:e.__(`Generate`),loading:l.value,disabled:l.value,"data-tolk-site-profile-generate":``,onClick:b},null,8,[`text`,`loading`,`disabled`]),P(z(U),null,{default:B(()=>[N(R(e.__(`Has the translator write a profile from the content of the default site. Check it before you save.`)),1)]),_:1})])),d.value?(F(),k(z(q),{key:1,variant:`danger`,"data-tolk-site-profile-error":``},{default:B(()=>[N(R(d.value),1)]),_:1})):A(``,!0),f.value?(F(),k(z(U),{key:2,"data-tolk-site-profile-written":``},{default:B(()=>[N(R(e.__(`Written by :model. It is not saved until you save the settings.`,{model:f.value.label})),1)]),_:1})):A(``,!0),v.value.length?(F(),j(`div`,Bd,[P(z(q),{variant:`strong`},{default:B(()=>[N(R(e.__(`Names to keep untranslated`)),1)]),_:1}),_.value?(F(),j(m,{key:0},[M(`div`,Vd,[(F(!0),j(m,null,L(v.value,t=>(F(),j(`div`,{key:t.term,"data-tolk-site-profile-term":t.term},[P(z(Hn),{"model-value":t.chosen,label:t.term,description:t.inGlossary?e.__(`Already in the glossary`):null,disabled:t.inGlossary,class:`dark:[&_p]:text-gray-400!`,"onUpdate:modelValue":e=>S(t.term,e)},null,8,[`model-value`,`label`,`description`,`disabled`,`onUpdate:modelValue`])],8,Hd))),128))]),M(`div`,Ud,[P(z(V),{size:`sm`,text:e.__(`Add to glossary`),disabled:y.value.length===0,"data-tolk-site-profile-add":``,onClick:C},null,8,[`text`,`disabled`]),p.value===null?A(``,!0):(F(),k(z(U),{key:0,"data-tolk-site-profile-added":``},{default:B(()=>[N(R(e.__n(`Added :count name to the glossary with Do not translate on. Save the settings to keep it.|Added :count names to the glossary with Do not translate on. Save the settings to keep them.`,p.value)),1)]),_:1}))])],64)):(F(),j(m,{key:1},[M(`ul`,Wd,[(F(!0),j(m,null,L(v.value,e=>(F(),j(`li`,{key:e.term,"data-tolk-site-profile-term":e.term},R(e.term),9,Gd))),128))]),P(z(U),null,{default:B(()=>[N(R(e.__(`Add them to the glossary with Do not translate on, so that every translation keeps them.`)),1)]),_:1})],64))])):A(``,!0),u.value?(F(),k(z(qn),{key:4,open:``,"onUpdate:open":t[0]||=e=>u.value=e,title:e.__(`Replace the site profile?`),"body-text":e.__(`A new profile replaces the text in this field. Nothing is saved until you save the settings.`),"button-text":e.__(`Generate`),onConfirm:x},null,8,[`title`,`body-text`,`button-text`])):A(``,!0)]))}},{Form:qd,Head:Jd,Link:Yd,router:Xd,toggleArchitecturalBackground:Zd,useArchitecturalBackground:Qd,useForm:$d,usePage:ef,usePoll:tf}=__STATAMIC__.inertia,nf={class:`mx-auto max-w-page space-y-6`,"data-tolk-audit":``},rf={class:`flex flex-wrap items-center gap-2`},af={key:1,class:`space-y-3`},of=[`data-tolk-item-level`],sf=[`data-tolk-blueprint`],cf={class:`flex flex-wrap items-center justify-between gap-2`},lf={class:`flex items-center gap-2`},uf=[`href`],df={class:`space-y-2`},ff=[`data-tolk-field`],pf=[`data-tolk-field-imported`],mf=[`href`],hf={key:1,class:`space-y-1 ps-6`},gf=[`data-tolk-field`],_f={class:`text-xs text-gray-600 dark:text-gray-400`},vf={key:1,class:`flex items-start gap-2`},yf={__name:`Audit`,props:{checks:{type:Array,default:()=>[]},canMakeLocalizable:{type:Boolean,default:!1},urls:{type:Object,required:!0}},setup(e){let t=e,n=I(t.checks),r=Dt({}),i=I(null),a=I(null),o=O(()=>Ql(n.value));bn(()=>t.checks,e=>n.value=e);function s(e,t){return(r[tu(e)]??[]).includes(t)}function c(e,t,n){let i=tu(e),a=(r[i]??[]).filter(e=>e!==t);r[i]=n?[...a,t]:a}function l(e){let t=au(e,r[tu(e)]);t.length>0&&(i.value={item:e,fields:t,text:ou(e,t)})}async function u(){let{item:e,fields:o}=i.value,s=tu(e);i.value=null,a.value=s;try{let i=await ea(t.urls.localizable,{namespace:e.namespace,blueprint:e.blueprint,fields:o});n.value=i.checks,delete r[s],Statamic.$toast.success(su(i.changed))}catch(e){Statamic.$toast.error(e.message)}finally{a.value=null}}return(t,d)=>(F(),j(`div`,nf,[P(z(Jd),{title:t.__(`Audit`)},null,8,[`title`]),P(z(xr),{title:t.__(`Setup audit`),icon:`clipboard-check`},{default:B(()=>[P(z(Yd),{href:e.urls.overview,class:`text-sm text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200`},{default:B(()=>[N(R(t.__(`Overview`)),1)]),_:1},8,[`href`]),P(z(V),{text:t.__(`Check again`),icon:`sync`,"data-tolk-audit-reload":``,onClick:d[0]||=e=>z(Xd).reload()},null,8,[`text`])]),_:1},8,[`title`]),P(z(H),{class:`flex items-start gap-3`,"data-tolk-audit-summary":``,"data-tolk-audit-level":o.value.level},{default:B(()=>[P(z(Cr),{name:z(Zl)(o.value.level).icon,class:it([`mt-0.5 size-5 shrink-0`,z(Zl)(o.value.level).class]),"aria-hidden":`true`},null,8,[`name`,`class`]),P(z(q),null,{default:B(()=>[N(R(o.value.text),1)]),_:1})]),_:1},8,[`data-tolk-audit-level`]),(F(!0),j(m,null,L(n.value,n=>(F(),k(z(H),{id:z(Jl)(n.id),key:n.id,class:`space-y-3`,"data-tolk-check":n.id,"data-tolk-check-level":n.level},{default:B(()=>[M(`div`,rf,[P(z(Cr),{name:z(Zl)(n.level).icon,class:it([`size-4 shrink-0`,z(Zl)(n.level).class]),"aria-hidden":`true`},null,8,[`name`,`class`]),P(z(W),{size:`lg`,level:2},{default:B(()=>[N(R(n.title),1)]),_:2},1024),P(z(Fn),{text:z(Zl)(n.level).label,color:z(Zl)(n.level).color},null,8,[`text`,`color`])]),P(z(U),null,{default:B(()=>[N(R(z($l)(n,e.canMakeLocalizable)),1)]),_:2},1024),n.items.length===0?(F(),k(z(q),{key:0,"data-tolk-audit-nothing":``},{default:B(()=>[N(R(n.id===z(`localizable`)?t.__(`Every text field Tolk could translate is localizable.`):t.__(`Nothing to report.`)),1)]),_:2},1024)):(F(),j(`ul`,af,[(F(!0),j(m,null,L(n.items,(i,o)=>(F(),j(`li`,{key:o,"data-tolk-item":``,"data-tolk-item-level":i.level},[z(eu)(i)?(F(),j(`div`,{key:0,class:`space-y-2 rounded-lg border border-gray-200 p-3 dark:border-gray-700`,"data-tolk-blueprint":z(tu)(i)},[M(`div`,cf,[M(`div`,lf,[P(z(Cr),{name:z(Zl)(i.level).icon,class:it([`size-4 shrink-0`,z(Zl)(i.level).class]),role:`img`,"aria-label":z(Zl)(i.level).label},null,8,[`name`,`class`,`aria-label`]),P(z(q),{class:`font-medium`},{default:B(()=>[N(R(i.name),1)]),_:2},1024)]),i.edit_url?(F(),j(`a`,{key:0,href:i.edit_url,class:`text-sm text-blue-600 hover:underline dark:text-blue-400`,"data-tolk-blueprint-link":``},R(t.__(`Edit blueprint`)),9,uf)):A(``,!0)]),n.id===z(`localizable`)?(F(),j(m,{key:0},[M(`div`,df,[(F(!0),j(m,null,L(z(nu)(i).editable,t=>(F(),j(`div`,{key:t.handle,"data-tolk-field":t.handle},[e.canMakeLocalizable?(F(),k(z(Hn),{key:0,"model-value":s(i,t.handle),label:z(ru)(t),disabled:a.value!==null,"onUpdate:modelValue":e=>c(i,t.handle,e)},null,8,[`model-value`,`label`,`disabled`,`onUpdate:modelValue`])):(F(),k(z(q),{key:1},{default:B(()=>[N(R(z(ru)(t)),1)]),_:2},1024))],8,ff))),128)),(F(!0),j(m,null,L(z(nu)(i).imported,n=>(F(),j(`div`,{key:n.handle,"data-tolk-field-imported":n.handle},[e.canMakeLocalizable?(F(),k(z(Hn),{key:0,"model-value":!1,label:z(ru)(n),description:z(iu)(n),disabled:``},null,8,[`label`,`description`])):(F(),j(m,{key:1},[P(z(q),null,{default:B(()=>[N(R(z(ru)(n)),1)]),_:2},1024),P(z(U),null,{default:B(()=>[N(R(z(iu)(n)),1)]),_:2},1024)],64)),n.fieldset_url?(F(),j(`a`,{key:2,href:n.fieldset_url,class:`ms-6 text-sm text-blue-600 hover:underline dark:text-blue-400`,"data-tolk-fieldset-link":``},R(t.__(`Edit fieldset`)),9,mf)):A(``,!0)],8,pf))),128))]),e.canMakeLocalizable&&z(nu)(i).editable.length>0?(F(),k(z(V),{key:0,size:`sm`,variant:`primary`,text:t.__(`Make localizable`),loading:a.value===z(tu)(i),disabled:a.value!==null||z(au)(i,r[z(tu)(i)]).length===0,"data-tolk-make-localizable":``,onClick:e=>l(i)},null,8,[`text`,`loading`,`disabled`,`onClick`])):A(``,!0)],64)):(F(),j(`ul`,hf,[(F(!0),j(m,null,L(i.fields,e=>(F(),j(`li`,{key:e.path??e.handle,"data-tolk-field":e.path??e.handle},[P(z(q),null,{default:B(()=>[N(R(e.label)+` `,1),M(`code`,_f,R(e.path??e.handle),1)]),_:2},1024)],8,gf))),128))]))],8,sf)):(F(),j(`div`,vf,[P(z(Cr),{name:z(Zl)(i.level).icon,class:it([`mt-0.5 size-4 shrink-0`,z(Zl)(i.level).class]),role:`img`,"aria-label":z(Zl)(i.level).label},null,8,[`name`,`class`,`aria-label`]),P(z(q),null,{default:B(()=>[N(R(i.text),1)]),_:2},1024)]))],8,of))),128))]))]),_:2},1032,[`id`,`data-tolk-check`,`data-tolk-check-level`]))),128)),i.value?(F(),k(z(qn),{key:0,open:``,title:t.__(`Make these fields localizable?`),"button-text":t.__(`Make localizable`),"data-tolk-localizable-confirm":``,"onUpdate:open":d[1]||=e=>i.value=e?i.value:null,onConfirm:u},{default:B(()=>[P(z(q),null,{default:B(()=>[N(R(i.value.text),1)]),_:1})]),_:1},8,[`title`,`button-text`])):A(``,!0)]))}},bf={class:`overflow-x-auto`},xf={__name:`RunsTable`,props:{runs:{type:Array,default:()=>[]}},setup(e){let t=e,n=ys(Statamic.$config.get(`sites`)),r=O(()=>t.runs.map(e=>{let t=Ss({counts:e.counts}),r=Ms(e),i=ks(e.scope,n);return{id:e.id,url:e.url,status:e.status,what:i.what,automatic:i.automatic,sites:i.sites,progress:__(`:finished of :total`,{finished:Q(t.finished),total:Q(t.total)}),failed:t.counts.failed,tokens:r.input+r.output,cost:r.cost,date:xs(e.created_at),by:e.created_by?.name??(i.automatic?__(`Automatic update`):__(`Command line`))}}));return(e,t)=>(F(),j(`div`,bf,[P(z(Oi),null,{default:B(()=>[P(z(ki),null,{default:B(()=>[P(z(K),null,{default:B(()=>[N(R(e.__(`Status`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(e.__(`Content`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(e.__(`Sites`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(e.__(`Items finished`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(e.__(`Usage`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(e.__(`Created`)),1)]),_:1})]),_:1}),P(z(ji),null,{default:B(()=>[(F(!0),j(m,null,L(r.value,t=>(F(),k(z(Ai),{key:t.id,"data-tolk-run-row":``,"data-tolk-run-id":t.id},{default:B(()=>[P(z(G),null,{default:B(()=>[P(z(Yd),{href:t.url,class:`inline-flex`},{default:B(()=>[P(z(Fn),{text:z(ms)(t.status),color:z(hs)(t.status)},null,8,[`text`,`color`])]),_:2},1032,[`href`])]),_:2},1024),P(z(G),null,{default:B(()=>[P(z(Yd),{href:t.url,class:`text-blue-600 hover:underline dark:text-blue-400`},{default:B(()=>[N(R(t.what),1)]),_:2},1032,[`href`]),t.automatic?(F(),k(z(U),{key:0,"data-tolk-run-automatic":``},{default:B(()=>[N(R(e.__(`Automatic update`)),1)]),_:1})):A(``,!0)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(t.sites),1)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(t.progress)+` `,1),t.failed>0?(F(),k(z(U),{key:0},{default:B(()=>[N(R(e.__n(`:count failed|:count failed`,t.failed)),1)]),_:2},1024)):A(``,!0)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(e.__(`:tokens tokens`,{tokens:z(Q)(t.tokens)}))+` `,1),P(z(U),null,{default:B(()=>[N(R(t.cost===null?e.__(`Cost unknown`):z(bs)(t.cost)),1)]),_:2},1024)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(t.date)+` `,1),P(z(U),null,{default:B(()=>[N(R(t.by),1)]),_:2},1024)]),_:2},1024)]),_:2},1032,[`data-tolk-run-id`]))),128))]),_:1})]),_:1})]))}};function Sf({scan:e,onChange:t=()=>{},concurrency:n=3}){let r=[],i=0,a=0,o=!1;function s(e){return e.generation===a}function c(){for(;i0;)l(r.shift())}async function l(n){i++,t(n.cell.key,{status:`loading`});try{let r=null;do{let i=await e({...n.cell,cursor:r,fresh:n.fresh});if(!s(n))return;r=i.cursor??null,t(n.cell.key,{...i,status:r===null?`done`:`loading`})}while(r!==null)}catch(e){s(n)&&t(n.cell.key,{status:`failed`,error:e?.message??String(e)})}finally{i--,c()}}function u(){a++,r=[]}function d(e,n){for(let i of e)r.push({cell:i,fresh:n,generation:a}),t(i.key,{status:`waiting`});c()}return{load(e,t={}){u(),o=t.fresh??!1,d(e,o)},retry(e){d([e],o)},stop:u,get active(){return i}}}var Cf=[`entry`,`term`,`globals`,`nav`],wf=[`missing`,`untranslated`,`outdated`,`attention`,`current`],Tf={entry:`collections`,term:`taxonomies`,globals:`globals`,nav:`navs`};function Ef(e){return e===`current`?__(`Current`):ca(e)}function Df(e){return{entry:__(`Collections`),term:__(`Taxonomies`),globals:__(`Global sets`),nav:__(`Navigation`)}[e]??e}function Of(e,t,n){return`${e}|${t}|${n}`}function kf(e,t){let n=new Set((Array.isArray(e)?e:[]).flatMap(e=>e.sites??[]));return(Array.isArray(t)?t:[]).filter(e=>n.has(e.handle))}function Af(e){let t=Array.isArray(e)?e:[];return Cf.map(e=>({type:e,label:Df(e),rows:t.filter(t=>t.type===e)})).filter(e=>e.rows.length>0)}function jf(e,t){return{key:Of(e.type,e.handle,t),type:e.type,container:e.handle,site:t}}function Mf(e){return(Array.isArray(e)?e:[]).flatMap(e=>(e.sites??[]).map(t=>jf(e,t)))}function Nf(e){let t=Y(e?.counts),n=e=>Number(t[e])||0;return{counts:Object.fromEntries(wf.map(e=>[e,n(e)])),untracked:Number(e?.untracked)||0,unreadable:Number(e?.unreadable)||0,scanned:Number(e?.scanned)||0,missing:n(`missing`)+n(`untranslated`),outdated:n(`outdated`)}}function Pf(e){let t=Nf(e);return{...t,badges:wf.filter(e=>t.counts[e]>0).map(e=>({status:e,text:`${Ef(e)} ${t.counts[e]}`,color:sa(e)})),finished:e?.status===`done`,loading:e?.status===`waiting`||e?.status===`loading`,failed:e?.status===`failed`,error:e?.error??null}}function Ff(e,t,n,r){return{sites:[n],[Tf[e]]:[t],options:{mode:r}}}function If(e,t,n){let r={};for(let i of Array.isArray(e)?e:[]){if(!(i.sites??[]).includes(n))continue;let e=Y(t)[Of(i.type,i.handle,n)];(e?.status!==`done`||Nf(e).missing!==0)&&(r[Tf[i.type]]??=[]).push(i.handle)}return Object.keys(r).length>0?{sites:[n],...r,options:{mode:`missing`}}:null}function Lf({multisite:e,providers:t,fakeEngine:n}){return e?(Array.isArray(t)?t:[]).some(e=>e.configured)||n?null:`no_provider`:`single_site`}function Rf(e){let t=Y(e?.labels),n=Object.entries(Y(e?.models)).map(([e,n])=>({reference:e,model:t[e]??e,calls:Number(n?.calls)||0,input:Number(n?.input)||0,output:Number(n?.output)||0,cost:n?.cost===null||n?.cost===void 0?null:Number(n.cost),sources:Object.keys(Y(n?.sources))}));return{month:e?.month??``,rows:n,calls:n.reduce((e,t)=>e+t.calls,0),cost:n.some(e=>e.cost===null)?null:n.reduce((e,t)=>e+t.cost,0)}}function zf(e){return{editor:__(`Editor`),run:__(`Runs`),cli:__(`Command line`),auto:__(`Automatic updates`)}[e]??e}function Bf(e,t=void 0){let n=/^(\d{4})-(\d{2})$/.exec(e??``);return n?new Intl.DateTimeFormat(t,{month:`long`,year:`numeric`}).format(Date.UTC(n[1],n[2]-1,15)):``}var Vf={class:`mx-auto max-w-page space-y-6`,"data-tolk-overview":``},Hf={class:`flex flex-wrap gap-4 text-sm`},Uf=[`href`],Wf={class:`overflow-x-auto`},Gf={class:`flex flex-col items-start gap-1`},Kf={key:1,class:`space-y-1.5`},qf={key:0,class:`flex flex-wrap gap-1`},Jf={key:5,class:`space-y-1`},Yf={key:6,class:`flex flex-wrap gap-1`},Xf={class:`grid gap-6 lg:grid-cols-2`},Zf={class:`flex flex-wrap items-center justify-between gap-2`},Qf={class:`overflow-x-auto`},$f={class:`space-y-2`},ep=[`data-tolk-provider`],tp=[`href`],np={class:`flex flex-wrap items-baseline justify-between gap-2`},rp={__name:`Overview`,props:{multisite:{type:Boolean,default:!1},sites:{type:Array,default:()=>[]},rows:{type:Array,default:()=>[]},providers:{type:Array,default:()=>[]},fakeEngine:{type:Boolean,default:!1},usage:{type:Object,default:()=>({})},canResetUsage:{type:Boolean,default:!1},runs:{type:Array,default:()=>[]},urls:{type:Object,required:!0}},setup(e){let t=e,n=Dt({}),r=I(null),i=I(t.usage),a=I(!1),o=I(!1),s=Statamic.$config.get(`tolk`)?.settingsUrl??null,c=O(()=>Lf(t)),l=O(()=>kf(t.rows,t.sites)),u=O(()=>Af(t.rows).map(e=>({...e,rows:e.rows.map(e=>({...e,cells:l.value.map(t=>{let r=jf(e,t.handle),i=e.sites.includes(t.handle),a=n[r.key];return{site:t,cell:r,status:i?a?.status??`waiting`:`none`,view:i?Pf(a):null}})}))}))),d=O(()=>Mf(t.rows)),f=O(()=>Rf(i.value)),p=O(()=>Object.values(n).some(e=>Number(e?.untracked)>0)),h=O(()=>Object.values(n).some(e=>Number(e?.unreadable)>0)),g=O(()=>Object.fromEntries(l.value.map(e=>[e.handle,If(t.rows,n,e.handle)]))),_=Sf({scan:({key:e,...n})=>ea(t.urls.scan,n),onChange:(e,t)=>n[e]=t});pt(()=>{c.value===null&&_.load(d.value)}),lt(()=>_.stop());function v(){_.load(d.value,{fresh:!0})}async function y(e,n){r.value=e;try{let{url:e}=await ea(t.urls.store,n);_.stop(),Xd.visit(e)}catch(e){Statamic.$toast.error(e.message),r.value=null}}async function b(){let e=Bf(f.value.month);a.value=!1,o.value=!0;try{i.value=(await ea(t.urls.resetUsage,{month:f.value.month})).usage,Statamic.$toast.success(__(`The usage of :month was reset.`,{month:e}))}catch(e){Statamic.$toast.error(e.message)}finally{o.value=!1}}return(t,n)=>(F(),j(`div`,Vf,[P(z(Jd),{title:t.__(`Translations`)},null,8,[`title`]),P(z(xr),{title:t.__(`Translations`),icon:`dictionary-language-book`},{default:B(()=>[P(z(Yd),{href:e.urls.runs,class:`text-sm text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200`,"data-tolk-runs-link":``},{default:B(()=>[N(R(t.__(`All runs`)),1)]),_:1},8,[`href`]),c.value===null&&d.value.length>0?(F(),k(z(V),{key:0,text:t.__(`Count again`),icon:`sync`,"data-tolk-count-again":``,onClick:v},null,8,[`text`])):A(``,!0)]),_:1},8,[`title`]),c.value===`single_site`?(F(),k(z(H),{key:0,class:`space-y-3`,"data-tolk-overview-empty":`single_site`},{default:B(()=>[P(z(W),{size:`lg`,text:t.__(`This site has one language`)},null,8,[`text`]),P(z(q),null,{default:B(()=>[N(R(t.__(`Tolk translates the content of one site into the languages of the others. Add a site for each language in Statamic first; the overview then shows what is translated into each.`)),1)]),_:1}),P(z(Yd),{href:e.urls.audit,class:`text-sm text-blue-600 hover:underline dark:text-blue-400`,"data-tolk-audit-link":``},{default:B(()=>[N(R(t.__(`Check the setup`)),1)]),_:1},8,[`href`])]),_:1})):c.value===`no_provider`?(F(),k(z(H),{key:1,class:`space-y-3`,"data-tolk-overview-empty":`no_provider`},{default:B(()=>[P(z(W),{size:`lg`,text:t.__(`No AI provider is set up`)},null,8,[`text`]),P(z(q),null,{default:B(()=>[N(R(t.__(`Tolk needs an API key of Anthropic, OpenAI or Google Gemini in the .env file before it can translate. The settings list the variables to set.`)),1)]),_:1}),M(`div`,Hf,[z(s)?(F(),j(`a`,{key:0,href:z(s),class:`text-blue-600 hover:underline dark:text-blue-400`,"data-tolk-settings-link":``},R(t.__(`Open the settings`)),9,Uf)):A(``,!0),P(z(Yd),{href:e.urls.audit,class:`text-blue-600 hover:underline dark:text-blue-400`,"data-tolk-audit-link":``},{default:B(()=>[N(R(t.__(`Check the setup`)),1)]),_:1},8,[`href`])])]),_:1})):e.rows.length===0?(F(),k(z(H),{key:2,"data-tolk-overview-nothing":``},{default:B(()=>[P(z(q),null,{default:B(()=>[N(R(t.__(`No collection, taxonomy, global set or navigation has more than one site yet, so there is nothing to translate.`)),1)]),_:1})]),_:1})):(F(),k(z(H),{key:3,class:`space-y-3`,"data-tolk-matrix":``},{default:B(()=>[M(`div`,Wf,[P(z(Oi),null,{default:B(()=>[P(z(ki),null,{default:B(()=>[P(z(K),null,{default:B(()=>[N(R(t.__(`Content`)),1)]),_:1}),(F(!0),j(m,null,L(l.value,e=>(F(),k(z(K),{key:e.handle,"data-tolk-column":e.handle},{default:B(()=>[M(`div`,Gf,[M(`span`,null,R(e.name),1),g.value[e.handle]?(F(),k(z(V),{key:0,size:`xs`,text:t.__(`Translate everything missing`),"aria-label":t.__(`Translate everything missing into :site`,{site:e.name}),loading:r.value===`site|${e.handle}`,disabled:r.value!==null,"data-tolk-site-action":e.handle,onClick:t=>y(`site|${e.handle}`,g.value[e.handle])},null,8,[`text`,`aria-label`,`loading`,`disabled`,`data-tolk-site-action`,`onClick`])):A(``,!0)])]),_:2},1032,[`data-tolk-column`]))),128))]),_:1}),P(z(ji),null,{default:B(()=>[(F(!0),j(m,null,L(u.value,e=>(F(),j(m,{key:e.type},[P(z(Ai),{"data-tolk-group":e.type},{default:B(()=>[P(z(G),{colspan:l.value.length+1,class:`bg-gray-50 dark:bg-gray-900`},{default:B(()=>[P(z(W),{text:e.label},null,8,[`text`])]),_:2},1032,[`colspan`])]),_:2},1032,[`data-tolk-group`]),(F(!0),j(m,null,L(e.rows,e=>(F(),k(z(Ai),{key:`${e.type}|${e.handle}`,"data-tolk-row":`${e.type}|${e.handle}`},{default:B(()=>[P(z(G),null,{default:B(()=>[P(z(q),null,{default:B(()=>[N(R(e.title),1)]),_:2},1024),P(z(U),null,{default:B(()=>[N(R(e.handle),1)]),_:2},1024)]),_:2},1024),(F(!0),j(m,null,L(e.cells,({site:i,cell:a,status:o,view:s})=>(F(),k(z(G),{key:i.handle,class:`align-top`,"data-tolk-cell":a.key,"data-tolk-cell-status":o},{default:B(()=>[s?(F(),j(`div`,Kf,[s.badges.length?(F(),j(`div`,qf,[(F(!0),j(m,null,L(s.badges,e=>(F(),k(z(Fn),{key:e.status,text:e.text,color:e.color,"data-tolk-count":e.status},null,8,[`text`,`color`,`data-tolk-count`]))),128))])):A(``,!0),s.loading?(F(),k(z(U),{key:1},{default:B(()=>[N(R(t.__(`Counting…`)),1)]),_:1})):s.finished&&s.scanned===0?(F(),k(z(U),{key:2},{default:B(()=>[N(R(t.__(`Nothing to translate`)),1)]),_:1})):A(``,!0),s.untracked>0?(F(),k(z(U),{key:3,"data-tolk-untracked":``},{default:B(()=>[N(R(t.__n(`:count untracked field|:count untracked fields`,s.untracked)),1)]),_:2},1024)):A(``,!0),s.unreadable>0?(F(),k(z(U),{key:4,"data-tolk-unreadable":``},{default:B(()=>[N(R(t.__n(`:count item with unreadable state|:count items with unreadable state`,s.unreadable)),1)]),_:2},1024)):A(``,!0),s.failed?(F(),j(`div`,Jf,[P(z(q),{size:`sm`,variant:`danger`,"data-tolk-cell-error":``},{default:B(()=>[N(R(s.error),1)]),_:2},1024),P(z(V),{size:`xs`,text:t.__(`Try again`),"data-tolk-cell-retry":``,onClick:e=>z(_).retry(a)},null,8,[`text`,`onClick`])])):A(``,!0),s.missing>0||s.outdated>0?(F(),j(`div`,Yf,[s.missing>0?(F(),k(z(V),{key:0,size:`xs`,text:t.__(`Translate missing`),"aria-label":t.__(`Translate missing :content into :site`,{content:e.title,site:i.name}),loading:r.value===`${a.key}|missing`,disabled:r.value!==null,"data-tolk-cell-action":`missing`,onClick:t=>y(`${a.key}|missing`,z(Ff)(e.type,e.handle,i.handle,`missing`))},null,8,[`text`,`aria-label`,`loading`,`disabled`,`onClick`])):A(``,!0),s.outdated>0?(F(),k(z(V),{key:1,size:`xs`,text:t.__(`Update outdated`),"aria-label":t.__(`Update outdated :content in :site`,{content:e.title,site:i.name}),loading:r.value===`${a.key}|update`,disabled:r.value!==null,"data-tolk-cell-action":`update`,onClick:t=>y(`${a.key}|update`,z(Ff)(e.type,e.handle,i.handle,`update`))},null,8,[`text`,`aria-label`,`loading`,`disabled`,`onClick`])):A(``,!0)])):A(``,!0)])):(F(),k(z(U),{key:0},{default:B(()=>[...n[2]||=[N(`—`,-1)]]),_:1}))]),_:2},1032,[`data-tolk-cell`,`data-tolk-cell-status`]))),128))]),_:2},1032,[`data-tolk-row`]))),128))],64))),128))]),_:1})]),_:1})]),p.value?(F(),k(z(U),{key:0,"data-tolk-baseline-hint":``},{default:B(()=>[N(R(t.__(`Untracked fields were translated by hand without a record of their origin, so a change to the origin goes unnoticed. Run php please tolk:baseline to record the origin of each.`)),1)]),_:1})):A(``,!0),h.value?(F(),k(z(U),{key:1,"data-tolk-unreadable-hint":``},{default:B(()=>[N(R(t.__(`The translation state of some items cannot be read, so their status is unknown and translating them fails. Run php please tolk:doctor to list the files.`)),1)]),_:1})):A(``,!0)]),_:1})),M(`div`,Xf,[P(z(H),{class:`space-y-3`,"data-tolk-usage":``},{default:B(()=>[M(`div`,Zf,[P(z(W),{size:`lg`,text:t.__(`Usage in :month`,{month:z(Bf)(f.value.month)})},null,8,[`text`]),e.canResetUsage&&f.value.rows.length>0?(F(),k(z(V),{key:0,size:`sm`,text:t.__(`Reset`),"aria-label":t.__(`Reset the usage of :month`,{month:z(Bf)(f.value.month)}),loading:o.value,"data-tolk-usage-reset":``,onClick:n[0]||=e=>a.value=!0},null,8,[`text`,`aria-label`,`loading`])):A(``,!0)]),f.value.rows.length===0?(F(),k(z(q),{key:0},{default:B(()=>[N(R(t.__(`No model was called this month.`)),1)]),_:1})):(F(),j(m,{key:1},[M(`div`,Qf,[P(z(Oi),null,{default:B(()=>[P(z(ki),null,{default:B(()=>[P(z(K),null,{default:B(()=>[N(R(t.__(`Model`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Calls`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Tokens`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Cost`)),1)]),_:1})]),_:1}),P(z(ji),null,{default:B(()=>[(F(!0),j(m,null,L(f.value.rows,e=>(F(),k(z(Ai),{key:e.reference,"data-tolk-usage-model":e.reference},{default:B(()=>[P(z(G),null,{default:B(()=>[N(R(e.model)+` `,1),P(z(U),null,{default:B(()=>[N(R(e.sources.map(z(zf)).join(`, `)),1)]),_:2},1024)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(z(Q)(e.calls)),1)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(t.__(`:input in, :output out`,{input:z(Q)(e.input),output:z(Q)(e.output)})),1)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(e.cost===null?t.__(`Unknown`):z(bs)(e.cost)),1)]),_:2},1024)]),_:2},1032,[`data-tolk-usage-model`]))),128))]),_:1})]),_:1})]),P(z(U),{"data-tolk-usage-total":``},{default:B(()=>[N(R(f.value.cost===null?t.__n(`:calls call this month. The cost is unknown: a model without a price was called.|:calls calls this month. The cost is unknown: a model without a price was called.`,f.value.calls,{calls:z(Q)(f.value.calls)}):t.__n(`:calls call this month, an estimated :cost.|:calls calls this month, an estimated :cost.`,f.value.calls,{calls:z(Q)(f.value.calls),cost:z(bs)(f.value.cost)})),1)]),_:1})],64))]),_:1}),P(z(H),{class:`space-y-3`,"data-tolk-providers":``},{default:B(()=>[P(z(W),{size:`lg`,text:t.__(`Providers`)},null,8,[`text`]),M(`ul`,$f,[(F(!0),j(m,null,L(e.providers,e=>(F(),j(`li`,{key:e.provider,class:`flex items-center justify-between gap-2`,"data-tolk-provider":e.provider},[P(z(q),null,{default:B(()=>[N(R(e.label),1)]),_:2},1024),P(z(Fn),tt({ref_for:!0},z(vd)(e.configured)),null,16)],8,ep))),128))]),e.fakeEngine?(F(),k(z(U),{key:0,"data-tolk-fake-engine":``},{default:B(()=>[N(R(t.__(`The fake engine is on: translations are made up without calling a provider.`)),1)]),_:1})):A(``,!0),z(s)?(F(),j(`a`,{key:1,href:z(s),class:`text-sm text-blue-600 hover:underline dark:text-blue-400`},R(t.__(`Settings`)),9,tp)):A(``,!0)]),_:1})]),P(z(H),{class:`space-y-3`,"data-tolk-latest-runs":``},{default:B(()=>[M(`div`,np,[P(z(W),{size:`lg`,text:t.__(`Latest runs`)},null,8,[`text`]),e.runs.length>0?(F(),k(z(Yd),{key:0,href:e.urls.runs,class:`text-sm text-blue-600 hover:underline dark:text-blue-400`},{default:B(()=>[N(R(t.__(`All runs`)),1)]),_:1},8,[`href`])):A(``,!0)]),e.runs.length===0?(F(),k(z(q),{key:0},{default:B(()=>[N(R(t.__(`No translation runs yet.`)),1)]),_:1})):(F(),k(xf,{key:1,runs:e.runs},null,8,[`runs`]))]),_:1}),a.value?(F(),k(z(qn),{key:4,open:``,danger:``,title:t.__(`Reset the usage of :month?`,{month:z(Bf)(f.value.month)}),"body-text":t.__(`The calls, tokens and costs counted this month are deleted, and counting starts again from zero. The runs keep their own usage.`),"button-text":t.__(`Reset`),"data-tolk-usage-reset-confirm":``,"onUpdate:open":n[1]||=e=>a.value=e,onConfirm:b},null,8,[`title`,`body-text`,`button-text`])):A(``,!0)]))}},ip={class:`mx-auto max-w-page space-y-6`,"data-tolk-runs":``},ap={__name:`Index`,props:{runs:{type:Array,default:()=>[]},canReset:{type:Boolean,default:!1},urls:{type:Object,default:()=>({})}},setup(e){let t=e,n=I(!1),r=I(!1),i=O(()=>t.runs.some(e=>Ho.includes(e.status)));async function a(){n.value=!1,r.value=!0;try{let{deleted:e}=await ea(t.urls.reset);Statamic.$toast.success(__n(`:count run was deleted.|:count runs were deleted.`,e)),Xd.reload({only:[`runs`]})}catch(e){Statamic.$toast.error(e.message)}finally{r.value=!1}}return(t,o)=>(F(),j(`div`,ip,[P(z(Jd),{title:t.__(`Translation runs`)},null,8,[`title`]),P(z(xr),{title:t.__(`Translation runs`),icon:`dictionary-language-book`},{default:B(()=>[e.canReset&&i.value?(F(),k(z(V),{key:0,text:t.__(`Reset`),loading:r.value,"data-tolk-runs-reset":``,onClick:o[0]||=e=>n.value=!0},null,8,[`text`,`loading`])):A(``,!0)]),_:1},8,[`title`]),e.runs.length===0?(F(),k(z(H),{key:0,"data-tolk-runs-empty":``},{default:B(()=>[P(z(q),null,{default:B(()=>[N(R(t.__(`No translation runs yet. Runs started from a listing, the overview or the command line appear here.`)),1)]),_:1})]),_:1})):(F(),k(z(H),{key:1},{default:B(()=>[P(xf,{runs:e.runs},null,8,[`runs`])]),_:1})),n.value?(F(),k(z(qn),{key:2,open:``,danger:``,title:t.__(`Delete the finished runs?`),"body-text":t.__(`Every completed, cancelled and aborted run is deleted with its results, and can no longer be resumed or retried. Pending and running runs stay. The translations they saved stay too.`),"button-text":t.__(`Delete`),"data-tolk-runs-reset-confirm":``,"onUpdate:open":o[1]||=e=>n.value=e,onConfirm:a},null,8,[`title`,`body-text`,`button-text`])):A(``,!0)]))}},op=[`data-tolk-run-status`],sp={class:`flex flex-wrap items-center gap-2`},cp={class:`flex flex-wrap items-center gap-x-4 gap-y-1`,"data-tolk-run-counts":``},lp={class:`space-y-3`},up={class:`flex flex-wrap gap-2`},dp={class:`flex flex-wrap items-center justify-between gap-2`},fp={class:`space-y-3`},pp={key:1,class:`flex flex-wrap gap-2`},mp={class:`grid gap-6 lg:grid-cols-2`},hp={class:`overflow-x-auto`},gp={class:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm`},_p={class:`text-gray-600 dark:text-gray-400`},vp=[`data-tolk-option`],yp={class:`flex flex-wrap items-baseline justify-between gap-2`},bp={key:0,class:`flex flex-wrap gap-x-10 gap-y-2 text-sm`},xp={class:`text-gray-600 dark:text-gray-400`},Sp={"data-tolk-estimate-segments":``},Cp={class:`text-gray-600 dark:text-gray-400`},wp={"data-tolk-estimate-chars":``},Tp={class:`text-gray-600 dark:text-gray-400`},Ep={"data-tolk-estimate-input":``},Dp={class:`text-gray-600 dark:text-gray-400`},Op={"data-tolk-estimate-output":``},kp={class:`text-gray-600 dark:text-gray-400`},Ap={"data-tolk-estimate-cost":``},jp={class:`flex flex-wrap items-center justify-between gap-2`},Mp={class:`w-56`},Np={class:`overflow-x-auto`},Pp=[`href`],Fp={key:1},Ip={key:1,class:`flex flex-wrap items-center gap-2`},Lp=[`href`],Rp={key:1,class:`flex items-center justify-end gap-2`,"data-tolk-items-pages":``},zp={__name:`Show`,props:{state:{type:Object,required:!0},urls:{type:Object,required:!0},models:{type:Object,default:()=>({})},lanes:{type:Number,default:1}},setup(e){let t=e,n=I(t.state),r=I(t.state.run?.estimate??null),i=I([]),a=I(null),o=I(t.state.pagination?.page??1),s=t.state.pagination?.per_page??50,c=I(`all`),l=ys(Statamic.$config.get(`sites`)),u=nc.following(t.state.run?.id),d=Rs({urls:t.urls,lanes:t.lanes,dirty:u?null:`tolk-run`,onState:e=>{n.value=e,r.value=e.run?.estimate??r.value,o.value=Ls(o.value,e.pagination)},onEstimate:e=>r.value=e,onFailures:e=>i.value=e,query:()=>({page:o.value,per_page:s,...c.value===`all`?{}:{status:c.value}})});function f(e){d.driving&&(e.preventDefault(),e.returnValue=``)}let p=()=>{};pt(()=>{p=nc.lend(t.state.run?.id),d.follow(t.state),window.addEventListener(`beforeunload`,f)}),lt(()=>{d.stop(),p(n.value),window.removeEventListener(`beforeunload`,f)});let h=O(()=>n.value.run??{}),g=O(()=>h.value.status),_=O(()=>Ss(n.value)),v=O(()=>Cs(n.value)),y=O(()=>Ts(n.value)),b=O(()=>ks(h.value.scope,l)),x=O(()=>Es(n.value.breakdown,l)),S=O(()=>Ds(h.value.scope)),C=Yl(Statamic.$config.get(`tolk.auditUrl`)),w=O(()=>Os(h.value.scope)),ee=O(()=>As(h.value.options,t.models)),T=O(()=>js(r.value,_.value.total)),E=O(()=>Ms(h.value,t.models)),te=O(()=>(n.value.items??[]).map(e=>Is(e,l))),D=O(()=>n.value.pagination??{page:1,last_page:1,total:0}),ne=O(()=>g.value===`running`&&h.value.driver===`browser`),re=O(()=>g.value===`running`&&!!n.value.stalled),ie=O(()=>us.filter(e=>_.value.counts[e]>0).map(e=>({key:e,text:`${Q(_.value.counts[e])} ${gs(e).toLowerCase()}`}))),ae=O(()=>[{label:__(`All items`),value:`all`},...us.map(e=>({label:gs(e),value:e}))]),oe=I(null),se=hu(()=>oe.value),ce=Mc(),le=I([]);function ue(e){le.value=e.corrections,ce.show()}bn(g,()=>se.changing());let de=O(()=>{let e=h.value.created_by?.name,t=xs(h.value.created_at);return b.value.automatic?e?__(`Started automatically on :date, when :name saved the entry.`,{name:e,date:t}):__(`Started automatically on :date, when the entry was saved.`,{date:t}):e?__(`Created by :name on :date`,{name:e,date:t}):__(`Created on :date from the command line`,{date:t})});async function fe(e,t){let n=se.holds();a.value=e;try{let n=await t();e===`retry`&&n?.retried===0&&Statamic.$toast.info(__(`No item failed, so nothing was retried.`))}catch(e){Statamic.$toast.error(e.message)}finally{a.value=null,n&&nt(se.restore)}}async function pe(e){o.value=Math.max(1,e);try{await d.refresh()}catch(e){Statamic.$toast.error(e.message)}}function me(e){c.value=e??`all`,pe(1)}return(t,r)=>(F(),j(`div`,{ref_key:`root`,ref:oe,class:`mx-auto max-w-page space-y-6`,"data-tolk-run":``,"data-tolk-run-status":g.value},[P(z(Jd),{title:t.__(`Translation run`)},null,8,[`title`]),P(z(xr),{title:t.__(`Translation run`),icon:`dictionary-language-book`},{default:B(()=>[P(z(Yd),{href:e.urls.index,class:`text-sm text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200`,"data-tolk-runs-link":``},{default:B(()=>[N(R(t.__(`All runs`)),1)]),_:1},8,[`href`]),v.value.cancel?(F(),k(z(V),{key:0,text:t.__(`Cancel`),loading:a.value===`cancel`,disabled:a.value!==null,"data-tolk-action":`cancel`,onClick:r[0]||=e=>fe(`cancel`,z(d).cancel)},null,8,[`text`,`loading`,`disabled`])):A(``,!0),v.value.start?(F(),k(z(V),{key:1,variant:`primary`,text:t.__(`Start`),loading:a.value===`start`,disabled:a.value!==null,"data-tolk-action":`start`,onClick:r[1]||=e=>fe(`start`,z(d).start)},null,8,[`text`,`loading`,`disabled`])):A(``,!0)]),_:1},8,[`title`]),P(z(H),{class:`space-y-3`,"data-tolk-run-summary":``},{default:B(()=>[M(`div`,sp,[P(z(Fn),{text:z(ms)(g.value),color:z(hs)(g.value),"data-tolk-run-status-badge":``},null,8,[`text`,`color`]),P(z(q),null,{default:B(()=>[N(R(b.value.sites?t.__(`:what into :sites`,{what:b.value.what,sites:b.value.sites}):b.value.what),1)]),_:1})]),P(z(U),null,{default:B(()=>[N(R(de.value),1)]),_:1}),g.value===`pending`?A(``,!0):(F(),j(m,{key:0},[P(Va,{value:_.value.finished,max:_.value.total,label:t.__(`Run progress`)},null,8,[`value`,`max`,`label`]),M(`div`,cp,[P(z(q),null,{default:B(()=>[N(R(t.__(`:finished of :total items finished`,{finished:z(Q)(_.value.finished),total:z(Q)(_.value.total)})),1)]),_:1}),(F(!0),j(m,null,L(ie.value,e=>(F(),k(z(U),{key:e.key,"data-tolk-count":e.key},{default:B(()=>[N(R(e.text),1)]),_:2},1032,[`data-tolk-count`]))),128))]),P(z(U),{"data-tolk-run-usage":``},{default:B(()=>[N(R(t.__n(`:input input and :output output tokens in :calls call.|:input input and :output output tokens in :calls calls.`,E.value.calls,{input:z(Q)(E.value.input),output:z(Q)(E.value.output),calls:z(Q)(E.value.calls)}))+` `+R(E.value.cost===null?t.__(`The cost is unknown: a model without a price was called.`):t.__(`Estimated cost so far: :cost.`,{cost:z(bs)(E.value.cost)})),1)]),_:1})],64))]),_:1}),ne.value?(F(),k(z(jn),{key:0,variant:`default`,icon:`info`,"data-tolk-keep-open":``},{default:B(()=>[N(R(z(u)?t.__(`Keep this tab open while the run is in progress. Closing it pauses the run until you open it again.`):t.__(`Keep this page open while the run is in progress. Leaving it pauses the run until you open it again.`)),1)]),_:1})):A(``,!0),re.value?(F(),k(z(jn),{key:1,variant:`warning`,heading:t.__(`This run is not moving`),"data-tolk-stalled":``},{default:B(()=>[M(`div`,lp,[h.value.driver===`cli`&&b.value.automatic?(F(),k(z(q),{key:0},{default:B(()=>[N(R(t.__(`The process that updates these translations has not worked on them for a while and may have stopped. Resume continues the run from here.`)),1)]),_:1})):h.value.driver===`cli`?(F(),k(z(q),{key:1},{default:B(()=>[N(R(t.__(`The command running this run has not worked on it for a while and may have stopped. Resume continues the run from here.`)),1)]),_:1})):(F(),k(z(q),{key:2},{default:B(()=>[N(R(t.__(`No queue worker has worked on this run for a while. Start a worker for the queue, or run it in this browser instead.`)),1)]),_:1})),M(`div`,up,[P(z(V),{size:`sm`,text:t.__(`Resume`),loading:a.value===`resume`,disabled:a.value!==null,"data-tolk-action":`resume`,onClick:r[2]||=e=>fe(`resume`,z(d).resume)},null,8,[`text`,`loading`,`disabled`]),v.value.takeOver?(F(),k(z(V),{key:0,size:`sm`,variant:`primary`,text:t.__(`Run in this browser instead`),loading:a.value===`take-over`,disabled:a.value!==null,"data-tolk-action":`take-over`,onClick:r[3]||=e=>fe(`take-over`,z(d).takeOver)},null,8,[`text`,`loading`,`disabled`])):A(``,!0)])])]),_:1},8,[`heading`])):A(``,!0),(F(!0),j(m,null,L(i.value,(e,i)=>(F(),k(z(jn),{key:i,variant:`error`,"data-tolk-run-failure":``},{default:B(()=>[M(`div`,dp,[P(z(q),null,{default:B(()=>[N(R(t.__(`Following the run stopped: :message`,{message:e.error?.message??``})),1)]),_:2},1024),i===0?(F(),k(z(V),{key:0,size:`sm`,text:t.__(`Try again`),"data-tolk-action":`follow-again`,onClick:r[4]||=e=>z(d).follow(n.value)},null,8,[`text`])):A(``,!0)])]),_:2},1024))),128)),y.value?(F(),k(z(jn),{key:2,variant:y.value.variant,"data-tolk-run-result":``},{default:B(()=>[M(`div`,fp,[P(z(q),{as:`p`},{default:B(()=>[N(R(y.value.text),1)]),_:1}),y.value.error?(F(),k(z(q),{key:0,as:`p`,variant:`danger`},{default:B(()=>[N(R(y.value.error),1)]),_:1})):A(``,!0),v.value.retry||v.value.resume?(F(),j(`div`,pp,[v.value.retry?(F(),k(z(V),{key:0,size:`sm`,text:t.__(`Retry failed`),loading:a.value===`retry`,disabled:a.value!==null,"data-tolk-action":`retry`,onClick:r[5]||=e=>fe(`retry`,z(d).retry)},null,8,[`text`,`loading`,`disabled`])):A(``,!0),v.value.resume?(F(),k(z(V),{key:1,size:`sm`,text:t.__(`Resume`),loading:a.value===`resume`,disabled:a.value!==null,"data-tolk-action":`resume`,onClick:r[6]||=e=>fe(`resume`,z(d).resume)},null,8,[`text`,`loading`,`disabled`])):A(``,!0)])):A(``,!0)])]),_:1},8,[`variant`])):A(``,!0),M(`div`,mp,[P(z(H),{class:`space-y-3`,"data-tolk-breakdown":``},{default:B(()=>[P(z(W),{size:`lg`,text:t.__(`What it translates`)},null,8,[`text`]),M(`div`,hp,[P(z(Oi),null,{default:B(()=>[P(z(ki),null,{default:B(()=>[P(z(K),null,{default:B(()=>[N(R(t.__(`Content`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Site`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Items`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Skipped`)),1)]),_:1})]),_:1}),P(z(ji),null,{default:B(()=>[(F(!0),j(m,null,L(x.value,e=>(F(),k(z(Ai),{key:e.key,"data-tolk-breakdown-row":e.key},{default:B(()=>[P(z(G),null,{default:B(()=>[N(R(e.type),1)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(e.site),1)]),_:2},1024),P(z(G),{"data-tolk-breakdown-total":``},{default:B(()=>[N(R(z(Q)(e.total)),1)]),_:2},1024),P(z(G),{"data-tolk-breakdown-skipped":``},{default:B(()=>[N(R(z(Q)(e.skipped)),1)]),_:2},1024)]),_:2},1032,[`data-tolk-breakdown-row`]))),128))]),_:1})]),_:1})]),x.value.length===0?(F(),k(z(U),{key:0},{default:B(()=>[N(R(t.__(`This run has nothing to translate.`)),1)]),_:1})):A(``,!0),(F(!0),j(m,null,L(S.value,e=>(F(),k(z(U),{key:e.reason,"data-tolk-left-out":e.reason},{default:B(()=>[N(R(e.text),1)]),_:2},1032,[`data-tolk-left-out`]))),128)),w.value?(F(),k(z(U),{key:1,"data-tolk-not-localizable":``},{default:B(()=>[N(R(w.value)+` `,1),z(C)?(F(),k(z(Yd),{key:0,href:z(C),class:`text-blue-600 hover:underline dark:text-blue-400`,"data-tolk-audit-link":``},{default:B(()=>[N(R(t.__(`Open the setup audit`)),1)]),_:1},8,[`href`])):(F(),j(m,{key:1},[N(R(t.__(`Run php please tolk:doctor for details.`)),1)],64))]),_:1})):A(``,!0)]),_:1}),P(z(H),{class:`space-y-3`,"data-tolk-settings":``},{default:B(()=>[P(z(W),{size:`lg`,text:t.__(`Settings`)},null,8,[`text`]),M(`dl`,gp,[(F(!0),j(m,null,L(ee.value,e=>(F(),j(m,{key:e.key},[M(`dt`,_p,R(e.label),1),M(`dd`,{"data-tolk-option":e.key},R(e.value),9,vp)],64))),128))])]),_:1})]),g.value===`pending`||T.value?(F(),k(z(H),{key:3,class:`space-y-3`,"data-tolk-estimate":``,"data-tolk-estimate-finished":T.value?.finished?`true`:`false`},{default:B(()=>[M(`div`,yp,[P(z(W),{size:`lg`,text:t.__(`Estimate`)},null,8,[`text`]),T.value?!T.value.finished&&g.value===`pending`?(F(),k(z(U),{key:1},{default:B(()=>[N(R(t.__(`Estimating… :progress`,{progress:T.value.progress})),1)]),_:1})):T.value.finished?A(``,!0):(F(),k(z(U),{key:2,"data-tolk-estimate-partial":``},{default:B(()=>[N(R(T.value.partial),1)]),_:1})):(F(),k(z(U),{key:0},{default:B(()=>[N(R(t.__(`Estimating…`)),1)]),_:1}))]),T.value?(F(),j(`dl`,bp,[M(`div`,null,[M(`dt`,xp,R(t.__(`Segments`)),1),M(`dd`,Sp,R(z(Q)(T.value.segments)),1)]),M(`div`,null,[M(`dt`,Cp,R(t.__(`Characters`)),1),M(`dd`,wp,R(z(Q)(T.value.chars)),1)]),M(`div`,null,[M(`dt`,Tp,R(t.__(`Input tokens`)),1),M(`dd`,Ep,R(z(Q)(T.value.inputTokens)),1)]),M(`div`,null,[M(`dt`,Dp,R(t.__(`Output tokens`)),1),M(`dd`,Op,R(z(Q)(T.value.outputTokens)),1)]),M(`div`,null,[M(`dt`,kp,R(t.__(`Cost`)),1),M(`dd`,Ap,R(T.value.cost===null?t.__(`Unknown`):z(bs)(T.value.cost)),1)])])):A(``,!0),P(z(U),null,{default:B(()=>[N(R(t.__(`An estimate: the tokens a language takes vary, and so does what a model writes.`))+` `,1),T.value&&T.value.cost===null?(F(),j(m,{key:0},[N(R(t.__(`The cost is unknown because a model has no price.`)),1)],64)):A(``,!0)]),_:1})]),_:1},8,[`data-tolk-estimate-finished`])):A(``,!0),P(z(H),{class:`space-y-3`,"data-tolk-items":``},{default:B(()=>[M(`div`,jp,[P(z(W),{size:`lg`,text:t.__(`Items`)},null,8,[`text`]),M(`div`,Mp,[P(z(fi),{"model-value":c.value,options:ae.value,size:`sm`,"data-tolk-items-filter":``,"onUpdate:modelValue":me},null,8,[`model-value`,`options`])])]),M(`div`,Np,[P(z(Oi),null,{default:B(()=>[P(z(ki),null,{default:B(()=>[P(z(K),null,{default:B(()=>[N(R(t.__(`Title`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Site`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Status`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Result`)),1)]),_:1})]),_:1}),P(z(ji),null,{default:B(()=>[(F(!0),j(m,null,L(te.value,e=>(F(),k(z(Ai),{key:e.index,"data-tolk-item":``,"data-tolk-item-status":e.status},{default:B(()=>[P(z(G),null,{default:B(()=>[e.editUrl?(F(),j(`a`,{key:0,href:e.editUrl,class:`text-blue-600 hover:underline dark:text-blue-400`},R(e.title),9,Pp)):(F(),j(`span`,Fp,R(e.title),1))]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(e.site),1)]),_:2},1024),P(z(G),null,{default:B(()=>[P(z(Fn),{text:e.statusLabel,color:e.statusColor},null,8,[`text`,`color`])]),_:2},1024),P(z(G),{class:`space-y-1`},{default:B(()=>[e.applied?(F(),k(z(q),{key:0,size:`sm`},{default:B(()=>[N(R(e.applied),1)]),_:2},1024)):A(``,!0),e.corrections.length?(F(),j(`div`,Ip,[P(z(q),{size:`sm`},{default:B(()=>[N(R(e.corrected),1)]),_:2},1024),P(z(V),{size:`sm`,variant:`ghost`,text:t.__(`View changes`),"aria-label":t.__(`View changes to :title in :site`,{title:e.title,site:e.site}),"data-tolk-item-changes":``,onClick:t=>ue(e)},null,8,[`text`,`aria-label`,`onClick`])])):A(``,!0),e.incomplete.length?(F(),k(z(U),{key:2},{default:B(()=>[N(R(t.__(`Left incomplete: :fields`,{fields:e.incomplete.join(`, `)})),1)]),_:2},1024)):A(``,!0),e.failed.length?(F(),k(z(U),{key:3,"data-tolk-item-failed":``},{default:B(()=>[N(R(t.__(`Could not be translated: :fields`,{fields:e.failed.map(e=>`${e.handle} (${e.reason})`).join(`, `)})),1)]),_:2},1024)):A(``,!0),e.notReviewed.length?(F(),k(z(U),{key:4},{default:B(()=>[N(R(t.__(`Not reviewed in full: :fields`,{fields:e.notReviewed.join(`, `)})),1)]),_:2},1024)):A(``,!0),e.kept.length?(F(),k(z(U),{key:5},{default:B(()=>[N(R(t.__(`Not changed: :fields`,{fields:e.kept.map(e=>`${e.handle} (${e.reason})`).join(`, `)})),1)]),_:2},1024)):A(``,!0),e.reason?(F(),k(z(U),{key:6},{default:B(()=>[N(R(e.reason),1)]),_:2},1024)):A(``,!0),e.error?(F(),k(z(q),{key:7,size:`sm`,variant:`danger`,"data-tolk-item-error":``},{default:B(()=>[N(R(e.error)+` `,1),e.rootPage?(F(),j(`a`,{key:0,href:e.rootPage.url,class:`text-blue-600 hover:underline dark:text-blue-400`,"data-tolk-root-page":``},R(t.__(`Open :title`,{title:e.rootPage.title})),9,Lp)):A(``,!0)]),_:2},1024)):A(``,!0),(F(!0),j(m,null,L(e.warnings,(e,t)=>(F(),k(z(U),{key:t},{default:B(()=>[N(R(e),1)]),_:2},1024))),128))]),_:2},1024)]),_:2},1032,[`data-tolk-item-status`]))),128))]),_:1})]),_:1})]),te.value.length===0?(F(),k(z(U),{key:0},{default:B(()=>[N(R(t.__(`No items.`)),1)]),_:1})):A(``,!0),D.value.last_page>1?(F(),j(`div`,Rp,[P(z(U),null,{default:B(()=>[N(R(t.__(`Page :page of :pages`,{page:D.value.page,pages:D.value.last_page})),1)]),_:1}),P(z(V),{size:`sm`,icon:`chevron-left`,"aria-label":t.__(`Previous page`),disabled:D.value.page<=1,onClick:r[7]||=e=>pe(D.value.page-1)},null,8,[`aria-label`,`disabled`]),P(z(V),{size:`sm`,icon:`chevron-right`,"aria-label":t.__(`Next page`),disabled:D.value.page>=D.value.last_page,onClick:r[8]||=e=>pe(D.value.page+1)},null,8,[`aria-label`,`disabled`])])):A(``,!0),z(ce).open?(F(),k(za,{key:2,modal:z(ce),corrections:le.value},null,8,[`modal`,`corrections`])):A(``,!0)]),_:1})],8,op))}};Statamic.booting(()=>{Statamic.$components.register(Tc,zu),Statamic.$components.register(Hu,Vu),Statamic.$components.register(`tolk_model-fieldtype`,gd),Statamic.$components.register(`tolk_providers-fieldtype`,Ed),Statamic.$components.register(`tolk_site_profile-fieldtype`,Kd),Statamic.$inertia.register(`tolk::Audit`,yf),Statamic.$inertia.register(`tolk::Overview`,rp),Statamic.$inertia.register(`tolk::Runs/Index`,ap),Statamic.$inertia.register(`tolk::Runs/Show`,zp),Ua.listen(),Ac.listen(),sl.listen(),lu({PipelineStopped:a}).listen(),Gu.register()}); \ No newline at end of file diff --git a/resources/dist/build/assets/cp-CtqImns9.js b/resources/dist/build/assets/cp-CtqImns9.js deleted file mode 100644 index 27de1d7..0000000 --- a/resources/dist/build/assets/cp-CtqImns9.js +++ /dev/null @@ -1,2 +0,0 @@ -var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},{AfterSaveHooks:n,BeforeSaveHooks:r,Pipeline:i,PipelineStopped:a,Request:o}=__STATAMIC__.savePipeline,{BaseTransition:s,BaseTransitionPropsValidators:c,Comment:l,DeprecationTypes:u,EffectScope:d,ErrorCodes:f,ErrorTypeStrings:p,Fragment:m,KeepAlive:h,ReactiveEffect:g,Static:_,Suspense:v,Teleport:y,Text:b,TrackOpTypes:x,Transition:S,TransitionGroup:C,TriggerOpTypes:w,VueElement:ee,__esModule:T,assertNumber:E,callWithAsyncErrorHandling:te,callWithErrorHandling:D,camelize:ne,capitalize:re,cloneVNode:ie,compatUtils:ae,compile:oe,computed:O,createApp:se,createBlock:k,createCommentVNode:A,createElementBlock:j,createElementVNode:M,createHydrationRenderer:ce,createPropsRestProxy:le,createRenderer:ue,createSSRApp:de,createSlots:fe,createStaticVNode:pe,createTextVNode:N,createVNode:P,customRef:me,defineAsyncComponent:he,defineComponent:ge,defineCustomElement:_e,defineEmits:ve,defineExpose:ye,defineModel:be,defineOptions:xe,defineProps:Se,defineSSRCustomElement:Ce,defineSlots:we,devtools:Te,effect:Ee,effectScope:De,getCurrentInstance:Oe,getCurrentScope:ke,getCurrentWatcher:Ae,getTransitionRawChildren:je,guardReactiveProps:Me,h:Ne,handleError:Pe,hasInjectionContext:Fe,hydrate:Ie,hydrateOnIdle:Le,hydrateOnInteraction:Re,hydrateOnMediaQuery:ze,hydrateOnVisible:Be,initCustomFormatter:Ve,initDirectivesForSSR:He,inject:Ue,isMemoSame:We,isProxy:Ge,isReactive:Ke,isReadonly:qe,isRef:Je,isRuntimeOnly:Ye,isShallow:Xe,isVNode:Ze,markRaw:Qe,mergeDefaults:$e,mergeModels:et,mergeProps:tt,nextTick:nt,nodeOps:rt,normalizeClass:it,normalizeProps:at,normalizeStyle:ot,onActivated:st,onBeforeMount:ct,onBeforeUnmount:lt,onBeforeUpdate:ut,onDeactivated:dt,onErrorCaptured:ft,onMounted:pt,onRenderTracked:mt,onRenderTriggered:ht,onScopeDispose:gt,onServerPrefetch:_t,onUnmounted:vt,onUpdated:yt,onWatcherCleanup:bt,openBlock:F,patchProp:xt,popScopeId:St,provide:Ct,proxyRefs:wt,pushScopeId:Tt,queuePostFlushCb:Et,reactive:Dt,readonly:Ot,ref:I,registerRuntimeCompiler:kt,render:At,renderList:L,renderSlot:jt,resolveComponent:Mt,resolveDirective:Nt,resolveDynamicComponent:Pt,resolveFilter:Ft,resolveTransitionHooks:It,setBlockTracking:Lt,setDevtoolsHook:Rt,setTransitionHooks:zt,shallowReactive:Bt,shallowReadonly:Vt,shallowRef:Ht,ssrContextKey:Ut,ssrUtils:Wt,stop:Gt,toDisplayString:R,toHandlerKey:Kt,toHandlers:qt,toRaw:Jt,toRef:Yt,toRefs:Xt,toValue:Zt,transformVNodeArgs:Qt,triggerRef:$t,unref:z,useAttrs:en,useCssModule:tn,useCssVars:nn,useHost:rn,useId:an,useModel:on,useSSRContext:sn,useShadowRoot:cn,useSlots:ln,useTemplateRef:un,useTransitionState:dn,vModelCheckbox:fn,vModelDynamic:pn,vModelRadio:mn,vModelSelect:hn,vModelText:gn,vShow:_n,version:vn,warn:yn,watch:bn,watchEffect:xn,watchPostEffect:Sn,watchSyncEffect:Cn,withAsyncContext:wn,withCtx:B,withDefaults:Tn,withDirectives:En,withKeys:Dn,withMemo:On,withModifiers:kn,withScopeId:An}=window.Vue,{Alert:jn,AuthCard:Mn,Avatar:Nn,Badge:Pn,Button:V,ButtonGroup:Fn,Calendar:In,Card:H,CardList:Ln,CardListItem:Rn,CardPanel:zn,CharacterCounter:Bn,Checkbox:Vn,CheckboxGroup:Hn,CodeEditor:Un,Combobox:Wn,CommandPaletteItem:Gn,ConfirmationModal:Kn,ContentDirection:qn,useContentDirection:Jn,useUiDirection:Yn,Context:Xn,ContextFooter:Zn,ContextHeader:Qn,ContextItem:$n,ContextLabel:er,ContextMenu:tr,ContextSeparator:nr,CreateForm:rr,DatePicker:ir,DateRangePicker:ar,Description:U,DocsCallout:or,DragHandle:sr,Dropdown:cr,DropdownItem:lr,DropdownLabel:ur,DropdownMenu:dr,DropdownSeparator:fr,DropdownFooter:pr,DropdownHeader:mr,Editable:hr,ErrorMessage:gr,EmptyStateItem:_r,EmptyStateMenu:vr,Field:yr,Header:br,Heading:W,HoverCard:xr,Icon:Sr,Input:Cr,InputGroup:wr,InputGroupAppend:Tr,InputGroupPrepend:Er,Label:Dr,Listing:Or,ListingCustomizeColumns:kr,ListingFilters:Ar,ListingHeaderCell:jr,ListingPagination:Mr,ListingPresets:Nr,ListingPresetTrigger:Pr,ListingRowActions:Fr,ListingSearch:Ir,ListingTable:Lr,ListingTableBody:Rr,ListingTableHead:zr,ListingToggleAll:Br,LivePreview:Vr,LivePreviewPopout:Hr,MiddleEllipsis:Ur,Modal:Wr,ModalClose:Gr,ModalTitle:Kr,Pagination:qr,Panel:Jr,PanelFooter:Yr,PanelHeader:Xr,Popover:Zr,PublishComponents:Qr,PublishContainer:$r,publishContextKey:ei,injectPublishContext:ti,PublishField:ni,PublishFields:ri,PublishFieldsProvider:ii,PublishForm:ai,PublishLocalizations:oi,PublishSections:si,PublishTabs:ci,Radio:li,RadioGroup:ui,Select:di,Separator:fi,Slider:pi,Skeleton:mi,SplitterGroup:hi,SplitterPanel:gi,SplitterResizeHandle:_i,StatusIndicator:vi,Subheading:yi,Switch:bi,TabContent:xi,Stack:Si,StackClose:Ci,StackHeader:wi,StackFooter:Ti,StackContent:Ei,Table:Di,TableCell:G,TableColumn:K,TableColumns:Oi,TableRow:ki,TableRows:Ai,TabList:ji,TabProvider:Mi,Tabs:Ni,TabTrigger:Pi,Text:q,Textarea:Fi,TimePicker:Ii,TimezoneHoverCard:Li,Timezones:Ri,ToggleGroup:zi,ToggleItem:Bi,Widget:Vi,registerIconSet:Hi,registerIconSetFromStrings:Ui}=__STATAMIC__.ui,Wi=/(<\/?\d+>|||\s+)/,Gi=/^(?:<\/?\d+>||)$/,Ki=/^\s+$/;function qi(e){return String(e??``).split(Wi).filter(e=>e!==``).map(e=>({text:e,kind:Ki.test(e)?`space`:Gi.test(e)?`placeholder`:`word`}))}function Ji(e,t){let n=new Set,r=new Set;if(e.length*t.length>25e4)return[n,r];let i=t.length+1,a=new Uint32Array((e.length+1)*i);for(let n=e.length-1;n>=0;n--)for(let r=t.length-1;r>=0;r--)a[n*i+r]=e[n]===t[r]?a[(n+1)*i+r+1]+1:Math.max(a[(n+1)*i+r],a[n*i+r+1]);for(let o=0,s=0;o=a[o*i+s+1]?o++:s++;return[n,r]}function Yi(e,t){let n=0,r=e.map(e=>({...e,changed:e.kind!==`space`&&!t.has(n++)}));return r.forEach((e,t)=>{e.kind===`space`&&(e.changed=!!(r[t-1]?.changed&&r[t+1]?.changed))}),r}function Xi(e,t){let n=qi(e),r=qi(t),i=e=>e.filter(e=>e.kind!==`space`).map(e=>e.text),[a,o]=Ji(i(n),i(r));return{before:Yi(n,a),after:Yi(r,o)}}var J=t({ApiError:()=>Zi,asMap:()=>Y,get:()=>Qi,normalizeError:()=>na,post:()=>$i}),Zi=class extends Error{constructor({status:e,code:t,message:n,data:r}){super(n),this.name=`ApiError`,this.status=e,this.code=t,this.data=r}};function Y(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function Qi(e,t={}){return ta(`get`,e,{params:t})}function $i(e,t={}){return ta(`post`,e,t)}function ea(){return Statamic.$app.config.globalProperties.$axios}async function ta(e,t,n){let r=ea(),i=/^https?:\/\//i.test(t)?t:cp_url(`tolk/${t.replace(/^\/+/,``)}`);try{return(await r[e](i,n)).data}catch(e){throw na(e)}}function na(e){let t=e?.response,n=t?.data!==null&&typeof t?.data==`object`?t.data:null,r=t?.status??0;return new Zi({status:r,code:typeof n?.code==`string`?n.code:null,message:typeof n?.message==`string`&&n.message!==``?n.message:ra(r),data:n})}function ra(e){return e===0?__(`The server could not be reached.`):__(`The request failed with status :status.`,{status:e})}var ia={untranslated:{text:e=>__n(`:count field untranslated|:count fields untranslated`,e),description:()=>__(`Not translated yet. Translate fills them in.`)},outdated:{text:e=>__n(`:count field outdated|:count fields outdated`,e),description:()=>__(`The source changed since they were translated, or part of their text is still untranslated. Update translates them again.`)},manual:{text:e=>__n(`:count field edited by hand|:count fields edited by hand`,e),description:()=>__(`Edited by hand. Translate and Update leave them alone.`)},attention:{text:e=>__n(`:count needs attention|:count need attention`,e),description:()=>__(`Edited by hand, and the source changed since or they hold its text again. Check them against the source.`)},untracked:{text:e=>__n(`:count untracked|:count untracked`,e),description:()=>__(`Edited by hand before their translation was tracked, so a change to the source cannot be detected. Mark them as up to date to track them.`)},current:{text:e=>__n(`:count field up to date|:count fields up to date`,e),description:()=>__(`Translated and up to date with the source.`)}},aa={missing:`red`,untranslated:`orange`,outdated:`amber`,attention:`purple`,manual:`sky`,untracked:`default`,current:`green`};function oa(e){return aa[e]??`default`}function sa(e){return{missing:__(`Missing`),untranslated:__(`Untranslated`),outdated:__(`Outdated`),attention:__(`Needs attention`),current:__(`Up to date`)}[e]??e}function ca(e={}){return Object.entries(ia).filter(([t])=>(e[t]??0)>0).map(([t,n])=>({key:t,count:e[t],text:n.text(e[t]),description:n.description()}))}function la(e){let t=e?.defaults??{};return!(t.providers_configured||t.fake_engine)||!t.translator}function ua(e){if(e?.translatable!==!0)return{visible:!1,reason:e?.reason??null,setup:!1,translator:null,localization:null,origin:null};let t=la(e);return{visible:!0,reason:null,setup:t,translator:e.defaults?.translator??null,localization:e.localization?da(e.localization,t):null,origin:e.origin?va(e.origin,t):null}}function da(e,t){let n=e.counts??{},r=ca(n),i=Object.entries(e.fields??{}),a=i.filter(([,e])=>e.incomplete).map(([e,t])=>({handle:e,label:t.label})),o=i.filter(([,e])=>e.same_as_origin).map(([e,t])=>({handle:e,label:t.label})),s=(e.out_of_scope??[]).filter(e=>e.reason===`not_localizable`).map(({handle:e,label:t})=>({handle:e,label:t})),c=pa(e,r);return{source:e.source,target:e.target,status:e.status,label:sa(e.status),parts:r,summary:c,lead:r.length>0?__(`From :source:`,{source:e.source?.name??``}):c,incomplete:a,incompleteNote:a.length?ma(a):null,copies:o,copiesNote:o.length?ha(o):null,translateCopies:!t&&o.length>0,translateCopiesLabel:__n(`Translate it|Translate them`,o.length),notLocalizable:s,hint:s.length?ga(_a(s),s.length):null,translate:!t&&(n.untranslated??0)>0,update:!t&&(n.outdated??0)>0,autoUpdated:fa(e.auto_updated,e.source)}}function fa(e,t){let n=Date.parse(e?.at??``);if(Number.isNaN(n))return null;let r={source:t?.name??``,date:new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(n)};return e.unpublished?__(`Updated automatically from :source on :date, not published yet.`,r):__(`Updated automatically from :source on :date.`,r)}function pa(e,t){let n=e.source?.name??``;return t.length===0?__(`Nothing to translate from :source.`,{source:n}):t.every(e=>e.key===`current`)?__(`Up to date with :source.`,{source:n}):__(`From :source: :parts.`,{source:n,parts:t.map(e=>e.text).join(`, `)})}function ma(e){return __n(`:fields is partly untranslated. Update translates the rest.|:fields are partly untranslated. Update translates the rest.`,e.length,{fields:_a(e)})}function ha(e){return __n(`:fields holds the text of the origin again. Translate it, or mark it as up to date to keep it.|:fields hold the text of the origin again. Translate them, or mark them as up to date to keep them.`,e.length,{fields:_a(e)})}function ga(e,t){return __n(`:fields is not translated because it is not localizable.|:fields are not translated because they are not localizable.`,t,{fields:e})}function _a(e){return e.map(e=>e.label).join(`, `)}function va(e,t){let n=(e.localizations??[]).map(e=>{let t=!e.exists,n=e.counts??{},r=t?[]:ca(n),i=typeof e.error==`string`&&e.error!==``;return{site:e.site,name:e.name,exists:e.exists,status:e.status,label:i?__(`Unreadable`):sa(e.status),color:i?`red`:oa(e.status),parts:r,summary:i?e.error:ya(e,r),editUrl:e.edit_url??null,translate:!i&&(t||(n.untranslated??0)>0),update:!i&&!t&&(n.outdated??0)>0}});return{localizations:n,upToDate:n.length>0&&n.every(e=>e.status===`current`),translateInto:!t&&n.some(e=>e.translate),update:!t&&n.some(e=>e.update),translatesPublished:e.translates_published===!0,unpublishedChanges:e.unpublished_changes===!0,autoUpdate:{save:__(`Translations are updated automatically each time this entry is saved.`),publish:__(`Translations are updated automatically when this entry is published.`)}[e.auto_update]??null}}function ya(e,t){return e.exists?t.length===0?__(`Nothing to translate.`):t.every(e=>e.key===`current`)?null:t.map(e=>e.text).join(`, `):__(`Not created yet.`)}function ba(e,t=globalThis.Statamic?.$config?.get(`tolk.models`)){if(typeof t?.[e]==`string`)return t[e];let n=e.indexOf(`:`);return n===-1?e:e.slice(n+1)}function xa(e,t){let n=Y(t?.localization?.fields);return e.map(e=>n[e]?.label??e).join(`, `)}function Sa(e,t=null,{retry:n=!1}={}){if(!e)return null;let r=e.kind===`review`,i=e.delivered.length,a=e.corrections?.length??0,o=Object.keys(e.skipped).filter(t=>e.skipped[t]===`edited`),s=Object.keys(e.skipped).filter(t=>e.skipped[t]===`hidden`),c=Object.keys(e.planSkipped??{}).filter(t=>e.planSkipped[t]===`manual`),l=Object.keys(e.failed);return{translated:r?null:wa(i,Ca(e)),reviewed:Ta(e,a),corrections:a,reviewSkipped:e.reviewSkipped?.length?__(`Part of the text could not be reviewed and was kept as it was.`):null,incomplete:e.incomplete.length?__n(`:fields is partly untranslated. Update translates the rest after you save.|:fields are partly untranslated. Update translates the rest after you save.`,e.incomplete.length,{fields:xa(e.incomplete,t)}):null,edited:o.length?__n(`:fields was skipped because you edited it.|:fields were skipped because you edited them.`,o.length,{fields:xa(o,t)}):null,hidden:s.length?Da(s,r,t):null,manual:c.length?Oa(c,r,t):null,failed:l.length?Ea(l,r,n,t):null,cancelled:e.cancelled?r?__(`The review was cancelled before it finished.`):__(`The translation was cancelled before it finished.`):null,unsaved:i>0?__(`Not saved yet. Check the fields, then save.`):null}}function Ca(e){let t=e.models.filter(t=>t!==e.reviewer);return(t.length?t:e.models).map(e=>ba(e)).join(`, `)}function wa(e,t){return e===0?__(`No fields were translated.`):t?__n(`:count field translated with :model.|:count fields translated with :model.`,e,{model:t}):__n(`:count field translated.|:count fields translated.`,e)}function Ta(e,t){if(e.kind===`review`&&(e.planned??[]).length===0)return __(`There was nothing to review: no field holds a translation that is up to date.`);if(!e.reviewer||!e.reviewedUnits?.length)return null;let n=ba(e.reviewer);return t>0?__n(`Reviewed with :model: :count correction.|Reviewed with :model: :count corrections.`,t,{model:n}):__(`Reviewed with :model: nothing to correct.`,{model:n})}function Ea(e,t,n,r){let i=xa(e,r);return n?t?__n(`:fields could not be reviewed. Retry reviews it again.|:fields could not be reviewed. Retry reviews them again.`,e.length,{fields:i}):__n(`:fields could not be translated. Retry translates it again.|:fields could not be translated. Retry translates them again.`,e.length,{fields:i}):t?__n(`:fields could not be reviewed.|:fields could not be reviewed.`,e.length,{fields:i}):__n(`:fields could not be translated.|:fields could not be translated.`,e.length,{fields:i})}function Da(e,t,n){let r=xa(e,n);return t?__n(`:fields was not reviewed because it is hidden. Show it and review again.|:fields were not reviewed because they are hidden. Show them and review again.`,e.length,{fields:r}):__n(`:fields was skipped because it is hidden. Show it and translate again.|:fields were skipped because they are hidden. Show them and translate again.`,e.length,{fields:r})}function Oa(e,t,n){let r=xa(e,n);return t?__n(`:fields was not reviewed because it was edited by hand. Overwrite manual edits in the options reviews it too.|:fields were not reviewed because they were edited by hand. Overwrite manual edits in the options reviews them too.`,e.length,{fields:r}):__n(`:fields was skipped because it was edited by hand. Overwrite manual edits in the options replaces it.|:fields were skipped because they were edited by hand. Overwrite manual edits in the options replaces them.`,e.length,{fields:r})}var ka={class:`space-y-6`},Aa={class:`space-y-2 text-sm`},ja={class:`text-xs font-medium text-gray-500 dark:text-gray-400`},Ma={class:`whitespace-pre-wrap`,"data-tolk-change-before":``},Na={class:`text-xs font-medium text-gray-500 dark:text-gray-400`},Pa={class:`whitespace-pre-wrap`,"data-tolk-change-after":``},Fa={class:`text-xs font-medium text-gray-500 dark:text-gray-400`},Ia={class:`whitespace-pre-wrap`,"data-tolk-change-reason":``},La={class:`flex items-center justify-end gap-3 pt-3 pb-1`},Ra={__name:`ChangesModal`,props:{modal:{type:Object,required:!0},corrections:{type:Array,default:()=>[]},reviewer:{type:String,default:null}},setup(e){let t=e,n=O(()=>t.corrections.map(e=>({...e,key:`${e.handle}:${e.id}`,diff:Xi(e.before,e.after)})));function r(e,t){return e.kind===`placeholder`?[`font-mono text-xs text-gray-500 dark:text-gray-400`,e.changed&&`rounded-sm bg-amber-100 dark:bg-amber-900/40!`]:e.changed?t===`before`?`rounded-sm bg-red-100 text-red-900 line-through dark:bg-red-900/40! dark:text-red-100`:`rounded-sm bg-green-100 text-green-900 underline decoration-green-700/60 dark:bg-green-900/40! dark:text-green-100 dark:decoration-green-300/60`:null}return(t,i)=>(F(),k(z(Wr),{open:``,title:t.__(`Changes by the reviewer`),icon:`dictionary-language-book`,"data-tolk-changes":``,onDismissed:i[1]||=t=>e.modal.dismissed(),"onUpdate:open":i[2]||=t=>e.modal.closed(t)},{footer:B(()=>[M(`div`,La,[P(z(V),{variant:`primary`,text:t.__(`Close`),"data-tolk-changes-action":`close`,onClick:i[0]||=t=>e.modal.hide()},null,8,[`text`])])]),default:B(()=>[M(`div`,ka,[e.reviewer?(F(),k(z(U),{key:0},{default:B(()=>[N(R(t.__(`Corrected by :model. The corrections are in the form; nothing is saved until you press Save.`,{model:z(ba)(e.reviewer)})),1)]),_:1})):A(``,!0),(F(!0),j(m,null,L(n.value,e=>(F(),j(`div`,{key:e.key,class:`space-y-2`,"data-tolk-change":``},[P(z(W),{"data-tolk-change-label":``},{default:B(()=>[N(R(e.label),1)]),_:2},1024),M(`dl`,Aa,[M(`div`,null,[M(`dt`,ja,R(t.__(`Before`)),1),M(`dd`,Ma,[(F(!0),j(m,null,L(e.diff.before,(e,t)=>(F(),k(Pt(e.changed?`del`:`span`),{key:t,class:it(r(e,`before`)),"data-tolk-removed":e.changed&&e.kind!==`space`?``:null},{default:B(()=>[N(R(e.text),1)]),_:2},1032,[`class`,`data-tolk-removed`]))),128))])]),M(`div`,null,[M(`dt`,Na,R(t.__(`After`)),1),M(`dd`,Pa,[(F(!0),j(m,null,L(e.diff.after,(e,t)=>(F(),k(Pt(e.changed?`ins`:`span`),{key:t,class:it(r(e,`after`)),"data-tolk-added":e.changed&&e.kind!==`space`?``:null},{default:B(()=>[N(R(e.text),1)]),_:2},1032,[`class`,`data-tolk-added`]))),128))])]),M(`div`,null,[M(`dt`,Fa,R(t.__(`Reason`)),1),M(`dd`,Ia,R(e.reason),1)])])]))),128))])]),_:1},8,[`title`]))}},za=[`aria-label`,`aria-valuemax`,`aria-valuenow`],Ba={__name:`ProgressBar`,props:{value:{type:Number,default:0},max:{type:Number,default:0},label:{type:String,required:!0}},setup(e){let t=e,n=O(()=>t.max>0?Math.min(100,Math.round(t.value/t.max*100)):0);return(t,r)=>(F(),j(`div`,{role:`progressbar`,"aria-label":e.label,"aria-valuemin":`0`,"aria-valuemax":e.max,"aria-valuenow":e.value,class:`h-1.5 w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700`,"data-tolk-progress":``},[M(`div`,{class:`h-full rounded-full bg-blue-600 transition-[width] duration-300 dark:bg-blue-400!`,style:ot({width:`${n.value}%`})},null,4)],8,za))}},X=`base`;function Va(){let e=Bt(new Map),t=!1;function n(e=Statamic.$events){t||(t=!0,e.$on(`publish-container-created`,r),e.$on(`publish-container-destroyed`,i))}function r(t){let n=(e.get(t.name)?.mounted??0)+1;e.set(t.name,{payload:t,context:null,clean:null,mounted:n})}function i({name:t}){let n=e.get(t);n&&(n.mounted>1?e.set(t,{...n,mounted:n.mounted-1}):e.delete(t))}function a(t,n){let r=e.get(t)??{payload:null,context:null,clean:null,mounted:0};e.set(t,{...r,...n})}function o(t,n){a(t,{context:n,clean:e.get(t)?.clean??Z(n.values.value)})}function s(e){let t=c(e);t!==null&&a(e,{clean:Z(t)})}function c(t){let n=e.get(t);return(n?.context??n?.payload)?.values?.value??null}function l(t){let n=e.get(t)?.clean,r=c(t);return!n||r===null?[]:[...new Set([...Object.keys(r),...Object.keys(n)])].filter(e=>!no(r[e],n[e]))}return{listen:n,attachContext:o,refreshClean:s,dirtyHandles:l,context:t=>e.get(t)?.context??null,payload:t=>e.get(t)?.payload??null,base:()=>e.get(`base`)?.context??null,others:()=>[...e.keys()].filter(e=>e!==X)}}var Ha=Va();function Z(e){return Array.isArray(e)?e.map(Z):typeof e!=`object`||!e?e:Object.fromEntries(Object.keys(e).map(t=>[t,Z(e[t])]))}var Ua=new Set([`type`,`id`,`_id`,`marks`]),Wa=new Set([`type`,`attrs`,`content`,`marks`,`text`]),Ga=e=>e.replace(/\r\n?/g,` -`),Ka=e=>typeof e==`boolean`||typeof e==`number`,qa=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function Ja(e){if(typeof e==`string`)return e===``?null:Ga(e);if(Array.isArray(e))return e.length>0&&e.every(Xa)?Za(e):Ya(e);if(typeof e!=`object`||!e)return null;let t=Object.keys(e).filter(e=>!Ua.has(e)).sort().map(t=>[t,Ja(e[t])]).filter(([,e])=>e!==null);return t.length?Object.fromEntries(t):null}function Ya(e){let t=e.map(Ja);for(;t.length&&t[t.length-1]===null;)t.pop();return t.length?t:null}function Xa(e){return typeof e==`object`&&!!e&&typeof e.type==`string`&&Object.keys(e).every(e=>Wa.has(e))}function Za(e){let t=[],n=[],r=e=>{n.length&&(t.push(n.length===1&&n[0].marks.length===0?Ga(n[0].text):n.map(Qa)),n=[]),e!==null&&t.push(e)},i=e=>{let t=typeof e.text==`string`?e.text:``;if(t===``)return;let r=to(Array.isArray(e.marks)?e.marks:[]),i=JSON.stringify(r),a=n[n.length-1];a?.key===i?a.text+=t:n.push({key:i,marks:r,text:t,title:$a(e.marks)})},a=e=>{Xa(e)?e.type===`text`?i(e):(r(Ja(e.attrs)),r($a(e.marks)),(Array.isArray(e.content)?e.content:[]).forEach(a),r(null)):r(Ja(e))};return e.forEach(a),r(null),t.length?t:null}function Qa({marks:e,text:t,title:n}){return e.length===0?Ga(t):n===null?{text:Ga(t)}:{text:Ga(t),title:n}}function $a(e){let t=(Array.isArray(e)?e:[]).find(e=>qa(e)&&e.type===`link`),n=qa(t?.attrs)?t.attrs.title:null;return typeof n==`string`&&n.trim()!==``?Ga(n):null}var eo=e=>e==null||e===``||typeof e==`object`&&Object.keys(e).length===0;function to(e){return Array.isArray(e)?e.map(to):Ka(e)?String(e):qa(e)?Object.fromEntries(Object.keys(e).sort().map(t=>[t,to(e[t])]).filter(([,e])=>!eo(e))):e??null}function no(e,t){return JSON.stringify(Ja(e))===JSON.stringify(Ja(t))}function ro(e,t){return Array.isArray(e)&&Array.isArray(t)?e.every((e,n)=>n>=t.length||ro(e,t[n])):qa(e)&&qa(t)?Object.keys(e).every(n=>Ua.has(n)||!Object.hasOwn(t,n)||ro(e[n],t[n])):!(Ka(e)||Ka(t))||e===t}function io(e,t){return no(e,t)&&ro(e,t)}var ao=2e3,oo=1e3,so=100,co=50,lo=e=>new Promise(t=>setTimeout(t,e)),uo=e=>typeof e==`function`?e:()=>e,fo=(e,t,n)=>()=>e.reference.value===t&&n();async function po(e,t,n){let r=()=>600-(t()-e());for(let e=r();e>0;e=r())await n(e)}function mo(e,t,n){return Object.hasOwn(t,n)?!no(e.values.value[n],t[n]):e.values.value[n]!==void 0}function ho(e,t,n){return n===null&&typeof e.values.value[t]==`string`?``:Z(n)}function go(e,t){return e.hiddenFields?.value?.[t]?.omitValue===!0}function _o(e,t){for(let[n,r]of Object.entries(t))r.pending||r.sync||r.localizedBefore||(go(e,n)?e.localizedFields.value.includes(n)&&(ko(e,n,!1),r.leftOut=!0):r.leftOut&&=(ko(e,n,!0),!1))}function vo(e,t){let n=e.localizedFields.value;return Object.keys(t).filter(e=>t[e].leftOut||n.includes(e))}function yo(e,t){return!!t&&!t.pending&&t.plan!==e.delivered?.plan}function bo(e,t,n={}){let r=e.localizedFields.value;return{reference:e.reference.value,dirty:Statamic.$dirty.has(e.name.value),fields:Object.fromEntries(t.map(t=>[t,{value:Z(e.values.value[t]),meta:Z(e.meta.value[t]),localized:r.includes(t),delivered:n[t]?Z(n[t]):null}]))}}async function xo(e,t,{reference:n,plan:r,lastChangeAt:i=0,planValues:a={},delivered:o,now:s=Date.now,sleep:c=lo,active:l=()=>!0}){let u=Object.keys(t??{}),d={stale:!1,applied:[],skipped:{},repeated:[]},f=()=>(d.stale=!0,d.applied=[],d.skipped=Object.fromEntries(u.map(e=>[e,`stale`])),d),p=fo(e,n,l);if(!p()||(await po(uo(i),s,c),!p()))return f();let m=[],h={};for(let n of u){let i=t[n];if(o[n]?.plan===r){d.repeated.push(n);continue}if(mo(e,a,n)){d.skipped[n]=`edited`;continue}if(!i.sync&&go(e,n)){d.skipped[n]=`hidden`;continue}o[n]={plan:r,value:void 0,pending:!0,incomplete:!!i.incomplete,sync:!!i.sync,localizedBefore:o[n]?.localizedBefore??e.localizedFields.value.includes(n)},i.meta!==void 0&&e.setFieldMeta(n,Z(i.meta)),h[n]=ho(e,n,i.value),e.setFieldValue(n,Z(h[n])),i.sync?(ko(e,n,!1),Statamic.$dirty.add(e.name.value),m.push(n)):(e.desyncField(n),e.localizedFields.value.includes(n)||(ko(e,n,!0),Statamic.$dirty.add(e.name.value))),d.applied.push(n)}if(!d.applied.length)return d;if(await c(300),!p())return d.applied.forEach(e=>delete o[e]),f();m.filter(t=>io(e.values.value[t],h[t])).forEach(t=>ko(e,t,!1));for(let t of d.applied){let n=e.values.value[t];o[t]={...o[t],value:no(n,h[t])?Z(n):h[t],pending:!1}}return d}async function So(e,t,n,{registry:r=Ha,sleep:i=lo}={}){let a={restored:[],kept:[]};if(!t||e.reference.value!==t.reference)return a;for(let[r,i]of Object.entries(t.fields)){let t=n[r];if(yo(i,t)){if(!no(e.values.value[r],t.value)){a.kept.push(r);continue}a.restored.push(r)}}if(!a.restored.length)return a;e.withoutDirtying(()=>{for(let r of a.restored){let i=t.fields[r];e.setFieldMeta(r,Z(i.meta)),e.setFieldValue(r,ho(e,r,i.value)),ko(e,r,i.localized),i.delivered?n[r]=Z(i.delivered):delete n[r]}});let o=()=>{if(e.reference.value!==t.reference)return;let n=a.restored.filter(n=>!io(e.values.value[n],t.fields[n].value));a.restored.filter(e=>t.fields[e].localized||!n.includes(e)).forEach(n=>ko(e,n,t.fields[n].localized)),!t.dirty&&!n.length&&r.dirtyHandles(e.name.value).length===0&&Statamic.$dirty.remove(e.name.value)};return o(),await i(300),o(),a}function Co(e,t,n){if(!t||e.reference.value!==t.reference)return[];let r=n.filter(e=>Object.hasOwn(t.fields,e));return r.length&&e.withoutDirtying(()=>{for(let n of r){let r=t.fields[n];e.setFieldMeta(n,Z(r.meta)),e.setFieldValue(n,ho(e,n,r.value)),ko(e,n,r.localized)}}),r}async function wo(e,t,{reference:n,lastChangeAt:r=0,now:i=Date.now,sleep:a=lo,active:o=()=>!0}={}){let s=uo(r),c=fo(e,n,o),l=()=>s()+ao-i();if(!c())return{stale:!0,kept:!1,reset:!1};if(!Eo(e,t))return{stale:!1,kept:!1,reset:!1};for(await po(s,i,a);c()&&!Do(e)&&l()>0;)await a(Math.min(so,l()));let u=Do(e);return!c()||!await Oo(e,t,{sleep:a,current:c})?{stale:!0,kept:!1,reset:u}:{stale:!1,kept:!0,reset:u}}async function To(e,t,{reference:n,sleep:r=lo,active:i=()=>!0}={}){let a=fo(e,n,i);return!Eo(e,t)||(await r(oo),!a()||e.values.value.slug===t&&!Do(e))?!1:Oo(e,t,{sleep:r,current:a})}function Eo(e,t){return typeof t==`string`&&t!==``&&Object.hasOwn(e.values.value??{},`slug`)}function Do(e){return e.meta.value?.slug?.auto===!0}async function Oo(e,t,{sleep:n,current:r}){return Do(e)&&e.values.value.slug===t&&(e.setFieldValue(`slug`,``),await n(co),!r())?!1:(e.values.value.slug!==t&&e.setFieldValue(`slug`,t),!0)}function ko(e,t,n){let r=e.localizedFields.value,i=r.indexOf(t);n&&i===-1?r.push(t):!n&&i!==-1&&r.splice(i,1)}var Ao=2e3,jo=5;function Mo(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=()=>{clearTimeout(i),t?.removeEventListener(`abort`,r),n()},i=setTimeout(r,e);t?.addEventListener(`abort`,r,{once:!0})})}function No(e){let t=e?.status??0;return t===429||t===503?`wait`:t===409&&e.code===`busy`?`busy`:t===409&&e.code===`source_changed`||t===410||t===502?`stop`:`fail`}function Po(e,t=``){return{status:e?.status??0,code:e?.code??null,message:e?.message||t}}var Fo=e=>Object.entries(Y(e)),Io=({id:e,fields:t})=>({id:e,fields:t});async function Lo({api:e=J,plan:t,concurrency:n=1,onFields:r=()=>{},onProgress:i=()=>{},signal:a=null,finishing:o=()=>!0,sleep:s=Mo,maxWaits:c=5,busyMs:l=Ao,maxBusyWaits:u=60}){let d=Math.max(1,Math.floor(Number(n))||1),f=[...t.units??[]],p=new Set(f.map(e=>e.id)),m={total:f.length,done:0,waiting:0},h=new Map,g=[],_=[],v=[],y={},b=new Set,x=new Set,S=new Set,C=new Set,w={},ee=null,T=()=>ee!==null||!!a?.aborted,E=()=>i({...m});function te(){if(!T())return f.shift();let e=ee===null&&o()?f.findIndex(e=>!p.has(e.id)):-1;return e===-1?null:f.splice(e,1)[0]}function D(e){let t=Fo(e).map(([e,t])=>(h.set(e,t),e));t.length&&g.push(Promise.resolve().then(()=>r(e)).then(e=>({handles:t,result:e}),e=>({handles:t,error:e})))}function ne(e,t){D(t?.fields);for(let[e,n]of Fo(t?.failed))y[e]=n;(Array.isArray(t?.warnings)?t.warnings:[]).forEach(e=>b.add(e)),(Array.isArray(t?.unchanged)?t.unchanged:[]).forEach(e=>x.add(e)),t?.reviewed===!0&&S.add(e.id),t?.review_skipped===!0&&C.add(e.id);for(let[e,n]of Fo(t?.usage))w[e]=zo(w[e]??{},n);let n=Array.isArray(t?.spawned)?t.spawned:[];f.push(...n),m.total+=n.length}async function re(n){let r=0,i=0;for(;;)try{return ne(n,await e.post(`editor/unit`,{plan:t.plan,unit:n.id}))}catch(e){let t=No(e),o=t===`wait`&&r0?Number(e.data.retry_after):jo;if(m.waiting++,E(),await s(t===`wait`?d*1e3:l,a),m.waiting--,E(),T()){v.push(Io(n));return}}}return D(t.ready),E(),await new Promise(e=>{let t=0,n=()=>{let r;for(;t{t--,m.done++,E(),n()});t===0&&e()};n()}),v.push(...f.map(Io)),Ro(await Promise.all(g),{received:h,failed:y,failedUnits:_,cancelledUnits:v,warnings:[...b],unchanged:x,reviewedUnits:[...S],reviewSkipped:[...C],usage:w,stopped:ee,aborted:!!a?.aborted,progress:m})}function Ro(e,{received:t,failed:n,failedUnits:r,cancelledUnits:i,warnings:a,unchanged:o,reviewedUnits:s,reviewSkipped:c,usage:l,stopped:u,aborted:d,progress:f}){let p=[],m={},h=!1;for(let{handles:t,result:r,error:i}of e){if(i){t.forEach(e=>n[e]??=`not_filled`);continue}h||=r?.stale===!0;for(let e of r?.applied??(r?[]:t))p.includes(e)||p.push(e);Object.assign(m,r?.skipped??{})}for(let e of r)for(let t of e.fields??[])!p.includes(t)&&!(t in m)&&(n[t]??=e.error?.code??`failed`);return p.forEach(e=>delete n[e]),{delivered:p,incomplete:p.filter(e=>t.get(e)?.incomplete===!0),skipped:m,failed:n,failedUnits:r,cancelledUnits:i,warnings:a,corrections:p.flatMap(e=>{let n=t.get(e)?.corrections;return Array.isArray(n)?n.map(t=>({handle:e,...t})):[]}),unchanged:[...o].filter(e=>!p.includes(e)),reviewedUnits:s,reviewSkipped:c,usage:l,models:Object.keys(l),stopped:u,aborted:d,stale:h,units:{total:f.total,done:f.done}}}function zo(e,t){let n={...e};for(let[e,r]of Fo(t))typeof r==`number`&&(n[e]=(n[e]??0)+r);return n}var Bo=t({BACKOFF_MS:()=>Ho,FINAL_STATUSES:()=>Vo,IDLE_MS:()=>Wo,MAX_BACKOFF_MS:()=>Uo,MAX_RETRIES:()=>5,POLL_MS:()=>Go,backoff:()=>ts,estimateLoop:()=>cs,isFinal:()=>Xo,latest:()=>Zo,nonce:()=>qo,pollState:()=>ss,retryable:()=>es,startApplyLoop:()=>as,startLanes:()=>is}),Vo=[`completed`,`completed_with_errors`,`cancelled`,`aborted`],Ho=1e3,Uo=3e4,Wo=1e3,Go=2e3,Ko=null;function qo(){return Ko??=Array.from(crypto.getRandomValues(new Uint8Array(12)),e=>e.toString(16).padStart(2,`0`)).join(``),Ko}var Jo=new WeakMap;function Yo(e,t,n){let r=Jo.get(e)??new Map,i=r.get(t),a=i?i.then(n):new Promise(e=>e(n())),o=a.then(()=>{},()=>{});return Jo.set(e,r),r.set(t,o),o.then(()=>r.get(t)===o&&r.delete(t)),a}function Xo(e){return Vo.includes(e?.run?.status)}function Zo(e){let t=null;return n=>{t!==null&&Qo(n,t)||(t=n,e(n))}}function Qo(e,t){let n=$o(e),r=$o(t);return n=500}function ts(e,t=Ho){return Math.min(t*2**Math.max(0,e-1),Uo)}function ns(e,t){return e==null?t:Math.max(0,Number(e)||0)*1e3}async function rs(e,{retries:t,backoffMs:n,sleep:r,signal:i}){for(let a=1;;a++)try{return{response:await e()}}catch(e){if(i?.aborted)return{};if(a>t||!es(e))return{error:Po(e)};if(await r(ts(a,n),i),i?.aborted)return{}}}function is({api:e=J,urls:t,lanes:n=1,nonce:r=qo(),onState:i=()=>{},onFailure:a=()=>{},signal:o=null,query:s=()=>({}),sleep:c=Mo,retries:l=5,backoffMs:u=Ho,idleMs:d=Wo}){let f=Math.max(1,Math.floor(Number(n))||1),p=new Map,m=new Set,h=[],g=[],_=()=>!!o?.aborted,v=e=>m.forEach(t=>t(e)),y=()=>[...p.values()].filter(e=>e===`running`).length;function b(e,t){let n={lane:e,error:t};return g.push(n),a(n),`failed`}let x=n=>Yo(e,`${t.tick} ${r} ${n}`,()=>_()?null:e.post(t.tick,{...s(),nonce:r,lane:n}));async function S(e){for(;!_();){let{response:t,error:n}=await rs(()=>x(e),{retries:l,backoffMs:u,sleep:c,signal:o});if(_())break;if(n)return b(e,n);if(i(t),v({lane:e,state:t}),Xo(t)||t?.report?.remains!==!0)return`finished`;await c(ns(t.report.wait,d),o)}return`aborted`}function C(e,t){p.set(e,t),v({lane:e,ended:t}),y()===0&&h.splice(0).forEach(e=>e())}function w(e){p.set(e,`running`),S(e).catch(t=>b(e,Po(t))).then(t=>C(e,t))}for(let e=1;e<=f;e++)w(e);return{get active(){return y()},failed:g,restart(){if(_())return 0;let e=[...p].filter(([,e])=>e===`finished`).map(([e])=>e);return e.forEach(w),e.length},idle(){return y()===0?Promise.resolve():new Promise(e=>h.push(e))},subscribe(e){return m.add(e),()=>m.delete(e)}}}async function as({api:e=J,urls:t,lanes:n=null,onState:r=()=>{},onFailure:i=()=>{},signal:a=null,query:o=()=>({}),sleep:s=Mo,retries:c=5,backoffMs:l=Ho,idleMs:u=Wo}){let d=()=>!!a?.aborted,f=null,p=!1,m=null,h=n?.subscribe(e=>{(e.ended||Number(Y(e.state?.counts).translated)>0)&&(p=!0,m?.())})??(()=>{}),g=()=>new Promise(e=>{let t=()=>{m=null,a?.removeEventListener(`abort`,t),e()};m=t,a?.addEventListener(`abort`,t,{once:!0})});try{for(;!d();){p=!1;let{response:m,error:h}=await rs(()=>e.post(t.apply,o()),{retries:c,backoffMs:l,sleep:s,signal:a});if(d())break;if(h)return i({error:h}),{state:f,error:h};if(f=m,r(m),Xo(m))break;if(n&&os(m)&&n.restart(),m?.report?.remains===!0)await s(ns(m.report.wait,u),a);else if(n?.active)p||await g();else break}}finally{h()}return{state:f,error:null}}function os(e){let t=e?.run;return t?.status===`running`&&t?.driver===`browser`&&Number(Y(e.counts).pending)>0}async function ss({api:e=J,url:t,interval:n=Go,onState:r=()=>{},onFailure:i=()=>{},signal:a=null,query:o=()=>({}),sleep:s=Mo,retries:c=5,backoffMs:l=Ho}){let u=null;for(;!a?.aborted;){let{response:d,error:f}=await rs(()=>e.get(t,o()),{retries:c,backoffMs:l,sleep:s,signal:a});if(a?.aborted)break;if(f)return i({error:f}),{state:u,error:f};if(u=d,r(d),Xo(d))break;await s(n,a)}return{state:u,error:null}}async function cs({api:e=J,url:t,estimate:n=null,onEstimate:r=()=>{},onFailure:i=()=>{},signal:a=null,sleep:o=Mo,retries:s=5,backoffMs:c=Ho}){let l=n,u=n===null?0:n.next===null?null:Math.max(0,Math.floor(Number(n.next))||0);for(;u!==null&&!a?.aborted;){let{response:n,error:d}=await rs(()=>e.post(t,{from:u}),{retries:s,backoffMs:c,sleep:o,signal:a});if(a?.aborted)break;if(d)return i({error:d}),{estimate:l,error:d};l=n,r(n),u=Number.isInteger(n?.next)?n.next:null}return{estimate:l,error:null}}var ls=[`pending`,`translating`,`translated`,`applying`,`done`,`skipped`,`failed`],us=[`pending`,`translating`,`translated`,`applying`],ds={pending:`default`,running:`blue`,completed:`green`,completed_with_errors:`orange`,cancelled:`amber`,aborted:`red`},fs={pending:`default`,translating:`blue`,translated:`sky`,applying:`blue`,done:`green`,skipped:`default`,failed:`red`};function ps(e){return{pending:__(`Not started`),running:__(`Running`),completed:__(`Completed`),completed_with_errors:__(`Completed with errors`),cancelled:__(`Cancelled`),aborted:__(`Aborted`)}[e]??e}function ms(e){return ds[e]??`default`}function hs(e){return{pending:__(`Waiting`),translating:__(`Translating`),translated:__(`Translated, not saved yet`),applying:__(`Saving`),done:__(`Done`),skipped:__(`Skipped`),failed:__(`Failed`)}[e]??e}function gs(e){return fs[e]??`default`}function _s(e){return{entry:__(`Entries`),term:__(`Terms`),globals:__(`Global sets`),nav:__(`Navigation`)}[e]??e}function vs(e=[]){let t=Object.fromEntries((Array.isArray(e)?e:[]).map(e=>[e.handle,e.name]));return e=>t[e]??e}function Q(e,t=void 0){return new Intl.NumberFormat(t).format(Number(e)||0)}function ys(e,t=void 0){let n=Number(e)||0,r=n>0&&n<.01?{maximumSignificantDigits:2}:{minimumFractionDigits:2,maximumFractionDigits:2};return new Intl.NumberFormat(t,{style:`currency`,currency:`USD`,...r}).format(n)}function bs(e,t=void 0){let n=Date.parse(e??``);return Number.isNaN(n)?``:new Intl.DateTimeFormat(t,{dateStyle:`medium`,timeStyle:`short`}).format(n)}function xs(e){let t={...Object.fromEntries(ls.map(e=>[e,0])),...Y(e?.counts)},n=ls.reduce((e,n)=>e+(Number(t[n])||0),0),r=us.reduce((e,n)=>e+(Number(t[n])||0),0);return{counts:t,total:n,finished:n-r,unfinished:r}}function Ss(e){let t=e?.run??{},{counts:n,unfinished:r}=xs(e),i=Xo(e),a=t.status===`running`&&!!e?.stalled;return{start:t.status===`pending`,cancel:t.status===`running`,resume:a||[`cancelled`,`aborted`].includes(t.status)&&r>0,retry:i&&n.failed>0,takeOver:a&&t.driver===`queue`}}function Cs(e,t){let n=[t];return e.skipped>0&&n.push(__n(`:count skipped|:count skipped`,e.skipped)),e.failed>0&&n.push(__n(`:count failed|:count failed`,e.failed)),n.join(`, `)}function ws(e){let t=e?.run??{};if(!Xo(e))return null;let{counts:n}=xs(e),r=Cs(n,__n(`:count done|:count done`,n.done));return{status:t.status,variant:{completed:`success`,completed_with_errors:`warning`,cancelled:`warning`,aborted:`error`}[t.status],text:{completed:__(`The run is complete: :items.`,{items:r}),completed_with_errors:__(`The run is complete, with errors: :items.`,{items:r}),cancelled:__(`The run was cancelled: :items.`,{items:r}),aborted:__(`The run was stopped: :items.`,{items:r})}[t.status],error:t.error??null}}function Ts(e,t=e=>e){return(Array.isArray(e)?e:[]).map(({type:e,site:n,counts:r})=>{let i=xs({counts:r});return{key:`${e}|${n}`,type:_s(e),site:t(n),total:i.total,skipped:i.counts.skipped,done:i.counts.done,failed:i.counts.failed}})}function Es(e){let t={excluded_collection:e=>__n(`:count target is in a collection excluded in the settings.|:count targets are in collections excluded in the settings.`,e),site_not_in_collection:e=>__n(`:count target is in a site its collection does not have.|:count targets are in sites their collection does not have.`,e),unauthorized:e=>__n(`:count target is one you may not edit.|:count targets are ones you may not edit.`,e),from_site:e=>__n(`:count target is a navigation in the site it is translated from.|:count targets are navigations in the site they are translated from.`,e)};return Object.entries(Y(e?.skipped)).filter(([,e])=>Number(e)>0).map(([e,n])=>({reason:e,text:t[e]?.(Number(n))??__(`:count targets left out: :reason.`,{count:n,reason:e.replaceAll(`_`,` `)})}))}function Ds(e){let t=(Array.isArray(e?.out_of_scope)?e.out_of_scope:[]).filter(e=>e.reason===`not_localizable`);if(t.length===0)return null;let n=new Set(t.map(e=>e.container));return ga(t.map(e=>n.size>1?`${e.label||e.handle} (${e.container})`:e.label||e.handle).join(`, `),t.length)}function Os(e,t=e=>e){let n=t=>Array.isArray(e?.[t])?e[t]:[],r=n(`collections`),i=n(`taxonomies`),a=n(`globals`),o=n(`navs`),s=n(`entry_ids`).length,c=n(`term_ids`).length,l=[],u=(e,t)=>{e.includes(`*`)?l.push(t):e.length>0&&l.push(e.join(`, `))};return u(r,__(`All collections`)),s>0&&l.push(__n(`:count selected entry|:count selected entries`,s)),u(i,__(`All taxonomies`)),c>0&&l.push(__n(`:count selected term|:count selected terms`,c)),u(a,__(`All global sets`)),u(o,__(`All navigation`)),{what:l.join(`, `)||__(`Nothing selected`),sites:n(`sites`).map(t).join(`, `),automatic:e?.automatic===!0}}function ks(e,t={}){let n=e=>e?Y(t)[e]??e:null,r=[{key:`mode`,label:__(`Translate`),value:{missing:__(`Only what is not translated yet`),update:__(`Also update outdated translations`),all:__(`Retranslate everything`),review:__(`Review existing translations`)}[e?.mode]??e?.mode??``},{key:`translator`,label:__(`Model`),value:n(e?.translator)??__(`Default`)},{key:`review`,label:__(`Review`),value:e?.review?n(e?.reviewer)??__(`On`):__(`Off`)},{key:`overwrite_manual`,label:__(`Manual edits`),value:e?.overwrite_manual?__(`Overwritten`):__(`Kept`)},{key:`new_status`,label:__(`New localizations`),value:e?.new_status===`mirror`?__(`Same as origin`):__(`Drafts`)}];return e?.publish_changes&&r.push({key:`publish_changes`,label:__(`Revisions`),value:__(`Changes are published`)}),r}function As(e,t=0){if(!e)return null;let n=Number.isInteger(e.next)?e.next:null,r={done:Math.min(n??0,t),total:t};return{finished:n===null,progress:n===null?null:__(`:done of :total items`,r),partial:n===null?null:__(`Only :done of :total items were estimated before the run started.`,r),segments:Number(e.segments)||0,chars:Number(e.chars)||0,inputTokens:Number(e.input_tokens)||0,outputTokens:Number(e.output_tokens)||0,cost:e.cost===null||e.cost===void 0?null:Number(e.cost)}}function js(e,t={}){let n=Object.entries(Y(e?.usage)).map(([e,n])=>({model:Y(t)[e]??e,input:Number(n?.input)||0,output:Number(n?.output)||0,calls:Number(n?.calls)||0}));return{rows:n,input:n.reduce((e,t)=>e+t.input,0),output:n.reduce((e,t)=>e+t.output,0),calls:n.reduce((e,t)=>e+t.calls,0),cost:e?.cost===null||e?.cost===void 0?null:Number(e.cost)}}var Ms={current:()=>__(`up to date`),outdated:()=>__(`outdated, not updated in this mode`),untranslated:()=>__(`not translated yet`),manual:()=>__(`edited by hand, kept`),target_changed:()=>__(`edited meanwhile, kept`),not_applicable:()=>__(`empty in the source`),not_requested:()=>__(`not requested`),origin_untranslated:()=>__(`not translated in its source yet`),structure_differs:()=>__(`its structure differs from the source`),no_corrections:()=>__(`reviewed, nothing to correct`),review_skipped:()=>__(`could not be reviewed`)},Ns={invalid:()=>__(`the model kept breaking its formatting`),missing:()=>__(`the model left it out`),too_long:()=>__(`the model's answer was cut off`),refused:()=>__(`the model refused it`),request_rejected:()=>__(`the provider rejected the request`)},Ps={nothing_to_do:()=>__(`Nothing to do.`),dependency_failed:()=>__(`An item it depends on failed.`),unauthorized:()=>__(`You may not edit it.`),target_changed:()=>__(`Edited by someone while it was being translated.`),no_corrections:()=>__(`Reviewed, nothing to correct.`),source_changed:()=>__(`Its source changed, so it is translated again.`)};function Fs(e,t=e=>e){let n=Object.entries(Y(e?.fields)),r=e=>n.filter(([,t])=>t===e).map(([e])=>e),i=[`applied`,`incomplete`,`partly_reviewed`],a=n.filter(([,e])=>i.includes(e)).length,o=([,e])=>Object.hasOwn(Ns,e),s=n.filter(o).map(([e,t])=>({handle:e,reason:Ns[t]()})),c=n.filter(e=>!i.includes(e[1])&&!o(e)).map(([e,t])=>({handle:e,reason:Ms[t]?.()??String(t).replaceAll(`_`,` `)})),l=e?.reason?Ps[e.reason]?.()??null:null,u=Object.entries(Y(e?.corrections)).flatMap(([e,t])=>(Array.isArray(t)?t:[]).map(t=>({...t,handle:e,label:e})));return{index:e?.index,title:e?.title||e?.source_id||``,site:t(e?.target_site),status:e?.status,statusLabel:hs(e?.status),statusColor:gs(e?.status),editUrl:e?.edit_url??null,applied:a>0?__n(`:count field saved|:count fields saved`,a):null,incomplete:r(`incomplete`),failed:s,notReviewed:r(`partly_reviewed`),kept:c,reason:l,error:e?.error??null,rootPage:e?.root_page?.edit_url?{title:e.root_page.title||``,url:e.root_page.edit_url}:null,warnings:Array.isArray(e?.warnings)?e.warnings:[],corrected:u.length>0?__n(`:count correction|:count corrections`,u.length):null,corrections:u}}function Is(e,t){let n=t?.page;return Number.isInteger(n)&&n{},onEstimate:i=()=>{},onFailures:a=()=>{},query:o=()=>({}),api:s=J,ticker:c=Bo}){let l=null,u=()=>{},d=null,f=null,p=[],m=null,h=!1,g=null;function _(e){p=[...p,e],a(p)}function v(){return!!(d&&d.active>0||f)}function y(){let e=m?.run??{};return e.status===`running`&&e.driver===`browser`&&v()}function b(){let e=n!==null&&y();e!==h&&(h=e,e?Statamic.$dirty.add(n):Statamic.$dirty.remove(n))}function x(){l?.abort(),l=null,d=null,f=null,b()}function S(e){x(),u=c.latest(C),w(e,!0)}function C(e){m=e,r(e),b(),Xo(e)?g=null:Rs(e)!==g&&(x(),w(e,!1))}function w(n,r){let i=new AbortController;l=i,p=[],a(p),g=Rs(n),r&&u(n);let m=n?.run??{},h={onState:u,onFailure:_,signal:i.signal,query:o};if(g===`estimate`)ee(m.estimate??null,i.signal);else if(g===`drive`){d=c.startLanes({api:s,urls:e,lanes:t,...h}),d.subscribe(e=>e.ended&&b());let n=c.startApplyLoop({api:s,urls:e,lanes:d,...h}).catch(e=>_({error:Po(e)})).finally(()=>{f===n&&(f=null,b())});f=n,b()}else g===`poll`&&c.pollState({api:s,url:e.state,...h}).catch(e=>_({error:Po(e)}))}async function ee(t,n){try{let{error:r}=await c.estimateLoop({api:s,url:e.estimate,estimate:t,onEstimate:i,onFailure:_,signal:n});!r&&!n.aborted&&await T()}catch(e){n.aborted||_({error:Po(e)})}}async function T(){let t=l?.signal,n=await s.get(e.state,o());return t&&!t.aborted&&u(n),n}async function E(e,t=!0){let n=await s.post(e,o());return t?S(n):u(n),n}return{follow:S,refresh:T,stop:x,start:()=>E(e.start),cancel:()=>E(e.cancel,!1),resume:()=>E(e.resume),retry:()=>E(e.retry),takeOver:()=>E(e.take_over),get active(){return v()},get driving(){return y()},get failures(){return p}}}function Rs(e){let t=e?.run??{};return t.status===`pending`?`estimate`:t.status===`running`?t.driver===`browser`?`drive`:`poll`:null}var zs=[`idle`,`offer`,`planning`,`working`,`done`,`error`];function Bs(){return{reference:null,status:null,phase:`idle`,progress:{total:0,done:0,waiting:0,cancelling:!1},summary:null,snapshot:null,delivered:{},lastChangeAt:0,planReference:null,error:null,request:null,notSaved:[],created:!1,slugKept:!1,push:null}}var Vs=null;function Hs(){return Vs??=Statamic.$pinia.defineStore(`tolk-editor`,{state:()=>({containers:{}}),getters:{phaseOf:e=>t=>e.containers[t]?.phase??`idle`},actions:{container(e){return this.containers[e]??=Bs(),this.containers[e]},switched(e,t,n=Date.now()){this.containers[e]={...Bs(),reference:t,lastChangeAt:n}},saved(e,t=Date.now()){let n=this.container(e),r={...n.delivered};return n.lastChangeAt=Math.max(n.lastChangeAt,t),Object.keys(r).forEach(e=>delete n.delivered[e]),r},setPhase(e,t,n=null){if(!zs.includes(t))throw Error(`Unknown editor phase [${t}].`);let r=this.container(e);r.phase=t,r.error=t===`error`?n:null},clearResult(e){Object.assign(this.container(e),{summary:null,snapshot:null,request:null}),this.setPhase(e,`idle`)},forget(e){delete this.containers[e]}}}),Vs()}var Us=[`starting`,`running`,`expecting`],Ws=[1e3,2e3,4e3,8e3,15e3];function Gs(e){let t=e?.origin?.auto_update_sites??[];return(e?.origin?.localizations??[]).filter(e=>t.includes(e.site)).filter(e=>!e.exists||[`untranslated`,`outdated`].includes(e.status)).map(e=>e.site)}function Ks(e){return(e?.localizations??[]).filter(e=>e.translate).map(({site:e,name:t,exists:n,summary:r})=>({site:e,name:t,missing:!n,summary:r}))}function qs(e){return(e?.localizations??[]).filter(e=>e.update).map(e=>e.site)}function Js(e,{dirty:t=!1,term:n=!1}={}){return e?.translatesPublished&&(t||e.unpublishedChanges)?__(`Publish first: the translations are made from the published entry.`):t?n?__(`Save first: the translations are made from the saved term.`):__(`Save first: the translations are made from the saved entry.`):null}function Ys(e,{term:t=!1}={}){return t?__(`The saved term is translated and saved in each language you choose. This form stays as it is.`):e?.translatesPublished?__(`The published entry is translated and saved in each language you choose. This form stays as it is.`):__(`The saved entry is translated and saved in each language you choose. This form stays as it is.`)}function Xs(e){return(e?.origin?.localizations??[]).filter(e=>!e.exists).map(e=>e.site)}function Zs(e,t){if(!e)return null;let n=new Map((t?.origin?.localizations??[]).map(e=>[e.site,e])),r=e=>n.get(e)?.name??e,i=e.state,a=(e.sites?.length?e.sites:i?.run?.scope?.sites??[]).map(r),o=xs(i),s=i?Xo(i):!1,c=s?ws(i):null,l=s?(e.missing??[]).filter(e=>n.get(e)?.exists):[],u=i?.run?.driver??e.driver,d=e.phase===`running`&&i?.run?.status===`running`&&!!i.stalled,f=d&&u===`queue`;return{sites:a.join(`, `),automatic:!!e.automatic,progress:o,keepOpen:e.phase===`running`&&u===`browser`,stalled:d?Qs(f):null,takeOver:f,failure:e.failures?.length?e.failures.at(-1).error?.message??null:null,error:e.phase===`error`?e.error?.message??null:null,result:c&&{...c,text:$s(c.status,o.counts),items:(i.items??[]).map(e=>{let t=Fs(e,r);return{...t,handle:e.target_site,editUrl:n.get(e.target_site)?.edit_url??t.editUrl}})},reload:l.length>0}}function Qs(e){return e?__(`No queue worker has worked on these translations for a while. Start a queue worker, or translate them in this page instead.`):__(`The process that updates these translations has not worked on them for a while and may have stopped. Cancel it, then start the translations again.`)}function $s(e,t){let n=Cs(t,__n(`:count saved|:count saved`,t.done));return{completed:__(`The translations are done: :items.`,{items:n}),completed_with_errors:__(`The translations are done, with errors: :items.`,{items:n}),cancelled:__(`The translations were cancelled: :items.`,{items:n}),aborted:__(`The translations were stopped: :items.`,{items:n})}[e]}function ec({store:e=Hs,api:t=J,createFollower:n=Ls,wait:r=e=>new Promise(t=>setTimeout(t,e)),delays:i=Ws}={}){let a=new Map,o=new Set,s=0;function c(t){return Object.values(e().containers).filter(e=>e.push?.run===t)}function l(e,t){for(let n of c(e))n.push.state=t,Xo(t)&&n.push.phase===`running`&&(n.push.phase=`finished`,n.push.cancelling=!1,d(n.reference));Xo(t)&&a.delete(e)}function u(e,t){for(let n of c(e))n.push.failures=t}async function d(n){try{let r=await t.get(`editor/status`,{reference:n});for(let t of Object.values(e().containers))t.reference===n&&(t.status=r)}catch(e){e?.status!==403&&Statamic.$toast.error(__(`The translation status could not be updated: :message`,{message:e?.message??``}))}}function f(e,{run:t=null,driver:n=null,automatic:r=!1,sites:i=null,missing:a=[]}){return{phase:e,run:t,driver:n,automatic:r,sites:i,state:null,failures:[],missing:a,cancelling:!1,takingOver:!1,error:null}}function p(t,n,r,i=null){e().container(t).push=f(`running`,{run:n.run,driver:n.driver,automatic:n.automatic===!0,sites:i,missing:r})}function m(e){return e?.push?.run?a.get(e.push.run)??null:null}function h(e,t){let r=a.get(e.run);r||(r=n({urls:e.urls,lanes:e.lanes,onState:t=>l(e.run,t),onFailures:t=>u(e.run,t)}),a.set(e.run,r)),o.has(e.run)||r.follow(t)}function g(e){return o.add(e),a.get(e)?.stop(),t=>{o.delete(e),a.get(e)?.follow(t)}}async function _(n,{reference:r,sites:i,mode:a,overwriteManual:o=!1,review:s=null,newStatus:c=null}){let l=e().container(n);if(Us.includes(l.push?.phase)||l.reference!==r)return null;let u=Xs(l.status).filter(e=>i.includes(e));l.push=f(`starting`,{sites:i,missing:u});try{let l=await t.post(`editor/push`,{reference:r,sites:i,mode:a,overwrite_manual:o,review:s,new_status:c});return e().containers[n]?.reference===r&&p(n,l,u,i),h(l,l.state),l}catch(t){let i=e().containers[n];return i?.reference===r?t?.code===`run_active`&&t.data?.active_run?(i.push=null,await v(n,{active_run:t.data.active_run,origin:i.status?.origin}),null):(i.push={...i.push,phase:`error`,error:Po(t)},null):null}}async function v(n,r){let i=r?.active_run,a=e().containers[n];if(!i||!a||a.push?.run===i.run)return;let o=a.reference;p(n,i,Xs(r));try{h(i,await t.get(i.urls.state))}catch(t){let r=e().containers[n];r?.reference===o&&r.push?.run===i.run&&(r.push.failures=[{error:Po(t)}])}}async function y(n,a,{published:o=!1}={}){let c=e().containers[n],l=c?.reference;if(a?.active_run){await v(n,a);return}let u=Gs(a),d=o?!!a?.origin?.auto_update:a?.origin?.auto_update===`save`;if(!c||!d||u.length===0||Us.includes(c.push?.phase))return;let p=++s;c.push={...f(`expecting`,{automatic:!0,sites:u}),expecting:p};let m=()=>{let t=e().containers[n];return t?.reference===l&&t.push?.phase===`expecting`&&t.push.expecting===p?t:null};for(let e of i){if(await r(e),!m())return;let i=null;try{i=await t.get(`editor/status`,{reference:l})}catch{}let a=m();if(!a||i===null){a&&(a.push=null);return}if(a.status=i,i.active_run){a.push=null,await v(n,i);return}if(Gs(i).length===0){a.push=f(`updated`,{automatic:!0,sites:u});return}}let h=m();h&&(h.push=null)}async function b(t){let n=e().containers[t],r=m(n);if(r){n.push.failures=[];try{r.follow(await r.refresh())}catch(e){n.push.failures=[{error:Po(e)}]}}}async function x(t){let n=e().containers[t],r=m(n);if(r){n.push.cancelling=!0;try{await r.cancel()}catch(e){n.push.cancelling=!1,Statamic.$toast.error(e.message)}}}async function S(t){let n=e().containers[t],r=m(n),i=n?.push;if(r&&!i.takingOver){i.takingOver=!0;try{await r.takeOver()}catch(e){Statamic.$toast.error(e.message)}finally{i.takingOver=!1}}}function C(t){let n=e().containers[t];n&&!Us.includes(n.push?.phase)&&(n.push=null)}return{start:_,adopt:v,afterSave:y,resume:b,cancel:x,takeOver:S,dismiss:C,lend:g,following:e=>a.has(e)}}var tc=ec(),nc=[`planning`,`working`],rc=[`source_changed`,`plan_expired`,`target_missing`],ic=`edited_in_form`;function ac(e,t=()=>Statamic.$progress){return t()?.names?.().includes(`${e}-entry-publish-form`)??!1}function oc(){return __(`The form is being saved. Try again when the save has finished.`)}function sc(e,t,n){return!!t&&!t.pending&&no(e.values.value[n],t.value)}function cc(e,t,{name:n,registry:r,delivered:i={}}){let a=Y(t?.localization?.fields),o=e.originValues?.value??{},s=new Set(r.dirtyHandles(n));for(let[t,n]of Object.entries(a))n?.status===`untranslated`&&Object.hasOwn(o,t)&&!no(e.values.value[t],o[t])&&s.add(t);return[...s].filter(t=>Object.hasOwn(a,t)&&!sc(e,i[t],t))}function lc(e,t){let n=Y(t?.localization?.fields);return e.localizedFields.value.filter(e=>Object.hasOwn(n,e))}function uc(e,{overwriteManual:t=!1}={}){let n=Object.values(e?.delivered??{}).some(e=>!e.pending&&!e.sync),r=e?.status?.localization?.counts??{};return n||(r.current??0)>0||t&&(r.manual??0)>0}function dc(e){let t=new Set([...e?.delivered??[],...Object.keys(e?.skipped??{}),...e?.unchanged??[]]);return(e?.planned??[]).filter(e=>!t.has(e))}function fc(e){if(e?.phase===`error`)return!0;let t=e?.summary?.failed??{};return e?.phase===`done`&&dc(e.summary).some(e=>Object.hasOwn(t,e))}function pc(e){let t=e?.status?.localization;return e?.created&&!e.slugKept&&!t?.translate_slug?t?.origin_slug??null:null}function mc(e){let t=e?.snapshot?.fields;return t?Object.entries(t).some(([t,n])=>yo(n,e.delivered?.[t])):!1}function hc(e,t){return __n(`:fields was changed after the translation and was kept.|:fields were changed after the translation and were kept.`,e.length,{fields:xa(e,t)})}function gc(e){return Object.entries(Y(e))}function _c(e){return Object.fromEntries(gc(e).filter(([,e])=>e===ic).map(([e])=>[e,`edited`]))}function vc(e){return Object.fromEntries(gc(e).filter(([,e])=>e!==ic))}function yc(e,t){return e.replace===!0&&(e.fields??[]).includes(t)}function bc(e,{reference:t,skip:n}){return{reference:t,mode:e.mode,overwrite_manual:e.overwriteManual,fields:e.fields,skip:n,translator:e.translator,review:e.review,reviewer:e.reviewer}}function xc(e,{reference:t,handles:n,values:r}){return{reference:t,values:Object.fromEntries(n.map(e=>[e,r[e]])),overwrite_manual:e.overwriteManual,reviewer:e.reviewer}}function Sc(e,t){let n=t.snapshot,r=!1;if(!n||n.reference!==e.reference)return e;for(let[i,a]of Object.entries(n.fields))yo(a,t.delivered[i])&&(e.fields[i]=a,r=!0);return r&&(e.dirty=n.dirty),e}function Cc({store:e=Hs,registry:t=Ha,api:n=J,concurrency:r=()=>Statamic.$config.get(`tolk.concurrency`),run:i=Lo,fill:a=xo,undoFill:o=So,keepSlug:s=wo,recheckSlug:c=To,saving:l=ac,toast:u=()=>Statamic.$toast}={}){let d=new Map,f=new Set;function p(e){return l(e)?(u().error(oc()),!0):!1}function m(t){let n=d.get(t),r=e();n&&(d.delete(t),n.controller.abort()),nc.includes(r.containers[t]?.phase)&&r.setPhase(t,`idle`)}function h(t){let n=d.get(t),r=e().containers[t];n&&!n.controller.signal.aborted&&r?.phase===`working`&&(n.controller.abort(),r.progress={...r.progress,cancelling:!0})}async function g(o,l,{continuing:u=!1}={}){let f=e(),m=t.context(o),h=f.container(o);if(!m||nc.includes(h.phase)||d.has(o)||!m.reference.value||p(o))return null;let g=m.reference.value,_={},v=new AbortController,y=()=>d.get(o)?.token===_,b=()=>y()&&f.containers[o]===h&&m.reference.value===g,x=()=>f.containers[o]?.lastChangeAt??0,S=pc(h),C=l.kind===`review`,w=C?l.fields??lc(m,h.status):l.fields,ee=bo(m,w??Object.keys(m.values.value),h.delivered),T=Z(m.values.value),E=C?[]:cc(m,h.status,{name:o,registry:t,delivered:h.delivered}).filter(e=>!yc(l,e)),[te,D]=C?[`editor/review`,xc(l,{reference:g,handles:w,values:T})]:[`editor/plan`,bc(l,{reference:g,skip:E})];u&&Sc(ee,h),d.set(o,{token:_,controller:v}),Object.assign(h,{request:l,snapshot:ee,summary:null,notSaved:[],planReference:g,progress:Bs().progress}),f.setPhase(o,`planning`);let ne=S?s(m,S,{reference:g,lastChangeAt:x,active:y}):null;ne?.catch(()=>{});try{let e=await n.post(te,D);if(!b())return null;if(ne){if(await ne,!b())return null;h.slugKept=!0}f.setPhase(o,`working`),h.progress={...Bs().progress,total:e.units?.length??0};let t={reference:g,plan:e.plan,lastChangeAt:x,planValues:T,delivered:h.delivered,active:y},s=await i({api:n,plan:e,concurrency:r(),signal:v.signal,finishing:y,onFields:e=>a(m,e,t),onProgress:e=>{b()&&(h.progress={...e,cancelling:v.signal.aborted})}});if(ne&&s.delivered.length&&b()&&await c(m,S,{reference:g,active:y}),!b())return null;let u={...s,kind:l.kind,reviewer:e.reviewer??null,plan:e.plan,planned:Array.isArray(e.fields)?e.fields:[],skipped:{..._c(e.skipped),...s.skipped},planSkipped:vc(e.skipped),warnings:[...new Set([...Array.isArray(e.warnings)?e.warnings:[],...s.warnings??[]])],cancelled:v.signal.aborted};return h.summary=u,f.setPhase(o,s.stopped?`error`:`done`,s.stopped),u}catch(e){return b()&&f.setPhase(o,`error`,Po(e,__(`Something went wrong.`))),null}finally{y()&&d.delete(o)}}function _(e,{mode:t=`missing`,fields:n=null,overwriteManual:r=!1,translator:i=null,review:a=null,reviewer:o=null,replace:s=!1}={}){return g(e,{kind:`translate`,mode:t,fields:n,overwriteManual:r,translator:i,review:a,reviewer:o,replace:s})}function v(e,{fields:t=null,overwriteManual:n=!1,reviewer:r=null}={}){return g(e,{kind:`review`,fields:t,overwriteManual:n,reviewer:r})}function y(t){let n=e().containers[t];if(!n?.request||nc.includes(n.phase))return null;let r=n.summary?dc(n.summary):n.request.fields;return r!==null&&r.length===0?(e().setPhase(t,`done`),null):g(t,{...n.request,fields:r},{continuing:!0})}async function b(n){let r=e(),i=r.containers[n],a=t.context(n);if(!a||!i?.snapshot||nc.includes(i.phase)||f.has(n)||p(n))return null;f.add(n);try{let e=await o(a,i.snapshot,i.delivered,{registry:t});return r.containers[n]===i&&r.clearResult(n),e}finally{f.delete(n)}}return{translate:_,review:v,retry:y,cancel:h,abort:m,undo:b,running:e=>d.has(e),current:e=>d.get(e)?.token??null,saving:e=>l(e)}}var $=Cc(),wc=`tolk-banner`;function Tc(e){return typeof e==`string`&&e.startsWith(`term::`)}function Ec(e,t){return[`idle`,`done`,`error`].includes(e)&&!!t?.localization&&!t?.setup}function Dc(e){let t=e?.reference?.value;return e?.name===`base`&&typeof t==`string`&&(t.startsWith(`entry::`)||Tc(t))&&Statamic.$config.get(`tolk.multisite`)===!0&&Statamic.$permissions.has(`translate content`)}function Oc({store:e=Hs,abort:t=e=>$.abort(e)}={}){let n=new Map,r=!1;function i(e=Statamic.$events){r||(r=!0,e.$on(`publish-container-created`,a),e.$on(`publish-container-destroyed`,o))}function a(e){let t=null;s(e.name),Dc(e)&&(t=e.pushComponent(wc,{props:{containerName:e.name}})),n.set(e.name,[...n.get(e.name)??[],t])}function o({name:e}){let[t,...r]=n.get(e)??[];t?.destroy(),r.length?n.set(e,r):(n.delete(e),s(e))}function s(n){t(n),e().forget(n)}return{listen:i,pushed:e=>(n.get(e)??[]).filter(Boolean).length}}var kc=Oc();function Ac({name:e,ctx:t,store:n=Hs(),registry:r=Ha,loadStatus:i=e=>Qi(`editor/status`,{reference:e}),now:a=Date.now,settleMs:o=600,onSwitch:s=e=>$.abort(e),onStatus:c=(e,t)=>tc.adopt(e,t)}){let l=I(null),u=!!t.reference.value&&n.container(e).reference===t.reference.value;r.attachContext(e,t);let d=r=>t.reference.value===r&&n.containers[e]?.reference===r;async function f(r){if(l.value=null,!t.readOnly?.value)try{let t=await i(r);d(r)&&(n.container(e).status=t,c(e,t))}catch(e){d(r)&&e?.status!==403&&(l.value=e)}}function p(t){let i=a();s(e),n.switched(e,t,i),r.refreshClean(e),setTimeout(()=>{n.containers[e]?.lastChangeAt===i&&d(t)&&r.refreshClean(e)},o),f(t)}return{failure:l,stop:bn(()=>[t.reference.value,t.site.value],([t],r)=>{if(t){if(r===void 0&&u){n.container(e).status===null&&f(t);return}p(t)}},{immediate:!0,flush:`post`})}}function jc(){let e=!1,t=!1,n=Dt({open:!1,show(){e?t=!0:n.open=!0},hide(){t=!1,e||(n.open=!1)},dismissed(){e=!0},closed(r){r||(e=!1,n.open=!1,t&&(t=!1,nt(()=>n.open=!0)))}});return n}var Mc={class:`space-y-2 ps-6`,"data-tolk-push":``},Nc={class:`sr-only`,"aria-live":`polite`,"data-tolk-push-announcement":``},Pc={key:0,class:`flex flex-wrap items-center gap-2 pt-1`,"data-tolk-push-actions":``},Fc={key:3,class:`flex flex-wrap items-center gap-2`,"data-tolk-push-phase":`updated`},Ic={key:4,class:`space-y-2`,"data-tolk-push-phase":`running`},Lc={class:`flex flex-wrap items-center justify-between gap-2`},Rc={key:1,class:`flex flex-wrap items-center gap-2`,"data-tolk-push-stalled":``},zc={key:2,class:`flex flex-wrap items-center gap-2`,"data-tolk-push-failure":``},Bc=[`data-tolk-push-status`],Vc={class:`space-y-1`},Hc=[`data-tolk-push-item`,`data-tolk-push-item-status`],Uc=[`href`],Wc=[`href`],Gc={class:`flex flex-wrap gap-2`},Kc={key:6,class:`flex flex-wrap items-center gap-2`,"data-tolk-push-phase":`error`},qc={class:`space-y-6`},Jc={class:`space-y-3`},Yc=[`data-tolk-push-site`],Xc={class:`flex items-center justify-end gap-3 pt-3 pb-1`},Zc={__name:`OriginPush`,props:{containerName:{type:String,required:!0},reference:{type:String,required:!0},origin:{type:Object,required:!0},status:{type:Object,default:null},dirty:{type:Boolean,default:!1}},setup(e){let t=e,n=Hs(),r=O(()=>n.containers[t.containerName]?.push??null),i=O(()=>Zs(r.value,t.status)),a=O(()=>Us.includes(r.value?.phase)),o=O(()=>!a.value&&(t.origin.translateInto||t.origin.update)),s=O(()=>Ks(t.origin)),c=jc(),l=I([]),u=I(`draft`),d=I(!1),f=O(()=>s.value.some(e=>e.missing&&l.value.includes(e.site))),p=O(()=>Tc(t.reference)),h=O(()=>Js(t.origin,{dirty:t.dirty,term:p.value})),g=O(()=>Ys(t.origin,{term:p.value}));function _(){l.value=s.value.map(e=>e.site),u.value=t.status?.defaults?.new_status===`mirror`?`mirror`:`draft`,d.value=t.status?.defaults?.review===!0,c.show()}function v(e,t){l.value=t?[...new Set([...l.value,e])]:l.value.filter(t=>t!==e)}function y(){c.hide(),tc.start(t.containerName,{reference:t.reference,sites:s.value.map(e=>e.site).filter(e=>l.value.includes(e)),mode:`missing`,review:d.value,newStatus:f.value?u.value:null})}function b(){tc.start(t.containerName,{reference:t.reference,sites:qs(t.origin),mode:`update`})}let x=O(()=>i.value?.automatic?__(`Updating the translations automatically into :sites…`,{sites:i.value.sites}):__(`Translating into :sites…`,{sites:i.value.sites})),S=O(()=>__(`The translations into :sites were updated automatically.`,{sites:i.value?.sites??``})),C=O(()=>{switch(r.value?.phase){case`starting`:return __(`Starting the translation…`);case`expecting`:return x.value;case`updated`:return S.value;case`running`:return i.value.failure?__(`The translations stopped: :message`,{message:i.value.failure}):i.value.stalled??x.value;case`error`:return i.value?.error??``;default:return i.value?.result?.text??``}});function w(){window.location.reload()}return(t,n)=>(F(),j(`div`,Mc,[M(`p`,Nc,R(C.value),1),o.value?(F(),j(`div`,Pc,[e.origin.translateInto?(F(),k(z(V),{key:0,variant:`primary`,size:`sm`,disabled:e.dirty,"data-tolk-action":`translate-into`,onClick:_},{default:B(()=>[N(R(t.__(`Translate into…`)),1)]),_:1},8,[`disabled`])):A(``,!0),e.origin.update?(F(),k(z(V),{key:1,size:`sm`,disabled:e.dirty,"data-tolk-action":`update-translations`,onClick:b},{default:B(()=>[N(R(t.__(`Update translations`)),1)]),_:1},8,[`disabled`])):A(``,!0),h.value?(F(),k(z(U),{key:2,"data-tolk-save-first":``},{default:B(()=>[N(R(h.value),1)]),_:1})):A(``,!0)])):A(``,!0),r.value?.phase===`starting`?(F(),k(z(q),{key:1,as:`p`,"data-tolk-push-phase":`starting`},{default:B(()=>[N(R(t.__(`Starting the translation…`)),1)]),_:1})):A(``,!0),r.value?.phase===`expecting`?(F(),k(z(q),{key:2,as:`p`,"data-tolk-push-phase":`expecting`},{default:B(()=>[N(R(x.value),1)]),_:1})):A(``,!0),r.value?.phase===`updated`?(F(),j(`div`,Fc,[P(z(q),null,{default:B(()=>[N(R(S.value),1)]),_:1}),P(z(V),{size:`sm`,variant:`ghost`,"data-tolk-action":`push-close`,onClick:n[0]||=t=>z(tc).dismiss(e.containerName)},{default:B(()=>[N(R(t.__(`Close`)),1)]),_:1})])):A(``,!0),r.value?.phase===`running`?(F(),j(`div`,Ic,[M(`div`,Lc,[r.value.cancelling?(F(),k(z(q),{key:0},{default:B(()=>[N(R(t.__(`Cancelling. Translations already being saved are still saved.`)),1)]),_:1})):(F(),k(z(q),{key:1,"data-tolk-push-working":``},{default:B(()=>[N(R(x.value),1)]),_:1})),P(z(V),{size:`sm`,variant:`ghost`,disabled:r.value.cancelling,"data-tolk-action":`push-cancel`,onClick:n[1]||=t=>z(tc).cancel(e.containerName)},{default:B(()=>[N(R(t.__(`Cancel`)),1)]),_:1},8,[`disabled`])]),P(Ba,{value:i.value.progress.finished,max:i.value.progress.total,label:t.__(`Translation progress`)},null,8,[`value`,`max`,`label`]),P(z(U),{"data-tolk-push-progress":``},{default:B(()=>[N(R(t.__(`:finished of :total translations finished.`,{finished:i.value.progress.finished,total:i.value.progress.total})),1)]),_:1}),i.value.keepOpen?(F(),k(z(U),{key:0},{default:B(()=>[N(R(p.value?t.__(`Keep this page open until the translations are saved. If you leave, they continue when you open this term again.`):t.__(`Keep this page open until the translations are saved. If you leave, they continue when you open this entry again.`)),1)]),_:1})):A(``,!0),i.value.stalled?(F(),j(`div`,Rc,[P(z(Sr),{name:`warning-diamond`,class:`size-4 shrink-0 text-amber-600`,"aria-hidden":`true`}),P(z(q),null,{default:B(()=>[N(R(i.value.stalled),1)]),_:1}),i.value.takeOver?(F(),k(z(V),{key:0,size:`sm`,disabled:r.value.takingOver||r.value.cancelling,loading:r.value.takingOver,"data-tolk-action":`push-take-over`,onClick:n[2]||=t=>z(tc).takeOver(e.containerName)},{default:B(()=>[N(R(t.__(`Translate in this page instead`)),1)]),_:1},8,[`disabled`,`loading`])):A(``,!0)])):A(``,!0),i.value.failure?(F(),j(`div`,zc,[P(z(Sr),{name:`warning-diamond`,class:`size-4 shrink-0 text-red-600`,"aria-hidden":`true`}),P(z(q),{variant:`danger`},{default:B(()=>[N(R(t.__(`The translations stopped: :message`,{message:i.value.failure})),1)]),_:1}),P(z(V),{size:`sm`,"data-tolk-action":`push-resume`,onClick:n[3]||=t=>z(tc).resume(e.containerName)},{default:B(()=>[N(R(t.__(`Try again`)),1)]),_:1})])):A(``,!0)])):A(``,!0),i.value?.result?(F(),j(`div`,{key:5,class:`space-y-2`,"data-tolk-push-result":``,"data-tolk-push-status":i.value.result.status},[P(z(q),{as:`p`},{default:B(()=>[N(R(i.value.result.text),1)]),_:1}),i.value.result.error?(F(),k(z(q),{key:0,as:`p`,variant:`danger`},{default:B(()=>[N(R(i.value.result.error),1)]),_:1})):A(``,!0),M(`ul`,Vc,[(F(!0),j(m,null,L(i.value.result.items,e=>(F(),j(`li`,{key:e.index,class:`flex flex-wrap items-center gap-2`,"data-tolk-push-item":e.handle,"data-tolk-push-item-status":e.status},[e.editUrl?(F(),j(`a`,{key:0,href:e.editUrl,class:`text-sm font-medium underline`},R(e.site),9,Uc)):(F(),k(z(q),{key:1,variant:`strong`},{default:B(()=>[N(R(e.site),1)]),_:2},1024)),P(z(Pn),{text:e.statusLabel,color:e.statusColor},null,8,[`text`,`color`]),e.error||e.reason?(F(),k(z(U),{key:2},{default:B(()=>[N(R(e.error??e.reason)+` `,1),e.rootPage?(F(),j(`a`,{key:0,href:e.rootPage.url,class:`font-medium underline`,"data-tolk-root-page":``},R(t.__(`Open :title`,{title:e.rootPage.title})),9,Wc)):A(``,!0)]),_:2},1024)):A(``,!0)],8,Hc))),128))]),i.value.reload?(F(),k(z(U),{key:1},{default:B(()=>[N(R(t.__(`Reload the page to see the new localizations in the Sites panel.`)),1)]),_:1})):A(``,!0),M(`div`,Gc,[i.value.reload?(F(),k(z(V),{key:0,size:`sm`,variant:`primary`,"data-tolk-action":`reload`,onClick:w},{default:B(()=>[N(R(t.__(`Reload`)),1)]),_:1})):A(``,!0),P(z(V),{size:`sm`,variant:`ghost`,"data-tolk-action":`push-close`,onClick:n[4]||=t=>z(tc).dismiss(e.containerName)},{default:B(()=>[N(R(t.__(`Close`)),1)]),_:1})])],8,Bc)):A(``,!0),r.value?.phase===`error`?(F(),j(`div`,Kc,[P(z(Sr),{name:`warning-diamond`,class:`size-4 shrink-0 text-red-600`,"aria-hidden":`true`}),P(z(q),{variant:`danger`,"data-tolk-push-error":``},{default:B(()=>[N(R(i.value.error),1)]),_:1}),P(z(V),{size:`sm`,variant:`ghost`,"data-tolk-action":`push-close`,onClick:n[5]||=t=>z(tc).dismiss(e.containerName)},{default:B(()=>[N(R(t.__(`Close`)),1)]),_:1})])):A(``,!0),z(c).open?(F(),k(z(Wr),{key:7,open:``,title:t.__(`Translate into other languages`),icon:`dictionary-language-book`,"data-tolk-push-modal":``,onDismissed:n[9]||=e=>z(c).dismissed(),"onUpdate:open":n[10]||=e=>z(c).closed(e)},{footer:B(()=>[M(`div`,Xc,[P(z(V),{variant:`ghost`,text:t.__(`Cancel`),"data-tolk-push-action":`close`,onClick:n[8]||=e=>z(c).hide()},null,8,[`text`]),P(z(V),{variant:`primary`,text:t.__(`Translate`),disabled:l.value.length===0,"data-tolk-push-action":`translate`,onClick:y},null,8,[`text`,`disabled`])])]),default:B(()=>[M(`div`,qc,[P(z(q),{as:`p`},{default:B(()=>[N(R(g.value),1)]),_:1}),M(`div`,Jc,[(F(!0),j(m,null,L(s.value,e=>(F(),j(`div`,{key:e.site,"data-tolk-push-site":e.site},[P(z(Vn),{"model-value":l.value.includes(e.site),label:e.name,description:e.summary,"onUpdate:modelValue":t=>v(e.site,t)},null,8,[`model-value`,`label`,`description`,`onUpdate:modelValue`])],8,Yc))),128))]),f.value?(F(),k(z(yr),{key:0,id:`tolk-push-status`,label:t.__(`New localizations`)},{default:B(()=>[P(z(ui),{modelValue:u.value,"onUpdate:modelValue":n[6]||=e=>u.value=e,appearance:`inline`,"data-tolk-push-new-status":``},{default:B(()=>[P(z(li),{value:`draft`,label:t.__(`Drafts`)},null,8,[`label`]),P(z(li),{value:`mirror`,label:t.__(`Same as origin`)},null,8,[`label`])]),_:1},8,[`modelValue`])]),_:1},8,[`label`])):A(``,!0),P(z(Vn),{modelValue:d.value,"onUpdate:modelValue":n[7]||=e=>d.value=e,label:t.__(`Review after translating`),description:t.__(`A second model checks each translation and corrects it before it is saved.`)},null,8,[`modelValue`,`label`,`description`])])]),_:1},8,[`title`])):A(``,!0)]))}},Qc=`tolk.offer`,$c=null;function el(e,t,{preferences:n=()=>Statamic.$preferences,toast:r=()=>Statamic.$toast}={}){let i=()=>new Promise(r=>r(n().set(e,t))).then(()=>!0,()=>(r().error(__(`Your choice could not be saved.`)),!1)),a=$c?$c.then(i):i();return $c=a,a.then(()=>{$c===a&&($c=null)}),a}function tl(e=Statamic.$preferences){return e.get(Qc,!0)!==!1}function nl(e,t=Statamic.$preferences){return e?.offer===!0&&tl(t)&&ua(e).localization?.translate===!0}function rl(e){let t=ua(e);return{count:e?.localization?.counts?.untranslated??0,source:t.localization?.source?.name??``,target:t.localization?.target?.name??``,translator:t.translator}}var il=350;function al({store:e=Hs,registry:t=Ha,translations:n=$,preferences:r=()=>Statamic.$preferences,toast:i=()=>Statamic.$toast,openAfterMs:a=il,clock:o=()=>Date.now(),wait:s=(e,t)=>setTimeout(e,t)}={}){let c=null,l=!1;function u(e=Statamic.$events){l||(l=!0,e.$on(`localization.created`,d))}function d(n){let r=n?.container?.name,i=t.context(r)?.reference?.value;if(r!==`base`||!i)return;m();let s=e(),l=o()+a;if(f(s,r,i,l))return;let u=bn(()=>{let e=s.containers[r];return[e?.reference,e?.status]},()=>{f(s,r,i,l)&&(u(),c===u&&(c=null))});c=u}function f(e,n,r,i){let a=e.containers[n];return a?.reference===r?(a.created=!0,a.status!==null&&(p(e,n,r,i),!0)):t.context(n)?.reference?.value!==r}function p(e,t,n,i){let a=i-o();if(a>0){s(()=>p(e,t,n,i),a);return}let c=e.containers[t];c?.reference===n&&c.phase===`idle`&&nl(c.status,r())&&e.setPhase(t,`offer`)}function m(){c?.(),c=null}function h(t,n){let a=e();return a.phaseOf(t)===`offer`&&(n&&el(Qc,!1,{preferences:r,toast:i}),a.setPhase(t,`idle`),!0)}function g(e,{dontOfferAgain:t=!1}={}){return h(e,t)?n.translate(e,{mode:`missing`}):null}function _(e,{dontOfferAgain:t=!1}={}){h(e,t)}return{listen:u,created:d,accept:g,decline:_,waiting:e=>e===`base`&&c!==null}}var ol=al(),sl={class:`space-y-1`},cl={class:`flex items-center justify-end gap-3 pt-3 pb-1`},ll={__name:`TranslateOffer`,props:{containerName:{type:String,required:!0},status:{type:Object,default:null},open:{type:Boolean,default:!1}},setup(e){let t=e,n=I(!1),r=O(()=>rl(t.status));bn(()=>t.open,e=>{e&&(n.value=!1)});function i(){ol.accept(t.containerName,{dontOfferAgain:n.value})}function a(){ol.decline(t.containerName,{dontOfferAgain:n.value})}return(t,o)=>(F(),k(z(Wr),{open:e.open,title:t.__(`Translate this entry?`),icon:`dictionary-language-book`,"data-tolk-offer":``,onDismissed:a},{footer:B(()=>[M(`div`,cl,[P(z(V),{variant:`ghost`,text:t.__(`Not now`),"data-tolk-offer-action":`decline`,onClick:a},null,8,[`text`]),P(z(V),{variant:`primary`,text:t.__(`Translate`),"data-tolk-offer-action":`translate`,onClick:i},null,8,[`text`])])]),default:B(()=>[M(`div`,sl,[P(z(q),{as:`p`,"data-tolk-offer-text":``},{default:B(()=>[N(R(t.__n(`Translate :count field from :source into :target. Nothing is saved until you press Save.|Translate :count fields from :source into :target. Nothing is saved until you press Save.`,r.value.count,{source:r.value.source,target:r.value.target})),1)]),_:1}),r.value.translator?(F(),k(z(U),{key:0,"data-tolk-offer-model":``},{default:B(()=>[N(R(t.__(`Model: :model`,{model:z(ba)(r.value.translator)})),1)]),_:1})):A(``,!0)]),P(z(Vn),{modelValue:n.value,"onUpdate:modelValue":o[0]||=e=>n.value=e,label:t.__(`Don't offer again`)},null,8,[`modelValue`,`label`])]),_:1},8,[`open`,`title`]))}},ul=`automatic`;function dl(e){return typeof e==`string`&&e.trim()!==``?e.trim():null}function fl(e){return/^[^\s:]+:\S+$/.test(e)}function pl(e){return{quality:__(`Quality`),fast:__(`Fast`)}[e]??null}function ml(e,t){return{value:e,label:e,note:Y(t)[e.split(`:`)[0]]?.[0]?.configured===!1?__(`No API key`):__(`Custom model`),disabled:!1}}function hl(e,t){let n=[{value:ul,label:e?.automatic||__(`Automatic`),note:null,disabled:!1}],r=e?.fake_engine===!0;for(let t of Object.values(Y(e?.catalog)).flat())n.push({value:t.value,label:t.label,note:t.configured?pl(t.tier):__(`No API key`),disabled:!t.configured&&!r});let i=dl(t);return i&&!n.some(e=>e.value===i)&&n.push(ml(i,e?.catalog)),n}function gl(e,t){if(e===null||e===`automatic`)return null;let n=t.find(t=>t.value===e);if(n)return n.disabled?void 0:n.value;let r=typeof e==`string`?e.trim():``;return fl(r)?r:void 0}var _l=`tolk.editor.translator`,vl=`tolk.editor.reviewer`;function yl(e,t){let n=e.get(t,null);return typeof n==`string`&&n!==``?n:null}function bl(e=Statamic.$preferences,t=_l){let n=yl(e,t);return n!==null&&fl(n)?n:null}function xl(e,{fakeEngine:t=!1,defaultModel:n=null,extra:r=[]}={}){let i=[];for(let r of Object.values(Y(e)).flat())(r.configured||t)&&i.push({value:r.value,label:r.value===n?__(`:model (default)`,{model:r.label}):r.label});for(let e of r)e&&!i.some(t=>t.value===e)&&i.push({value:e,label:e===n?__(`:model (default)`,{model:e}):e});return i}function Sl(e,t,n){if(t.some(t=>t.value===e))return e;let r=typeof e==`string`?e.trim():``;return fl(r)?r:n}function Cl(e,{remembered:t=null,defaultModel:n=null}={}){let r=t=>t!==null&&e.some(e=>e.value===t);return r(t)?t:r(n)?n:e[0]?.value??null}function wl(e,t){return e&&e!==t?e:null}function Tl(e,t,n){return n?e||null:wl(e,t)}function El({model:e=null,defaultModel:t=null,retranslate:n=!1,overwriteManual:r=!1,review:i=null,reviewer:a=null,defaultReviewer:o=null}={}){let s=wl(e,t);return{mode:n?`all`:`update`,overwriteManual:r,translator:s,review:i,reviewer:i===!0?Tl(a,o,s):null}}function Dl({reviewer:e=null,defaultReviewer:t=null,overwriteManual:n=!1}={}){return{overwriteManual:n,reviewer:wl(e,t)}}function Ol(e){let t=e?.localization?.counts??{},n=Object.values(e?.localization?.fields??{}).filter(e=>e.incomplete).length;return{markCurrent:(t.attention??0)+(t.untracked??0)>0,protect:(t.current??0)+(t.outdated??0)-n>0}}function kl(e,t){return e===0?__(`No field needed changing.`):t?__n(`:count field is now protected from updates.|:count fields are now protected from updates.`,e):__n(`:count field marked as up to date.|:count fields marked as up to date.`,e)}function Al({store:e=Hs,registry:t=Ha,api:n=J,translations:r=$,preferences:i=()=>Statamic.$preferences,toast:a=()=>Statamic.$toast}={}){let o=null;function s(){return o??=n.get(`models`).catch(e=>{throw o=null,e}),o}function c(e,t){t!==yl(i(),e)&&el(e,t,{preferences:i,toast:a})}function l(t,n={}){let i=El(n);return nc.includes(e().phaseOf(t))?null:(c(_l,i.translator),i.review===!0&&c(vl,wl(n.reviewer,n.defaultReviewer)),r.translate(t,i))}function u(t,n={}){let i=Dl(n);return nc.includes(e().phaseOf(t))?null:(c(vl,i.reviewer),r.review(t,i))}async function d(r,{protect:i=!1}={}){let o=e().containers[r],s=t.context(r)?.reference?.value??null;if(!o||!s||o.reference!==s||nc.includes(o.phase))return null;try{let{baselined:e=0,...t}=await n.post(`editor/baseline`,{reference:s,protect:i});return o.status=t,a().success(kl(e,i)),e}catch(e){return a().error(e?.message||__(`Something went wrong.`)),null}}function f(e){return el(Qc,e,{preferences:i,toast:a})}return{loadModels:s,translate:l,review:u,baseline:d,setOffers:f}}var jl=Al(),Ml={class:`space-y-4`},Nl={class:`space-y-3`},Pl={class:`grid gap-4 sm:grid-cols-2`},Fl={class:`space-y-3`},Il={key:0,class:`space-y-3 border-t border-gray-200 pt-4 dark:border-gray-700`,"aria-labelledby":`tolk-options-state-heading`,"data-tolk-options-state":``},Ll={key:0,class:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`},Rl={key:1,class:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`},zl={key:1,class:`flex items-start justify-between gap-4 border-t border-gray-200 pt-4 dark:border-gray-700`,"data-tolk-options-offer":``},Bl={class:`space-y-0.5`},Vl={class:`flex items-center justify-end gap-3 pt-3 pb-1`},Hl={__name:`TranslateOptions`,props:{containerName:{type:String,required:!0},status:{type:Object,default:null}},setup(e){let t=e,n=Hs(),r=O(()=>Tc(n.containers[t.containerName]?.reference)),i=jc(),a=I(!1),o=I(null),s=I(null),c=I(null),l=I(null),u=I(!1),d=I(!1),f=I(!1),p=I(!0),h=I(!1),g=!!Statamic.$config.get(`tolk.settingsUrl`),_=O(()=>s.value?.defaults?.translator??t.status?.defaults?.translator??null),v=O(()=>s.value?.defaults?.reviewer??null),y=O(()=>bl()),b=O(()=>bl(Statamic.$preferences,vl));function x(e,n,r){return xl(s.value?.catalog,{fakeEngine:t.status?.defaults?.fake_engine===!0,defaultModel:e,extra:g?[e,n,r]:[e]})}let S=O(()=>x(_.value,y.value,c.value)),C=O(()=>x(v.value,b.value,l.value)),w=O(()=>uc(n.containers[t.containerName],{overwriteManual:f.value})),ee=O(()=>u.value||w.value),T=O(()=>Ol(t.status)),E=O(()=>t.status?.offer===!0);async function te(){d.value=!1,f.value=!1,u.value=t.status?.defaults?.review===!0,o.value=null,p.value=tl(),i.show(),a.value=!0;try{s.value=await jl.loadModels()}catch(e){o.value=e.message}finally{a.value=!1}c.value=Cl(S.value,{remembered:y.value,defaultModel:_.value}),l.value=Cl(C.value,{remembered:b.value,defaultModel:v.value})}function D(){i.hide(),jl.translate(t.containerName,{model:c.value,defaultModel:_.value,retranslate:d.value,overwriteManual:f.value,review:u.value,reviewer:l.value,defaultReviewer:v.value})}function ne(){i.hide(),jl.review(t.containerName,{reviewer:l.value,defaultReviewer:v.value,overwriteManual:f.value})}async function re(e){h.value=!0;try{await jl.baseline(t.containerName,{protect:e})!==null&&i.hide()}finally{h.value=!1}}async function ie(e){p.value=e,await jl.setOffers(e)||(p.value=!e)}return(e,t)=>(F(),j(m,null,[P(z(V),{size:`sm`,variant:`ghost`,icon:`sliders-horizontal`,text:e.__(`Options`),"data-tolk-action":`options`,onClick:te},null,8,[`text`]),z(i).open?(F(),k(z(Wr),{key:0,open:``,title:e.__(`Translation options`),icon:`sliders-horizontal`,"data-tolk-options":``,onDismissed:t[8]||=e=>z(i).dismissed(),"onUpdate:open":t[9]||=e=>z(i).closed(e)},{footer:B(()=>[M(`div`,Vl,[P(z(V),{variant:`ghost`,text:e.__(`Close`),"data-tolk-options-action":`close`,onClick:t[7]||=e=>z(i).hide()},null,8,[`text`]),w.value?(F(),k(z(V),{key:0,text:e.__(`Review`),disabled:a.value||!l.value,"data-tolk-options-action":`review`,onClick:ne},null,8,[`text`,`disabled`])):A(``,!0),P(z(V),{variant:`primary`,text:e.__(`Translate`),disabled:a.value||!c.value,"data-tolk-options-action":`translate`,onClick:D},null,8,[`text`,`disabled`])])]),default:B(()=>[M(`div`,Ml,[M(`div`,Nl,[M(`div`,Pl,[P(z(yr),{id:`tolk-options-model`,label:e.__(`Model`)},{default:B(()=>[P(z(Wn),{id:`tolk-options-model`,"model-value":c.value,options:S.value,taggable:z(g),disabled:a.value,placeholder:a.value?e.__(`Loading…`):e.__(`Choose a model`),"data-tolk-options-model":``,"onUpdate:modelValue":t[0]||=e=>c.value=z(Sl)(e,S.value,c.value)},null,8,[`model-value`,`options`,`taggable`,`disabled`,`placeholder`])]),_:1},8,[`label`]),P(z(yr),{id:`tolk-options-reviewer`,label:e.__(`Reviewer`),"data-tolk-options-review":``},{default:B(()=>[P(z(Wn),{id:`tolk-options-reviewer`,"model-value":l.value,options:C.value,taggable:z(g),disabled:a.value||!ee.value,placeholder:a.value?e.__(`Loading…`):e.__(`Choose a model`),"data-tolk-options-reviewer":``,"onUpdate:modelValue":t[1]||=e=>l.value=z(Sl)(e,C.value,l.value)},null,8,[`model-value`,`options`,`taggable`,`disabled`,`placeholder`])]),_:1},8,[`label`])]),z(g)?(F(),k(z(U),{key:0},{default:B(()=>[N(R(e.__(`You may also type a model outside the list, as provider:model.`)),1)]),_:1})):A(``,!0),o.value?(F(),k(z(q),{key:1,as:`p`,variant:`danger`,"data-tolk-options-failure":``},{default:B(()=>[N(R(e.__(`The models could not be loaded: :message`,{message:o.value})),1)]),_:1})):A(``,!0)]),M(`div`,Fl,[P(z(Vn),{modelValue:d.value,"onUpdate:modelValue":t[2]||=e=>d.value=e,label:e.__(`Retranslate everything`),description:e.__(`Also translates the fields that are up to date again.`)},null,8,[`modelValue`,`label`,`description`]),P(z(Vn),{modelValue:f.value,"onUpdate:modelValue":t[3]||=e=>f.value=e,label:e.__(`Overwrite manual edits`),description:e.__(`Also replaces the text of fields edited by hand.`)},null,8,[`modelValue`,`label`,`description`]),P(z(Vn),{modelValue:u.value,"onUpdate:modelValue":t[4]||=e=>u.value=e,label:e.__(`Review after translating`),description:e.__(`The reviewer checks the new translation and corrects it.`)},null,8,[`modelValue`,`label`,`description`])]),T.value.markCurrent||T.value.protect?(F(),j(`section`,Il,[P(z(W),{id:`tolk-options-state-heading`,level:2,text:e.__(`Translation status`)},null,8,[`text`]),T.value.markCurrent?(F(),j(`div`,Ll,[P(z(U),null,{default:B(()=>[N(R(e.__(`Records that the fields edited by hand match the current source, so a later change to the source is flagged.`)),1)]),_:1}),P(z(V),{size:`sm`,class:`shrink-0 self-start sm:self-auto`,text:e.__(`Mark manual fields as up to date`),disabled:h.value,"data-tolk-action":`mark-current`,onClick:t[5]||=e=>re(!1)},null,8,[`text`,`disabled`])])):A(``,!0),T.value.protect?(F(),j(`div`,Rl,[P(z(U),null,{default:B(()=>[N(R(e.__(`Treats the translated fields as edited by hand, so Translate and Update leave them alone.`)),1)]),_:1}),P(z(V),{size:`sm`,class:`shrink-0 self-start sm:self-auto`,text:r.value?e.__(`Protect this term from updates`):e.__(`Protect this entry from updates`),disabled:h.value,"data-tolk-action":`protect`,onClick:t[6]||=e=>re(!0)},null,8,[`text`,`disabled`])])):A(``,!0)])):A(``,!0),E.value&&!r.value?(F(),j(`div`,zl,[M(`div`,Bl,[P(z(Dr),{for:`tolk-options-offer`,text:e.__(`Offer to translate new localizations`)},null,8,[`text`]),P(z(U),{id:`tolk-options-offer-description`},{default:B(()=>[N(R(e.__(`Asks whether to translate each localization you create. Only for your account.`)),1)]),_:1})]),P(z(bi),{id:`tolk-options-offer`,"model-value":p.value,"aria-describedby":`tolk-options-offer-description`,"onUpdate:modelValue":ie},null,8,[`model-value`])])):A(``,!0)])]),_:1},8,[`title`])):A(``,!0)],64))}},Ul=`localizable`,Wl={ok:{color:`green`,icon:`checkmark`,class:`text-green-600`},warning:{color:`amber`,icon:`alert-warning-exclamation-mark`,class:`text-amber-600`},error:{color:`red`,icon:`warning-diamond`,class:`text-red-600`}};function Gl(e){return`tolk-audit-${e}`}function Kl(e){return e?`${e}#${Gl(Ul)}`:null}function ql(e){return{ok:__(`OK`),warning:__(`Warning`),error:__(`Error`)}[e]??e}function Jl(e){return{label:ql(e),...Wl[e]??Wl.warning}}function Yl(e){let t=(Array.isArray(e)?e:[]).flatMap(e=>e.items??[]),n=t.filter(e=>e.level===`error`).length,r=t.filter(e=>e.level===`warning`).length;if(n===0&&r===0)return{level:`ok`,text:__(`Everything is set up. Tolk found nothing to change.`)};let i=[n>0?__n(`:count error|:count errors`,n):null,r>0?__n(`:count warning|:count warnings`,r):null].filter(Boolean);return{level:n>0?`error`:`warning`,text:__(`The audit found :problems. Errors keep Tolk from translating; warnings leave something untranslated or slower than it could be.`,{problems:i.join(`, `)})}}function Xl(e,t){return e?.id===`localizable`?t?__(`A text field that is not localizable is shared by every site, so Tolk does not translate it. Choose the fields that hold text in each language and make them localizable.`):__(`A text field that is not localizable is shared by every site, so Tolk does not translate it. Someone who may edit the Tolk settings and blueprints can make them localizable here, or with php please tolk:doctor --fix-localizable.`):e?.detail??``}function Zl(e){return typeof e?.namespace==`string`&&typeof e?.blueprint==`string`&&Array.isArray(e?.fields)}function Ql(e){return`${e.namespace}|${e.blueprint}`}function $l(e){let t=Array.isArray(e?.fields)?e.fields:[];return{editable:t.filter(e=>!e.fieldset),imported:t.filter(e=>!!e.fieldset)}}function eu(e){return e.label&&e.label!==e.handle?`${e.label} (${e.handle})`:e.handle}function tu(e){return __(`From the fieldset :fieldset: make it localizable in the fieldset, which changes every blueprint that imports it.`,{fieldset:e.fieldset})}function nu(e,t){let n=new Set(Array.isArray(t)?t:[]);return $l(e).editable.map(e=>e.handle).filter(e=>n.has(e))}function ru(e,t){let n=$l(e).editable.filter(e=>t.includes(e.handle)).map(eu).join(`, `);return __n(`This changes the blueprint file of :blueprint: :fields becomes localizable, so each site keeps its own value and Tolk translates it. Existing localizations keep the value they inherit until they are translated or edited.|This changes the blueprint file of :blueprint: :fields become localizable, so each site keeps its own value and Tolk translates them. Existing localizations keep the values they inherit until they are translated or edited.`,t.length,{blueprint:e.name,fields:n})}function iu(e){return e>0?__n(`:count field is now localizable.|:count fields are now localizable.`,e):__(`Nothing changed: the fields were already localizable.`)}function au(e,t){return __n(`:fields was not saved because it was hidden when you saved. Show it and translate it again.|:fields were not saved because they were hidden when you saved. Show them and translate them again.`,e.length,{fields:xa(e,t)})}function ou({PipelineStopped:e,store:t=Hs,registry:n=Ha,api:r=J,now:i=Date.now,running:a=e=>$.current(e),stop:o=e=>$.abort(e),onConfirmed:s=(e,t,n)=>tc.afterSave(e,t,n)}){let c=!1,l=null;function u(e=Statamic.$hooks){if(!c){c=!0;for(let t of[`entry`,`term`])e.on(`${t}.saving`,d),e.on(`${t}.saved`,f);e.on(`entry.published`,m)}}function d(r,i){let o=t(),s=a(X);if(nc.includes(o.phaseOf(`base`))&&s){l!==s&&(l=s,Statamic.$toast.error(__(`A translation is in progress. Wait for it to finish, or cancel it.`))),i(new e);return}let c=n.context(X),u=o.containers[X];c&&u?.reference&&u.reference===c.reference.value&&_o(c,u.delivered),r()}async function f(e,t,n){try{await p(n)}catch(e){console.error(e)}finally{e()}}async function p(e){let a=t(),o=a.containers[X],c=su(e,o);if(!o?.reference||c!==o.reference)return;let l=n.context(X),u=a.saved(X,i()),d=l?.reference.value===c?vo(l,u):Object.keys(u);n.refreshClean(X),(o.phase===`done`||o.phase===`error`)&&a.clearResult(X);try{let{not_saved:e=[],...t}=await r.post(`editor/confirm`,{reference:c,delivered:d}),n=a.containers[X];n?.reference===c&&(n.status=t,n.notSaved=e,s(X,t)),e.length&&Statamic.$toast.error(au(e,t),{duration:1e4})}catch(e){e?.status!==403&&Statamic.$toast.error(__(`The translation status could not be updated: :message`,{message:e?.message??``}))}}function m(e,t,n){try{h(n)}catch(e){console.error(e)}g(n).catch(e=>console.error(e)),e()}function h(e){let r=t(),s=r.containers[X];if(!s?.reference||su(e,s)!==s.reference)return;let c=s.phase,l=nc.includes(c)&&!!a(`base`),u=Object.keys(s.delivered),d=n.context(X);o(X),d&&u.length&&Co(d,s.snapshot,u),r.saved(X,i()),(u.length||![`idle`,`offer`].includes(c))&&r.clearResult(X),(u.length||l)&&Statamic.$toast.info(__(`Publishing discarded the unsaved translation. Translate again to fill in the form.`))}async function g(e){let n=t().containers[X],i=su(e,n);if(n?.reference&&i===n.reference)try{let e=await r.get(`editor/status`,{reference:i}),n=t().containers[X];n?.reference===i&&(n.status=e,s(X,e,{published:!0}))}catch(e){e?.status!==403&&Statamic.$toast.error(__(`The translation status could not be updated: :message`,{message:e?.message??``}))}}return{listen:u,saving:d,saved:f,published:m}}function su(e,t){let n=e?.response?.data?.data;return typeof n?.reference==`string`?n.reference:typeof n?.id==`string`&&t?.reference?.startsWith(`term::${n.id}::`)?t.reference:e?.reference??null}var cu=`[data-tolk-offer], [data-tolk-options], [data-tolk-changes], [data-tolk-push-modal]`,lu=`[data-tolk-action]:not([disabled])`,uu=`[data-tolk-focus]`,du=`button:not([disabled]), [href], [tabindex="0"]`;function fu(e,{modals:t=null,doc:n=globalThis.document,wait:r=setTimeout,delays:i=[0,400]}={}){let a=null;function o(){let r=n?.activeElement,i=e();return!!(r&&i&&(i.contains(r)||t&&r.closest?.(t)))}function s(){return!n.activeElement||n.activeElement===n.body||n.activeElement===a}function c(){let t=e();if(!t?.isConnected||!s())return;let n=t.querySelector(lu),r=n??t.querySelector(uu)??t.querySelector(du);r?.focus(),a=n?null:r}return{holds:o,restore:c,changing(){o()&&i.forEach(e=>r(c,e))}}}var pu={class:`sr-only`,"aria-live":`polite`,"data-tolk-announcement":``},mu={key:0,class:`flex items-center gap-2`},hu={key:0,class:`space-y-2`,"data-tolk-localization":``},gu={class:`flex flex-wrap items-center justify-between gap-x-6 gap-y-3`},_u={class:`flex flex-wrap items-center gap-2`},vu={key:0,class:`flex flex-wrap items-center gap-2`,"data-tolk-actions":``},yu={key:2,class:`flex flex-wrap items-center gap-2`,"data-tolk-copies":``},bu=[`href`],xu={key:1,class:`flex items-center gap-2`,tabindex:`-1`,"data-tolk-focus":``,"data-tolk-phase":`planning`},Su={key:2,class:`space-y-2`,"data-tolk-phase":`working`},Cu={class:`flex flex-wrap items-center justify-between gap-2`},wu={key:3,class:`space-y-1`,"data-tolk-phase":`error`},Tu={class:`flex items-center gap-2`},Eu={key:4,class:`space-y-1`,"data-tolk-summary":``},Du={key:1,class:`flex flex-wrap items-center gap-2`},Ou={key:5,class:`flex flex-wrap gap-2`},ku={key:6,class:`flex items-center gap-2`,"data-tolk-not-saved":``},Au={key:7,class:`space-y-2`,"data-tolk-origin":``},ju={class:`flex items-center gap-2`},Mu={class:`grid grid-cols-[auto_auto_minmax(0,1fr)] items-center gap-x-3 gap-y-1.5 ps-6`},Nu=[`data-tolk-site`],Pu=[`href`],Fu=[`href`],Iu={__name:`EditorBanner`,props:{containerName:{type:String,required:!0}},setup(e){let t=e,n=ti(),r=Hs(),i=t.containerName,{failure:a,stop:o}=Ac({name:i,ctx:n,store:r});lt(o);let s=O(()=>r.containers[i]??null),c=O(()=>s.value?.phase??`idle`),l=Kl(Statamic.$config.get(`tolk.auditUrl`)),u=O(()=>ua(s.value?.status??null)),d=O(()=>mc(s.value)),f=O(()=>fc(s.value)),p=O(()=>rc.includes(s.value?.error?.code)),h=O(()=>Sa(s.value?.summary??null,s.value?.status??null,{retry:f.value&&!p.value})),g=O(()=>s.value?.notSaved?.length?au(s.value.notSaved,s.value.status):null),_=O(()=>Ec(c.value,u.value)),v=O(()=>uc(s.value)),y=O(()=>{let e=s.value?.request;return e?.kind===`translate`&&e.fields?.length===1?xa(e.fields,s.value.status):null}),b=O(()=>{let e=u.value.localization?.target?.name??``;return s.value?.progress?.cancelling?__(`Cancelling. Fields already on their way are still filled in.`):s.value?.request?.kind===`review`?__(`Reviewing the translation…`):y.value?__(`Translating :field into :site…`,{field:y.value,site:e}):__(`Translating into :site…`,{site:e})}),x=O(()=>{switch(c.value){case`planning`:return __(`Preparing the translation…`);case`working`:return b.value;case`error`:return s.value?.error?.message??``;case`done`:return[h.value?.translated,h.value?.reviewed].filter(Boolean).join(` `);default:return``}}),S=jc();bn(()=>s.value?.summary,()=>S.hide());let C=O(()=>!!u.value.origin?.upToDate&&!u.value.localization&&!s.value?.push),w=O(()=>!n.readOnly.value&&(a.value!==null||u.value.visible&&!C.value)),ee=O(()=>Ha.dirtyHandles(i).length>0),T=Statamic.$config.get(`tolk.settingsUrl`),E=O(()=>Tc(s.value?.reference)),te=I(null),D=fu(()=>te.value?.$el??null,{modals:cu});bn([c,()=>s.value?.push?.phase],()=>D.changing()),bn(w,e=>{!e&&D.holds()&&nt(()=>document.getElementById(`content-card`)?.focus())});function ne(e){$.translate(i,{mode:e})}function re(){$.translate(i,{mode:`all`,fields:u.value.localization.copies.map(e=>e.handle),overwriteManual:!0})}async function ie(){let e=D.holds(),t=await $.undo(i);e&&(await nt(),D.restore()),t?.kept.length&&Statamic.$toast.info(hc(t.kept,s.value?.status))}return(e,t)=>{let n=Nt(`tooltip`);return w.value?(F(),k(z(H),{key:0,ref_key:`card`,ref:te,class:`mb-6 space-y-3`,"data-tolk-banner":``},{default:B(()=>[M(`p`,pu,R(x.value),1),z(a)?(F(),j(`div`,mu,[P(z(Sr),{name:`warning-diamond`,class:`size-4 shrink-0 text-red-600`,"aria-hidden":`true`}),P(z(q),{variant:`danger`},{default:B(()=>[N(R(e.__(`The translation status could not be loaded: :message`,{message:z(a).message})),1)]),_:1})])):(F(),j(m,{key:1},[u.value.localization?(F(),j(`div`,hu,[M(`div`,gu,[M(`div`,_u,[P(z(Sr),{name:`dictionary-language-book`,class:`size-4 shrink-0 text-gray-500`,"aria-hidden":`true`}),P(z(q),null,{default:B(()=>[N(R(u.value.localization.lead),1)]),_:1}),(F(!0),j(m,null,L(u.value.localization.parts,e=>En((F(),k(z(Pn),{key:e.key,text:e.text,color:z(oa)(e.key),tabindex:`0`,"data-tolk-part":e.key},null,8,[`text`,`color`,`data-tolk-part`])),[[n,e.description]])),128))]),_.value?(F(),j(`div`,vu,[c.value===`idle`?(F(),j(m,{key:0},[u.value.localization.translate?(F(),k(z(V),{key:0,variant:`primary`,size:`sm`,"data-tolk-action":`translate`,onClick:t[0]||=e=>ne(`missing`)},{default:B(()=>[N(R(e.__(`Translate`)),1)]),_:1})):A(``,!0),u.value.localization.update?(F(),k(z(V),{key:1,size:`sm`,"data-tolk-action":`update`,onClick:t[1]||=e=>ne(`update`)},{default:B(()=>[N(R(e.__(`Update`)),1)]),_:1})):A(``,!0)],64)):A(``,!0),v.value?(F(),k(z(V),{key:1,size:`sm`,"data-tolk-action":`review`,onClick:t[2]||=e=>z($).review(z(i))},{default:B(()=>[N(R(e.__(`Review`)),1)]),_:1})):A(``,!0),P(Hl,{"container-name":z(i),status:s.value.status},null,8,[`container-name`,`status`])])):A(``,!0)]),u.value.localization.autoUpdated?(F(),k(z(U),{key:0,"data-tolk-auto-updated":``},{default:B(()=>[N(R(u.value.localization.autoUpdated),1)]),_:1})):A(``,!0),u.value.localization.incompleteNote?(F(),k(z(U),{key:1},{default:B(()=>[N(R(u.value.localization.incompleteNote),1)]),_:1})):A(``,!0),u.value.localization.copiesNote?(F(),j(`div`,yu,[P(z(U),null,{default:B(()=>[N(R(u.value.localization.copiesNote),1)]),_:1}),_.value&&c.value===`idle`&&u.value.localization.translateCopies?(F(),k(z(V),{key:0,size:`sm`,"data-tolk-action":`translate-copies`,onClick:re},{default:B(()=>[N(R(u.value.localization.translateCopiesLabel),1)]),_:1})):A(``,!0)])):A(``,!0),u.value.localization.hint?(F(),k(z(U),{key:3,"data-tolk-not-localizable":``},{default:B(()=>[N(R(u.value.localization.hint)+` `,1),z(l)?(F(),j(`a`,{key:0,href:z(l),"data-tolk-audit-link":``},R(e.__(`Open the setup audit`)),9,bu)):(F(),j(m,{key:1},[N(R(e.__(`Run php please tolk:doctor for details.`)),1)],64))]),_:1})):A(``,!0)])):A(``,!0),c.value===`planning`?(F(),j(`div`,xu,[P(z(q),null,{default:B(()=>[N(R(e.__(`Preparing the translation…`)),1)]),_:1})])):A(``,!0),c.value===`working`?(F(),j(`div`,Su,[M(`div`,Cu,[P(z(q),{"data-tolk-working-field":y.value?``:null},{default:B(()=>[N(R(b.value),1)]),_:1},8,[`data-tolk-working-field`]),P(z(V),{size:`sm`,variant:`ghost`,disabled:s.value.progress.cancelling,"data-tolk-action":`cancel`,onClick:t[3]||=e=>z($).cancel(z(i))},{default:B(()=>[N(R(e.__(`Cancel`)),1)]),_:1},8,[`disabled`])]),P(Ba,{value:s.value.progress.done,max:s.value.progress.total,label:s.value.request?.kind===`review`?e.__(`Review progress`):e.__(`Translation progress`)},null,8,[`value`,`max`,`label`]),s.value.progress.waiting?(F(),k(z(U),{key:0},{default:B(()=>[N(R(e.__(`The provider asked to wait. Trying again shortly.`)),1)]),_:1})):A(``,!0)])):A(``,!0),c.value===`error`?(F(),j(`div`,wu,[M(`div`,Tu,[P(z(Sr),{name:`warning-diamond`,class:`size-4 shrink-0 text-red-600`,"aria-hidden":`true`}),P(z(q),{variant:`danger`,"data-tolk-error":``},{default:B(()=>[N(R(s.value.error?.message),1)]),_:1})])])):A(``,!0),h.value&&(c.value===`done`||c.value===`error`)?(F(),j(`div`,Eu,[h.value.translated?(F(),k(z(q),{key:0,as:`p`,"data-tolk-summary-translated":``},{default:B(()=>[N(R(h.value.translated),1)]),_:1})):A(``,!0),h.value.reviewed?(F(),j(`div`,Du,[P(z(q),{"data-tolk-summary-reviewed":``},{default:B(()=>[N(R(h.value.reviewed),1)]),_:1}),h.value.corrections?(F(),k(z(V),{key:0,size:`sm`,variant:`ghost`,"data-tolk-action":`view-changes`,onClick:t[4]||=e=>z(S).show()},{default:B(()=>[N(R(e.__(`View changes`)),1)]),_:1})):A(``,!0)])):A(``,!0),h.value.reviewSkipped?(F(),k(z(U),{key:2,"data-tolk-summary-review-skipped":``},{default:B(()=>[N(R(h.value.reviewSkipped),1)]),_:1})):A(``,!0),h.value.cancelled?(F(),k(z(U),{key:3},{default:B(()=>[N(R(h.value.cancelled),1)]),_:1})):A(``,!0),h.value.incomplete?(F(),k(z(U),{key:4,"data-tolk-summary-incomplete":``},{default:B(()=>[N(R(h.value.incomplete),1)]),_:1})):A(``,!0),h.value.edited?(F(),k(z(U),{key:5,"data-tolk-summary-edited":``},{default:B(()=>[N(R(h.value.edited),1)]),_:1})):A(``,!0),h.value.hidden?(F(),k(z(U),{key:6,"data-tolk-summary-hidden":``},{default:B(()=>[N(R(h.value.hidden),1)]),_:1})):A(``,!0),h.value.manual?(F(),k(z(U),{key:7,"data-tolk-summary-manual":``},{default:B(()=>[N(R(h.value.manual),1)]),_:1})):A(``,!0),h.value.failed?(F(),k(z(U),{key:8,"data-tolk-summary-failed":``},{default:B(()=>[N(R(h.value.failed),1)]),_:1})):A(``,!0),h.value.unsaved?(F(),k(z(U),{key:9,"data-tolk-summary-unsaved":``},{default:B(()=>[N(R(h.value.unsaved),1)]),_:1})):A(``,!0)])):A(``,!0),f.value||c.value===`done`&&d.value?(F(),j(`div`,Ou,[f.value?(F(),k(z(V),{key:0,size:`sm`,variant:`primary`,"data-tolk-action":`retry`,onClick:t[5]||=e=>z($).retry(z(i))},{default:B(()=>[N(R(p.value?e.__(`Start again`):e.__(`Retry`)),1)]),_:1})):A(``,!0),d.value?(F(),k(z(V),{key:1,size:`sm`,"data-tolk-action":`undo`,onClick:ie},{default:B(()=>[N(R(e.__(`Undo`)),1)]),_:1})):A(``,!0)])):A(``,!0),g.value?(F(),j(`div`,ku,[P(z(Sr),{name:`warning-diamond`,class:`size-4 shrink-0 text-amber-600`,"aria-hidden":`true`}),P(z(q),null,{default:B(()=>[N(R(g.value),1)]),_:1})])):A(``,!0),u.value.origin?(F(),j(`div`,Au,[M(`div`,ju,[P(z(Sr),{name:`dictionary-language-book`,class:`size-4 shrink-0 text-gray-500`,"aria-hidden":`true`}),P(z(q),null,{default:B(()=>[N(R(E.value?e.__(`Translations of this term:`):e.__(`Translations of this entry:`)),1)]),_:1})]),M(`ul`,Mu,[(F(!0),j(m,null,L(u.value.origin.localizations,e=>(F(),j(`li`,{key:e.site,class:`col-span-3 grid grid-cols-subgrid items-center`,"data-tolk-site":e.site},[e.editUrl?(F(),j(`a`,{key:0,href:e.editUrl,class:`text-sm font-medium underline`},R(e.name),9,Pu)):(F(),k(z(q),{key:1,variant:`strong`},{default:B(()=>[N(R(e.name),1)]),_:2},1024)),P(z(Pn),{text:e.label,color:e.color,class:`justify-self-start`},null,8,[`text`,`color`]),e.exists&&e.summary?(F(),k(z(U),{key:2},{default:B(()=>[N(R(e.summary),1)]),_:2},1024)):A(``,!0)],8,Nu))),128))]),u.value.origin.autoUpdate?(F(),k(z(U),{key:0,class:`ps-6`,"data-tolk-auto-update":``},{default:B(()=>[N(R(u.value.origin.autoUpdate),1)]),_:1})):A(``,!0),P(Zc,{"container-name":z(i),reference:s.value.reference,origin:u.value.origin,status:s.value.status,dirty:ee.value},null,8,[`container-name`,`reference`,`origin`,`status`,`dirty`])])):A(``,!0),u.value.localization?(F(),k(ll,{key:8,"container-name":z(i),status:s.value.status,open:c.value===`offer`},null,8,[`container-name`,`status`,`open`])):A(``,!0),z(S).open?(F(),k(Ra,{key:9,modal:z(S),corrections:s.value.summary?.corrections??[],reviewer:s.value.summary?.reviewer??null},null,8,[`modal`,`corrections`,`reviewer`])):A(``,!0),u.value.setup?(F(),k(z(U),{key:10,"data-tolk-setup":``},{default:B(()=>[N(R(e.__(`Translation is not set up yet.`))+` `,1),z(T)?(F(),j(`a`,{key:0,href:z(T)},R(e.__(`Open the Tolk settings`)),9,Fu)):(F(),j(m,{key:1},[N(R(e.__(`Ask an administrator to configure a provider in the Tolk settings.`)),1)],64))]),_:1})):A(``,!0)],64))]),_:1},512)):A(``,!0)}}},Lu={class:`flex items-center justify-end gap-3 pt-3 pb-1`},Ru={__name:`TranslateFieldConfirm`,emits:[`confirm`,`cancel`],setup(e,{emit:t}){let n=t,r=jc(),i=!1;pt(()=>r.show());function a(e){i||(i=!0,n(e))}function o(e){r.hide(),a(e)}function s(e){r.closed(e),e||a(`cancel`)}return(e,t)=>z(r).open?(F(),k(z(Wr),{key:0,open:``,title:e.__(`Translate from origin`),"data-tolk-field-confirm":``,onDismissed:t[2]||=e=>z(r).dismissed(),"onUpdate:open":s},{footer:B(()=>[M(`div`,Lu,[P(z(V),{variant:`ghost`,text:e.__(`Cancel`),"data-tolk-field-confirm-action":`cancel`,onClick:t[0]||=e=>o(`cancel`)},null,8,[`text`]),P(z(V),{variant:`primary`,text:e.__(`Translate`),"data-tolk-field-confirm-action":`translate`,onClick:t[1]||=e=>o(`confirm`)},null,8,[`text`])])]),default:B(()=>[P(z(q),{as:`p`},{default:B(()=>[N(R(e.__(`The current content of this field will be replaced.`)),1)]),_:1})]),_:1},8,[`title`])):A(``,!0)}},zu=`tolk-translate-field-confirm`;function Bu(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>Bu(e,t[n]));if(e===null||t===null||typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&Bu(e[n],t[n]))}function Vu({registry:e=Ha,store:t=Hs,translations:n=$,fieldActions:r=()=>Statamic.$fieldActions,config:i=()=>Statamic.$config,permissions:a=()=>Statamic.$permissions,toast:o=()=>Statamic.$toast,components:s=()=>Statamic.$components,doc:c=()=>globalThis.document,wait:l=setTimeout}={}){let u=!1;function d({vm:n,fieldPathPrefix:r,handle:i,config:o,isReadOnly:s}){if(r||s||!o?.localizable||!a().has(`translate content`)||n&&n.publishContainer?.name!==`base`||e.others().length>0)return!1;let c=e.base(),l=t().containers[X],u=l?.status;if(!c||c.readOnly?.value||!u?.localization||l.reference!==c.reference.value)return!1;let d=Y(u.localization.fields)[i];return!la(u)&&Object.hasOwn(c.originValues?.value??{},i)&&!!d&&d.status!==`not_applicable`}function f(){return nc.includes(t().containers[X]?.phase)}function p({handle:t,value:n}){let r=e.base()?.originValues?.value??{};return Ja(n)!==null&&!no(n,r[t])}async function m({handle:r,value:i}){let a=e.base(),s=t();if(!a||!Bu(i,a.values.value[r])){o().error(Tc(s.containers.base?.reference)?__(`This field is not part of the term being translated.`):__(`This field is not part of the entry being translated.`));return}if(nc.includes(s.phaseOf(`base`))||n.running(`base`)){o().error(__(`A translation is already running. Try again when it has finished.`));return}if(n.saving(`base`)){o().error(oc());return}let c=s.containers[X],l=await n.translate(X,{mode:`all`,fields:[r],overwriteManual:!0,replace:!0});if(s.containers.base===c){if(c.phase===`error`){o().error(c.error?.message||__(`Something went wrong.`));return}if(l&&!l.cancelled&&!l.delivered.includes(r)){let e=Sa(l,c.status);o().error(e.failed??e.edited??e.hidden??e.translated)}}}function h(e){return[...([...c()?.querySelectorAll(`label[for]`)??[]].find(t=>t.getAttribute(`for`)===`field_${e}`)?.closest(`[data-ui-input-group]`)?.querySelector(`[data-ui-field-header]`))?.querySelectorAll(`button[aria-label]`)??[]].find(e=>e.getAttribute(`aria-label`)===b())??null}function g(){let e=c()?.querySelector(`[data-tolk-banner]`);return e?.querySelector(`[data-tolk-action="cancel"]`)??e?.querySelector(`[data-tolk-focus]`)??null}function _(e){for(let t of[0,400])l(()=>{let t=c()?.activeElement;(!t||t===c().body)&&e()?.focus()},t)}function v(e){m(e).catch(()=>o().error(__(`Something went wrong.`))),_(()=>g()??h(e.handle))}function y(e){if(!p(e)){v(e);return}let t=s().append(zu,{props:{}});t.on(`confirm`,()=>{t.destroy(),v(e)}),t.on(`cancel`,()=>{t.destroy(),_(()=>h(e.handle))})}function b(){return __(`Translate from origin`)}let x={get title(){return b()},quick:!0,icon:`dictionary-language-book`,visible:d,disabled:f,run:y};function S(){if(!u){u=!0;for(let e of i().get(`tolk.fieldtypes`)??[])r().add(`${e}-fieldtype`,x)}}return{register:S,action:x,visible:d,disabled:f,run:y}}var Hu=Vu(),{Fieldtype:Uu,IndexFieldtype:Wu,FieldtypeMixin:Gu,HasActionsMixin:Ku,HasInputOptionsMixin:qu,HasPreferencesMixin:Ju,IndexFieldtypeMixin:Yu,InlineEditForm:Xu,DateFormatter:Zu,NumberFormatter:Qu,ItemActions:$u,RelatedItem:ed,RestoreRevision:td,RevisionHistory:nd,RevisionPreview:rd,SaveButtonOptions:id,SortableList:ad,requireElevatedSession:od,requireElevatedSessionIf:sd,clone:cd,debounce:ld,deepClone:ud,resetValuesFromResponse:dd}=__STATAMIC__.core,fd=[`data-tolk-model-note`],pd={__name:`ModelSelect`,props:Uu.props,emits:Uu.emits,setup(e,{expose:t,emit:n}){let r=n,i=e,{expose:a,isReadOnly:o,update:s}=Uu.use(r,i),c=O(()=>hl(i.meta,i.value)),l=O(()=>dl(i.value)??`automatic`);function u(e){let t=gl(e,c.value);t!==void 0&&t!==dl(i.value)&&s(t)}return t(a),(e,t)=>(F(),k(z(Wn),{id:e.id,"model-value":l.value,options:c.value,"read-only":z(o),placeholder:e.__(`Choose a model`),taggable:``,"data-tolk-model-select":``,"onUpdate:modelValue":u},{option:B(e=>[M(`span`,{class:it([`truncate`,{"opacity-50":e.disabled}])},R(e.label),3),e.note?(F(),j(`span`,{key:0,class:it([`ms-auto shrink-0 text-xs text-gray-500 dark:text-gray-400`,{"opacity-50":e.disabled}]),"data-tolk-model-note":e.value},R(e.note),11,fd)):A(``,!0)]),_:1},8,[`id`,`model-value`,`options`,`read-only`,`placeholder`]))}};function md(e){let t=e?.fake_engine===!0;return(Array.isArray(e?.providers)?e.providers:[]).map(e=>{let n=e.configured===!0;return{provider:e.provider,label:e.label,badge:hd(n),source:gd(e.source),hint:n?null:_d(e.env),testable:n||t}})}function hd(e){return e?{text:__(`Configured`),color:`green`}:{text:__(`No API key`),color:`default`}}function gd(e){return{ai:__(`The key comes from config/ai.php, which Tolk shares with the rest of the site.`),addon:__(`The key is Tolk's own, from the addon's config.`)}[e]??null}function _d(e){return e?.ai?__(`Add :variable to the .env file, or :override to give Tolk a key of its own.`,{variable:e.ai,override:e.addon}):null}function vd(e){if(e?.ok!==!0)return{ok:!1,text:e?.error||__(`The test failed.`)};let t={model:e.label||e.model,ms:e.latency_ms};return{ok:!0,text:e.fake?__(`The fake engine answered for :model in :ms ms, without calling the provider.`,t):__(`:model answered in :ms ms.`,t)}}async function yd(e,t=J){try{return await t.post(`providers/test`,{provider:e})}catch(e){return{ok:!1,error:e.message}}}var bd={class:`divide-y divide-gray-200 dark:divide-gray-700`,"data-tolk-providers":``},xd=[`data-tolk-provider`],Sd={class:`flex flex-wrap items-center gap-2`},Cd={__name:`ProvidersStatus`,props:Uu.props,emits:Uu.emits,setup(e,{expose:t,emit:n}){let r=n,i=e,{expose:a}=Uu.use(r,i),o=O(()=>md(i.meta)),s=Dt({}),c=Dt({});async function l(e){s[e]=!0,c[e]=null;try{c[e]=vd(await yd(e))}finally{s[e]=!1}}return t(a),(e,t)=>(F(),j(`div`,bd,[(F(!0),j(m,null,L(o.value,t=>(F(),j(`div`,{key:t.provider,class:`space-y-1 py-3 first:pt-0 last:pb-0`,"data-tolk-provider":t.provider},[M(`div`,Sd,[P(z(q),{variant:`strong`},{default:B(()=>[N(R(t.label),1)]),_:2},1024),P(z(Pn),{text:t.badge.text,color:t.badge.color,"data-tolk-provider-status":``},null,8,[`text`,`color`]),t.testable?(F(),k(z(V),{key:0,class:`ms-auto`,size:`sm`,text:e.__(`Test connection`),loading:!!s[t.provider],disabled:!!s[t.provider],"data-tolk-provider-test":``,onClick:e=>l(t.provider)},null,8,[`text`,`loading`,`disabled`,`onClick`])):A(``,!0)]),t.source?(F(),k(z(U),{key:0},{default:B(()=>[N(R(t.source),1)]),_:2},1024)):A(``,!0),t.hint?(F(),k(z(U),{key:1},{default:B(()=>[N(R(t.hint),1)]),_:2},1024)):A(``,!0),c[t.provider]?(F(),k(z(q),{key:2,variant:c[t.provider].ok?`success`:`danger`,"data-tolk-provider-result":c[t.provider].ok?`ok`:`failed`},{default:B(()=>[N(R(c[t.provider].text),1)]),_:2},1032,[`variant`,`data-tolk-provider-result`])):A(``,!0)],8,xd))),128))]))}},{asMap:wd}=J,Td=`glossary`;function Ed(e,t=J){let n=wd(e),r=Object.hasOwn(n,`translator_model`)?{model:n.translator_model||null}:{};return t.post(`site-profile/generate`,r)}function Dd(e){return typeof e==`string`&&e.trim()!==``}function Od(e){return String(e??``).normalize(`NFKD`).toLowerCase().replace(/\p{Mn}+/gu,``).replace(/[\s\p{Z}]+/gu,` `).trim()}function kd(e){let t=e?.site;return Array.isArray(t)?t.length===0:!t}function Ad(e){return new Set((Array.isArray(e)?e:[]).filter(kd).map(e=>Od(e?.term)).filter(e=>e!==``))}function jd(e,t,n={}){let r=Ad(t);return(Array.isArray(e)?e:[]).map(e=>{let t=r.has(Od(e));return{term:e,inGlossary:t,chosen:!t&&n[e]!==!0}})}function Md(){return Array.from(crypto.getRandomValues(new Uint8Array(12)),e=>`abcdefghijklmnopqrstuvwxyz0123456789`[e%36]).join(``)}function Nd(e){return JSON.parse(JSON.stringify(e??{}))}function Pd(e,t,n,r=Md){let i=Array.isArray(t)?t:[],a=wd(n),o=Ad(i),s={...wd(a.existing)},c=[];for(let t of e){let e=Od(t);if(e===``||o.has(e))continue;let n=r();o.add(e),s[n]=Nd(wd(a.new)),c.push({...Nd(wd(a.defaults)),term:t.trim(),do_not_translate:!0,_id:n})}return{rows:[...i,...c],meta:{...a,existing:s},added:c.map(e=>e.term)}}var Fd={class:`space-y-3`,"data-tolk-site-profile":``},Id={key:0,class:`flex flex-wrap items-center gap-3`},Ld={key:3,class:`space-y-2`,"data-tolk-site-profile-terms":``},Rd={class:`space-y-1`},zd=[`data-tolk-site-profile-term`],Bd={class:`flex flex-wrap items-center gap-3`},Vd={class:`list-disc ps-5 text-sm`},Hd=[`data-tolk-site-profile-term`],Ud={__name:`SiteProfile`,props:Uu.props,emits:Uu.emits,setup(e,{expose:t,emit:n}){let r=n,i=e,{expose:a,isReadOnly:o,update:s}=Uu.use(r,i),c=ti(),l=I(!1),u=I(!1),d=I(null),f=I(null),p=I(null),h=Dt({}),g=O(()=>Y(c?.values.value)),_=O(()=>!o.value&&Object.hasOwn(g.value,`glossary`)&&Object.hasOwn(Y(c?.meta.value),`glossary`)),v=O(()=>jd(f.value?.terms,g.value[Td],h)),y=O(()=>v.value.filter(e=>e.chosen).map(e=>e.term));function b(){Dd(i.value)?u.value=!0:x()}async function x(){u.value=!1,l.value=!0,d.value=null;try{let e=await Ed(g.value);s(e.profile),f.value={label:e.label||e.model,terms:Array.isArray(e.terms)?e.terms:[]},p.value=null,Object.keys(h).forEach(e=>delete h[e])}catch(e){d.value=e.message}finally{l.value=!1}}function S(e,t){h[e]=!t}function C(){let e=Pd(y.value,g.value[Td],c.meta.value[Td]);c.setFieldMeta(Td,e.meta),c.setFieldValue(Td,e.rows),p.value=e.added.length}return t(a),(e,t)=>(F(),j(`div`,Fd,[P(z(Fi),{id:e.id,name:e.handle,"model-value":e.value,"read-only":z(o),rows:8,"onUpdate:modelValue":z(s)},null,8,[`id`,`name`,`model-value`,`read-only`,`onUpdate:modelValue`]),z(o)?A(``,!0):(F(),j(`div`,Id,[P(z(V),{size:`sm`,icon:`ai-sparks`,text:e.__(`Generate`),loading:l.value,disabled:l.value,"data-tolk-site-profile-generate":``,onClick:b},null,8,[`text`,`loading`,`disabled`]),P(z(U),null,{default:B(()=>[N(R(e.__(`Has the translator write a profile from the content of the default site. Check it before you save.`)),1)]),_:1})])),d.value?(F(),k(z(q),{key:1,variant:`danger`,"data-tolk-site-profile-error":``},{default:B(()=>[N(R(d.value),1)]),_:1})):A(``,!0),f.value?(F(),k(z(U),{key:2,"data-tolk-site-profile-written":``},{default:B(()=>[N(R(e.__(`Written by :model. It is not saved until you save the settings.`,{model:f.value.label})),1)]),_:1})):A(``,!0),v.value.length?(F(),j(`div`,Ld,[P(z(q),{variant:`strong`},{default:B(()=>[N(R(e.__(`Names to keep untranslated`)),1)]),_:1}),_.value?(F(),j(m,{key:0},[M(`div`,Rd,[(F(!0),j(m,null,L(v.value,t=>(F(),j(`div`,{key:t.term,"data-tolk-site-profile-term":t.term},[P(z(Vn),{"model-value":t.chosen,label:t.term,description:t.inGlossary?e.__(`Already in the glossary`):null,disabled:t.inGlossary,"onUpdate:modelValue":e=>S(t.term,e)},null,8,[`model-value`,`label`,`description`,`disabled`,`onUpdate:modelValue`])],8,zd))),128))]),M(`div`,Bd,[P(z(V),{size:`sm`,text:e.__(`Add to glossary`),disabled:y.value.length===0,"data-tolk-site-profile-add":``,onClick:C},null,8,[`text`,`disabled`]),p.value===null?A(``,!0):(F(),k(z(U),{key:0,"data-tolk-site-profile-added":``},{default:B(()=>[N(R(e.__n(`Added :count name to the glossary with Do not translate on. Save the settings to keep it.|Added :count names to the glossary with Do not translate on. Save the settings to keep them.`,p.value)),1)]),_:1}))])],64)):(F(),j(m,{key:1},[M(`ul`,Vd,[(F(!0),j(m,null,L(v.value,e=>(F(),j(`li`,{key:e.term,"data-tolk-site-profile-term":e.term},R(e.term),9,Hd))),128))]),P(z(U),null,{default:B(()=>[N(R(e.__(`Add them to the glossary with Do not translate on, so that every translation keeps them.`)),1)]),_:1})],64))])):A(``,!0),u.value?(F(),k(z(Kn),{key:4,open:``,"onUpdate:open":t[0]||=e=>u.value=e,title:e.__(`Replace the site profile?`),"body-text":e.__(`A new profile replaces the text in this field. Nothing is saved until you save the settings.`),"button-text":e.__(`Generate`),onConfirm:x},null,8,[`title`,`body-text`,`button-text`])):A(``,!0)]))}},{Form:Wd,Head:Gd,Link:Kd,router:qd,toggleArchitecturalBackground:Jd,useArchitecturalBackground:Yd,useForm:Xd,usePage:Zd,usePoll:Qd}=__STATAMIC__.inertia,$d={class:`mx-auto max-w-page space-y-6`,"data-tolk-audit":``},ef={class:`flex flex-wrap items-center gap-2`},tf={key:1,class:`space-y-3`},nf=[`data-tolk-item-level`],rf=[`data-tolk-blueprint`],af={class:`flex flex-wrap items-center justify-between gap-2`},of={class:`flex items-center gap-2`},sf=[`href`],cf={class:`space-y-2`},lf=[`data-tolk-field`],uf=[`data-tolk-field-imported`],df=[`href`],ff={key:1,class:`space-y-1 ps-6`},pf=[`data-tolk-field`],mf={class:`text-xs text-gray-600 dark:text-gray-400`},hf={key:1,class:`flex items-start gap-2`},gf={__name:`Audit`,props:{checks:{type:Array,default:()=>[]},canMakeLocalizable:{type:Boolean,default:!1},urls:{type:Object,required:!0}},setup(e){let t=e,n=I(t.checks),r=Dt({}),i=I(null),a=I(null),o=O(()=>Yl(n.value));bn(()=>t.checks,e=>n.value=e);function s(e,t){return(r[Ql(e)]??[]).includes(t)}function c(e,t,n){let i=Ql(e),a=(r[i]??[]).filter(e=>e!==t);r[i]=n?[...a,t]:a}function l(e){let t=nu(e,r[Ql(e)]);t.length>0&&(i.value={item:e,fields:t,text:ru(e,t)})}async function u(){let{item:e,fields:o}=i.value,s=Ql(e);i.value=null,a.value=s;try{let i=await $i(t.urls.localizable,{namespace:e.namespace,blueprint:e.blueprint,fields:o});n.value=i.checks,delete r[s],Statamic.$toast.success(iu(i.changed))}catch(e){Statamic.$toast.error(e.message)}finally{a.value=null}}return(t,d)=>(F(),j(`div`,$d,[P(z(Gd),{title:t.__(`Audit`)},null,8,[`title`]),P(z(br),{title:t.__(`Setup audit`),icon:`clipboard-check`},{default:B(()=>[P(z(Kd),{href:e.urls.overview,class:`text-sm text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200`},{default:B(()=>[N(R(t.__(`Overview`)),1)]),_:1},8,[`href`]),P(z(V),{text:t.__(`Check again`),icon:`sync`,"data-tolk-audit-reload":``,onClick:d[0]||=e=>z(qd).reload()},null,8,[`text`])]),_:1},8,[`title`]),P(z(H),{class:`flex items-start gap-3`,"data-tolk-audit-summary":``,"data-tolk-audit-level":o.value.level},{default:B(()=>[P(z(Sr),{name:z(Jl)(o.value.level).icon,class:it([`mt-0.5 size-5 shrink-0`,z(Jl)(o.value.level).class]),"aria-hidden":`true`},null,8,[`name`,`class`]),P(z(q),null,{default:B(()=>[N(R(o.value.text),1)]),_:1})]),_:1},8,[`data-tolk-audit-level`]),(F(!0),j(m,null,L(n.value,n=>(F(),k(z(H),{id:z(Gl)(n.id),key:n.id,class:`space-y-3`,"data-tolk-check":n.id,"data-tolk-check-level":n.level},{default:B(()=>[M(`div`,ef,[P(z(Sr),{name:z(Jl)(n.level).icon,class:it([`size-4 shrink-0`,z(Jl)(n.level).class]),"aria-hidden":`true`},null,8,[`name`,`class`]),P(z(W),{size:`lg`,level:2},{default:B(()=>[N(R(n.title),1)]),_:2},1024),P(z(Pn),{text:z(Jl)(n.level).label,color:z(Jl)(n.level).color},null,8,[`text`,`color`])]),P(z(U),null,{default:B(()=>[N(R(z(Xl)(n,e.canMakeLocalizable)),1)]),_:2},1024),n.items.length===0?(F(),k(z(q),{key:0,"data-tolk-audit-nothing":``},{default:B(()=>[N(R(n.id===z(`localizable`)?t.__(`Every text field Tolk could translate is localizable.`):t.__(`Nothing to report.`)),1)]),_:2},1024)):(F(),j(`ul`,tf,[(F(!0),j(m,null,L(n.items,(i,o)=>(F(),j(`li`,{key:o,"data-tolk-item":``,"data-tolk-item-level":i.level},[z(Zl)(i)?(F(),j(`div`,{key:0,class:`space-y-2 rounded-lg border border-gray-200 p-3 dark:border-gray-700`,"data-tolk-blueprint":z(Ql)(i)},[M(`div`,af,[M(`div`,of,[P(z(Sr),{name:z(Jl)(i.level).icon,class:it([`size-4 shrink-0`,z(Jl)(i.level).class]),role:`img`,"aria-label":z(Jl)(i.level).label},null,8,[`name`,`class`,`aria-label`]),P(z(q),{class:`font-medium`},{default:B(()=>[N(R(i.name),1)]),_:2},1024)]),i.edit_url?(F(),j(`a`,{key:0,href:i.edit_url,class:`text-sm text-blue-600 hover:underline dark:text-blue-400`,"data-tolk-blueprint-link":``},R(t.__(`Edit blueprint`)),9,sf)):A(``,!0)]),n.id===z(`localizable`)?(F(),j(m,{key:0},[M(`div`,cf,[(F(!0),j(m,null,L(z($l)(i).editable,t=>(F(),j(`div`,{key:t.handle,"data-tolk-field":t.handle},[e.canMakeLocalizable?(F(),k(z(Vn),{key:0,"model-value":s(i,t.handle),label:z(eu)(t),disabled:a.value!==null,"onUpdate:modelValue":e=>c(i,t.handle,e)},null,8,[`model-value`,`label`,`disabled`,`onUpdate:modelValue`])):(F(),k(z(q),{key:1},{default:B(()=>[N(R(z(eu)(t)),1)]),_:2},1024))],8,lf))),128)),(F(!0),j(m,null,L(z($l)(i).imported,n=>(F(),j(`div`,{key:n.handle,"data-tolk-field-imported":n.handle},[e.canMakeLocalizable?(F(),k(z(Vn),{key:0,"model-value":!1,label:z(eu)(n),description:z(tu)(n),disabled:``},null,8,[`label`,`description`])):(F(),j(m,{key:1},[P(z(q),null,{default:B(()=>[N(R(z(eu)(n)),1)]),_:2},1024),P(z(U),null,{default:B(()=>[N(R(z(tu)(n)),1)]),_:2},1024)],64)),n.fieldset_url?(F(),j(`a`,{key:2,href:n.fieldset_url,class:`ms-6 text-sm text-blue-600 hover:underline dark:text-blue-400`,"data-tolk-fieldset-link":``},R(t.__(`Edit fieldset`)),9,df)):A(``,!0)],8,uf))),128))]),e.canMakeLocalizable&&z($l)(i).editable.length>0?(F(),k(z(V),{key:0,size:`sm`,variant:`primary`,text:t.__(`Make localizable`),loading:a.value===z(Ql)(i),disabled:a.value!==null||z(nu)(i,r[z(Ql)(i)]).length===0,"data-tolk-make-localizable":``,onClick:e=>l(i)},null,8,[`text`,`loading`,`disabled`,`onClick`])):A(``,!0)],64)):(F(),j(`ul`,ff,[(F(!0),j(m,null,L(i.fields,e=>(F(),j(`li`,{key:e.path??e.handle,"data-tolk-field":e.path??e.handle},[P(z(q),null,{default:B(()=>[N(R(e.label)+` `,1),M(`code`,mf,R(e.path??e.handle),1)]),_:2},1024)],8,pf))),128))]))],8,rf)):(F(),j(`div`,hf,[P(z(Sr),{name:z(Jl)(i.level).icon,class:it([`mt-0.5 size-4 shrink-0`,z(Jl)(i.level).class]),role:`img`,"aria-label":z(Jl)(i.level).label},null,8,[`name`,`class`,`aria-label`]),P(z(q),null,{default:B(()=>[N(R(i.text),1)]),_:2},1024)]))],8,nf))),128))]))]),_:2},1032,[`id`,`data-tolk-check`,`data-tolk-check-level`]))),128)),i.value?(F(),k(z(Kn),{key:0,open:``,title:t.__(`Make these fields localizable?`),"button-text":t.__(`Make localizable`),"data-tolk-localizable-confirm":``,"onUpdate:open":d[1]||=e=>i.value=e?i.value:null,onConfirm:u},{default:B(()=>[P(z(q),null,{default:B(()=>[N(R(i.value.text),1)]),_:1})]),_:1},8,[`title`,`button-text`])):A(``,!0)]))}},_f={class:`overflow-x-auto`},vf={__name:`RunsTable`,props:{runs:{type:Array,default:()=>[]}},setup(e){let t=e,n=vs(Statamic.$config.get(`sites`)),r=O(()=>t.runs.map(e=>{let t=xs({counts:e.counts}),r=js(e),i=Os(e.scope,n);return{id:e.id,url:e.url,status:e.status,what:i.what,automatic:i.automatic,sites:i.sites,progress:__(`:finished of :total`,{finished:Q(t.finished),total:Q(t.total)}),failed:t.counts.failed,tokens:r.input+r.output,cost:r.cost,date:bs(e.created_at),by:e.created_by?.name??(i.automatic?__(`Automatic update`):__(`Command line`))}}));return(e,t)=>(F(),j(`div`,_f,[P(z(Di),null,{default:B(()=>[P(z(Oi),null,{default:B(()=>[P(z(K),null,{default:B(()=>[N(R(e.__(`Status`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(e.__(`Content`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(e.__(`Sites`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(e.__(`Items finished`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(e.__(`Usage`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(e.__(`Created`)),1)]),_:1})]),_:1}),P(z(Ai),null,{default:B(()=>[(F(!0),j(m,null,L(r.value,t=>(F(),k(z(ki),{key:t.id,"data-tolk-run-row":``,"data-tolk-run-id":t.id},{default:B(()=>[P(z(G),null,{default:B(()=>[P(z(Kd),{href:t.url,class:`inline-flex`},{default:B(()=>[P(z(Pn),{text:z(ps)(t.status),color:z(ms)(t.status)},null,8,[`text`,`color`])]),_:2},1032,[`href`])]),_:2},1024),P(z(G),null,{default:B(()=>[P(z(Kd),{href:t.url,class:`text-blue-600 hover:underline dark:text-blue-400`},{default:B(()=>[N(R(t.what),1)]),_:2},1032,[`href`]),t.automatic?(F(),k(z(U),{key:0,"data-tolk-run-automatic":``},{default:B(()=>[N(R(e.__(`Automatic update`)),1)]),_:1})):A(``,!0)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(t.sites),1)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(t.progress)+` `,1),t.failed>0?(F(),k(z(U),{key:0},{default:B(()=>[N(R(e.__n(`:count failed|:count failed`,t.failed)),1)]),_:2},1024)):A(``,!0)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(e.__(`:tokens tokens`,{tokens:z(Q)(t.tokens)}))+` `,1),P(z(U),null,{default:B(()=>[N(R(t.cost===null?e.__(`Cost unknown`):z(ys)(t.cost)),1)]),_:2},1024)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(t.date)+` `,1),P(z(U),null,{default:B(()=>[N(R(t.by),1)]),_:2},1024)]),_:2},1024)]),_:2},1032,[`data-tolk-run-id`]))),128))]),_:1})]),_:1})]))}};function yf({scan:e,onChange:t=()=>{},concurrency:n=3}){let r=[],i=0,a=0,o=!1;function s(e){return e.generation===a}function c(){for(;i0;)l(r.shift())}async function l(n){i++,t(n.cell.key,{status:`loading`});try{let r=null;do{let i=await e({...n.cell,cursor:r,fresh:n.fresh});if(!s(n))return;r=i.cursor??null,t(n.cell.key,{...i,status:r===null?`done`:`loading`})}while(r!==null)}catch(e){s(n)&&t(n.cell.key,{status:`failed`,error:e?.message??String(e)})}finally{i--,c()}}function u(){a++,r=[]}function d(e,n){for(let i of e)r.push({cell:i,fresh:n,generation:a}),t(i.key,{status:`waiting`});c()}return{load(e,t={}){u(),o=t.fresh??!1,d(e,o)},retry(e){d([e],o)},stop:u,get active(){return i}}}var bf=[`entry`,`term`,`globals`,`nav`],xf=[`missing`,`untranslated`,`outdated`,`attention`,`current`],Sf={entry:`collections`,term:`taxonomies`,globals:`globals`,nav:`navs`};function Cf(e){return e===`current`?__(`Current`):sa(e)}function wf(e){return{entry:__(`Collections`),term:__(`Taxonomies`),globals:__(`Global sets`),nav:__(`Navigation`)}[e]??e}function Tf(e,t,n){return`${e}|${t}|${n}`}function Ef(e,t){let n=new Set((Array.isArray(e)?e:[]).flatMap(e=>e.sites??[]));return(Array.isArray(t)?t:[]).filter(e=>n.has(e.handle))}function Df(e){let t=Array.isArray(e)?e:[];return bf.map(e=>({type:e,label:wf(e),rows:t.filter(t=>t.type===e)})).filter(e=>e.rows.length>0)}function Of(e,t){return{key:Tf(e.type,e.handle,t),type:e.type,container:e.handle,site:t}}function kf(e){return(Array.isArray(e)?e:[]).flatMap(e=>(e.sites??[]).map(t=>Of(e,t)))}function Af(e){let t=Y(e?.counts),n=e=>Number(t[e])||0;return{counts:Object.fromEntries(xf.map(e=>[e,n(e)])),untracked:Number(e?.untracked)||0,unreadable:Number(e?.unreadable)||0,scanned:Number(e?.scanned)||0,missing:n(`missing`)+n(`untranslated`),outdated:n(`outdated`)}}function jf(e){let t=Af(e);return{...t,badges:xf.filter(e=>t.counts[e]>0).map(e=>({status:e,text:`${Cf(e)} ${t.counts[e]}`,color:oa(e)})),finished:e?.status===`done`,loading:e?.status===`waiting`||e?.status===`loading`,failed:e?.status===`failed`,error:e?.error??null}}function Mf(e,t,n,r){return{sites:[n],[Sf[e]]:[t],options:{mode:r}}}function Nf(e,t,n){let r={};for(let i of Array.isArray(e)?e:[]){if(!(i.sites??[]).includes(n))continue;let e=Y(t)[Tf(i.type,i.handle,n)];(e?.status!==`done`||Af(e).missing!==0)&&(r[Sf[i.type]]??=[]).push(i.handle)}return Object.keys(r).length>0?{sites:[n],...r,options:{mode:`missing`}}:null}function Pf({multisite:e,providers:t,fakeEngine:n}){return e?(Array.isArray(t)?t:[]).some(e=>e.configured)||n?null:`no_provider`:`single_site`}function Ff(e){let t=Y(e?.labels),n=Object.entries(Y(e?.models)).map(([e,n])=>({reference:e,model:t[e]??e,calls:Number(n?.calls)||0,input:Number(n?.input)||0,output:Number(n?.output)||0,cost:n?.cost===null||n?.cost===void 0?null:Number(n.cost),sources:Object.keys(Y(n?.sources))}));return{month:e?.month??``,rows:n,calls:n.reduce((e,t)=>e+t.calls,0),cost:n.some(e=>e.cost===null)?null:n.reduce((e,t)=>e+t.cost,0)}}function If(e){return{editor:__(`Editor`),run:__(`Runs`),cli:__(`Command line`),auto:__(`Automatic updates`)}[e]??e}function Lf(e,t=void 0){let n=/^(\d{4})-(\d{2})$/.exec(e??``);return n?new Intl.DateTimeFormat(t,{month:`long`,year:`numeric`}).format(Date.UTC(n[1],n[2]-1,15)):``}var Rf={class:`mx-auto max-w-page space-y-6`,"data-tolk-overview":``},zf={class:`flex flex-wrap gap-4 text-sm`},Bf=[`href`],Vf={class:`overflow-x-auto`},Hf={class:`flex flex-col items-start gap-1`},Uf={key:1,class:`space-y-1.5`},Wf={key:0,class:`flex flex-wrap gap-1`},Gf={key:5,class:`space-y-1`},Kf={key:6,class:`flex flex-wrap gap-1`},qf={class:`grid gap-6 lg:grid-cols-2`},Jf={class:`flex flex-wrap items-center justify-between gap-2`},Yf={class:`overflow-x-auto`},Xf={class:`space-y-2`},Zf=[`data-tolk-provider`],Qf=[`href`],$f={class:`flex flex-wrap items-baseline justify-between gap-2`},ep={__name:`Overview`,props:{multisite:{type:Boolean,default:!1},sites:{type:Array,default:()=>[]},rows:{type:Array,default:()=>[]},providers:{type:Array,default:()=>[]},fakeEngine:{type:Boolean,default:!1},usage:{type:Object,default:()=>({})},canResetUsage:{type:Boolean,default:!1},runs:{type:Array,default:()=>[]},urls:{type:Object,required:!0}},setup(e){let t=e,n=Dt({}),r=I(null),i=I(t.usage),a=I(!1),o=I(!1),s=Statamic.$config.get(`tolk`)?.settingsUrl??null,c=O(()=>Pf(t)),l=O(()=>Ef(t.rows,t.sites)),u=O(()=>Df(t.rows).map(e=>({...e,rows:e.rows.map(e=>({...e,cells:l.value.map(t=>{let r=Of(e,t.handle),i=e.sites.includes(t.handle),a=n[r.key];return{site:t,cell:r,status:i?a?.status??`waiting`:`none`,view:i?jf(a):null}})}))}))),d=O(()=>kf(t.rows)),f=O(()=>Ff(i.value)),p=O(()=>Object.values(n).some(e=>Number(e?.untracked)>0)),h=O(()=>Object.values(n).some(e=>Number(e?.unreadable)>0)),g=O(()=>Object.fromEntries(l.value.map(e=>[e.handle,Nf(t.rows,n,e.handle)]))),_=yf({scan:({key:e,...n})=>$i(t.urls.scan,n),onChange:(e,t)=>n[e]=t});pt(()=>{c.value===null&&_.load(d.value)}),lt(()=>_.stop());function v(){_.load(d.value,{fresh:!0})}async function y(e,n){r.value=e;try{let{url:e}=await $i(t.urls.store,n);_.stop(),qd.visit(e)}catch(e){Statamic.$toast.error(e.message),r.value=null}}async function b(){let e=Lf(f.value.month);a.value=!1,o.value=!0;try{i.value=(await $i(t.urls.resetUsage,{month:f.value.month})).usage,Statamic.$toast.success(__(`The usage of :month was reset.`,{month:e}))}catch(e){Statamic.$toast.error(e.message)}finally{o.value=!1}}return(t,n)=>(F(),j(`div`,Rf,[P(z(Gd),{title:t.__(`Translations`)},null,8,[`title`]),P(z(br),{title:t.__(`Translations`),icon:`dictionary-language-book`},{default:B(()=>[P(z(Kd),{href:e.urls.runs,class:`text-sm text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200`,"data-tolk-runs-link":``},{default:B(()=>[N(R(t.__(`All runs`)),1)]),_:1},8,[`href`]),c.value===null&&d.value.length>0?(F(),k(z(V),{key:0,text:t.__(`Count again`),icon:`sync`,"data-tolk-count-again":``,onClick:v},null,8,[`text`])):A(``,!0)]),_:1},8,[`title`]),c.value===`single_site`?(F(),k(z(H),{key:0,class:`space-y-3`,"data-tolk-overview-empty":`single_site`},{default:B(()=>[P(z(W),{size:`lg`,text:t.__(`This site has one language`)},null,8,[`text`]),P(z(q),null,{default:B(()=>[N(R(t.__(`Tolk translates the content of one site into the languages of the others. Add a site for each language in Statamic first; the overview then shows what is translated into each.`)),1)]),_:1}),P(z(Kd),{href:e.urls.audit,class:`text-sm text-blue-600 hover:underline dark:text-blue-400`,"data-tolk-audit-link":``},{default:B(()=>[N(R(t.__(`Check the setup`)),1)]),_:1},8,[`href`])]),_:1})):c.value===`no_provider`?(F(),k(z(H),{key:1,class:`space-y-3`,"data-tolk-overview-empty":`no_provider`},{default:B(()=>[P(z(W),{size:`lg`,text:t.__(`No AI provider is set up`)},null,8,[`text`]),P(z(q),null,{default:B(()=>[N(R(t.__(`Tolk needs an API key of Anthropic, OpenAI or Google Gemini in the .env file before it can translate. The settings list the variables to set.`)),1)]),_:1}),M(`div`,zf,[z(s)?(F(),j(`a`,{key:0,href:z(s),class:`text-blue-600 hover:underline dark:text-blue-400`,"data-tolk-settings-link":``},R(t.__(`Open the settings`)),9,Bf)):A(``,!0),P(z(Kd),{href:e.urls.audit,class:`text-blue-600 hover:underline dark:text-blue-400`,"data-tolk-audit-link":``},{default:B(()=>[N(R(t.__(`Check the setup`)),1)]),_:1},8,[`href`])])]),_:1})):e.rows.length===0?(F(),k(z(H),{key:2,"data-tolk-overview-nothing":``},{default:B(()=>[P(z(q),null,{default:B(()=>[N(R(t.__(`No collection, taxonomy, global set or navigation has more than one site yet, so there is nothing to translate.`)),1)]),_:1})]),_:1})):(F(),k(z(H),{key:3,class:`space-y-3`,"data-tolk-matrix":``},{default:B(()=>[M(`div`,Vf,[P(z(Di),null,{default:B(()=>[P(z(Oi),null,{default:B(()=>[P(z(K),null,{default:B(()=>[N(R(t.__(`Content`)),1)]),_:1}),(F(!0),j(m,null,L(l.value,e=>(F(),k(z(K),{key:e.handle,"data-tolk-column":e.handle},{default:B(()=>[M(`div`,Hf,[M(`span`,null,R(e.name),1),g.value[e.handle]?(F(),k(z(V),{key:0,size:`xs`,text:t.__(`Translate everything missing`),"aria-label":t.__(`Translate everything missing into :site`,{site:e.name}),loading:r.value===`site|${e.handle}`,disabled:r.value!==null,"data-tolk-site-action":e.handle,onClick:t=>y(`site|${e.handle}`,g.value[e.handle])},null,8,[`text`,`aria-label`,`loading`,`disabled`,`data-tolk-site-action`,`onClick`])):A(``,!0)])]),_:2},1032,[`data-tolk-column`]))),128))]),_:1}),P(z(Ai),null,{default:B(()=>[(F(!0),j(m,null,L(u.value,e=>(F(),j(m,{key:e.type},[P(z(ki),{"data-tolk-group":e.type},{default:B(()=>[P(z(G),{colspan:l.value.length+1,class:`bg-gray-50 dark:bg-gray-900`},{default:B(()=>[P(z(W),{text:e.label},null,8,[`text`])]),_:2},1032,[`colspan`])]),_:2},1032,[`data-tolk-group`]),(F(!0),j(m,null,L(e.rows,e=>(F(),k(z(ki),{key:`${e.type}|${e.handle}`,"data-tolk-row":`${e.type}|${e.handle}`},{default:B(()=>[P(z(G),null,{default:B(()=>[P(z(q),null,{default:B(()=>[N(R(e.title),1)]),_:2},1024),P(z(U),null,{default:B(()=>[N(R(e.handle),1)]),_:2},1024)]),_:2},1024),(F(!0),j(m,null,L(e.cells,({site:i,cell:a,status:o,view:s})=>(F(),k(z(G),{key:i.handle,class:`align-top`,"data-tolk-cell":a.key,"data-tolk-cell-status":o},{default:B(()=>[s?(F(),j(`div`,Uf,[s.badges.length?(F(),j(`div`,Wf,[(F(!0),j(m,null,L(s.badges,e=>(F(),k(z(Pn),{key:e.status,text:e.text,color:e.color,"data-tolk-count":e.status},null,8,[`text`,`color`,`data-tolk-count`]))),128))])):A(``,!0),s.loading?(F(),k(z(U),{key:1},{default:B(()=>[N(R(t.__(`Counting…`)),1)]),_:1})):s.finished&&s.scanned===0?(F(),k(z(U),{key:2},{default:B(()=>[N(R(t.__(`Nothing to translate`)),1)]),_:1})):A(``,!0),s.untracked>0?(F(),k(z(U),{key:3,"data-tolk-untracked":``},{default:B(()=>[N(R(t.__n(`:count untracked field|:count untracked fields`,s.untracked)),1)]),_:2},1024)):A(``,!0),s.unreadable>0?(F(),k(z(U),{key:4,"data-tolk-unreadable":``},{default:B(()=>[N(R(t.__n(`:count item with unreadable state|:count items with unreadable state`,s.unreadable)),1)]),_:2},1024)):A(``,!0),s.failed?(F(),j(`div`,Gf,[P(z(q),{size:`sm`,variant:`danger`,"data-tolk-cell-error":``},{default:B(()=>[N(R(s.error),1)]),_:2},1024),P(z(V),{size:`xs`,text:t.__(`Try again`),"data-tolk-cell-retry":``,onClick:e=>z(_).retry(a)},null,8,[`text`,`onClick`])])):A(``,!0),s.missing>0||s.outdated>0?(F(),j(`div`,Kf,[s.missing>0?(F(),k(z(V),{key:0,size:`xs`,text:t.__(`Translate missing`),"aria-label":t.__(`Translate missing :content into :site`,{content:e.title,site:i.name}),loading:r.value===`${a.key}|missing`,disabled:r.value!==null,"data-tolk-cell-action":`missing`,onClick:t=>y(`${a.key}|missing`,z(Mf)(e.type,e.handle,i.handle,`missing`))},null,8,[`text`,`aria-label`,`loading`,`disabled`,`onClick`])):A(``,!0),s.outdated>0?(F(),k(z(V),{key:1,size:`xs`,text:t.__(`Update outdated`),"aria-label":t.__(`Update outdated :content in :site`,{content:e.title,site:i.name}),loading:r.value===`${a.key}|update`,disabled:r.value!==null,"data-tolk-cell-action":`update`,onClick:t=>y(`${a.key}|update`,z(Mf)(e.type,e.handle,i.handle,`update`))},null,8,[`text`,`aria-label`,`loading`,`disabled`,`onClick`])):A(``,!0)])):A(``,!0)])):(F(),k(z(U),{key:0},{default:B(()=>[...n[2]||=[N(`—`,-1)]]),_:1}))]),_:2},1032,[`data-tolk-cell`,`data-tolk-cell-status`]))),128))]),_:2},1032,[`data-tolk-row`]))),128))],64))),128))]),_:1})]),_:1})]),p.value?(F(),k(z(U),{key:0,"data-tolk-baseline-hint":``},{default:B(()=>[N(R(t.__(`Untracked fields were translated by hand without a record of their origin, so a change to the origin goes unnoticed. Run php please tolk:baseline to record the origin of each.`)),1)]),_:1})):A(``,!0),h.value?(F(),k(z(U),{key:1,"data-tolk-unreadable-hint":``},{default:B(()=>[N(R(t.__(`The translation state of some items cannot be read, so their status is unknown and translating them fails. Run php please tolk:doctor to list the files.`)),1)]),_:1})):A(``,!0)]),_:1})),M(`div`,qf,[P(z(H),{class:`space-y-3`,"data-tolk-usage":``},{default:B(()=>[M(`div`,Jf,[P(z(W),{size:`lg`,text:t.__(`Usage in :month`,{month:z(Lf)(f.value.month)})},null,8,[`text`]),e.canResetUsage&&f.value.rows.length>0?(F(),k(z(V),{key:0,size:`sm`,text:t.__(`Reset`),"aria-label":t.__(`Reset the usage of :month`,{month:z(Lf)(f.value.month)}),loading:o.value,"data-tolk-usage-reset":``,onClick:n[0]||=e=>a.value=!0},null,8,[`text`,`aria-label`,`loading`])):A(``,!0)]),f.value.rows.length===0?(F(),k(z(q),{key:0},{default:B(()=>[N(R(t.__(`No model was called this month.`)),1)]),_:1})):(F(),j(m,{key:1},[M(`div`,Yf,[P(z(Di),null,{default:B(()=>[P(z(Oi),null,{default:B(()=>[P(z(K),null,{default:B(()=>[N(R(t.__(`Model`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Calls`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Tokens`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Cost`)),1)]),_:1})]),_:1}),P(z(Ai),null,{default:B(()=>[(F(!0),j(m,null,L(f.value.rows,e=>(F(),k(z(ki),{key:e.reference,"data-tolk-usage-model":e.reference},{default:B(()=>[P(z(G),null,{default:B(()=>[N(R(e.model)+` `,1),P(z(U),null,{default:B(()=>[N(R(e.sources.map(z(If)).join(`, `)),1)]),_:2},1024)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(z(Q)(e.calls)),1)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(t.__(`:input in, :output out`,{input:z(Q)(e.input),output:z(Q)(e.output)})),1)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(e.cost===null?t.__(`Unknown`):z(ys)(e.cost)),1)]),_:2},1024)]),_:2},1032,[`data-tolk-usage-model`]))),128))]),_:1})]),_:1})]),P(z(U),{"data-tolk-usage-total":``},{default:B(()=>[N(R(f.value.cost===null?t.__n(`:calls call this month. The cost is unknown: a model without a price was called.|:calls calls this month. The cost is unknown: a model without a price was called.`,f.value.calls,{calls:z(Q)(f.value.calls)}):t.__n(`:calls call this month, an estimated :cost.|:calls calls this month, an estimated :cost.`,f.value.calls,{calls:z(Q)(f.value.calls),cost:z(ys)(f.value.cost)})),1)]),_:1})],64))]),_:1}),P(z(H),{class:`space-y-3`,"data-tolk-providers":``},{default:B(()=>[P(z(W),{size:`lg`,text:t.__(`Providers`)},null,8,[`text`]),M(`ul`,Xf,[(F(!0),j(m,null,L(e.providers,e=>(F(),j(`li`,{key:e.provider,class:`flex items-center justify-between gap-2`,"data-tolk-provider":e.provider},[P(z(q),null,{default:B(()=>[N(R(e.label),1)]),_:2},1024),P(z(Pn),tt({ref_for:!0},z(hd)(e.configured)),null,16)],8,Zf))),128))]),e.fakeEngine?(F(),k(z(U),{key:0,"data-tolk-fake-engine":``},{default:B(()=>[N(R(t.__(`The fake engine is on: translations are made up without calling a provider.`)),1)]),_:1})):A(``,!0),z(s)?(F(),j(`a`,{key:1,href:z(s),class:`text-sm text-blue-600 hover:underline dark:text-blue-400`},R(t.__(`Settings`)),9,Qf)):A(``,!0)]),_:1})]),P(z(H),{class:`space-y-3`,"data-tolk-latest-runs":``},{default:B(()=>[M(`div`,$f,[P(z(W),{size:`lg`,text:t.__(`Latest runs`)},null,8,[`text`]),e.runs.length>0?(F(),k(z(Kd),{key:0,href:e.urls.runs,class:`text-sm text-blue-600 hover:underline dark:text-blue-400`},{default:B(()=>[N(R(t.__(`All runs`)),1)]),_:1},8,[`href`])):A(``,!0)]),e.runs.length===0?(F(),k(z(q),{key:0},{default:B(()=>[N(R(t.__(`No translation runs yet.`)),1)]),_:1})):(F(),k(vf,{key:1,runs:e.runs},null,8,[`runs`]))]),_:1}),a.value?(F(),k(z(Kn),{key:4,open:``,danger:``,title:t.__(`Reset the usage of :month?`,{month:z(Lf)(f.value.month)}),"body-text":t.__(`The calls, tokens and costs counted this month are deleted, and counting starts again from zero. The runs keep their own usage.`),"button-text":t.__(`Reset`),"data-tolk-usage-reset-confirm":``,"onUpdate:open":n[1]||=e=>a.value=e,onConfirm:b},null,8,[`title`,`body-text`,`button-text`])):A(``,!0)]))}},tp={class:`mx-auto max-w-page space-y-6`,"data-tolk-runs":``},np={__name:`Index`,props:{runs:{type:Array,default:()=>[]},canReset:{type:Boolean,default:!1},urls:{type:Object,default:()=>({})}},setup(e){let t=e,n=I(!1),r=I(!1),i=O(()=>t.runs.some(e=>Vo.includes(e.status)));async function a(){n.value=!1,r.value=!0;try{let{deleted:e}=await $i(t.urls.reset);Statamic.$toast.success(__n(`:count run was deleted.|:count runs were deleted.`,e)),qd.reload({only:[`runs`]})}catch(e){Statamic.$toast.error(e.message)}finally{r.value=!1}}return(t,o)=>(F(),j(`div`,tp,[P(z(Gd),{title:t.__(`Translation runs`)},null,8,[`title`]),P(z(br),{title:t.__(`Translation runs`),icon:`dictionary-language-book`},{default:B(()=>[e.canReset&&i.value?(F(),k(z(V),{key:0,text:t.__(`Reset`),loading:r.value,"data-tolk-runs-reset":``,onClick:o[0]||=e=>n.value=!0},null,8,[`text`,`loading`])):A(``,!0)]),_:1},8,[`title`]),e.runs.length===0?(F(),k(z(H),{key:0,"data-tolk-runs-empty":``},{default:B(()=>[P(z(q),null,{default:B(()=>[N(R(t.__(`No translation runs yet. Runs started from a listing, the overview or the command line appear here.`)),1)]),_:1})]),_:1})):(F(),k(z(H),{key:1},{default:B(()=>[P(vf,{runs:e.runs},null,8,[`runs`])]),_:1})),n.value?(F(),k(z(Kn),{key:2,open:``,danger:``,title:t.__(`Delete the finished runs?`),"body-text":t.__(`Every completed, cancelled and aborted run is deleted with its results, and can no longer be resumed or retried. Pending and running runs stay. The translations they saved stay too.`),"button-text":t.__(`Delete`),"data-tolk-runs-reset-confirm":``,"onUpdate:open":o[1]||=e=>n.value=e,onConfirm:a},null,8,[`title`,`body-text`,`button-text`])):A(``,!0)]))}},rp=[`data-tolk-run-status`],ip={class:`flex flex-wrap items-center gap-2`},ap={class:`flex flex-wrap items-center gap-x-4 gap-y-1`,"data-tolk-run-counts":``},op={class:`space-y-3`},sp={class:`flex flex-wrap gap-2`},cp={class:`flex flex-wrap items-center justify-between gap-2`},lp={class:`space-y-3`},up={key:1,class:`flex flex-wrap gap-2`},dp={class:`grid gap-6 lg:grid-cols-2`},fp={class:`overflow-x-auto`},pp={class:`grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-sm`},mp={class:`text-gray-600 dark:text-gray-400`},hp=[`data-tolk-option`],gp={class:`flex flex-wrap items-baseline justify-between gap-2`},_p={key:0,class:`flex flex-wrap gap-x-10 gap-y-2 text-sm`},vp={class:`text-gray-600 dark:text-gray-400`},yp={"data-tolk-estimate-segments":``},bp={class:`text-gray-600 dark:text-gray-400`},xp={"data-tolk-estimate-chars":``},Sp={class:`text-gray-600 dark:text-gray-400`},Cp={"data-tolk-estimate-input":``},wp={class:`text-gray-600 dark:text-gray-400`},Tp={"data-tolk-estimate-output":``},Ep={class:`text-gray-600 dark:text-gray-400`},Dp={"data-tolk-estimate-cost":``},Op={class:`flex flex-wrap items-center justify-between gap-2`},kp={class:`w-56`},Ap={class:`overflow-x-auto`},jp=[`href`],Mp={key:1},Np={key:1,class:`flex flex-wrap items-center gap-2`},Pp=[`href`],Fp={key:1,class:`flex items-center justify-end gap-2`,"data-tolk-items-pages":``},Ip={__name:`Show`,props:{state:{type:Object,required:!0},urls:{type:Object,required:!0},models:{type:Object,default:()=>({})},lanes:{type:Number,default:1}},setup(e){let t=e,n=I(t.state),r=I(t.state.run?.estimate??null),i=I([]),a=I(null),o=I(t.state.pagination?.page??1),s=t.state.pagination?.per_page??50,c=I(`all`),l=vs(Statamic.$config.get(`sites`)),u=tc.following(t.state.run?.id),d=Ls({urls:t.urls,lanes:t.lanes,dirty:u?null:`tolk-run`,onState:e=>{n.value=e,r.value=e.run?.estimate??r.value,o.value=Is(o.value,e.pagination)},onEstimate:e=>r.value=e,onFailures:e=>i.value=e,query:()=>({page:o.value,per_page:s,...c.value===`all`?{}:{status:c.value}})});function f(e){d.driving&&(e.preventDefault(),e.returnValue=``)}let p=()=>{};pt(()=>{p=tc.lend(t.state.run?.id),d.follow(t.state),window.addEventListener(`beforeunload`,f)}),lt(()=>{d.stop(),p(n.value),window.removeEventListener(`beforeunload`,f)});let h=O(()=>n.value.run??{}),g=O(()=>h.value.status),_=O(()=>xs(n.value)),v=O(()=>Ss(n.value)),y=O(()=>ws(n.value)),b=O(()=>Os(h.value.scope,l)),x=O(()=>Ts(n.value.breakdown,l)),S=O(()=>Es(h.value.scope)),C=Kl(Statamic.$config.get(`tolk.auditUrl`)),w=O(()=>Ds(h.value.scope)),ee=O(()=>ks(h.value.options,t.models)),T=O(()=>As(r.value,_.value.total)),E=O(()=>js(h.value,t.models)),te=O(()=>(n.value.items??[]).map(e=>Fs(e,l))),D=O(()=>n.value.pagination??{page:1,last_page:1,total:0}),ne=O(()=>g.value===`running`&&h.value.driver===`browser`),re=O(()=>g.value===`running`&&!!n.value.stalled),ie=O(()=>ls.filter(e=>_.value.counts[e]>0).map(e=>({key:e,text:`${Q(_.value.counts[e])} ${hs(e).toLowerCase()}`}))),ae=O(()=>[{label:__(`All items`),value:`all`},...ls.map(e=>({label:hs(e),value:e}))]),oe=I(null),se=fu(()=>oe.value),ce=jc(),le=I([]);function ue(e){le.value=e.corrections,ce.show()}bn(g,()=>se.changing());let de=O(()=>{let e=h.value.created_by?.name,t=bs(h.value.created_at);return b.value.automatic?e?__(`Started automatically on :date, when :name saved the entry.`,{name:e,date:t}):__(`Started automatically on :date, when the entry was saved.`,{date:t}):e?__(`Created by :name on :date`,{name:e,date:t}):__(`Created on :date from the command line`,{date:t})});async function fe(e,t){let n=se.holds();a.value=e;try{let n=await t();e===`retry`&&n?.retried===0&&Statamic.$toast.info(__(`No item failed, so nothing was retried.`))}catch(e){Statamic.$toast.error(e.message)}finally{a.value=null,n&&nt(se.restore)}}async function pe(e){o.value=Math.max(1,e);try{await d.refresh()}catch(e){Statamic.$toast.error(e.message)}}function me(e){c.value=e??`all`,pe(1)}return(t,r)=>(F(),j(`div`,{ref_key:`root`,ref:oe,class:`mx-auto max-w-page space-y-6`,"data-tolk-run":``,"data-tolk-run-status":g.value},[P(z(Gd),{title:t.__(`Translation run`)},null,8,[`title`]),P(z(br),{title:t.__(`Translation run`),icon:`dictionary-language-book`},{default:B(()=>[P(z(Kd),{href:e.urls.index,class:`text-sm text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200`,"data-tolk-runs-link":``},{default:B(()=>[N(R(t.__(`All runs`)),1)]),_:1},8,[`href`]),v.value.cancel?(F(),k(z(V),{key:0,text:t.__(`Cancel`),loading:a.value===`cancel`,disabled:a.value!==null,"data-tolk-action":`cancel`,onClick:r[0]||=e=>fe(`cancel`,z(d).cancel)},null,8,[`text`,`loading`,`disabled`])):A(``,!0),v.value.start?(F(),k(z(V),{key:1,variant:`primary`,text:t.__(`Start`),loading:a.value===`start`,disabled:a.value!==null,"data-tolk-action":`start`,onClick:r[1]||=e=>fe(`start`,z(d).start)},null,8,[`text`,`loading`,`disabled`])):A(``,!0)]),_:1},8,[`title`]),P(z(H),{class:`space-y-3`,"data-tolk-run-summary":``},{default:B(()=>[M(`div`,ip,[P(z(Pn),{text:z(ps)(g.value),color:z(ms)(g.value),"data-tolk-run-status-badge":``},null,8,[`text`,`color`]),P(z(q),null,{default:B(()=>[N(R(b.value.sites?t.__(`:what into :sites`,{what:b.value.what,sites:b.value.sites}):b.value.what),1)]),_:1})]),P(z(U),null,{default:B(()=>[N(R(de.value),1)]),_:1}),g.value===`pending`?A(``,!0):(F(),j(m,{key:0},[P(Ba,{value:_.value.finished,max:_.value.total,label:t.__(`Run progress`)},null,8,[`value`,`max`,`label`]),M(`div`,ap,[P(z(q),null,{default:B(()=>[N(R(t.__(`:finished of :total items finished`,{finished:z(Q)(_.value.finished),total:z(Q)(_.value.total)})),1)]),_:1}),(F(!0),j(m,null,L(ie.value,e=>(F(),k(z(U),{key:e.key,"data-tolk-count":e.key},{default:B(()=>[N(R(e.text),1)]),_:2},1032,[`data-tolk-count`]))),128))]),P(z(U),{"data-tolk-run-usage":``},{default:B(()=>[N(R(t.__n(`:input input and :output output tokens in :calls call.|:input input and :output output tokens in :calls calls.`,E.value.calls,{input:z(Q)(E.value.input),output:z(Q)(E.value.output),calls:z(Q)(E.value.calls)}))+` `+R(E.value.cost===null?t.__(`The cost is unknown: a model without a price was called.`):t.__(`Estimated cost so far: :cost.`,{cost:z(ys)(E.value.cost)})),1)]),_:1})],64))]),_:1}),ne.value?(F(),k(z(jn),{key:0,variant:`default`,icon:`info`,"data-tolk-keep-open":``},{default:B(()=>[N(R(z(u)?t.__(`Keep this tab open while the run is in progress. Closing it pauses the run until you open it again.`):t.__(`Keep this page open while the run is in progress. Leaving it pauses the run until you open it again.`)),1)]),_:1})):A(``,!0),re.value?(F(),k(z(jn),{key:1,variant:`warning`,heading:t.__(`This run is not moving`),"data-tolk-stalled":``},{default:B(()=>[M(`div`,op,[h.value.driver===`cli`&&b.value.automatic?(F(),k(z(q),{key:0},{default:B(()=>[N(R(t.__(`The process that updates these translations has not worked on them for a while and may have stopped. Resume continues the run from here.`)),1)]),_:1})):h.value.driver===`cli`?(F(),k(z(q),{key:1},{default:B(()=>[N(R(t.__(`The command running this run has not worked on it for a while and may have stopped. Resume continues the run from here.`)),1)]),_:1})):(F(),k(z(q),{key:2},{default:B(()=>[N(R(t.__(`No queue worker has worked on this run for a while. Start a worker for the queue, or run it in this browser instead.`)),1)]),_:1})),M(`div`,sp,[P(z(V),{size:`sm`,text:t.__(`Resume`),loading:a.value===`resume`,disabled:a.value!==null,"data-tolk-action":`resume`,onClick:r[2]||=e=>fe(`resume`,z(d).resume)},null,8,[`text`,`loading`,`disabled`]),v.value.takeOver?(F(),k(z(V),{key:0,size:`sm`,variant:`primary`,text:t.__(`Run in this browser instead`),loading:a.value===`take-over`,disabled:a.value!==null,"data-tolk-action":`take-over`,onClick:r[3]||=e=>fe(`take-over`,z(d).takeOver)},null,8,[`text`,`loading`,`disabled`])):A(``,!0)])])]),_:1},8,[`heading`])):A(``,!0),(F(!0),j(m,null,L(i.value,(e,i)=>(F(),k(z(jn),{key:i,variant:`error`,"data-tolk-run-failure":``},{default:B(()=>[M(`div`,cp,[P(z(q),null,{default:B(()=>[N(R(t.__(`Following the run stopped: :message`,{message:e.error?.message??``})),1)]),_:2},1024),i===0?(F(),k(z(V),{key:0,size:`sm`,text:t.__(`Try again`),"data-tolk-action":`follow-again`,onClick:r[4]||=e=>z(d).follow(n.value)},null,8,[`text`])):A(``,!0)])]),_:2},1024))),128)),y.value?(F(),k(z(jn),{key:2,variant:y.value.variant,"data-tolk-run-result":``},{default:B(()=>[M(`div`,lp,[P(z(q),{as:`p`},{default:B(()=>[N(R(y.value.text),1)]),_:1}),y.value.error?(F(),k(z(q),{key:0,as:`p`,variant:`danger`},{default:B(()=>[N(R(y.value.error),1)]),_:1})):A(``,!0),v.value.retry||v.value.resume?(F(),j(`div`,up,[v.value.retry?(F(),k(z(V),{key:0,size:`sm`,text:t.__(`Retry failed`),loading:a.value===`retry`,disabled:a.value!==null,"data-tolk-action":`retry`,onClick:r[5]||=e=>fe(`retry`,z(d).retry)},null,8,[`text`,`loading`,`disabled`])):A(``,!0),v.value.resume?(F(),k(z(V),{key:1,size:`sm`,text:t.__(`Resume`),loading:a.value===`resume`,disabled:a.value!==null,"data-tolk-action":`resume`,onClick:r[6]||=e=>fe(`resume`,z(d).resume)},null,8,[`text`,`loading`,`disabled`])):A(``,!0)])):A(``,!0)])]),_:1},8,[`variant`])):A(``,!0),M(`div`,dp,[P(z(H),{class:`space-y-3`,"data-tolk-breakdown":``},{default:B(()=>[P(z(W),{size:`lg`,text:t.__(`What it translates`)},null,8,[`text`]),M(`div`,fp,[P(z(Di),null,{default:B(()=>[P(z(Oi),null,{default:B(()=>[P(z(K),null,{default:B(()=>[N(R(t.__(`Content`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Site`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Items`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Skipped`)),1)]),_:1})]),_:1}),P(z(Ai),null,{default:B(()=>[(F(!0),j(m,null,L(x.value,e=>(F(),k(z(ki),{key:e.key,"data-tolk-breakdown-row":e.key},{default:B(()=>[P(z(G),null,{default:B(()=>[N(R(e.type),1)]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(e.site),1)]),_:2},1024),P(z(G),{"data-tolk-breakdown-total":``},{default:B(()=>[N(R(z(Q)(e.total)),1)]),_:2},1024),P(z(G),{"data-tolk-breakdown-skipped":``},{default:B(()=>[N(R(z(Q)(e.skipped)),1)]),_:2},1024)]),_:2},1032,[`data-tolk-breakdown-row`]))),128))]),_:1})]),_:1})]),x.value.length===0?(F(),k(z(U),{key:0},{default:B(()=>[N(R(t.__(`This run has nothing to translate.`)),1)]),_:1})):A(``,!0),(F(!0),j(m,null,L(S.value,e=>(F(),k(z(U),{key:e.reason,"data-tolk-left-out":e.reason},{default:B(()=>[N(R(e.text),1)]),_:2},1032,[`data-tolk-left-out`]))),128)),w.value?(F(),k(z(U),{key:1,"data-tolk-not-localizable":``},{default:B(()=>[N(R(w.value)+` `,1),z(C)?(F(),k(z(Kd),{key:0,href:z(C),class:`text-blue-600 hover:underline dark:text-blue-400`,"data-tolk-audit-link":``},{default:B(()=>[N(R(t.__(`Open the setup audit`)),1)]),_:1},8,[`href`])):(F(),j(m,{key:1},[N(R(t.__(`Run php please tolk:doctor for details.`)),1)],64))]),_:1})):A(``,!0)]),_:1}),P(z(H),{class:`space-y-3`,"data-tolk-settings":``},{default:B(()=>[P(z(W),{size:`lg`,text:t.__(`Settings`)},null,8,[`text`]),M(`dl`,pp,[(F(!0),j(m,null,L(ee.value,e=>(F(),j(m,{key:e.key},[M(`dt`,mp,R(e.label),1),M(`dd`,{"data-tolk-option":e.key},R(e.value),9,hp)],64))),128))])]),_:1})]),g.value===`pending`||T.value?(F(),k(z(H),{key:3,class:`space-y-3`,"data-tolk-estimate":``,"data-tolk-estimate-finished":T.value?.finished?`true`:`false`},{default:B(()=>[M(`div`,gp,[P(z(W),{size:`lg`,text:t.__(`Estimate`)},null,8,[`text`]),T.value?!T.value.finished&&g.value===`pending`?(F(),k(z(U),{key:1},{default:B(()=>[N(R(t.__(`Estimating… :progress`,{progress:T.value.progress})),1)]),_:1})):T.value.finished?A(``,!0):(F(),k(z(U),{key:2,"data-tolk-estimate-partial":``},{default:B(()=>[N(R(T.value.partial),1)]),_:1})):(F(),k(z(U),{key:0},{default:B(()=>[N(R(t.__(`Estimating…`)),1)]),_:1}))]),T.value?(F(),j(`dl`,_p,[M(`div`,null,[M(`dt`,vp,R(t.__(`Segments`)),1),M(`dd`,yp,R(z(Q)(T.value.segments)),1)]),M(`div`,null,[M(`dt`,bp,R(t.__(`Characters`)),1),M(`dd`,xp,R(z(Q)(T.value.chars)),1)]),M(`div`,null,[M(`dt`,Sp,R(t.__(`Input tokens`)),1),M(`dd`,Cp,R(z(Q)(T.value.inputTokens)),1)]),M(`div`,null,[M(`dt`,wp,R(t.__(`Output tokens`)),1),M(`dd`,Tp,R(z(Q)(T.value.outputTokens)),1)]),M(`div`,null,[M(`dt`,Ep,R(t.__(`Cost`)),1),M(`dd`,Dp,R(T.value.cost===null?t.__(`Unknown`):z(ys)(T.value.cost)),1)])])):A(``,!0),P(z(U),null,{default:B(()=>[N(R(t.__(`An estimate: the tokens a language takes vary, and so does what a model writes.`))+` `,1),T.value&&T.value.cost===null?(F(),j(m,{key:0},[N(R(t.__(`The cost is unknown because a model has no price.`)),1)],64)):A(``,!0)]),_:1})]),_:1},8,[`data-tolk-estimate-finished`])):A(``,!0),P(z(H),{class:`space-y-3`,"data-tolk-items":``},{default:B(()=>[M(`div`,Op,[P(z(W),{size:`lg`,text:t.__(`Items`)},null,8,[`text`]),M(`div`,kp,[P(z(di),{"model-value":c.value,options:ae.value,size:`sm`,"data-tolk-items-filter":``,"onUpdate:modelValue":me},null,8,[`model-value`,`options`])])]),M(`div`,Ap,[P(z(Di),null,{default:B(()=>[P(z(Oi),null,{default:B(()=>[P(z(K),null,{default:B(()=>[N(R(t.__(`Title`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Site`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Status`)),1)]),_:1}),P(z(K),null,{default:B(()=>[N(R(t.__(`Result`)),1)]),_:1})]),_:1}),P(z(Ai),null,{default:B(()=>[(F(!0),j(m,null,L(te.value,e=>(F(),k(z(ki),{key:e.index,"data-tolk-item":``,"data-tolk-item-status":e.status},{default:B(()=>[P(z(G),null,{default:B(()=>[e.editUrl?(F(),j(`a`,{key:0,href:e.editUrl,class:`text-blue-600 hover:underline dark:text-blue-400`},R(e.title),9,jp)):(F(),j(`span`,Mp,R(e.title),1))]),_:2},1024),P(z(G),null,{default:B(()=>[N(R(e.site),1)]),_:2},1024),P(z(G),null,{default:B(()=>[P(z(Pn),{text:e.statusLabel,color:e.statusColor},null,8,[`text`,`color`])]),_:2},1024),P(z(G),{class:`space-y-1`},{default:B(()=>[e.applied?(F(),k(z(q),{key:0,size:`sm`},{default:B(()=>[N(R(e.applied),1)]),_:2},1024)):A(``,!0),e.corrections.length?(F(),j(`div`,Np,[P(z(q),{size:`sm`},{default:B(()=>[N(R(e.corrected),1)]),_:2},1024),P(z(V),{size:`sm`,variant:`ghost`,text:t.__(`View changes`),"aria-label":t.__(`View changes to :title in :site`,{title:e.title,site:e.site}),"data-tolk-item-changes":``,onClick:t=>ue(e)},null,8,[`text`,`aria-label`,`onClick`])])):A(``,!0),e.incomplete.length?(F(),k(z(U),{key:2},{default:B(()=>[N(R(t.__(`Left incomplete: :fields`,{fields:e.incomplete.join(`, `)})),1)]),_:2},1024)):A(``,!0),e.failed.length?(F(),k(z(U),{key:3,"data-tolk-item-failed":``},{default:B(()=>[N(R(t.__(`Could not be translated: :fields`,{fields:e.failed.map(e=>`${e.handle} (${e.reason})`).join(`, `)})),1)]),_:2},1024)):A(``,!0),e.notReviewed.length?(F(),k(z(U),{key:4},{default:B(()=>[N(R(t.__(`Not reviewed in full: :fields`,{fields:e.notReviewed.join(`, `)})),1)]),_:2},1024)):A(``,!0),e.kept.length?(F(),k(z(U),{key:5},{default:B(()=>[N(R(t.__(`Not changed: :fields`,{fields:e.kept.map(e=>`${e.handle} (${e.reason})`).join(`, `)})),1)]),_:2},1024)):A(``,!0),e.reason?(F(),k(z(U),{key:6},{default:B(()=>[N(R(e.reason),1)]),_:2},1024)):A(``,!0),e.error?(F(),k(z(q),{key:7,size:`sm`,variant:`danger`,"data-tolk-item-error":``},{default:B(()=>[N(R(e.error)+` `,1),e.rootPage?(F(),j(`a`,{key:0,href:e.rootPage.url,class:`text-blue-600 hover:underline dark:text-blue-400`,"data-tolk-root-page":``},R(t.__(`Open :title`,{title:e.rootPage.title})),9,Pp)):A(``,!0)]),_:2},1024)):A(``,!0),(F(!0),j(m,null,L(e.warnings,(e,t)=>(F(),k(z(U),{key:t},{default:B(()=>[N(R(e),1)]),_:2},1024))),128))]),_:2},1024)]),_:2},1032,[`data-tolk-item-status`]))),128))]),_:1})]),_:1})]),te.value.length===0?(F(),k(z(U),{key:0},{default:B(()=>[N(R(t.__(`No items.`)),1)]),_:1})):A(``,!0),D.value.last_page>1?(F(),j(`div`,Fp,[P(z(U),null,{default:B(()=>[N(R(t.__(`Page :page of :pages`,{page:D.value.page,pages:D.value.last_page})),1)]),_:1}),P(z(V),{size:`sm`,icon:`chevron-left`,"aria-label":t.__(`Previous page`),disabled:D.value.page<=1,onClick:r[7]||=e=>pe(D.value.page-1)},null,8,[`aria-label`,`disabled`]),P(z(V),{size:`sm`,icon:`chevron-right`,"aria-label":t.__(`Next page`),disabled:D.value.page>=D.value.last_page,onClick:r[8]||=e=>pe(D.value.page+1)},null,8,[`aria-label`,`disabled`])])):A(``,!0),z(ce).open?(F(),k(Ra,{key:2,modal:z(ce),corrections:le.value},null,8,[`modal`,`corrections`])):A(``,!0)]),_:1})],8,rp))}};Statamic.booting(()=>{Statamic.$components.register(wc,Iu),Statamic.$components.register(zu,Ru),Statamic.$components.register(`tolk_model-fieldtype`,pd),Statamic.$components.register(`tolk_providers-fieldtype`,Cd),Statamic.$components.register(`tolk_site_profile-fieldtype`,Ud),Statamic.$inertia.register(`tolk::Audit`,gf),Statamic.$inertia.register(`tolk::Overview`,ep),Statamic.$inertia.register(`tolk::Runs/Index`,np),Statamic.$inertia.register(`tolk::Runs/Show`,Ip),Ha.listen(),kc.listen(),ol.listen(),ou({PipelineStopped:a}).listen(),Hu.register()}); \ No newline at end of file diff --git a/resources/dist/build/manifest.json b/resources/dist/build/manifest.json index 07281e2..d3d1f5b 100644 --- a/resources/dist/build/manifest.json +++ b/resources/dist/build/manifest.json @@ -1,6 +1,6 @@ { "resources/css/cp.css": { - "file": "assets/cp-DwecAxz4.css", + "file": "assets/cp-Bpgkw0bR.css", "name": "cp", "names": [ "cp.css" @@ -9,7 +9,7 @@ "isEntry": true }, "resources/js/cp.js": { - "file": "assets/cp-CtqImns9.js", + "file": "assets/cp-C2SnXUZQ.js", "name": "cp", "src": "resources/js/cp.js", "isEntry": true diff --git a/resources/js/combobox.js b/resources/js/combobox.js new file mode 100644 index 0000000..9e02e4c --- /dev/null +++ b/resources/js/combobox.js @@ -0,0 +1,12 @@ +// Core's `shouldOpenDropdown` for a Combobox that takes typed values. Since Statamic 6.36 such a combobox opens its list +// when it gains the focus without a click (statamic/cms#15249), and the list puts the focus back into the field when it +// closes, which opens it again: Tab never leaves the field, and in a modal Esc closes the modal with the list. The list +// therefore opens only on a click, a key or typing, never while a focus event is dispatched. +export function opensOnRequest(event = globalThis.event) { + return event?.type !== 'focus'; +} + +// Core calls `shouldOpenDropdown(open)`, so the event is read here and not taken as an argument. +export function shouldOpenDropdown() { + return opensOnRequest(); +} diff --git a/resources/js/combobox.test.js b/resources/js/combobox.test.js new file mode 100644 index 0000000..db16b20 --- /dev/null +++ b/resources/js/combobox.test.js @@ -0,0 +1,31 @@ +import { afterEach, describe, expect, it, vi } from 'vitest'; +import { opensOnRequest, shouldOpenDropdown } from './combobox.js'; + +afterEach(() => { + vi.unstubAllGlobals(); +}); + +describe('opensOnRequest', () => { + it('refuses to open while a focus event is dispatched, and opens on a click, a key or typing', () => { + expect(opensOnRequest({ type: 'focus' })).toBe(false); + + for (const type of ['click', 'pointerdown', 'keydown', 'input']) { + expect(opensOnRequest({ type })).toBe(true); + } + }); + + it('opens outside an event, as when core opens the list itself', () => { + expect(opensOnRequest(undefined)).toBe(true); + }); +}); + +describe('shouldOpenDropdown', () => { + // Core passes `open`, which must not be taken for the event. + it('reads the event being dispatched, whatever core passes', () => { + vi.stubGlobal('event', { type: 'focus' }); + expect(shouldOpenDropdown(true)).toBe(false); + + vi.stubGlobal('event', { type: 'click' }); + expect(shouldOpenDropdown(true)).toBe(true); + }); +}); diff --git a/resources/js/components/OriginPush.vue b/resources/js/components/OriginPush.vue index ad95806..9d052fc 100644 --- a/resources/js/components/OriginPush.vue +++ b/resources/js/components/OriginPush.vue @@ -202,12 +202,14 @@ function reload() { >
{{ lead }} +
@@ -222,6 +224,7 @@ function reload() { v-model="review" :label="__('Review after translating')" :description="__('A second model checks each translation and corrects it before it is saved.')" + class="dark:[&_p]:text-gray-400!" />
diff --git a/resources/js/components/TranslateOptions.vue b/resources/js/components/TranslateOptions.vue index d0305f7..4640f1a 100644 --- a/resources/js/components/TranslateOptions.vue +++ b/resources/js/components/TranslateOptions.vue @@ -1,6 +1,7 @@