@verbaly/studio 0.56.0 → 0.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +0,0 @@
1
- // What a host needs to render the panel: the component itself is @verbaly/studio/Panel.svelte.
2
- export { applyState, health, toPanel, visible } from './model';
3
- export type { Cell, Filter, LocaleHealth, MessageState, Panel, RawState, Row } from './model';
4
- export { serverApi } from './api';
5
- export type {
6
- Added,
7
- Check,
8
- Health,
9
- Job,
10
- Plan,
11
- ReadResult,
12
- Saved,
13
- StudioApi,
14
- } from './api';
15
- export type { Answer } from './wire';
16
- export { preview } from './validate';
17
- export type { Preview } from './validate';
18
- export { FILTER, MARK_AS_READ, SIGNAL, STATE, UNDO } from './words';
@@ -1,150 +0,0 @@
1
- // The shapes the panel reads: StudioState restated, so the UI never imports Node code.
2
- export type MessageState = 'done' | 'draft' | 'missing' | 'broken';
3
-
4
- export interface Cell {
5
- locale: string;
6
- text: string;
7
- state: MessageState;
8
- issue?: string;
9
- signals: string[];
10
- }
11
-
12
- export interface Row {
13
- key: string;
14
- source: string;
15
- cells: Cell[];
16
- origins: string[];
17
- }
18
-
19
- export interface LocaleHealth {
20
- locale: string;
21
- source: boolean;
22
- total: number;
23
- done: number;
24
- draft: number;
25
- missing: number;
26
- broken: number;
27
- }
28
-
29
- export interface Panel {
30
- root: string;
31
- sourceLocale: string;
32
- locales: string[];
33
- rows: Row[];
34
- problems: { scope: string; message: string }[];
35
- }
36
-
37
- type Catalogs = Record<string, Record<string, unknown>>;
38
-
39
- export interface RawState {
40
- root: string;
41
- dir: string;
42
- sourceLocale: string;
43
- locales: string[];
44
- // include: [] means scanning is off, which is not the same as having found nothing
45
- scanning: boolean;
46
- catalogs: Catalogs;
47
- origins: Record<string, string[]>;
48
- drafts: Record<string, string[]>;
49
- triage: Record<string, Record<string, { signal: string; text: string }[]>>;
50
- check: { broken: { locale: string; key: string; severity: string; issue: string }[] };
51
- problems: { scope: string; message: string }[];
52
- }
53
-
54
- // a catalog arrives in the shape its file has, so the panel flattens it to read
55
- function flatten(tree: Record<string, unknown>, prefix = '', out: Record<string, string> = {}) {
56
- for (const [key, value] of Object.entries(tree)) {
57
- const path = prefix ? `${prefix}.${key}` : key;
58
- if (typeof value === 'string') out[path] = value;
59
- else if (value && typeof value === 'object' && !Array.isArray(value)) {
60
- flatten(value as Record<string, unknown>, path, out);
61
- }
62
- }
63
- return out;
64
- }
65
-
66
- export function toPanel(raw: RawState): Panel {
67
- const flat: Record<string, Record<string, string>> = {};
68
- for (const locale of raw.locales) flat[locale] = flatten(raw.catalogs[locale] ?? {});
69
-
70
- // the separator is the escape, never the byte: a raw NUL makes git call this file binary
71
- const broken = new Map<string, string>();
72
- for (const entry of raw.check.broken) {
73
- if (entry.severity === 'error') broken.set(`${entry.locale}\u0000${entry.key}`, entry.issue);
74
- }
75
- const drafts = new Map<string, Set<string>>();
76
- for (const [locale, keys] of Object.entries(raw.drafts)) drafts.set(locale, new Set(keys));
77
-
78
- const source = flat[raw.sourceLocale] ?? {};
79
- const targets = raw.locales.filter((locale) => locale !== raw.sourceLocale);
80
-
81
- const rows: Row[] = Object.keys(source).map((key) => ({
82
- key,
83
- source: source[key] ?? '',
84
- origins: raw.origins[key] ?? [],
85
- cells: targets.map((locale) => {
86
- const text = flat[locale]?.[key] ?? '';
87
- const issue = broken.get(`${locale}\u0000${key}`);
88
- const state: MessageState = issue
89
- ? 'broken'
90
- : !text
91
- ? 'missing'
92
- : drafts.get(locale)?.has(key)
93
- ? 'draft'
94
- : 'done';
95
- const signals = (raw.triage?.[locale]?.[key] ?? []).map((reason) => reason.signal);
96
- return { locale, text, state, issue, signals };
97
- }),
98
- }));
99
-
100
- return {
101
- root: raw.root,
102
- sourceLocale: raw.sourceLocale,
103
- locales: raw.locales,
104
- rows,
105
- problems: raw.problems,
106
- };
107
- }
108
-
109
- // a projection of the rows, never stored: a saved cell has to move the rail in the same breath
110
- export function health(panel: Panel): LocaleHealth[] {
111
- return panel.locales.map((locale) => {
112
- const total = panel.rows.length;
113
- if (locale === panel.sourceLocale) {
114
- return { locale, source: true, total, done: total, draft: 0, missing: 0, broken: 0 };
115
- }
116
- const count = { done: 0, draft: 0, missing: 0, broken: 0 };
117
- for (const row of panel.rows) {
118
- const cell = row.cells.find((c) => c.locale === locale);
119
- if (cell) count[cell.state]++;
120
- }
121
- return { locale, source: false, total, ...count };
122
- });
123
- }
124
-
125
- // A command rewrote the catalogs, so every row comes back rather than being patched key by key.
126
- export function applyState(panel: Panel, raw: RawState): void {
127
- Object.assign(panel, toPanel(raw));
128
- }
129
-
130
- export interface Filter {
131
- text: string;
132
- state: MessageState | 'all' | 'look';
133
- locales: string[];
134
- }
135
-
136
- // One pass over every row: measured at 0.9 ms on 1573 messages, so nothing here is memoized.
137
- export function visible(rows: Row[], filter: Filter): Row[] {
138
- const needle = filter.text.trim().toLowerCase();
139
- const shown = new Set(filter.locales);
140
- return rows.filter((row) => {
141
- const cells = row.cells.filter((cell) => shown.has(cell.locale));
142
- if (filter.state === 'look' && !cells.some((cell) => cell.signals.length)) return false;
143
- if (filter.state !== 'all' && filter.state !== 'look') {
144
- if (!cells.some((cell) => cell.state === filter.state)) return false;
145
- }
146
- if (!needle) return true;
147
- if (row.source.toLowerCase().includes(needle)) return true;
148
- return cells.some((cell) => cell.text.toLowerCase().includes(needle));
149
- });
150
- }
@@ -1,106 +0,0 @@
1
- /* The Studio's own layer, on one class: a host puts it on a wrapper, the command on <html>. */
2
- .verbaly-studio {
3
- --paper: #f8fbf7;
4
- --ground: #eff4ee;
5
- --hollow: #e5ede4;
6
- --rule: #d7dfd5;
7
- --rule-strong: #828d80;
8
- --muted: #636c61;
9
- --body: #374036;
10
- --ink: #061005;
11
- /* the bar never turns: lime on paper is 1.2:1 and the one brand colour cannot vanish on a theme */
12
- --bar: #131e12;
13
- --on-bar: #f8fbf7;
14
-
15
- --broken: #b43931;
16
- --broken-tint: #eee0db;
17
- --missing: #8e5a04;
18
- --missing-tint: #e9e4d5;
19
- --draft: #2267ad;
20
- --draft-tint: #dae6ed;
21
- --done: #2e7428;
22
- --done-tint: #dce8da;
23
-
24
- --sans: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
25
- --serif: 'Newsreader', ui-serif, Georgia, 'Times New Roman', serif;
26
- --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
27
-
28
- --rail: 232px;
29
- --radius: 6px;
30
- }
31
-
32
- /* The panel had a dark palette and no way to reach it, so it opened light on a dark machine. */
33
- @media (prefers-color-scheme: dark) {
34
- .verbaly-studio:not([data-theme='light']) {
35
- --paper: #10170f;
36
- --ground: #161e15;
37
- --hollow: #1d271c;
38
- --rule: #2a352a;
39
- --rule-strong: #6f7a6d;
40
- --muted: #9aa598;
41
- --body: #d3dbd1;
42
- --ink: #f2f7f1;
43
-
44
- --broken: #f08a82;
45
- --broken-tint: #3a211f;
46
- --missing: #dcae4e;
47
- --missing-tint: #352c16;
48
- --draft: #7db6e8;
49
- --draft-tint: #172a3a;
50
- --done: #79c46f;
51
- --done-tint: #182c16;
52
- }
53
- }
54
-
55
- /* an embedder sets the attribute, which is why it wins over the machine in both directions */
56
- .verbaly-studio[data-theme='dark'] {
57
- --paper: #10170f;
58
- --ground: #161e15;
59
- --hollow: #1d271c;
60
- --rule: #2a352a;
61
- --rule-strong: #6f7a6d;
62
- --muted: #9aa598;
63
- --body: #d3dbd1;
64
- --ink: #f2f7f1;
65
-
66
- --broken: #f08a82;
67
- --broken-tint: #3a211f;
68
- --missing: #dcae4e;
69
- --missing-tint: #352c16;
70
- --draft: #7db6e8;
71
- --draft-tint: #172a3a;
72
- --done: #79c46f;
73
- --done-tint: #182c16;
74
- }
75
-
76
- .verbaly-studio,
77
- .verbaly-studio *,
78
- .verbaly-studio *::before,
79
- .verbaly-studio *::after {
80
- box-sizing: border-box;
81
- }
82
-
83
- .verbaly-studio {
84
- color: var(--body);
85
- font-family: var(--sans);
86
- font-size: 14px;
87
- line-height: 1.5;
88
- -webkit-font-smoothing: antialiased;
89
- }
90
-
91
- .verbaly-studio code,
92
- .verbaly-studio kbd {
93
- font-family: var(--mono);
94
- font-size: 0.92em;
95
- }
96
-
97
- /* Nothing loops and nothing moves on its own: only what reports a real process animates. */
98
- @media (prefers-reduced-motion: reduce) {
99
- .verbaly-studio,
100
- .verbaly-studio *,
101
- .verbaly-studio *::before,
102
- .verbaly-studio *::after {
103
- animation-duration: 0.01ms !important;
104
- transition-duration: 0.01ms !important;
105
- }
106
- }
@@ -1,94 +0,0 @@
1
- import { parse, parseTags } from 'verbaly';
2
-
3
- // The browser preview of the gate, on the runtime's own parser: the server is still the authority.
4
- export interface Preview {
5
- params: { name: string; inSource: boolean; inTarget: boolean }[];
6
- problems: string[];
7
- }
8
-
9
- type Node = { kind: string; name?: string; variants?: [string, Node[]][] };
10
-
11
- function walk(nodes: Node[], out: Map<string, Set<string>>): void {
12
- for (const node of nodes) {
13
- if (node.kind === 'param' && node.name) {
14
- if (!out.has(node.name)) out.set(node.name, new Set());
15
- for (const [selector, body] of node.variants ?? []) {
16
- out.get(node.name)!.add(selector);
17
- walk(body, out);
18
- }
19
- }
20
- }
21
- }
22
-
23
- function shape(message: string): Map<string, Set<string>> {
24
- const out = new Map<string, Set<string>>();
25
- try {
26
- walk(parse(message) as Node[], out);
27
- } catch {
28
- // a half-typed message is not a defect, so an unparseable draft simply reports nothing yet
29
- }
30
- return out;
31
- }
32
-
33
- type Token = string | { name: string; children: Token[] };
34
-
35
- function collect(tokens: Token[], out: string[]): void {
36
- for (const token of tokens) {
37
- if (typeof token === 'string') continue;
38
- out.push(token.name);
39
- collect(token.children, out);
40
- }
41
- }
42
-
43
- function tags(message: string): string[] {
44
- const out: string[] = [];
45
- try {
46
- collect(parseTags(message) as Token[], out);
47
- } catch {
48
- return out;
49
- }
50
- return out;
51
- }
52
-
53
- function counted(list: string[]): Map<string, number> {
54
- const out = new Map<string, number>();
55
- for (const item of list) out.set(item, (out.get(item) ?? 0) + 1);
56
- return out;
57
- }
58
-
59
- const list = (names: string[]) =>
60
- names.length === 1 ? names[0] : `${names.slice(0, -1).join(', ')} and ${names.at(-1)}`;
61
-
62
- export function preview(source: string, translated: string): Preview {
63
- const from = shape(source);
64
- const to = shape(translated);
65
- const params = [...new Set([...from.keys(), ...to.keys()])].sort().map((name) => ({
66
- name,
67
- inSource: from.has(name),
68
- inTarget: to.has(name),
69
- }));
70
-
71
- const problems: string[] = [];
72
- const lost = params.filter((p) => p.inSource && !p.inTarget).map((p) => `{${p.name}}`);
73
- const made = params.filter((p) => !p.inSource && p.inTarget).map((p) => `{${p.name}}`);
74
- if (lost.length) problems.push(`${list(lost)} is missing, so its value never reaches the text`);
75
- if (made.length) problems.push(`${list(made)} is not in the source, so it renders as literal text`);
76
-
77
- // a plural block that lost its catch-all renders nothing for any count it does not list
78
- for (const [name, selectors] of to) {
79
- if (selectors.size && !selectors.has('other')) {
80
- problems.push(`the block for {${name}} has no "other" case, so some counts render empty`);
81
- }
82
- }
83
-
84
- const sourceTags = counted(tags(source));
85
- const targetTags = counted(tags(translated));
86
- for (const [name, n] of sourceTags) {
87
- if ((targetTags.get(name) ?? 0) < n) problems.push(`<${name}> is missing from the translation`);
88
- }
89
- for (const [name, n] of targetTags) {
90
- if ((sourceTags.get(name) ?? 0) < n) problems.push(`<${name}> is not in the source message`);
91
- }
92
-
93
- return { params, problems };
94
- }
@@ -1,29 +0,0 @@
1
- // Every route answers JSON and every failure has to read like a sentence, so it is asked once here.
2
- export interface Answer<T> {
3
- value?: T;
4
- error?: string;
5
- }
6
-
7
- export async function ask<T>(
8
- token: string,
9
- path: string,
10
- // an intersection narrows body, it does not replace it, so the fetch shape is omitted first
11
- init?: Omit<RequestInit, 'body'> & { body?: unknown },
12
- ): Promise<Answer<T>> {
13
- const join = path.includes('?') ? '&' : '?';
14
- let response: Response;
15
- try {
16
- response = await fetch(`${path}${join}t=${encodeURIComponent(token)}`, {
17
- ...init,
18
- headers: init?.body === undefined ? undefined : { 'content-type': 'application/json' },
19
- body: init?.body === undefined ? undefined : JSON.stringify(init.body),
20
- });
21
- } catch {
22
- return { error: '[verbaly] the studio server is not answering, is it still running?' };
23
- }
24
- const body = (await response.json().catch(() => ({}))) as T & { error?: string };
25
- if (!response.ok) {
26
- return { error: body.error ?? `[verbaly] the server answered ${response.status}` };
27
- }
28
- return { value: body };
29
- }
@@ -1,48 +0,0 @@
1
- import type { MessageState } from './model';
2
-
3
- // The words are a product decision: each names a checkable fact, never a stage of a workflow.
4
- export const STATE: Record<MessageState, { short: string; long: string }> = {
5
- done: { short: 'ready', long: 'ready' },
6
- draft: { short: 'unread', long: 'written by a machine, nobody has read it' },
7
- missing: { short: 'missing', long: 'missing, so your visitor sees the source language' },
8
- broken: { short: 'breaks', long: 'breaks your site' },
9
- };
10
-
11
- export const FILTER: Record<'all' | 'look' | 'missing' | 'draft' | 'broken', string> = {
12
- all: 'everything',
13
- missing: 'missing',
14
- draft: 'unread',
15
- broken: 'breaks your site',
16
- look: 'worth a look',
17
- };
18
-
19
- // The signals do not score a translation, they point at the few worth reading first.
20
- export const SIGNAL: Record<string, string> = {
21
- divergent: 'the source says this two ways',
22
- collision: 'came back as two translations',
23
- echo: 'still identical to the source',
24
- digits: 'the numbers moved',
25
- url: 'a link changed',
26
- code: 'a code span changed',
27
- };
28
-
29
- export const MARK_AS_READ = 'Mark as read';
30
- export const UNDO = 'Undo';
31
-
32
- // The two commands the panel can run, named by what they leave behind, not by what they are called.
33
- export const ACTION = {
34
- find: 'Find new text',
35
- findWhy: 'Reads your code and adds what your catalogs do not have yet.',
36
- translate: 'Translate what is missing',
37
- translateWhy: 'Calls your provider, so it costs money and takes minutes.',
38
- cancel: 'Not now',
39
- working: 'Reading your code',
40
- running: 'Translating',
41
- nothingNew: 'Nothing new: your catalogs already have every message your code uses.',
42
- nothingMissing: 'Nothing missing in the languages you ticked.',
43
- pickFirst: 'Tick a language to translate it.',
44
- } as const;
45
-
46
- export function messages(n: number): string {
47
- return `${n} ${n === 1 ? 'message' : 'messages'}`;
48
- }
@@ -1,3 +0,0 @@
1
- (function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e=Array.isArray,t=Array.prototype.indexOf,n=Array.prototype.includes,r=Array.from,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyDescriptors,s=Object.prototype,c=Array.prototype,l=Object.getPrototypeOf,u=Object.isExtensible,d=()=>{};function f(e){for(var t=0;t<e.length;t++)e[t]()}function p(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}var m=1024,h=2048,g=4096,_=8192,v=16384,y=32768,ee=1<<25,b=65536,x=1<<19,te=1<<20,ne=1<<25,S=65536,re=1<<21,ie=1<<22,ae=1<<23,oe=Symbol(`$state`),se=Symbol(`component`),ce=Symbol(``),le=Symbol(`attributes`),ue=Symbol(`class`),de=Symbol(`style`),fe=Symbol(`text`),pe=Symbol(`form reset`),me=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},he=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),ge={},C=Symbol(`uninitialized`),_e=`http://www.w3.org/1999/xhtml`;function ve(){console.warn(`https://svelte.dev/e/derived_inert`)}function ye(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function be(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var w=!1;function xe(e){w=e}var T;function E(e){if(e===null)throw ye(),ge;return T=e}function Se(){return E(Zt(T))}function D(e){if(w){if(Zt(T)!==null)throw ye(),ge;T=e}}function Ce(e=1){if(w){for(var t=e,n=T;t--;)n=Zt(n);T=n}}function we(e=!0){for(var t=0,n=T;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else(r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=Zt(n);e&&n.remove(),n=i}}function Te(e){if(!e||e.nodeType!==8)throw ye(),ge;return e.data}function Ee(e){return e===this.v}function De(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Oe(e){return!De(e,this.v)}function ke(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function Ae(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function je(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Me(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function Ne(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Pe(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Fe(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Ie(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Le(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Re(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function ze(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var O=null;function Be(e){O=e}function Ve(e,t=!1,n){O={p:O,i:!1,c:null,e:null,s:e,x:null,r:W,l:null}}function He(e){var t=O,n=t.e;if(n!==null){t.e=null;for(var r of n)fn(r)}return e!==void 0&&(t.x=e),t.i=!0,O=t.p,Ue(e)}function Ue(e={}){return i(e,se,{value:!0}),e}function We(){return!0}var Ge=[];function Ke(){var e=Ge;Ge=[],f(e)}function qe(e){if(Ge.length===0&&!St){var t=Ge;queueMicrotask(()=>{t===Ge&&Ke()})}Ge.push(e)}function Je(){for(;Ge.length>0;)Ke()}var Ye=~(h|g|m);function k(e,t){e.f=e.f&Ye|t}function Xe(e){e.f&512||e.deps===null?k(e,m):k(e,g)}function Ze(e){if(e!==null)for(let t of e)t.f&2&&t.f&65536&&(t.f^=S,Ze(t.deps))}function Qe(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),Ze(e.deps),k(e,m)}function $e(e,t){if(t){let t=document.body;e.autofocus=!0,qe(()=>{document.activeElement===t&&e.focus()})}}function et(e){w&&F(e)!==null&&$t(e)}var tt=!1;function nt(){tt||(tt=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[pe]?.()})},{capture:!0}))}function rt(e){var t=H,n=W;U(null),Mn(null);try{return e()}finally{U(t),Mn(n)}}function it(e,t,n,r=n){e.addEventListener(t,()=>rt(n));let i=e[pe];e[pe]=i?()=>{i(),r(!0)}:()=>r(!0),nt()}function at(e,t,n,r){let i=We()?lt:ft;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=W,c=ot(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){an(e,s)}st()}}var d=ct();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>dt(e))).then(u).catch(e=>an(e,s)).finally(d)}l?l.then(()=>{c(),f(),st()}):f()}function ot(){var e=W,t=H,n=O,r=j;return function(i=!0){Mn(e),U(t),Be(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function st(e=!0){Mn(null),U(null),Be(null),e&&j?.deactivate()}function ct(){var e=W,t=e.b,n=j,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function lt(e){var t=2|h;return W!==null&&(W.f|=x),{ctx:O,deps:null,effects:null,equals:Ee,f:t,fn:e,reactions:null,rv:0,v:C,wv:0,parent:W,ac:null}}var ut=Symbol(`obsolete`);function dt(e,t,n){let r=W;r===null&&Ae();var i=void 0,a=zt(C),o=!H,s=new Set;return mn(()=>{var t=W,n=p();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==me&&n.reject(e)}).finally(st)}catch(e){n.reject(e),st()}var c=j;if(o){if(t.f&32768)var l=ct();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(ut);else for(let e of s.values())e.reject(ut);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==ut&&(c.activate(),t?(a.f|=ae,Vt(a,t)):(a.f&8388608&&(a.f^=ae),Vt(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),un(()=>{for(let e of s)e.reject(ut)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function A(e){let t=lt(e);return Pn(t),t}function ft(e){let t=lt(e);return t.equals=Oe,t}function pt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)V(t[n])}}function mt(e){var t,n=W,r=e.parent;if(!kn&&r!==null&&e.v!==C&&r.f&24576)return ve(),e.v;Mn(r);try{e.f&=~S,pt(e),t=Wn(e)}finally{Mn(n)}return t}function ht(e){var t=mt(e);if(!e.equals(t)&&(e.wv=Vn(),(!j?.is_fork||e.deps===null)&&(j===null?e.v=t:(j.capture(e,t,!0),yt?.capture(e,t,!0)),e.deps===null))){k(e,m);return}kn||(bt===null?Xe(e):(ln()||j?.is_fork)&&bt.set(e,t))}function gt(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac!==null&&rt(()=>{t.ac.abort(me),t.ac=null}),t.fn!==null&&(t.teardown=d),qn(t,0),vn(t))}function _t(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&Jn(t)}var vt=null,j=null,yt=null,bt=null,xt=null,St=!1,Ct=!1,wt=null,Tt=null,Et=0,Dt=1,Ot=class e{id=Dt++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){vt===null?vt=this:(vt.#n=this,this.#t=vt),vt=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)k(r,h),t(r);for(r of n.m)k(r,g),t(r)}this.#p.add(e)}#g(){this.#e=!0,Et++>1e3&&(this.#x(),At());for(let e of this.#u)this.#d.delete(e),k(e,h),this.schedule(e);for(let e of this.#d)k(e,g),this.schedule(e);let t=this.#c;this.#c=[],this.apply();var n=wt=[],r=[],i=Tt=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw Ft(e),this.#h()||this.discard(),t}if(j=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(wt=null,Tt=null,this.#h()){this.#b(r),this.#b(n);for(let[e,t]of this.#f)Pt(e,t);i.length>0&&j.#g();return}let o=this.#v();if(o){this.#b(r),this.#b(n),o.#y(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),yt=this,Mt(r),Mt(n),yt=null,this.#s?.resolve();var s=j;if(this.#a===0&&(this.#c.length===0||s!==null)&&this.#x(),this.#c.length>0){if(s!==null){let e=s;e.#c.push(...this.#c.filter(t=>!e.#c.includes(t)))}else s=this}s!==null&&(Lt.clear(),s.#g())}#_(e,t,n){e.f^=m;for(var r=e.first;r!==null;){var i=r.f,a=!!(i&96);if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=m:i&4?t.push(r):Hn(r)&&(i&16&&this.#d.add(r),Jn(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#y(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null&&!(e.f&2&&!(e.f&6144)))for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),k(i,h),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#x(),j=this,this.#g()}#b(e){for(var t=0;t<e.length;t+=1)Qe(e[t],this.#u,this.#d)}capture(e,t,n=!1){e.v!==C&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),bt?.set(e,t)),this.is_fork||(e.v=t)}activate(){j=this}deactivate(){j=null,bt=null}flush(){try{Ct=!0,j=this,this.#g()}finally{Et=0,xt=null,wt=null,Tt=null,Ct=!1,j=null,bt=null,Lt.clear()}}discard(){for(let e of this.#i)e(this);this.#i.clear();for(let e of this.async_deriveds.values())e.reject(ut);this.#x(),this.#s?.resolve()}register_created_effect(e){this.#l.push(e)}increment(e,t){if(this.#a+=1,e){let e=this.#o.get(t)??0;this.#o.set(t,e+1)}}decrement(e,t){if(--this.#a,e){let e=this.#o.get(t)??0;e===1?this.#o.delete(t):this.#o.set(t,e-1)}this.#m||(this.#m=!0,qe(()=>{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=p()).promise}static ensure(){if(j===null){let t=j=new e;!Ct&&!St&&qe(()=>{t.#e||t.flush()})}return j}apply(){bt=null}schedule(e){if(xt=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(wt!==null&&t===W&&(H===null||!(H.f&2)))return;if(n&96){if(!(n&1024))return;t.f^=m}}this.#c.push(t)}#x(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?vt=e:t.#t=e,this.linked=!1}}};function kt(e){var t=St;St=!0;try{var n;for(e&&(j!==null&&!j.is_fork&&j.flush(),n=e());;){if(Je(),j===null)return n;j.flush()}}finally{St=t}}function At(){try{Fe()}catch(e){an(e,xt)}}var jt=null;function Mt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&Hn(r)&&(jt=new Set,Jn(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&xn(r),jt?.size>0)){Lt.clear();for(let e of jt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)jt.has(n)&&(jt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||Jn(n)}}jt.clear()}}jt=null}}function Nt(e){j.schedule(e)}function Pt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),k(e,m);for(var n=e.first;n!==null;)Pt(n,t),n=n.next}}function Ft(e){k(e,m);for(var t=e.first;t!==null;)Ft(t),t=t.next}var It=new Set,Lt=new Map,Rt=!1;function zt(e,t){return{f:0,v:e,reactions:null,equals:Ee,rv:0,wv:0}}function M(e,t){let n=zt(e,t);return Pn(n),n}function Bt(e,t=!1,n=!0){let r=zt(e);return t||(r.equals=Oe),r}function N(e,t,n=!1){return H!==null&&(!jn||H.f&131072)&&We()&&H.f&4325394&&(Nn===null||!Nn.has(e))&&Re(),Vt(e,n?Gt(t):t,Tt)}function Vt(e,t,n=null){if(!e.equals(t)){kn?Lt.set(e,t):Lt.has(e)||Lt.set(e,e.v);var r=Ot.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&mt(t),bt===null&&Xe(t)}e.wv=Vn(),Wt(e,h,n),We()&&W!==null&&W.f&1024&&!(W.f&96)&&(Fn===null?In([e]):Fn.push(e)),!r.is_fork&&It.size>0&&!Rt&&Ht()}return t}function Ht(){Rt=!1;for(let e of It){e.f&1024&&k(e,g);let t;try{t=Hn(e)}catch{t=!0}t&&Jn(e)}It.clear()}function Ut(e){N(e,e.v+1)}function Wt(e,t,n){var r=e.reactions;if(r!==null)for(var i=We(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(i||s!==W){var l=(c&h)===0;if(l&&k(s,t),c&131072)It.add(s);else if(c&2){var u=s;bt?.delete(u),c&65536||(c&512&&(W===null||!(W.f&2097152))&&(s.f|=S),Wt(u,g,n))}else if(l){var d=s;c&16&&jt!==null&&jt.add(d),n===null?Nt(d):n.push(d)}}}}function Gt(t){if(typeof t!=`object`||!t||oe in t||se in t)return t;let n=l(t);if(n!==s&&n!==c)return t;var r=new Map,i=e(t),o=M(0),u=null,d=zn,f=e=>{if(zn===d)return e();var t=H,n=zn;U(null),Bn(d);var r=e();return U(t),Bn(n),r};return i&&r.set(`length`,M(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&Ie();var i=r.get(t);return i===void 0?f(()=>{var e=M(n.value,u);return r.set(t,e),e}):N(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>M(C,u));r.set(t,e),Ut(o)}}else N(n,C),Ut(o);return!0},get(e,n,i){if(n===oe)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>M(Gt(s?e[n]:C),u)),r.set(n,o)),o!==void 0){var c=q(o);return c===C?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){var n=Reflect.getOwnPropertyDescriptor(e,t);if(n&&`value`in n){var i=r.get(t);i&&(n.value=q(i))}else if(n===void 0){var a=r.get(t),o=a?.v;if(a!==void 0&&o!==C)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return n},has(e,t){if(t===oe)return!0;var n=r.get(t),i=n!==void 0&&n.v!==C||Reflect.has(e,t);return(n!==void 0||W!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>M(i?Gt(e[t]):C,u)),r.set(t,n)),q(n)===C)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;d<c.v;d+=1){var p=r.get(d+``);p===void 0?d in e&&(p=f(()=>M(C,u)),r.set(d+``,p)):N(p,C)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>M(void 0,u)),N(c,Gt(n)),r.set(t,c));else{l=c.v!==C;var m=f(()=>Gt(n));N(c,m)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(s,n),!l){if(i&&typeof t==`string`){var g=r.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&N(g,_+1)}Ut(o)}return!0},ownKeys(e){q(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==C});for(var[n,i]of r)i.v!==C&&!(n in e)&&t.push(n);return t},setPrototypeOf(){Le()}})}var Kt,qt,Jt,Yt;function Xt(){if(Kt===void 0){Kt=window,qt=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Jt=a(t,`firstChild`).get,Yt=a(t,`nextSibling`).get,u(e)&&(e[ue]=void 0,e[le]=null,e[de]=void 0,e.__e=void 0),u(n)&&(n[fe]=void 0)}}function P(e=``){return document.createTextNode(e)}function F(e){return Jt.call(e)}function Zt(e){return Yt.call(e)}function I(e,t){if(!w)return F(e);var n=F(T);if(n===null)n=T.appendChild(P());else if(t&&n.nodeType!==3){var r=P();return n?.before(r),E(r),r}return t&&nn(n),E(n),n}function Qt(e,t=!1){if(!w){var n=F(e);return n instanceof Comment&&n.data===``?Zt(n):n}if(t){if(T?.nodeType!==3){var r=P();return T?.before(r),E(r),r}nn(T)}return T}function L(e,t=!1){if(!w)return F(e);var n=I(e,t);return D(e),n}function R(e,t=1,n=!1){let r=w?T:e;for(var i;t--;)i=r,r=Zt(r);if(!w)return r;if(n){if(r?.nodeType!==3){var a=P();return r===null?i?.after(a):r.before(a),E(a),a}nn(r)}return E(r),r}function $t(e){e.textContent=``}function en(){return!1}function tn(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function nn(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function rn(e){var t=W;if(t===null)return H.f|=ae,e;if(!(t.f&32768)&&!(t.f&4))throw e;an(e,t)}function an(e,t){if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128&&!(t.f&33570816)){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}function on(e){W===null&&(H===null&&Pe(e),Ne()),kn&&Me(e)}function sn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function cn(e,t){var n=W;n!==null&&n.f&8192&&(e|=_);var r={ctx:O,deps:null,nodes:null,f:e|h|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};j?.register_created_effect(r);var i=r;if(e&4)wt===null?Ot.ensure().schedule(r):wt.push(r);else if(t!==null){try{Jn(r)}catch(e){throw V(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=b))}if(i!==null&&(i.parent=n,n!==null&&sn(i,n),H!==null&&H.f&2&&!(e&64))){var a=H;(a.effects??=[]).push(i)}return r}function ln(){return H!==null&&!jn}function un(e){let t=cn(8,null);return k(t,m),t.teardown=e,t}function dn(e){on(`$effect`);var t=W.f;if(!H&&t&32&&O!==null&&!O.i){var n=O;(n.e??=[]).push(e)}else return fn(e)}function fn(e){return cn(4|te,e)}function pn(e){Ot.ensure();let t=cn(64|x,e);return(e={})=>new Promise(n=>{e.outro?Sn(t,()=>{V(t),n(void 0)}):(V(t),n(void 0))})}function mn(e){return cn(ie|x,e)}function hn(e,t=0){return cn(8|t,e)}function z(e,t=[],n=[],r=[]){at(r,t,n,t=>{cn(8,()=>{e(...t.map(q))})})}function gn(e,t=0){return cn(16|t,e)}function B(e){return cn(32|x,e)}function _n(e){var t=e.teardown;if(t!==null){let n=kn,r=H;An(!0),U(null);try{t.call(null)}catch(t){an(t,e.parent)}finally{An(n),U(r)}}}function vn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&rt(()=>{e.abort(me)});var r=n.next;n.f&64?n.parent=null:V(n,t),n=r}}function yn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||V(t),t=n}}function V(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(bn(e.nodes.start,e.nodes.end),n=!0),e.f|=ee,vn(e,t&&!n),qn(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();_n(e),e.f^=ee,e.f|=v;var i=e.parent;i!==null&&i.first!==null&&xn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function bn(e,t){for(;e!==null;){var n=e===t?null:Zt(e);e.remove(),e=n}}function xn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Sn(e,t,n=!0){var r=[];e.f|=256,Cn(e,r,!0);var i=()=>{n&&V(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Cn(e,t,n){if(!(e.f&8192)){e.f^=_;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=!!(i.f&65536)||!!(i.f&32)&&!!(e.f&16);Cn(i,t,o?n:!1)}i=a}}}function wn(e){e.f&=-257,Tn(e,!0)}function Tn(e,t){if(!(e.f&256)&&e.f&8192){e.f^=_,e.f&1024||(k(e,h),Ot.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);Tn(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function En(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:Zt(n);t.append(n),n=i}}var Dn=null,On=!1,kn=!1;function An(e){kn=e}var H=null,jn=!1;function U(e){H=e}var W=null;function Mn(e){W=e}var Nn=null;function Pn(e){H!==null&&(Nn??=new Set).add(e)}var G=null,K=0,Fn=null;function In(e){Fn=e}var Ln=1,Rn=0,zn=Rn;function Bn(e){zn=e}function Vn(){return++Ln}function Hn(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~S),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(Hn(a)&&ht(a),a.wv>e.wv)return!0}t&512&&bt===null&&k(e,m)}return!1}function Un(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Nn!==null&&Nn.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?Un(a,t,!1):t===a&&(n?k(a,h):a.f&1024&&k(a,g),Nt(a))}}function Wn(e){var t=G,n=K,r=Fn,i=H,a=Nn,o=O,s=jn,c=zn,l=e.f;G=null,K=0,Fn=null,H=l&96?null:e,Nn=null,Be(e.ctx),jn=!1,zn=++Rn,e.ac!==null&&(rt(()=>{e.ac.abort(me)}),e.ac=null);try{e.f|=re;var u=e.fn,d=u();e.f|=y;var f=Gn(e);if(We()&&Fn!==null&&!jn&&f!==null&&!(e.f&6146))for(var p=0;p<Fn.length;p++)Un(Fn[p],e);if(i!==null&&i!==e){if(Rn++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=Rn;if(t!==null)for(let e of t)e.rv=Rn;Fn!==null&&(r===null?r=Fn:r.push(...Fn))}return e.f&8388608&&(e.f^=ae),d}catch(t){return Gn(e),rn(t)}finally{e.f^=re,G=t,K=n,Fn=r,H=i,Nn=a,Be(o),jn=s,zn=c}}function Gn(e){var t=e.deps,n=j?.is_fork;if(G!==null){var r;if(n||qn(e,K),t!==null&&K>0)for(t.length=K+G.length,r=0;r<G.length;r++)t[K+r]=G[r];else e.deps=t=G;if(ln()&&e.f&512)for(r=K;r<t.length;r++)(t[r].reactions??=[]).push(e)}else!n&&t!==null&&K<t.length&&(qn(e,K),t.length=K);return t}function Kn(e,r){let i=r.reactions;if(i!==null){var a=t.call(i,e);if(a!==-1){var o=i.length-1;o===0?i=r.reactions=null:(i[a]=i[o],i.pop())}}if(i===null&&r.f&2&&(G===null||!n.call(G,r))){var s=r;s.f&512&&(s.f^=512,s.f&=~S),s.v!==C&&Xe(s),s.ac!==null&&rt(()=>{s.ac.abort(me),s.ac=null,k(s,h)}),gt(s),qn(s,0)}}function qn(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Kn(e,n[r])}function Jn(e){var t=e.f;if(!(t&16384)){k(e,m);var n=W,r=On;W=e,On=!(t&96);try{t&16777232?yn(e):vn(e),_n(e);var i=Wn(e);e.teardown=typeof i==`function`?i:null,e.wv=Ln}finally{On=r,W=n}}}async function Yn(){await Promise.resolve(),kt()}function q(e){var t=!!(e.f&2);if(Dn?.add(e),H!==null&&!jn&&!(W!==null&&W.f&16384)&&(Nn===null||!Nn.has(e))){var r=H.deps;if(H.f&2097152)e.rv<Rn&&(e.rv=Rn,G===null&&r!==null&&r[K]===e?K++:G===null?G=[e]:G.push(e));else{H.deps??=[],n.call(H.deps,e)||H.deps.push(e);var i=e.reactions;i===null?e.reactions=[H]:n.call(i,H)||i.push(H)}}if(kn&&Lt.has(e))return Lt.get(e);if(t){var a=e;if(kn){var o=a.v;return(!(a.f&1024)&&a.reactions!==null||Zn(a))&&(o=mt(a)),Lt.set(a,o),o}var s=!(a.f&512)&&!jn&&H!==null&&(On||!!(H.f&512)),c=(a.f&y)===0;Hn(a)&&(s&&(a.f|=512),ht(a)),s&&!c&&(_t(a),Xn(a))}if(bt?.has(e))return bt.get(e);if(e.f&8388608)throw e.v;return e.v}function Xn(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(_t(t),Xn(t))}function Zn(e){if(e.v===C)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(Lt.has(t)||t.f&2&&Zn(t))return!0;return!1}function Qn(e){var t=jn;try{return jn=!0,e()}finally{jn=t}}[...`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`)];var $n=[`touchstart`,`touchmove`];function er(e){return $n.includes(e)}var tr=Symbol(`events`),nr=new Set,rr=new Set;function ir(e,t,n,r={}){function i(e){if(r.capture||lr.call(t,e),!e.cancelBubble)return rt(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?qe(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function ar(e,t,n,r,i){var a={capture:r,passive:i},o=ir(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&un(()=>{t.removeEventListener(e,o,a)})}function J(e,t,n){(t[tr]??={})[e]=n}function or(e){for(var t=0;t<e.length;t++)nr.add(e[t]);for(var n of rr)n(e)}var sr=null,cr=!1;function lr(e){var t=this,n=t.ownerDocument,r=e.type,a=e.composedPath?.()||[],o=a[0]||e.target;sr=e,cr||(cr=!0,setTimeout(()=>{cr=!1,sr=null}));var s=0,c=sr===e&&e[tr];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[tr]=t;return}var u=a.indexOf(t);if(u===-1)return;l<=u&&(s=l)}if(o=a[s]||e.target,o!==t){i(e,`currentTarget`,{configurable:!0,get(){return o||n}});var d=H,f=W;U(null),Mn(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[tr]?.[r];h!=null&&(!o.disabled||e.target===o)&&h.call(o,e)}catch(e){p?m.push(e):p=e}if(e.cancelBubble)break;s++,o=s<a.length?a[s]:null}if(p){for(let e of m)queueMicrotask(()=>{throw e});throw p}}finally{e[tr]=t,delete e.currentTarget,U(d),Mn(f)}}}var ur=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function dr(e){return ur?.createHTML(e)??e}function fr(e){var t=tn(`template`);return t.innerHTML=dr(e.replaceAll(`<!>`,`<!---->`)),t.content}function pr(e,t){var n=W;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function Y(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(`<!>`);return()=>{if(w)return pr(T,null),T;i===void 0&&(i=fr(a?e:`<!>`+e),n||(i=F(i)));var t=r||qt?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=F(t),s=t.lastChild;pr(o,s)}else pr(t,t);return t}}function mr(e,t,n=`svg`){var r=!e.startsWith(`<!>`),i=!!(t&1),a=`<${n}>${r?e:`<!>`+e}</${n}>`,o;return()=>{if(w)return pr(T,null),T;if(!o){var e=F(fr(a));if(i)for(o=document.createDocumentFragment();F(e);)o.appendChild(F(e));else o=F(e)}var t=o.cloneNode(!0);if(i){var n=F(t),r=t.lastChild;pr(n,r)}else pr(t,t);return t}}function hr(e,t){return mr(e,t,`svg`)}function gr(e=``){if(!w){var t=P(e+``);return pr(t,t),t}var n=T;return n.nodeType===3?nn(n):(n.before(n=P()),E(n)),pr(n,n),n}function _r(){if(w)return pr(T,null),T;var e=document.createDocumentFragment(),t=document.createComment(``),n=P();return e.append(t,n),pr(t,n),e}function X(e,t){if(w){var n=W;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=T),Se();return}e!==null&&e.before(t)}function vr(e){let t=0,n=zt(0),r;return()=>{ln()&&(q(n),hn(()=>(t===0&&(r=Qn(()=>e(()=>Ut(n)))),t+=1,()=>{qe(()=>{--t,t===0&&(r?.(),r=void 0,Ut(n))})})))}}var yr=b|x;function br(e,t,n,r){new xr(e,t,n,r)}var xr=class{parent;is_pending=!1;transform_error;#e;#t=w?T:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=vr(()=>(this.#m=zt(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=W;t.b=this,t.f|=128,n(e)},this.parent=W.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=gn(()=>{if(w){let e=this.#t;Se();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#y():this.#g()}else this.#b()},yr),w&&(this.#e=T)}#g(){try{this.#a=B(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);qe(r),t&&(this.#s=B(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{if(t){be();return}t=!0,n&&ze(),this.#s!==null&&Sn(this.#s,()=>{this.#s=null}),this.#S(()=>{this.#b()})};return{reset:r,invoke_onerror:()=>{try{n=!0,this.#n.onerror?.(e,r),n=!1}catch(e){an(e,this.#i&&this.#i.parent)}}}}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=B(()=>e(this.#e)),qe(()=>{var e=this.#c=document.createDocumentFragment(),t=P(),n=!1;if(e.append(t),this.#a=this.#S(()=>{try{return B(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){an(e,this.#i.parent)}return null}}),this.#a===null){this.#c=null,n&&this.#x(j);return}this.#u===0&&(this.#e.before(e),this.#c=null,Sn(this.#o,()=>{this.#o=null}),this.#x(j))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=B(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();En(this.#a,e);let t=this.#n.pending;this.#o=B(()=>t(this.#e))}else this.#x(j)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){Qe(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#S(e){var t=W,n=H,r=O;Mn(this.#i),U(this.#i),Be(this.#i.ctx);try{return Ot.ensure(),e()}finally{Mn(t),U(n),Be(r)}}#C(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#C(e,t);return}this.#u+=e,this.#u===0&&(this.#x(t),this.#o&&Sn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#C(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,qe(()=>{this.#d=!1,this.#m&&Vt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),q(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;j?.is_fork?(this.#a&&j.skip_effect(this.#a),this.#o&&j.skip_effect(this.#o),this.#s&&j.skip_effect(this.#s),j.oncommit(()=>{this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(V(this.#a),null),this.#o&&=(V(this.#o),null),this.#s&&=(V(this.#s),null),w&&(E(this.#t),Ce(),E(we()));let t=this.#n.failed,n=e=>{let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&(this.#s=this.#S(()=>{try{return B(()=>{var r=W;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return an(e,this.#i.parent),null}}))};qe(()=>{var t;try{t=this.transform_error(e)}catch(e){an(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>an(e,this.#i&&this.#i.parent)):n(t)})}};function Z(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[fe]??=e.nodeValue)&&(e[fe]=n,e.nodeValue=`${n}`)}function Sr(e,t){return wr(e,t)}var Cr=new Map;function wr(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){Xt();var l=void 0,u=pn(()=>{var s=n??t.appendChild(P());br(s,{pending:()=>{}},t=>{Ve({});var n=O;if(o&&(n.c=o),a&&(i.$$events=a),w&&pr(t,null),l=e(t,i)||Ue(),w&&(W.nodes.end=T,T===null||T.nodeType!==8||T.data!==`]`))throw ye(),ge;He()},c);var u=new Set,d=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!u.has(r)){u.add(r);var i=er(r);for(let e of[t,document]){var a=Cr.get(e);a===void 0&&(a=new Map,Cr.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,lr,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return d(r(nr)),rr.add(d),()=>{for(var e of u)for(let n of[t,document]){var r=Cr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,lr),r.delete(e),r.size===0&&Cr.delete(n)):r.set(e,i)}rr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Tr.set(l,u),l}var Tr=new WeakMap,Er=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)wn(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(wn(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(V(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();En(r,t),t.append(P()),this.#n.set(e,{effect:r,fragment:t})}else V(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Sn(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(V(n.effect),this.#n.delete(e))};ensure(e,t){var n=j,r=en();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=P();i.append(a),this.#n.set(e,{effect:B(()=>t(a)),fragment:i})}else this.#t.set(e,B(()=>t(this.anchor)))}if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else w&&(this.anchor=T),this.#a(n)}};function Q(e,t,n=!1){var r;w&&(r=T,Se());var i=new Er(e),a=n?b:0;function o(e,t){if(w){var n=Te(r);if(e!==parseInt(n.substring(1))){var a=we();E(a),i.anchor=a,xe(!1),i.ensure(e,t),xe(!0);return}}i.ensure(e,t)}gn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}function Dr(e,t){return t}function Or(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c<a;c++){let n=t[c];Sn(n,()=>{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;kr(e,r(o.done)),t.delete(o),t.size===0&&(e.outrogroups=null)}}else--s},!1)}if(s===0){var l=i.length===0&&n!==null&&e.pending.size===0;if(l){var u=n,d=u.parentNode;$t(d),d.append(u),e.items.clear()}kr(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function kr(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var a=t[i];r?.has(a)?(a.f|=ne,En(a,document.createDocumentFragment())):V(t[i],n)}}var Ar;function jr(t,n,i,a,o,s=null){var c=t,l=new Map;if(n&4){var u=t;c=w?E(F(u)):u.appendChild(P())}w&&Se();var d=null,f=ft(()=>{var t=i();return e(t)?t:t==null?[]:r(t)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=d,Nr(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=ne,Fr(d,null,c)):wn(d):Sn(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:gn(()=>{p=q(f);var e=p.length;let t=!1;w&&Te(c)===`[!`!=(e===0)&&(c=we(),E(c),xe(!1),t=!0);for(var r=new Set,u=j,v=en(),y=0;y<e;y+=1){w&&T.nodeType===8&&T.data===`]`&&(c=T,t=!0,xe(!1));var ee=p[y],b=a(ee,y),x=h?null:l.get(b);x?(x.v&&Vt(x.v,ee),x.i&&Vt(x.i,y),v&&u.unskip_effect(x.e)):(x=Pr(l,h?c:Ar??=P(),ee,b,y,o,n,i),h||(x.e.f|=ne),l.set(b,x)),r.add(b)}if(e===0&&s&&!d&&(h?d=B(()=>s(c)):(d=B(()=>s(Ar??=P())),d.f|=ne)),e>r.size&&je(``,``,``),w&&e>0&&E(we()),!h){if(m.set(u,r),v){for(let[e,t]of l)r.has(e)||u.skip_effect(t.e);u.oncommit(g),u.ondiscard(_)}else g(u)}t&&xe(!0),q(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,w&&(c=T)}function Mr(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Nr(e,t,n,i,a){var o=!!(i&8),s=t.length,c=e.items,l=Mr(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v<s;v+=1)h=t[v],g=a(h,v),_=c.get(g).e,_.f&33554432||(_.nodes?.a?.measure(),(f??=new Set).add(_));for(v=0;v<s;v+=1){if(h=t[v],g=a(h,v),_=c.get(g).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(_),t.done.delete(_);if(_.f&8192&&(wn(_),o&&(_.nodes?.a?.unfix(),(f??=new Set).delete(_))),_.f&33554432){if(_.f^=ne,_===l)Fr(_,null,n);else{var y=d?d.next:l;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),Ir(e,d,_),Ir(e,_,y),Fr(_,y,n),d=_,p=[],m=[],l=Mr(d.next);continue}}if(_!==l){if(u!==void 0&&u.has(_)){if(p.length<m.length){var ee=m[0],b;d=ee.prev;var x=p[0],te=p[p.length-1];for(b=0;b<p.length;b+=1)Fr(p[b],ee,n);for(b=0;b<m.length;b+=1)u.delete(m[b]);Ir(e,x.prev,te.next),Ir(e,d,x),Ir(e,te,ee),l=ee,d=te,--v,p=[],m=[]}else u.delete(_),Fr(_,l,n),Ir(e,_.prev,_.next),Ir(e,_,d===null?e.effect.first:d.next),Ir(e,d,_),d=_;continue}for(p=[],m=[];l!==null&&l!==_;)(u??=new Set).add(l),m.push(l),l=Mr(l.next);if(l===null)continue}_.f&33554432||p.push(_),d=_,l=Mr(_.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(kr(e,r(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(l!==null||u!==void 0){var S=[];if(u!==void 0)for(_ of u)_.f&8192||S.push(_);for(;l!==null;)!(l.f&8192)&&l!==e.fallback&&S.push(l),l=Mr(l.next);var re=S.length;if(re>0){var ie=i&4&&s===0?n:null;if(o){for(v=0;v<re;v+=1)S[v].nodes?.a?.measure();for(v=0;v<re;v+=1)S[v].nodes?.a?.fix()}Or(e,S,ie)}}o&&qe(()=>{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function Pr(e,t,n,r,i,a,o,s){var c=o&1?o&16?zt(n):Bt(n,!1,!1):null,l=o&2?zt(i):null;return{v:c,i:l,e:B(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function Fr(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=Zt(r);if(a.before(r),r===i)return;r=o}}function Ir(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Lr(e,t,...n){var r=new Er(e);gn(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},b)}var Rr=[...`
2
- \r\f\xA0\v`];function zr(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||Rr.includes(r[o-1]))&&(s===r.length||Rr.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function Br(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function Vr(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function Hr(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\/\*.*?\*\//g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(Vr)),i&&c.push(...Object.keys(i).map(Vr));var l=0,u=-1;let t=e.length;for(var d=0;d<t;d++){var f=e[d];if(s?f===`/`&&e[d-1]===`*`&&(s=!1):a?a===f&&(a=!1):f===`/`&&e[d+1]===`*`?s=!0:f===`"`||f===`'`?a=f:f===`(`?o++:f===`)`&&o--,!s&&a===!1&&o===0){if(f===`:`&&u===-1)u=d;else if(f===`;`||d===t-1){if(u!==-1){var p=Vr(e.substring(l,u).trim());if(!c.includes(p)){f!==`;`&&d++;var m=e.substring(l,d).trim();n+=` `+m+`;`}}l=d+1,u=-1}}}}return r&&(n+=Br(r)),i&&(n+=Br(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function Ur(e,t,n,r,i,a){var o=e[ue];if(w||o!==n||o===void 0){var s=zr(n,r,a);(!w||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e[ue]=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function Wr(e,t={},n,r){for(var i in n){var a=n[i];t[i]!==a&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,a,r))}}function Gr(e,t,n,r){var i=e[de];if(w||i!==t){var a=Hr(t,r);(!w||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e[de]=t}else r&&(Array.isArray(r)?(Wr(e,n?.[0],r[0]),Wr(e,n?.[1],r[1],`important`)):Wr(e,n,r));return r}var Kr=Symbol(`is custom element`),qr=Symbol(`is html`),Jr=he?`link`:`LINK`;function Yr(e){if(w){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;Zr(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;Zr(e,`checked`,null),e.checked=r}}};e[pe]=n,qe(n),nt()}}function Xr(e,t){var n=Qr(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function Zr(e,t,n,r){var i=Qr(e);w&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===Jr)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[ce]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&ei(e).has(t)?e[t]=n:e.setAttribute(t,n))}function Qr(e){return e[le]??={[Kr]:e.nodeName.includes(`-`),[qr]:e.namespaceURI===_e}}var $r=new Map;function ei(e){var t=e.getAttribute(`is`)||e.nodeName,n=$r.get(t);if(n)return n;$r.set(t,n=new Set);for(var r,i=e,a=Element.prototype;a!==i;){for(var s in r=o(i),r)r[s].set&&s!==`innerHTML`&&s!==`textContent`&&s!==`innerText`&&n.add(s);i=l(i)}return n}function ti(e,t,n=t){var r=new WeakSet;it(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=ni(e)?ri(a):a,n(a),j!==null&&r.add(j),await Yn(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,c=e.value.length;if(e.value=a??``,s!==null){var l=e.value.length;o===s&&s===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(s,l))}}}),(w&&e.defaultValue!==e.value||Qn(t)==null&&e.value)&&(n(ni(e)?ri(e.value):e.value),j!==null&&r.add(j)),hn(()=>{var n=t();if(e===document.activeElement){var i=j;if(r.has(i))return}ni(e)&&n===ri(e.value)||(e.type!==`date`||n||e.value)&&n!==e.value&&(e.value=n??``)})}function ni(e){var t=e.type;return t===`number`||t===`range`}function ri(e){return e===``?null:+e}function ii(e){O===null&&ke(`onMount`),dn(()=>{let t=Qn(e);if(typeof t==`function`)return t})}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);var ai=hr(`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m3.4 8.4 3 3 6.2-6.8"></path></svg>`),oi=hr(`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M8 4v5"></path><path d="M8 12h.01"></path></svg>`),si=hr(`<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M4 4l8 8M12 4l-8 8"></path></svg>`),ci=Y(`<span class="fix svelte-hz6ou4"> </span>`),li=Y(`<li class="svelte-hz6ou4"><span class="mark svelte-hz6ou4" aria-hidden="true"><!></span> <span class="body svelte-hz6ou4"><b class="svelte-hz6ou4"> </b> <span class="msg svelte-hz6ou4"> </span> <!></span> <span class="sr svelte-hz6ou4"> </span></li>`),ui=Y(`<section class="health svelte-hz6ou4" aria-label="Health"><header class="svelte-hz6ou4"><h2 class="svelte-hz6ou4"> </h2> <p class="svelte-hz6ou4">This is the same check <code>npx verbaly doctor</code> runs, read out loud. It looks at your
3
- settings, your catalogs and the way your build is wired, and it never changes anything.</p> <button class="close svelte-hz6ou4">Back to the messages</button></header> <ul class="svelte-hz6ou4"></ul></section>`);function di(e,t){Ve(t,!0);let n={config:`Your settings`,cli:`The verbaly command`,catalogs:`Your catalogs`,routing:`Where the language lives in your urls`,plugin:`The piece that wires your build`,types:`The generated types`,sources:`Reading your code`,orphans:`Keys nothing in your code uses`,bundle:`What the browser downloads`,translations:`The translations themselves`},r=A(()=>t.entries.filter(e=>e.level!==`ok`).length);var i=ui(),a=I(i),o=I(a),s=L(o,!0),c=R(o,4);D(a);var l=R(a,2);jr(l,21,()=>t.entries,Dr,(e,t)=>{var r=li(),i=I(r),a=I(i),o=e=>{X(e,ai())},s=e=>{X(e,oi())},c=e=>{X(e,si())};Q(a,e=>{q(t).level===`ok`?e(o):q(t).level===`warn`?e(s,1):e(c,-1)}),D(i);var l=R(i,2),u=I(l),d=L(u,!0),f=R(u,2),p=L(f,!0),m=R(f,2),h=e=>{var n=ci(),r=L(n,!0);z(()=>Z(r,q(t).fix)),X(e,n)};Q(m,e=>{q(t).fix&&e(h)}),D(l);var g=L(R(l,2),!0);D(r),z(()=>{Zr(r,`data-level`,q(t).level),Z(d,n[q(t).check]??q(t).check),Z(p,q(t).message),Z(g,q(t).level)}),X(e,r)}),D(l),D(i),z(()=>Z(s,t.ok?`Nothing is broken`:`${q(r)} of ${t.entries.length} need you`)),J(`click`,c,function(...e){t.onClose?.apply(this,e)}),X(e,i),He()}or([`click`]);var fi={done:{short:`ready`,long:`ready`},draft:{short:`unread`,long:`written by a machine, nobody has read it`},missing:{short:`missing`,long:`missing, so your visitor sees the source language`},broken:{short:`breaks`,long:`breaks your site`}},pi={all:`everything`,missing:`missing`,draft:`unread`,broken:`breaks your site`,look:`worth a look`},mi={divergent:`the source says this two ways`,collision:`came back as two translations`,echo:`still identical to the source`,digits:`the numbers moved`,url:`a link changed`,code:`a code span changed`},hi=`Undo`,$={find:`Find new text`,findWhy:`Reads your code and adds what your catalogs do not have yet.`,translate:`Translate what is missing`,translateWhy:`Calls your provider, so it costs money and takes minutes.`,cancel:`Not now`,working:`Reading your code`,running:`Translating`,nothingNew:`Nothing new: your catalogs already have every message your code uses.`,nothingMissing:`Nothing missing in the languages you ticked.`,pickFirst:`Tick a language to translate it.`};function gi(e){return`${e} ${e===1?`message`:`messages`}`}var _i=Y(`<span> </span>`),vi=Y(`<button class="read svelte-1rwkwvu"> <span class="n svelte-1rwkwvu"> </span></button>`),yi=Y(`<li><label><input type="checkbox" class="svelte-1rwkwvu"/> <span class="meta svelte-1rwkwvu"><span class="name svelte-1rwkwvu"> </span> <span class="state svelte-1rwkwvu"> </span></span></label> <!></li>`),bi=Y(`<p class="undo svelte-1rwkwvu"><span> </span> <button class="svelte-1rwkwvu"> </button></p>`),xi=Y(`<li><button type="button"><span> </span> <span class="count svelte-1rwkwvu"> </span></button></li>`),Si=Y(`<nav class="rail svelte-1rwkwvu" aria-label="Languages and filters"><button class="nav svelte-1rwkwvu"><span>Health</span> <!></button> <!> <h2 class="cap svelte-1rwkwvu">Languages</h2> <ul class="langs svelte-1rwkwvu"></ul> <!> <h2 class="cap svelte-1rwkwvu">Show</h2> <ul class="filters svelte-1rwkwvu"></ul></nav>`);function Ci(e,t){Ve(t,!0);let n=[`all`,`look`,`missing`,`draft`,`broken`];function r(e){return e.source?`the one you write`:e.broken?`${e.broken} breaks your site`:e.missing?`${e.missing} missing`:e.draft?`${e.draft} nobody has read`:`all read`}function i(e){return e.source?`done`:e.broken?`broken`:e.missing?`missing`:e.draft?`draft`:`done`}var a=Si(),o=I(a),s=R(I(o),2),c=e=>{var n=_i();let r;var i=L(n,!0);z(()=>{r=Ur(n,1,`bad svelte-1rwkwvu`,null,r,{clean:!t.checks.bad}),Z(i,t.checks.bad||`ok`)}),X(e,n)};Q(s,e=>{t.checks&&e(c)}),D(o);var l=R(o,2);Lr(l,()=>t.actions);var u=R(l,4);jr(u,21,()=>t.health,e=>e.locale,(e,n)=>{var a=yi(),o=I(a);let s;var c=I(o);Yr(c);var l=R(c,2),u=I(l),d=L(u,!0),f=R(u,2),p=L(f,!0);D(l),D(o);var m=R(o,2),h=e=>{var r=vi(),i=I(r),a=L(R(i),!0);D(r),z(()=>{Z(i,`Mark as read `),Z(a,q(n).draft)}),J(`click`,r,()=>t.onRead(q(n).locale)),X(e,r)};Q(m,e=>{!q(n).source&&q(n).draft>0&&e(h)}),D(a),z((e,t,r)=>{s=Ur(o,1,`lang svelte-1rwkwvu`,null,s,{source:q(n).source}),Xr(c,e),c.disabled=q(n).source,Z(d,q(n).locale),Zr(f,`data-state`,t),Z(p,r)},[()=>t.shown.includes(q(n).locale),()=>i(q(n)),()=>r(q(n))]),J(`change`,c,()=>t.onToggle(q(n).locale)),X(e,a)}),D(u);var d=R(u,2),f=e=>{var n=bi(),r=I(n),i=L(r),a=R(r,2),o=L(a,!0);D(n),z(()=>{Z(i,`${t.pending.keys.length??``} in ${t.pending.locale??``} marked as read`),Z(o,hi)}),J(`click`,a,function(...e){t.onUndo?.apply(this,e)}),X(e,n)};Q(d,e=>{t.pending&&e(f)});var p=R(d,4);jr(p,20,()=>n,e=>e,(e,n)=>{var r=xi(),i=I(r);let a;var o=I(i),s=L(o,!0),c=L(R(o,2),!0);D(i),D(r),z(()=>{a=Ur(i,1,`svelte-1rwkwvu`,null,a,{on:t.state===n}),Z(s,pi[n]),Z(c,t.counts[n]??0)}),J(`click`,i,()=>t.onState(n)),X(e,r)}),D(p),D(a),J(`click`,o,function(...e){t.onHealth?.apply(this,e)}),X(e,a),He()}or([`click`,`change`]);var wi=hr(`<svg viewBox="0 0 22 22" width="15" height="15" aria-hidden="true"><path d="M5 11h12" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path></svg>`),Ti=hr(`<svg viewBox="0 0 22 22" width="15" height="15" aria-hidden="true" fill="none"><path d="M6 12.5 11 7l5 5.5" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"></path><path d="M11 8v7" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"></path></svg>`),Ei=hr(`<svg viewBox="0 0 22 22" width="15" height="15" aria-hidden="true" fill="none"><path d="M4.5 12.5c1.6-2.2 3.2-2.2 4.8 0s3.2 2.2 4.8 0 3.2-2.2 4.8 0" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"></path></svg>`),Di=hr(`<svg viewBox="0 0 22 22" width="15" height="15" aria-hidden="true"><path d="M11 6v6.4" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path><circle cx="11" cy="16" r="1.2" fill="currentColor"></circle></svg>`),Oi=Y(`<!> <span class="sr svelte-150apog"> </span>`,1);function ki(e,t){let n={done:`translated`,draft:`written by a machine`,missing:`not translated, shows in your source language`,broken:`breaks your site`};var r=Oi(),i=Qt(r),a=e=>{X(e,wi())},o=e=>{X(e,Ti())},s=e=>{X(e,Ei())},c=e=>{X(e,Di())};Q(i,e=>{t.state===`done`?e(a):t.state===`missing`?e(o,1):t.state===`draft`?e(s,2):e(c,-1)});var l=L(R(i,2),!0);z(()=>Z(l,n[t.state])),X(e,r)}var Ai=new Set;function ji(e){Ai.has(e)||(Ai.add(e),console.warn(`[verbaly] ${e}`))}var Mi=/\{\s*[a-zA-Z0-9_]+\s*,\s*(?:plural|selectordinal|select|number|date|time)\b/;function Ni(e){return Mi.test(e)}var Pi=new Map,Fi=5e3;function Ii(e,t){let n=Pi.get(e);if(!n){if(Ni(e)){if(!t)return Li(e);n=t(e)}else n=Ri(e,!1);Pi.size>=Fi&&Pi.delete(Pi.keys().next().value),Pi.set(e,n)}return n}function Li(e){return ji(`a message uses ICU syntax but no ICU parser is loaded: pass icu to createVerbaly (the compiler wires it when a catalog needs it, so this means it arrived after the build)`),[{kind:`text`,value:e}]}function Ri(e,t){let n=[],r=``,i=0,a=()=>{r&&n.push({kind:`text`,value:r}),r=``};for(;i<e.length;){let o=e[i];if(o===`{`){if(e[i+1]===`{`){r+=`{`,i+=2;continue}let t=zi(e,i);if(t<0){r+=e.slice(i);break}a(),n.push(Bi(e.slice(i+1,t))),i=t+1}else o===`}`&&e[i+1]===`}`?(r+=`}`,i+=2):t&&o===`#`?e[i+1]===`#`?(r+=`#`,i+=2):(a(),n.push({kind:`hash`}),i+=1):(r+=o,i+=1)}return a(),n}function zi(e,t){let n=0,r=t;for(;r<e.length;){let t=e[r];if(t===`{`){if(e[r+1]===`{`){r+=2;continue}n+=1}else if(t===`}`){if(e[r+1]===`}`){r+=2;continue}if(--n,n===0)return r}r+=1}return-1}function Bi(e){let t=Vi(e),n=(t[0]??``).trim();if(!n)return{kind:`text`,value:`{${e}}`};let r=n.indexOf(`:`),i=(r<0?n:n.slice(0,r)).trim();if(!i)return{kind:`text`,value:`{${e}}`};let a={kind:`param`,name:i};if(r>=0){let e=n.slice(r+1).trim(),t=e.indexOf(`/`);a.format=(t<0?e:e.slice(0,t)).trim(),t>=0&&(a.arg=e.slice(t+1).trim())}if(t.length>1){a.variants=[];for(let e of t.slice(1)){let t=e.indexOf(`:`);if(t<0)continue;let n=e.slice(0,t).trim(),r=e.slice(t+1).trim();n&&a.variants.push([n,Ri(r,!0)])}}return a}function Vi(e){let t=[],n=``,r=0,i=0;for(;i<e.length;){let a=e[i];if(a===`{`){if(e[i+1]===`{`){n+=`{{`,i+=2;continue}r+=1,n+=a}else if(a===`}`){if(e[i+1]===`}`){n+=`}}`,i+=2;continue}--r,n+=a}else if(a===`|`&&r===0){if(e[i+1]===`|`){n+=`|`,i+=2;continue}t.push(n),n=``}else n+=a;i+=1}return t.push(n),t}var Hi=/<(\/?)([a-zA-Z][\w-]*)(\/?)>/g,Ui=/&(?:(lt|gt|amp)|#(\d+)|#[xX]([0-9a-fA-F]+));/g,Wi={lt:`<`,gt:`>`,amp:`&`},Gi=e=>e.replace(Ui,(e,t,n,r)=>{if(t)return Wi[t];let i=n?parseInt(n,10):parseInt(r,16);return i<=1114111?String.fromCodePoint(i):e});function Ki(e){Hi.lastIndex=0;let t=[],n=[],r=()=>n.length?n[n.length-1].children:t,i=e=>{e&&r().push(Gi(e))},a=0,o;for(;(o=Hi.exec(e))!==null;){let[t,s,c,l]=o;if(i(e.slice(a,o.index)),a=o.index+t.length,l)r().push({name:c,children:[]});else if(s){if(n.length&&n[n.length-1].name===c){let e=n.pop();r().push(e)}else i(t)}else n.push({name:c,children:[]})}for(i(e.slice(a));n.length;){let e=n.pop();r().push(...e.children)}return t}function qi(e,t){for(let n of e)if(n.kind===`param`&&n.name){t.has(n.name)||t.set(n.name,new Set);for(let[e,r]of n.variants??[])t.get(n.name).add(e),qi(r,t)}}function Ji(e){let t=new Map;try{qi(Ii(e),t)}catch{}return t}function Yi(e,t){for(let n of e)typeof n!=`string`&&(t.push(n.name),Yi(n.children,t))}function Xi(e){let t=[];try{Yi(Ki(e),t)}catch{return t}return t}function Zi(e){let t=new Map;for(let n of e)t.set(n,(t.get(n)??0)+1);return t}var Qi=e=>e.length===1?e[0]:`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`;function $i(e,t){let n=Ji(e),r=Ji(t),i=[...new Set([...n.keys(),...r.keys()])].sort().map(e=>({name:e,inSource:n.has(e),inTarget:r.has(e)})),a=[],o=i.filter(e=>e.inSource&&!e.inTarget).map(e=>`{${e.name}}`),s=i.filter(e=>!e.inSource&&e.inTarget).map(e=>`{${e.name}}`);o.length&&a.push(`${Qi(o)} is missing, so its value never reaches the text`),s.length&&a.push(`${Qi(s)} is not in the source, so it renders as literal text`);for(let[e,t]of r)t.size&&!t.has(`other`)&&a.push(`the block for {${e}} has no "other" case, so some counts render empty`);let c=Zi(Xi(e)),l=Zi(Xi(t));for(let[e,t]of c)(l.get(e)??0)<t&&a.push(`<${e}> is missing from the translation`);for(let[e,t]of l)(c.get(e)??0)<t&&a.push(`<${e}> is not in the source message`);return{params:i,problems:a}}var ea=Y(`<span> </span>`),ta=Y(`<span class="vmsg svelte-1vuyl2e"> </span>`),na=Y(`<span class="tl edit svelte-1vuyl2e"><span class="disc svelte-1vuyl2e"> </span> <textarea class="tf svelte-1vuyl2e" rows="2"></textarea></span> <span class="editbar svelte-1vuyl2e"><!> <!> <!> <button class="btn sm svelte-1vuyl2e"> </button> <button class="btn sm quiet svelte-1vuyl2e">Cancel</button> <span class="keys svelte-1vuyl2e">Enter saves · Esc closes</span></span>`,1),ra=Y(`<button class="tv svelte-1vuyl2e"> </button>`),ia=Y(`<button class="tv none svelte-1vuyl2e"> </button>`),aa=Y(`<span class="sig svelte-1vuyl2e"> </span>`),oa=Y(`<span class="tl svelte-1vuyl2e"><span class="disc svelte-1vuyl2e"> </span> <!> <!></span>`),sa=Y(`<article><span class="tile svelte-1vuyl2e"><!></span> <span class="row-t svelte-1vuyl2e"><span class="src svelte-1vuyl2e"> </span> <!></span></article>`);function ca(e,t){Ve(t,!0);let n=A(()=>t.row.cells.filter(e=>t.shown.includes(e.locale))),r=A(()=>[`broken`,`missing`,`draft`,`done`].find(e=>q(n).some(t=>t.state===e))??`done`),i=M(``),a=M(!1),o=M(null),s=A(()=>$i(t.row.source,q(i))),c=e=>`${e.locale} ${t.row.key}`;function l(e){N(i,e.text,!0),N(o,null),t.onEdit(c(e))}async function u(e){q(a)||(N(a,!0),N(o,await t.onSave(e.locale,t.row.key,q(i)),!0),N(a,!1),q(o)||t.onEdit(null))}function d(e,n){e.key===`Escape`&&t.onEdit(null),e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),u(n))}var f=sa();let p;var m=I(f);ki(I(m),{get state(){return q(r)}}),D(m);var h=R(m,2),g=I(h),_=L(g,!0);jr(R(g,2),17,()=>q(n),e=>e.locale,(e,n)=>{var r=_r(),f=Qt(r),p=e=>{var r=na(),c=Qt(r),l=I(c),f=L(l,!0),p=R(l,2);et(p),$e(p,!0),D(c);var m=R(c,2),h=I(m);jr(h,17,()=>q(s).params,e=>e.name,(e,t)=>{var n=ea();let r;var i=L(n);z(()=>{r=Ur(n,1,`pm svelte-1vuyl2e`,null,r,{gone:q(t).inSource&&!q(t).inTarget}),Z(i,`${q(t).inSource&&!q(t).inTarget?`+`:``}{${q(t).name??``}}`)}),X(e,n)});var g=R(h,2);jr(g,16,()=>q(s).problems,e=>e,(e,t)=>{var n=ta(),r=L(n,!0);z(()=>Z(r,t)),X(e,n)});var _=R(g,2),v=e=>{var t=ta(),n=L(t,!0);z(()=>Z(n,q(o))),X(e,t)};Q(_,e=>{q(o)&&!q(s).problems.length&&e(v)});var y=R(_,2),ee=L(y,!0),b=R(y,2);Ce(2),D(m),z(()=>{Zr(l,`data-state`,q(n).state),Z(f,q(n).locale),Zr(p,`aria-label`,`Translation for ${q(n).locale??``}`),y.disabled=q(a),Z(ee,q(a)?`Saving`:`Save`)}),J(`keydown`,p,e=>d(e,q(n))),ti(p,()=>q(i),e=>N(i,e)),J(`click`,y,()=>u(q(n))),J(`click`,b,()=>t.onEdit(null)),X(e,r)},m=A(()=>t.editing===c(q(n))),h=e=>{var t=oa(),r=I(t),i=L(r,!0),a=R(r,2),o=e=>{var t=ra(),r=L(t,!0);z(()=>{Zr(t,`title`,q(n).text),Z(r,q(n).text)}),J(`click`,t,()=>l(q(n))),X(e,t)},s=e=>{var t=ia(),r=L(t,!0);z(()=>Z(r,fi.missing.long)),J(`click`,t,()=>l(q(n))),X(e,t)};Q(a,e=>{q(n).text?e(o):e(s,-1)}),jr(R(a,2),16,()=>q(n).signals,e=>e,(e,t)=>{var n=aa(),r=L(n,!0);z(()=>{Zr(n,`title`,mi[t]??t),Z(r,mi[t]??t)}),X(e,n)}),D(t),z(()=>{Zr(r,`data-state`,q(n).state),Z(i,q(n).locale)}),X(e,t)};Q(f,e=>{q(m)?e(p):e(h,-1)}),X(e,r)}),D(h),D(f),z(e=>{p=Ur(f,1,`row svelte-1vuyl2e`,null,p,{open:e}),Zr(f,`data-worst`,q(r)),Zr(m,`data-state`,q(r)),Z(_,t.row.source)},[()=>q(n).some(e=>t.editing===c(e))]),X(e,f),He()}or([`keydown`,`click`]);function la(e,t=``,n={}){for(let[r,i]of Object.entries(e)){let e=t?`${t}.${r}`:r;typeof i==`string`?n[e]=i:i&&typeof i==`object`&&!Array.isArray(i)&&la(i,e,n)}return n}function ua(e){let t={};for(let n of e.locales)t[n]=la(e.catalogs[n]??{});let n=new Map;for(let t of e.check.broken)t.severity===`error`&&n.set(`${t.locale}\u0000${t.key}`,t.issue);let r=new Map;for(let[t,n]of Object.entries(e.drafts))r.set(t,new Set(n));let i=t[e.sourceLocale]??{},a=e.locales.filter(t=>t!==e.sourceLocale),o=Object.keys(i).map(o=>({key:o,source:i[o]??``,origins:e.origins[o]??[],cells:a.map(i=>{let a=t[i]?.[o]??``,s=n.get(`${i}\u0000${o}`);return{locale:i,text:a,state:s?`broken`:a?r.get(i)?.has(o)?`draft`:`done`:`missing`,issue:s,signals:(e.triage?.[i]?.[o]??[]).map(e=>e.signal)}})}));return{root:e.root,sourceLocale:e.sourceLocale,locales:e.locales,rows:o,problems:e.problems}}function da(e){return e.locales.map(t=>{let n=e.rows.length;if(t===e.sourceLocale)return{locale:t,source:!0,total:n,done:n,draft:0,missing:0,broken:0};let r={done:0,draft:0,missing:0,broken:0};for(let n of e.rows){let e=n.cells.find(e=>e.locale===t);e&&r[e.state]++}return{locale:t,source:!1,total:n,...r}})}function fa(e,t){Object.assign(e,ua(t))}function pa(e,t){let n=t.text.trim().toLowerCase(),r=new Set(t.locales);return e.filter(e=>{let i=e.cells.filter(e=>r.has(e.locale));return t.state===`look`&&!i.some(e=>e.signals.length)||t.state!==`all`&&t.state!==`look`&&!i.some(e=>e.state===t.state)?!1:!n||e.source.toLowerCase().includes(n)?!0:i.some(e=>e.text.toLowerCase().includes(n))})}var ma=Y(`<div class="bill svelte-5qpy41"><p class="lede svelte-5qpy41"> </p> <p class="why svelte-5qpy41"> </p> <div class="pair svelte-5qpy41"><button class="go svelte-5qpy41"> </button> <button class="plain svelte-5qpy41"> </button></div></div>`),ha=Y(`<div class="bill svelte-5qpy41"><p class="lede svelte-5qpy41"> </p> <div class="track svelte-5qpy41"><span class="fill svelte-5qpy41"></span></div> <p class="why svelte-5qpy41"> </p></div>`),ga=Y(`<button class="act svelte-5qpy41"><span class="name svelte-5qpy41"> </span> <span class="why svelte-5qpy41"> </span></button> <button class="act svelte-5qpy41"><span class="name svelte-5qpy41"> </span> <span class="why svelte-5qpy41"> </span></button>`,1),_a=Y(`<p> </p>`),va=Y(`<section class="acts svelte-5qpy41" aria-label="Commands"><h2 class="cap svelte-5qpy41">Commands</h2> <!> <!></section>`);function ya(e,t){Ve(t,!0);let n=M(Gt({at:`idle`})),r=A(()=>q(n).at===`finding`||q(n).at===`planning`||q(n).at===`running`);function i(e,t=!1){N(n,{at:`said`,text:e,bad:t},!0)}async function a(){N(n,{at:`finding`},!0);let e=await t.api.extract();if(e.error||!e.value)return i(e.error??`no answer`,!0);let{found:r}=e.value;if(!r)return i($.nothingNew);let a=`${gi(r)} your code uses and your catalogs did not have`;await t.onDone(a),i(a)}async function o(){N(n,{at:`planning`},!0);let e=await t.api.plan(t.shown);if(e.error||!e.value)return i(e.error??`no answer`,!0);if(!e.value.total)return i($.nothingMissing);N(n,{at:`plan`,plan:e.value},!0)}async function s(e){let r=await t.api.job(e);if(r.error||!r.value)return i(r.error??`no answer`,!0);let a=r.value;if(a.state===`running`){N(n,{at:`running`,job:a},!0);return}let o=`${gi(a.done)} translated, unread until you read them`;await t.onDone(o),i(a.state===`failed`?a.message??`the run failed`:o,a.state===`failed`)}async function c(){let e=await t.api.translate(t.shown);if(e.error||!e.value)return i(e.error??`no answer`,!0);N(n,{at:`running`,job:e.value},!0)}ii(()=>{t.api.job().then(e=>{e.value&&q(n).at===`idle`&&N(n,{at:`running`,job:e.value},!0)})}),dn(()=>{if(q(n).at!==`running`)return;let e=q(n).job.id,t=setInterval(()=>void s(e),1e3);return()=>clearInterval(t)});let l=A(()=>q(n).at===`running`&&q(n).job.total?q(n).job.done/q(n).job.total:0);var u=va(),d=R(I(u),2),f=e=>{var t=ma(),r=I(t),i=L(r),a=R(r,2),o=L(a,!0),s=R(a,2),l=I(s),u=L(l,!0),d=R(l,2),f=L(d,!0);D(s),D(t),z((e,t)=>{Z(i,`${e??``} in ${t??``}`),Z(o,$.translateWhy),Z(u,$.translate),Z(f,$.cancel)},[()=>gi(q(n).plan.total),()=>Object.keys(q(n).plan.pending).join(`, `)]),J(`click`,l,c),J(`click`,d,()=>N(n,{at:`idle`},!0)),X(e,t)},p=e=>{var t=ha(),r=I(t),i=L(r),a=R(r,2),o=L(a),s=L(R(a,2));D(t),z(e=>{Z(i,`${$.running??``} ${q(n).job.locale??``??``}`),Gr(o,`width: ${e??``}%`),Z(s,`${q(n).job.done??``} of ${q(n).job.total??``}`)},[()=>Math.round(q(l)*100)]),X(e,t)},m=e=>{var i=ga(),s=Qt(i),c=I(s),l=L(c,!0),u=L(R(c,2),!0);D(s);var d=R(s,2),f=I(d),p=L(f,!0),m=L(R(f,2),!0);D(d),z(()=>{s.disabled=q(r),Z(l,q(n).at===`finding`?$.working:$.find),Z(u,$.findWhy),d.disabled=q(r)||!t.shown.length,Z(p,$.translate),Z(m,t.shown.length?$.translateWhy:$.pickFirst)}),J(`click`,s,a),J(`click`,d,o),X(e,i)};Q(d,e=>{q(n).at===`plan`?e(f):q(n).at===`running`?e(p,1):e(m,-1)});var h=R(d,2),g=e=>{var t=_a();let r;var i=L(t,!0);z(()=>{r=Ur(t,1,`said svelte-5qpy41`,null,r,{bad:q(n).bad}),Z(i,q(n).text)}),X(e,t)};Q(h,e=>{q(n).at===`said`&&e(g)}),D(u),X(e,u),He()}or([`click`]);var ba=Y(`<li><code> </code> </li>`),xa=Y(`<ul class="problems svelte-c7dw08"></ul>`),Sa=Y(`<p class="note svelte-c7dw08">Tick a language in the rail to see its translations.</p>`),Ca=Y(`<p class="note svelte-c7dw08">Nothing matches. Every message here is in the state you asked for.</p>`),wa=Y(`<p class="note svelte-c7dw08"> </p>`),Ta=Y(`<!> <!>`,1),Ea=Y(`<main class="table svelte-c7dw08"><!></main>`),Da=Y(`Saved in <code> </code>`,1),Oa=Y(`<p class="snack svelte-c7dw08" role="status"><svg viewBox="0 0 16 16" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="svelte-c7dw08"><path d="m3.4 8.4 3 3 6.2-6.8"></path></svg> <!> <button class="svelte-c7dw08">Dismiss</button></p>`),ka=Y(`<div class="shell svelte-c7dw08"><header class="bar svelte-c7dw08"><span class="brand svelte-c7dw08">verbaly <b class="svelte-c7dw08">studio</b></span> <input class="search svelte-c7dw08" type="search" placeholder="Search the text, not the key" aria-label="Search the text, not the key"/> <span class="root svelte-c7dw08"> </span></header> <!> <div class="body svelte-c7dw08"><!> <!></div> <!></div>`);function Aa(e,t){Ve(t,!0);let n=M(null),r=M(null),i=M(null),a=M(`messages`),o=M(null);async function s(){N(a,`health`);let e=await t.api.health();if(e.error){N(r,{text:e.error,file:``},!0);return}e.value&&N(o,e.value,!0)}dn(()=>{t.api.health().then(e=>{e.value&&N(o,e.value,!0)})});async function c(e){let a=await t.api.state();if(a.error||!a.value){N(r,{text:a.error??`[verbaly] the server sent no state`,file:``},!0);return}N(n,null),N(i,null),fa(t.panel,a.value),N(r,{text:e,file:``},!0);let s=await t.api.health();s.value&&N(o,s.value,!0)}async function l(e,n,a){let o=await t.api.setRead(e,n,a);if(o.error){N(r,{text:o.error,file:``},!0);return}let s=new Set(o.value?.keys??[]);for(let n of t.panel.rows){if(!s.has(n.key))continue;let t=n.cells.find(t=>t.locale===e);t?.text&&(t.state=a?`draft`:`done`)}N(i,a?null:{locale:e,keys:o.value?.keys??[]},!0)}async function u(e,n,i){let a=await t.api.save(e,n,i);if(a.error)return a.error;let o=t.panel.rows.find(e=>e.key===n)?.cells.find(t=>t.locale===e);return o&&(o.text=i,o.state=i?`done`:`missing`,o.issue=void 0),N(r,{text:i,file:`${e}.json`},!0),null}let d=M(`all`),f=M(``),p=M(null),m=A(()=>t.panel.locales.filter(e=>e!==t.panel.sourceLocale)),h=A(()=>q(p)??q(m).slice(0,1)),g=A(()=>da(t.panel)),_=A(()=>pa(t.panel.rows,{text:q(f),state:q(d),locales:q(h)})),v=A(()=>{let e={all:0,look:0,missing:0,draft:0,broken:0};for(let n of[`all`,`look`,`missing`,`draft`,`broken`])e[n]=pa(t.panel.rows,{text:q(f),state:n,locales:q(h)}).length;return e}),y=M(60);dn(()=>{q(f),q(d),q(h),N(y,60)});function ee(e){let t=e.currentTarget;t.scrollTop+t.clientHeight>t.scrollHeight-600&&q(y)<q(_).length&&N(y,q(y)+60)}function b(e){N(p,q(h).includes(e)?q(h).filter(t=>t!==e):[...q(h),e],!0)}var x=ka(),te=I(x),ne=R(I(te),2);Yr(ne);var S=R(ne,2),re=L(S,!0);D(te);var ie=R(te,2),ae=e=>{var n=xa();jr(n,21,()=>t.panel.problems,e=>e.scope+e.message,(e,t)=>{var n=ba(),r=I(n),i=L(r,!0),a=R(r);D(n),z(()=>{Z(i,q(t).scope),Z(a,` ${q(t).message??``}`)}),X(e,n)}),D(n),X(e,n)};Q(ie,e=>{t.panel.problems.length&&e(ae)});var oe=R(ie,2),se=I(oe);{let e=e=>{ya(e,{get api(){return t.api},get shown(){return q(h)},onDone:c})},n=A(()=>q(o)?{bad:q(o).entries.filter(e=>e.level!==`ok`).length}:null);Ci(se,{get health(){return q(g)},get shown(){return q(h)},get state(){return q(d)},get counts(){return q(v)},get pending(){return q(i)},get checks(){return q(n)},onToggle:b,onState:e=>N(d,e,!0),onRead:e=>l(e,void 0,!1),onUndo:()=>q(i)&&l(q(i).locale,q(i).keys,!0),onHealth:s,actions:e,$$slots:{actions:!0}})}var ce=R(se,2),le=e=>{{let t=A(()=>q(o)?.entries??[]),n=A(()=>q(o)?.ok??!0);di(e,{get entries(){return q(t)},get ok(){return q(n)},onClose:()=>N(a,`messages`)})}},ue=e=>{var t=Ea(),r=I(t),i=e=>{X(e,Sa())},a=e=>{X(e,Ca())},o=e=>{var t=Ta(),r=Qt(t);jr(r,17,()=>q(_).slice(0,q(y)),e=>e.key,(e,t)=>{ca(e,{get row(){return q(t)},get shown(){return q(h)},get editing(){return q(n)},onEdit:e=>N(n,e,!0),onSave:u})});var i=R(r,2),a=e=>{var t=wa(),n=L(t);z(()=>Z(n,`${q(_).length-q(y)} more below`)),X(e,t)};Q(i,e=>{q(y)<q(_).length&&e(a)}),X(e,t)};Q(r,e=>{q(h).length?q(_).length?e(o,-1):e(a,1):e(i)}),D(t),ar(`scroll`,t,ee),X(e,t)};Q(ce,e=>{q(a)===`health`?e(le):e(ue,-1)}),D(oe);var de=R(oe,2),fe=e=>{var t=Oa(),n=R(I(t),2),i=e=>{var t=Da(),n=L(R(Qt(t)),!0);z(()=>Z(n,q(r).file)),X(e,t)},a=e=>{var t=gr();z(()=>Z(t,q(r).text)),X(e,t)};Q(n,e=>{q(r).file?e(i):e(a,-1)});var o=R(n,2);D(t),J(`click`,o,()=>N(r,null)),X(e,t)};Q(de,e=>{q(r)&&e(fe)}),D(x),z(()=>{Zr(S,`title`,t.panel.root),Z(re,t.panel.root)}),ti(ne,()=>q(f),e=>N(f,e)),X(e,x),He()}or([`click`]);async function ja(e,t,n){let r=t.includes(`?`)?`&`:`?`,i;try{i=await fetch(`${t}${r}t=${encodeURIComponent(e)}`,{...n,headers:n?.body===void 0?void 0:{"content-type":`application/json`},body:n?.body===void 0?void 0:JSON.stringify(n.body)})}catch{return{error:`[verbaly] the studio server is not answering, is it still running?`}}let a=await i.json().catch(()=>({}));return i.ok?{value:a}:{error:a.error??`[verbaly] the server answered ${i.status}`}}function Ma(e){return{state:()=>ja(e,`/api/state`),health:()=>ja(e,`/api/health`),save:(t,n,r)=>ja(e,`/api/message/${encodeURIComponent(t)}/${encodeURIComponent(n)}`,{method:`PUT`,body:{text:r}}),setRead:(t,n,r)=>ja(e,`/api/approve`,{method:`POST`,body:{locale:t,keys:n,undo:r}}),extract:()=>ja(e,`/api/extract`,{method:`POST`}),plan:t=>{let n=t.map(e=>`locale=${encodeURIComponent(e)}`).join(`&`);return ja(e,`/api/translate${n?`?${n}`:``}`)},translate:t=>ja(e,`/api/translate`,{method:`POST`,body:{locales:t}}),job:t=>ja(e,t?`/api/job/${encodeURIComponent(t)}`:`/api/job`)}}function Na(e){return Gt(ua(e))}var Pa=new URLSearchParams(location.search).get(`t`)??``;async function Fa(){let e=document.getElementById(`app`),t=Ma(Pa),n=await t.state();if(n.error||!n.value){e.textContent=n.error??`[verbaly] the server sent no state`;return}Sr(Aa,{target:e,props:{panel:Na(n.value),api:t}})}Fa();