diff --git a/README.md b/README.md index 56f1dc9..da35178 100644 --- a/README.md +++ b/README.md @@ -1595,6 +1595,24 @@ visually marked with a vertical rail. Formatting uses validated structured fields rather than guessing command boundaries from the justification. Legacy or incomplete requests retain their original bounded text. +**File-change approvals (shared app-server only):** proposed additions, deletions +and updates are shown as scrollable patches, with file paths, rename destinations, +old/new line numbers and green additions/red removals. An overall `+N / −N` +summary counts added and removed source lines across all proposed files (not +wrapped display rows or patch headers). Full detail retains the +preceding commentary and justification. The terminal and writable web interface +offer **APPROVE ONCE** (with confirmation), **DECLINE**, and **REJECT & STOP TURN**. +Read-only web mode can display the patch but cannot answer it. Inline terminal +buttons appear only when the entire proposed patch fits; otherwise open full detail. + +The patch must come from the matching live thread, turn and item; Codexometer +never reconstructs approval details from files on disk. Patches are memory-only, +bounded to 64 KiB of JSON and 64 files per item. Missing, oversized, unsafe or +changed patches fail closed: review them in Codex (a fresh matching approval +request can restore controls). Directory-root grants remain in Codex because +their app-server semantics are unstable. File approvals do not offer session-wide +or persistent permission grants. + When the approval event omits the command or directory, Codexometer associates it with the preceding command item from the same thread, turn and item. A complete ordinary command request offers clickable @@ -1692,14 +1710,14 @@ acknowledgement animations remain confined to full detail. Local rollout logs do **not** persist Codex's approval-request events, so a local preview can show only the message preceding an approval. `INPUT NEEDED` or `CHECK SESSION` alone never enables these controls. Requests with missing, -truncated or sanitised-away details, network approvals, file changes, permission +truncated or sanitised-away details, network approvals, incomplete file changes, permission grants and other unsupported requests remain **REPLY IN CODEX**. The complete eligible request is available in the scrollable detail, not just the compact two-line preview. Unsupported requests may have only a bounded excerpt. When controls are unavailable, the detail page explains why beside **REPLY IN CODEX**: for example, missing command/directory or request identity, -additional permissions, network/file-change approval, no supported decisions, +additional permissions, network approval, unavailable complete file changes, no supported decisions, truncated or sanitised text, local-only observation, or a resolved/disconnected request. Eligible requests on small terminals instead explain that the terminal must be enlarged. These diagnostics do not relax any approval safeguards. diff --git a/internal/codex/file_approval.go b/internal/codex/file_approval.go new file mode 100644 index 0000000..5c24238 --- /dev/null +++ b/internal/codex/file_approval.go @@ -0,0 +1,211 @@ +package codex + +import ( + "bytes" + "crypto/rand" + "encoding/json" + "fmt" + "regexp" + "strconv" + "strings" + "unicode" + "unicode/utf8" +) + +// Patches stay in memory, scoped to an exact live item. Never read the local +// filesystem to reconstruct what a remote approval might authorise. +const fileApprovalLimit = 64 * 1024 + +type FileChange struct { + Path string `json:"path"` + Kind struct { + Type string `json:"type"` + // PatchChangeKind's Update variant uses snake_case on the wire, + // unlike outer request fields. Verified against Codex 0.160.1's + // generated JSON schema; do not infer movePath from threadId. + MovePath string `json:"move_path"` + } `json:"kind"` + Diff string `json:"diff"` +} + +func safePatchText(s string) bool { + if !utf8.ValidString(s) { + return false + } + for _, r := range s { + if (unicode.IsControl(r) && r != '\n' && r != '\t') || unicode.Is(unicode.Cf, r) { + return false + } + } + return true +} + +func validatedFileChanges(raw json.RawMessage) string { + if len(raw) > fileApprovalLimit || !utf8.Valid(raw) { + return "" + } + var changes []FileChange + decoder := json.NewDecoder(bytes.NewReader(raw)) + decoder.DisallowUnknownFields() + if decoder.Decode(&changes) != nil || len(changes) == 0 || len(changes) > 64 { + return "" + } + var fields []map[string]json.RawMessage + if json.Unmarshal(raw, &fields) != nil { + return "" + } + for _, f := range fields { + if len(f["diff"]) == 0 || string(f["diff"]) == "null" { + return "" + } + } + for _, c := range changes { + if strings.TrimSpace(c.Path) == "" || strings.ContainsAny(c.Path+c.Kind.MovePath, "\n\t") || !safePatchText(c.Path+c.Kind.MovePath+c.Diff) { + return "" + } + switch c.Kind.Type { + case "add", "delete", "update": + default: + return "" + } + } + data, _ := json.Marshal(changes) + return string(data) +} + +func configureFileApproval(c *SessionContext, grantRoot string, state *daemonContextState) { + c.ApprovalToken = "" + c.ApprovalOptions = [8]ApprovalOption{} + c.ApprovalBlocked = "file-change" + if c.FileChanges == "" { + return + } + if c.TurnID == "" || c.ItemID == "" || state.ended || state.activeTurn != "" && c.TurnID != state.activeTurn { + c.ApprovalBlocked = "missing-identity" + return + } + // Root grants have unstable semantics. Keep them in Codex, rather than + // suggesting that approval once authorises only the displayed patch. + if grantRoot != "" { + c.ApprovalBlocked = "permissions" + return + } + if SanitizeSessionContext(c.Text) != c.Text { + c.ApprovalBlocked = "sanitised" + return + } + c.ApprovalOptions, c.ApprovalDecisions = commandApprovalOptions([]json.RawMessage{json.RawMessage(`"accept"`), json.RawMessage(`"decline"`), json.RawMessage(`"cancel"`)}) + c.ApprovalBlocked, c.ApprovalToken = "", rand.Text() +} + +func (s *daemonContextState) capturePatch(turn, item string, raw json.RawMessage) { + if turn == "" || item == "" || s.ended || s.activeTurn != "" && turn != s.activeTurn { + return + } + if s.patches == nil { + s.patches = map[string]string{} + } + key := turn + "/" + item + patch := validatedFileChanges(raw) + if _, exists := s.patches[key]; exists || len(s.patches) < 16 { + s.patches[key] = patch + } + // Any changed patch invalidates an already displayed/confirmed capability. + // A new approval request is required; never silently broaden a grant. + for id, c := range s.requests { + if c.TurnID == turn && c.ItemID == item && c.Kind == SessionContextApproval && c.FileChanges != patch { + c.FileChanges, c.ApprovalToken, c.ApprovalBlocked = patch, "", "file-change" + s.requests[id] = c + } + } +} + +type FileDiffLine struct { + Text string `json:"text"` + Kind string `json:"kind"` + Old int `json:"old,omitempty"` + New int `json:"new,omitempty"` +} + +// Count logical changed lines, not wrapped display rows or patch headers. +func FileDiffTotals(lines []FileDiffLine) (added, removed int) { + for _, line := range lines { + switch line.Kind { + case "addition": + added++ + case "removal": + removed++ + } + } + return +} + +var diffHunk = regexp.MustCompile(`^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@`) + +// FileDiffLines is shared by both front ends. Add/delete diffs are whole-file +// content; update diffs are unified patches. Prefixes are never inferred from +// file contents for add/delete operations. +func FileDiffLines(encoded string) (out []FileDiffLine) { + var changes []FileChange + if json.Unmarshal([]byte(encoded), &changes) != nil { + return nil + } + for _, c := range changes { + out = append(out, FileDiffLine{Text: strings.ToUpper(c.Kind.Type) + " // " + c.Path, Kind: "heading"}) + if c.Kind.MovePath != "" { + out = append(out, FileDiffLine{Text: "→ " + c.Kind.MovePath, Kind: "heading"}) + } + if c.Diff == "" { + continue + } + old, next := 0, 0 + if c.Kind.Type == "add" { + next = 1 + } + if c.Kind.Type == "delete" { + old = 1 + } + for _, text := range strings.Split(strings.TrimSuffix(c.Diff, "\n"), "\n") { + line := FileDiffLine{Text: strings.ReplaceAll(text, "\t", " "), Kind: "body"} + switch { + case c.Kind.Type == "add": + line.Kind, line.New, line.Text = "addition", next, "+"+line.Text + next++ + case c.Kind.Type == "delete": + line.Kind, line.Old, line.Text = "removal", old, "-"+line.Text + old++ + case diffHunk.MatchString(text): + m := diffHunk.FindStringSubmatch(text) + old, _ = strconv.Atoi(m[1]) + next, _ = strconv.Atoi(m[2]) + line.Kind = "metadata" + case strings.HasPrefix(text, "+") && next > 0: + line.Kind, line.New = "addition", next + next++ + case strings.HasPrefix(text, "-") && old > 0: + line.Kind, line.Old = "removal", old + old++ + case strings.HasPrefix(text, " ") && (old > 0 || next > 0): + line.Old, line.New = old, next + old++ + next++ + } + out = append(out, line) + } + } + return out +} + +func (l FileDiffLine) NumberedText() string { + if l.Kind == "heading" || l.Kind == "metadata" { + return l.Text + } + old, next := "", "" + if l.Old > 0 { + old = strconv.Itoa(l.Old) + } + if l.New > 0 { + next = strconv.Itoa(l.New) + } + return fmt.Sprintf("%5s %5s │ %s", old, next, l.Text) +} diff --git a/internal/codex/file_approval_test.go b/internal/codex/file_approval_test.go new file mode 100644 index 0000000..7b01567 --- /dev/null +++ b/internal/codex/file_approval_test.go @@ -0,0 +1,135 @@ +package codex + +import ( + "encoding/json" + "strings" + "testing" + "time" +) + +const testFilePatch = `[{"path":"/work/a.go","kind":{"type":"update","move_path":null},"diff":"@@ -3,2 +3,2 @@\n-old\n+new\n context\n"}]` + +func TestFileApprovalRenameWireShape(t *testing.T) { + // Matches PatchChangeKind in `codex app-server generate-json-schema` + // from codex-cli 0.160.1: the nested variant field is move_path. + patch := strings.Replace(testFilePatch, `"move_path":null`, `"move_path":"/work/renamed.go"`, 1) + states, c := fileApprovalFixture(t, patch, nil) + if c.ApprovalToken == "" || c.ApprovalBlocked != "" { + t.Fatalf("valid rename rejected: %+v", c) + } + lines := FileDiffLines(c.FileChanges) + if len(lines) < 2 || lines[0].Text != "UPDATE // /work/a.go" || lines[1].Text != "→ /work/renamed.go" { + t.Fatalf("rename source/destination missing: %+v", lines) + } + changed := strings.Replace(patch, "/work/renamed.go", "/work/another.go", 1) + states["root"].capturePatch("turn", "patch", json.RawMessage(changed)) + if got := states["root"].requests[`"req"`]; got.ApprovalToken != "" || got.FileChanges == c.FileChanges { + t.Fatal("destination change retained old approval", got) + } + for _, invalid := range []string{ + strings.Replace(patch, "move_path", "movePath", 1), + strings.Replace(patch, "/work/renamed.go", `/work/\u202Erenamed.go`, 1), + } { + _, blocked := fileApprovalFixture(t, invalid, nil) + if blocked.ApprovalToken != "" || blocked.FileChanges != "" { + t.Fatal("unknown or unsafe rename accepted", blocked) + } + } +} + +func fileApprovalFixture(t *testing.T, patch string, overrides map[string]any) (map[string]*daemonContextState, SessionContext) { + t.Helper() + states := map[string]*daemonContextState{} + daemonContextEvent(states, "item/started", nil, json.RawMessage(`{"threadId":"root","turnId":"turn","item":{"type":"fileChange","id":"patch","changes":`+patch+`}}`), time.Now()) + p := map[string]any{"threadId": "root", "turnId": "turn", "itemId": "patch", "reason": "Update the implementation"} + for k, v := range overrides { + p[k] = v + } + raw, _ := json.Marshal(p) + daemonContextEvent(states, "item/fileChange/requestApproval", json.RawMessage(`"req"`), raw, time.Now()) + return states, states["root"].requests[`"req"`] +} + +func TestFileApprovalCorrelationAndSafety(t *testing.T) { + _, c := fileApprovalFixture(t, testFilePatch, nil) + if c.ApprovalToken == "" || c.FileChanges == "" || c.ApprovalBlocked != "" { + t.Fatalf("blocked complete patch: %+v", c) + } + for i, want := range []string{"accept", "decline", "cancel"} { + if c.ApprovalOptions[i].Wire != `"`+want+`"` { + t.Fatal(c.ApprovalOptions) + } + } + for name, p := range map[string]string{ + "missing": "null", "empty": "[]", "invalid": "{}", + "no diff": `[{"path":"a","kind":{"type":"add"}}]`, + "null diff": `[{"path":"a","kind":{"type":"add"},"diff":null}]`, + "unknown kind": strings.Replace(testFilePatch, `"update"`, `"future"`, 1), + "unknown field": strings.Replace(testFilePatch, `"path":`, `"permissions":true,"path":`, 1), + "escape": strings.Replace(testFilePatch, "old", `\u001b[31mold`, 1), + "bidi": strings.Replace(testFilePatch, "old", `\u202eold`, 1), + "large": strings.Replace(testFilePatch, "old", strings.Repeat("x", fileApprovalLimit), 1), + } { + t.Run(name, func(t *testing.T) { + _, c := fileApprovalFixture(t, p, nil) + if c.ApprovalToken != "" || c.FileChanges != "" { + t.Fatal("unsafe patch actionable", c) + } + }) + } + for _, fields := range []map[string]any{{"turnId": "other"}, {"itemId": "other"}, {"grantRoot": "/work"}, {"reason": "hidden\x1b[31m"}} { + _, c := fileApprovalFixture(t, testFilePatch, fields) + if c.ApprovalToken != "" { + t.Fatal("unsafe request actionable", c) + } + } +} + +func TestFileApprovalPatchChangeAndLifecycle(t *testing.T) { + states, c := fileApprovalFixture(t, testFilePatch, nil) + changed := strings.Replace(testFilePatch, "new", "replacement", 1) + daemonContextEvent(states, "item/fileChange/patchUpdated", nil, json.RawMessage(`{"threadId":"root","turnId":"turn","itemId":"patch","changes":`+changed+`}`), time.Now()) + if got := states["root"].requests[`"req"`]; got.ApprovalToken != "" || got.FileChanges == c.FileChanges { + t.Fatal("old grant survived patch change", got) + } + for _, method := range []string{"turn/started", "turn/completed", "turn/interrupted", "item/completed", "thread/closed"} { + states, _ := fileApprovalFixture(t, testFilePatch, nil) + daemonContextEvent(states, method, nil, json.RawMessage(`{"threadId":"root","turnId":"turn","turn":{"id":"next"},"item":{"id":"patch","type":"fileChange"}}`), time.Now()) + if s := states["root"]; s != nil && (len(s.requests) != 0 || len(s.patches) != 0) { + t.Fatal(method, "retained patch") + } + } +} + +func TestFileDiffNumbering(t *testing.T) { + lines := FileDiffLines(testFilePatch) + if len(lines) != 5 || lines[2].Old != 3 || lines[2].Kind != "removal" || lines[3].New != 3 || lines[3].Kind != "addition" || lines[4].Old != 4 || lines[4].New != 4 { + t.Fatalf("bad numbers: %+v", lines) + } + for _, kind := range []string{"add", "delete"} { + lines := FileDiffLines(`[{"path":"a","kind":{"type":"` + kind + `"},"diff":"+literal\n\tindented\n"}]`) + if len(lines) != 3 || !strings.Contains(lines[1].Text, "+literal") || !strings.Contains(lines[2].Text, " indented") { + t.Fatal(lines) + } + if kind == "add" && lines[2].New != 2 || kind == "delete" && lines[2].Old != 2 { + t.Fatal(lines) + } + } +} + +func TestFileDiffTotals(t *testing.T) { + patch := `[ + {"path":"updated","kind":{"type":"update"},"diff":"--- a/updated\n+++ b/updated\n@@ -3,2 +3,2 @@\n-old\n+new\n context\n@@ -10 +10 @@\n-last\n+replacement\n\\ No newline at end of file\n"}, + {"path":"added","kind":{"type":"add"},"diff":"first\n\n+literal\n"}, + {"path":"deleted","kind":{"type":"delete"},"diff":"first\nsecond"}, + {"path":"empty","kind":{"type":"add"},"diff":""}, + {"path":"renamed","kind":{"type":"update","move_path":"destination"},"diff":""} + ]` + added, removed := FileDiffTotals(FileDiffLines(patch)) + if added != 5 || removed != 4 { + t.Fatalf("got +%d / -%d; want +5 / -4", added, removed) + } + if a, r := FileDiffTotals(nil); a != 0 || r != 0 { + t.Fatal("empty diff has changes") + } +} diff --git a/internal/codex/session_approval.go b/internal/codex/session_approval.go index fbfb228..97cf00d 100644 --- a/internal/codex/session_approval.go +++ b/internal/codex/session_approval.go @@ -6,8 +6,8 @@ import ( ) // SessionApprovalClient is deliberately separate from telemetry. Only live, -// fully displayed, ordinary command requests expose a one-use capability. -// Responses must select a supported choice advertised by that exact request. +// fully displayed ordinary command or file-change requests expose a one-use +// capability. Responses must select a supported choice for that exact request. type SessionApprovalClient interface { SessionApprovalPending(string) bool RespondSessionApproval(context.Context, string, string) error diff --git a/internal/codex/session_approval_unix_test.go b/internal/codex/session_approval_unix_test.go index 85dac9a..2204a4f 100644 --- a/internal/codex/session_approval_unix_test.go +++ b/internal/codex/session_approval_unix_test.go @@ -39,6 +39,24 @@ func TestApprovalWireOneUseAndDisconnect(t *testing.T) { defer conn.Close() states, c := approvalFixture(t, nil) p := &daemonStatusProvider{connection: conn, contexts: states} + for _, decision := range []string{"accept", "decline", "cancel"} { + p.contexts, c = fileApprovalFixture(t, testFilePatch, nil) + if err := p.RespondSessionApproval(context.Background(), c.ApprovalToken, decision); err != nil { + t.Fatal(err) + } + select { + case msg := <-received: + if string(msg["id"]) != `"req"` || string(msg["result"]) != `{"decision":"`+decision+`"}` { + t.Fatal("wrong file approval wire", msg) + } + case <-time.After(time.Second): + t.Fatal("missing file approval") + } + if p.SessionApprovalPending(c.ApprovalToken) { + t.Fatal("file capability reused") + } + } + p.contexts, c = approvalFixture(t, nil) if !p.SessionApprovalPending(c.ApprovalToken) { t.Fatal("missing pending") } diff --git a/internal/codex/session_context.go b/internal/codex/session_context.go index 5aae254..9cfad38 100644 --- a/internal/codex/session_context.go +++ b/internal/codex/session_context.go @@ -40,6 +40,7 @@ type SessionContext struct { PendingApprovalsLimited bool RequestID string CommandDetails ApprovalCommandDetails + FileChanges string // validated, bounded JSON; immutable comparable snapshot InputToken string InputQuestions string // ApprovalToken is an opaque, connection-local capability, never persisted. diff --git a/internal/codex/session_context_daemon.go b/internal/codex/session_context_daemon.go index e001fee..ded9bbf 100644 --- a/internal/codex/session_context_daemon.go +++ b/internal/codex/session_context_daemon.go @@ -25,6 +25,7 @@ type daemonContextState struct { latest SessionContext requests map[string]SessionContext commands map[string]contextCommandItem + patches map[string]string } type contextCommandItem struct{ Command, CWD string } @@ -45,6 +46,7 @@ func daemonContextEvent(states map[string]*daemonContextState, method string, id Decisions []json.RawMessage `json:"availableDecisions"` ThreadID string `json:"threadId"` GrantRoot string `json:"grantRoot"` + Changes json.RawMessage `json:"changes"` RequestID json.RawMessage `json:"requestId"` Reason string `json:"reason"` Command json.RawMessage `json:"command"` @@ -56,14 +58,15 @@ func daemonContextEvent(states map[string]*daemonContextState, method string, id Type string `json:"type"` Text string `json:"text"` } `json:"content"` - ID string `json:"id"` - CWD string `json:"cwd"` - Type string `json:"type"` - Text string `json:"text"` - Phase string `json:"phase"` - Command string `json:"command"` - Status string `json:"status"` - ExitCode *int `json:"exitCode"` + ID string `json:"id"` + CWD string `json:"cwd"` + Type string `json:"type"` + Text string `json:"text"` + Phase string `json:"phase"` + Command string `json:"command"` + Status string `json:"status"` + ExitCode *int `json:"exitCode"` + Changes json.RawMessage `json:"changes"` } `json:"item"` } if json.Unmarshal(raw, &p) != nil || p.ThreadID == "" { @@ -105,6 +108,7 @@ func daemonContextEvent(states map[string]*daemonContextState, method string, id clear(state.requests) state.approvalsLimited = false clear(state.commands) + clear(state.patches) if state.latest.Kind == SessionContextActivity && state.latest.Activity.Command != "" { state.latest.Text = state.latest.Activity.Prose } @@ -170,7 +174,6 @@ func daemonContextEvent(states map[string]*daemonContextState, method string, id c.CommandDetails = ApprovalCommandDetails{Justification: SanitizeSessionContext(p.Reason), Command: command, Directory: p.CWD} } case "item/fileChange/requestApproval": - c.ApprovalBlocked = "file-change" c.Kind, c.Text = SessionContextApproval, p.Reason if c.Text == "" { c.Text = "File changes requested" @@ -178,6 +181,11 @@ func daemonContextEvent(states map[string]*daemonContextState, method string, id if p.GrantRoot != "" { c.Text += "\nRoot: " + p.GrantRoot } + c.FileChanges = state.patches[p.TurnID+"/"+p.ItemID] + configureFileApproval(&c, p.GrantRoot, state) + case "item/fileChange/patchUpdated": + state.capturePatch(p.TurnID, p.ItemID, p.Changes) + return case "item/permissions/requestApproval": c.ApprovalBlocked = "permissions" c.Kind, c.Text = SessionContextApproval, p.Reason @@ -215,6 +223,7 @@ func daemonContextEvent(states map[string]*daemonContextState, method string, id } } delete(state.commands, p.TurnID+"/"+p.Item.ID) + delete(state.patches, p.TurnID+"/"+p.Item.ID) if p.Item.Type == "commandExecution" { status := p.Item.Status if p.Item.ExitCode != nil { @@ -253,6 +262,10 @@ func daemonContextEvent(states map[string]*daemonContextState, method string, id c = state.activity.context(c) } case "item/started": + if p.Item.Type == "fileChange" { + state.capturePatch(p.TurnID, p.Item.ID, p.Item.Changes) + return + } if p.Item.Type == "userMessage" { return } diff --git a/internal/i18n/locales/da.json b/internal/i18n/locales/da.json index ff1b5d4..c7894d7 100644 --- a/internal/i18n/locales/da.json +++ b/internal/i18n/locales/da.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "Lokal observation kan ikke besvare livegodkendelser.", "Network approval is not supported here.": "Netværksgodkendelse understøttes ikke her.", "Additional permissions require approval in Codex.": "Yderligere tilladelser kræver godkendelse i Codex.", - "File-change approval is not supported here.": "Godkendelse af filændringer understøttes ikke her.", + "Complete file changes unavailable. Review in Codex.": "Fuldstændige filændringer er ikke tilgængelige. Gennemgå i Codex.", "Unsupported command format.": "Ikke-understøttet kommandoformat.", "Command details are missing.": "Kommandodetaljer mangler.", "Working directory is missing.": "Arbejdsmappen mangler.", diff --git a/internal/i18n/locales/de.json b/internal/i18n/locales/de.json index 52c5d39..1e31615 100644 --- a/internal/i18n/locales/de.json +++ b/internal/i18n/locales/de.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "Lokale Beobachtung kann keine Live-Genehmigung erteilen.", "Network approval is not supported here.": "Netzwerkgenehmigungen werden hier nicht unterstützt.", "Additional permissions require approval in Codex.": "Zusätzliche Berechtigungen müssen in Codex genehmigt werden.", - "File-change approval is not supported here.": "Dateiänderungen können hier nicht genehmigt werden.", + "Complete file changes unavailable. Review in Codex.": "Vollständige Dateiänderungen nicht verfügbar. In Codex prüfen.", "Unsupported command format.": "Nicht unterstütztes Befehlsformat.", "Command details are missing.": "Befehlsdetails fehlen.", "Working directory is missing.": "Arbeitsverzeichnis fehlt.", diff --git a/internal/i18n/locales/en-GB.json b/internal/i18n/locales/en-GB.json index 56411f5..08c307f 100644 --- a/internal/i18n/locales/en-GB.json +++ b/internal/i18n/locales/en-GB.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "Local observation cannot answer live approvals.", "Network approval is not supported here.": "Network approval is not supported here.", "Additional permissions require approval in Codex.": "Additional permissions require approval in Codex.", - "File-change approval is not supported here.": "File-change approval is not supported here.", + "Complete file changes unavailable. Review in Codex.": "Complete file changes unavailable. Review in Codex.", "Unsupported command format.": "Unsupported command format.", "Command details are missing.": "Command details are missing.", "Working directory is missing.": "Working directory is missing.", diff --git a/internal/i18n/locales/es.json b/internal/i18n/locales/es.json index f266934..be71ef0 100644 --- a/internal/i18n/locales/es.json +++ b/internal/i18n/locales/es.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "La observación local no permite responder a aprobaciones en vivo.", "Network approval is not supported here.": "La aprobación de red no se admite aquí.", "Additional permissions require approval in Codex.": "Los permisos adicionales requieren aprobación en Codex.", - "File-change approval is not supported here.": "La aprobación de cambios de archivos no se admite aquí.", + "Complete file changes unavailable. Review in Codex.": "Los cambios completos de los archivos no están disponibles. Revísalos en Codex.", "Unsupported command format.": "Formato de comando no compatible.", "Command details are missing.": "Faltan los detalles del comando.", "Working directory is missing.": "Falta el directorio de trabajo.", diff --git a/internal/i18n/locales/et.json b/internal/i18n/locales/et.json index a4d279f..0d8a765 100644 --- a/internal/i18n/locales/et.json +++ b/internal/i18n/locales/et.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "Kohalik vaatlus ei saa reaalajas kinnitusi anda.", "Network approval is not supported here.": "Võrguloa kinnitamist siin ei toetata.", "Additional permissions require approval in Codex.": "Lisaload tuleb kinnitada Codexis.", - "File-change approval is not supported here.": "Failimuudatuste kinnitamist siin ei toetata.", + "Complete file changes unavailable. Review in Codex.": "Täielikud failimuudatused pole saadaval. Vaata üle Codexis.", "Unsupported command format.": "Toetamata käsuvorming.", "Command details are missing.": "Käsu üksikasjad puuduvad.", "Working directory is missing.": "Töökataloog puudub.", diff --git a/internal/i18n/locales/fi.json b/internal/i18n/locales/fi.json index 91ff96c..c5f68be 100644 --- a/internal/i18n/locales/fi.json +++ b/internal/i18n/locales/fi.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "Paikallinen seuranta ei voi vastata reaaliaikaisiin hyväksyntöihin.", "Network approval is not supported here.": "Verkkokäytön hyväksyntää ei tueta tässä.", "Additional permissions require approval in Codex.": "Lisäoikeudet on hyväksyttävä Codexissa.", - "File-change approval is not supported here.": "Tiedostomuutosten hyväksyntää ei tueta tässä.", + "Complete file changes unavailable. Review in Codex.": "Täydellisiä tiedostomuutoksia ei ole saatavilla. Tarkista Codexissa.", "Unsupported command format.": "Komentomuotoa ei tueta.", "Command details are missing.": "Komennon tiedot puuttuvat.", "Working directory is missing.": "Työhakemisto puuttuu.", diff --git a/internal/i18n/locales/fr.json b/internal/i18n/locales/fr.json index 8ab3566..9816442 100644 --- a/internal/i18n/locales/fr.json +++ b/internal/i18n/locales/fr.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "L’observation locale ne permet pas d’approuver les demandes en direct.", "Network approval is not supported here.": "L’approbation réseau n’est pas prise en charge ici.", "Additional permissions require approval in Codex.": "Les autorisations supplémentaires doivent être approuvées dans Codex.", - "File-change approval is not supported here.": "L’approbation des modifications de fichiers n’est pas prise en charge ici.", + "Complete file changes unavailable. Review in Codex.": "Modifications complètes des fichiers indisponibles. Vérifiez dans Codex.", "Unsupported command format.": "Format de commande non pris en charge.", "Command details are missing.": "Les détails de la commande sont manquants.", "Working directory is missing.": "Le répertoire de travail est manquant.", diff --git a/internal/i18n/locales/it.json b/internal/i18n/locales/it.json index e506b0b..fbbae70 100644 --- a/internal/i18n/locales/it.json +++ b/internal/i18n/locales/it.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "L’osservazione locale non può rispondere alle approvazioni live.", "Network approval is not supported here.": "L’approvazione di rete non è supportata qui.", "Additional permissions require approval in Codex.": "I permessi aggiuntivi richiedono approvazione in Codex.", - "File-change approval is not supported here.": "L’approvazione delle modifiche ai file non è supportata qui.", + "Complete file changes unavailable. Review in Codex.": "Modifiche complete ai file non disponibili. Controlla in Codex.", "Unsupported command format.": "Formato del comando non supportato.", "Command details are missing.": "Mancano i dettagli del comando.", "Working directory is missing.": "Manca la directory di lavoro.", diff --git a/internal/i18n/locales/ja.json b/internal/i18n/locales/ja.json index d15cb84..eb578cf 100644 --- a/internal/i18n/locales/ja.json +++ b/internal/i18n/locales/ja.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "ローカル監視ではライブ承認に応答できません。", "Network approval is not supported here.": "ネットワーク承認には対応していません。", "Additional permissions require approval in Codex.": "追加の権限は Codex で承認してください。", - "File-change approval is not supported here.": "ファイル変更の承認には対応していません。", + "Complete file changes unavailable. Review in Codex.": "ファイル変更の全内容を取得できません。Codexで確認してください。", "Unsupported command format.": "未対応のコマンド形式です。", "Command details are missing.": "コマンドの詳細がありません。", "Working directory is missing.": "作業ディレクトリがありません。", diff --git a/internal/i18n/locales/nb.json b/internal/i18n/locales/nb.json index d84fadf..959981a 100644 --- a/internal/i18n/locales/nb.json +++ b/internal/i18n/locales/nb.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "Lokal avlesning kan ikke besvare sanntidsgodkjenninger.", "Network approval is not supported here.": "Nettverksgodkjenning støttes ikke her.", "Additional permissions require approval in Codex.": "Ekstra tillatelser må godkjennes i Codex.", - "File-change approval is not supported here.": "Godkjenning av filendringer støttes ikke her.", + "Complete file changes unavailable. Review in Codex.": "Fullstendige filendringer er utilgjengelige. Se gjennom i Codex.", "Unsupported command format.": "Kommandoformatet støttes ikke.", "Command details are missing.": "Kommandoopplysninger mangler.", "Working directory is missing.": "Arbeidsmappe mangler.", diff --git a/internal/i18n/locales/nl.json b/internal/i18n/locales/nl.json index b68a8ca..b63a2aa 100644 --- a/internal/i18n/locales/nl.json +++ b/internal/i18n/locales/nl.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "Lokale observatie kan geen live goedkeuring geven.", "Network approval is not supported here.": "Netwerkgoedkeuring wordt hier niet ondersteund.", "Additional permissions require approval in Codex.": "Extra rechten vereisen goedkeuring in Codex.", - "File-change approval is not supported here.": "Goedkeuring van bestandswijzigingen wordt hier niet ondersteund.", + "Complete file changes unavailable. Review in Codex.": "Volledige bestandswijzigingen niet beschikbaar. Bekijk ze in Codex.", "Unsupported command format.": "Niet-ondersteund opdrachtformaat.", "Command details are missing.": "Opdrachtgegevens ontbreken.", "Working directory is missing.": "Werkmap ontbreekt.", diff --git a/internal/i18n/locales/pt-BR.json b/internal/i18n/locales/pt-BR.json index 4bd53aa..a5df4eb 100644 --- a/internal/i18n/locales/pt-BR.json +++ b/internal/i18n/locales/pt-BR.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "A observação local não pode responder a aprovações ao vivo.", "Network approval is not supported here.": "A aprovação de rede não é compatível aqui.", "Additional permissions require approval in Codex.": "Permissões adicionais exigem aprovação no Codex.", - "File-change approval is not supported here.": "A aprovação de alterações em arquivos não é compatível aqui.", + "Complete file changes unavailable. Review in Codex.": "As alterações completas dos arquivos não estão disponíveis. Revise no Codex.", "Unsupported command format.": "Formato de comando incompatível.", "Command details are missing.": "Faltam os detalhes do comando.", "Working directory is missing.": "Falta o diretório de trabalho.", diff --git a/internal/i18n/locales/pt-PT.json b/internal/i18n/locales/pt-PT.json index db9f1ec..2a50e53 100644 --- a/internal/i18n/locales/pt-PT.json +++ b/internal/i18n/locales/pt-PT.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "A observação local não permite responder a aprovações em direto.", "Network approval is not supported here.": "A aprovação de rede não é suportada aqui.", "Additional permissions require approval in Codex.": "Permissões adicionais exigem aprovação no Codex.", - "File-change approval is not supported here.": "A aprovação de alterações em ficheiros não é suportada aqui.", + "Complete file changes unavailable. Review in Codex.": "As alterações completas dos ficheiros não estão disponíveis. Reveja no Codex.", "Unsupported command format.": "Formato de comando não suportado.", "Command details are missing.": "Faltam os detalhes do comando.", "Working directory is missing.": "Falta o diretório de trabalho.", diff --git a/internal/i18n/locales/ru.json b/internal/i18n/locales/ru.json index 2f25935..0095b28 100644 --- a/internal/i18n/locales/ru.json +++ b/internal/i18n/locales/ru.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "Локальное наблюдение не позволяет отвечать на запросы разрешений.", "Network approval is not supported here.": "Разрешения сети здесь не поддерживаются.", "Additional permissions require approval in Codex.": "Дополнительные разрешения нужно подтвердить в Codex.", - "File-change approval is not supported here.": "Подтверждение изменений файлов здесь не поддерживается.", + "Complete file changes unavailable. Review in Codex.": "Полные изменения файлов недоступны. Проверьте их в Codex.", "Unsupported command format.": "Неподдерживаемый формат команды.", "Command details are missing.": "Нет сведений о команде.", "Working directory is missing.": "Не указан рабочий каталог.", diff --git a/internal/i18n/locales/sv.json b/internal/i18n/locales/sv.json index 692bbc6..e1d7cb0 100644 --- a/internal/i18n/locales/sv.json +++ b/internal/i18n/locales/sv.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "Lokal avläsning kan inte besvara livegodkännanden.", "Network approval is not supported here.": "Nätverksgodkännande stöds inte här.", "Additional permissions require approval in Codex.": "Ytterligare behörigheter måste godkännas i Codex.", - "File-change approval is not supported here.": "Godkännande av filändringar stöds inte här.", + "Complete file changes unavailable. Review in Codex.": "Fullständiga filändringar saknas. Granska i Codex.", "Unsupported command format.": "Kommandoformatet stöds inte.", "Command details are missing.": "Kommandouppgifter saknas.", "Working directory is missing.": "Arbetskatalog saknas.", diff --git a/internal/i18n/locales/tr.json b/internal/i18n/locales/tr.json index 1715449..5aa4b33 100644 --- a/internal/i18n/locales/tr.json +++ b/internal/i18n/locales/tr.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "Yerel izleme canlı onayları yanıtlayamaz.", "Network approval is not supported here.": "Ağ onayı burada desteklenmiyor.", "Additional permissions require approval in Codex.": "Ek izinler Codex'te onaylanmalıdır.", - "File-change approval is not supported here.": "Dosya değişikliği onayı burada desteklenmiyor.", + "Complete file changes unavailable. Review in Codex.": "Dosya değişikliklerinin tamamı mevcut değil. Codex'te inceleyin.", "Unsupported command format.": "Desteklenmeyen komut biçimi.", "Command details are missing.": "Komut ayrıntıları eksik.", "Working directory is missing.": "Çalışma dizini eksik.", diff --git a/internal/i18n/locales/zh-Hans.json b/internal/i18n/locales/zh-Hans.json index ab580d2..403cfc1 100644 --- a/internal/i18n/locales/zh-Hans.json +++ b/internal/i18n/locales/zh-Hans.json @@ -89,7 +89,7 @@ "Local observation cannot answer live approvals.": "本地观察无法响应实时批准请求。", "Network approval is not supported here.": "此处不支持网络批准。", "Additional permissions require approval in Codex.": "额外权限需要在 Codex 中批准。", - "File-change approval is not supported here.": "此处不支持文件更改批准。", + "Complete file changes unavailable. Review in Codex.": "无法获取完整的文件更改。请在 Codex 中查看。", "Unsupported command format.": "不支持的命令格式。", "Command details are missing.": "缺少命令详情。", "Working directory is missing.": "缺少工作目录。", diff --git a/internal/ui/file_approval_test.go b/internal/ui/file_approval_test.go new file mode 100644 index 0000000..af37494 --- /dev/null +++ b/internal/ui/file_approval_test.go @@ -0,0 +1,44 @@ +package ui + +import ( + "strings" + "testing" + + "charm.land/lipgloss/v2" + "github.com/merefield/codexometer/internal/codex" +) + +func TestFileApprovalDetailAndInlineFit(t *testing.T) { + m := approvalTestModel() + c := &m.monitorSessionData[0].preview + c.CommandDetails = codex.ApprovalCommandDetails{} + c.Text = "Review these changes" + c.FileChanges = `[{"path":"/work/a.go","kind":{"type":"update"},"diff":"@@ -4 +4 @@\n-before\n+after\n"}]` + for _, width := range []int{1, 20, 80, 120} { + doc := m.contextDetailDocument(width) + add, remove := false, false + for _, line := range doc { + if lipgloss.Width(line.text) > width { + t.Fatal("overflow", width, line) + } + add = add || line.kind == "addition" + remove = remove || line.kind == "removal" + } + if !add || !remove { + t.Fatal("missing coloured diffs") + } + } + text := strings.Join(m.contextDetailLines(100), "\n") + if !strings.Contains(text, "+1 / −1") { + t.Fatal("missing overall line totals", text) + } + if !strings.Contains(strings.Join(expandedContextLines(80, m.monitorSessionData[0]), "\n"), "+1 / −1") { + t.Fatal("inline totals missing") + } + if !strings.Contains(text, "/work/a.go") || !strings.Contains(text, " 4 │ -before") || !strings.Contains(text, " 4 │ +after") { + t.Fatal(text) + } + if len(m.expandedApprovalButtons(80, 6, m.monitorSessionData[0])) != 0 { + t.Fatal("inline approval offered without room for full patch") + } +} diff --git a/internal/ui/monitor_approval.go b/internal/ui/monitor_approval.go index 266bcc2..eff1a16 100644 --- a/internal/ui/monitor_approval.go +++ b/internal/ui/monitor_approval.go @@ -47,7 +47,7 @@ func (m Model) monitorApprovalBlockReason(c codex.SessionContext) string { case "permissions": return i18n.Text("Additional permissions require approval in Codex.") case "file-change": - return i18n.Text("File-change approval is not supported here.") + return i18n.Text("Complete file changes unavailable. Review in Codex.") case "command-format": return i18n.Text("Unsupported command format.") case "missing-command": diff --git a/internal/ui/monitor_context_modes.go b/internal/ui/monitor_context_modes.go index 48ed92a..f3b37ec 100644 --- a/internal/ui/monitor_context_modes.go +++ b/internal/ui/monitor_context_modes.go @@ -135,6 +135,13 @@ func (m *Model) setRowContext(id string, mode int) { } func expandedContextLines(width int, s monitorSession) []string { + if s.preview.FileChanges != "" { + lines := strings.Split(ansi.Hardwrap(codex.SanitizeSessionContext(s.preview.Text), max(width-4, 1), true), "\n") + for _, line := range fileApprovalDocument(s.preview.FileChanges, max(width-4, 1)) { + lines = append(lines, line.text) + } + return lines + } if s.preview.Text == "" && s.preview.CurrentTask == "" && s.preview.LatestGuidance == "" { return []string{i18n.Text("NO CONTEXT")} } @@ -229,6 +236,18 @@ func (m Model) renderExpandedContext(width, height int, s monitorSession, colors for i := range lines { lines[i] = colors.label().Render(lines[i]) } + if s.preview.FileChanges != "" { + offset := len(strings.Split(ansi.Hardwrap(codex.SanitizeSessionContext(s.preview.Text), max(width-4, 1), true), "\n")) + document := fileApprovalDocument(s.preview.FileChanges, max(width-4, 1)) + for i, line := range document { + if i+offset < len(lines) { + if i+offset == len(lines)-1 && len(document)+offset > len(lines) { + line.text = ansi.Truncate(line.text, max(width-5, 0), "") + "…" + } + lines[i+offset] = line.render(colors) + } + } + } if n > 0 { for len(lines) < textRows+gap { lines = append(lines, "") diff --git a/internal/ui/monitor_detail.go b/internal/ui/monitor_detail.go index 5499bc4..a48264a 100644 --- a/internal/ui/monitor_detail.go +++ b/internal/ui/monitor_detail.go @@ -1,6 +1,7 @@ package ui import ( + "fmt" "strings" "charm.land/lipgloss/v2" @@ -25,6 +26,14 @@ func (line detailLine) render(colors palette) string { style = style.Foreground(colors.warning) case "command": style = style.Foreground(colors.primary) + case "addition": + style = style.Foreground(colors.success) + case "removal": + style = style.Foreground(colors.danger) + case "diff-summary": + if parts := strings.SplitN(line.text, " / ", 2); len(parts) == 2 { + return style.Foreground(colors.success).Render(parts[0]) + style.Render(" / ") + style.Foreground(colors.danger).Render(parts[1]) + } } return style.Render(line.text) } @@ -103,6 +112,11 @@ func (m Model) contextDetailDocument(width int) (document []detailLine) { prefix = "" } appendText(codex.SanitizeSessionContext(c.Activity.Command), "command", prefix) + } else if c.Kind == codex.SessionContextApproval && c.FileChanges != "" { + section(contextTitle(c)) + appendText(codex.SanitizeSessionContext(c.Text), "body", "") + lines = append(lines, detailLine{}) + lines = append(lines, fileApprovalDocument(c.FileChanges, width)...) } else if c.Kind == codex.SessionContextApproval && c.CommandDetails.Command != "" { section(contextTitle(c)) d := c.CommandDetails @@ -151,6 +165,20 @@ func (m Model) contextDetailDocument(width int) (document []detailLine) { return lines } +func fileApprovalDocument(changes string, width int) (lines []detailLine) { + diff := codex.FileDiffLines(changes) + added, removed := codex.FileDiffTotals(diff) + for _, text := range strings.Split(ansi.Hardwrap(fmt.Sprintf("+%d / −%d", added, removed), max(width, 1), true), "\n") { + lines = append(lines, detailLine{ansi.Truncate(text, max(width, 1), ""), "diff-summary"}) + } + for _, line := range diff { + for _, text := range strings.Split(ansi.Hardwrap(line.NumberedText(), max(width, 1), true), "\n") { + lines = append(lines, detailLine{ansi.Truncate(text, max(width, 1), ""), line.Kind}) + } + } + return lines +} + func (m Model) contextDetailLines(width int) []string { doc := m.contextDetailDocument(width) lines := make([]string, len(doc)) diff --git a/internal/web/control.go b/internal/web/control.go index 6e42be0..b50e6d7 100644 --- a/internal/web/control.go +++ b/internal/web/control.go @@ -48,15 +48,16 @@ type actionQuestion struct { } type actionOffer struct { - Profile *profileReview `json:"profile,omitempty"` - ID string `json:"id"` - Session string `json:"session"` - Thread string `json:"thread"` - Directory string `json:"directory"` - Kind string `json:"kind"` - Command string `json:"command"` - Choices []actionChoice `json:"choices"` - Questions []actionQuestion `json:"questions"` + FileChanges []codex.FileDiffLine `json:"fileChanges,omitempty"` + Profile *profileReview `json:"profile,omitempty"` + ID string `json:"id"` + Session string `json:"session"` + Thread string `json:"thread"` + Directory string `json:"directory"` + Kind string `json:"kind"` + Command string `json:"command"` + Choices []actionChoice `json:"choices"` + Questions []actionQuestion `json:"questions"` } type offeredAction struct { @@ -110,11 +111,12 @@ func (c *control) offer(id string) (offeredAction, error) { } o := offeredAction{actionOffer: actionOffer{Session: id, Thread: id, Directory: directory}} if ctx.Kind == codex.SessionContextApproval { - if c.approvals == nil || ctx.ApprovalToken == "" || ctx.ApprovalBlocked != "" || ctx.CommandDetails.Command == "" || ctx.CommandDetails.Directory == "" || ctx.ThreadID == "" || !c.approvals.SessionApprovalPending(ctx.ApprovalToken) { + if c.approvals == nil || ctx.ApprovalToken == "" || ctx.ApprovalBlocked != "" || (ctx.FileChanges == "" && (ctx.CommandDetails.Command == "" || ctx.CommandDetails.Directory == "")) || ctx.ThreadID == "" || !c.approvals.SessionApprovalPending(ctx.ApprovalToken) { return o, nil } o.Kind, o.token = "approval", ctx.ApprovalToken o.Command, o.Directory, o.Thread = ctx.CommandDetails.Command, ctx.CommandDetails.Directory, ctx.ThreadID + o.FileChanges = codex.FileDiffLines(ctx.FileChanges) for _, option := range ctx.ApprovalOptions { label := map[string]string{"accept": "APPROVE ONCE", "acceptForSession": "ALLOW FOR SESSION", "acceptWithExecpolicyAmendment": "ALWAYS ALLOW PREFIX", "decline": "DECLINE", "cancel": "REJECT & STOP TURN"}[option.Kind] if label == "" { diff --git a/internal/web/control_test.go b/internal/web/control_test.go index 7ae8be9..b4eddb4 100644 --- a/internal/web/control_test.go +++ b/internal/web/control_test.go @@ -138,6 +138,30 @@ func TestControlApprovalBindingAndExactlyOnce(t *testing.T) { } } +func TestControlFileApprovalBindsDiff(t *testing.T) { + s, f, token := controlServer(t) + c := s.store.contexts["parent"] + c.CommandDetails = codex.ApprovalCommandDetails{} + c.FileChanges = `[{"path":"/project/a","kind":{"type":"add"},"diff":"hello\n"}]` + s.store.contexts["parent"] = c + o := getOffer(t, s, token) + if o.Command != "" || len(o.FileChanges) != 2 || o.FileChanges[1].New != 1 { + t.Fatal("file details not offered", o) + } + index := 0 + r := prepareAction(t, s, token, actionRequest{Session: "parent", Offer: o.ID, Choice: &index}) + c.FileChanges = strings.Replace(c.FileChanges, "hello", "changed", 1) + s.store.contexts["parent"] = c + if w := actionCall(s, token, "commit", r); w.Code != 409 || f.calls != 0 { + t.Fatal("changed patch accepted", w.Code) + } + o = getOffer(t, s, token) + r = prepareAction(t, s, token, actionRequest{Session: "parent", Offer: o.ID, Choice: &index}) + if w := actionCall(s, token, "commit", r); w.Code != 200 || f.calls != 1 || f.decision != "accept" { + t.Fatal("file approval not sent", w.Code) + } +} + func TestControlStaleConfirmation(t *testing.T) { for _, kind := range []string{"expired", "stale", "error", "removed", "changed-command", "changed-choice", "source-consumed", "connection-change"} { t.Run(kind, func(t *testing.T) { diff --git a/internal/web/dist/assets/index-BdtIe-Dj.js b/internal/web/dist/assets/index-BdtIe-Dj.js new file mode 100644 index 0000000..12ba842 --- /dev/null +++ b/internal/web/dist/assets/index-BdtIe-Dj.js @@ -0,0 +1,42 @@ +(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;function d(e){return typeof e==`function`}var f=()=>{};function p(e){return e()}function m(e){for(var t=0;t{e=n,t=r}),resolve:e,reject:t}}function g(e,t,n=!1){return e===void 0?n?t():t:e}function _(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);let n=[];for(let r of e)if(n.push(r),n.length===t)break;return n}var v=1024,y=2048,b=4096,x=8192,S=16384,C=32768,w=1<<25,T=65536,ee=1<<19,te=1<<20,E=1<<25,D=1<<21,ne=1<<22,re=1<<23,ie=Symbol(`$state`),ae=Symbol(`component`),oe=Symbol(`legacy props`),se=Symbol(``),ce=Symbol(`attributes`),le=Symbol(`class`),ue=Symbol(`style`),de=Symbol(`text`),fe=Symbol(`form reset`),pe=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},me=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),he={},O=Symbol(`uninitialized`),ge=`http://www.w3.org/1999/xhtml`;function _e(){console.warn(`https://svelte.dev/e/derived_inert`)}function ve(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function ye(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function be(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var k=!1;function xe(e){k=e}var A;function Se(e){if(e===null)throw ve(),he;return A=e}function Ce(){return Se(cn(A))}function j(e){if(k){if(cn(A)!==null)throw ve(),he;A=e}}function we(e=1){if(k){for(var t=e,n=A;t--;)n=cn(n);A=n}}function Te(e=!0){for(var t=0,n=A;;){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=cn(n);e&&n.remove(),n=i}}function Ee(e){if(!e||e.nodeType!==8)throw ve(),he;return e.data}function De(e){return e===this.v}function Oe(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function ke(e){return!Oe(e,this.v)}function Ae(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function je(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function Me(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Ne(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function Pe(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Fe(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Ie(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Le(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Re(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function ze(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Be(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Ve(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var He=!1;function Ue(){He=!0}var M=null;function We(e){M=e}function Ge(e,t=!1,n){M={p:M,i:!1,c:null,e:null,s:e,x:null,r:U,l:He&&!t?{s:null,u:null,$:[]}:null}}function Ke(e){var t=M,n=t.e;if(n!==null){t.e=null;for(var r of n)xn(r)}return e!==void 0&&(t.x=e),t.i=!0,M=t.p,qe(e)}function qe(e={}){return i(e,ae,{value:!0}),e}function Je(){return!He||M!==null&&M.l===null}var Ye=[];function Xe(){var e=Ye;Ye=[],m(e)}function Ze(e){if(Ye.length===0&&!Tt){var t=Ye;queueMicrotask(()=>{t===Ye&&Xe()})}Ye.push(e)}function Qe(){for(;Ye.length>0;)Xe()}var $e=~(y|b|v);function et(e,t){e.f=e.f&$e|t}function tt(e){e.f&512||e.deps===null?et(e,v):et(e,b)}function nt(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),et(e,v)}function rt(e){k&&sn(e)!==null&&ln(e)}var it=!1;function at(){it||(it=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[fe]?.()})},{capture:!0}))}function ot(e){var t=H,n=U;Gn(null),Kn(null);try{return e()}finally{Gn(t),Kn(n)}}function st(e,t,n,r=n){e.addEventListener(t,()=>ot(n));let i=e[fe];e[fe]=i?()=>{i(),r(!0)}:()=>r(!0),at()}function ct(e,t,n,r){let i=Je()?ft:ht;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=U,c=lt(),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){mn(e,s)}ut()}}var d=dt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>mt(e))).then(u).catch(e=>mn(e,s)).finally(d)}l?l.then(()=>{c(),f(),ut()}):f()}function lt(){var e=U,t=H,n=M,r=P;return function(i=!0){Kn(e),Gn(t),We(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function ut(e=!0){Kn(null),Gn(null),We(null),e&&P?.deactivate()}function dt(){var e=U,t=e.b,n=P,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 ft(e){var t=2|y;return U!==null&&(U.f|=ee),{ctx:M,deps:null,effects:null,equals:De,f:t,fn:e,reactions:null,rv:0,v:O,wv:0,parent:U,ac:null}}var pt=Symbol(`obsolete`);function mt(e,t,n){let r=U;r===null&&je();var i=void 0,a=Ht(O),o=!H,s=new Set;return Tn(()=>{var t=U,n=h();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==pe&&n.reject(e)}).finally(ut)}catch(e){n.reject(e),ut()}var c=P;if(o){if(t.f&32768)var l=dt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(pt);else for(let e of s.values())e.reject(pt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==pt&&(c.activate(),t?(a.f|=re,Kt(a,t)):(a.f&8388608&&(a.f^=re),Kt(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),yn(()=>{for(let e of s)e.reject(pt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function N(e){let t=ft(e);return Jn(t),t}function ht(e){let t=ft(e);return t.equals=ke,t}function gt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n{t.ac.abort(pe),t.ac=null}),t.fn!==null&&(t.teardown=f),lr(t,0),An(t))}function bt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&ur(t)}var xt=null,P=null,St=null,Ct=null,wt=null,Tt=!1,Et=!1,Dt=null,Ot=null,kt=0,At=1,jt=class e{id=At++;#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(){xt===null?xt=this:(xt.#n=this,this.#t=xt),xt=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)et(r,y),t(r);for(r of n.m)et(r,b),t(r)}this.#p.add(e)}#g(){var e=[];for(let i of this.#c)if(!(i.f&16384||!(i.f&6144))){for(var t=i,n=!1;t.parent!==null;){t=t.parent;var r=t.f;if(r&96){if(!(r&1024)){n=!0;break}t.f^=v}}n||e.push(t)}return this.#c=[],e}#_(){this.#e=!0;for(let e of this.#u)this.#d.delete(e),et(e,y),this.schedule(e);for(let e of this.#d)et(e,b),this.schedule(e);this.apply();for(var t=Dt=[],n=[],r=Ot=[];this.#c.length>0;){kt++>1e3&&(this.#S(),Nt());for(let e of this.#g())try{this.#v(e,t,n)}catch(t){throw Rt(e),this.#h()||this.discard(),t}}if(P=null,r.length>0){var i=e.ensure();for(let e of r)i.schedule(e)}if(Dt=null,Ot=null,this.#h()){this.#x(n),this.#x(t);for(let[e,t]of this.#f)Lt(e,t);r.length>0&&P.#_();return}let a=this.#y();if(a){this.#x(n),this.#x(t),a.#b(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),St=this,Ft(n),Ft(t),St=null,this.#s?.resolve();var o=P;if(this.#a===0&&(this.#c.length===0||o!==null)&&this.#S(),this.#c.length>0){if(o!==null){for(let e of this.#c)o.#c.push(e);this.#c=[]}else o=this}o!==null&&(Bt.clear(),o.#_())}#v(e,t,n){e.f^=v;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^=v:i&4?t.push(r):ir(r)&&(i&16&&this.#d.add(r),ur(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}}}#y(){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}#b(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),et(i,y),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#S(),P=this,this.#_()}#x(e){for(var t=0;t{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??=h()).promise}static ensure(){if(P===null){let t=P=new e;!Et&&!Tt&&Ze(()=>{t.#e||t.flush()})}return P}apply(){Ct=null}schedule(e){if(wt=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}this.#c.push(e)}#S(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?xt=e:t.#t=e,this.linked=!1}}};function Mt(e){var t=Tt;Tt=!0;try{var n;for(e&&(P!==null&&!P.is_fork&&P.flush(),n=e());;){if(Qe(),P===null)return n;P.flush()}}finally{Tt=t}}function Nt(){try{Ie()}catch(e){mn(e,wt)}}var Pt=null;function Ft(e){var t=e.length;if(t!==0){for(var n=0;n0)){Bt.clear();for(let e of Pt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Pt.has(n)&&(Pt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||ur(n)}}Pt.clear()}}Pt=null}}function It(e){P.schedule(e)}function Lt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),et(e,v);for(var n=e.first;n!==null;)Lt(n,t),n=n.next}}function Rt(e){et(e,v);for(var t=e.first;t!==null;)Rt(t),t=t.next}var zt=new Set,Bt=new Map,Vt=!1;function Ht(e,t){return{f:0,v:e,reactions:null,equals:De,rv:0,wv:0}}function F(e,t){let n=Ht(e,t);return Jn(n),n}function Ut(e,t=!1,n=!0){let r=Ht(e);return t||(r.equals=ke),He&&n&&M!==null&&M.l!==null&&(M.l.s??=[]).push(r),r}function I(e,t,n=!1){return H!==null&&(!Wn||H.f&131072)&&Je()&&H.f&4325394&&(qn===null||!qn.has(e))&&Be(),Kt(e,n?Zt(t):t,Ot)}var Wt=null,Gt=0;function Kt(e,t,n=null){if(!e.equals(t)){Hn?Bt.set(e,t):Bt.has(e)||Bt.set(e,e.v);var r=jt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&_t(t),Ct===null&&tt(t)}e.wv=rr(),Wt=null,Gt=0,Xt(e,y,n),Wt=null,Je()&&U!==null&&U.f&1024&&!(U.f&96)&&(Zn===null?Qn([e]):Zn.push(e)),!r.is_fork&&zt.size>0&&!Vt&&qt()}return t}function qt(){Vt=!1;for(let e of zt){e.f&1024&&et(e,b);let t;try{t=ir(e)}catch{t=!0}t&&ur(e)}zt.clear()}function Jt(e,t=1){var n=W(e),r=t===1?n++:n--;return I(e,n),r}function Yt(e){I(e,e.v+1)}function Xt(e,t,n){var r=e.reactions;if(r!==null){var i=Je(),a=r.length;if(Gt+=a,Gt>1e5&&Wt===null&&(Wt=new Set),Wt!==null){if(Wt.has(e))return;Wt.add(e)}for(var o=0;o{if(tr===d)return e();var t=H,n=tr;Gn(null),nr(d);var r=e();return Gn(t),nr(n),r};return i&&r.set(`length`,F(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&Re();var i=r.get(t);return i===void 0?f(()=>{var e=F(n.value,u);return r.set(t,e),e}):I(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>F(O,u));r.set(t,e),Yt(o)}}else I(n,O),Yt(o);return!0},get(e,n,i){if(n===ie)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>F(Zt(s?e[n]:O),u)),r.set(n,o)),o!==void 0){var c=W(o);return c===O?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){this.has?.(e,t);var n=Reflect.getOwnPropertyDescriptor(e,t),i=r.get(t);if(i!==void 0){var a=W(i);if(a===O)return;if(n&&`value`in n)n.value=a;else return{enumerable:!0,configurable:!0,value:a,writable:!0}}return n},has(e,t){if(t===ie)return!0;var n=r.get(t),i=n!==void 0&&n.v!==O||Reflect.has(e,t);return(n!==void 0||U!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>F(i?Zt(e[t]):O,u)),r.set(t,n)),W(n)===O)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;dF(O,u)),r.set(d+``,p)):I(p,O)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>F(void 0,u)),I(c,Zt(n)),r.set(t,c));else{l=c.v!==O;var m=f(()=>Zt(n));I(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&&I(g,_+1)}Yt(o)}return!0},ownKeys(e){W(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==O});for(var[n,i]of r)i.v!==O&&!(n in e)&&t.push(n);return t},setPrototypeOf(){ze()}})}function Qt(e){try{if(typeof e==`object`&&e&&ie in e)return e[ie]}catch{}return e}function $t(e,t){return Object.is(Qt(e),Qt(t))}var en,tn,nn,rn;function an(){if(en===void 0){en=window,tn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;nn=a(t,`firstChild`).get,rn=a(t,`nextSibling`).get,u(e)&&(e[le]=void 0,e[ce]=null,e[ue]=void 0,e.__e=void 0),u(n)&&(n[de]=void 0)}}function on(e=``){return document.createTextNode(e)}function sn(e){return nn.call(e)}function cn(e){return rn.call(e)}function L(e,t){if(!k)return sn(e);var n=sn(A);if(n===null)n=A.appendChild(on());else if(t&&n.nodeType!==3){var r=on();return n?.before(r),Se(r),r}return t&&fn(n),Se(n),n}function R(e,t=!1){if(!k){var n=sn(e);return n instanceof Comment&&n.data===``?cn(n):n}if(t){if(A?.nodeType!==3){var r=on();return A?.before(r),Se(r),r}fn(A)}return A}function z(e,t=!1){if(!k)return sn(e);var n=L(e,t);return j(e),n}function B(e,t=1,n=!1){let r=k?A:e;for(var i;t--;)i=r,r=cn(r);if(!k)return r;if(n){if(r?.nodeType!==3){var a=on();return r===null?i?.after(a):r.before(a),Se(a),a}fn(r)}return Se(r),r}function ln(e){e.textContent=``}function un(){return!1}function dn(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 fn(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 pn(e){var t=U;if(t===null)return H.f|=re,e;if(!(t.f&32768)&&!(t.f&4))throw e;mn(e,t)}function mn(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 hn(e){U===null&&(H===null&&Fe(e),Pe()),Hn&&Ne(e)}function gn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function _n(e,t){var n=U;n!==null&&n.f&8192&&(e|=x);var r={ctx:M,deps:null,nodes:null,f:e|y|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};P?.register_created_effect(r);var i=r;if(e&4)Dt===null?jt.ensure().schedule(r):Dt.push(r);else if(t!==null){try{ur(r)}catch(e){throw Mn(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|=T))}if(i!==null&&(i.parent=n,n!==null&&gn(i,n),H!==null&&H.f&2&&!(e&64))){var a=H;(a.effects??=[]).push(i)}return r}function vn(){return H!==null&&!Wn}function yn(e){let t=_n(8,null);return et(t,v),t.teardown=e,t}function bn(e){hn(`$effect`);var t=U.f;if(!H&&t&32&&M!==null&&!M.i){var n=M;(n.e??=[]).push(e)}else return xn(e)}function xn(e){return _n(4|te,e)}function Sn(e){return hn(`$effect.pre`),_n(8|te,e)}function Cn(e){jt.ensure();let t=_n(64|ee,e);return(e={})=>new Promise(n=>{e.outro?Fn(t,()=>{Mn(t),n(void 0)}):(Mn(t),n(void 0))})}function wn(e){return _n(4,e)}function Tn(e){return _n(ne|ee,e)}function En(e,t=0){return _n(8|t,e)}function V(e,t=[],n=[],r=[]){ct(r,t,n,t=>{_n(8,()=>{e(...t.map(W))})})}function Dn(e,t=0){return _n(16|t,e)}function On(e){return _n(32|ee,e)}function kn(e){var t=e.teardown;if(t!==null){let n=Hn,r=H;Un(!0),Gn(null);try{t.call(null)}catch(t){mn(t,e.parent)}finally{Un(n),Gn(r)}}}function An(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&ot(()=>{e.abort(pe)});var r=n.next;n.f&64?n.parent=null:Mn(n,t),n=r}}function jn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Mn(t),t=n}}function Mn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Nn(e.nodes.start,e.nodes.end),n=!0),e.f|=w,An(e,t&&!n),lr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();kn(e),e.f^=w,e.f|=S;var i=e.parent;i!==null&&i.first!==null&&Pn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Nn(e,t){for(;e!==null;){var n=e===t?null:cn(e);e.remove(),e=n}}function Pn(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 Fn(e,t,n=!0){var r=[];e.f|=256,In(e,r,!0);var i=()=>{n&&Mn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function In(e,t,n){if(!(e.f&8192)){e.f^=x;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);In(i,t,o?n:!1)}i=a}}}function Ln(e){e.f&=-257,Rn(e,!0)}function Rn(e,t){if(!(e.f&256)&&e.f&8192){e.f^=x,e.f&1024||(et(e,y),jt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);Rn(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 zn(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:cn(n);t.append(n),n=i}}var Bn=null,Vn=!1,Hn=!1;function Un(e){Hn=e}var H=null,Wn=!1;function Gn(e){H=e}var U=null;function Kn(e){U=e}var qn=null;function Jn(e){H!==null&&(H.f&2097152||H.f&2)&&(qn??=new Set).add(e)}var Yn=null,Xn=0,Zn=null;function Qn(e){Zn=e}var $n=1,er=0,tr=er;function nr(e){tr=e}function rr(){return++$n}function ir(e){var t=e.f;if(t&2048)return!0;if(t&4096){for(var n=e.deps,r=n.length,i=0;ie.wv)return!0}t&512&&Ct===null&&et(e,v)}return!1}function ar(e,t,n=!0){var r=e.reactions;if(r!==null&&!(qn!==null&&qn.has(e)))for(var i=0;i{e.ac.abort(pe)}),e.ac=null);try{e.f|=D;var u=e.fn,d=u();e.f|=C;var f=sr(e);if(Je()&&Zn!==null&&!Wn&&f!==null&&!(e.f&6146))for(var p=0;p0)for(t.length=Xn+Yn.length,r=0;r{s.ac.abort(pe),s.ac=null,et(s,y)}),yt(s),lr(s,0)}}function lr(e,t){var n=e.deps;if(n!==null)for(var r=t;rn?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?(i.__removed=!1,Ze(()=>{i.__removed||t.addEventListener(e,i,r)})):t.addEventListener(e,i,r),i}function Cr(e,t,n,r,i){var a={capture:r,passive:i},o=Sr(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&yn(()=>{o.__removed=!0,t.removeEventListener(e,o,a)})}function G(e,t,n){(t[yr]??={})[e]=n}function wr(e){for(var t=0;t{Er=!1,Tr=null}));var s=0,c=Tr===e&&e[yr];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[yr]=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=U;Gn(null),Kn(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[yr]?.[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{throw e});throw p}}finally{e[yr]=t,delete e.currentTarget,Gn(d),Kn(f)}}}var Or=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function kr(e){return Or?.createHTML(e)??e}function Ar(e){var t=dn(`template`);return t.innerHTML=kr(e.replaceAll(``,``)),t.content}function jr(e,t){var n=U;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function K(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(``);return()=>{if(k)return jr(A,null),A;i===void 0&&(i=Ar(a?e:``+e),n||(i=sn(i)));var t=r||tn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=sn(t),s=t.lastChild;jr(o,s)}else jr(t,t);return t}}function Mr(e,t,n=`svg`){var r=!e.startsWith(``),i=!!(t&1),a=`<${n}>${r?e:``+e}`,o;return()=>{if(k)return jr(A,null),A;if(!o){var e=sn(Ar(a));if(i)for(o=document.createDocumentFragment();sn(e);)o.appendChild(sn(e));else o=sn(e)}var t=o.cloneNode(!0);if(i){var n=sn(t),r=t.lastChild;jr(n,r)}else jr(t,t);return t}}function Nr(e,t){return Mr(e,t,`svg`)}function Pr(e=``){if(!k){var t=on(e+``);return jr(t,t),t}var n=A;return n.nodeType===3?fn(n):(n.before(n=on()),Se(n)),jr(n,n),n}function Fr(){if(k)return jr(A,null),A;var e=document.createDocumentFragment(),t=document.createComment(``),n=on();return e.append(t,n),jr(t,n),e}function q(e,t){if(k){var n=U;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=A),Ce();return}e!==null&&e.before(t)}function Ir(){if(k&&A&&A.nodeType===8&&A.textContent?.startsWith(`$`)){let e=A.textContent.substring(1);return Ce(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}function Lr(e){let t=0,n=Ht(0),r;return()=>{vn()&&(W(n),En(()=>(t===0&&(r=mr(()=>e(()=>Yt(n)))),t+=1,()=>{Ze(()=>{--t,t===0&&(r?.(),r=void 0,Yt(n))})})))}}var Rr=T|ee;function zr(e,t,n,r){new Br(e,t,n,r)}var Br=class{parent;is_pending=!1;transform_error;#e;#t=k?A: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=Lr(()=>(this.#m=Ht(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=U;t.b=this,t.f|=128,n(e)},this.parent=U.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Dn(()=>{if(k){let e=this.#t;Ce();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()},Rr),k&&(this.#e=A)}#g(){try{this.#a=On(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);Ze(r),t&&(this.#s=On(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{if(t){be();return}t=!0,n&&Ve(),this.#s!==null&&Fn(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){mn(e,this.#i&&this.#i.parent)}}}}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=On(()=>e(this.#e)),Ze(()=>{var e=this.#c=document.createDocumentFragment(),t=on(),n=!1;if(e.append(t),this.#a=this.#S(()=>{try{return On(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){mn(e,this.#i.parent)}return null}}),this.#a===null){this.#c=null,n&&this.#x(P);return}this.#u===0&&(this.#e.before(e),this.#c=null,Fn(this.#o,()=>{this.#o=null}),this.#x(P))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=On(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();zn(this.#a,e);let t=this.#n.pending;this.#o=On(()=>t(this.#e))}else this.#x(P)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){nt(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=U,n=H,r=M;Kn(this.#i),Gn(this.#i),We(this.#i.ctx);try{return jt.ensure(),e()}finally{Kn(t),Gn(n),We(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&&Fn(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,Ze(()=>{this.#d=!1,this.#m&&Kt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),W(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;P?.is_fork?(this.#a&&P.skip_effect(this.#a),this.#o&&P.skip_effect(this.#o),this.#s&&P.skip_effect(this.#s),P.oncommit(()=>{this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(Mn(this.#a),null),this.#o&&=(Mn(this.#o),null),this.#s&&=(Mn(this.#s),null),k&&(Se(this.#t),we(),Se(Te()));let t=this.#n.failed,n=e=>{let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&(this.#s=this.#S(()=>{try{return On(()=>{var r=U;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return mn(e,this.#i.parent),null}}))};Ze(()=>{var t;try{t=this.transform_error(e)}catch(e){mn(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>mn(e,this.#i&&this.#i.parent)):n(t)})}};function J(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[de]??=e.nodeValue)&&(e[de]=n,e.nodeValue=`${n}`)}function Vr(e,t){return Ur(e,t)}var Hr=new Map;function Ur(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){an();var l=void 0,u=Cn(()=>{var s=n??t.appendChild(on());zr(s,{pending:()=>{}},t=>{Ge({});var n=M;if(o&&(n.c=o),a&&(i.$$events=a),k&&jr(t,null),l=e(t,i)||qe(),k&&(U.nodes.end=A,A===null||A.nodeType!==8||A.data!==`]`))throw ve(),he;Ke()},c);var u=new Set,d=e=>{for(var n=0;n{for(var e of u)for(let n of[t,document]){var r=Hr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,Dr),r.delete(e),r.size===0&&Hr.delete(n)):r.set(e,i)}xr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Wr.set(l,u),l}var Wr=new WeakMap,Gr=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)Ln(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(Ln(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&&(Mn(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();zn(r,t),t.append(on()),this.#n.set(e,{effect:r,fragment:t})}else Mn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Fn(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)||(Mn(n.effect),this.#n.delete(e))};ensure(e,t){var n=P,r=un();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=on();i.append(a),this.#n.set(e,{effect:On(()=>t(a)),fragment:i})}else this.#t.set(e,On(()=>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 k&&(this.anchor=A),this.#a(n)}};function Y(e,t,n=!1){var r;k&&(r=A,Ce());var i=new Gr(e),a=n?T:0;function o(e,t){if(k){var n=Ee(r);if(e!==parseInt(n.substring(1))){var a=Te();Se(a),i.anchor=a,xe(!1),i.ensure(e,t),xe(!0);return}}i.ensure(e,t)}Dn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var Kr=Symbol(`NaN`);function qr(e,t,n){k&&Ce();var r=new Gr(e),i=!Je();Dn(()=>{var e=t();e!==e&&(e=Kr),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function X(e,t){return t}function Jr(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;Yr(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;ln(d),d.append(u),e.items.clear()}Yr(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Yr(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{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,Qr(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=E,ei(d,null,c)):Ln(d):Fn(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:Dn(()=>{p=W(f);var e=p.length;let t=!1;k&&Ee(c)===`[!`!=(e===0)&&(c=Te(),Se(c),xe(!1),t=!0);for(var r=new Set,u=P,v=un(),y=0;ys(c)):(d=On(()=>s(Xr??=on())),d.f|=E)),e>r.size&&Me(``,``,``),k&&e>0&&Se(Te()),!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),W(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,k&&(c=A)}function Zr(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Qr(e,t,n,i,a){var o=!!(i&8),s=t.length,c=e.items,l=Zr(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v0){var ee=i&4&&s===0?n:null;if(o){for(v=0;v{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function $r(e,t,n,r,i,a,o,s){var c=o&1?o&16?Ht(n):Ut(n,!1,!1):null,l=o&2?Ht(i):null;return{v:c,i:l,e:On(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function ei(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=cn(r);if(a.before(r),r===i)return;r=o}}function ti(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function ni(e,t,n){var r;k&&(r=A,Ce());var i=new Gr(e);Dn(()=>{var e=t()??null;if(k&&Ee(r)===`[`!=(e!==null)){var a=Te();Se(a),i.anchor=a,xe(!1),i.ensure(e,e&&(t=>n(t,e))),xe(!0);return}i.ensure(e,e&&(t=>n(t,e)))},T)}var ri=[...` +\r\f\xA0\v`];function ii(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||ri.includes(r[o-1]))&&(s===r.length||ri.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function ai(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 oi(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function si(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(oi)),i&&c.push(...Object.keys(i).map(oi));var l=0,u=-1;let t=e.length;for(var d=0;d{t.every(_i)||(`__defaultValue`in e&&fi(e,!1),`__value`in e&&pi(e,e.__value))});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),yn(()=>{t.disconnect()})}function hi(e,t,n=t){var r=new WeakSet,i=!0;st(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),gi);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&gi(o)}n(a),e.__value=a,P!==null&&r.add(P)}),wn(()=>{var a=t();if(e===document.activeElement){var o=P;if(r.has(o))return}if(pi(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=gi(s),n(a))}e.__value=a,i=!1})}function gi(e){return`__value`in e?e.__value:e.value}function _i(e){if(e.target.closest(`selectedcontent`)!==null)return!0;if(e.type===`childList`){var t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(e=>e.nodeName===`SELECTEDCONTENT`)}return!1}var vi=Symbol(`is custom element`),yi=Symbol(`is html`),bi=me?`link`:`LINK`;function xi(e){if(k){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;Q(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;Q(e,`checked`,null),e.checked=r}}};e[fe]=n,Ze(n),at()}}function Q(e,t,n,r){var i=Si(e);k&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===bi)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[se]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&wi(e).has(t)?e[t]=n:e.setAttribute(t,n))}function Si(e){return e[ce]??={[vi]:e.nodeName.includes(`-`),[yi]:e.namespaceURI===ge}}var Ci=new Map;function wi(e){var t=e.getAttribute(`is`)||e.nodeName,n=Ci.get(t);if(n)return n;Ci.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;st(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=ki(e)?Ai(a):a,n(a),P!==null&&r.add(P),await dr(),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))}}}),(k&&e.defaultValue!==e.value||mr(t)==null&&e.value)&&(n(ki(e)?Ai(e.value):e.value),P!==null&&r.add(P)),En(()=>{var n=t();if(e===document.activeElement){var i=P;if(r.has(i))return}ki(e)&&n===Ai(e.value)||(e.type!==`date`||n||e.value)&&n!==e.value&&(e.value=n??``)})}var Ei=new Set;function Di(e,t,n,r,i=r){var a=n.getAttribute(`type`)===`checkbox`,o=e;let s=!1;if(t!==null)for(var c of t)o=o[c]??=[];o.push(n),st(n,`change`,()=>{var e=n.__value;a&&(e=Oi(o,e,n.checked)),i(e)},()=>i(a?[]:null)),En(()=>{var e=r();if(k&&n.defaultChecked!==n.checked){s=!0;return}a?(e||=[],n.checked=e.includes(n.__value)):n.checked=$t(n.__value,e)}),yn(()=>{var e=o.indexOf(n);e!==-1&&o.splice(e,1)}),Ei.has(o)||(Ei.add(o),Ze(()=>{o.sort((e,t)=>e.compareDocumentPosition(t)===4?-1:1),Ei.delete(o)})),Ze(()=>{if(s){var e=a?Oi(o,e,n.checked):o.find(e=>e.checked)?.__value;i(e)}})}function Oi(e,t,n){for(var r=new Set,i=0;i{var n=this.#e.get(e);n.delete(t),n.size===0&&(this.#e.delete(e),this.#t.unobserve(e))}}#r(){return this.#t??=new ResizeObserver(t=>{for(var n of t){e.entries.set(n.target,n);for(var r of this.#e.get(n.target)||[])r(n)}})}}({box:`border-box`});function Mi(e,t,n){var r=ji.observe(e,()=>n(e[t]));wn(()=>(mr(()=>n(e[t])),r))}function Ni(e,t){return e===t||e?.[ie]===t}function Pi(e=qe(),t,n,r){var i=M.r,a=U;return wn(()=>{var o,s;return En(()=>{o=s,s=r?.()||[],mr(()=>{Ni(n(...s),e)||(t(e,...s),o&&Ni(n(...o),e)&&t(null,...o))})}),()=>{let r=a;for(;r!==i&&r.parent!==null&&r.parent.f&33554432;)r=r.parent;let o=()=>{s&&Ni(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Fi(e,t,n,r,i){var a=()=>{r(n[e])};n.addEventListener(t,a),i?En(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&yn(()=>{n.removeEventListener(t,a)})}function Ii(e=!1){let t=M,n=t.l.u;if(!n)return;let r=()=>hr(t.s);if(e){let e=0,n={},i=ft(()=>{let r=!1,i=t.s;for(let e in i)i[e]!==n[e]&&(n[e]=i[e],r=!0);return r&&e++,e});r=()=>W(i)}n.b.length&&Sn(()=>{Li(t,r),m(n.b)}),bn(()=>{let e=mr(()=>n.m.map(p));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&bn(()=>{Li(t,r),m(n.a)})}function Li(e,t){if(e.l.s)for(let t of e.l.s)W(t);t()}var Ri=!1;function zi(e){var t=Ri;try{return Ri=!1,[e(),Ri]}finally{Ri=t}}var Bi={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let i=e.props[r];d(i)&&(i=i());let o=a(i,t);if(o&&o.set)return o.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r){let e=a(r,t);return e&&!e.configurable&&(e.configurable=!0),e}}},has(e,t){if(t===ie||t===oe)return!1;for(let n of e.props)if(d(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){let t=[];for(let n of e.props)if(d(n)&&(n=n()),n){for(let e in n)t.includes(e)||t.push(e);for(let e of Object.getOwnPropertySymbols(n))t.includes(e)||t.push(e)}return t}};function Vi(...e){return new Proxy({props:e},Bi)}function Hi(e,t,n,r){var i=!He||!!(n&2),o=!!(n&8),s=!!(n&16),c=r,l=!0,u=void 0,d=()=>s&&i?(u??=ft(r),W(u)):(l&&(l=!1,c=s?mr(r):r),c);let f;if(o){var p=ie in e||oe in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=zi(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&Le(t),f(m)));var g=i?()=>{var n=e[t];return n===void 0?d():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return g;if(f){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&f(t?g():e),e):g()})}var v=!1,y=(n&1?ft:ht)(()=>(v=!1,g()));o&&W(y);var b=U;return(function(e,t){if(arguments.length>0){let n=t?W(y):i&&o?Zt(e):e;return I(y,n),v=!0,c!==void 0&&(c=n),e}return Hn&&v||b.f&16384?y.v:W(y)})}function Ui(e){M===null&&Ae(`onMount`),He&&M.l!==null?Wi(M).m.push(e):bn(()=>{let t=mr(e);if(typeof t==`function`)return t})}function Wi(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);function Gi(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,i,a,o=[],s=``,c=e.split(`/`);for(c[0]||c.shift();i=c.shift();)n=i[0],n===`*`?(o.push(`wild`),s+=`/(.*)`):n===`:`?(r=i.indexOf(`?`,1),a=i.indexOf(`.`,1),o.push(i.substring(1,~r?r:~a?a:i.length)),s+=~r&&!~a?`(?:/([^/]+?))?`:`/([^/]+?)`,~a&&(s+=(~r?`?`:``)+`\\`+i.substring(a))):s+=`/`+i;return{keys:o,pattern:RegExp(`^`+s+(t?`(?=$|/)`:`/?$`),`i`)}}var Ki=new class{#e=F(qi());get _loc(){return W(this.#e)}set _loc(e){I(this.#e,e)}#t=N(()=>this._loc.location);get _location(){return W(this.#t)}set _location(e){I(this.#t,e)}#n=N(()=>this._loc.querystring);get _querystring(){return W(this.#n)}set _querystring(e){I(this.#n,e)}#r=F(void 0);get _params(){return W(this.#r)}set _params(e){I(this.#r,e)}get loc(){return this._loc}get location(){return this._location}get querystring(){return this._querystring}get params(){return this._params}constructor(){typeof window<`u`?window.addEventListener(`hashchange`,()=>{this._loc=qi()}):console.warn(`[svelte-spa-router] window 'window' is not defined, skipping initiation`)}};function qi(){let e=typeof window<`u`?window.location.href:``,t=e.indexOf(`#/`),n=t>-1?e.substr(t+1):`/`,r=n.indexOf(`?`),i=``;return r>-1&&(i=n.substr(r+1),n=n.substr(0,r)),{location:n,querystring:i}}function Ji(e){e?window.scrollTo(e.__svelte_spa_router_scrollX||0,e.__svelte_spa_router_scrollY||0):window.scrollTo(0,0)}function Yi(e,t){Ge(t,!0);let n=Hi(t,`routes`,19,()=>({})),r=Hi(t,`prefix`,3,``),i=Hi(t,`restoreScrollState`,3,!1),a=Hi(t,`onConditionsFailed`,3,()=>{}),o=Hi(t,`onRouteLoaded`,3,()=>{}),s=Hi(t,`onRouteLoading`,3,()=>{}),c=Hi(t,`onRouteEvent`,3,()=>{});class l{path;component;conditions;userData;props;_pattern;_keys;constructor(e,t){let n=e=>typeof e==`object`&&!!e&&e._sveltesparouter===!0;if(!t||typeof t!=`function`&&!n(t))throw Error(`Invalid component object`);if(!e||typeof e==`string`&&(e.length<1||e.charAt(0)!=`/`&&e.charAt(0)!=`*`)||typeof e==`object`&&!(e instanceof RegExp))throw Error(`Invalid value for "path" argument - strings must start with / or *`);let r=Gi(e);if(this.path=e,n(t)){let e=t;this.component=e.component,this.conditions=e.conditions||[],this.userData=e.userData,this.props=e.props||{}}else{let e=t;this.component=()=>Promise.resolve(e),this.conditions=[],this.props={}}this._pattern=r.pattern,this._keys=r.keys}match(e){if(r()){if(typeof r()==`string`){if(e.startsWith(r()))e=e.substr(r().length)||`/`;else return null}else if(r()instanceof RegExp){let t=e.match(r());if(t&&t[0])e=e.substr(t[0].length)||`/`;else return null}}let t=this._pattern.exec(e);if(t===null)return null;if(this._keys===!1)return t;let n={},i=0;for(;i{u.push(new l(t,e))}):Object.keys(n()).forEach(e=>{let t=n();u.push(new l(e,t[e]))});let d=F(null),f=F(null),p=F({}),m=null,h=null;bn(()=>{history.scrollRestoration=i()?`manual`:`auto`}),bn(()=>{if(!i())return;let e=e=>{m=e.state&&(e.state.__svelte_spa_router_scrollY||e.state.__svelte_spa_router_scrollX)?e.state:null};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)});async function g(e,t){await dr(),e(t)}bn(()=>{let e=Ki.loc,t=!1;return mr(async()=>{let n=0;for(;n{t=!0}});function _(e){return e&&typeof e==`object`&&Object.keys(e).length?e:null}var v=Fr(),y=R(v),b=e=>{let t=N(()=>W(d));var n=Fr(),r=R(n),i=e=>{var n=Fr();ni(R(n),()=>W(t),(e,t)=>{t(e,Vi({get params(){return W(f)},get onRouteEvent(){return c()}},()=>W(p)))}),q(e,n)},a=e=>{var n=Fr();ni(R(n),()=>W(t),(e,t)=>{t(e,Vi({get onRouteEvent(){return c()}},()=>W(p)))}),q(e,n)};Y(r,e=>{W(f)?e(i):e(a,-1)}),q(e,n)};Y(y,e=>{W(d)&&e(b)}),q(e,v),Ke()}var Xi=[`bars`,`pace`,`zone`,`pie`,`fuel`,`resets`,`thresholds`],Zi=`codexometer.web.preferences.v1`,Qi={tab:`quota`,view:`bars`,selected:``,defaultDetail:0,layouts:[]};function $i(){try{let e=JSON.parse(localStorage.getItem(Zi)||`null`);return!e||typeof e!=`object`?Qi:{tab:[`quota`,`sessions`,`usage`].includes(e.tab)?e.tab:`quota`,view:Xi.includes(e.view)?e.view:`bars`,selected:typeof e.selected==`string`?e.selected.slice(0,256):``,defaultDetail:+(e.defaultDetail===1),layouts:Array.isArray(e.layouts)?e.layouts.filter(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&t.id.length<=256&&[0,1,2].includes(t.level)}).slice(-100):[]}}catch{return Qi}}var ea=Zt($i());function ta(){let e=JSON.stringify(ea);try{localStorage.setItem(Zi,e)}catch{}}function na(){return ea.tab===`quota`?`/quota/`+ea.view:`/`+ea.tab}function ra(e){return ea.layouts.find(t=>t.id===e)?.level??ea.defaultDetail}function ia(e){ea.defaultDetail=e,ea.layouts=[]}function aa(e,t){ea.layouts=[...ea.layouts.filter(t=>t.id!==e),{id:e,level:Math.max(0,Math.min(2,t))}].slice(-100)}var $=Zt({data:null,connected:!1,error:``}),oa=e=>e==null?`Unavailable`:e.toLocaleString(`en-GB`),sa=e=>!e||String(e).startsWith(`0001-`)?`Not yet available`:new Date(typeof e==`number`?e*1e3:e).toLocaleString(`en-GB`),ca=`codexometer.web.session`,la=class extends Error{},ua;async function da(e,t,n){if(!ua||!$.connected||!$.data?.control||$.data.sessionsError)throw Error(`Session controls unavailable. Check the live connection.`);return await ua(e,t,n)}function fa(){let e=new AbortController,t,n=``;ua=async(t,r,i)=>{let a=await fetch(`/api/control/`+t,{method:`POST`,headers:{Authorization:`Bearer ${n}`,"Content-Type":`application/json`},body:JSON.stringify(r),signal:AbortSignal.any([e.signal,AbortSignal.timeout(8e3),...i?[i]:[]]),cache:`no-store`});if(!a.ok)throw a.status===502?Error(`Outcome uncertain. Check Codex before taking another action; nothing was retried.`):new la(`Action rejected, expired or changed. Refresh and check Codex; nothing was retried.`);return a.json()};try{n=sessionStorage.getItem(ca)||``}catch{}let r=location.hash,i=r.startsWith(`#pair=`)?r.slice(6):``;(i||!r||r===`#`)&&(history.replaceState(null,``,`/#`+na()),window.dispatchEvent(new HashChangeEvent(`hashchange`)));async function a(){if(i)try{let t=await fetch(`/api/pair`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({secret:i}),signal:e.signal});if(!t.ok)throw Error(`Pairing link expired or already used. Restart --web for a fresh link.`);n=(await t.json()).token;try{sessionStorage.setItem(ca,n)}catch{}}catch(t){e.signal.aborted||($.error=t instanceof Error?t.message:`Pairing failed`);return}if(!n){$.error=`Open the private pairing link printed by codexometer --web in your terminal.`;return}await o()}async function o(){try{let t=await fetch(`/api/events`,{headers:{Authorization:`Bearer ${n}`},signal:e.signal,cache:`no-store`});if(t.status===401){try{sessionStorage.removeItem(ca)}catch{}$.error=`Browser session expired. Restart --web and open its new pairing link.`;return}if(!t.ok||!t.body)throw Error(`Live connection unavailable`);let r=t.body.getReader(),i=new TextDecoder,a=``;for(;!e.signal.aborted;){let{done:e,value:t}=await r.read();if(e)break;a+=i.decode(t,{stream:!0});let n;for(;(n=a.indexOf(` + +`))>=0;){let e=a.slice(0,n);a=a.slice(n+2),e.startsWith(`data: `)&&($.data=JSON.parse(e.slice(6)),$.connected=!0,$.error=``)}}}catch{}finally{$.connected=!1}e.signal.aborted||($.error=`Connection lost — showing last observation. Reconnecting…`,t=setTimeout(o,2500))}return a(),()=>{ua=void 0,e.abort(),clearTimeout(t),$.connected=!1}}Ue();var pa=K(`

Quota refresh failed. Policy state is based on the last successful + observation.

`),ma=K(`

`),ha=K(`

The longest Codex quota window selects one active model profile. ASK + creates a per-session review; AUTO applies the profile on the next + eligible check.

`,1),ga=K(`

No threshold-based model steps were configured at launch.

`);function _a(e,t){Ge(t,!1),Ii();var n=Fr(),r=R(n),i=e=>{var t=ha(),n=R(t),r=z(n),i=B(n,2),a=e=>{q(e,pa())};Y(i,e=>{$.data.quotaError&&e(a)});var o=B(i,2),s=L(o),c=z(s),l=B(s,4);Z(l,5,()=>$.data.thresholds,X,(e,t)=>{var n=ma();let r;var i=L(n),a=z(i),o=B(i,2),s=L(o),c=z(s,!0),l=z(B(s,2));j(o);var u=B(o,2),d=z(u,!0),f=z(B(u,2));j(n),V((e,i)=>{r=ci(n,1,``,null,r,{active:W(t).state===`ACTIVE`,next:W(t).state===`NEXT`}),J(a,`${W(t).threshold??``}%`),J(c,W(t).model),J(l,`${e??``} REASONING // ${i??``} + SPEED`),J(d,W(t).mode),J(f,`${W(t).state??``}${W(t).state===`NEXT`?` // ${W(t).remaining||0} PP TO GO`:``}`)},[()=>W(t).effort.toUpperCase(),()=>W(t).speed.toUpperCase()]),q(e,n)}),j(l),j(o),V(e=>{J(r,`MODEL STEP POLICY // OBSERVED ${e??``}`),J(c,`THRESHOLDS // ${$.data.thresholds.length??``} CONFIGURED`)},[()=>sa($.data.quotaAt)]),q(e,t)},a=e=>{q(e,ga())};Y(r,e=>{$.data?.thresholds?.length?e(i):e(a,-1)}),q(e,n),Ke()}var va=Nr(` `,1),ya=Nr(` `,1),ba=K(` `),xa=K(`
Quota observations
Observed atPeriod elapsedConsumedTrail segment
`),Sa=K(`


Observed quota + path, not individual session usage. Gaps are not interpolated. Expand the + observation table for times, positions and gaps.

OBSERVATION TABLE
`,1),Ca=K(`
CONSUMPTIONQUOTA PERIOD ELAPSED


`,1);function wa(e,t){let n=Ir();Ge(t,!0);let r=Hi(t,`trail`,19,()=>[]),i=F(!1),a=[0,25,50,75,100],o=F(400),s=F(240),c=N(()=>W(o)-24),l=N(()=>W(s)-48),u=N(()=>Math.max(1,W(c)-48)),d=N(()=>Math.max(1,W(l)-20)),f=N(()=>48+Math.max(0,Math.min(100,t.elapsed))/100*W(u)),p=N(()=>W(l)-Math.max(0,Math.min(100,t.used))/100*W(d)),m=N(()=>t.used-t.elapsed),h=N(()=>r().map((e,t)=>`${t===0||e.break?`M`:`L`}${48+e.elapsed/100*W(u)} ${W(l)-e.used/100*W(d)}`).join(` `));var g=Ca(),_=R(g),v=L(_),y=L(v),b=z(y),x=B(y),S=B(x);Z(S,17,()=>a,X,(e,t)=>{var n=va(),r=R(n),i=B(r),a=B(i),o=z(a),s=B(a),f=z(s);V(()=>{Q(r,`x1`,48+W(t)/100*W(u)),Q(r,`x2`,48+W(t)/100*W(u)),Q(r,`y2`,W(l)),Q(i,`y1`,W(l)-W(t)/100*W(d)),Q(i,`x2`,W(c)),Q(i,`y2`,W(l)-W(t)/100*W(d)),Q(a,`x`,48+W(t)/100*W(u)),Q(a,`y`,W(l)+20),J(o,`${W(t)??``}%`),Q(s,`y`,W(l)+4-W(t)/100*W(d)),J(f,`${W(t)??``}%`)}),q(e,n)});var C=B(S),w=B(C),T=B(w),ee=e=>{var t=ya(),n=R(t),i=B(n),a=z(L(i));j(i),V(e=>{Q(n,`d`,W(h)),Q(i,`cx`,48+r()[0].elapsed/100*W(u)),Q(i,`cy`,W(l)-r()[0].used/100*W(d)),J(a,`First observation: ${e??``}`)},[()=>sa(r()[0].at)]),q(e,t)};Y(T,e=>{r().length&&e(ee)});var te=B(T,2),E=B(te),D=B(E),ne=z(L(D));j(D),j(v),j(_);var re=B(_,2),ie=L(re),ae=z(B(ie,3),!0);j(re);var oe=B(re,2),se=e=>{var t=Sa(),a=R(t),o=L(a);we(2),j(a);var s=B(a,2),c=B(L(s),2),l=e=>{var t=xa(),n=L(t),i=B(L(n),2);Z(i,21,r,X,(e,t,n)=>{var r=ba(),i=L(r),a=L(i),o=z(a,!0);j(i);var s=B(i),c=z(s),l=B(s),u=z(l),d=z(B(l),!0);j(r),V((e,r)=>{Q(a,`datetime`,W(t).at),J(o,e),J(c,`${r??``}%`),J(u,`${W(t).used??``}%`),J(d,n===0?`First observation`:W(t).break?`Gap before this observation`:`Connected to previous observation`)},[()=>sa(W(t).at),()=>W(t).elapsed.toFixed(1)]),q(e,r)}),j(i),j(n),j(t),q(e,t)};Y(c,e=>{W(i)&&e(l)}),j(s),V(e=>{Q(a,`id`,n+`-trail-summary`),J(o,`○ START ${e??``} // ${r().length??``} + ${r().length===1?`OBSERVATION`:`OBSERVATIONS`}`)},[()=>sa(r()[0].at)]),Fi(`open`,`toggle`,s,e=>I(i,e),()=>W(i)),q(e,t)};Y(oe,e=>{r().length&&e(se)}),V((e,i,a,m)=>{Q(v,`viewBox`,`0 0 ${W(o)} ${W(s)}`),Q(v,`aria-describedby`,r().length?n+`-trail-summary`:void 0),Q(v,`aria-label`,e),Q(b,`id`,n),Q(x,`width`,W(u)),Q(x,`height`,W(d)),Q(x,`fill`,`url(#${n})`),Q(C,`d`,`M48 20 V${W(l)} H${W(c)}`),Q(w,`y1`,W(l)),Q(w,`x2`,W(c)),Q(te,`x`,48+W(u)/2),Q(te,`y`,W(s)-5),Q(E,`cx`,W(f)),Q(E,`cy`,W(p)),Q(D,`cx`,W(f)),Q(D,`cy`,W(p)),J(ne,`${t.used??``}% consumed // ${i??``}% of period elapsed`),J(ie,`${t.used??``}% USED // ${a??``}% TIME ELAPSED`),J(ae,m)},[()=>`Consumption zone: ${t.used}% consumed, ${t.elapsed.toFixed(1)}% of quota period elapsed. ${W(m)>0?`Above`:W(m)<0?`Below`:`On`} the steady-consumption line.`,()=>t.elapsed.toFixed(1),()=>t.elapsed.toFixed(1),()=>Math.abs(W(m))<.05?`ON PACE`:W(m)>0?`ABOVE THE LINE — CONSUMING FASTER THAN TIME`:`BELOW THE LINE — WITHIN PACE`]),Mi(_,`clientWidth`,e=>I(o,e)),Mi(_,`clientHeight`,e=>I(s,e)),q(e,g),Ke()}var Ta=K(` `),Ea=K(`

Quota refresh failed. Values below are the last successful observation.

`),Da=K(`

Expiry details unavailable. No listed expiry does not mean no expiry.

`),Oa=K(`

`),ka=K(`

Read-only preview. Use the terminal to redeem a reset.

The backend may return only some credits. This list does not establish + redemption order.

`),Aa=K(` `,1),ja=Nr(``),Ma=Nr(``),Na=K(`
`),Pa=K(`

Cycle duration or reset date unavailable — position cannot be + plotted.

`),Fa=K(`
▼
−100 // OVER BUDGET+100 // HEADROOM

`,1),Ia=K(`

Cycle duration unavailable — pace cannot be calculated.

`),La=K(`
EMPTYFULL
`),Ra=K(`

`,1),za=K(`
`,1),Ba=K(`

`),Va=K(`

`),Ha=K(`

No quota windows reported yet.

`),Ua=K(`
`,1),Wa=K(`

All reported windows are shown. API-equivalent learning and quota status + scoring remain in the terminal for this first preview.

`,1),Ga=K(` `,1);function Ka(e,t){Ge(t,!0);let n=Hi(t,`params`,19,()=>({})),r=N(()=>Xi.filter(e=>e!==`thresholds`||!!$.data?.thresholds?.length)),i=F(Zt(Date.now())),a=N(()=>W(r).includes(n().view||``)?n().view:`bars`);Ui(()=>{let e=setInterval(()=>I(i,Date.now(),!0),1e3);return()=>clearInterval(e)});function o(e){return!e.duration||e.duration<=0||!e.reset?null:Math.max(0,Math.min(100,100*(1-(e.reset*1e3-W(i))/(e.duration*6e4))))}bn(()=>{ea.view=W(a)});function s(e){let t=e/100*Math.PI*2;return`M60 60 L60 14 A46 46 0 ${+(e>50)} 1 ${60+46*Math.sin(t)} ${60-46*Math.cos(t)} Z`}var c=Ga(),l=R(c);Z(l,21,()=>W(r),X,(e,t)=>{var n=Ta();let r;var i=z(n,!0);V(e=>{Q(n,`href`,`#/quota/`+W(t)),Q(n,`aria-current`,W(a)===W(t)?`page`:void 0),r=ci(n,1,``,null,r,{active:W(a)===W(t)}),J(i,e)},[()=>W(t)===`pace`?`CONSUMPTION PACE`:W(t)===`zone`?`CONSUMPTION ZONE`:W(t)===`fuel`?`FUEL TANK`:W(t).toUpperCase()]),q(e,n)}),j(l);var u=B(l,2),d=e=>{var t=Wa(),n=R(t),r=e=>{q(e,Ea())};Y(n,e=>{$.data.quotaError&&e(r)});var i=B(n,2),c=z(i),l=B(i,2),u=e=>{_a(e,{})},d=e=>{var t=ka(),n=L(t),r=z(n),i=B(n,4),a=e=>{q(e,Da())};Y(i,e=>{$.data.credits.length||e(a)}),Z(B(i,2),17,()=>$.data.credits,X,(e,t)=>{var n=Oa(),r=L(n),i=z(r),a=z(B(r,2),!0);j(n),V(e=>{J(i,`${(W(t).title||`Quota reset`)??``} // ${W(t).status??``}`),J(a,e)},[()=>W(t).expiryKnown?W(t).expires?`EXPIRES `+sa(W(t).expires):`Does not expire`:`Expiry information unavailable`]),q(e,n)}),we(2),j(t),V(()=>J(r,`RESET INVENTORY // ${$.data.creditCount??``} AVAILABLE`)),q(e,t)},f=e=>{var t=Ua(),n=R(t);let r;Z(n,21,()=>$.data.meters,X,(e,t)=>{let n=N(()=>o(W(t))),r=N(()=>W(n)===null?null:W(n)-W(t).used);var i=Va(),c=L(i),l=z(c,!0),u=B(c,2),d=L(u),f=e=>{var n=Aa(),r=R(n),i=z(r),a=z(B(r));V(()=>{J(i,`FREE ${100-W(t).used}%`),J(a,`USED ${W(t).used??``}%`)}),q(e,n)},p=e=>{var n=Aa(),r=R(n),i=z(r),a=z(B(r));V(()=>{J(i,`USED ${W(t).used??``}%`),J(a,`FREE ${100-W(t).used}%`)}),q(e,n)};Y(d,e=>{W(a)===`fuel`?e(f):e(p,-1)}),j(u);var m=B(u,2);let h;var g=L(m),_=e=>{var n=Na(),r=L(n),i=B(L(r)),a=e=>{q(e,ja())},o=e=>{var n=Ma();V(e=>Q(n,`d`,e),[()=>s(W(t).used)]),q(e,n)};Y(i,e=>{W(t).used>=100?e(a):W(t).used>0&&e(o,1)}),j(r),j(n),V(()=>Q(r,`aria-label`,`${W(t).used}% quota used`)),q(e,n)},v=e=>{var r=Fr(),i=R(r),a=e=>{{let r=N(()=>W(t).trail||[]);wa(e,{get used(){return W(t).used},get elapsed(){return W(n)},get trail(){return W(r)}})}},o=e=>{q(e,Pa())};Y(i,e=>{W(n)===null?e(o,-1):e(a)}),q(e,r)},y=e=>{var t=Fr(),n=R(t),i=e=>{var t=Fa(),n=R(t),i=B(L(n),2);let a;j(n);var o=B(n,4),s=L(o),c=z(B(s),!0);j(o),V(e=>{a=ui(i,``,a,{left:`${(W(r)+100)/2}%`}),J(s,`${W(r)>=0?`+`:``}${e??``} PP `),J(c,W(r)>=0?`WITHIN PACE`:`USING FASTER THAN TIME`)},[()=>W(r).toFixed(1)]),q(e,t)},a=e=>{q(e,Ia())};Y(n,e=>{W(r)===null?e(a,-1):e(i)}),q(e,t)},b=e=>{var r=za(),i=R(r),o=L(i);let s;j(i);var c=B(i,2),l=e=>{q(e,La())};Y(c,e=>{W(a)===`fuel`&&e(l)});var u=B(c,2),d=e=>{var t=Ra(),r=R(t),i=z(r),o=B(r,2),s=L(o);let c;j(o),V(e=>{J(i,`RESET CYCLE // ${e??``}% ELAPSED`),c=ui(s,``,c,{width:`${W(a)===`fuel`?100-W(n):W(n)}%`})},[()=>Math.floor(W(n))]),q(e,t)};Y(u,e=>{W(n)!==null&&e(d)}),V(()=>{Q(i,`aria-label`,W(a)===`fuel`?`Fuel remaining`:`Quota used`),Q(i,`aria-valuenow`,W(a)===`fuel`?100-W(t).used:W(t).used),s=ui(o,``,s,{width:`${W(a)===`fuel`?100-W(t).used:W(t).used}%`})}),q(e,r)};Y(g,e=>{W(a)===`pie`?e(_):W(a)===`zone`?e(v,1):W(a)===`pace`?e(y,2):e(b,-1)}),j(m);var x=B(m,2),S=z(x),C=B(x,2),w=e=>{var n=Ba(),r=z(n,!0);V(()=>J(r,W(t).details)),q(e,n)};Y(C,e=>{W(t).details&&e(w)}),j(i),V(e=>{J(l,W(t).name),h=ci(m,1,`meter-graphic`,null,h,{"bar-graphic":W(a)===`bars`||W(a)===`fuel`}),J(S,`RESETS // ${e??``}`)},[()=>sa(W(t).reset)]),q(e,i)}),j(n);var i=B(n,2),c=e=>{q(e,Ha())};Y(i,e=>{$.data.meters.length||e(c)}),V(()=>r=ci(n,1,`quota-grid`,null,r,{radial:W(a)===`pie`,zone:W(a)===`zone`})),q(e,t)};Y(l,e=>{W(a)===`thresholds`?e(u):W(a)===`resets`?e(d,1):e(f,-1)}),we(2),V(e=>J(c,`QUOTA // OBSERVED ${e??``}`),[()=>sa($.data.quotaAt)]),q(e,t)};Y(u,e=>{$.data&&e(d)}),q(e,c),Ke()}var qa=K(`
`),Ja=K(`

`,1);function Ya(e,t){Ge(t,!0);let n=Hi(t,`values`,19,()=>[]),r=Hi(t,`label`,3,`Token activity`),i=Hi(t,`capacity`,3,0),a=N(()=>Math.max(0,...n())),o=N(()=>i()>n().length?[...Array(i()-n().length).fill(0),...n()]:n());var s=Ja(),c=R(s),l=z(c),u=B(c,2);Z(u,21,()=>W(o),X,(e,t)=>{var n=qa();let r;V((e,t)=>{Q(n,`title`,e),r=ui(n,``,r,{height:t})},[()=>W(t).toLocaleString(`en-GB`)+` tokens`,()=>`${100*W(t)/Math.max(1,W(a))}%`]),q(e,n)}),j(u),V((e,t)=>{J(l,`SCALE // 0 — ${e??``} TOKENS`),Q(u,`aria-label`,t)},[()=>W(a).toLocaleString(`en-GB`),()=>`${r()}. Peak ${W(a).toLocaleString(`en-GB`)} tokens.`]),q(e,s),Ke()}var Xa=K(` `,1),Za=K(`
`),Qa=K(`
/
`);function $a(e,t){Ge(t,!0);let n=N(()=>t.lines.filter(e=>e.kind===`addition`).length),r=N(()=>t.lines.filter(e=>e.kind===`removal`).length);var i=Qa(),a=L(i),o=L(a),s=z(o),c=z(B(o,2));j(a),Z(B(a,2),17,()=>t.lines,X,(e,t)=>{var n=Za();let r;var i=L(n),a=e=>{var n=Xa(),r=R(n),i=z(r,!0),a=z(B(r),!0);V(()=>{J(i,W(t).old||``),J(a,W(t).new||``)}),q(e,n)};Y(i,e=>{W(t).kind!==`heading`&&W(t).kind!==`metadata`&&e(a)});var o=z(B(i),!0);j(n),V(()=>{r=ci(n,1,`diff-line svelte-x4gtb6`,null,r,{added:W(t).kind===`addition`,removed:W(t).kind===`removal`,heading:W(t).kind===`heading`}),J(o,W(t).text)}),q(e,n)}),j(i),V(()=>{Q(a,`aria-label`,`${W(n)} lines added, ${W(r)} lines removed`),J(s,`+${W(n)??``}`),J(c,`−${W(r)??``}`)}),q(e,i),Ke()}var eo=K(`

`),to=K(`

Send this saved prompt now? This starts Codex work and consumes quota.

`,1),no=K(``),ro=K(`

 

In memory only. Follows session model, reasoning and speed. Closing + Codexometer cancels pending work.

`),io=K(`

CURRENT PROFILE

MODEL / REASONING LEVEL / SPEED

 

PROPOSED PROFILE

MODEL / REASONING LEVEL / SPEED

 

Applied settings remain after Codexometer closes.

`,1),ao=K(`

`),oo=K(`

 
`,1),so=K(`

Command unavailable from this observation. Open Codex to inspect the + request.

`),co=K(`

Session controls temporarily unavailable. Check Codex for current state.

`),lo=K(`

Checking session controls…

`),uo=K(`

`),fo=K(`
About browser controls

Controls require a supported live request from a connected shared + app-server session. Local observations alone cannot provide them.

`),po=K(` `,1),mo=K(` `),ho=K(`Grants permission beyond this one action. Check the scope + carefully.`),go=K(``),_o=K(``),vo=K(``),yo=K(``),bo=K(`

Not before this time; when quota and idle allow.

`),xo=K(`

`,1),So=K(`

The existing trigger remains active until saved or deleted. If + it changes or sends while you edit, saving is blocked.

`),Co=K(` `,1),wo=K(``),To=K(``),Eo=K(``),Do=K(` `,1),Oo=K(`
  • `),ko=K(`
    View fixed choices

    Type one of these choices exactly. Your answer stays masked.

      `),Ao=K(` `,1),jo=K(`

      `),Mo=K(`

      `,1),No=K(` `,1),Po=K(``),Fo=K(`

      `,1),Io=K(`

      `);function Lo(e,t){Ge(t,!0);let n=[],r=Hi(t,`observedCommand`,3,``),i=Hi(t,`observedFileChanges`,19,()=>[]),a=Hi(t,`review`,3,``),o=Hi(t,`suspended`,3,!1),s=Hi(t,`openScheduler`,3,!1),c=Hi(t,`onProtectedChange`,3,e=>{}),l=F(null),u=F(Zt([])),d=F(null),f=F(``),p=F(0),m=F(Zt(Date.now())),h=F(!1),g=F(``),_=F(!1),v=F(!1),y=F(``),b=F(!1),x=F(``),S=F(!1),C=F(``),w=F(`now`),T=F(60),ee=F(``),te=F(!1),E=F(``),D=F(Zt([])),ne=N(()=>W(D).find(e=>e.status!==`sent`)),re=F(void 0);function ie(e){if(W(b)){dr().then(()=>W(re)?.focus());return}if(e.status!==`pending`||W(h)||!W(l)?.id||W(l).kind!==`prompt`||W(l).questions?.length)return;I(b,!0),I(x,e.id,!0),dr().then(()=>W(re)?.focus()),I(u,[e.text],!0),I(w,e.trigger===`quota`?`quota`:`at`,!0),I(f,``),I(C,``);let t=new Date(e.at);e.trigger!==`quota`&&I(ee,new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16),!0)}bn(()=>{s()&&W(ne)&&!W(S)&&W(l)?.id&&W(l).kind===`prompt`&&!W(l).questions?.length&&(I(S,!0),ie(W(ne)))});async function ae(){if(!a())try{I(D,await da(`schedules`,{session:t.session},ye.signal),!0),W(b)&&!W(D).some(e=>e.id===W(x)&&e.status===`pending`)&&I(f,``),W(C)&&!W(D).some(e=>e.id===W(C)&&e.status===`pending`)&&(I(f,``),I(C,``))}catch{}}async function oe(e){try{I(D,await da(`schedules`,{session:t.session,cancelId:e},ye.signal),!0),I(b,!1),I(f,``),I(C,``),I(u,[],!0)}catch(e){I(g,e instanceof Error?e.message:`Unable to cancel trigger.`,!0)}}bn(()=>(c()(W(h)||W(u).some(e=>e.length>0)),()=>c()(!1)));let se=N(()=>$.data?.sessions.find(e=>e.id===t.session)?.status),ce=N(()=>!$.connected||!!$.data?.sessionsError),le=N(()=>a()!==`profile`&&W(l)?.kind===`prompt`&&!W(l).questions?.length&&!!$.data?.profiles?.some(e=>e.session===t.session&&e.pending)),ue=N(()=>!W(ce)&&!W(v)&&!!W(l)?.id&&W(l).kind===`approval`&&W(y)!==W(l).id),de=N(()=>W(ue)?W(l).command:r()),fe=N(()=>!!W(f)&&W(m)W(l)?.questions?.length?W(l).questions:[{text:`Follow-up message`,secret:!1,freeText:!0,options:[]}]),me=N(()=>W(l)?.kind===`approval`||W(l)?.kind===`profile`?W(d)!==null:W(u).length===W(pe).length&&W(u).every((e,t)=>e.trim().length>0&&(W(pe)[t].freeText||W(pe)[t].options?.includes(e)))),he=N(()=>W(l)?.kind===`prompt`&&!W(l).questions?.length&&W(w)!==`now`),O=N(()=>W(w)===`delay`?W(m)+W(T)*6e4:Date.parse(W(ee))),ge=N(()=>{if(!W(he))return``;if(W(b)&&!W(D).some(e=>e.id===W(x)&&e.status===`pending`))return`Trigger changed, removed or already sent. Go back and reopen it; your draft has not been saved.`;if(!W(u)[0]?.trim())return`Enter a message to schedule.`;if(W(w)===`quota`)return``;if(!Number.isFinite(W(O))||W(O)<=W(m))return`Choose a future date/time or a delay greater than zero.`;let e=new Date(W(m));return e.setFullYear(e.getFullYear()+1),W(O)>=e.getTime()?`Choose a time within one year.`:``});function _e(e){return new Date(e).toLocaleString([],{timeZoneName:`short`})}function ve(e){if(e.status!==`pending`)return e.status;if(e.trigger===`at`&&Date.parse(e.at)>W(m))return`Due in `+Math.ceil((Date.parse(e.at)-W(m))/6e4)+` min`;let t=W(ce)?`waiting for a fresh connection`:e.waitingReason||(e.canSend?`ready; awaiting dispatch`:`waiting for quota and an eligible idle session`);return(e.trigger===`at`?`Time reached — `:``)+t}bn(()=>{(W(ce)||o()||W(le)||W(m)>=W(p))&&I(f,``)});let ye=new AbortController;Ui(()=>{let e=e=>{e.ctrlKey&&e.key.toLowerCase()===`s`&&!a()&&W(ne)&&(e.preventDefault(),ie(W(ne)))};window.addEventListener(`keydown`,e);let n,r=setInterval(()=>{I(m,Date.now(),!0)},1e3);async function i(){await ae();try{let e=await da(`offer`,{session:t.session,...a()?{review:a()}:{}},ye.signal);if(ye.signal.aborted)return;I(v,!1),W(l)?.id!==e.id&&(I(f,``),I(d,null),I(u,Array(Math.max(1,e.questions?.length||0)).fill(``),!0)),I(l,e,!0),W(_)&&e.id&&e.id!==W(y)&&(I(g,``),I(_,!1))}catch{ye.signal.aborted||(I(l,null),I(v,!0),I(f,``))}finally{ye.signal.aborted||(n=setTimeout(i,2e3))}}return i(),()=>{window.removeEventListener(`keydown`,e),ye.abort(),clearTimeout(n),clearInterval(r)}});async function be(e){if(!W(l)?.id||W(h)||W(ce)||o()||W(le)||(e?!e.canSend:!W(me)||W(ge)))return;let n=W(l).id;I(h,!0),I(g,``),I(_,!1),I(f,``),I(C,e?.id||``,!0);try{let r=!e&&W(l).kind===`prompt`&&!W(l).questions?.length&&W(w)!==`now`?{trigger:W(w)===`quota`?`quota`:`at`,zone:Intl.DateTimeFormat().resolvedOptions().timeZone,...W(w)===`quota`?{}:{at:(W(w)===`delay`?new Date(Date.now()+W(T)*6e4):new Date(W(ee))).toISOString()}}:void 0;I(te,!!r),I(E,r?r.trigger===`quota`?`After fresh quota becomes available, when the session is idle`:_e(r.at)+` — not before this time; when quota and idle allow`:``,!0);let i=await da(`prepare`,{session:t.session,...a()?{review:a()}:{},offer:n,...e?{sendId:e.id}:{},...r?{schedule:r}:{},...r&&W(b)?{editId:W(x)}:{},...W(l).kind===`approval`||W(l).kind===`profile`?{choice:W(d)}:{answers:e?[e.text]:[...W(u)]}},ye.signal);W(l)?.id===n&&!ye.signal.aborted&&!W(ce)&&!o()&&!W(le)&&(I(f,i.confirmation,!0),I(p,Date.parse(i.expires),!0))}catch(e){ye.signal.aborted||I(g,e instanceof Error?e.message:`Unable to prepare action.`,!0)}finally{I(h,!1)}}async function k(){if(!W(l)?.id||W(h)||o()||W(le)||!W(fe))return;let e=W(l).id,n=W(l).kind,r=W(f);I(f,``),I(h,!0),I(y,e,!0);try{await da(`commit`,{session:t.session,...a()?{review:a()}:{},offer:e,confirmation:r},ye.signal),I(_,!0),I(b,!1),W(te)&&(I(y,``),await ae()),I(g,W(te)?`Trigger set. Closing Codexometer cancels it.`:n===`profile`?`Profile decision completed.`:n===`approval`?`Decision sent.`:`Text sent.`,!0)}catch(e){I(g,e instanceof la?e.message:`Outcome uncertain. Check Codex before taking another action; nothing was retried.`,!0)}finally{I(h,!1),I(C,``),await ae(),I(u,[],!0),I(d,null)}}var xe=po(),A=R(xe),Se=e=>{var t=Fr();Z(R(t),17,()=>W(D).filter(e=>e.status!==`sent`),e=>e.id,(e,t)=>{var n=ro(),r=L(n),i=z(r,!0),a=B(r,2),s=z(a),c=B(a,2),u=z(c,!0),d=B(c,2),p=z(d,!0),m=B(d,2),_=z(m,!0),v=B(m,2),y=e=>{var t=eo(),n=z(t,!0);V(()=>J(n,W(g))),q(e,t)};Y(v,e=>{W(g)&&e(y)});var b=B(v,4),x=B(b,2),S=B(x,2),w=e=>{var n=to(),r=B(R(n),2),i=B(r,2);V(()=>r.disabled=W(h)||W(ce)||!W(t).canSend),G(`click`,r,k),G(`click`,i,()=>{I(f,``),I(C,``)}),q(e,n)},T=e=>{var n=no();V(()=>n.disabled=W(h)||W(ce)||!W(t).canSend||o()),G(`click`,n,()=>be(W(t))),q(e,n)};Y(S,e=>{W(fe)&&W(C)===W(t).id?e(w):e(T,-1)}),j(n),V((e,n)=>{J(i,W(t).status===`uncertain`?`CHECK TRIGGER — outcome uncertain; not retried`:`SCHEDULED FOLLOW-UP`),J(s,`TARGET // ${W(t).session??``}`),J(u,e),J(p,n),J(_,W(t).text),b.disabled=W(h)||!W(l)?.id||W(l).kind!==`prompt`||!!W(l).questions?.length||W(t).status!==`pending`,x.disabled=W(h)||W(t).status===`sending`},[()=>W(t).trigger===`quota`?`After confirmed quota recovery, when idle`:`Not before ${_e(W(t).at)}`,()=>ve(W(t))]),G(`click`,b,()=>ie(W(t))),G(`click`,x,()=>oe(W(t).id)),q(e,n)}),q(e,t)},Ce=N(()=>!a()&&W(l)?.kind!==`approval`&&!W(l)?.questions?.length&&![`APPROVAL NEEDED`,`INPUT NEEDED`].includes(W(se)||``));Y(A,e=>{W(Ce)&&e(Se)});var Te=B(A,2),Ee=e=>{var r=Io(),o=L(r),s=z(o,!0),c=B(o,2),x=e=>{var t=io(),n=R(t),r=z(n),i=B(n,6),a=z(i,!0),o=z(B(i,6),!0);we(2),V(()=>{J(r,`Your ${W(l).profile.threshold??``}% quota threshold has been reached. Review + the profile for subsequent turns.`),J(a,W(l).profile.current),J(o,W(l).profile.proposed)}),q(e,t)};Y(c,e=>{W(l)?.profile&&!W(ce)&&!W(v)&&e(x)});var S=B(c,2),C=e=>{var t=ao();let n;var r=z(t,!0);V(()=>{n=ci(t,1,`svelte-1oupzfc`,null,n,{notice:!W(_),sent:W(_)}),J(r,W(g))}),q(e,t)};Y(S,e=>{W(g)&&e(C)});var D=B(S,2),ne=e=>{$a(e,{get lines(){return W(l).fileChanges}})},ie=e=>{$a(e,{get lines(){return i()}})},ae=e=>{var t=oo(),n=R(t),r=z(n,!0),i=z(B(n,2),!0);V(()=>{J(r,W(ue)?`EXACT COMMAND`:`LAST OBSERVED COMMAND`),J(i,W(de))}),q(e,t)},oe=e=>{q(e,so())};Y(D,e=>{W(l)?.fileChanges?.length&&!W(ce)&&!W(v)?e(ne):i().length?e(ie,1):W(de)?e(ae,2):a()!==`profile`&&W(se)===`APPROVAL NEEDED`&&!W(_)&&e(oe,3)});var le=B(D,2),he=e=>{q(e,co())},ve=e=>{q(e,lo())},ye=e=>{var t=po(),n=R(t),r=e=>{var t=uo(),n=z(t,!0);V(e=>J(n,e),[()=>W(se)===`WORKING`?`Codex is working — nothing to respond to.`:[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(W(se)||``)?`Respond in Codex for this request.`:`Nothing needs a response right now.`]),q(e,t)};Y(n,e=>{(W(se)===`WORKING`||!W(_)&&!W(h))&&e(r)});var i=B(n,2),a=e=>{q(e,fo())},o=N(()=>[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(W(se)||``)&&!W(_));Y(i,e=>{W(o)&&e(a)}),q(e,t)},xe=e=>{var r=Fo(),i=R(r),o=z(i),s=B(i,2),c=L(s),g=z(c,!0),_=B(c,2),v=e=>{var r=Fr();Z(R(r),17,()=>W(l).choices||[],X,(e,r,i)=>{var o=go(),s=L(o);xi(s),s.value=s.__value=i;var c=B(s),l=B(c),u=e=>{var t=mo(),n=z(t,!0);V(()=>J(n,W(r).detail)),q(e,t)};Y(l,e=>{W(r).detail&&e(u)});var f=B(l,2),p=e=>{q(e,ho())};Y(f,e=>{W(r).persistent&&e(p)}),j(o),V(()=>{Q(s,`name`,`decision-`+t.session+`-`+a()),J(c,` ${W(r).label??``} `)}),Di(n,[],s,()=>W(d),e=>I(d,e)),q(e,o)}),q(e,r)},y=e=>{var t=po(),n=R(t),r=e=>{var t=Co(),n=R(t),r=B(L(n)),i=L(r),a=e=>{var t=_o();t.value=t.__value=`now`,q(e,t)};Y(i,e=>{W(b)||e(a)});var o=B(i);o.value=o.__value=`quota`;var s=B(o);s.value=s.__value=`delay`;var c=B(s);c.value=c.__value=`at`,j(r),mi(r),j(n);var l=B(n,2),u=e=>{var t=vo(),n=B(L(t));xi(n),j(t),Ti(n,()=>W(T),e=>I(T,e)),q(e,t)};Y(l,e=>{W(w)===`delay`&&e(u)});var d=B(l,2),f=e=>{var t=yo(),n=B(L(t));xi(n),j(t),Ti(n,()=>W(ee),e=>I(ee,e)),q(e,t)};Y(d,e=>{W(w)===`at`&&e(f)});var p=B(d,2),m=e=>{var t=xo(),n=R(t),r=z(n),i=B(n,2),a=e=>{q(e,bo())};Y(i,e=>{W(w)!==`quota`&&e(a)});var o=B(i,2);o.textContent=`Timezone: ${Intl.DateTimeFormat().resolvedOptions().timeZone??``}. + One pending request per session; saving replaces it. Memory + only; Codexometer must stay running. Uses session model, + reasoning and speed.`,V(e=>J(r,`Will send: ${e??``}`),[()=>W(w)===`quota`?`when quota is available and this session is idle`:Number.isFinite(W(O))?_e(W(O)):`choose a date and time`]),q(e,t)};Y(p,e=>{W(w)!==`now`&&e(m)});var h=B(p,2),g=e=>{q(e,So())};Y(h,e=>{W(b)&&e(g)}),hi(r,()=>W(w),e=>I(w,e)),q(e,t)};Y(n,e=>{W(l).questions?.length||e(r)}),Z(B(n,2),17,()=>W(pe),X,(e,t,n)=>{var r=Ao(),i=R(r),a=L(i),o=B(a),s=e=>{var t=wo();xi(t),Ti(t,()=>W(u)[n],e=>W(u)[n]=e),q(e,t)},c=e=>{var r=Eo(),i=L(r);i.value=i.__value=``,Z(B(i),17,()=>W(t).options||[],X,(e,t)=>{var n=To(),r=z(n,!0),i={};V(()=>{J(r,W(t)),i!==(i=W(t))&&(n.value=(n.__value=i)??``)}),q(e,n)}),j(r),mi(r),hi(r,()=>W(u)[n],e=>W(u)[n]=e),q(e,r)},l=e=>{var r=Do(),i=R(r);rt(i),Pi(i,e=>I(re,e),()=>W(re));var a=B(i,2),o=e=>{var n=uo(),r=z(n);V(e=>J(r,`Suggested answers: ${e??``}`),[()=>W(t).options.join(` · `)]),q(e,n)};Y(a,e=>{W(t).options?.length&&e(o)}),Ti(i,()=>W(u)[n],e=>W(u)[n]=e),q(e,r)};Y(o,e=>{W(t).secret?e(s):W(t).freeText?e(l,-1):e(c,1)}),j(i);var d=B(i,2),f=e=>{var n=ko(),r=B(L(n),4);Z(r,21,()=>W(t).options||[],X,(e,t)=>{var n=Oo(),r=z(n,!0);V(()=>J(r,W(t))),q(e,n)}),j(r),j(n),q(e,n)};Y(d,e=>{W(t).secret&&!W(t).freeText&&e(f)}),V(()=>J(a,`${W(t).text??``} `)),q(e,r)}),q(e,t)};Y(_,e=>{W(l).kind===`approval`||W(l).kind===`profile`?e(v):e(y,-1)}),j(s);var x=B(s,2),S=e=>{var t=Mo(),n=R(t),r=e=>{var t=jo(),n=z(t);V(()=>J(n,`TRIGGER // ${W(E)??``}`)),q(e,t)};Y(n,e=>{W(te)&&e(r)});var i=B(n,2),a=z(i),o=B(i,2),s=z(o),c=B(o,2);V(e=>{J(a,`Check the target and ${W(l).kind===`profile`?`profile above`:W(l).kind===`approval`?W(l).fileChanges?.length?`proposed file changes above`:`exact command and permission scope`:`message above`}. ${W(te)?`This schedules a follow-up that will send automatically when eligible`:`This will send to Codex`}; it may start work using your quota. + Confirmation expires in ${e??``}s.`),o.disabled=W(h)||W(ce),J(s,`CONFIRM ${(W(l).kind===`approval`||W(l).kind===`profile`?W(l).choices?.[W(d)]?.label:W(te)?W(b)?`SAVE CHANGES`:`SCHEDULE`:`SEND`)??``}`)},[()=>Math.max(0,Math.ceil((W(p)-W(m))/1e3))]),G(`click`,o,k),G(`click`,c,()=>{I(f,``)}),q(e,t)},C=e=>{var t=No(),n=R(t),r=e=>{var t=eo(),n=z(t,!0);V(()=>J(n,W(ge))),q(e,t)};Y(n,e=>{W(ge)&&e(r)});var i=B(n,2),a=z(i,!0);V(()=>{i.disabled=W(h)||W(ce)||!W(me)||!!W(ge),J(a,W(h)?`SENDING…`:W(b)?`REVIEW CHANGES`:`REVIEW BEFORE SENDING`)}),G(`click`,i,()=>be()),q(e,t)};Y(x,e=>{W(fe)?e(S):e(C,-1)});var D=B(x,2),ne=e=>{var t=Po();G(`click`,t,()=>{I(b,!1),I(f,``),I(u,[],!0)}),q(e,t)};Y(D,e=>{W(b)&&e(ne)}),V(()=>{J(o,`TARGET // ${W(l).thread??``} // ${(W(l).directory||`Directory unavailable`)??``}`),s.disabled=W(h)||W(fe)||W(ce),J(g,W(l).kind===`approval`||W(l).kind===`profile`?`Choose a decision`:W(b)?`EDIT SCHEDULED FOLLOW-UP`:`Reply to this session`)}),q(e,r)};Y(le,e=>{W(ce)||W(v)?e(he):W(l)?W(l).id?W(y)!==W(l).id&&e(xe,3):e(ye,2):e(ve,1)}),j(r),V(()=>J(s,a()===`profile`?`QUOTA THRESHOLD`:`SESSION CONTROL // EXPERIMENTAL`)),q(e,r)};Y(Te,e=>{!W(le)&&(!W(ne)||W(b)||a()||W(l)?.kind!==`prompt`||W(l).questions?.length)&&e(Ee)}),q(e,xe),Ke()}wr([`click`]);var Ro=K(`
      `);function zo(e,t){Ge(t,!0);let n=Hi(t,`active`,3,!1),r=N(()=>t.session.text||t.session.contextKind===`LAST ACTIVITY`&&t.session.workingCommand||``),i=N(()=>[`LAST REPLY`,`LAST ACTIVITY`].includes(t.session.contextKind)&&!!W(r).trim()),a=F(!1),o=F(``),s=F(!1);bn(()=>{if(!W(s))return;let e=setTimeout(()=>{I(s,!1)},150);return()=>clearTimeout(e)}),bn(()=>{W(r),t.session.status,I(o,``)});async function c(){if(!W(i)||W(a))return;let e=W(r);I(a,!0),I(s,!0),I(o,``);try{await navigator.clipboard.writeText(e),W(r)===e&&I(o,`Copied.`)}catch{W(r)===e&&I(o,`Clipboard unavailable. Select the visible text and copy it manually.`)}finally{I(a,!1)}}function l(e){!n()||!W(i)||e.defaultPrevented||e.repeat||e.ctrlKey||e.metaKey||e.altKey||e.key.toLowerCase()!==`c`||e.target instanceof Element&&e.target.closest(`input, textarea, select, [contenteditable]`)||(e.preventDefault(),c())}var u=Fr();Cr(`keydown`,en,l);var d=R(u),f=e=>{var t=Ro(),n=L(t),r=z(n,!0),i=B(n,2);let l;j(t),V(()=>{J(r,W(o)),i.disabled=W(a),l=ci(i,1,`svelte-543j00`,null,l,{flashed:W(s)})}),G(`click`,i,c),q(e,t)};Y(d,e=>{W(i)&&e(f)}),q(e,u),Ke()}wr([`click`]);var Bo=K(`

       
      `,1),Vo=K(`

      LATEST GUIDANCE

       
      `,1),Ho=K(`

      CONTEXT

       

      `,1),Uo=K(`

      `),Wo=K(`

      `),Go=K(`
       
      `),Ko=K(`

       
      `,1),qo=K(`
       
      `),Jo=K(`

      Command unavailable from this observation. Open Codex to inspect the + request.

      `),Yo=K(`

      `,1),Xo=K(`

      `),Zo=K(` `,1),Qo=K(`
      `),$o=K(`

      Session connection or refresh unavailable. Context and telemetry may be + stale.

      `),es=K(`

      Some quota profile checks are unavailable. Only sessions with freshly + verified quota and settings can be updated; previous outcome notices remain + visible.

      `),ts=K(` `),ns=K(` `),rs=K(` `),is=K(``),as=K(`

      Read only — reply or approve in Codex.

      `),os=K(`

      `),ss=K(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),cs=K(`
      `),ls=K(`
      `),us=K(`

      This session is no longer in the current observation. Return to sessions.

      `),ds=K(`

      `),fs=K(``),ps=K(`

      `),ms=K(` `),hs=K(`

      `),gs=K(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),_s=K(` `,1),vs=K(`

      `),ys=K(`

      TOKEN ACTIVITY // 30 SECOND SAMPLES

      `),bs=K(`

      TOKENS

      FULL DETAIL →
      `),xs=K(`

      No locally observed sessions yet. Keep Codex running alongside + Codexometer.

      `),Ss=K(`

      ↑ ↓ SELECT SESSION // ← LESS DETAIL // → MORE DETAIL // ESC BACK

      `,1),Cs=K(`

      SESSION TOTALS

      `,1);function ws(e,t){Ge(t,!0);let n=(e,t=f,n,r)=>{let i=ht(()=>g(n?.(),!0)),a=ht(()=>g(r?.(),!1));var o=Zo(),s=R(o),c=e=>{var n=Bo(),r=R(n),i=z(r,!0),a=z(B(r,2),!0);V(()=>{J(i,t().contextKind===`LAST REPLY`&&!t().streaming?`TASK`:`CURRENT TASK`),J(a,t().currentTask)}),q(e,n)};Y(s,e=>{t().currentTask&&e(c)});var l=B(s,2),u=e=>{var n=Vo(),r=z(B(R(n),2),!0);V(()=>J(r,t().latestGuidance)),q(e,n)};Y(l,e=>{t().latestGuidance&&e(u)});var d=B(l,2),p=e=>{var n=Ho(),r=z(B(R(n),2),!0);we(2),V(()=>J(r,t().approvalContext)),q(e,n)};Y(d,e=>{W(a)&&t().contextKind===`APPROVAL REQUEST`&&t().approvalContext&&e(p)});var m=B(d,2),_=e=>{var n=Uo();let r;var i=z(n,!0);V(e=>{r=ci(n,1,`attention-note`,null,r,{inferred:t().status===`CHECK SESSION`}),J(i,e)},[()=>C(t())]),q(e,n)},v=N(()=>C(t())&&(!W(a)||W(h)||t().status===`CHECK SESSION`));Y(m,e=>{W(v)&&e(_)});var y=B(m,2),b=e=>{var n=Wo(),r=z(n,!0);V(e=>J(r,e),[()=>w(t())]),q(e,n)};Y(y,e=>{W(i)&&e(b)});var x=B(y,2),S=e=>{var n=Go(),r=z(n,!0);V(()=>J(r,t().text||`No session context available.`)),q(e,n)};Y(x,e=>{(t().text||!t().workingCommand)&&e(S)});var T=B(x,2),ee=e=>{var n=Ko(),r=B(R(n),2),i=L(r),a=B(i),o=e=>{var n=Pr();V(()=>J(n,`// +${(t().runningCommands||0)-+(t().commandStatus===`running`)} RUNNING`)),q(e,n)};Y(a,e=>{!W(h)&&(t().runningCommands||0)>+(t().commandStatus===`running`)&&e(o)});var s=B(a,2),c=e=>{q(e,Pr(`+`))};Y(s,e=>{t().runningLimited&&e(c)}),j(r);var l=z(B(r,2),!0);V(e=>{J(i,`COMMAND // ${e??``} `),J(l,t().workingCommand)},[()=>W(h)?`UNKNOWN`:(t().commandStatus||`unknown`).toUpperCase()]),q(e,n)};Y(T,e=>{t().workingCommand&&e(ee)});var te=B(T,2),E=e=>{$a(e,{get lines(){return t().fileChanges}})},D=e=>{var n=Yo(),r=B(R(n),2),i=z(r,!0),a=B(r,2),o=e=>{var n=qo(),r=z(n,!0);V(()=>J(r,t().command)),q(e,n)},s=e=>{q(e,Jo())};Y(a,e=>{t().command?e(o):e(s,-1)}),V(()=>J(i,W(h)||t().status!==`APPROVAL NEEDED`?`LAST OBSERVED COMMAND`:$.data?.control?`COMMAND REQUEST`:`COMMAND TO APPROVE IN CODEX`)),q(e,n)};Y(te,e=>{(!W(a)||!$.data?.control)&&t().fileChanges?.length?e(E):(!W(a)||!$.data?.control)&&(t().command||t().status===`APPROVAL NEEDED`)&&e(D,1)});var ne=B(te,2),re=e=>{var n=Xo(),r=z(n);V(()=>J(r,`CONTEXT SOURCE // ${(t().source||`LOCAL`)??``} // OBSERVATION`)),q(e,n)};Y(ne,e=>{W(a)||e(re)}),q(e,o)},r=Hi(t,`params`,19,()=>({})),i=N(()=>$.data?.sessions||[]),a=N(()=>$.data?.control&&$.data.profiles||[]),o=N(()=>($.data?.triggers||[]).filter(e=>W(i).some(t=>t.id===e.session)));function s(e,t){if(r().id&&r().id!==t&&W(l)){e.preventDefault();return}b(t)}function c(e){return[`TURN COMPLETE`,`IDLE`,`ACTIVE`].includes(e.status)&&W(o).some(t=>t.session===e.id)?`TRIGGER SET`:e.status}let l=F(!1);function u(e,t){if(r().id&&r().id!==t&&W(l)){e.preventDefault();return}b(t)}bn(()=>{let e=r().id;e&&mr(()=>{ea.selected=e,aa(e,2)})});let d=N(()=>W(i).find(e=>e.id===r().id)),p=N(()=>new URLSearchParams(Ki.querystring).get(`review`)===`profile`&&W(a).some(e=>e.session===r().id&&e.pending)),m=N(()=>W(i).some(e=>e.id===ea.selected)?ea.selected:W(i)[0]?.id),h=N(()=>!$.connected||!!$.data?.sessionsError),v=N(()=>[[`OBSERVED TOKENS`,oa(W(i).reduce((e,t)=>e+t.tokens,0))],[`LISTED SESSIONS`,oa(W(i).length)],...[[`WORKING`,`WORKING`],[`AWAITING APPROVAL`,`APPROVAL NEEDED`],[`AWAITING INPUT`,`INPUT NEEDED`],[`CHECK · INFERRED`,`CHECK SESSION`]].map(([e,t])=>[e,W(h)?`—`:oa(W(i).filter(e=>e.status===t).length)])]),y=N(()=>W(i).filter(e=>[`INPUT NEEDED`,`APPROVAL NEEDED`,`CHECK SESSION`].includes(e.status)));function b(e){ea.selected=e,dr().then(()=>document.querySelector(`.session-row.selected`)?.scrollIntoView({block:`nearest`}))}function x(e,t){if(b(e),r().id){t<0&&(aa(e,2),location.hash=`/sessions`);return}let n=ra(e)+t;n>2?location.hash=`/sessions/`+encodeURIComponent(e):aa(e,n)}function S(e){let t=e.target;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||t.closest(`input, textarea, select, [contenteditable="true"]`))){if(e.key===`Escape`&&r().id)e.preventDefault(),x(r().id,-1);else if([`ArrowLeft`,`ArrowRight`].includes(e.key)&&(r().id||W(m)))e.preventDefault(),x(r().id||W(m),e.key===`ArrowLeft`?-1:1);else if(!r().id&&[`ArrowUp`,`ArrowDown`].includes(e.key)&&W(i).length){e.preventDefault();let t=W(i).findIndex(e=>e.id===W(m));b(W(i)[Math.max(0,Math.min(W(i).length-1,t+(e.key===`ArrowUp`?-1:1)))].id)}}}function C(e){return W(h)?`Last observation only — refresh unavailable. Check Codex for current state.`:e.status===`CHECK SESSION`?`INFERRED INACTIVITY — a quiet session, not a confirmed input or approval request. Local tools may still be running.`:$.data?.control&&[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(e.status)?`Open full detail for supported live controls; otherwise reply in Codex.`:e.status===`APPROVAL NEEDED`?`OBSERVED APPROVAL SIGNAL — approve or decline in Codex.`:e.status===`INPUT NEEDED`?`OBSERVED INPUT SIGNAL — reply in Codex.`:e.status===`TURN COMPLETE`?`OBSERVED TURN COMPLETION — informational, not an approval request.`:``}function w(e){return e.streaming&&e.contextKind===`LAST REPLY`?`REPLY // STREAMING`:e.contextKind||`LAST ACTIVITY`}var T=Cs();Cr(`keydown`,en,S);var ee=R(T),te=z(B(L(ee),2));j(ee);var E=B(ee,2);let D;Z(E,21,()=>W(v),X,(e,t)=>{var n=N(()=>_(W(t),2));let r=()=>W(n)[0],i=()=>W(n)[1];var a=Qo(),o=L(a),s=z(o,!0),c=z(B(o,2),!0);j(a),V(()=>{J(s,r()),J(c,i())}),q(e,a)}),j(E);var ne=B(E,2),re=z(ne),ie=B(ne,2),ae=e=>{q(e,$o())};Y(ie,e=>{W(h)&&e(ae)});var oe=B(ie,2),se=e=>{q(e,es())};Y(oe,e=>{$.data?.profileError&&e(se)});var ce=B(oe,2),le=e=>{var t=is(),n=L(t);Z(n,17,()=>W(y),X,(e,t)=>{var n=ts();let r;var i=z(n);V((e,a)=>{r=ci(n,1,`button`,null,r,{approval:W(t).status===`APPROVAL NEEDED`}),Q(n,`href`,e),J(i,`${W(t).status??``} + ${a??``} // ${(W(t).name||W(t).directory||W(t).id)??``}`)},[()=>`#/sessions/`+encodeURIComponent(W(t).id),()=>Array.from(W(t).id).slice(-5).join(``).toUpperCase()]),G(`click`,n,()=>b(W(t).id)),q(e,n)});var c=B(n,2);Z(c,17,()=>W(a).filter(e=>e.pending&&W(i).some(t=>t.id===e.session)),X,(e,t)=>{var n=ns(),a=z(n);V((e,i,o)=>{Q(n,`title`,r().id&&r().id!==W(t).session&&W(l)?`Finish sending or clear your current draft before switching sessions.`:`Review this session’s quota threshold`),Q(n,`href`,e),J(a,`QUOTA THRESHOLD ${i??``} // ${o??``}`)},[()=>`#/sessions/`+encodeURIComponent(W(t).session)+`?review=profile`,()=>Array.from(W(t).session).slice(-5).join(``).toUpperCase(),()=>W(i).find(e=>e.id===W(t).session)?.name||W(i).find(e=>e.id===W(t).session)?.directory||W(t).session]),G(`click`,n,e=>u(e,W(t).session)),q(e,n)}),Z(B(c,2),17,()=>W(o),X,(e,t)=>{var n=rs(),r=z(n);V((e,t,i)=>{Q(n,`href`,e),J(r,`TRIGGER SET ${t??``} // ${i??``}`)},[()=>`#/sessions/`+encodeURIComponent(W(t).session),()=>Array.from(W(t).session).slice(-5).join(``).toUpperCase(),()=>W(i).find(e=>e.id===W(t).session)?.name||W(i).find(e=>e.id===W(t).session)?.directory]),G(`click`,n,e=>s(e,W(t).session)),q(e,n)}),j(t),q(e,t)},ue=N(()=>(W(y).length||W(a).some(e=>e.pending)||W(o).length)&&!W(h));Y(ce,e=>{W(ue)&&e(le)});var de=B(ce,2),fe=e=>{var t=Fr(),i=R(t),o=e=>{var t=ls(),i=L(t),o=L(i),s=L(o);let u;var f=B(s);j(o);var m=B(o,2);j(i);var g=B(i,2),_=e=>{var t=Xo(),n=z(t,!0);V(()=>J(n,W(d).directory)),q(e,t)};Y(g,e=>{W(d).name&&W(d).directory&&e(_)});var v=B(g,2),y=z(v),x=B(v,2);let S;var C=L(x),w=L(C);n(w,()=>W(d),()=>!0,()=>!0),j(C);var T=B(C,2),ee=e=>{var t=Fr();qr(R(t),()=>W(d).id,e=>{{let t=N(()=>new URLSearchParams(Ki.querystring).get(`schedule`)===`edit`),n=N(()=>W(d).fileChanges||[]);Lo(e,{get session(){return W(d).id},get openScheduler(){return W(t)},get observedCommand(){return W(d).command},get observedFileChanges(){return W(n)},get suspended(){return W(p)},onProtectedChange:e=>{I(l,e,!0)}})}}),q(e,t)},te=e=>{q(e,as())};Y(T,e=>{$.data?.control?e(ee):e(te,-1)}),j(x);var E=B(x,2);Z(E,17,()=>W(a).filter(e=>e.session===W(d).id),e=>e.session,(e,t)=>{var n=cs(),r=L(n),i=e=>{var n=os(),r=z(n,!0);V(()=>J(r,W(t).notice)),q(e,n)};Y(r,e=>{W(t).notice&&e(i)});var a=B(r,2),o=e=>{Lo(e,{get session(){return W(d).id},review:`profile`})},s=e=>{var t=ss();V(e=>Q(t,`href`,e),[()=>`#/sessions/`+encodeURIComponent(W(d).id)+`?review=profile`]),q(e,t)};Y(a,e=>{W(t).pending&&W(p)?e(o):W(t).pending&&e(s,1)}),j(n),V(()=>Q(n,`id`,`quota-profile-`+W(d).id)),q(e,n)});var D=B(E,2),ne=e=>{var t=Fr();qr(R(t),()=>W(d).id,e=>{zo(e,{get session(){return W(d)},active:!0})}),q(e,t)};Y(D,e=>{W(p)||e(ne)}),j(t),V((e,t)=>{u=ci(s,1,`lamp lit`,null,u,{working:W(d).status===`WORKING`&&!W(h)}),J(f,`${e??``} // ${(W(d).name||W(d).directory)??``}`),J(y,`${t??``} TOKENS // ${W(d).id??``} // CONTEXT SOURCE // ${(W(d).source||`LOCAL`)??``}`),S=ui(x,``,S,{display:W(p)?`none`:void 0})},[()=>W(h)?`STALE`:W(p)?`QUOTA THRESHOLD`:c(W(d)),()=>oa(W(d).tokens)]),G(`click`,m,()=>{b(r().id),aa(r().id,2)}),q(e,t)},s=e=>{q(e,us())};Y(i,e=>{W(d)?e(o):e(s,-1)}),q(e,t)},pe=e=>{var t=Ss(),r=R(t),o=B(L(r),2),s=L(o),l=B(s,2);j(o),j(r);var d=B(r,2);Z(d,17,()=>W(i),e=>e.id,(e,t)=>{let r=N(()=>ra(W(t).id));var i=bs();let o;var s=L(i),l=L(s),d=e=>{var n=ds(),r=L(n),i=z(r);j(n),V(e=>{Q(r,`aria-pressed`,W(m)===W(t).id),J(i,`${e??``} // ${W(t).name??``}`)},[()=>Array.from(W(t).id).slice(-5).join(``).toUpperCase()]),G(`click`,r,()=>b(W(t).id)),q(e,n)};Y(l,e=>{W(t).name&&e(d)});var f=B(l,2),p=L(f),g=L(p);let _;var v=B(g,1,!0);j(p),j(f);var y=B(f,2),S=e=>{var n=fs(),r=z(n,!0);V(()=>{Q(n,`aria-pressed`,W(m)===W(t).id),J(r,W(t).directory||W(t).id)}),G(`click`,n,()=>b(W(t).id)),q(e,n)};Y(y,e=>{W(t).name||e(S)});var C=B(y,2),T=L(C);we(),j(C);var ee=B(C,2),te=e=>{var n=Xo(),r=z(n,!0);V(()=>J(r,W(t).directory)),q(e,n)};Y(ee,e=>{W(t).name&&W(t).directory&&e(te)});var E=B(ee,2),D=z(E),ne=B(E,2),re=z(ne),ie=B(ne,2),ae=L(ie),oe=B(ae,2),se=z(oe,!0),ce=B(oe,2);j(ie);var le=B(ie,2),ue=B(le,2),de=e=>{var n=ps(),r=z(n,!0);V(()=>J(r,W(t).status===`CHECK SESSION`?`INFERRED INACTIVITY`:$.data?.control?`OPEN FULL DETAIL OR REPLY IN CODEX`:W(t).status===`APPROVAL NEEDED`?`APPROVE OR DECLINE IN CODEX`:`REPLY IN CODEX`)),q(e,n)},fe=N(()=>!W(h)&&[`APPROVAL NEEDED`,`INPUT NEEDED`,`CHECK SESSION`].includes(W(t).status));Y(ue,e=>{W(fe)&&e(de)}),j(s);var pe=B(s,2),me=e=>{var r=vs(),i=L(r),o=L(i),s=z(o,!0),c=B(o,2),l=e=>{var n=ms(),r=z(n,!0);V(e=>{Q(n,`href`,e),J(r,$.data?.control?`REVIEW IN FULL DETAIL ↗`:`APPROVAL IN CODEX ↗`)},[()=>`#/sessions/`+encodeURIComponent(W(t).id)]),q(e,n)};Y(c,e=>{!W(h)&&W(t).status===`APPROVAL NEEDED`&&e(l)}),j(i);var d=B(i,2);n(d,()=>W(t),()=>!1);var f=B(d,2);Z(f,17,()=>W(a).filter(e=>e.session===W(t).id),X,(e,n)=>{var r=_s(),i=R(r),a=e=>{var t=hs(),r=z(t,!0);V(()=>J(r,W(n).notice)),q(e,t)};Y(i,e=>{W(n).notice&&e(a)});var o=B(i,2),s=e=>{var n=gs();V(e=>Q(n,`href`,e),[()=>`#/sessions/`+encodeURIComponent(W(t).id)+`?review=profile`]),G(`click`,n,e=>u(e,W(t).id)),q(e,n)};Y(o,e=>{W(n).pending&&e(s)}),q(e,r)});var p=B(f,2);{let e=N(()=>W(m)===W(t).id);zo(p,{get session(){return W(t)},get active(){return W(e)}})}j(r),V(e=>J(s,e),[()=>w(W(t))]),q(e,r)};Y(pe,e=>{W(r)>0&&e(me)});var he=B(pe,2),O=e=>{var n=ys(),r=B(L(n),2);{let e=N(()=>(W(t).samples||[]).map(e=>e.tokens));Ya(r,{get values(){return W(e)},capacity:120})}var i=z(B(r,2));j(n),V(()=>J(i,`LAST ${(W(t).samples?.length||0)??``} SAMPLES // AUTO SCALE`)),q(e,n)};Y(he,e=>{W(r)<2&&e(O)}),j(i),V((e,n,a,s,c)=>{o=ci(i,1,`session-row`,null,o,{selected:W(m)===W(t).id,wide:W(r)===2,split:W(r)===1}),Q(i,`aria-label`,`Session `+(W(t).name||W(t).directory||W(t).id)),Q(p,`href`,e),_=ci(g,1,`lamp lit`,null,_,{working:W(t).status===`WORKING`&&!W(h)}),J(v,n),J(T,`${a??``} `),J(D,`${W(t).agents??``} LINKED AGENTS`),J(re,`ACTIVE // ${s??``}`),ae.disabled=W(r)===0,Q(oe,`aria-expanded`,W(r)>0),J(se,W(r)?`HIDE DETAIL`:`SHOW DETAIL`),Q(le,`href`,c)},[()=>`#/sessions/`+encodeURIComponent(W(t).id),()=>W(h)?`STALE`:c(W(t)),()=>oa(W(t).tokens),()=>sa(W(t).activity),()=>`#/sessions/`+encodeURIComponent(W(t).id)]),G(`click`,p,()=>b(W(t).id)),G(`click`,ae,()=>x(W(t).id,-1)),G(`click`,oe,()=>{b(W(t).id),aa(W(t).id,+!W(r))}),G(`click`,ce,()=>x(W(t).id,1)),G(`click`,le,()=>b(W(t).id)),q(e,i)});var f=B(d,2),p=e=>{q(e,xs())};Y(f,e=>{W(i).length||e(p)}),G(`click`,s,()=>ia(1)),G(`click`,l,()=>ia(0)),q(e,t)};Y(de,e=>{r().id?e(fe):e(pe,-1)}),V(e=>{J(te,`OBSERVED ${e??``}`),D=ci(E,1,`session-totals`,null,D,{stale:W(h)}),J(re,`${W(h)?`LAST KNOWN TOTALS — live state counts unavailable. `:``}Tokens + observed since this server started for currently listed sessions; linked + agents are already included. Totals can decrease when a session leaves the + list. History samples every 30 seconds. Not account-wide totals.`)},[()=>sa($.data?.sessionsAt)]),q(e,T),Ke()}wr([`click`]);var Ts=K(`

      `),Es=K(`

      Relative usage/credits are not tokens or quota percentages. Groupings + describe the same usage, not additional consumption.

      `,1),Ds=K(`// APPROXIMATE`),Os=K(`

      Partial accounting: totals may still change.

      `),ks=K(`

      Percentage of this period's historical allowance, not today's limit. May + exceed 100%. This is not a manual/automatic reset log.

      `,1),As=K(`

      `,1),js=K(`

      This optional account report is unavailable. Token history remains + available; missing data does not mean zero usage.

      `),Ms=K(`
      `),Ns=K(`
      `),Ps=K(`

      No usage reported for this day.

      `),Fs=K(`

      Selected breakdown unavailable; missing does not mean zero.

      `),Is=K(`

      `,1);function Ls(e,t){Ge(t,!0);let n=F(`surface`),r=F(0),i=N(()=>t.reports?.daily),a=N(()=>t.reports?.plan),o=N(()=>t.mode===`breakdown`?W(i)?.days.length||0:W(a)?.periods.length||0),s=N(()=>Math.min(W(r),Math.max(0,W(o)-1))),c=N(()=>W(i)?.days[(W(i)?.days.length||0)-1-W(s)]),l=N(()=>W(a)?.periods[W(s)]),u=N(()=>t.mode===`breakdown`?W(i)?.units||``:`%`),d=N(()=>{let e=Object.create(null);if(t.mode===`breakdown`)e=W(c)?.groups[W(n)]||{};else{let t=W(n)===`feature`?`thread_source`:W(n)===`task start`?`turn_trigger`:W(n);for(let n of W(l)?.breakdowns||[])if(n.dimension===t)for(let t of n.rows)e[t.key]=(e[t.key]||0)+t.basis_points/100}return Object.entries(e).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))}),f=N(()=>t.mode===`breakdown`?W(c)?.total:W(l)?.used_basis_points==null?null:W(l).used_basis_points/100),p=N(()=>Math.max(1,W(f)||0,...W(d).map(([,e])=>e))),m=e=>e==null?`UNKNOWN`:e.toLocaleString(`en-GB`,{maximumFractionDigits:2});var h=Is(),g=R(h),v=L(g),y=B(L(v)),b=L(y);b.value=b.__value=`surface`;var x=B(b);x.value=x.__value=`model`;var S=B(x);S.value=S.__value=`feature`;var C=B(S);C.value=C.__value=`task start`,j(y),mi(y),j(v);var w=B(v,2),T=B(w,2),ee=z(B(T,2),!0);j(g);var te=B(g,2),E=L(te),D=z(E,!0),ne=B(E,2),re=z(ne),ie=B(ne,2),ae=e=>{var t=Es(),n=R(t),r=z(n),a=B(n,2),o=e=>{var t=Ts(),n=z(t);V(()=>J(n,`Data as of ${W(i).dataAsOf??``}`)),q(e,t)};Y(a,e=>{W(i).dataAsOf&&e(o)});var s=z(B(a,2));we(2),V((e,t)=>{J(r,`Latest fetch ${e??``} // queried ${W(i).from??``} → ${W(i).through??``}. + Reports are fetched from OpenAI and are not saved between runs.`),J(s,`${(W(c)?.date||`No daily buckets reported`)??``} // ${t??``} + ${W(u)??``}`)},[()=>sa(W(i).fetchedAt),()=>m(W(f))]),q(e,t)},oe=e=>{var t=As(),n=R(t),r=L(n);let i;var o=z(r,!0),s=B(r),c=e=>{q(e,Ds())};Y(s,e=>{W(a).approximate&&e(c)});var u=B(s);j(n);var d=B(n,2),p=L(d),h=B(p),g=e=>{var t=Pr();V(()=>J(t,`// Boundary tolerance ${W(a).boundary_tolerance_seconds??``}s`)),q(e,t)};Y(h,e=>{W(a).boundary_tolerance_seconds!=null&&e(g)}),j(d);var _=B(d,2),v=e=>{var t=ks(),n=R(t),r=L(n),i=B(r);let a;var o=z(i);j(n);var s=B(n,2),c=z(s),u=B(s,2),d=e=>{q(e,Os())};Y(u,e=>{W(l).accounting_complete||e(d)}),we(2),V(e=>{J(r,`${W(l).window_minutes??``} MIN // ${W(l).plan_type??``} // `),a=ci(i,1,`svelte-1fbui7h`,null,a,{muted:W(f)==null,"quota-near":W(f)!=null&&W(f)>=80&&W(f)<100,"quota-full":W(f)!=null&&W(f)>=100}),J(o,`USED ${e??``}${W(f)==null?``:`%`}`),J(c,`${W(l).starts_at??``} → ${W(l).ends_at??``}`)},[()=>m(W(f))]),q(e,t)};Y(_,e=>{W(l)&&e(v)}),V(e=>{i=ci(r,1,`svelte-1fbui7h`,null,i,{"quality-warning":!W(a).coverage_complete}),J(o,W(a).coverage_complete?`Reported range complete`:`Partial coverage`),J(u,` // Latest fetch ${e??``}`),J(p,`Coverage starts ${(W(a).coverage_start||`unknown`)??``} // Data as of ${(W(a).data_as_of||`unknown`)??``}`)},[()=>sa(W(a).fetchedAt)]),q(e,t)},se=e=>{q(e,js())};Y(ie,e=>{t.mode===`breakdown`&&W(i)?e(ae):t.mode===`periods`&&W(a)?e(oe,1):e(se,-1)});var ce=B(ie,2),le=e=>{var n=Ns(),r=L(n),i=z(B(L(r),2),!0);j(r),Z(B(r,2),17,()=>W(d),X,(e,n,r)=>{var i=N(()=>_(W(n),2));let a=()=>W(i)[0],o=()=>W(i)[1];var s=Ms();let c;var l=L(s),u=z(l,!0),d=B(l,2),f=L(d);let h;j(d);var g=z(B(d,2));j(s),V((e,n,i)=>{c=ci(s,1,`report-row svelte-1fbui7h`,null,c,{unknown:e,alternate:r%2==1}),Q(l,`title`,a()),J(u,a()),h=ui(f,``,h,{width:n}),J(g,`${i??``}${t.mode===`periods`?`%`:``}`)},[()=>a().trim().toLowerCase()===`unknown`,()=>`${Math.max(0,100*o()/W(p))}%`,()=>m(o())]),q(e,s)}),j(n),V(()=>J(i,t.mode===`breakdown`?W(u):`QUOTA USED`)),q(e,n)},ue=e=>{q(e,Ps())},de=e=>{q(e,Fs())};Y(ce,e=>{W(d).length?e(le):t.mode===`breakdown`&&W(c)?.total===0&&W(c)?.groups[W(n)]!=null?e(ue,1):(W(i)&&t.mode===`breakdown`||W(a)&&t.mode===`periods`)&&e(de,2)}),j(te),V(()=>{w.disabled=W(s)>=W(o)-1,T.disabled=W(s)===0,J(ee,W(o)?`${W(s)+1} / ${W(o)}`:`NO DATA`),J(D,t.mode===`breakdown`?`DAILY BREAKDOWN`:`QUOTA WINDOWS`),J(re,`${(t.mode===`breakdown`?t.reports?.dailyStatus||`UNAVAILABLE`:t.reports?.planStatus||`UNAVAILABLE`)??``} // UTC`)}),hi(y,()=>W(n),e=>I(n,e)),G(`click`,w,()=>I(r,W(s)+1)),G(`click`,T,()=>I(r,W(s)-1)),q(e,h),Ke()}wr([`click`]);var Rs=864e5;function zs(e,t){let n=new Date(e);n.setUTCDate(1),n.setUTCMonth(n.getUTCMonth()+t);let r=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return n.setUTCDate(Math.min(e.getUTCDate(),r)),n}function Bs(e,t,n){let r=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));for(let e=0;;e++){let i=zs(r,-t),a=new Date(i.getTime()+Rs);if(e===n)return{start:a,end:r};r=i}}var Vs=K(``),Hs=K(``,1),Us=K(`

      History refresh failed. Any displayed history is the last successful + observation.

      `),Ws=K(`

      Token history unavailable; other reports may still be available.

      `),Gs=K(``),Ks=K(`
      `),qs=K(`

      LESS ░ ▒ ▓ █ MORE // HOVER FOR DATE AND TOKENS

      `,1),Js=K(`
      `,1),Ys=K(` `),Xs=K(`

      LIFETIME TOKENS

      PEAK DAY

      CURRENT STREAK

      DAYS

      LONGEST TURN

      SECONDS

      LONGEST STREAK

      DAYS

      OPENAI // UTC

      Accessible data table
      Date (UTC)Tokens

      `,1),Zs=K(`

      History unavailable or awaiting a matching account observation. Missing + history is not treated as zero usage.

      `),Qs=K(`

      USAGE // ACCOUNT HISTORY

      Account-wide history reported by Codex, not the local Sessions counter. Dates + use UTC. Allowance history is approximate where indicated; reset causes are + not provided.

      `,1);function $s(e,t){Ge(t,!0);let n=F(`daily`),r=F(12),i=F(0),a=N(()=>{let e=$.data?.usage?.dailyUsageBuckets;if(!e)return[];let{start:t,end:n}=Bs(new Date,W(r),W(i)),a=new Map;for(let t of e)!Number.isFinite(t.tokens)||t.tokens<0||a.set(t.startDate,(a.get(t.startDate)||0)+t.tokens);let o=[];for(let e=t;e<=n;e=new Date(e.getTime()+864e5)){let t=e.toISOString().slice(0,10);o.push({date:t,tokens:a.get(t)||0})}return o}),o=N(()=>Math.max(1,...W(a).map(e=>e.tokens))),s=N(()=>W(a).length?new Date(W(a)[0].date+`T00:00:00Z`).getUTCDay():0),c=N(()=>{if(W(n)===`monthly`){let e=new Map;for(let t of W(a))e.set(t.date.slice(0,7),(e.get(t.date.slice(0,7))||0)+t.tokens);return[...e].map(([e,t])=>({date:e,tokens:t}))}let e=0;return W(a).map(t=>({date:t.date,tokens:e+=t.tokens}))});var l=Qs(),u=B(R(l),4);Z(u,20,()=>[[`daily`,`Daily`],[`monthly`,`Monthly`],[`cumulative`,`Cumulative`],[`breakdown`,`Breakdown`],[`periods`,`Windows`]],X,(e,t)=>{var r=N(()=>_(t,2));let a=()=>W(r)[0],o=()=>W(r)[1];var s=Vs();let c;var l=z(s,!0);V(()=>{Q(s,`aria-pressed`,W(n)===a()),c=ci(s,1,``,null,c,{active:W(n)===a()}),J(l,o())}),G(`click`,s,()=>{I(n,a(),!0),I(i,0)}),q(e,s)}),j(u);var d=B(u,2),f=L(d),p=e=>{var t=Hs(),n=R(t),a=B(L(n)),o=L(a);o.value=o.__value=6;var s=B(o);s.value=s.__value=12,j(a),mi(a),j(n);var c=B(n),l=B(c);V(()=>l.disabled=W(i)===0),G(`change`,a,()=>I(i,0)),hi(a,()=>W(r),e=>I(r,e)),G(`click`,c,()=>Jt(i)),G(`click`,l,()=>Jt(i,-1)),q(e,t)};Y(f,e=>{W(n)!==`breakdown`&&W(n)!==`periods`&&e(p)}),j(d);var m=B(d,2),h=e=>{q(e,Us())};Y(m,e=>{$.data?.usageError&&e(h)});var g=B(m,2),v=e=>{q(e,Ws())};Y(g,e=>{$.data?.usage?.tokenStatus===`UNAVAILABLE`&&W(n)!==`breakdown`&&W(n)!==`periods`&&e(v)});var y=B(g,2),b=e=>{var t=Fr();qr(R(t),()=>W(n),e=>{{let t=N(()=>$.data?.usage?.reports);Ls(e,{get reports(){return W(t)},get mode(){return W(n)}})}}),q(e,t)},x=e=>{var t=Xs(),r=R(t),i=L(r),l=z(B(L(i),2),!0);j(i);var u=B(i,2),d=z(B(L(u),2),!0);j(u);var f=B(u,2),p=B(L(f),2),m=L(p);we(),j(p),j(f);var h=B(f,2),g=B(L(h),2),_=L(g);we(),j(g),j(h);var v=B(h,2),y=B(L(v),2),b=L(y);we(),j(y),j(v),j(r);var x=B(r,4),S=L(x),C=z(S),w=B(S,2),T=e=>{var t=qs(),n=R(t),r=L(n),i=L(r);Z(i,17,()=>Array(W(s)),X,(e,t)=>{q(e,Gs())}),Z(B(i,2),17,()=>W(a),X,(e,t)=>{var n=Ks();let r,i;V(e=>{r=ci(n,1,`heat-cell`,null,r,{zero:W(t).tokens===0}),Q(n,`title`,e),i=ui(n,``,i,{opacity:W(t).tokens?.25+.75*W(t).tokens/W(o):1})},[()=>`${W(t).date}: ${oa(W(t).tokens)} tokens`]),q(e,n)}),j(r),j(n),we(2),q(e,t)},ee=e=>{var t=Js(),r=R(t);{let e=N(()=>W(c).map(e=>e.tokens)),t=N(()=>W(n)+` usage`);Ya(r,{get values(){return W(e)},get label(){return W(t)}})}var i=B(r,2),a=L(i),o=z(a,!0),s=z(B(a),!0);j(i),V(e=>{J(o,W(c)[0]?.date),J(s,e)},[()=>W(c).at(-1)?.date]),q(e,t)};Y(w,e=>{W(n)===`daily`?e(T):e(ee,-1)});var te=B(w,2),E=B(L(te),2),D=L(E),ne=B(L(D));Z(ne,21,()=>W(n)===`daily`?W(a):W(c),X,(e,t)=>{var n=Ys(),r=L(n),i=z(r,!0),a=z(B(r),!0);j(n),V(e=>{J(i,W(t).date),J(a,e)},[()=>oa(W(t).tokens)]),q(e,n)}),j(ne),j(D),j(E),j(te),j(x);var re=z(B(x,2));V((e,t,n,r,i,o,s)=>{J(l,e),J(d,t),J(m,`${n??``} `),J(_,`${r??``} `),J(b,`${i??``} `),J(C,`${W(a)[0]?.date??``} — ${o??``}`),J(re,`OBSERVED ${s??``} // CUMULATIVE IS FOR THE SELECTED PERIOD`)},[()=>oa($.data.usage.summary.lifetimeTokens),()=>oa($.data.usage.summary.peakDailyTokens),()=>oa($.data.usage.summary.currentStreakDays),()=>oa($.data.usage.summary.longestRunningTurnSec),()=>oa($.data.usage.summary.longestStreakDays),()=>W(a).at(-1)?.date,()=>sa($.data.usageAt)]),q(e,t)},S=e=>{q(e,Zs())};Y(y,e=>{W(n)===`breakdown`||W(n)===`periods`?e(b):$.data?.usage&&$.data.usage.dailyUsageBuckets!==null?e(x,1):e(S,-1)}),q(e,l),Ke()}wr([`click`,`change`]);var ec=K(`

      Page not found

      Return to Quota

      `,1);function tc(e){var t=ec();we(2),q(e,t)}var nc=K(` `),rc=K(`

      `),ic=K(`

      Connecting to your local Codexometer…

      `),ac=K(``),oc=K(`
      CODEXOMETER

      Your quota. Your sessions. Your command centre.

      `);function sc(e,t){Ge(t,!0);let n={"/":Ka,"/quota/:view?":Ka,"/sessions/:id?":ws,"/usage":$s,"*":tc},r={quota:/^(?:\/|\/quota(?:\/[^/]+)?\/?)$/,sessions:/^\/sessions(?:\/[^/]+)?\/?$/,usage:/^\/usage\/?$/},i=F(`hacker`),a=[`hacker`,`rust`,`blue-steel`,`ultraviolet`,`nightshade`];bn(()=>{ta()}),bn(()=>{if($.data)for(let[e,t]of Object.entries(r))t.test(Ki.location)&&(ea.tab=e)}),Ui(()=>{try{let e=localStorage.getItem(`codexometer.web.theme`);e&&a.includes(e)&&I(i,e,!0)}catch{}return fa()});function o(){try{localStorage.setItem(`codexometer.web.theme`,W(i))}catch{}}var s=oc(),c=L(s),l=B(L(c),2),u=L(l);let d;var f=B(u,1,!0),p=z(B(f));j(l),j(c);var m=B(c,2);Z(m,21,()=>Object.entries(r),X,(e,t)=>{var n=N(()=>_(W(t),2));let r=()=>W(n)[0],i=()=>W(n)[1],a=N(()=>i().test(Ki.location));var o=nc();let s;var c=z(o,!0);V(e=>{Q(o,`href`,r()===`quota`?`#/quota/`+ea.view:`#/`+r()),Q(o,`aria-current`,W(a)?`page`:void 0),s=ci(o,1,``,null,s,{active:W(a)}),J(c,e)},[()=>r().toUpperCase()]),q(e,o)}),j(m);var h=B(m,2),g=L(h),v=e=>{var t=rc(),n=z(t,!0);V(()=>J(n,$.error)),q(e,t)};Y(g,e=>{$.error&&e(v)});var y=B(g,2),b=e=>{Yi(e,{get routes(){return n}})},x=e=>{q(e,ic())};Y(y,e=>{$.data?e(b):$.error||e(x,1)}),j(h);var S=B(h,2),C=L(S),w=z(C),T=B(C,2),ee=z(T,!0),te=B(T,2),E=B(L(te));Z(E,21,()=>a,X,(e,t)=>{var n=ac(),r=z(n,!0),i={};V(e=>{J(r,e),i!==(i=W(t))&&(n.value=(n.__value=i)??``)},[()=>W(t).replace(`-`,` `).toUpperCase()]),q(e,n)}),j(E),mi(E),j(te),j(S),j(s),V(()=>{Q(s,`data-theme`,W(i)),d=ci(u,1,`lamp`,null,d,{lit:$.connected}),J(f,$.connected?`CONNECTED`:`OFFLINE`),J(p,`EXPERIMENTAL // ${$.data?.control?`SESSION CONTROL`:`READ ONLY`}`),J(w,`v${($.data?.version||`…`)??``} // LOCAL ONLY`),J(ee,$.data?.control?`Session control enabled. Stop the server to revoke access.`:`No actions can be sent from this preview.`)}),G(`change`,E,o),hi(E,()=>W(i),e=>I(i,e)),q(e,s),Ke()}wr([`change`]),Vr(sc,{target:document.getElementById(`app`)}); \ No newline at end of file diff --git a/internal/web/dist/assets/index-CIiWCxs0.css b/internal/web/dist/assets/index-CIiWCxs0.css new file mode 100644 index 0000000..b5dfc9b --- /dev/null +++ b/internal/web/dist/assets/index-CIiWCxs0.css @@ -0,0 +1 @@ +.observation-details.svelte-1wk8llw{font-size:12px}summary.svelte-1wk8llw{cursor:pointer;color:var(--accent)}.observation-table.svelte-1wk8llw{max-height:240px;overflow:auto}.zone-canvas.svelte-1wk8llw{flex:1;min-height:170px;margin-top:6px;position:relative}svg.svelte-1wk8llw{width:100%;height:100%;display:block;position:absolute;inset:0}text.svelte-1wk8llw{fill:var(--ink);font:14px Cascadia Code,Consolas,monospace}.axis-title.svelte-1wk8llw{letter-spacing:.04em;font-size:12px}.grid.svelte-1wk8llw{stroke:#fff;stroke-opacity:.14;stroke-width:1px}.axes.svelte-1wk8llw{stroke:var(--ink);stroke-width:1.5px;fill:none}.pace-line.svelte-1wk8llw{stroke:#fff;stroke-width:2px;stroke-dasharray:6 4}.position-halo.svelte-1wk8llw{fill:#101820;stroke:#fff;stroke-width:1.5px}.position-dot.svelte-1wk8llw{fill:#fff}.observation-trail.svelte-1wk8llw{fill:none;stroke:#fff;stroke-width:2.5px;stroke-linejoin:round}.trail-start.svelte-1wk8llw{fill:none;stroke:#fff;stroke-width:2px}.trail-caption.svelte-1wk8llw{text-align:center;font-size:11px}.zone-caption.svelte-1wk8llw{color:var(--accent);text-align:center}.file-diff.svelte-x4gtb6{border:1px solid var(--muted);max-height:60vh;padding:.5rem;font-family:monospace;overflow:auto}.diff-line.svelte-x4gtb6{white-space:pre;min-height:1.3em;display:flex}.line-number.svelte-x4gtb6{text-align:right;opacity:.75;-webkit-user-select:none;user-select:none;flex:0 0 5ch;padding-right:1ch;display:inline-block}.added.svelte-x4gtb6{color:#67d391;background:#67d39112}.removed.svelte-x4gtb6{color:#ff6b83;background:#ff6b8312}.heading.svelte-x4gtb6{padding:.5rem 0;font-weight:700}.saved-prompt.svelte-1oupzfc{white-space:pre-wrap;overflow-wrap:anywhere}fieldset.svelte-1oupzfc{border:1px solid;margin:.5rem 0;padding:.35rem .6rem}.decision.svelte-1oupzfc,.answer.svelte-1oupzfc{margin:.3rem 0;display:block}.decision.svelte-1oupzfc code:where(.svelte-1oupzfc),.decision.svelte-1oupzfc span:where(.svelte-1oupzfc){overflow-wrap:anywhere;margin:.3rem 0 .3rem 1.5rem;display:block}textarea.svelte-1oupzfc,.answer.svelte-1oupzfc input:where(.svelte-1oupzfc),.answer.svelte-1oupzfc select:where(.svelte-1oupzfc){box-sizing:border-box;background:var(--bg);width:100%;color:inherit;font:inherit;border:1px solid;margin-top:.4rem;padding:.5rem;display:block}textarea.svelte-1oupzfc{resize:vertical;background:color-mix(in srgb, currentColor 8%, var(--bg))}button.svelte-1oupzfc{margin:.3rem .5rem .3rem 0}h3.svelte-1oupzfc,p.svelte-1oupzfc{margin-block:.4rem}.sent.svelte-1oupzfc{color:var(--accent)}.session-copy.svelte-543j00{justify-content:flex-end;align-items:center;gap:8px;margin-top:auto;padding-top:6px;display:flex}span.svelte-543j00{color:var(--muted);overflow-wrap:anywhere;font-size:12px}button.svelte-543j00{color:var(--accent);flex-shrink:0;padding:3px 7px}button.svelte-543j00:hover,button.flashed.svelte-543j00{color:var(--bg);background:var(--accent)}h3.svelte-1fbui7h,.window-dates.svelte-1fbui7h,.report-value.svelte-1fbui7h{color:var(--accent);font-weight:700}.quality-warning.svelte-1fbui7h,.quota-near.svelte-1fbui7h{color:var(--approval)}.quota-full.svelte-1fbui7h{color:#ff6680}.alternate.svelte-1fbui7h .report-fill:where(.svelte-1fbui7h){background:radial-gradient(circle, var(--panel) .7px, transparent .9px) 0 0 / 3px 3px, var(--accent)}.unknown.svelte-1fbui7h,.unknown.svelte-1fbui7h .report-value:where(.svelte-1fbui7h){color:var(--muted)}.unknown.svelte-1fbui7h .report-fill:where(.svelte-1fbui7h){background:var(--muted);opacity:1}.report-bars.svelte-1fbui7h{grid-template-columns:minmax(5rem,1fr) minmax(2rem,3fr) auto;gap:.6rem;display:grid}.report-row.svelte-1fbui7h,.report-head.svelte-1fbui7h{grid-column:1/-1;grid-template-columns:subgrid;align-items:center;gap:.6rem;display:grid}.report-head.svelte-1fbui7h{color:var(--muted);font-size:.85rem}.report-head.svelte-1fbui7h>span:where(.svelte-1fbui7h):last-child,.report-value.svelte-1fbui7h{text-align:right}.report-row.svelte-1fbui7h>span:where(.svelte-1fbui7h):first-child{overflow-wrap:anywhere}.report-track.svelte-1fbui7h{background:var(--panel);height:1rem}.report-fill.svelte-1fbui7h{background:var(--accent);height:100%}:root{font-synthesis:none;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;background:#080e0c;font-family:Cascadia Code,SFMono-Regular,Consolas,monospace}*{box-sizing:border-box}body{margin:0}.shell{--accent:#80edac;--approval:#ffca58;--muted:#98aaa0;--edge:#31473a;--panel:#101c16;--bg:#080e0c;--ink:#e2eee5;background:var(--bg);height:100dvh;color:var(--ink);grid-template-rows:auto auto minmax(0,1fr) auto;padding:clamp(10px,1.2vw,20px);display:grid}.shell[data-theme=rust]{--approval:#ff8a3d;--accent:#ffbc75;--muted:#bfac95;--edge:#59412c;--panel:#261b14;--bg:#140e0a}.shell[data-theme=blue-steel]{--approval:#e8c46a;--accent:#85c8ff;--muted:#9cacc4;--edge:#334d69;--panel:#142235;--bg:#0b1421}.shell[data-theme=ultraviolet]{--approval:#f9a8d4;--accent:#c5adff;--muted:#b3a6c9;--edge:#4b3c68;--panel:#241a35;--bg:#140d22}.shell[data-theme=nightshade]{--approval:#8f7cff;--accent:#e59bff;--muted:#c6a7cf;--edge:#673976;--panel:#301739;--bg:#1c0b24}header,.spread,footer,.controls{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:10px;display:flex}header{margin-bottom:10px}.brand{letter-spacing:.08em;color:var(--accent);text-shadow:0 0 22px color-mix(in srgb, var(--accent) 20%, transparent);font-size:clamp(22px,2.5vw,32px);font-weight:800;text-decoration:none}header p{color:var(--muted);margin:3px 0 0;font-size:13px}.connection{color:var(--accent);text-align:right}small,.eyebrow{letter-spacing:.04em;font-size:12px}.connection small{color:var(--muted);margin-top:4px;display:block}.lamp{background:var(--muted);border-radius:50%;width:9px;height:9px;margin-right:9px;display:inline-block}.lamp.lit{background:var(--accent);box-shadow:0 0 8px color-mix(in srgb, var(--accent) 40%, transparent)}.working{animation:1.5s ease-in-out infinite pulse}@keyframes pulse{50%{opacity:.3}}nav{flex-wrap:wrap;gap:6px;margin-bottom:10px;display:flex}nav a,button,.button,select{font:inherit;color:var(--accent);border:1px solid var(--edge);background:var(--panel);cursor:pointer;border-radius:3px;padding:7px 11px;font-size:13px;text-decoration:none}button:hover,.button:hover,nav a:hover{border-color:var(--accent)}nav a.active,nav button.active{background:var(--accent);color:var(--bg);border-color:var(--accent)}:focus-visible{outline:2px solid var(--accent);outline-offset:4px}.secondary{margin-bottom:8px}.secondary a,.secondary button{padding:6px 10px;font-size:12px}main{scrollbar-gutter:stable;flex-direction:column;min-width:0;min-height:0;display:flex;overflow:auto}main>*{flex-shrink:0}.panel{border:1px solid var(--edge);border-top:2px solid var(--accent);background:var(--panel);border-radius:4px;min-width:0;padding:clamp(10px,1vw,16px)}h1{color:var(--accent);font-size:20px}h2{letter-spacing:.04em;color:var(--accent);overflow-wrap:anywhere;margin:0 0 10px;font-size:13px}h3{overflow-wrap:anywhere;font-size:13px}p{margin:6px 0;font-size:13px;line-height:1.45}a{color:var(--accent)}.muted,.eyebrow{color:var(--muted)}.notice{color:#ffe0aa;background:#332611;border-left:3px solid #ffc26e;padding:12px 16px}.empty{color:var(--muted);padding:35px 0}.quota-grid{flex:1 0 auto;grid-auto-rows:minmax(220px,1fr);gap:10px;display:grid}.quota-card{flex-direction:column;min-height:0;display:flex}.quota-card>:not(.meter-graphic){flex-shrink:0}.meter-graphic{flex-direction:column;flex:1;min-height:100px;display:flex}.bar-graphic{min-height:65px}.quota-card .gauge{flex:2;height:auto;min-height:16px;margin:7px 0}.quota-card .timeline{flex:1;min-height:8px}.quota-card .pace{flex:1;height:auto;min-height:20px;margin:20px 14px 8px}.quota-card .readout{margin:6px 0;font-size:clamp(18px,2vw,28px)}.quota-grid.zone{grid-template-columns:repeat(auto-fit,minmax(min(100%,420px),1fr));grid-auto-rows:minmax(330px,1fr)}.quota-grid.radial{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));grid-auto-rows:minmax(260px,1fr)}.gauge{background:var(--edge);height:35px;margin:15px 0;overflow:hidden}.gauge>div{background:repeating-linear-gradient(90deg, var(--accent) 0, var(--accent) 9px, transparent 9px, transparent 12px);height:100%;transition:width .5s}.gauge.timeline{height:14px}.pie-wrap{flex:1;min-height:100px;margin:6px 0;position:relative}.pie-wrap svg{width:100%;height:100%;position:absolute;inset:0}.pie-base{fill:var(--edge);stroke:var(--accent);stroke-width:1px}.pie-fill{fill:var(--accent)}.pace{background:linear-gradient(90deg, #6d3838, var(--edge) 50%, #376348);height:28px;margin:28px 14px 15px;position:relative}.pace-mid{border-left:2px solid var(--ink);height:100%;position:absolute;left:50%}.pace-marker{color:var(--accent);font-size:27px;position:absolute;top:-16px;transform:translate(-50%)}.readout{overflow-wrap:anywhere;color:var(--accent);margin:18px 0;font-size:clamp(22px,3vw,34px)}.credit+.credit{border-top:1px solid var(--edge);padding-top:20px}.credit{margin-top:24px}.session-row{grid-template-columns:minmax(210px,1.1fr) minmax(0,1.2fr) minmax(0,1.5fr);align-items:stretch;gap:14px;margin:18px 0;display:grid}.session-totals{grid-template-columns:repeat(auto-fit,minmax(min(145px,100%),1fr));gap:8px;margin:8px 0;display:grid}.session-totals>div{border:1px solid var(--edge);min-width:0;padding:10px}.session-totals dt{color:var(--muted);font-size:11px}.session-totals dd{color:var(--accent);overflow-wrap:anywhere;margin:6px 0 0;font-size:24px}.session-totals.stale dd{color:var(--muted)}.session-row.selected{outline:1px solid var(--accent);outline-offset:4px}.session-row.wide .context{grid-column:2/-1}.detail-controls{flex-wrap:wrap;gap:6px;display:flex}.attention-summary{flex-wrap:wrap;gap:8px;margin-block:8px;display:flex}.attention-summary .approval{color:var(--approval);border-color:var(--approval)}.attention-summary .approval:hover{background:color-mix(in srgb, var(--approval) 12%, var(--panel))}.attention-summary .approval:focus-visible{outline-color:var(--approval)}.attention-note,.attention-badge{color:var(--accent);border-left:3px solid;padding-left:8px}.attention-note.inferred{color:var(--muted)}.attention-badge{font-size:12px}.session-select{text-align:left;overflow-wrap:anywhere;max-width:100%}.status-detail{color:inherit;text-decoration:none}.status-detail:hover{text-decoration:underline}button:disabled{opacity:.4;cursor:default}.session-row .graph-panel{flex-direction:column;grid-column:2/-1;display:flex}.session-row.split .graph-panel{grid-column:auto}.session-row .button,.session-row button{margin-top:8px;display:inline-block}.context pre{max-height:230px;overflow:auto}.session-row .context{flex-direction:column;display:flex}pre{font:inherit;white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.7}.full-detail{margin-top:6px}.detail-heading{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:6px 12px;display:flex}.detail-heading h2{flex:250px;min-width:0;margin:0}.detail-metadata{overflow-wrap:anywhere}.detail-workspace{border-top:1px solid var(--edge);flex-direction:column;gap:10px;margin-top:8px;padding-top:4px;display:flex}.detail-context,.detail-workspace .session-actions{min-width:0}.detail-workspace .session-actions{border-top:1px solid var(--edge);padding-top:6px}.full-detail h3{margin-block:8px}.full-detail pre{margin-block:8px;line-height:1.5}.full-detail hr{margin-block:12px}.full-detail .command,.full-detail .notice{padding:8px 10px}.command{background:var(--bg);border-left:3px solid var(--accent);padding:16px}hr{border:0;border-top:1px solid var(--edge);margin:24px 0}.chart{border-bottom:1px solid var(--muted);align-items:flex-end;gap:2px;height:clamp(120px,22vh,320px);margin-top:18px;display:flex}.chart-bar{background:var(--accent);flex:1;min-width:0;max-height:100%}.controls{justify-content:flex-start;margin:20px 0}.summary-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:16px;margin:20px 0;display:grid}.thresholds-panel{padding:clamp(14px,2vw,22px)}.thresholds-panel h1{margin-top:0}.threshold-list{gap:8px;margin-top:16px;display:grid}.threshold-list article{border:1px solid var(--edge);grid-template-columns:minmax(64px,.5fr) minmax(220px,3fr) minmax(64px,.6fr) minmax(120px,1.2fr);align-items:center;gap:12px;padding:10px 12px;display:grid}.threshold-list article.active{border-color:var(--accent);box-shadow:inset 3px 0 0 var(--accent)}.threshold-list article.next{border-color:var(--approval);box-shadow:inset 3px 0 0 var(--approval)}.threshold-list p{color:var(--muted);margin:3px 0 0;font-size:12px}.threshold-trigger{color:var(--accent);font-size:22px;font-weight:800}.threshold-mode,.threshold-state{color:var(--muted);font-size:12px;font-weight:700}.threshold-list article.active .threshold-state{color:var(--accent)}.threshold-list article.next .threshold-state{color:var(--approval)}.heat-scroll{overflow-x:auto}.heatmap{grid-template-rows:repeat(7,13px);grid-auto-columns:minmax(9px,1fr);grid-auto-flow:column;gap:4px;min-width:620px;margin:25px 0;display:grid}.heat-cell{background:var(--accent);border-radius:2px}.heat-cell.zero{background:var(--edge)}.table-scroll{max-height:280px;overflow:auto}table{border-collapse:collapse;width:100%;margin-top:15px}th,td{text-align:left;border-bottom:1px solid var(--edge);padding:8px}summary{cursor:pointer;color:var(--accent);padding-top:14px}footer{border-top:1px solid var(--edge);color:var(--muted);margin-top:8px;padding-top:8px;font-size:11px}footer select{padding:6px}@media (width<=850px){.session-row{grid-template-columns:minmax(0,1fr)}.session-row.wide .context,.session-row .graph-panel{grid-column:auto}.connection{text-align:left}.threshold-list article{grid-template-columns:64px minmax(0,1fr)}.threshold-mode,.threshold-state{grid-column:2}}@media (prefers-reduced-motion:reduce){*,:before,:after{transition:none!important;animation:none!important}} diff --git a/internal/web/dist/assets/index-CLM8akQt.js b/internal/web/dist/assets/index-CLM8akQt.js deleted file mode 100644 index 78b9e7d..0000000 --- a/internal/web/dist/assets/index-CLM8akQt.js +++ /dev/null @@ -1,42 +0,0 @@ -(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;function d(e){return typeof e==`function`}var f=()=>{};function p(e){return e()}function m(e){for(var t=0;t{e=n,t=r}),resolve:e,reject:t}}function g(e,t,n=!1){return e===void 0?n?t():t:e}function _(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);let n=[];for(let r of e)if(n.push(r),n.length===t)break;return n}var v=1024,y=2048,b=4096,x=8192,S=16384,C=32768,w=1<<25,T=65536,E=1<<19,ee=1<<20,D=1<<25,te=1<<21,ne=1<<22,re=1<<23,O=Symbol(`$state`),ie=Symbol(`component`),ae=Symbol(`legacy props`),oe=Symbol(``),se=Symbol(`attributes`),ce=Symbol(`class`),le=Symbol(`style`),ue=Symbol(`text`),de=Symbol(`form reset`),fe=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},pe=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),me={},k=Symbol(`uninitialized`),he=`http://www.w3.org/1999/xhtml`;function ge(){console.warn(`https://svelte.dev/e/derived_inert`)}function _e(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function ve(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function ye(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var A=!1;function be(e){A=e}var j;function xe(e){if(e===null)throw _e(),me;return j=e}function Se(){return xe(sn(j))}function M(e){if(A){if(sn(j)!==null)throw _e(),me;j=e}}function Ce(e=1){if(A){for(var t=e,n=j;t--;)n=sn(n);j=n}}function we(e=!0){for(var t=0,n=j;;){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=sn(n);e&&n.remove(),n=i}}function Te(e){if(!e||e.nodeType!==8)throw _e(),me;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(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Le(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Re(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function ze(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Be(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var Ve=!1;function He(){Ve=!0}var N=null;function Ue(e){N=e}function We(e,t=!1,n){N={p:N,i:!1,c:null,e:null,s:e,x:null,r:W,l:Ve&&!t?{s:null,u:null,$:[]}:null}}function Ge(e){var t=N,n=t.e;if(n!==null){t.e=null;for(var r of n)bn(r)}return e!==void 0&&(t.x=e),t.i=!0,N=t.p,Ke(e)}function Ke(e={}){return i(e,ie,{value:!0}),e}function qe(){return!Ve||N!==null&&N.l===null}var Je=[];function Ye(){var e=Je;Je=[],m(e)}function Xe(e){if(Je.length===0&&!wt){var t=Je;queueMicrotask(()=>{t===Je&&Ye()})}Je.push(e)}function Ze(){for(;Je.length>0;)Ye()}var Qe=~(y|b|v);function $e(e,t){e.f=e.f&Qe|t}function et(e){e.f&512||e.deps===null?$e(e,v):$e(e,b)}function tt(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),$e(e,v)}function nt(e){A&&on(e)!==null&&cn(e)}var rt=!1;function it(){rt||(rt=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[de]?.()})},{capture:!0}))}function at(e){var t=U,n=W;Wn(null),Gn(null);try{return e()}finally{Wn(t),Gn(n)}}function ot(e,t,n,r=n){e.addEventListener(t,()=>at(n));let i=e[de];e[de]=i?()=>{i(),r(!0)}:()=>r(!0),it()}function st(e,t,n,r){let i=qe()?dt:mt;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=ct(),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){pn(e,s)}lt()}}var d=ut();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>pt(e))).then(u).catch(e=>pn(e,s)).finally(d)}l?l.then(()=>{c(),f(),lt()}):f()}function ct(){var e=W,t=U,n=N,r=F;return function(i=!0){Gn(e),Wn(t),Ue(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function lt(e=!0){Gn(null),Wn(null),Ue(null),e&&F?.deactivate()}function ut(){var e=W,t=e.b,n=F,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 dt(e){var t=2|y;return W!==null&&(W.f|=E),{ctx:N,deps:null,effects:null,equals:Ee,f:t,fn:e,reactions:null,rv:0,v:k,wv:0,parent:W,ac:null}}var ft=Symbol(`obsolete`);function pt(e,t,n){let r=W;r===null&&Ae();var i=void 0,a=Vt(k),o=!U,s=new Set;return wn(()=>{var t=W,n=h();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==fe&&n.reject(e)}).finally(lt)}catch(e){n.reject(e),lt()}var c=F;if(o){if(t.f&32768)var l=ut();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(ft);else for(let e of s.values())e.reject(ft);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==ft&&(c.activate(),t?(a.f|=re,Gt(a,t)):(a.f&8388608&&(a.f^=re),Gt(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),vn(()=>{for(let e of s)e.reject(ft)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function P(e){let t=dt(e);return qn(t),t}function mt(e){let t=dt(e);return t.equals=Oe,t}function ht(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n{t.ac.abort(fe),t.ac=null}),t.fn!==null&&(t.teardown=f),cr(t,0),kn(t))}function yt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&lr(t)}var bt=null,F=null,xt=null,St=null,Ct=null,wt=!1,Tt=!1,Et=null,Dt=null,Ot=0,kt=1,At=class e{id=kt++;#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(){bt===null?bt=this:(bt.#n=this,this.#t=bt),bt=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)$e(r,y),t(r);for(r of n.m)$e(r,b),t(r)}this.#p.add(e)}#g(){var e=[];for(let i of this.#c)if(!(i.f&16384||!(i.f&6144))){for(var t=i,n=!1;t.parent!==null;){t=t.parent;var r=t.f;if(r&96){if(!(r&1024)){n=!0;break}t.f^=v}}n||e.push(t)}return this.#c=[],e}#_(){this.#e=!0;for(let e of this.#u)this.#d.delete(e),$e(e,y),this.schedule(e);for(let e of this.#d)$e(e,b),this.schedule(e);this.apply();for(var t=Et=[],n=[],r=Dt=[];this.#c.length>0;){Ot++>1e3&&(this.#S(),Mt());for(let e of this.#g())try{this.#v(e,t,n)}catch(t){throw Lt(e),this.#h()||this.discard(),t}}if(F=null,r.length>0){var i=e.ensure();for(let e of r)i.schedule(e)}if(Et=null,Dt=null,this.#h()){this.#x(n),this.#x(t);for(let[e,t]of this.#f)It(e,t);r.length>0&&F.#_();return}let a=this.#y();if(a){this.#x(n),this.#x(t),a.#b(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),xt=this,Pt(n),Pt(t),xt=null,this.#s?.resolve();var o=F;if(this.#a===0&&(this.#c.length===0||o!==null)&&this.#S(),this.#c.length>0){if(o!==null){for(let e of this.#c)o.#c.push(e);this.#c=[]}else o=this}o!==null&&(zt.clear(),o.#_())}#v(e,t,n){e.f^=v;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^=v:i&4?t.push(r):rr(r)&&(i&16&&this.#d.add(r),lr(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}}}#y(){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}#b(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),$e(i,y),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#S(),F=this,this.#_()}#x(e){for(var t=0;t{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??=h()).promise}static ensure(){if(F===null){let t=F=new e;!Tt&&!wt&&Xe(()=>{t.#e||t.flush()})}return F}apply(){St=null}schedule(e){if(Ct=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}this.#c.push(e)}#S(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?bt=e:t.#t=e,this.linked=!1}}};function jt(e){var t=wt;wt=!0;try{var n;for(e&&(F!==null&&!F.is_fork&&F.flush(),n=e());;){if(Ze(),F===null)return n;F.flush()}}finally{wt=t}}function Mt(){try{Fe()}catch(e){pn(e,Ct)}}var Nt=null;function Pt(e){var t=e.length;if(t!==0){for(var n=0;n0)){zt.clear();for(let e of Nt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Nt.has(n)&&(Nt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||lr(n)}}Nt.clear()}}Nt=null}}function Ft(e){F.schedule(e)}function It(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),$e(e,v);for(var n=e.first;n!==null;)It(n,t),n=n.next}}function Lt(e){$e(e,v);for(var t=e.first;t!==null;)Lt(t),t=t.next}var Rt=new Set,zt=new Map,Bt=!1;function Vt(e,t){return{f:0,v:e,reactions:null,equals:Ee,rv:0,wv:0}}function I(e,t){let n=Vt(e,t);return qn(n),n}function Ht(e,t=!1,n=!0){let r=Vt(e);return t||(r.equals=Oe),Ve&&n&&N!==null&&N.l!==null&&(N.l.s??=[]).push(r),r}function L(e,t,n=!1){return U!==null&&(!Un||U.f&131072)&&qe()&&U.f&4325394&&(Kn===null||!Kn.has(e))&&ze(),Gt(e,n?Xt(t):t,Dt)}var Ut=null,Wt=0;function Gt(e,t,n=null){if(!e.equals(t)){Vn?zt.set(e,t):zt.has(e)||zt.set(e,e.v);var r=At.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&>(t),St===null&&et(t)}e.wv=nr(),Ut=null,Wt=0,Yt(e,y,n),Ut=null,qe()&&W!==null&&W.f&1024&&!(W.f&96)&&(Xn===null?Zn([e]):Xn.push(e)),!r.is_fork&&Rt.size>0&&!Bt&&Kt()}return t}function Kt(){Bt=!1;for(let e of Rt){e.f&1024&&$e(e,b);let t;try{t=rr(e)}catch{t=!0}t&&lr(e)}Rt.clear()}function qt(e,t=1){var n=G(e),r=t===1?n++:n--;return L(e,n),r}function Jt(e){L(e,e.v+1)}function Yt(e,t,n){var r=e.reactions;if(r!==null){var i=qe(),a=r.length;if(Wt+=a,Wt>1e5&&Ut===null&&(Ut=new Set),Ut!==null){if(Ut.has(e))return;Ut.add(e)}for(var o=0;o{if(er===d)return e();var t=U,n=er;Wn(null),tr(d);var r=e();return Wn(t),tr(n),r};return i&&r.set(`length`,I(t.length,u)),new Proxy(t,{defineProperty(e,t,n){(!(`value`in n)||n.configurable===!1||n.enumerable===!1||n.writable===!1)&&Le();var i=r.get(t);return i===void 0?f(()=>{var e=I(n.value,u);return r.set(t,e),e}):L(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>I(k,u));r.set(t,e),Jt(o)}}else L(n,k),Jt(o);return!0},get(e,n,i){if(n===O)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>I(Xt(s?e[n]:k),u)),r.set(n,o)),o!==void 0){var c=G(o);return c===k?void 0:c}return Reflect.get(e,n,i)},getOwnPropertyDescriptor(e,t){this.has?.(e,t);var n=Reflect.getOwnPropertyDescriptor(e,t),i=r.get(t);if(i!==void 0){var a=G(i);if(a===k)return;if(n&&`value`in n)n.value=a;else return{enumerable:!0,configurable:!0,value:a,writable:!0}}return n},has(e,t){if(t===O)return!0;var n=r.get(t),i=n!==void 0&&n.v!==k||Reflect.has(e,t);return(n!==void 0||W!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>I(i?Xt(e[t]):k,u)),r.set(t,n)),G(n)===k)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;dI(k,u)),r.set(d+``,p)):L(p,k)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>I(void 0,u)),L(c,Xt(n)),r.set(t,c));else{l=c.v!==k;var m=f(()=>Xt(n));L(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&&L(g,_+1)}Jt(o)}return!0},ownKeys(e){G(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==k});for(var[n,i]of r)i.v!==k&&!(n in e)&&t.push(n);return t},setPrototypeOf(){Re()}})}function Zt(e){try{if(typeof e==`object`&&e&&O in e)return e[O]}catch{}return e}function Qt(e,t){return Object.is(Zt(e),Zt(t))}var $t,en,tn,nn;function rn(){if($t===void 0){$t=window,en=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;tn=a(t,`firstChild`).get,nn=a(t,`nextSibling`).get,u(e)&&(e[ce]=void 0,e[se]=null,e[le]=void 0,e.__e=void 0),u(n)&&(n[ue]=void 0)}}function an(e=``){return document.createTextNode(e)}function on(e){return tn.call(e)}function sn(e){return nn.call(e)}function R(e,t){if(!A)return on(e);var n=on(j);if(n===null)n=j.appendChild(an());else if(t&&n.nodeType!==3){var r=an();return n?.before(r),xe(r),r}return t&&dn(n),xe(n),n}function z(e,t=!1){if(!A){var n=on(e);return n instanceof Comment&&n.data===``?sn(n):n}if(t){if(j?.nodeType!==3){var r=an();return j?.before(r),xe(r),r}dn(j)}return j}function B(e,t=!1){if(!A)return on(e);var n=R(e,t);return M(e),n}function V(e,t=1,n=!1){let r=A?j:e;for(var i;t--;)i=r,r=sn(r);if(!A)return r;if(n){if(r?.nodeType!==3){var a=an();return r===null?i?.after(a):r.before(a),xe(a),a}dn(r)}return xe(r),r}function cn(e){e.textContent=``}function ln(){return!1}function un(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 dn(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 fn(e){var t=W;if(t===null)return U.f|=re,e;if(!(t.f&32768)&&!(t.f&4))throw e;pn(e,t)}function pn(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 mn(e){W===null&&(U===null&&Pe(e),Ne()),Vn&&Me(e)}function hn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function gn(e,t){var n=W;n!==null&&n.f&8192&&(e|=x);var r={ctx:N,deps:null,nodes:null,f:e|y|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};F?.register_created_effect(r);var i=r;if(e&4)Et===null?At.ensure().schedule(r):Et.push(r);else if(t!==null){try{lr(r)}catch(e){throw jn(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|=T))}if(i!==null&&(i.parent=n,n!==null&&hn(i,n),U!==null&&U.f&2&&!(e&64))){var a=U;(a.effects??=[]).push(i)}return r}function _n(){return U!==null&&!Un}function vn(e){let t=gn(8,null);return $e(t,v),t.teardown=e,t}function yn(e){mn(`$effect`);var t=W.f;if(!U&&t&32&&N!==null&&!N.i){var n=N;(n.e??=[]).push(e)}else return bn(e)}function bn(e){return gn(4|ee,e)}function xn(e){return mn(`$effect.pre`),gn(8|ee,e)}function Sn(e){At.ensure();let t=gn(64|E,e);return(e={})=>new Promise(n=>{e.outro?Pn(t,()=>{jn(t),n(void 0)}):(jn(t),n(void 0))})}function Cn(e){return gn(4,e)}function wn(e){return gn(ne|E,e)}function Tn(e,t=0){return gn(8|t,e)}function H(e,t=[],n=[],r=[]){st(r,t,n,t=>{gn(8,()=>{e(...t.map(G))})})}function En(e,t=0){return gn(16|t,e)}function Dn(e){return gn(32|E,e)}function On(e){var t=e.teardown;if(t!==null){let n=Vn,r=U;Hn(!0),Wn(null);try{t.call(null)}catch(t){pn(t,e.parent)}finally{Hn(n),Wn(r)}}}function kn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&at(()=>{e.abort(fe)});var r=n.next;n.f&64?n.parent=null:jn(n,t),n=r}}function An(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||jn(t),t=n}}function jn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Mn(e.nodes.start,e.nodes.end),n=!0),e.f|=w,kn(e,t&&!n),cr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();On(e),e.f^=w,e.f|=S;var i=e.parent;i!==null&&i.first!==null&&Nn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Mn(e,t){for(;e!==null;){var n=e===t?null:sn(e);e.remove(),e=n}}function Nn(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 Pn(e,t,n=!0){var r=[];e.f|=256,Fn(e,r,!0);var i=()=>{n&&jn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Fn(e,t,n){if(!(e.f&8192)){e.f^=x;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);Fn(i,t,o?n:!1)}i=a}}}function In(e){e.f&=-257,Ln(e,!0)}function Ln(e,t){if(!(e.f&256)&&e.f&8192){e.f^=x,e.f&1024||($e(e,y),At.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);Ln(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 Rn(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:sn(n);t.append(n),n=i}}var zn=null,Bn=!1,Vn=!1;function Hn(e){Vn=e}var U=null,Un=!1;function Wn(e){U=e}var W=null;function Gn(e){W=e}var Kn=null;function qn(e){U!==null&&(U.f&2097152||U.f&2)&&(Kn??=new Set).add(e)}var Jn=null,Yn=0,Xn=null;function Zn(e){Xn=e}var Qn=1,$n=0,er=$n;function tr(e){er=e}function nr(){return++Qn}function rr(e){var t=e.f;if(t&2048)return!0;if(t&4096){for(var n=e.deps,r=n.length,i=0;ie.wv)return!0}t&512&&St===null&&$e(e,v)}return!1}function ir(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Kn!==null&&Kn.has(e)))for(var i=0;i{e.ac.abort(fe)}),e.ac=null);try{e.f|=te;var u=e.fn,d=u();e.f|=C;var f=or(e);if(qe()&&Xn!==null&&!Un&&f!==null&&!(e.f&6146))for(var p=0;p0)for(t.length=Yn+Jn.length,r=0;r{s.ac.abort(fe),s.ac=null,$e(s,y)}),vt(s),cr(s,0)}}function cr(e,t){var n=e.deps;if(n!==null)for(var r=t;rn?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?(i.__removed=!1,Xe(()=>{i.__removed||t.addEventListener(e,i,r)})):t.addEventListener(e,i,r),i}function Sr(e,t,n,r,i){var a={capture:r,passive:i},o=xr(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&vn(()=>{o.__removed=!0,t.removeEventListener(e,o,a)})}function K(e,t,n){(t[vr]??={})[e]=n}function Cr(e){for(var t=0;t{Tr=!1,wr=null}));var s=0,c=wr===e&&e[vr];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[vr]=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=U,f=W;Wn(null),Gn(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[vr]?.[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{throw e});throw p}}finally{e[vr]=t,delete e.currentTarget,Wn(d),Gn(f)}}}var Dr=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function Or(e){return Dr?.createHTML(e)??e}function kr(e){var t=un(`template`);return t.innerHTML=Or(e.replaceAll(``,``)),t.content}function Ar(e,t){var n=W;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function q(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(``);return()=>{if(A)return Ar(j,null),j;i===void 0&&(i=kr(a?e:``+e),n||(i=on(i)));var t=r||en?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=on(t),s=t.lastChild;Ar(o,s)}else Ar(t,t);return t}}function jr(e,t,n=`svg`){var r=!e.startsWith(``),i=!!(t&1),a=`<${n}>${r?e:``+e}`,o;return()=>{if(A)return Ar(j,null),j;if(!o){var e=on(kr(a));if(i)for(o=document.createDocumentFragment();on(e);)o.appendChild(on(e));else o=on(e)}var t=o.cloneNode(!0);if(i){var n=on(t),r=t.lastChild;Ar(n,r)}else Ar(t,t);return t}}function Mr(e,t){return jr(e,t,`svg`)}function Nr(e=``){if(!A){var t=an(e+``);return Ar(t,t),t}var n=j;return n.nodeType===3?dn(n):(n.before(n=an()),xe(n)),Ar(n,n),n}function Pr(){if(A)return Ar(j,null),j;var e=document.createDocumentFragment(),t=document.createComment(``),n=an();return e.append(t,n),Ar(t,n),e}function J(e,t){if(A){var n=W;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=j),Se();return}e!==null&&e.before(t)}function Fr(){if(A&&j&&j.nodeType===8&&j.textContent?.startsWith(`$`)){let e=j.textContent.substring(1);return Se(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}function Ir(e){let t=0,n=Vt(0),r;return()=>{_n()&&(G(n),Tn(()=>(t===0&&(r=pr(()=>e(()=>Jt(n)))),t+=1,()=>{Xe(()=>{--t,t===0&&(r?.(),r=void 0,Jt(n))})})))}}var Lr=T|E;function Rr(e,t,n,r){new zr(e,t,n,r)}var zr=class{parent;is_pending=!1;transform_error;#e;#t=A?j: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=Ir(()=>(this.#m=Vt(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=En(()=>{if(A){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()},Lr),A&&(this.#e=j)}#g(){try{this.#a=Dn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);Xe(r),t&&(this.#s=Dn(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{if(t){ye();return}t=!0,n&&Be(),this.#s!==null&&Pn(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){pn(e,this.#i&&this.#i.parent)}}}}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=Dn(()=>e(this.#e)),Xe(()=>{var e=this.#c=document.createDocumentFragment(),t=an(),n=!1;if(e.append(t),this.#a=this.#S(()=>{try{return Dn(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){pn(e,this.#i.parent)}return null}}),this.#a===null){this.#c=null,n&&this.#x(F);return}this.#u===0&&(this.#e.before(e),this.#c=null,Pn(this.#o,()=>{this.#o=null}),this.#x(F))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=Dn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();Rn(this.#a,e);let t=this.#n.pending;this.#o=Dn(()=>t(this.#e))}else this.#x(F)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){tt(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=U,r=N;Gn(this.#i),Wn(this.#i),Ue(this.#i.ctx);try{return At.ensure(),e()}finally{Gn(t),Wn(n),Ue(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&&Pn(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,Xe(()=>{this.#d=!1,this.#m&&Gt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),G(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;F?.is_fork?(this.#a&&F.skip_effect(this.#a),this.#o&&F.skip_effect(this.#o),this.#s&&F.skip_effect(this.#s),F.oncommit(()=>{this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(jn(this.#a),null),this.#o&&=(jn(this.#o),null),this.#s&&=(jn(this.#s),null),A&&(xe(this.#t),Ce(),xe(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 Dn(()=>{var r=W;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return pn(e,this.#i.parent),null}}))};Xe(()=>{var t;try{t=this.transform_error(e)}catch(e){pn(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>pn(e,this.#i&&this.#i.parent)):n(t)})}};function Y(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[ue]??=e.nodeValue)&&(e[ue]=n,e.nodeValue=`${n}`)}function Br(e,t){return Hr(e,t)}var Vr=new Map;function Hr(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){rn();var l=void 0,u=Sn(()=>{var s=n??t.appendChild(an());Rr(s,{pending:()=>{}},t=>{We({});var n=N;if(o&&(n.c=o),a&&(i.$$events=a),A&&Ar(t,null),l=e(t,i)||Ke(),A&&(W.nodes.end=j,j===null||j.nodeType!==8||j.data!==`]`))throw _e(),me;Ge()},c);var u=new Set,d=e=>{for(var n=0;n{for(var e of u)for(let n of[t,document]){var r=Vr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,Er),r.delete(e),r.size===0&&Vr.delete(n)):r.set(e,i)}br.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Ur.set(l,u),l}var Ur=new WeakMap,Wr=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)In(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(In(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&&(jn(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();Rn(r,t),t.append(an()),this.#n.set(e,{effect:r,fragment:t})}else jn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Pn(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)||(jn(n.effect),this.#n.delete(e))};ensure(e,t){var n=F,r=ln();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=an();i.append(a),this.#n.set(e,{effect:Dn(()=>t(a)),fragment:i})}else this.#t.set(e,Dn(()=>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 A&&(this.anchor=j),this.#a(n)}};function X(e,t,n=!1){var r;A&&(r=j,Se());var i=new Wr(e),a=n?T:0;function o(e,t){if(A){var n=Te(r);if(e!==parseInt(n.substring(1))){var a=we();xe(a),i.anchor=a,be(!1),i.ensure(e,t),be(!0);return}}i.ensure(e,t)}En(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var Gr=Symbol(`NaN`);function Kr(e,t,n){A&&Se();var r=new Wr(e),i=!qe();En(()=>{var e=t();e!==e&&(e=Gr),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function qr(e,t){return t}function Jr(e,t,n){for(var i=[],a=t.length,o,s=t.length,c=0;c{if(o){if(o.pending.delete(n),o.done.add(n),o.pending.size===0){var t=e.outrogroups;Yr(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;cn(d),d.append(u),e.items.clear()}Yr(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Yr(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{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,Qr(v,p,c,n,a),d!==null&&(p.length===0?d.f&33554432?(d.f^=D,ei(d,null,c)):In(d):Pn(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:En(()=>{p=G(f);var e=p.length;let t=!1;A&&Te(c)===`[!`!=(e===0)&&(c=we(),xe(c),be(!1),t=!0);for(var r=new Set,u=F,v=ln(),y=0;ys(c)):(d=Dn(()=>s(Xr??=an())),d.f|=D)),e>r.size&&je(``,``,``),A&&e>0&&xe(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&&be(!0),G(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,A&&(c=j)}function Zr(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function Qr(e,t,n,i,a){var o=!!(i&8),s=t.length,c=e.items,l=Zr(e.effect.first),u,d=null,f,p=[],m=[],h,g,_,v;if(o)for(v=0;v0){var E=i&4&&s===0?n:null;if(o){for(v=0;v{if(f!==void 0)for(_ of f)_.nodes?.a?.apply()})}function $r(e,t,n,r,i,a,o,s){var c=o&1?o&16?Vt(n):Ht(n,!1,!1):null,l=o&2?Vt(i):null;return{v:c,i:l,e:Dn(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function ei(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=sn(r);if(a.before(r),r===i)return;r=o}}function ti(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function ni(e,t,n){var r;A&&(r=j,Se());var i=new Wr(e);En(()=>{var e=t()??null;if(A&&Te(r)===`[`!=(e!==null)){var a=we();xe(a),i.anchor=a,be(!1),i.ensure(e,e&&(t=>n(t,e))),be(!0);return}i.ensure(e,e&&(t=>n(t,e)))},T)}var ri=[...` -\r\f\xA0\v`];function ii(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||ri.includes(r[o-1]))&&(s===r.length||ri.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function ai(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 oi(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function si(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(oi)),i&&c.push(...Object.keys(i).map(oi));var l=0,u=-1;let t=e.length;for(var d=0;d{t.every(_i)||(`__defaultValue`in e&&fi(e,!1),`__value`in e&&pi(e,e.__value))});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),vn(()=>{t.disconnect()})}function hi(e,t,n=t){var r=new WeakSet,i=!0;ot(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),gi);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&gi(o)}n(a),e.__value=a,F!==null&&r.add(F)}),Cn(()=>{var a=t();if(e===document.activeElement){var o=F;if(r.has(o))return}if(pi(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=gi(s),n(a))}e.__value=a,i=!1})}function gi(e){return`__value`in e?e.__value:e.value}function _i(e){if(e.target.closest(`selectedcontent`)!==null)return!0;if(e.type===`childList`){var t=[...e.addedNodes,...e.removedNodes];return t.length>0&&t.every(e=>e.nodeName===`SELECTEDCONTENT`)}return!1}var vi=Symbol(`is custom element`),yi=Symbol(`is html`),bi=pe?`link`:`LINK`;function xi(e){if(A){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;Q(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;Q(e,`checked`,null),e.checked=r}}};e[de]=n,Xe(n),it()}}function Q(e,t,n,r){var i=Si(e);A&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===bi)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[oe]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&wi(e).has(t)?e[t]=n:e.setAttribute(t,n))}function Si(e){return e[se]??={[vi]:e.nodeName.includes(`-`),[yi]:e.namespaceURI===he}}var Ci=new Map;function wi(e){var t=e.getAttribute(`is`)||e.nodeName,n=Ci.get(t);if(n)return n;Ci.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;ot(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=ki(e)?Ai(a):a,n(a),F!==null&&r.add(F),await ur(),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))}}}),(A&&e.defaultValue!==e.value||pr(t)==null&&e.value)&&(n(ki(e)?Ai(e.value):e.value),F!==null&&r.add(F)),Tn(()=>{var n=t();if(e===document.activeElement){var i=F;if(r.has(i))return}ki(e)&&n===Ai(e.value)||(e.type!==`date`||n||e.value)&&n!==e.value&&(e.value=n??``)})}var Ei=new Set;function Di(e,t,n,r,i=r){var a=n.getAttribute(`type`)===`checkbox`,o=e;let s=!1;if(t!==null)for(var c of t)o=o[c]??=[];o.push(n),ot(n,`change`,()=>{var e=n.__value;a&&(e=Oi(o,e,n.checked)),i(e)},()=>i(a?[]:null)),Tn(()=>{var e=r();if(A&&n.defaultChecked!==n.checked){s=!0;return}a?(e||=[],n.checked=e.includes(n.__value)):n.checked=Qt(n.__value,e)}),vn(()=>{var e=o.indexOf(n);e!==-1&&o.splice(e,1)}),Ei.has(o)||(Ei.add(o),Xe(()=>{o.sort((e,t)=>e.compareDocumentPosition(t)===4?-1:1),Ei.delete(o)})),Xe(()=>{if(s){var e=a?Oi(o,e,n.checked):o.find(e=>e.checked)?.__value;i(e)}})}function Oi(e,t,n){for(var r=new Set,i=0;i{var n=this.#e.get(e);n.delete(t),n.size===0&&(this.#e.delete(e),this.#t.unobserve(e))}}#r(){return this.#t??=new ResizeObserver(t=>{for(var n of t){e.entries.set(n.target,n);for(var r of this.#e.get(n.target)||[])r(n)}})}}({box:`border-box`});function Mi(e,t,n){var r=ji.observe(e,()=>n(e[t]));Cn(()=>(pr(()=>n(e[t])),r))}function Ni(e,t){return e===t||e?.[O]===t}function Pi(e=Ke(),t,n,r){var i=N.r,a=W;return Cn(()=>{var o,s;return Tn(()=>{o=s,s=r?.()||[],pr(()=>{Ni(n(...s),e)||(t(e,...s),o&&Ni(n(...o),e)&&t(null,...o))})}),()=>{let r=a;for(;r!==i&&r.parent!==null&&r.parent.f&33554432;)r=r.parent;let o=()=>{s&&Ni(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Fi(e,t,n,r,i){var a=()=>{r(n[e])};n.addEventListener(t,a),i?Tn(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&vn(()=>{n.removeEventListener(t,a)})}function Ii(e=!1){let t=N,n=t.l.u;if(!n)return;let r=()=>mr(t.s);if(e){let e=0,n={},i=dt(()=>{let r=!1,i=t.s;for(let e in i)i[e]!==n[e]&&(n[e]=i[e],r=!0);return r&&e++,e});r=()=>G(i)}n.b.length&&xn(()=>{Li(t,r),m(n.b)}),yn(()=>{let e=pr(()=>n.m.map(p));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&yn(()=>{Li(t,r),m(n.a)})}function Li(e,t){if(e.l.s)for(let t of e.l.s)G(t);t()}var Ri=!1;function zi(e){var t=Ri;try{return Ri=!1,[e(),Ri]}finally{Ri=t}}var Bi={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let i=e.props[r];d(i)&&(i=i());let o=a(i,t);if(o&&o.set)return o.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(d(r)&&(r=r()),typeof r==`object`&&r&&t in r){let e=a(r,t);return e&&!e.configurable&&(e.configurable=!0),e}}},has(e,t){if(t===O||t===ae)return!1;for(let n of e.props)if(d(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){let t=[];for(let n of e.props)if(d(n)&&(n=n()),n){for(let e in n)t.includes(e)||t.push(e);for(let e of Object.getOwnPropertySymbols(n))t.includes(e)||t.push(e)}return t}};function Vi(...e){return new Proxy({props:e},Bi)}function Hi(e,t,n,r){var i=!Ve||!!(n&2),o=!!(n&8),s=!!(n&16),c=r,l=!0,u=void 0,d=()=>s&&i?(u??=dt(r),G(u)):(l&&(l=!1,c=s?pr(r):r),c);let f;if(o){var p=O in e||ae in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=zi(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&Ie(t),f(m)));var g=i?()=>{var n=e[t];return n===void 0?d():(l=!0,n)}:()=>{var n=e[t];return n!==void 0&&(c=void 0),n===void 0?c:n};if(i&&!(n&4))return g;if(f){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&f(t?g():e),e):g()})}var v=!1,y=(n&1?dt:mt)(()=>(v=!1,g()));o&&G(y);var b=W;return(function(e,t){if(arguments.length>0){let n=t?G(y):i&&o?Xt(e):e;return L(y,n),v=!0,c!==void 0&&(c=n),e}return Vn&&v||b.f&16384?y.v:G(y)})}function Ui(e){N===null&&ke(`onMount`),Ve&&N.l!==null?Wi(N).m.push(e):yn(()=>{let t=pr(e);if(typeof t==`function`)return t})}function Wi(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);function Gi(e,t){if(e instanceof RegExp)return{keys:!1,pattern:e};var n,r,i,a,o=[],s=``,c=e.split(`/`);for(c[0]||c.shift();i=c.shift();)n=i[0],n===`*`?(o.push(`wild`),s+=`/(.*)`):n===`:`?(r=i.indexOf(`?`,1),a=i.indexOf(`.`,1),o.push(i.substring(1,~r?r:~a?a:i.length)),s+=~r&&!~a?`(?:/([^/]+?))?`:`/([^/]+?)`,~a&&(s+=(~r?`?`:``)+`\\`+i.substring(a))):s+=`/`+i;return{keys:o,pattern:RegExp(`^`+s+(t?`(?=$|/)`:`/?$`),`i`)}}var Ki=new class{#e=I(qi());get _loc(){return G(this.#e)}set _loc(e){L(this.#e,e)}#t=P(()=>this._loc.location);get _location(){return G(this.#t)}set _location(e){L(this.#t,e)}#n=P(()=>this._loc.querystring);get _querystring(){return G(this.#n)}set _querystring(e){L(this.#n,e)}#r=I(void 0);get _params(){return G(this.#r)}set _params(e){L(this.#r,e)}get loc(){return this._loc}get location(){return this._location}get querystring(){return this._querystring}get params(){return this._params}constructor(){typeof window<`u`?window.addEventListener(`hashchange`,()=>{this._loc=qi()}):console.warn(`[svelte-spa-router] window 'window' is not defined, skipping initiation`)}};function qi(){let e=typeof window<`u`?window.location.href:``,t=e.indexOf(`#/`),n=t>-1?e.substr(t+1):`/`,r=n.indexOf(`?`),i=``;return r>-1&&(i=n.substr(r+1),n=n.substr(0,r)),{location:n,querystring:i}}function Ji(e){e?window.scrollTo(e.__svelte_spa_router_scrollX||0,e.__svelte_spa_router_scrollY||0):window.scrollTo(0,0)}function Yi(e,t){We(t,!0);let n=Hi(t,`routes`,19,()=>({})),r=Hi(t,`prefix`,3,``),i=Hi(t,`restoreScrollState`,3,!1),a=Hi(t,`onConditionsFailed`,3,()=>{}),o=Hi(t,`onRouteLoaded`,3,()=>{}),s=Hi(t,`onRouteLoading`,3,()=>{}),c=Hi(t,`onRouteEvent`,3,()=>{});class l{path;component;conditions;userData;props;_pattern;_keys;constructor(e,t){let n=e=>typeof e==`object`&&!!e&&e._sveltesparouter===!0;if(!t||typeof t!=`function`&&!n(t))throw Error(`Invalid component object`);if(!e||typeof e==`string`&&(e.length<1||e.charAt(0)!=`/`&&e.charAt(0)!=`*`)||typeof e==`object`&&!(e instanceof RegExp))throw Error(`Invalid value for "path" argument - strings must start with / or *`);let r=Gi(e);if(this.path=e,n(t)){let e=t;this.component=e.component,this.conditions=e.conditions||[],this.userData=e.userData,this.props=e.props||{}}else{let e=t;this.component=()=>Promise.resolve(e),this.conditions=[],this.props={}}this._pattern=r.pattern,this._keys=r.keys}match(e){if(r()){if(typeof r()==`string`){if(e.startsWith(r()))e=e.substr(r().length)||`/`;else return null}else if(r()instanceof RegExp){let t=e.match(r());if(t&&t[0])e=e.substr(t[0].length)||`/`;else return null}}let t=this._pattern.exec(e);if(t===null)return null;if(this._keys===!1)return t;let n={},i=0;for(;i{u.push(new l(t,e))}):Object.keys(n()).forEach(e=>{let t=n();u.push(new l(e,t[e]))});let d=I(null),f=I(null),p=I({}),m=null,h=null;yn(()=>{history.scrollRestoration=i()?`manual`:`auto`}),yn(()=>{if(!i())return;let e=e=>{m=e.state&&(e.state.__svelte_spa_router_scrollY||e.state.__svelte_spa_router_scrollX)?e.state:null};return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)});async function g(e,t){await ur(),e(t)}yn(()=>{let e=Ki.loc,t=!1;return pr(async()=>{let n=0;for(;n{t=!0}});function _(e){return e&&typeof e==`object`&&Object.keys(e).length?e:null}var v=Pr(),y=z(v),b=e=>{let t=P(()=>G(d));var n=Pr(),r=z(n),i=e=>{var n=Pr();ni(z(n),()=>G(t),(e,t)=>{t(e,Vi({get params(){return G(f)},get onRouteEvent(){return c()}},()=>G(p)))}),J(e,n)},a=e=>{var n=Pr();ni(z(n),()=>G(t),(e,t)=>{t(e,Vi({get onRouteEvent(){return c()}},()=>G(p)))}),J(e,n)};X(r,e=>{G(f)?e(i):e(a,-1)}),J(e,n)};X(y,e=>{G(d)&&e(b)}),J(e,v),Ge()}var Xi=[`bars`,`pace`,`zone`,`pie`,`fuel`,`resets`,`thresholds`],Zi=`codexometer.web.preferences.v1`,Qi={tab:`quota`,view:`bars`,selected:``,defaultDetail:0,layouts:[]};function $i(){try{let e=JSON.parse(localStorage.getItem(Zi)||`null`);return!e||typeof e!=`object`?Qi:{tab:[`quota`,`sessions`,`usage`].includes(e.tab)?e.tab:`quota`,view:Xi.includes(e.view)?e.view:`bars`,selected:typeof e.selected==`string`?e.selected.slice(0,256):``,defaultDetail:+(e.defaultDetail===1),layouts:Array.isArray(e.layouts)?e.layouts.filter(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&t.id.length<=256&&[0,1,2].includes(t.level)}).slice(-100):[]}}catch{return Qi}}var ea=Xt($i());function ta(){let e=JSON.stringify(ea);try{localStorage.setItem(Zi,e)}catch{}}function na(){return ea.tab===`quota`?`/quota/`+ea.view:`/`+ea.tab}function ra(e){return ea.layouts.find(t=>t.id===e)?.level??ea.defaultDetail}function ia(e){ea.defaultDetail=e,ea.layouts=[]}function aa(e,t){ea.layouts=[...ea.layouts.filter(t=>t.id!==e),{id:e,level:Math.max(0,Math.min(2,t))}].slice(-100)}var $=Xt({data:null,connected:!1,error:``}),oa=e=>e==null?`Unavailable`:e.toLocaleString(`en-GB`),sa=e=>!e||String(e).startsWith(`0001-`)?`Not yet available`:new Date(typeof e==`number`?e*1e3:e).toLocaleString(`en-GB`),ca=`codexometer.web.session`,la=class extends Error{},ua;async function da(e,t,n){if(!ua||!$.connected||!$.data?.control||$.data.sessionsError)throw Error(`Session controls unavailable. Check the live connection.`);return await ua(e,t,n)}function fa(){let e=new AbortController,t,n=``;ua=async(t,r,i)=>{let a=await fetch(`/api/control/`+t,{method:`POST`,headers:{Authorization:`Bearer ${n}`,"Content-Type":`application/json`},body:JSON.stringify(r),signal:AbortSignal.any([e.signal,AbortSignal.timeout(8e3),...i?[i]:[]]),cache:`no-store`});if(!a.ok)throw a.status===502?Error(`Outcome uncertain. Check Codex before taking another action; nothing was retried.`):new la(`Action rejected, expired or changed. Refresh and check Codex; nothing was retried.`);return a.json()};try{n=sessionStorage.getItem(ca)||``}catch{}let r=location.hash,i=r.startsWith(`#pair=`)?r.slice(6):``;(i||!r||r===`#`)&&(history.replaceState(null,``,`/#`+na()),window.dispatchEvent(new HashChangeEvent(`hashchange`)));async function a(){if(i)try{let t=await fetch(`/api/pair`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({secret:i}),signal:e.signal});if(!t.ok)throw Error(`Pairing link expired or already used. Restart --web for a fresh link.`);n=(await t.json()).token;try{sessionStorage.setItem(ca,n)}catch{}}catch(t){e.signal.aborted||($.error=t instanceof Error?t.message:`Pairing failed`);return}if(!n){$.error=`Open the private pairing link printed by codexometer --web in your terminal.`;return}await o()}async function o(){try{let t=await fetch(`/api/events`,{headers:{Authorization:`Bearer ${n}`},signal:e.signal,cache:`no-store`});if(t.status===401){try{sessionStorage.removeItem(ca)}catch{}$.error=`Browser session expired. Restart --web and open its new pairing link.`;return}if(!t.ok||!t.body)throw Error(`Live connection unavailable`);let r=t.body.getReader(),i=new TextDecoder,a=``;for(;!e.signal.aborted;){let{done:e,value:t}=await r.read();if(e)break;a+=i.decode(t,{stream:!0});let n;for(;(n=a.indexOf(` - -`))>=0;){let e=a.slice(0,n);a=a.slice(n+2),e.startsWith(`data: `)&&($.data=JSON.parse(e.slice(6)),$.connected=!0,$.error=``)}}}catch{}finally{$.connected=!1}e.signal.aborted||($.error=`Connection lost — showing last observation. Reconnecting…`,t=setTimeout(o,2500))}return a(),()=>{ua=void 0,e.abort(),clearTimeout(t),$.connected=!1}}He();var pa=q(`

      Quota refresh failed. Policy state is based on the last successful - observation.

      `),ma=q(`

      `),ha=q(`

      The longest Codex quota window selects one active model profile. ASK - creates a per-session review; AUTO applies the profile on the next - eligible check.

      `,1),ga=q(`

      No threshold-based model steps were configured at launch.

      `);function _a(e,t){We(t,!1),Ii();var n=Pr(),r=z(n),i=e=>{var t=ha(),n=z(t),r=B(n),i=V(n,2),a=e=>{J(e,pa())};X(i,e=>{$.data.quotaError&&e(a)});var o=V(i,2),s=R(o),c=B(s),l=V(s,4);Z(l,5,()=>$.data.thresholds,qr,(e,t)=>{var n=ma();let r;var i=R(n),a=B(i),o=V(i,2),s=R(o),c=B(s,!0),l=B(V(s,2));M(o);var u=V(o,2),d=B(u,!0),f=B(V(u,2));M(n),H((e,i)=>{r=ci(n,1,``,null,r,{active:G(t).state===`ACTIVE`,next:G(t).state===`NEXT`}),Y(a,`${G(t).threshold??``}%`),Y(c,G(t).model),Y(l,`${e??``} REASONING // ${i??``} - SPEED`),Y(d,G(t).mode),Y(f,`${G(t).state??``}${G(t).state===`NEXT`?` // ${G(t).remaining||0} PP TO GO`:``}`)},[()=>G(t).effort.toUpperCase(),()=>G(t).speed.toUpperCase()]),J(e,n)}),M(l),M(o),H(e=>{Y(r,`MODEL STEP POLICY // OBSERVED ${e??``}`),Y(c,`THRESHOLDS // ${$.data.thresholds.length??``} CONFIGURED`)},[()=>sa($.data.quotaAt)]),J(e,t)},a=e=>{J(e,ga())};X(r,e=>{$.data?.thresholds?.length?e(i):e(a,-1)}),J(e,n),Ge()}var va=Mr(` `,1),ya=Mr(` `,1),ba=q(` `),xa=q(`
      Quota observations
      Observed atPeriod elapsedConsumedTrail segment
      `),Sa=q(`


      Observed quota - path, not individual session usage. Gaps are not interpolated. Expand the - observation table for times, positions and gaps.

      OBSERVATION TABLE
      `,1),Ca=q(`
      CONSUMPTIONQUOTA PERIOD ELAPSED


      `,1);function wa(e,t){let n=Fr();We(t,!0);let r=Hi(t,`trail`,19,()=>[]),i=I(!1),a=[0,25,50,75,100],o=I(400),s=I(240),c=P(()=>G(o)-24),l=P(()=>G(s)-48),u=P(()=>Math.max(1,G(c)-48)),d=P(()=>Math.max(1,G(l)-20)),f=P(()=>48+Math.max(0,Math.min(100,t.elapsed))/100*G(u)),p=P(()=>G(l)-Math.max(0,Math.min(100,t.used))/100*G(d)),m=P(()=>t.used-t.elapsed),h=P(()=>r().map((e,t)=>`${t===0||e.break?`M`:`L`}${48+e.elapsed/100*G(u)} ${G(l)-e.used/100*G(d)}`).join(` `));var g=Ca(),_=z(g),v=R(_),y=R(v),b=B(y),x=V(y),S=V(x);Z(S,17,()=>a,qr,(e,t)=>{var n=va(),r=z(n),i=V(r),a=V(i),o=B(a),s=V(a),f=B(s);H(()=>{Q(r,`x1`,48+G(t)/100*G(u)),Q(r,`x2`,48+G(t)/100*G(u)),Q(r,`y2`,G(l)),Q(i,`y1`,G(l)-G(t)/100*G(d)),Q(i,`x2`,G(c)),Q(i,`y2`,G(l)-G(t)/100*G(d)),Q(a,`x`,48+G(t)/100*G(u)),Q(a,`y`,G(l)+20),Y(o,`${G(t)??``}%`),Q(s,`y`,G(l)+4-G(t)/100*G(d)),Y(f,`${G(t)??``}%`)}),J(e,n)});var C=V(S),w=V(C),T=V(w),E=e=>{var t=ya(),n=z(t),i=V(n),a=B(R(i));M(i),H(e=>{Q(n,`d`,G(h)),Q(i,`cx`,48+r()[0].elapsed/100*G(u)),Q(i,`cy`,G(l)-r()[0].used/100*G(d)),Y(a,`First observation: ${e??``}`)},[()=>sa(r()[0].at)]),J(e,t)};X(T,e=>{r().length&&e(E)});var ee=V(T,2),D=V(ee),te=V(D),ne=B(R(te));M(te),M(v),M(_);var re=V(_,2),O=R(re),ie=B(V(O,3),!0);M(re);var ae=V(re,2),oe=e=>{var t=Sa(),a=z(t),o=R(a);Ce(2),M(a);var s=V(a,2),c=V(R(s),2),l=e=>{var t=xa(),n=R(t),i=V(R(n),2);Z(i,21,r,qr,(e,t,n)=>{var r=ba(),i=R(r),a=R(i),o=B(a,!0);M(i);var s=V(i),c=B(s),l=V(s),u=B(l),d=B(V(l),!0);M(r),H((e,r)=>{Q(a,`datetime`,G(t).at),Y(o,e),Y(c,`${r??``}%`),Y(u,`${G(t).used??``}%`),Y(d,n===0?`First observation`:G(t).break?`Gap before this observation`:`Connected to previous observation`)},[()=>sa(G(t).at),()=>G(t).elapsed.toFixed(1)]),J(e,r)}),M(i),M(n),M(t),J(e,t)};X(c,e=>{G(i)&&e(l)}),M(s),H(e=>{Q(a,`id`,n+`-trail-summary`),Y(o,`○ START ${e??``} // ${r().length??``} - ${r().length===1?`OBSERVATION`:`OBSERVATIONS`}`)},[()=>sa(r()[0].at)]),Fi(`open`,`toggle`,s,e=>L(i,e),()=>G(i)),J(e,t)};X(ae,e=>{r().length&&e(oe)}),H((e,i,a,m)=>{Q(v,`viewBox`,`0 0 ${G(o)} ${G(s)}`),Q(v,`aria-describedby`,r().length?n+`-trail-summary`:void 0),Q(v,`aria-label`,e),Q(b,`id`,n),Q(x,`width`,G(u)),Q(x,`height`,G(d)),Q(x,`fill`,`url(#${n})`),Q(C,`d`,`M48 20 V${G(l)} H${G(c)}`),Q(w,`y1`,G(l)),Q(w,`x2`,G(c)),Q(ee,`x`,48+G(u)/2),Q(ee,`y`,G(s)-5),Q(D,`cx`,G(f)),Q(D,`cy`,G(p)),Q(te,`cx`,G(f)),Q(te,`cy`,G(p)),Y(ne,`${t.used??``}% consumed // ${i??``}% of period elapsed`),Y(O,`${t.used??``}% USED // ${a??``}% TIME ELAPSED`),Y(ie,m)},[()=>`Consumption zone: ${t.used}% consumed, ${t.elapsed.toFixed(1)}% of quota period elapsed. ${G(m)>0?`Above`:G(m)<0?`Below`:`On`} the steady-consumption line.`,()=>t.elapsed.toFixed(1),()=>t.elapsed.toFixed(1),()=>Math.abs(G(m))<.05?`ON PACE`:G(m)>0?`ABOVE THE LINE — CONSUMING FASTER THAN TIME`:`BELOW THE LINE — WITHIN PACE`]),Mi(_,`clientWidth`,e=>L(o,e)),Mi(_,`clientHeight`,e=>L(s,e)),J(e,g),Ge()}var Ta=q(` `),Ea=q(`

      Quota refresh failed. Values below are the last successful observation.

      `),Da=q(`

      Expiry details unavailable. No listed expiry does not mean no expiry.

      `),Oa=q(`

      `),ka=q(`

      Read-only preview. Use the terminal to redeem a reset.

      The backend may return only some credits. This list does not establish - redemption order.

      `),Aa=q(` `,1),ja=Mr(``),Ma=Mr(``),Na=q(`
      `),Pa=q(`

      Cycle duration or reset date unavailable — position cannot be - plotted.

      `),Fa=q(`
      ▼
      −100 // OVER BUDGET+100 // HEADROOM

      `,1),Ia=q(`

      Cycle duration unavailable — pace cannot be calculated.

      `),La=q(`
      EMPTYFULL
      `),Ra=q(`

      `,1),za=q(`
      `,1),Ba=q(`

      `),Va=q(`

      `),Ha=q(`

      No quota windows reported yet.

      `),Ua=q(`
      `,1),Wa=q(`

      All reported windows are shown. API-equivalent learning and quota status - scoring remain in the terminal for this first preview.

      `,1),Ga=q(` `,1);function Ka(e,t){We(t,!0);let n=Hi(t,`params`,19,()=>({})),r=P(()=>Xi.filter(e=>e!==`thresholds`||!!$.data?.thresholds?.length)),i=I(Xt(Date.now())),a=P(()=>G(r).includes(n().view||``)?n().view:`bars`);Ui(()=>{let e=setInterval(()=>L(i,Date.now(),!0),1e3);return()=>clearInterval(e)});function o(e){return!e.duration||e.duration<=0||!e.reset?null:Math.max(0,Math.min(100,100*(1-(e.reset*1e3-G(i))/(e.duration*6e4))))}yn(()=>{ea.view=G(a)});function s(e){let t=e/100*Math.PI*2;return`M60 60 L60 14 A46 46 0 ${+(e>50)} 1 ${60+46*Math.sin(t)} ${60-46*Math.cos(t)} Z`}var c=Ga(),l=z(c);Z(l,21,()=>G(r),qr,(e,t)=>{var n=Ta();let r;var i=B(n,!0);H(e=>{Q(n,`href`,`#/quota/`+G(t)),Q(n,`aria-current`,G(a)===G(t)?`page`:void 0),r=ci(n,1,``,null,r,{active:G(a)===G(t)}),Y(i,e)},[()=>G(t)===`pace`?`CONSUMPTION PACE`:G(t)===`zone`?`CONSUMPTION ZONE`:G(t)===`fuel`?`FUEL TANK`:G(t).toUpperCase()]),J(e,n)}),M(l);var u=V(l,2),d=e=>{var t=Wa(),n=z(t),r=e=>{J(e,Ea())};X(n,e=>{$.data.quotaError&&e(r)});var i=V(n,2),c=B(i),l=V(i,2),u=e=>{_a(e,{})},d=e=>{var t=ka(),n=R(t),r=B(n),i=V(n,4),a=e=>{J(e,Da())};X(i,e=>{$.data.credits.length||e(a)}),Z(V(i,2),17,()=>$.data.credits,qr,(e,t)=>{var n=Oa(),r=R(n),i=B(r),a=B(V(r,2),!0);M(n),H(e=>{Y(i,`${(G(t).title||`Quota reset`)??``} // ${G(t).status??``}`),Y(a,e)},[()=>G(t).expiryKnown?G(t).expires?`EXPIRES `+sa(G(t).expires):`Does not expire`:`Expiry information unavailable`]),J(e,n)}),Ce(2),M(t),H(()=>Y(r,`RESET INVENTORY // ${$.data.creditCount??``} AVAILABLE`)),J(e,t)},f=e=>{var t=Ua(),n=z(t);let r;Z(n,21,()=>$.data.meters,qr,(e,t)=>{let n=P(()=>o(G(t))),r=P(()=>G(n)===null?null:G(n)-G(t).used);var i=Va(),c=R(i),l=B(c,!0),u=V(c,2),d=R(u),f=e=>{var n=Aa(),r=z(n),i=B(r),a=B(V(r));H(()=>{Y(i,`FREE ${100-G(t).used}%`),Y(a,`USED ${G(t).used??``}%`)}),J(e,n)},p=e=>{var n=Aa(),r=z(n),i=B(r),a=B(V(r));H(()=>{Y(i,`USED ${G(t).used??``}%`),Y(a,`FREE ${100-G(t).used}%`)}),J(e,n)};X(d,e=>{G(a)===`fuel`?e(f):e(p,-1)}),M(u);var m=V(u,2);let h;var g=R(m),_=e=>{var n=Na(),r=R(n),i=V(R(r)),a=e=>{J(e,ja())},o=e=>{var n=Ma();H(e=>Q(n,`d`,e),[()=>s(G(t).used)]),J(e,n)};X(i,e=>{G(t).used>=100?e(a):G(t).used>0&&e(o,1)}),M(r),M(n),H(()=>Q(r,`aria-label`,`${G(t).used}% quota used`)),J(e,n)},v=e=>{var r=Pr(),i=z(r),a=e=>{{let r=P(()=>G(t).trail||[]);wa(e,{get used(){return G(t).used},get elapsed(){return G(n)},get trail(){return G(r)}})}},o=e=>{J(e,Pa())};X(i,e=>{G(n)===null?e(o,-1):e(a)}),J(e,r)},y=e=>{var t=Pr(),n=z(t),i=e=>{var t=Fa(),n=z(t),i=V(R(n),2);let a;M(n);var o=V(n,4),s=R(o),c=B(V(s),!0);M(o),H(e=>{a=ui(i,``,a,{left:`${(G(r)+100)/2}%`}),Y(s,`${G(r)>=0?`+`:``}${e??``} PP `),Y(c,G(r)>=0?`WITHIN PACE`:`USING FASTER THAN TIME`)},[()=>G(r).toFixed(1)]),J(e,t)},a=e=>{J(e,Ia())};X(n,e=>{G(r)===null?e(a,-1):e(i)}),J(e,t)},b=e=>{var r=za(),i=z(r),o=R(i);let s;M(i);var c=V(i,2),l=e=>{J(e,La())};X(c,e=>{G(a)===`fuel`&&e(l)});var u=V(c,2),d=e=>{var t=Ra(),r=z(t),i=B(r),o=V(r,2),s=R(o);let c;M(o),H(e=>{Y(i,`RESET CYCLE // ${e??``}% ELAPSED`),c=ui(s,``,c,{width:`${G(a)===`fuel`?100-G(n):G(n)}%`})},[()=>Math.floor(G(n))]),J(e,t)};X(u,e=>{G(n)!==null&&e(d)}),H(()=>{Q(i,`aria-label`,G(a)===`fuel`?`Fuel remaining`:`Quota used`),Q(i,`aria-valuenow`,G(a)===`fuel`?100-G(t).used:G(t).used),s=ui(o,``,s,{width:`${G(a)===`fuel`?100-G(t).used:G(t).used}%`})}),J(e,r)};X(g,e=>{G(a)===`pie`?e(_):G(a)===`zone`?e(v,1):G(a)===`pace`?e(y,2):e(b,-1)}),M(m);var x=V(m,2),S=B(x),C=V(x,2),w=e=>{var n=Ba(),r=B(n,!0);H(()=>Y(r,G(t).details)),J(e,n)};X(C,e=>{G(t).details&&e(w)}),M(i),H(e=>{Y(l,G(t).name),h=ci(m,1,`meter-graphic`,null,h,{"bar-graphic":G(a)===`bars`||G(a)===`fuel`}),Y(S,`RESETS // ${e??``}`)},[()=>sa(G(t).reset)]),J(e,i)}),M(n);var i=V(n,2),c=e=>{J(e,Ha())};X(i,e=>{$.data.meters.length||e(c)}),H(()=>r=ci(n,1,`quota-grid`,null,r,{radial:G(a)===`pie`,zone:G(a)===`zone`})),J(e,t)};X(l,e=>{G(a)===`thresholds`?e(u):G(a)===`resets`?e(d,1):e(f,-1)}),Ce(2),H(e=>Y(c,`QUOTA // OBSERVED ${e??``}`),[()=>sa($.data.quotaAt)]),J(e,t)};X(u,e=>{$.data&&e(d)}),J(e,c),Ge()}var qa=q(`
      `),Ja=q(`

      `,1);function Ya(e,t){We(t,!0);let n=Hi(t,`values`,19,()=>[]),r=Hi(t,`label`,3,`Token activity`),i=Hi(t,`capacity`,3,0),a=P(()=>Math.max(0,...n())),o=P(()=>i()>n().length?[...Array(i()-n().length).fill(0),...n()]:n());var s=Ja(),c=z(s),l=B(c),u=V(c,2);Z(u,21,()=>G(o),qr,(e,t)=>{var n=qa();let r;H((e,t)=>{Q(n,`title`,e),r=ui(n,``,r,{height:t})},[()=>G(t).toLocaleString(`en-GB`)+` tokens`,()=>`${100*G(t)/Math.max(1,G(a))}%`]),J(e,n)}),M(u),H((e,t)=>{Y(l,`SCALE // 0 — ${e??``} TOKENS`),Q(u,`aria-label`,t)},[()=>G(a).toLocaleString(`en-GB`),()=>`${r()}. Peak ${G(a).toLocaleString(`en-GB`)} tokens.`]),J(e,s),Ge()}var Xa=q(`

      `),Za=q(`

      Send this saved prompt now? This starts Codex work and consumes quota.

      `,1),Qa=q(``),$a=q(`

       

      In memory only. Follows session model, reasoning and speed. Closing - Codexometer cancels pending work.

      `),eo=q(`

      CURRENT PROFILE

      MODEL / REASONING LEVEL / SPEED

       

      PROPOSED PROFILE

      MODEL / REASONING LEVEL / SPEED

       

      Applied settings remain after Codexometer closes.

      `,1),to=q(`

      `),no=q(`

       
      `,1),ro=q(`

      Command unavailable from this observation. Open Codex to inspect the - request.

      `),io=q(`

      Session controls temporarily unavailable. Check Codex for current state.

      `),ao=q(`

      Checking session controls…

      `),oo=q(`

      `),so=q(`
      About browser controls

      Controls require a supported live request from a connected shared - app-server session. Local observations alone cannot provide them.

      `),co=q(` `,1),lo=q(` `),uo=q(`Grants permission beyond this one command. Check the scope - carefully.`),fo=q(``),po=q(``),mo=q(``),ho=q(``),go=q(`

      Not before this time; when quota and idle allow.

      `),_o=q(`

      `,1),vo=q(`

      The existing trigger remains active until saved or deleted. If - it changes or sends while you edit, saving is blocked.

      `),yo=q(` `,1),bo=q(``),xo=q(``),So=q(``),Co=q(` `,1),wo=q(`
    • `),To=q(`
      View fixed choices

      Type one of these choices exactly. Your answer stays masked.

        `),Eo=q(` `,1),Do=q(`

        `),Oo=q(`

        `,1),ko=q(` `,1),Ao=q(``),jo=q(`

        `,1),Mo=q(`

        `);function No(e,t){We(t,!0);let n=[],r=Hi(t,`observedCommand`,3,``),i=Hi(t,`review`,3,``),a=Hi(t,`suspended`,3,!1),o=Hi(t,`openScheduler`,3,!1),s=Hi(t,`onProtectedChange`,3,e=>{}),c=I(null),l=I(Xt([])),u=I(null),d=I(``),f=I(0),p=I(Xt(Date.now())),m=I(!1),h=I(``),g=I(!1),_=I(!1),v=I(``),y=I(!1),b=I(``),x=I(!1),S=I(``),C=I(`now`),w=I(60),T=I(``),E=I(!1),ee=I(``),D=I(Xt([])),te=P(()=>G(D).find(e=>e.status!==`sent`)),ne=I(void 0);function re(e){if(G(y)){ur().then(()=>G(ne)?.focus());return}if(e.status!==`pending`||G(m)||!G(c)?.id||G(c).kind!==`prompt`||G(c).questions?.length)return;L(y,!0),L(b,e.id,!0),ur().then(()=>G(ne)?.focus()),L(l,[e.text],!0),L(C,e.trigger===`quota`?`quota`:`at`,!0),L(d,``),L(S,``);let t=new Date(e.at);e.trigger!==`quota`&&L(T,new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16),!0)}yn(()=>{o()&&G(te)&&!G(x)&&G(c)?.id&&G(c).kind===`prompt`&&!G(c).questions?.length&&(L(x,!0),re(G(te)))});async function O(){if(!i())try{L(D,await da(`schedules`,{session:t.session},_e.signal),!0),G(y)&&!G(D).some(e=>e.id===G(b)&&e.status===`pending`)&&L(d,``),G(S)&&!G(D).some(e=>e.id===G(S)&&e.status===`pending`)&&(L(d,``),L(S,``))}catch{}}async function ie(e){try{L(D,await da(`schedules`,{session:t.session,cancelId:e},_e.signal),!0),L(y,!1),L(d,``),L(S,``),L(l,[],!0)}catch(e){L(h,e instanceof Error?e.message:`Unable to cancel trigger.`,!0)}}yn(()=>(s()(G(m)||G(l).some(e=>e.length>0)),()=>s()(!1)));let ae=P(()=>$.data?.sessions.find(e=>e.id===t.session)?.status),oe=P(()=>!$.connected||!!$.data?.sessionsError),se=P(()=>i()!==`profile`&&G(c)?.kind===`prompt`&&!G(c).questions?.length&&!!$.data?.profiles?.some(e=>e.session===t.session&&e.pending)),ce=P(()=>!G(oe)&&!G(_)&&!!G(c)?.id&&G(c).kind===`approval`&&G(v)!==G(c).id),le=P(()=>G(ce)?G(c).command:r()),ue=P(()=>!!G(d)&&G(p)G(c)?.questions?.length?G(c).questions:[{text:`Follow-up message`,secret:!1,freeText:!0,options:[]}]),fe=P(()=>G(c)?.kind===`approval`||G(c)?.kind===`profile`?G(u)!==null:G(l).length===G(de).length&&G(l).every((e,t)=>e.trim().length>0&&(G(de)[t].freeText||G(de)[t].options?.includes(e)))),pe=P(()=>G(c)?.kind===`prompt`&&!G(c).questions?.length&&G(C)!==`now`),me=P(()=>G(C)===`delay`?G(p)+G(w)*6e4:Date.parse(G(T))),k=P(()=>{if(!G(pe))return``;if(G(y)&&!G(D).some(e=>e.id===G(b)&&e.status===`pending`))return`Trigger changed, removed or already sent. Go back and reopen it; your draft has not been saved.`;if(!G(l)[0]?.trim())return`Enter a message to schedule.`;if(G(C)===`quota`)return``;if(!Number.isFinite(G(me))||G(me)<=G(p))return`Choose a future date/time or a delay greater than zero.`;let e=new Date(G(p));return e.setFullYear(e.getFullYear()+1),G(me)>=e.getTime()?`Choose a time within one year.`:``});function he(e){return new Date(e).toLocaleString([],{timeZoneName:`short`})}function ge(e){if(e.status!==`pending`)return e.status;if(e.trigger===`at`&&Date.parse(e.at)>G(p))return`Due in `+Math.ceil((Date.parse(e.at)-G(p))/6e4)+` min`;let t=G(oe)?`waiting for a fresh connection`:e.waitingReason||(e.canSend?`ready; awaiting dispatch`:`waiting for quota and an eligible idle session`);return(e.trigger===`at`?`Time reached — `:``)+t}yn(()=>{(G(oe)||a()||G(se)||G(p)>=G(f))&&L(d,``)});let _e=new AbortController;Ui(()=>{let e=e=>{e.ctrlKey&&e.key.toLowerCase()===`s`&&!i()&&G(te)&&(e.preventDefault(),re(G(te)))};window.addEventListener(`keydown`,e);let n,r=setInterval(()=>{L(p,Date.now(),!0)},1e3);async function a(){await O();try{let e=await da(`offer`,{session:t.session,...i()?{review:i()}:{}},_e.signal);if(_e.signal.aborted)return;L(_,!1),G(c)?.id!==e.id&&(L(d,``),L(u,null),L(l,Array(Math.max(1,e.questions?.length||0)).fill(``),!0)),L(c,e,!0),G(g)&&e.id&&e.id!==G(v)&&(L(h,``),L(g,!1))}catch{_e.signal.aborted||(L(c,null),L(_,!0),L(d,``))}finally{_e.signal.aborted||(n=setTimeout(a,2e3))}}return a(),()=>{window.removeEventListener(`keydown`,e),_e.abort(),clearTimeout(n),clearInterval(r)}});async function ve(e){if(!G(c)?.id||G(m)||G(oe)||a()||G(se)||(e?!e.canSend:!G(fe)||G(k)))return;let n=G(c).id;L(m,!0),L(h,``),L(g,!1),L(d,``),L(S,e?.id||``,!0);try{let r=!e&&G(c).kind===`prompt`&&!G(c).questions?.length&&G(C)!==`now`?{trigger:G(C)===`quota`?`quota`:`at`,zone:Intl.DateTimeFormat().resolvedOptions().timeZone,...G(C)===`quota`?{}:{at:(G(C)===`delay`?new Date(Date.now()+G(w)*6e4):new Date(G(T))).toISOString()}}:void 0;L(E,!!r),L(ee,r?r.trigger===`quota`?`After fresh quota becomes available, when the session is idle`:he(r.at)+` — not before this time; when quota and idle allow`:``,!0);let o=await da(`prepare`,{session:t.session,...i()?{review:i()}:{},offer:n,...e?{sendId:e.id}:{},...r?{schedule:r}:{},...r&&G(y)?{editId:G(b)}:{},...G(c).kind===`approval`||G(c).kind===`profile`?{choice:G(u)}:{answers:e?[e.text]:[...G(l)]}},_e.signal);G(c)?.id===n&&!_e.signal.aborted&&!G(oe)&&!a()&&!G(se)&&(L(d,o.confirmation,!0),L(f,Date.parse(o.expires),!0))}catch(e){_e.signal.aborted||L(h,e instanceof Error?e.message:`Unable to prepare action.`,!0)}finally{L(m,!1)}}async function ye(){if(!G(c)?.id||G(m)||a()||G(se)||!G(ue))return;let e=G(c).id,n=G(c).kind,r=G(d);L(d,``),L(m,!0),L(v,e,!0);try{await da(`commit`,{session:t.session,...i()?{review:i()}:{},offer:e,confirmation:r},_e.signal),L(g,!0),L(y,!1),G(E)&&(L(v,``),await O()),L(h,G(E)?`Trigger set. Closing Codexometer cancels it.`:n===`profile`?`Profile decision completed.`:n===`approval`?`Decision sent.`:`Text sent.`,!0)}catch(e){L(h,e instanceof la?e.message:`Outcome uncertain. Check Codex before taking another action; nothing was retried.`,!0)}finally{L(m,!1),L(S,``),await O(),L(l,[],!0),L(u,null)}}var A=co(),be=z(A),j=e=>{var t=Pr();Z(z(t),17,()=>G(D).filter(e=>e.status!==`sent`),e=>e.id,(e,t)=>{var n=$a(),r=R(n),i=B(r,!0),o=V(r,2),s=B(o),l=V(o,2),u=B(l,!0),f=V(l,2),p=B(f,!0),g=V(f,2),_=B(g,!0),v=V(g,2),y=e=>{var t=Xa(),n=B(t,!0);H(()=>Y(n,G(h))),J(e,t)};X(v,e=>{G(h)&&e(y)});var b=V(v,4),x=V(b,2),C=V(x,2),w=e=>{var n=Za(),r=V(z(n),2),i=V(r,2);H(()=>r.disabled=G(m)||G(oe)||!G(t).canSend),K(`click`,r,ye),K(`click`,i,()=>{L(d,``),L(S,``)}),J(e,n)},T=e=>{var n=Qa();H(()=>n.disabled=G(m)||G(oe)||!G(t).canSend||a()),K(`click`,n,()=>ve(G(t))),J(e,n)};X(C,e=>{G(ue)&&G(S)===G(t).id?e(w):e(T,-1)}),M(n),H((e,n)=>{Y(i,G(t).status===`uncertain`?`CHECK TRIGGER — outcome uncertain; not retried`:`SCHEDULED FOLLOW-UP`),Y(s,`TARGET // ${G(t).session??``}`),Y(u,e),Y(p,n),Y(_,G(t).text),b.disabled=G(m)||!G(c)?.id||G(c).kind!==`prompt`||!!G(c).questions?.length||G(t).status!==`pending`,x.disabled=G(m)||G(t).status===`sending`},[()=>G(t).trigger===`quota`?`After confirmed quota recovery, when idle`:`Not before ${he(G(t).at)}`,()=>ge(G(t))]),K(`click`,b,()=>re(G(t))),K(`click`,x,()=>ie(G(t).id)),J(e,n)}),J(e,t)},xe=P(()=>!i()&&G(c)?.kind!==`approval`&&!G(c)?.questions?.length&&![`APPROVAL NEEDED`,`INPUT NEEDED`].includes(G(ae)||``));X(be,e=>{G(xe)&&e(j)});var Se=V(be,2),we=e=>{var r=Mo(),a=R(r),o=B(a,!0),s=V(a,2),b=e=>{var t=eo(),n=z(t),r=B(n),i=V(n,6),a=B(i,!0),o=B(V(i,6),!0);Ce(2),H(()=>{Y(r,`Your ${G(c).profile.threshold??``}% quota threshold has been reached. Review - the profile for subsequent turns.`),Y(a,G(c).profile.current),Y(o,G(c).profile.proposed)}),J(e,t)};X(s,e=>{G(c)?.profile&&!G(oe)&&!G(_)&&e(b)});var x=V(s,2),S=e=>{var t=to();let n;var r=B(t,!0);H(()=>{n=ci(t,1,`svelte-1oupzfc`,null,n,{notice:!G(g),sent:G(g)}),Y(r,G(h))}),J(e,t)};X(x,e=>{G(h)&&e(S)});var D=V(x,2),te=e=>{var t=no(),n=z(t),r=B(n,!0),i=B(V(n,2),!0);H(()=>{Y(r,G(ce)?`EXACT COMMAND`:`LAST OBSERVED COMMAND`),Y(i,G(le))}),J(e,t)},re=e=>{J(e,ro())};X(D,e=>{G(le)?e(te):i()!==`profile`&&G(ae)===`APPROVAL NEEDED`&&!G(g)&&e(re,1)});var O=V(D,2),ie=e=>{J(e,io())},se=e=>{J(e,ao())},pe=e=>{var t=co(),n=z(t),r=e=>{var t=oo(),n=B(t,!0);H(e=>Y(n,e),[()=>G(ae)===`WORKING`?`Codex is working — nothing to respond to.`:[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(G(ae)||``)?`Respond in Codex for this request.`:`Nothing needs a response right now.`]),J(e,t)};X(n,e=>{(G(ae)===`WORKING`||!G(g)&&!G(m))&&e(r)});var i=V(n,2),a=e=>{J(e,so())},o=P(()=>[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(G(ae)||``)&&!G(g));X(i,e=>{G(o)&&e(a)}),J(e,t)},ge=e=>{var r=jo(),a=z(r),o=B(a),s=V(a,2),h=R(s),g=B(h,!0),_=V(h,2),v=e=>{var r=Pr();Z(z(r),17,()=>G(c).choices||[],qr,(e,r,a)=>{var o=fo(),s=R(o);xi(s),s.value=s.__value=a;var c=V(s),l=V(c),d=e=>{var t=lo(),n=B(t,!0);H(()=>Y(n,G(r).detail)),J(e,t)};X(l,e=>{G(r).detail&&e(d)});var f=V(l,2),p=e=>{J(e,uo())};X(f,e=>{G(r).persistent&&e(p)}),M(o),H(()=>{Q(s,`name`,`decision-`+t.session+`-`+i()),Y(c,` ${G(r).label??``} `)}),Di(n,[],s,()=>G(u),e=>L(u,e)),J(e,o)}),J(e,r)},b=e=>{var t=co(),n=z(t),r=e=>{var t=yo(),n=z(t),r=V(R(n)),i=R(r),a=e=>{var t=po();t.value=t.__value=`now`,J(e,t)};X(i,e=>{G(y)||e(a)});var o=V(i);o.value=o.__value=`quota`;var s=V(o);s.value=s.__value=`delay`;var c=V(s);c.value=c.__value=`at`,M(r),mi(r),M(n);var l=V(n,2),u=e=>{var t=mo(),n=V(R(t));xi(n),M(t),Ti(n,()=>G(w),e=>L(w,e)),J(e,t)};X(l,e=>{G(C)===`delay`&&e(u)});var d=V(l,2),f=e=>{var t=ho(),n=V(R(t));xi(n),M(t),Ti(n,()=>G(T),e=>L(T,e)),J(e,t)};X(d,e=>{G(C)===`at`&&e(f)});var p=V(d,2),m=e=>{var t=_o(),n=z(t),r=B(n),i=V(n,2),a=e=>{J(e,go())};X(i,e=>{G(C)!==`quota`&&e(a)});var o=V(i,2);o.textContent=`Timezone: ${Intl.DateTimeFormat().resolvedOptions().timeZone??``}. - One pending request per session; saving replaces it. Memory - only; Codexometer must stay running. Uses session model, - reasoning and speed.`,H(e=>Y(r,`Will send: ${e??``}`),[()=>G(C)===`quota`?`when quota is available and this session is idle`:Number.isFinite(G(me))?he(G(me)):`choose a date and time`]),J(e,t)};X(p,e=>{G(C)!==`now`&&e(m)});var h=V(p,2),g=e=>{J(e,vo())};X(h,e=>{G(y)&&e(g)}),hi(r,()=>G(C),e=>L(C,e)),J(e,t)};X(n,e=>{G(c).questions?.length||e(r)}),Z(V(n,2),17,()=>G(de),qr,(e,t,n)=>{var r=Eo(),i=z(r),a=R(i),o=V(a),s=e=>{var t=bo();xi(t),Ti(t,()=>G(l)[n],e=>G(l)[n]=e),J(e,t)},c=e=>{var r=So(),i=R(r);i.value=i.__value=``,Z(V(i),17,()=>G(t).options||[],qr,(e,t)=>{var n=xo(),r=B(n,!0),i={};H(()=>{Y(r,G(t)),i!==(i=G(t))&&(n.value=(n.__value=i)??``)}),J(e,n)}),M(r),mi(r),hi(r,()=>G(l)[n],e=>G(l)[n]=e),J(e,r)},u=e=>{var r=Co(),i=z(r);nt(i),Pi(i,e=>L(ne,e),()=>G(ne));var a=V(i,2),o=e=>{var n=oo(),r=B(n);H(e=>Y(r,`Suggested answers: ${e??``}`),[()=>G(t).options.join(` · `)]),J(e,n)};X(a,e=>{G(t).options?.length&&e(o)}),Ti(i,()=>G(l)[n],e=>G(l)[n]=e),J(e,r)};X(o,e=>{G(t).secret?e(s):G(t).freeText?e(u,-1):e(c,1)}),M(i);var d=V(i,2),f=e=>{var n=To(),r=V(R(n),4);Z(r,21,()=>G(t).options||[],qr,(e,t)=>{var n=wo(),r=B(n,!0);H(()=>Y(r,G(t))),J(e,n)}),M(r),M(n),J(e,n)};X(d,e=>{G(t).secret&&!G(t).freeText&&e(f)}),H(()=>Y(a,`${G(t).text??``} `)),J(e,r)}),J(e,t)};X(_,e=>{G(c).kind===`approval`||G(c).kind===`profile`?e(v):e(b,-1)}),M(s);var x=V(s,2),S=e=>{var t=Oo(),n=z(t),r=e=>{var t=Do(),n=B(t);H(()=>Y(n,`TRIGGER // ${G(ee)??``}`)),J(e,t)};X(n,e=>{G(E)&&e(r)});var i=V(n,2),a=B(i),o=V(i,2),s=B(o),l=V(o,2);H(e=>{Y(a,`Check the target and ${G(c).kind===`profile`?`profile above`:G(c).kind===`approval`?`exact command and permission scope`:`message above`}. ${G(E)?`This schedules a follow-up that will send automatically when eligible`:`This will send to Codex`}; it may start work using your quota. - Confirmation expires in ${e??``}s.`),o.disabled=G(m)||G(oe),Y(s,`CONFIRM ${(G(c).kind===`approval`||G(c).kind===`profile`?G(c).choices?.[G(u)]?.label:G(E)?G(y)?`SAVE CHANGES`:`SCHEDULE`:`SEND`)??``}`)},[()=>Math.max(0,Math.ceil((G(f)-G(p))/1e3))]),K(`click`,o,ye),K(`click`,l,()=>{L(d,``)}),J(e,t)},D=e=>{var t=ko(),n=z(t),r=e=>{var t=Xa(),n=B(t,!0);H(()=>Y(n,G(k))),J(e,t)};X(n,e=>{G(k)&&e(r)});var i=V(n,2),a=B(i,!0);H(()=>{i.disabled=G(m)||G(oe)||!G(fe)||!!G(k),Y(a,G(m)?`SENDING…`:G(y)?`REVIEW CHANGES`:`REVIEW BEFORE SENDING`)}),K(`click`,i,()=>ve()),J(e,t)};X(x,e=>{G(ue)?e(S):e(D,-1)});var te=V(x,2),re=e=>{var t=Ao();K(`click`,t,()=>{L(y,!1),L(d,``),L(l,[],!0)}),J(e,t)};X(te,e=>{G(y)&&e(re)}),H(()=>{Y(o,`TARGET // ${G(c).thread??``} // ${(G(c).directory||`Directory unavailable`)??``}`),s.disabled=G(m)||G(ue)||G(oe),Y(g,G(c).kind===`approval`||G(c).kind===`profile`?`Choose a decision`:G(y)?`EDIT SCHEDULED FOLLOW-UP`:`Reply to this session`)}),J(e,r)};X(O,e=>{G(oe)||G(_)?e(ie):G(c)?G(c).id?G(v)!==G(c).id&&e(ge,3):e(pe,2):e(se,1)}),M(r),H(()=>Y(o,i()===`profile`?`QUOTA THRESHOLD`:`SESSION CONTROL // EXPERIMENTAL`)),J(e,r)};X(Se,e=>{!G(se)&&(!G(te)||G(y)||i()||G(c)?.kind!==`prompt`||G(c).questions?.length)&&e(we)}),J(e,A),Ge()}Cr([`click`]);var Po=q(`
        `);function Fo(e,t){We(t,!0);let n=Hi(t,`active`,3,!1),r=P(()=>t.session.text||t.session.contextKind===`LAST ACTIVITY`&&t.session.workingCommand||``),i=P(()=>[`LAST REPLY`,`LAST ACTIVITY`].includes(t.session.contextKind)&&!!G(r).trim()),a=I(!1),o=I(``),s=I(!1);yn(()=>{if(!G(s))return;let e=setTimeout(()=>{L(s,!1)},150);return()=>clearTimeout(e)}),yn(()=>{G(r),t.session.status,L(o,``)});async function c(){if(!G(i)||G(a))return;let e=G(r);L(a,!0),L(s,!0),L(o,``);try{await navigator.clipboard.writeText(e),G(r)===e&&L(o,`Copied.`)}catch{G(r)===e&&L(o,`Clipboard unavailable. Select the visible text and copy it manually.`)}finally{L(a,!1)}}function l(e){!n()||!G(i)||e.defaultPrevented||e.repeat||e.ctrlKey||e.metaKey||e.altKey||e.key.toLowerCase()!==`c`||e.target instanceof Element&&e.target.closest(`input, textarea, select, [contenteditable]`)||(e.preventDefault(),c())}var u=Pr();Sr(`keydown`,$t,l);var d=z(u),f=e=>{var t=Po(),n=R(t),r=B(n,!0),i=V(n,2);let l;M(t),H(()=>{Y(r,G(o)),i.disabled=G(a),l=ci(i,1,`svelte-543j00`,null,l,{flashed:G(s)})}),K(`click`,i,c),J(e,t)};X(d,e=>{G(i)&&e(f)}),J(e,u),Ge()}Cr([`click`]);var Io=q(`

         
        `,1),Lo=q(`

        LATEST GUIDANCE

         
        `,1),Ro=q(`

        CONTEXT

         

        `,1),zo=q(`

        `),Bo=q(`

        `),Vo=q(`
         
        `),Ho=q(`

         
        `,1),Uo=q(`
         
        `),Wo=q(`

        Command unavailable from this observation. Open Codex to inspect the - request.

        `),Go=q(`

        `,1),Ko=q(`

        `),qo=q(` `,1),Jo=q(`
        `),Yo=q(`

        Session connection or refresh unavailable. Context and telemetry may be - stale.

        `),Xo=q(`

        Some quota profile checks are unavailable. Only sessions with freshly - verified quota and settings can be updated; previous outcome notices remain - visible.

        `),Zo=q(` `),Qo=q(` `),$o=q(` `),es=q(``),ts=q(`

        Read only — reply or approve in Codex.

        `),ns=q(`

        `),rs=q(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),is=q(`
        `),as=q(`
        `),os=q(`

        This session is no longer in the current observation. Return to sessions.

        `),ss=q(`

        `),cs=q(``),ls=q(`

        `),us=q(` `),ds=q(`

        `),fs=q(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),ps=q(` `,1),ms=q(`

        `),hs=q(`

        TOKEN ACTIVITY // 30 SECOND SAMPLES

        `),gs=q(`

        TOKENS

        FULL DETAIL →
        `),_s=q(`

        No locally observed sessions yet. Keep Codex running alongside - Codexometer.

        `),vs=q(`

        ↑ ↓ SELECT SESSION // ← LESS DETAIL // → MORE DETAIL // ESC BACK

        `,1),ys=q(`

        SESSION TOTALS

        `,1);function bs(e,t){We(t,!0);let n=(e,t=f,n,r)=>{let i=mt(()=>g(n?.(),!0)),a=mt(()=>g(r?.(),!1));var o=qo(),s=z(o),c=e=>{var n=Io(),r=z(n),i=B(r,!0),a=B(V(r,2),!0);H(()=>{Y(i,t().contextKind===`LAST REPLY`&&!t().streaming?`TASK`:`CURRENT TASK`),Y(a,t().currentTask)}),J(e,n)};X(s,e=>{t().currentTask&&e(c)});var l=V(s,2),u=e=>{var n=Lo(),r=B(V(z(n),2),!0);H(()=>Y(r,t().latestGuidance)),J(e,n)};X(l,e=>{t().latestGuidance&&e(u)});var d=V(l,2),p=e=>{var n=Ro(),r=B(V(z(n),2),!0);Ce(2),H(()=>Y(r,t().approvalContext)),J(e,n)};X(d,e=>{G(a)&&t().contextKind===`APPROVAL REQUEST`&&t().approvalContext&&e(p)});var m=V(d,2),_=e=>{var n=zo();let r;var i=B(n,!0);H(e=>{r=ci(n,1,`attention-note`,null,r,{inferred:t().status===`CHECK SESSION`}),Y(i,e)},[()=>C(t())]),J(e,n)},v=P(()=>C(t())&&(!G(a)||G(h)||t().status===`CHECK SESSION`));X(m,e=>{G(v)&&e(_)});var y=V(m,2),b=e=>{var n=Bo(),r=B(n,!0);H(e=>Y(r,e),[()=>w(t())]),J(e,n)};X(y,e=>{G(i)&&e(b)});var x=V(y,2),S=e=>{var n=Vo(),r=B(n,!0);H(()=>Y(r,t().text||`No session context available.`)),J(e,n)};X(x,e=>{(t().text||!t().workingCommand)&&e(S)});var T=V(x,2),E=e=>{var n=Ho(),r=V(z(n),2),i=R(r),a=V(i),o=e=>{var n=Nr();H(()=>Y(n,`// +${(t().runningCommands||0)-+(t().commandStatus===`running`)} RUNNING`)),J(e,n)};X(a,e=>{!G(h)&&(t().runningCommands||0)>+(t().commandStatus===`running`)&&e(o)});var s=V(a,2),c=e=>{J(e,Nr(`+`))};X(s,e=>{t().runningLimited&&e(c)}),M(r);var l=B(V(r,2),!0);H(e=>{Y(i,`COMMAND // ${e??``} `),Y(l,t().workingCommand)},[()=>G(h)?`UNKNOWN`:(t().commandStatus||`unknown`).toUpperCase()]),J(e,n)};X(T,e=>{t().workingCommand&&e(E)});var ee=V(T,2),D=e=>{var n=Go(),r=V(z(n),2),i=B(r,!0),a=V(r,2),o=e=>{var n=Uo(),r=B(n,!0);H(()=>Y(r,t().command)),J(e,n)},s=e=>{J(e,Wo())};X(a,e=>{t().command?e(o):e(s,-1)}),H(()=>Y(i,G(h)||t().status!==`APPROVAL NEEDED`?`LAST OBSERVED COMMAND`:$.data?.control?`COMMAND REQUEST`:`COMMAND TO APPROVE IN CODEX`)),J(e,n)};X(ee,e=>{(!G(a)||!$.data?.control)&&(t().command||t().status===`APPROVAL NEEDED`)&&e(D)});var te=V(ee,2),ne=e=>{var n=Ko(),r=B(n);H(()=>Y(r,`CONTEXT SOURCE // ${(t().source||`LOCAL`)??``} // OBSERVATION`)),J(e,n)};X(te,e=>{G(a)||e(ne)}),J(e,o)},r=Hi(t,`params`,19,()=>({})),i=P(()=>$.data?.sessions||[]),a=P(()=>$.data?.control&&$.data.profiles||[]),o=P(()=>($.data?.triggers||[]).filter(e=>G(i).some(t=>t.id===e.session)));function s(e,t){if(r().id&&r().id!==t&&G(l)){e.preventDefault();return}b(t)}function c(e){return[`TURN COMPLETE`,`IDLE`,`ACTIVE`].includes(e.status)&&G(o).some(t=>t.session===e.id)?`TRIGGER SET`:e.status}let l=I(!1);function u(e,t){if(r().id&&r().id!==t&&G(l)){e.preventDefault();return}b(t)}yn(()=>{let e=r().id;e&&pr(()=>{ea.selected=e,aa(e,2)})});let d=P(()=>G(i).find(e=>e.id===r().id)),p=P(()=>new URLSearchParams(Ki.querystring).get(`review`)===`profile`&&G(a).some(e=>e.session===r().id&&e.pending)),m=P(()=>G(i).some(e=>e.id===ea.selected)?ea.selected:G(i)[0]?.id),h=P(()=>!$.connected||!!$.data?.sessionsError),v=P(()=>[[`OBSERVED TOKENS`,oa(G(i).reduce((e,t)=>e+t.tokens,0))],[`LISTED SESSIONS`,oa(G(i).length)],...[[`WORKING`,`WORKING`],[`AWAITING APPROVAL`,`APPROVAL NEEDED`],[`AWAITING INPUT`,`INPUT NEEDED`],[`CHECK · INFERRED`,`CHECK SESSION`]].map(([e,t])=>[e,G(h)?`—`:oa(G(i).filter(e=>e.status===t).length)])]),y=P(()=>G(i).filter(e=>[`INPUT NEEDED`,`APPROVAL NEEDED`,`CHECK SESSION`].includes(e.status)));function b(e){ea.selected=e,ur().then(()=>document.querySelector(`.session-row.selected`)?.scrollIntoView({block:`nearest`}))}function x(e,t){if(b(e),r().id){t<0&&(aa(e,2),location.hash=`/sessions`);return}let n=ra(e)+t;n>2?location.hash=`/sessions/`+encodeURIComponent(e):aa(e,n)}function S(e){let t=e.target;if(!(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||t.closest(`input, textarea, select, [contenteditable="true"]`))){if(e.key===`Escape`&&r().id)e.preventDefault(),x(r().id,-1);else if([`ArrowLeft`,`ArrowRight`].includes(e.key)&&(r().id||G(m)))e.preventDefault(),x(r().id||G(m),e.key===`ArrowLeft`?-1:1);else if(!r().id&&[`ArrowUp`,`ArrowDown`].includes(e.key)&&G(i).length){e.preventDefault();let t=G(i).findIndex(e=>e.id===G(m));b(G(i)[Math.max(0,Math.min(G(i).length-1,t+(e.key===`ArrowUp`?-1:1)))].id)}}}function C(e){return G(h)?`Last observation only — refresh unavailable. Check Codex for current state.`:e.status===`CHECK SESSION`?`INFERRED INACTIVITY — a quiet session, not a confirmed input or approval request. Local tools may still be running.`:$.data?.control&&[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(e.status)?`Open full detail for supported live controls; otherwise reply in Codex.`:e.status===`APPROVAL NEEDED`?`OBSERVED APPROVAL SIGNAL — approve or decline in Codex.`:e.status===`INPUT NEEDED`?`OBSERVED INPUT SIGNAL — reply in Codex.`:e.status===`TURN COMPLETE`?`OBSERVED TURN COMPLETION — informational, not an approval request.`:``}function w(e){return e.streaming&&e.contextKind===`LAST REPLY`?`REPLY // STREAMING`:e.contextKind||`LAST ACTIVITY`}var T=ys();Sr(`keydown`,$t,S);var E=z(T),ee=B(V(R(E),2));M(E);var D=V(E,2);let te;Z(D,21,()=>G(v),qr,(e,t)=>{var n=P(()=>_(G(t),2));let r=()=>G(n)[0],i=()=>G(n)[1];var a=Jo(),o=R(a),s=B(o,!0),c=B(V(o,2),!0);M(a),H(()=>{Y(s,r()),Y(c,i())}),J(e,a)}),M(D);var ne=V(D,2),re=B(ne),O=V(ne,2),ie=e=>{J(e,Yo())};X(O,e=>{G(h)&&e(ie)});var ae=V(O,2),oe=e=>{J(e,Xo())};X(ae,e=>{$.data?.profileError&&e(oe)});var se=V(ae,2),ce=e=>{var t=es(),n=R(t);Z(n,17,()=>G(y),qr,(e,t)=>{var n=Zo();let r;var i=B(n);H((e,a)=>{r=ci(n,1,`button`,null,r,{approval:G(t).status===`APPROVAL NEEDED`}),Q(n,`href`,e),Y(i,`${G(t).status??``} - ${a??``} // ${(G(t).name||G(t).directory||G(t).id)??``}`)},[()=>`#/sessions/`+encodeURIComponent(G(t).id),()=>Array.from(G(t).id).slice(-5).join(``).toUpperCase()]),K(`click`,n,()=>b(G(t).id)),J(e,n)});var c=V(n,2);Z(c,17,()=>G(a).filter(e=>e.pending&&G(i).some(t=>t.id===e.session)),qr,(e,t)=>{var n=Qo(),a=B(n);H((e,i,o)=>{Q(n,`title`,r().id&&r().id!==G(t).session&&G(l)?`Finish sending or clear your current draft before switching sessions.`:`Review this session’s quota threshold`),Q(n,`href`,e),Y(a,`QUOTA THRESHOLD ${i??``} // ${o??``}`)},[()=>`#/sessions/`+encodeURIComponent(G(t).session)+`?review=profile`,()=>Array.from(G(t).session).slice(-5).join(``).toUpperCase(),()=>G(i).find(e=>e.id===G(t).session)?.name||G(i).find(e=>e.id===G(t).session)?.directory||G(t).session]),K(`click`,n,e=>u(e,G(t).session)),J(e,n)}),Z(V(c,2),17,()=>G(o),qr,(e,t)=>{var n=$o(),r=B(n);H((e,t,i)=>{Q(n,`href`,e),Y(r,`TRIGGER SET ${t??``} // ${i??``}`)},[()=>`#/sessions/`+encodeURIComponent(G(t).session),()=>Array.from(G(t).session).slice(-5).join(``).toUpperCase(),()=>G(i).find(e=>e.id===G(t).session)?.name||G(i).find(e=>e.id===G(t).session)?.directory]),K(`click`,n,e=>s(e,G(t).session)),J(e,n)}),M(t),J(e,t)},le=P(()=>(G(y).length||G(a).some(e=>e.pending)||G(o).length)&&!G(h));X(se,e=>{G(le)&&e(ce)});var ue=V(se,2),de=e=>{var t=Pr(),i=z(t),o=e=>{var t=as(),i=R(t),o=R(i),s=R(o);let u;var f=V(s);M(o);var m=V(o,2);M(i);var g=V(i,2),_=e=>{var t=Ko(),n=B(t,!0);H(()=>Y(n,G(d).directory)),J(e,t)};X(g,e=>{G(d).name&&G(d).directory&&e(_)});var v=V(g,2),y=B(v),x=V(v,2);let S;var C=R(x),w=R(C);n(w,()=>G(d),()=>!0,()=>!0),M(C);var T=V(C,2),E=e=>{var t=Pr();Kr(z(t),()=>G(d).id,e=>{{let t=P(()=>new URLSearchParams(Ki.querystring).get(`schedule`)===`edit`);No(e,{get session(){return G(d).id},get openScheduler(){return G(t)},get observedCommand(){return G(d).command},get suspended(){return G(p)},onProtectedChange:e=>{L(l,e,!0)}})}}),J(e,t)},ee=e=>{J(e,ts())};X(T,e=>{$.data?.control?e(E):e(ee,-1)}),M(x);var D=V(x,2);Z(D,17,()=>G(a).filter(e=>e.session===G(d).id),e=>e.session,(e,t)=>{var n=is(),r=R(n),i=e=>{var n=ns(),r=B(n,!0);H(()=>Y(r,G(t).notice)),J(e,n)};X(r,e=>{G(t).notice&&e(i)});var a=V(r,2),o=e=>{No(e,{get session(){return G(d).id},review:`profile`})},s=e=>{var t=rs();H(e=>Q(t,`href`,e),[()=>`#/sessions/`+encodeURIComponent(G(d).id)+`?review=profile`]),J(e,t)};X(a,e=>{G(t).pending&&G(p)?e(o):G(t).pending&&e(s,1)}),M(n),H(()=>Q(n,`id`,`quota-profile-`+G(d).id)),J(e,n)});var te=V(D,2),ne=e=>{var t=Pr();Kr(z(t),()=>G(d).id,e=>{Fo(e,{get session(){return G(d)},active:!0})}),J(e,t)};X(te,e=>{G(p)||e(ne)}),M(t),H((e,t)=>{u=ci(s,1,`lamp lit`,null,u,{working:G(d).status===`WORKING`&&!G(h)}),Y(f,`${e??``} // ${(G(d).name||G(d).directory)??``}`),Y(y,`${t??``} TOKENS // ${G(d).id??``} // CONTEXT SOURCE // ${(G(d).source||`LOCAL`)??``}`),S=ui(x,``,S,{display:G(p)?`none`:void 0})},[()=>G(h)?`STALE`:G(p)?`QUOTA THRESHOLD`:c(G(d)),()=>oa(G(d).tokens)]),K(`click`,m,()=>{b(r().id),aa(r().id,2)}),J(e,t)},s=e=>{J(e,os())};X(i,e=>{G(d)?e(o):e(s,-1)}),J(e,t)},fe=e=>{var t=vs(),r=z(t),o=V(R(r),2),s=R(o),l=V(s,2);M(o),M(r);var d=V(r,2);Z(d,17,()=>G(i),e=>e.id,(e,t)=>{let r=P(()=>ra(G(t).id));var i=gs();let o;var s=R(i),l=R(s),d=e=>{var n=ss(),r=R(n),i=B(r);M(n),H(e=>{Q(r,`aria-pressed`,G(m)===G(t).id),Y(i,`${e??``} // ${G(t).name??``}`)},[()=>Array.from(G(t).id).slice(-5).join(``).toUpperCase()]),K(`click`,r,()=>b(G(t).id)),J(e,n)};X(l,e=>{G(t).name&&e(d)});var f=V(l,2),p=R(f),g=R(p);let _;var v=V(g,1,!0);M(p),M(f);var y=V(f,2),S=e=>{var n=cs(),r=B(n,!0);H(()=>{Q(n,`aria-pressed`,G(m)===G(t).id),Y(r,G(t).directory||G(t).id)}),K(`click`,n,()=>b(G(t).id)),J(e,n)};X(y,e=>{G(t).name||e(S)});var C=V(y,2),T=R(C);Ce(),M(C);var E=V(C,2),ee=e=>{var n=Ko(),r=B(n,!0);H(()=>Y(r,G(t).directory)),J(e,n)};X(E,e=>{G(t).name&&G(t).directory&&e(ee)});var D=V(E,2),te=B(D),ne=V(D,2),re=B(ne),O=V(ne,2),ie=R(O),ae=V(ie,2),oe=B(ae,!0),se=V(ae,2);M(O);var ce=V(O,2),le=V(ce,2),ue=e=>{var n=ls(),r=B(n,!0);H(()=>Y(r,G(t).status===`CHECK SESSION`?`INFERRED INACTIVITY`:$.data?.control?`OPEN FULL DETAIL OR REPLY IN CODEX`:G(t).status===`APPROVAL NEEDED`?`APPROVE OR DECLINE IN CODEX`:`REPLY IN CODEX`)),J(e,n)},de=P(()=>!G(h)&&[`APPROVAL NEEDED`,`INPUT NEEDED`,`CHECK SESSION`].includes(G(t).status));X(le,e=>{G(de)&&e(ue)}),M(s);var fe=V(s,2),pe=e=>{var r=ms(),i=R(r),o=R(i),s=B(o,!0),c=V(o,2),l=e=>{var n=us(),r=B(n,!0);H(e=>{Q(n,`href`,e),Y(r,$.data?.control?`REVIEW IN FULL DETAIL ↗`:`APPROVAL IN CODEX ↗`)},[()=>`#/sessions/`+encodeURIComponent(G(t).id)]),J(e,n)};X(c,e=>{!G(h)&&G(t).status===`APPROVAL NEEDED`&&e(l)}),M(i);var d=V(i,2);n(d,()=>G(t),()=>!1);var f=V(d,2);Z(f,17,()=>G(a).filter(e=>e.session===G(t).id),qr,(e,n)=>{var r=ps(),i=z(r),a=e=>{var t=ds(),r=B(t,!0);H(()=>Y(r,G(n).notice)),J(e,t)};X(i,e=>{G(n).notice&&e(a)});var o=V(i,2),s=e=>{var n=fs();H(e=>Q(n,`href`,e),[()=>`#/sessions/`+encodeURIComponent(G(t).id)+`?review=profile`]),K(`click`,n,e=>u(e,G(t).id)),J(e,n)};X(o,e=>{G(n).pending&&e(s)}),J(e,r)});var p=V(f,2);{let e=P(()=>G(m)===G(t).id);Fo(p,{get session(){return G(t)},get active(){return G(e)}})}M(r),H(e=>Y(s,e),[()=>w(G(t))]),J(e,r)};X(fe,e=>{G(r)>0&&e(pe)});var me=V(fe,2),k=e=>{var n=hs(),r=V(R(n),2);{let e=P(()=>(G(t).samples||[]).map(e=>e.tokens));Ya(r,{get values(){return G(e)},capacity:120})}var i=B(V(r,2));M(n),H(()=>Y(i,`LAST ${(G(t).samples?.length||0)??``} SAMPLES // AUTO SCALE`)),J(e,n)};X(me,e=>{G(r)<2&&e(k)}),M(i),H((e,n,a,s,c)=>{o=ci(i,1,`session-row`,null,o,{selected:G(m)===G(t).id,wide:G(r)===2,split:G(r)===1}),Q(i,`aria-label`,`Session `+(G(t).name||G(t).directory||G(t).id)),Q(p,`href`,e),_=ci(g,1,`lamp lit`,null,_,{working:G(t).status===`WORKING`&&!G(h)}),Y(v,n),Y(T,`${a??``} `),Y(te,`${G(t).agents??``} LINKED AGENTS`),Y(re,`ACTIVE // ${s??``}`),ie.disabled=G(r)===0,Q(ae,`aria-expanded`,G(r)>0),Y(oe,G(r)?`HIDE DETAIL`:`SHOW DETAIL`),Q(ce,`href`,c)},[()=>`#/sessions/`+encodeURIComponent(G(t).id),()=>G(h)?`STALE`:c(G(t)),()=>oa(G(t).tokens),()=>sa(G(t).activity),()=>`#/sessions/`+encodeURIComponent(G(t).id)]),K(`click`,p,()=>b(G(t).id)),K(`click`,ie,()=>x(G(t).id,-1)),K(`click`,ae,()=>{b(G(t).id),aa(G(t).id,+!G(r))}),K(`click`,se,()=>x(G(t).id,1)),K(`click`,ce,()=>b(G(t).id)),J(e,i)});var f=V(d,2),p=e=>{J(e,_s())};X(f,e=>{G(i).length||e(p)}),K(`click`,s,()=>ia(1)),K(`click`,l,()=>ia(0)),J(e,t)};X(ue,e=>{r().id?e(de):e(fe,-1)}),H(e=>{Y(ee,`OBSERVED ${e??``}`),te=ci(D,1,`session-totals`,null,te,{stale:G(h)}),Y(re,`${G(h)?`LAST KNOWN TOTALS — live state counts unavailable. `:``}Tokens - observed since this server started for currently listed sessions; linked - agents are already included. Totals can decrease when a session leaves the - list. History samples every 30 seconds. Not account-wide totals.`)},[()=>sa($.data?.sessionsAt)]),J(e,T),Ge()}Cr([`click`]);var xs=q(`

        `),Ss=q(`

        Relative usage/credits are not tokens or quota percentages. Groupings - describe the same usage, not additional consumption.

        `,1),Cs=q(`// APPROXIMATE`),ws=q(`

        Partial accounting: totals may still change.

        `),Ts=q(`

        Percentage of this period's historical allowance, not today's limit. May - exceed 100%. This is not a manual/automatic reset log.

        `,1),Es=q(`

        `,1),Ds=q(`

        This optional account report is unavailable. Token history remains - available; missing data does not mean zero usage.

        `),Os=q(`
        `),ks=q(`
        `),As=q(`

        No usage reported for this day.

        `),js=q(`

        Selected breakdown unavailable; missing does not mean zero.

        `),Ms=q(`

        `,1);function Ns(e,t){We(t,!0);let n=I(`surface`),r=I(0),i=P(()=>t.reports?.daily),a=P(()=>t.reports?.plan),o=P(()=>t.mode===`breakdown`?G(i)?.days.length||0:G(a)?.periods.length||0),s=P(()=>Math.min(G(r),Math.max(0,G(o)-1))),c=P(()=>G(i)?.days[(G(i)?.days.length||0)-1-G(s)]),l=P(()=>G(a)?.periods[G(s)]),u=P(()=>t.mode===`breakdown`?G(i)?.units||``:`%`),d=P(()=>{let e=Object.create(null);if(t.mode===`breakdown`)e=G(c)?.groups[G(n)]||{};else{let t=G(n)===`feature`?`thread_source`:G(n)===`task start`?`turn_trigger`:G(n);for(let n of G(l)?.breakdowns||[])if(n.dimension===t)for(let t of n.rows)e[t.key]=(e[t.key]||0)+t.basis_points/100}return Object.entries(e).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0]))}),f=P(()=>t.mode===`breakdown`?G(c)?.total:G(l)?.used_basis_points==null?null:G(l).used_basis_points/100),p=P(()=>Math.max(1,G(f)||0,...G(d).map(([,e])=>e))),m=e=>e==null?`UNKNOWN`:e.toLocaleString(`en-GB`,{maximumFractionDigits:2});var h=Ms(),g=z(h),v=R(g),y=V(R(v)),b=R(y);b.value=b.__value=`surface`;var x=V(b);x.value=x.__value=`model`;var S=V(x);S.value=S.__value=`feature`;var C=V(S);C.value=C.__value=`task start`,M(y),mi(y),M(v);var w=V(v,2),T=V(w,2),E=B(V(T,2),!0);M(g);var ee=V(g,2),D=R(ee),te=B(D,!0),ne=V(D,2),re=B(ne),O=V(ne,2),ie=e=>{var t=Ss(),n=z(t),r=B(n),a=V(n,2),o=e=>{var t=xs(),n=B(t);H(()=>Y(n,`Data as of ${G(i).dataAsOf??``}`)),J(e,t)};X(a,e=>{G(i).dataAsOf&&e(o)});var s=B(V(a,2));Ce(2),H((e,t)=>{Y(r,`Latest fetch ${e??``} // queried ${G(i).from??``} → ${G(i).through??``}. - Reports are fetched from OpenAI and are not saved between runs.`),Y(s,`${(G(c)?.date||`No daily buckets reported`)??``} // ${t??``} - ${G(u)??``}`)},[()=>sa(G(i).fetchedAt),()=>m(G(f))]),J(e,t)},ae=e=>{var t=Es(),n=z(t),r=R(n);let i;var o=B(r,!0),s=V(r),c=e=>{J(e,Cs())};X(s,e=>{G(a).approximate&&e(c)});var u=V(s);M(n);var d=V(n,2),p=R(d),h=V(p),g=e=>{var t=Nr();H(()=>Y(t,`// Boundary tolerance ${G(a).boundary_tolerance_seconds??``}s`)),J(e,t)};X(h,e=>{G(a).boundary_tolerance_seconds!=null&&e(g)}),M(d);var _=V(d,2),v=e=>{var t=Ts(),n=z(t),r=R(n),i=V(r);let a;var o=B(i);M(n);var s=V(n,2),c=B(s),u=V(s,2),d=e=>{J(e,ws())};X(u,e=>{G(l).accounting_complete||e(d)}),Ce(2),H(e=>{Y(r,`${G(l).window_minutes??``} MIN // ${G(l).plan_type??``} // `),a=ci(i,1,`svelte-1fbui7h`,null,a,{muted:G(f)==null,"quota-near":G(f)!=null&&G(f)>=80&&G(f)<100,"quota-full":G(f)!=null&&G(f)>=100}),Y(o,`USED ${e??``}${G(f)==null?``:`%`}`),Y(c,`${G(l).starts_at??``} → ${G(l).ends_at??``}`)},[()=>m(G(f))]),J(e,t)};X(_,e=>{G(l)&&e(v)}),H(e=>{i=ci(r,1,`svelte-1fbui7h`,null,i,{"quality-warning":!G(a).coverage_complete}),Y(o,G(a).coverage_complete?`Reported range complete`:`Partial coverage`),Y(u,` // Latest fetch ${e??``}`),Y(p,`Coverage starts ${(G(a).coverage_start||`unknown`)??``} // Data as of ${(G(a).data_as_of||`unknown`)??``}`)},[()=>sa(G(a).fetchedAt)]),J(e,t)},oe=e=>{J(e,Ds())};X(O,e=>{t.mode===`breakdown`&&G(i)?e(ie):t.mode===`periods`&&G(a)?e(ae,1):e(oe,-1)});var se=V(O,2),ce=e=>{var n=ks(),r=R(n),i=B(V(R(r),2),!0);M(r),Z(V(r,2),17,()=>G(d),qr,(e,n,r)=>{var i=P(()=>_(G(n),2));let a=()=>G(i)[0],o=()=>G(i)[1];var s=Os();let c;var l=R(s),u=B(l,!0),d=V(l,2),f=R(d);let h;M(d);var g=B(V(d,2));M(s),H((e,n,i)=>{c=ci(s,1,`report-row svelte-1fbui7h`,null,c,{unknown:e,alternate:r%2==1}),Q(l,`title`,a()),Y(u,a()),h=ui(f,``,h,{width:n}),Y(g,`${i??``}${t.mode===`periods`?`%`:``}`)},[()=>a().trim().toLowerCase()===`unknown`,()=>`${Math.max(0,100*o()/G(p))}%`,()=>m(o())]),J(e,s)}),M(n),H(()=>Y(i,t.mode===`breakdown`?G(u):`QUOTA USED`)),J(e,n)},le=e=>{J(e,As())},ue=e=>{J(e,js())};X(se,e=>{G(d).length?e(ce):t.mode===`breakdown`&&G(c)?.total===0&&G(c)?.groups[G(n)]!=null?e(le,1):(G(i)&&t.mode===`breakdown`||G(a)&&t.mode===`periods`)&&e(ue,2)}),M(ee),H(()=>{w.disabled=G(s)>=G(o)-1,T.disabled=G(s)===0,Y(E,G(o)?`${G(s)+1} / ${G(o)}`:`NO DATA`),Y(te,t.mode===`breakdown`?`DAILY BREAKDOWN`:`QUOTA WINDOWS`),Y(re,`${(t.mode===`breakdown`?t.reports?.dailyStatus||`UNAVAILABLE`:t.reports?.planStatus||`UNAVAILABLE`)??``} // UTC`)}),hi(y,()=>G(n),e=>L(n,e)),K(`click`,w,()=>L(r,G(s)+1)),K(`click`,T,()=>L(r,G(s)-1)),J(e,h),Ge()}Cr([`click`]);var Ps=864e5;function Fs(e,t){let n=new Date(e);n.setUTCDate(1),n.setUTCMonth(n.getUTCMonth()+t);let r=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return n.setUTCDate(Math.min(e.getUTCDate(),r)),n}function Is(e,t,n){let r=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));for(let e=0;;e++){let i=Fs(r,-t),a=new Date(i.getTime()+Ps);if(e===n)return{start:a,end:r};r=i}}var Ls=q(``),Rs=q(``,1),zs=q(`

        History refresh failed. Any displayed history is the last successful - observation.

        `),Bs=q(`

        Token history unavailable; other reports may still be available.

        `),Vs=q(``),Hs=q(`
        `),Us=q(`

        LESS ░ ▒ ▓ █ MORE // HOVER FOR DATE AND TOKENS

        `,1),Ws=q(`
        `,1),Gs=q(` `),Ks=q(`

        LIFETIME TOKENS

        PEAK DAY

        CURRENT STREAK

        DAYS

        LONGEST TURN

        SECONDS

        LONGEST STREAK

        DAYS

        OPENAI // UTC

        Accessible data table
        Date (UTC)Tokens

        `,1),qs=q(`

        History unavailable or awaiting a matching account observation. Missing - history is not treated as zero usage.

        `),Js=q(`

        USAGE // ACCOUNT HISTORY

        Account-wide history reported by Codex, not the local Sessions counter. Dates - use UTC. Allowance history is approximate where indicated; reset causes are - not provided.

        `,1);function Ys(e,t){We(t,!0);let n=I(`daily`),r=I(12),i=I(0),a=P(()=>{let e=$.data?.usage?.dailyUsageBuckets;if(!e)return[];let{start:t,end:n}=Is(new Date,G(r),G(i)),a=new Map;for(let t of e)!Number.isFinite(t.tokens)||t.tokens<0||a.set(t.startDate,(a.get(t.startDate)||0)+t.tokens);let o=[];for(let e=t;e<=n;e=new Date(e.getTime()+864e5)){let t=e.toISOString().slice(0,10);o.push({date:t,tokens:a.get(t)||0})}return o}),o=P(()=>Math.max(1,...G(a).map(e=>e.tokens))),s=P(()=>G(a).length?new Date(G(a)[0].date+`T00:00:00Z`).getUTCDay():0),c=P(()=>{if(G(n)===`monthly`){let e=new Map;for(let t of G(a))e.set(t.date.slice(0,7),(e.get(t.date.slice(0,7))||0)+t.tokens);return[...e].map(([e,t])=>({date:e,tokens:t}))}let e=0;return G(a).map(t=>({date:t.date,tokens:e+=t.tokens}))});var l=Js(),u=V(z(l),4);Z(u,20,()=>[[`daily`,`Daily`],[`monthly`,`Monthly`],[`cumulative`,`Cumulative`],[`breakdown`,`Breakdown`],[`periods`,`Windows`]],qr,(e,t)=>{var r=P(()=>_(t,2));let a=()=>G(r)[0],o=()=>G(r)[1];var s=Ls();let c;var l=B(s,!0);H(()=>{Q(s,`aria-pressed`,G(n)===a()),c=ci(s,1,``,null,c,{active:G(n)===a()}),Y(l,o())}),K(`click`,s,()=>{L(n,a(),!0),L(i,0)}),J(e,s)}),M(u);var d=V(u,2),f=R(d),p=e=>{var t=Rs(),n=z(t),a=V(R(n)),o=R(a);o.value=o.__value=6;var s=V(o);s.value=s.__value=12,M(a),mi(a),M(n);var c=V(n),l=V(c);H(()=>l.disabled=G(i)===0),K(`change`,a,()=>L(i,0)),hi(a,()=>G(r),e=>L(r,e)),K(`click`,c,()=>qt(i)),K(`click`,l,()=>qt(i,-1)),J(e,t)};X(f,e=>{G(n)!==`breakdown`&&G(n)!==`periods`&&e(p)}),M(d);var m=V(d,2),h=e=>{J(e,zs())};X(m,e=>{$.data?.usageError&&e(h)});var g=V(m,2),v=e=>{J(e,Bs())};X(g,e=>{$.data?.usage?.tokenStatus===`UNAVAILABLE`&&G(n)!==`breakdown`&&G(n)!==`periods`&&e(v)});var y=V(g,2),b=e=>{var t=Pr();Kr(z(t),()=>G(n),e=>{{let t=P(()=>$.data?.usage?.reports);Ns(e,{get reports(){return G(t)},get mode(){return G(n)}})}}),J(e,t)},x=e=>{var t=Ks(),r=z(t),i=R(r),l=B(V(R(i),2),!0);M(i);var u=V(i,2),d=B(V(R(u),2),!0);M(u);var f=V(u,2),p=V(R(f),2),m=R(p);Ce(),M(p),M(f);var h=V(f,2),g=V(R(h),2),_=R(g);Ce(),M(g),M(h);var v=V(h,2),y=V(R(v),2),b=R(y);Ce(),M(y),M(v),M(r);var x=V(r,4),S=R(x),C=B(S),w=V(S,2),T=e=>{var t=Us(),n=z(t),r=R(n),i=R(r);Z(i,17,()=>Array(G(s)),qr,(e,t)=>{J(e,Vs())}),Z(V(i,2),17,()=>G(a),qr,(e,t)=>{var n=Hs();let r,i;H(e=>{r=ci(n,1,`heat-cell`,null,r,{zero:G(t).tokens===0}),Q(n,`title`,e),i=ui(n,``,i,{opacity:G(t).tokens?.25+.75*G(t).tokens/G(o):1})},[()=>`${G(t).date}: ${oa(G(t).tokens)} tokens`]),J(e,n)}),M(r),M(n),Ce(2),J(e,t)},E=e=>{var t=Ws(),r=z(t);{let e=P(()=>G(c).map(e=>e.tokens)),t=P(()=>G(n)+` usage`);Ya(r,{get values(){return G(e)},get label(){return G(t)}})}var i=V(r,2),a=R(i),o=B(a,!0),s=B(V(a),!0);M(i),H(e=>{Y(o,G(c)[0]?.date),Y(s,e)},[()=>G(c).at(-1)?.date]),J(e,t)};X(w,e=>{G(n)===`daily`?e(T):e(E,-1)});var ee=V(w,2),D=V(R(ee),2),te=R(D),ne=V(R(te));Z(ne,21,()=>G(n)===`daily`?G(a):G(c),qr,(e,t)=>{var n=Gs(),r=R(n),i=B(r,!0),a=B(V(r),!0);M(n),H(e=>{Y(i,G(t).date),Y(a,e)},[()=>oa(G(t).tokens)]),J(e,n)}),M(ne),M(te),M(D),M(ee),M(x);var re=B(V(x,2));H((e,t,n,r,i,o,s)=>{Y(l,e),Y(d,t),Y(m,`${n??``} `),Y(_,`${r??``} `),Y(b,`${i??``} `),Y(C,`${G(a)[0]?.date??``} — ${o??``}`),Y(re,`OBSERVED ${s??``} // CUMULATIVE IS FOR THE SELECTED PERIOD`)},[()=>oa($.data.usage.summary.lifetimeTokens),()=>oa($.data.usage.summary.peakDailyTokens),()=>oa($.data.usage.summary.currentStreakDays),()=>oa($.data.usage.summary.longestRunningTurnSec),()=>oa($.data.usage.summary.longestStreakDays),()=>G(a).at(-1)?.date,()=>sa($.data.usageAt)]),J(e,t)},S=e=>{J(e,qs())};X(y,e=>{G(n)===`breakdown`||G(n)===`periods`?e(b):$.data?.usage&&$.data.usage.dailyUsageBuckets!==null?e(x,1):e(S,-1)}),J(e,l),Ge()}Cr([`click`,`change`]);var Xs=q(`

        Page not found

        Return to Quota

        `,1);function Zs(e){var t=Xs();Ce(2),J(e,t)}var Qs=q(` `),$s=q(`

        `),ec=q(`

        Connecting to your local Codexometer…

        `),tc=q(``),nc=q(`
        CODEXOMETER

        Your quota. Your sessions. Your command centre.

        `);function rc(e,t){We(t,!0);let n={"/":Ka,"/quota/:view?":Ka,"/sessions/:id?":bs,"/usage":Ys,"*":Zs},r={quota:/^(?:\/|\/quota(?:\/[^/]+)?\/?)$/,sessions:/^\/sessions(?:\/[^/]+)?\/?$/,usage:/^\/usage\/?$/},i=I(`hacker`),a=[`hacker`,`rust`,`blue-steel`,`ultraviolet`,`nightshade`];yn(()=>{ta()}),yn(()=>{if($.data)for(let[e,t]of Object.entries(r))t.test(Ki.location)&&(ea.tab=e)}),Ui(()=>{try{let e=localStorage.getItem(`codexometer.web.theme`);e&&a.includes(e)&&L(i,e,!0)}catch{}return fa()});function o(){try{localStorage.setItem(`codexometer.web.theme`,G(i))}catch{}}var s=nc(),c=R(s),l=V(R(c),2),u=R(l);let d;var f=V(u,1,!0),p=B(V(f));M(l),M(c);var m=V(c,2);Z(m,21,()=>Object.entries(r),qr,(e,t)=>{var n=P(()=>_(G(t),2));let r=()=>G(n)[0],i=()=>G(n)[1],a=P(()=>i().test(Ki.location));var o=Qs();let s;var c=B(o,!0);H(e=>{Q(o,`href`,r()===`quota`?`#/quota/`+ea.view:`#/`+r()),Q(o,`aria-current`,G(a)?`page`:void 0),s=ci(o,1,``,null,s,{active:G(a)}),Y(c,e)},[()=>r().toUpperCase()]),J(e,o)}),M(m);var h=V(m,2),g=R(h),v=e=>{var t=$s(),n=B(t,!0);H(()=>Y(n,$.error)),J(e,t)};X(g,e=>{$.error&&e(v)});var y=V(g,2),b=e=>{Yi(e,{get routes(){return n}})},x=e=>{J(e,ec())};X(y,e=>{$.data?e(b):$.error||e(x,1)}),M(h);var S=V(h,2),C=R(S),w=B(C),T=V(C,2),E=B(T,!0),ee=V(T,2),D=V(R(ee));Z(D,21,()=>a,qr,(e,t)=>{var n=tc(),r=B(n,!0),i={};H(e=>{Y(r,e),i!==(i=G(t))&&(n.value=(n.__value=i)??``)},[()=>G(t).replace(`-`,` `).toUpperCase()]),J(e,n)}),M(D),mi(D),M(ee),M(S),M(s),H(()=>{Q(s,`data-theme`,G(i)),d=ci(u,1,`lamp`,null,d,{lit:$.connected}),Y(f,$.connected?`CONNECTED`:`OFFLINE`),Y(p,`EXPERIMENTAL // ${$.data?.control?`SESSION CONTROL`:`READ ONLY`}`),Y(w,`v${($.data?.version||`…`)??``} // LOCAL ONLY`),Y(E,$.data?.control?`Session control enabled. Stop the server to revoke access.`:`No actions can be sent from this preview.`)}),K(`change`,D,o),hi(D,()=>G(i),e=>L(i,e)),J(e,s),Ge()}Cr([`change`]),Br(rc,{target:document.getElementById(`app`)}); \ No newline at end of file diff --git a/internal/web/dist/assets/index-CnNJF8v9.css b/internal/web/dist/assets/index-CnNJF8v9.css deleted file mode 100644 index 4c9fb1f..0000000 --- a/internal/web/dist/assets/index-CnNJF8v9.css +++ /dev/null @@ -1 +0,0 @@ -.observation-details.svelte-1wk8llw{font-size:12px}summary.svelte-1wk8llw{cursor:pointer;color:var(--accent)}.observation-table.svelte-1wk8llw{max-height:240px;overflow:auto}.zone-canvas.svelte-1wk8llw{flex:1;min-height:170px;margin-top:6px;position:relative}svg.svelte-1wk8llw{width:100%;height:100%;display:block;position:absolute;inset:0}text.svelte-1wk8llw{fill:var(--ink);font:14px Cascadia Code,Consolas,monospace}.axis-title.svelte-1wk8llw{letter-spacing:.04em;font-size:12px}.grid.svelte-1wk8llw{stroke:#fff;stroke-opacity:.14;stroke-width:1px}.axes.svelte-1wk8llw{stroke:var(--ink);stroke-width:1.5px;fill:none}.pace-line.svelte-1wk8llw{stroke:#fff;stroke-width:2px;stroke-dasharray:6 4}.position-halo.svelte-1wk8llw{fill:#101820;stroke:#fff;stroke-width:1.5px}.position-dot.svelte-1wk8llw{fill:#fff}.observation-trail.svelte-1wk8llw{fill:none;stroke:#fff;stroke-width:2.5px;stroke-linejoin:round}.trail-start.svelte-1wk8llw{fill:none;stroke:#fff;stroke-width:2px}.trail-caption.svelte-1wk8llw{text-align:center;font-size:11px}.zone-caption.svelte-1wk8llw{color:var(--accent);text-align:center}.saved-prompt.svelte-1oupzfc{white-space:pre-wrap;overflow-wrap:anywhere}fieldset.svelte-1oupzfc{border:1px solid;margin:.5rem 0;padding:.35rem .6rem}.decision.svelte-1oupzfc,.answer.svelte-1oupzfc{margin:.3rem 0;display:block}.decision.svelte-1oupzfc code:where(.svelte-1oupzfc),.decision.svelte-1oupzfc span:where(.svelte-1oupzfc){overflow-wrap:anywhere;margin:.3rem 0 .3rem 1.5rem;display:block}textarea.svelte-1oupzfc,.answer.svelte-1oupzfc input:where(.svelte-1oupzfc),.answer.svelte-1oupzfc select:where(.svelte-1oupzfc){box-sizing:border-box;background:var(--bg);width:100%;color:inherit;font:inherit;border:1px solid;margin-top:.4rem;padding:.5rem;display:block}textarea.svelte-1oupzfc{resize:vertical;background:color-mix(in srgb, currentColor 8%, var(--bg))}button.svelte-1oupzfc{margin:.3rem .5rem .3rem 0}h3.svelte-1oupzfc,p.svelte-1oupzfc{margin-block:.4rem}.sent.svelte-1oupzfc{color:var(--accent)}.session-copy.svelte-543j00{justify-content:flex-end;align-items:center;gap:8px;margin-top:auto;padding-top:6px;display:flex}span.svelte-543j00{color:var(--muted);overflow-wrap:anywhere;font-size:12px}button.svelte-543j00{color:var(--accent);flex-shrink:0;padding:3px 7px}button.svelte-543j00:hover,button.flashed.svelte-543j00{color:var(--bg);background:var(--accent)}h3.svelte-1fbui7h,.window-dates.svelte-1fbui7h,.report-value.svelte-1fbui7h{color:var(--accent);font-weight:700}.quality-warning.svelte-1fbui7h,.quota-near.svelte-1fbui7h{color:var(--approval)}.quota-full.svelte-1fbui7h{color:#ff6680}.alternate.svelte-1fbui7h .report-fill:where(.svelte-1fbui7h){background:radial-gradient(circle, var(--panel) .7px, transparent .9px) 0 0 / 3px 3px, var(--accent)}.unknown.svelte-1fbui7h,.unknown.svelte-1fbui7h .report-value:where(.svelte-1fbui7h){color:var(--muted)}.unknown.svelte-1fbui7h .report-fill:where(.svelte-1fbui7h){background:var(--muted);opacity:1}.report-bars.svelte-1fbui7h{grid-template-columns:minmax(5rem,1fr) minmax(2rem,3fr) auto;gap:.6rem;display:grid}.report-row.svelte-1fbui7h,.report-head.svelte-1fbui7h{grid-column:1/-1;grid-template-columns:subgrid;align-items:center;gap:.6rem;display:grid}.report-head.svelte-1fbui7h{color:var(--muted);font-size:.85rem}.report-head.svelte-1fbui7h>span:where(.svelte-1fbui7h):last-child,.report-value.svelte-1fbui7h{text-align:right}.report-row.svelte-1fbui7h>span:where(.svelte-1fbui7h):first-child{overflow-wrap:anywhere}.report-track.svelte-1fbui7h{background:var(--panel);height:1rem}.report-fill.svelte-1fbui7h{background:var(--accent);height:100%}:root{font-synthesis:none;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark;background:#080e0c;font-family:Cascadia Code,SFMono-Regular,Consolas,monospace}*{box-sizing:border-box}body{margin:0}.shell{--accent:#80edac;--approval:#ffca58;--muted:#98aaa0;--edge:#31473a;--panel:#101c16;--bg:#080e0c;--ink:#e2eee5;background:var(--bg);height:100dvh;color:var(--ink);grid-template-rows:auto auto minmax(0,1fr) auto;padding:clamp(10px,1.2vw,20px);display:grid}.shell[data-theme=rust]{--approval:#ff8a3d;--accent:#ffbc75;--muted:#bfac95;--edge:#59412c;--panel:#261b14;--bg:#140e0a}.shell[data-theme=blue-steel]{--approval:#e8c46a;--accent:#85c8ff;--muted:#9cacc4;--edge:#334d69;--panel:#142235;--bg:#0b1421}.shell[data-theme=ultraviolet]{--approval:#f9a8d4;--accent:#c5adff;--muted:#b3a6c9;--edge:#4b3c68;--panel:#241a35;--bg:#140d22}.shell[data-theme=nightshade]{--approval:#8f7cff;--accent:#e59bff;--muted:#c6a7cf;--edge:#673976;--panel:#301739;--bg:#1c0b24}header,.spread,footer,.controls{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:10px;display:flex}header{margin-bottom:10px}.brand{letter-spacing:.08em;color:var(--accent);text-shadow:0 0 22px color-mix(in srgb, var(--accent) 20%, transparent);font-size:clamp(22px,2.5vw,32px);font-weight:800;text-decoration:none}header p{color:var(--muted);margin:3px 0 0;font-size:13px}.connection{color:var(--accent);text-align:right}small,.eyebrow{letter-spacing:.04em;font-size:12px}.connection small{color:var(--muted);margin-top:4px;display:block}.lamp{background:var(--muted);border-radius:50%;width:9px;height:9px;margin-right:9px;display:inline-block}.lamp.lit{background:var(--accent);box-shadow:0 0 8px color-mix(in srgb, var(--accent) 40%, transparent)}.working{animation:1.5s ease-in-out infinite pulse}@keyframes pulse{50%{opacity:.3}}nav{flex-wrap:wrap;gap:6px;margin-bottom:10px;display:flex}nav a,button,.button,select{font:inherit;color:var(--accent);border:1px solid var(--edge);background:var(--panel);cursor:pointer;border-radius:3px;padding:7px 11px;font-size:13px;text-decoration:none}button:hover,.button:hover,nav a:hover{border-color:var(--accent)}nav a.active,nav button.active{background:var(--accent);color:var(--bg);border-color:var(--accent)}:focus-visible{outline:2px solid var(--accent);outline-offset:4px}.secondary{margin-bottom:8px}.secondary a,.secondary button{padding:6px 10px;font-size:12px}main{scrollbar-gutter:stable;flex-direction:column;min-width:0;min-height:0;display:flex;overflow:auto}main>*{flex-shrink:0}.panel{border:1px solid var(--edge);border-top:2px solid var(--accent);background:var(--panel);border-radius:4px;min-width:0;padding:clamp(10px,1vw,16px)}h1{color:var(--accent);font-size:20px}h2{letter-spacing:.04em;color:var(--accent);overflow-wrap:anywhere;margin:0 0 10px;font-size:13px}h3{overflow-wrap:anywhere;font-size:13px}p{margin:6px 0;font-size:13px;line-height:1.45}a{color:var(--accent)}.muted,.eyebrow{color:var(--muted)}.notice{color:#ffe0aa;background:#332611;border-left:3px solid #ffc26e;padding:12px 16px}.empty{color:var(--muted);padding:35px 0}.quota-grid{flex:1 0 auto;grid-auto-rows:minmax(220px,1fr);gap:10px;display:grid}.quota-card{flex-direction:column;min-height:0;display:flex}.quota-card>:not(.meter-graphic){flex-shrink:0}.meter-graphic{flex-direction:column;flex:1;min-height:100px;display:flex}.bar-graphic{min-height:65px}.quota-card .gauge{flex:2;height:auto;min-height:16px;margin:7px 0}.quota-card .timeline{flex:1;min-height:8px}.quota-card .pace{flex:1;height:auto;min-height:20px;margin:20px 14px 8px}.quota-card .readout{margin:6px 0;font-size:clamp(18px,2vw,28px)}.quota-grid.zone{grid-template-columns:repeat(auto-fit,minmax(min(100%,420px),1fr));grid-auto-rows:minmax(330px,1fr)}.quota-grid.radial{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));grid-auto-rows:minmax(260px,1fr)}.gauge{background:var(--edge);height:35px;margin:15px 0;overflow:hidden}.gauge>div{background:repeating-linear-gradient(90deg, var(--accent) 0, var(--accent) 9px, transparent 9px, transparent 12px);height:100%;transition:width .5s}.gauge.timeline{height:14px}.pie-wrap{flex:1;min-height:100px;margin:6px 0;position:relative}.pie-wrap svg{width:100%;height:100%;position:absolute;inset:0}.pie-base{fill:var(--edge);stroke:var(--accent);stroke-width:1px}.pie-fill{fill:var(--accent)}.pace{background:linear-gradient(90deg, #6d3838, var(--edge) 50%, #376348);height:28px;margin:28px 14px 15px;position:relative}.pace-mid{border-left:2px solid var(--ink);height:100%;position:absolute;left:50%}.pace-marker{color:var(--accent);font-size:27px;position:absolute;top:-16px;transform:translate(-50%)}.readout{overflow-wrap:anywhere;color:var(--accent);margin:18px 0;font-size:clamp(22px,3vw,34px)}.credit+.credit{border-top:1px solid var(--edge);padding-top:20px}.credit{margin-top:24px}.session-row{grid-template-columns:minmax(210px,1.1fr) minmax(0,1.2fr) minmax(0,1.5fr);align-items:stretch;gap:14px;margin:18px 0;display:grid}.session-totals{grid-template-columns:repeat(auto-fit,minmax(min(145px,100%),1fr));gap:8px;margin:8px 0;display:grid}.session-totals>div{border:1px solid var(--edge);min-width:0;padding:10px}.session-totals dt{color:var(--muted);font-size:11px}.session-totals dd{color:var(--accent);overflow-wrap:anywhere;margin:6px 0 0;font-size:24px}.session-totals.stale dd{color:var(--muted)}.session-row.selected{outline:1px solid var(--accent);outline-offset:4px}.session-row.wide .context{grid-column:2/-1}.detail-controls{flex-wrap:wrap;gap:6px;display:flex}.attention-summary{flex-wrap:wrap;gap:8px;margin-block:8px;display:flex}.attention-summary .approval{color:var(--approval);border-color:var(--approval)}.attention-summary .approval:hover{background:color-mix(in srgb, var(--approval) 12%, var(--panel))}.attention-summary .approval:focus-visible{outline-color:var(--approval)}.attention-note,.attention-badge{color:var(--accent);border-left:3px solid;padding-left:8px}.attention-note.inferred{color:var(--muted)}.attention-badge{font-size:12px}.session-select{text-align:left;overflow-wrap:anywhere;max-width:100%}.status-detail{color:inherit;text-decoration:none}.status-detail:hover{text-decoration:underline}button:disabled{opacity:.4;cursor:default}.session-row .graph-panel{flex-direction:column;grid-column:2/-1;display:flex}.session-row.split .graph-panel{grid-column:auto}.session-row .button,.session-row button{margin-top:8px;display:inline-block}.context pre{max-height:230px;overflow:auto}.session-row .context{flex-direction:column;display:flex}pre{font:inherit;white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.7}.full-detail{margin-top:6px}.detail-heading{flex-wrap:wrap;justify-content:space-between;align-items:center;gap:6px 12px;display:flex}.detail-heading h2{flex:250px;min-width:0;margin:0}.detail-metadata{overflow-wrap:anywhere}.detail-workspace{border-top:1px solid var(--edge);flex-direction:column;gap:10px;margin-top:8px;padding-top:4px;display:flex}.detail-context,.detail-workspace .session-actions{min-width:0}.detail-workspace .session-actions{border-top:1px solid var(--edge);padding-top:6px}.full-detail h3{margin-block:8px}.full-detail pre{margin-block:8px;line-height:1.5}.full-detail hr{margin-block:12px}.full-detail .command,.full-detail .notice{padding:8px 10px}.command{background:var(--bg);border-left:3px solid var(--accent);padding:16px}hr{border:0;border-top:1px solid var(--edge);margin:24px 0}.chart{border-bottom:1px solid var(--muted);align-items:flex-end;gap:2px;height:clamp(120px,22vh,320px);margin-top:18px;display:flex}.chart-bar{background:var(--accent);flex:1;min-width:0;max-height:100%}.controls{justify-content:flex-start;margin:20px 0}.summary-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:16px;margin:20px 0;display:grid}.thresholds-panel{padding:clamp(14px,2vw,22px)}.thresholds-panel h1{margin-top:0}.threshold-list{gap:8px;margin-top:16px;display:grid}.threshold-list article{border:1px solid var(--edge);grid-template-columns:minmax(64px,.5fr) minmax(220px,3fr) minmax(64px,.6fr) minmax(120px,1.2fr);align-items:center;gap:12px;padding:10px 12px;display:grid}.threshold-list article.active{border-color:var(--accent);box-shadow:inset 3px 0 0 var(--accent)}.threshold-list article.next{border-color:var(--approval);box-shadow:inset 3px 0 0 var(--approval)}.threshold-list p{color:var(--muted);margin:3px 0 0;font-size:12px}.threshold-trigger{color:var(--accent);font-size:22px;font-weight:800}.threshold-mode,.threshold-state{color:var(--muted);font-size:12px;font-weight:700}.threshold-list article.active .threshold-state{color:var(--accent)}.threshold-list article.next .threshold-state{color:var(--approval)}.heat-scroll{overflow-x:auto}.heatmap{grid-template-rows:repeat(7,13px);grid-auto-columns:minmax(9px,1fr);grid-auto-flow:column;gap:4px;min-width:620px;margin:25px 0;display:grid}.heat-cell{background:var(--accent);border-radius:2px}.heat-cell.zero{background:var(--edge)}.table-scroll{max-height:280px;overflow:auto}table{border-collapse:collapse;width:100%;margin-top:15px}th,td{text-align:left;border-bottom:1px solid var(--edge);padding:8px}summary{cursor:pointer;color:var(--accent);padding-top:14px}footer{border-top:1px solid var(--edge);color:var(--muted);margin-top:8px;padding-top:8px;font-size:11px}footer select{padding:6px}@media (width<=850px){.session-row{grid-template-columns:minmax(0,1fr)}.session-row.wide .context,.session-row .graph-panel{grid-column:auto}.connection{text-align:left}.threshold-list article{grid-template-columns:64px minmax(0,1fr)}.threshold-mode,.threshold-state{grid-column:2}}@media (prefers-reduced-motion:reduce){*,:before,:after{transition:none!important;animation:none!important}} diff --git a/internal/web/dist/index.html b/internal/web/dist/index.html index a7a9e1a..4bf5b01 100644 --- a/internal/web/dist/index.html +++ b/internal/web/dist/index.html @@ -5,8 +5,8 @@ Codexometer // Experimental web - - + +
        diff --git a/internal/web/state.go b/internal/web/state.go index 59573aa..d42d0cd 100644 --- a/internal/web/state.go +++ b/internal/web/state.go @@ -21,26 +21,27 @@ type Source interface { // Deliberately project source types: never serialize approval/input capabilities, // account fingerprints, arbitrary errors, or authentication objects to browsers. type session struct { - CurrentTask string `json:"currentTask,omitempty"` - LatestGuidance string `json:"latestGuidance,omitempty"` - Streaming bool `json:"streaming,omitempty"` - Name string `json:"name,omitempty"` - ID string `json:"id"` - Directory string `json:"directory"` - Tokens int64 `json:"tokens"` - Agents int `json:"agents"` - Status string `json:"status"` - ContextKind string `json:"contextKind"` - Text string `json:"text"` - Command string `json:"command"` - WorkingCommand string `json:"workingCommand,omitempty"` - ApprovalContext string `json:"approvalContext,omitempty"` - CommandStatus string `json:"commandStatus,omitempty"` - RunningCommands int `json:"runningCommands,omitempty"` - RunningLimited bool `json:"runningLimited,omitempty"` - Source string `json:"source"` - Activity time.Time `json:"activity"` - Samples []sample `json:"samples"` + FileChanges []codex.FileDiffLine `json:"fileChanges,omitempty"` + CurrentTask string `json:"currentTask,omitempty"` + LatestGuidance string `json:"latestGuidance,omitempty"` + Streaming bool `json:"streaming,omitempty"` + Name string `json:"name,omitempty"` + ID string `json:"id"` + Directory string `json:"directory"` + Tokens int64 `json:"tokens"` + Agents int `json:"agents"` + Status string `json:"status"` + ContextKind string `json:"contextKind"` + Text string `json:"text"` + Command string `json:"command"` + WorkingCommand string `json:"workingCommand,omitempty"` + ApprovalContext string `json:"approvalContext,omitempty"` + CommandStatus string `json:"commandStatus,omitempty"` + RunningCommands int `json:"runningCommands,omitempty"` + RunningLimited bool `json:"runningLimited,omitempty"` + Source string `json:"source"` + Activity time.Time `json:"activity"` + Samples []sample `json:"samples"` } type sample struct { @@ -334,6 +335,7 @@ func (s *store) live(l codex.LiveUsageSnapshot, err error, now time.Time) { Command: row.Context.CommandDetails.Command, Source: row.Context.Source, Activity: row.LastActivity, WorkingCommand: activity.Command, CommandStatus: activity.CommandStatus, ApprovalContext: approvalContext, + FileChanges: codex.FileDiffLines(row.Context.FileChanges), CurrentTask: codex.SanitizeSessionContext(row.Context.CurrentTask), LatestGuidance: codex.SanitizeSessionContext(row.Context.LatestGuidance), Streaming: row.Context.Streaming, RunningCommands: activity.RunningCommands, RunningLimited: activity.RunningLimited, Samples: s.samples[row.ID], diff --git a/intro-post.md b/intro-post.md index b0fe6fb..af12242 100644 --- a/intro-post.md +++ b/intro-post.md @@ -81,6 +81,12 @@ Long full-screen replies scroll with Up/Down, Page Up/Down or the mouse wheel; p If an approval request is too long for inline controls, a highlighted **APPROVAL — OPEN DETAIL →** warning takes you to the complete request. Dismiss another session or enlarge the window and the buttons reappear automatically when there is enough room to review the request safely. +File-change approvals now have a proper diff review too: file paths, old/new line +numbers, green additions and red removals, in both terminal and web detail. With a +shared app-server, approve once (with confirmation), decline, or reject and stop +the turn. Read-only web mode can show the changes without enabling decisions. +Missing or unsafe patches and broader directory grants stay in Codex—no blind approvals. + For **Approve Once**, press its number, release it, then press it again to confirm on terminals with detected **Kitty keyboard-protocol key-release support**. `C` remains an alternative; session-wide and persistent grants still require `C` or clicking confirmation. Confirmations expire after five seconds. Windows Terminal 1.24 inside Ubuntu/WSL and Apple's built-in Terminal.app use the `1` → `C` fallback. [Windows Terminal Preview 1.25](https://github.com/microsoft/terminal/releases/tag/v1.25.622.0) introduced the protocol, and the separate [kitty app](https://sw.kovidgoyal.net/kitty/) supports it on macOS. Follow the shortcut shown on the button—this terminal capability is optional, not a requirement for using Codexometer or approving commands. Subtle animated dots in inline and full-screen detail indicate observed work, disappearing when the session is no longer observed working or needs attention. “Text sent ...” and “Decision sent ...” confirmations linger briefly so fast updates do not swallow the acknowledgement. Local activity signals remain best-effort, not proof that a model is still executing. diff --git a/web/src/FileDiff.svelte b/web/src/FileDiff.svelte new file mode 100644 index 0000000..f9e7b83 --- /dev/null +++ b/web/src/FileDiff.svelte @@ -0,0 +1,67 @@ + + +
        +
        + +{added} / + −{removed} +
        + {#each lines as line} +
        + {#if line.kind !== 'heading' && line.kind !== 'metadata'}{line.old || ''}{line.new || ''}{/if}{line.text} +
        + {/each} +
        + + diff --git a/web/src/SessionActions.svelte b/web/src/SessionActions.svelte index ca42f2a..ec1249a 100644 --- a/web/src/SessionActions.svelte +++ b/web/src/SessionActions.svelte @@ -1,9 +1,12 @@ ', kind: 'removal', old: 3 }, + { text: '+new', kind: 'addition', new: 3 }, + ]; + Object.assign(offer, { command: '', fileChanges }); + await page.goto(pairingURL); + await page.evaluate(() => { + location.hash = '/sessions/parent'; + }); + const controls = page.getByRole('region', { name: 'Session controls' }); + await expect(controls.locator('.file-diff')).toContainText('/project/a.ts'); + await expect(controls.locator('.diff-summary')).toHaveText('+1 / −1'); + await expect(controls.locator('.diff-line.removed')).toContainText('3'); + await expect(controls.locator('.diff-line.removed')).toContainText( + '', + ); + await expect(controls.locator('.diff-line.added')).toContainText('3'); + await expect(controls.locator('.diff-line.added')).toHaveCSS( + 'color', + 'rgb(103, 211, 145)', + ); + await expect(controls.locator('.diff-line.removed')).toHaveCSS( + 'color', + 'rgb(255, 107, 131)', + ); + await controls + .getByRole('radio', { name: 'APPROVE ONCE', exact: true }) + .check(); + await controls.getByRole('button', { name: 'REVIEW BEFORE SENDING' }).click(); + await expect(controls).toContainText('proposed file changes above'); + expect(calls.filter((c) => c.action === 'commit')).toHaveLength(0); + await controls.getByRole('button', { name: 'CONFIRM APPROVE ONCE' }).click(); + expect(calls.filter((c) => c.action === 'commit')).toHaveLength(1); + // The same patch remains readable without enabling browser writes. + snapshot.control = false; + Object.assign(snapshot.sessions[0], { fileChanges }); + await page.evaluate( + (detail) => + window.dispatchEvent(new CustomEvent('test-snapshot', { detail })), + snapshot, + ); + await expect(page.locator('.detail-context .file-diff')).toBeVisible(); + await expect(page.locator('.detail-context .diff-summary')).toHaveText( + '+1 / −1', + ); + await expect( + page.getByRole('region', { name: 'Session controls' }), + ).toHaveCount(0); +}); + test('scheduled follow-up is reviewed, visible and cancellable without sending immediately', async ({ page, pairingURL,