From 9c335a18781350dac9ee987dde8dea891b4d17af Mon Sep 17 00:00:00 2001 From: merefield Date: Tue, 27 Oct 2026 15:37:59 +0000 Subject: [PATCH 1/5] FEAT: surface confirmed session failures in a separate Errors category --- README.md | 29 +++- internal/codex/daemon_status.go | 1 + internal/codex/daemon_status_unix.go | 3 + internal/codex/live_usage.go | 57 +++++-- internal/codex/live_usage_compressed.go | 2 +- internal/codex/live_usage_test.go | 4 +- internal/codex/session_approval_unix_test.go | 12 ++ internal/codex/session_context.go | 32 +++- internal/codex/session_context_daemon.go | 39 ++++- internal/codex/session_failure.go | 56 +++++++ internal/codex/session_failure_test.go | 150 +++++++++++++++++++ internal/codex/session_prompt_unix.go | 3 + internal/i18n/locales/da.json | 4 + internal/i18n/locales/de.json | 4 + internal/i18n/locales/en-GB.json | 4 + internal/i18n/locales/es.json | 4 + internal/i18n/locales/et.json | 4 + internal/i18n/locales/fi.json | 4 + internal/i18n/locales/fr.json | 4 + internal/i18n/locales/it.json | 4 + internal/i18n/locales/ja.json | 4 + internal/i18n/locales/nb.json | 4 + internal/i18n/locales/nl.json | 4 + internal/i18n/locales/pt-BR.json | 4 + internal/i18n/locales/pt-PT.json | 4 + internal/i18n/locales/ru.json | 4 + internal/i18n/locales/sv.json | 4 + internal/i18n/locales/tr.json | 4 + internal/i18n/locales/zh-Hans.json | 4 + internal/ui/english_snapshot_test.go | 4 +- internal/ui/monitor.go | 6 +- internal/ui/monitor_context.go | 5 + internal/ui/monitor_failure_test.go | 40 +++++ internal/ui/monitor_filter.go | 5 +- internal/ui/monitor_filter_test.go | 4 +- internal/ui/monitor_summary.go | 15 +- internal/ui/monitor_summary_test.go | 10 +- internal/web/dist/assets/index-Bg6CQ-Bn.js | 46 ------ internal/web/dist/assets/index-Bjr_1drg.css | 1 - internal/web/dist/assets/index-DiPYjudz.css | 1 + internal/web/dist/assets/index-zYOUcPV1.js | 47 ++++++ internal/web/dist/index.html | 4 +- internal/web/session_failure_test.go | 17 +++ internal/web/state.go | 4 + intro-post.md | 2 + web/src/Sessions.svelte | 87 +++++++++-- web/tests/browser.spec.ts | 88 +++++++++++ 47 files changed, 739 insertions(+), 103 deletions(-) create mode 100644 internal/codex/session_failure.go create mode 100644 internal/codex/session_failure_test.go create mode 100644 internal/ui/monitor_failure_test.go delete mode 100644 internal/web/dist/assets/index-Bg6CQ-Bn.js delete mode 100644 internal/web/dist/assets/index-Bjr_1drg.css create mode 100644 internal/web/dist/assets/index-DiPYjudz.css create mode 100644 internal/web/dist/assets/index-zYOUcPV1.js create mode 100644 internal/web/session_failure_test.go diff --git a/README.md b/README.md index 5be4236..ba8acb3 100644 --- a/README.md +++ b/README.md @@ -218,7 +218,8 @@ includes the explicit backgrounds used for consistent terminal rendering. without closing or modifying the underlying Codex session. - Highlighted per-session attention badges. A shared Codex app-server supplies exact `INPUT NEEDED` and `APPROVAL NEEDED` states. Without it, a completed - open turn is definite `INPUT NEEDED`; an otherwise active session with no + open turn is `TURN COMPLETE`, not a request for input; an otherwise active + session with no rollout activity for three minutes is cautiously labelled `CHECK SESSION`. For a root with linked agents, fresh activity from any member suppresses that uncertain fallback; definite input or approval signals still propagate from @@ -1168,7 +1169,7 @@ The other top-level views are: session. It automatically establishes a zero baseline across locally active Codex sessions when Codexometer starts. The **SESSION TOTALS** readout follows newly appended token telemetry in a compact summary strip: **TOKENS**, visible **SESSIONS**, - **WORKING**, **APPROVAL**, **INPUT**, and **CHECK*** counts. CHECK* means inferred + **ACTIVE**, **WORKING**, **APPROVAL**, **INPUT**, **ERRORS**, and **CHECK*** counts. CHECK* means inferred inactivity, not a confirmed request. Linked agents are already included in parent sessions and are not counted again. Tokens retain the existing measurement baseline (including previously dismissed sessions); the session/state counts @@ -1213,6 +1214,19 @@ The other top-level views are: minutes receives `CHECK SESSION`: a deliberately uncertain prompt that can also mean a long-running local tool. Subsequent activity from the root or any linked agent clears the uncertain group-level warning. + Confirmed failed turns instead enter **ERRORS**, with an amber **MODEL BUSY** + badge for server-reported model capacity and **TURN FAILED** for other failures. + The row, full detail and attention pill retain the observed error message; + capacity is not interpreted as quota exhaustion. Both the shared app-server's + failed-turn/error events and local rollout error records are supported. Errors + that Codex is still automatically retrying remain **WORKING**, as do non-turn + failures such as a rejected steering attempt. A new turn on the affected + thread clears its prior failure; + stale events from older identified turns cannot fail the new one. Errors from + linked agents propagate to the parent row, below pending approvals and questions. + No prompt is automatically retried and no model is automatically switched. + **INPUT** is reserved for observed blocking questions/requests, not a completed + turn without a final reply. Normal completion remains **TURN COMPLETE**. Codexometer never guesses `APPROVAL NEEDED` from inactivity. Closing the CLI releases its per-thread writer lock and clears every attention badge. A session already included in the current Sessions recording can remain as an @@ -1590,7 +1604,8 @@ live session states and are not persisted across launches. **Active** includes sessions identified as active by the latest observation, including working sessions and those waiting for input, approval or their next -turn. It excludes inferred **CHECK SESSION** entries and retained inactive rows. +turn. It excludes confirmed failures, inferred **CHECK SESSION** entries and +retained inactive rows. An app-server-confirmed loaded, idle/ready session remains Active even after five minutes without session-file updates; that confirmation is not carried forward if it disappears or the daemon disconnects. Without the daemon, the @@ -1615,7 +1630,8 @@ Enter submits, and `Esc` leaves the editor first. Approval controls remain exclusive to the current target. An **attention strip** beneath the summary provides direct links to visible -sessions, ordered **Approval → Input → Turn Complete**. Approval and input pills +sessions, ordered **Approval → Input → Errors → quota-threshold reviews → Turn Complete → triggers**. +Approval, input and error pills use the theme's warning colour; completed turns use a quieter, non-bold theme-primary colour to mean “your result is ready”, not “a reply is required”. Completion pills disappear when work resumes, the completion state clears or the session is dismissed. @@ -2916,7 +2932,10 @@ available from the existing reader. - Attention links jump to the relevant session. Approval indicators remain outside scrollable reply text; available commands are separated from their justification. Missing commands are explicitly labelled, never reconstructed. -- **INPUT NEEDED / APPROVAL NEEDED** represent observed signals; **CHECK SESSION** +- **INPUT NEEDED / APPROVAL NEEDED** represent observed signals; **MODEL BUSY / + TURN FAILED** represent confirmed turn errors and appear in **ERRORS**, with + the observed explanation in detail. Retrying errors do not raise failure pills. + **CHECK SESSION** is labelled inferred inactivity and is not proof that a reply is required. **TURN COMPLETE** is informational. Disconnection or failed session refresh suppresses live attention indicators and marks the display stale. diff --git a/internal/codex/daemon_status.go b/internal/codex/daemon_status.go index df3dbb6..964c0d2 100644 --- a/internal/codex/daemon_status.go +++ b/internal/codex/daemon_status.go @@ -11,6 +11,7 @@ const ( sessionRuntimeInput sessionRuntimeApproval sessionRuntimeComplete + sessionRuntimeFailed ) type sessionStatusProvider interface { diff --git a/internal/codex/daemon_status_unix.go b/internal/codex/daemon_status_unix.go index 6e9e54f..a59a76e 100644 --- a/internal/codex/daemon_status_unix.go +++ b/internal/codex/daemon_status_unix.go @@ -155,6 +155,9 @@ func (p *daemonStatusProvider) statusSnapshotLocked(threadIDs []string) sessionD if state := p.contexts[threadID]; status == sessionRuntimeIdle && state != nil && state.completed { status = sessionRuntimeComplete } + if state := p.contexts[threadID]; status == sessionRuntimeIdle && state != nil && state.latest.Kind == SessionContextFailure { + status = sessionRuntimeFailed + } statuses[threadID] = status if cwd := p.threadDirectories[threadID]; cwd != "" { directories[threadID] = cwd diff --git a/internal/codex/live_usage.go b/internal/codex/live_usage.go index a72e3e9..92b9817 100644 --- a/internal/codex/live_usage.go +++ b/internal/codex/live_usage.go @@ -80,6 +80,7 @@ type LiveUsageSession struct { // Input and approval are definite signals; Check is deliberately cautious and // means only that an open fallback-observed session has remained quiet. // Complete is informational: an observed completed turn, not an input request. +// Error is a confirmed failed turn; it is never inferred from inactivity. type SessionAttention int const ( @@ -88,6 +89,7 @@ const ( SessionAttentionApproval SessionAttentionCheck SessionAttentionComplete + SessionAttentionError ) // LiveModelCall is a small, content-free response-usage pulse. APIEqIssue retains @@ -213,6 +215,7 @@ const ( sessionAttentionIdle sessionAttentionInput sessionAttentionApproval + sessionAttentionFailed ) type rolloutEvent struct { @@ -293,8 +296,11 @@ type rolloutAttentionEvent struct { Ordinal *uint64 `json:"ordinal"` Type string `json:"type"` Payload struct { - Type string `json:"type"` - IsBlocking *bool `json:"isBlocking"` + Type string `json:"type"` + IsBlocking *bool `json:"isBlocking"` + Error json.RawMessage `json:"error"` + WillRetry *bool `json:"will_retry"` + TurnID string `json:"turn_id"` } `json:"payload"` } @@ -748,7 +754,7 @@ func (r *LiveUsageReader) consume(path string, cursor *rolloutCursor) error { cursor.currentModel = model cursor.currentServiceTier = cursor.nextServiceTier } - if attention, ordinal, at, ok := sessionAttentionRecord(line); ok && + if attention, ordinal, at, ok := sessionAttentionRecord(line, cursor.currentTurnID); ok && tokenRecordIsOwned(ordinal, cursor.subagentHistoryStartOrdinal, at, cursor.nonRoot, cursor.startedAt) { cursor.attention = attention } @@ -988,7 +994,7 @@ func latestSessionAttention(path string, cursor *rolloutCursor) (sessionAttentio firstComplete = 0 } for index := len(lines) - 1; index >= firstComplete; index-- { - attention, ordinal, at, ok := sessionAttentionRecord(lines[index]) + attention, ordinal, at, ok := sessionAttentionRecord(lines[index], cursor.currentTurnID) if ok && tokenRecordIsOwned(ordinal, cursor.subagentHistoryStartOrdinal, at, cursor.nonRoot, cursor.startedAt) { return attention, nil } @@ -998,7 +1004,7 @@ func latestSessionAttention(path string, cursor *rolloutCursor) (sessionAttentio return sessionAttentionUnknown, nil } -func sessionAttentionRecord(line []byte) (sessionAttentionState, *uint64, time.Time, bool) { +func sessionAttentionRecord(line []byte, currentTurnID string) (sessionAttentionState, *uint64, time.Time, bool) { if !bytes.Contains(line, []byte(`"event_msg"`)) && !bytes.Contains(line, []byte(`"response_item"`)) { return sessionAttentionUnknown, nil, time.Time{}, false } @@ -1012,6 +1018,9 @@ func sessionAttentionRecord(line []byte) (sessionAttentionState, *uint64, time.T if event.Type != "event_msg" { return sessionAttentionUnknown, nil, time.Time{}, false } + if (event.Payload.Type == "error" || event.Payload.Type == "task_complete" || event.Payload.Type == "turn_complete") && currentTurnID != "" && event.Payload.TurnID != "" && currentTurnID != event.Payload.TurnID { + return sessionAttentionUnknown, nil, time.Time{}, false + } switch event.Payload.Type { case "request_user_input": if event.Payload.IsBlocking == nil || *event.Payload.IsBlocking { @@ -1020,7 +1029,20 @@ func sessionAttentionRecord(line []byte) (sessionAttentionState, *uint64, time.T case "exec_approval_request", "apply_patch_approval_request", "request_permissions", "elicitation_request": return sessionAttentionApproval, event.Ordinal, event.Timestamp, true case "task_complete", "turn_complete": + if len(event.Payload.Error) > 0 && string(event.Payload.Error) != "null" { + return sessionAttentionFailed, event.Ordinal, event.Timestamp, true + } return sessionAttentionIdle, event.Ordinal, event.Timestamp, true + case "error": + if event.Payload.WillRetry != nil && *event.Payload.WillRetry { + break + } + var raw struct { + Payload json.RawMessage `json:"payload"` + } + if json.Unmarshal(line, &raw) == nil && failureAffectsTurn(sessionFailureContext(SessionContext{}, raw.Payload)) { + return sessionAttentionFailed, event.Ordinal, event.Timestamp, true + } case "task_started", "turn_started", "user_message", "exec_command_begin", "dynamic_tool_call_response": return sessionAttentionWorking, event.Ordinal, event.Timestamp, true } @@ -1415,9 +1437,6 @@ func (r *LiveUsageReader) sessionSnapshots(now time.Time, liveWriters map[string exactWorking := exact && exactStatus == sessionRuntimeWorking localWorking := !exact && writerActive && cursor.attention == sessionAttentionWorking attention := sessionAttention(cursor.attention, writerActive, writerLocksSupported, quietFor, exactStatus, exact) - if !exact && attention == SessionAttentionInput && cursor.attention == sessionAttentionIdle && cursor.preview.Kind == SessionContextReply { - attention = SessionAttentionComplete - } if !active && !exactWorking && attention == SessionAttentionNone && cursor.observedTokens == 0 && len(cursor.modelCalls) == 0 && len(cursor.turnTimings) == 0 { continue } @@ -1437,21 +1456,29 @@ func (r *LiveUsageReader) sessionSnapshots(now time.Time, liveWriters map[string group.Active = group.Active || active || exactWorking || attention != SessionAttentionNone group.Attention = mergeSessionAttention(group.Attention, attention) preview := cursor.preview + if exact && (exactStatus == sessionRuntimeWorking || exactStatus == sessionRuntimeComplete) && preview.Kind == SessionContextFailure { + preview = SessionContext{} + } if exact && preview.pending() { preview = SessionContext{} } if live, ok := r.daemonContexts[cursor.threadID]; ok { if live.At.After(preview.At) || live.pending() || live.PendingApprovalsLimited { preview = live - } else if preview.Kind == SessionContextReply && live.ThreadID == cursor.threadID && live.TurnID != "" && live.TurnID == cursor.currentTurnID { + } else if (preview.Kind == SessionContextReply || preview.Kind == SessionContextFailure) && live.ThreadID == cursor.threadID && live.TurnID != "" && live.TurnID == cursor.currentTurnID { // The local task_complete record can be newer than the live - // final message. Keep its reply, but retain observed prompt + // final message. Keep its reply/error, but retain observed prompt // context only for the same positively identified turn. preview.CurrentTask, preview.LatestGuidance = live.CurrentTask, live.LatestGuidance preview.LatestGuidanceID = live.LatestGuidanceID preview.TurnID = live.TurnID } } + if preview.Kind == SessionContextFailure && (!writerLocksSupported || writerActive || exact) && (!exact || exactStatus != sessionRuntimeWorking && exactStatus != sessionRuntimeComplete) { + attention = mergeSessionAttention(attention, SessionAttentionError) + group.Attention = mergeSessionAttention(group.Attention, attention) + localWorking = false + } // A persisted request is not proof that it is still outstanding. Match // it to current attention before displaying it as actionable context. if preview.Kind == SessionContextApproval && attention != SessionAttentionApproval || @@ -1534,6 +1561,8 @@ func sessionAttention(state sessionAttentionState, writerActive, writerLocksSupp return SessionAttentionApproval case sessionRuntimeInput: return SessionAttentionInput + case sessionRuntimeFailed: + return SessionAttentionError } // A status supplied by the shared daemon is authoritative. In // particular, an active thread without a waiting flag must not age into @@ -1546,10 +1575,12 @@ func sessionAttention(state sessionAttentionState, writerActive, writerLocksSupp switch state { case sessionAttentionIdle: if writerActive { - return SessionAttentionInput + return SessionAttentionComplete } case sessionAttentionInput: return SessionAttentionInput + case sessionAttentionFailed: + return SessionAttentionError case sessionAttentionApproval: return SessionAttentionApproval } @@ -1569,8 +1600,10 @@ func mergeSessionAttention(current, next SessionAttention) SessionAttention { func sessionAttentionPriority(attention SessionAttention) int { switch attention { case SessionAttentionApproval: - return 4 + return 5 case SessionAttentionInput: + return 4 + case SessionAttentionError: return 3 case SessionAttentionCheck: return 2 diff --git a/internal/codex/live_usage_compressed.go b/internal/codex/live_usage_compressed.go index 07740d0..34df86c 100644 --- a/internal/codex/live_usage_compressed.go +++ b/internal/codex/live_usage_compressed.go @@ -135,7 +135,7 @@ func baselineRolloutRecord(c *rolloutCursor, line []byte) { if turn, ordinal, at, ok := rolloutTurnIDRecord(line); ok && tokenRecordIsOwned(ordinal, c.subagentHistoryStartOrdinal, at, c.nonRoot, c.startedAt) { c.currentTurnID = turn } - if attention, ordinal, at, ok := sessionAttentionRecord(line); ok && tokenRecordIsOwned(ordinal, c.subagentHistoryStartOrdinal, at, c.nonRoot, c.startedAt) { + if attention, ordinal, at, ok := sessionAttentionRecord(line, c.currentTurnID); ok && tokenRecordIsOwned(ordinal, c.subagentHistoryStartOrdinal, at, c.nonRoot, c.startedAt) { c.attention = attention } if preview, ok := rolloutContextRecord(line, c); ok { diff --git a/internal/codex/live_usage_test.go b/internal/codex/live_usage_test.go index d254bfd..8cb8148 100644 --- a/internal/codex/live_usage_test.go +++ b/internal/codex/live_usage_test.go @@ -518,8 +518,8 @@ func TestSessionAttentionFallbackChecksOnlyOpenQuietSessions(t *testing.T) { if got := sessionAttention(sessionAttentionWorking, false, true, time.Hour, sessionRuntimeUnknown, false); got != SessionAttentionNone { t.Fatalf("closed quiet session attention = %v; want none", got) } - if got := sessionAttention(sessionAttentionIdle, true, true, 0, sessionRuntimeUnknown, false); got != SessionAttentionInput { - t.Fatalf("durably completed session attention = %v; want input", got) + if got := sessionAttention(sessionAttentionIdle, true, true, 0, sessionRuntimeUnknown, false); got != SessionAttentionComplete { + t.Fatalf("durably completed session attention = %v; want completion, not input", got) } } diff --git a/internal/codex/session_approval_unix_test.go b/internal/codex/session_approval_unix_test.go index 2204a4f..4d9d682 100644 --- a/internal/codex/session_approval_unix_test.go +++ b/internal/codex/session_approval_unix_test.go @@ -140,6 +140,15 @@ func TestApprovalWireOneUseAndDisconnect(t *testing.T) { } } +func TestDaemonLateFailedCompletionCannotStopNewTurn(t *testing.T) { + p := &daemonStatusProvider{contexts: map[string]*daemonContextState{}, statuses: map[string]sessionRuntimeStatus{}} + p.promptLifecycleLocked("turn/started", json.RawMessage(`{"threadId":"root","turn":{"id":"new"}}`)) + p.promptLifecycleLocked("turn/completed", json.RawMessage(`{"threadId":"root","turn":{"id":"old","status":"failed"}}`)) + if p.statuses["root"] != sessionRuntimeWorking || p.contexts["root"].activeTurn != "new" { + t.Fatal("old completion stopped new turn") + } +} + func TestDaemonSuccessfulCompletionIsSeparateFromIdle(t *testing.T) { for _, status := range []string{"completed", "interrupted", "failed", ""} { t.Run(status, func(t *testing.T) { @@ -155,6 +164,9 @@ func TestDaemonSuccessfulCompletionIsSeparateFromIdle(t *testing.T) { if status == "completed" { want = sessionRuntimeComplete } + if status == "failed" { + want = sessionRuntimeFailed + } if got := p.statusSnapshotLocked([]string{"root"}).Statuses["root"]; got != want { t.Fatalf("completion %q: got %v want %v", status, got, want) } diff --git a/internal/codex/session_context.go b/internal/codex/session_context.go index be1ec2c..46f6ae8 100644 --- a/internal/codex/session_context.go +++ b/internal/codex/session_context.go @@ -20,11 +20,13 @@ const ( SessionContextReply SessionContextQuestion SessionContextApproval + SessionContextFailure ) // SessionContext is a bounded, memory-only excerpt, never a generated summary. // It is deliberately separate from token accounting and persisted preferences. type SessionContext struct { + FailureCode string CurrentTask string LatestGuidance string LatestGuidanceID string @@ -129,9 +131,12 @@ func preferSessionContext(a, b SessionContext) SessionContext { } priority := func(c SessionContext) int { if c.Kind == SessionContextApproval { - return 3 + return 4 } if c.Kind == SessionContextQuestion { + return 3 + } + if c.Kind == SessionContextFailure { return 2 } return 1 @@ -194,6 +199,10 @@ func rolloutContextRecord(line []byte, cursor *rolloutCursor) (SessionContext, b Timestamp time.Time `json:"timestamp"` Ordinal *uint64 `json:"ordinal"` Payload struct { + Error json.RawMessage `json:"error"` + Code json.RawMessage `json:"codex_error_info"` + WillRetry *bool `json:"will_retry"` + TurnID string `json:"turn_id"` Type string `json:"type"` Role string `json:"role"` Phase string `json:"phase"` @@ -214,8 +223,11 @@ func rolloutContextRecord(line []byte, cursor *rolloutCursor) (SessionContext, b if json.Unmarshal(line, &event) != nil || !tokenRecordIsOwned(event.Ordinal, cursor.subagentHistoryStartOrdinal, event.Timestamp, cursor.nonRoot, cursor.startedAt) { return SessionContext{}, false } - c := SessionContext{At: event.Timestamp, ThreadID: cursor.threadID, Source: "LOCAL"} + c := SessionContext{At: event.Timestamp, ThreadID: cursor.threadID, TurnID: event.Payload.TurnID, Source: "LOCAL"} p := event.Payload + if (p.Type == "error" || p.Type == "task_complete" || p.Type == "turn_complete") && p.TurnID != "" && cursor.currentTurnID != "" && p.TurnID != cursor.currentTurnID { + return c, false + } if event.Type == "response_item" && p.Type == "message" && p.Role == "assistant" { if p.Phase != "commentary" && p.Phase != "final_answer" { return c, false @@ -236,10 +248,26 @@ func rolloutContextRecord(line []byte, cursor *rolloutCursor) (SessionContext, b return SessionContext{}, true case "task_complete", "turn_complete": cursor.activity = sessionActivityState{} + if len(p.Error) > 0 && string(p.Error) != "null" { + return sessionFailureContext(c, p.Error), true + } + if cursor.preview.Kind == SessionContextFailure && (p.TurnID == "" || cursor.preview.TurnID == "" || p.TurnID == cursor.preview.TurnID) { + return cursor.preview, true + } c.Kind, c.Text = SessionContextReply, p.Last if p.Last == "" && cursor.preview.Kind == SessionContextReply { return cursor.preview, true } + case "error": + if p.WillRetry != nil && *p.WillRetry { + return c, false + } + raw, _ := json.Marshal(struct { + Message string `json:"message"` + Code json.RawMessage `json:"codexErrorInfo"` + }{p.Message, p.Code}) + failure := sessionFailureContext(c, raw) + return failure, failureAffectsTurn(failure) case "agent_message": c.Kind, c.Text = SessionContextActivity, p.Message if p.Phase == "final_answer" { diff --git a/internal/codex/session_context_daemon.go b/internal/codex/session_context_daemon.go index 789f898..0645047 100644 --- a/internal/codex/session_context_daemon.go +++ b/internal/codex/session_context_daemon.go @@ -17,6 +17,7 @@ type daemonContextState struct { ended bool streamItem, streamTurn, streamText, streamPhase string activeTurn string + finishedTurn string turnToken string activity sessionActivityState approvalsLimited bool @@ -34,9 +35,12 @@ type contextCommandItem struct{ Command, CWD string } func daemonContextEvent(states map[string]*daemonContextState, method string, id, raw json.RawMessage, now time.Time) { var p struct { Turn struct { - ID string `json:"id"` - Status string `json:"status"` + ID string `json:"id"` + Status string `json:"status"` + Error json.RawMessage `json:"error"` } `json:"turn"` + Error json.RawMessage `json:"error"` + WillRetry *bool `json:"willRetry"` TurnID string `json:"turnId"` ItemID string `json:"itemId"` Delta string `json:"delta"` @@ -98,6 +102,10 @@ func daemonContextEvent(states map[string]*daemonContextState, method string, id delete(states, p.ThreadID) return case "turn/completed", "turn/interrupted": + if !state.acceptTurn(p.Turn.ID) { + return + } + state.finishedTurn = p.Turn.ID // Keep the observed task alongside its reply until the next turn. state.ended = true state.userItems = nil @@ -115,6 +123,25 @@ func daemonContextEvent(states map[string]*daemonContextState, method string, id } state.activity = sessionActivityState{} state.latest.Activity = SessionActivity{} + if method == "turn/completed" && p.Turn.Status == "failed" { + c.TurnID = p.Turn.ID + if len(p.Turn.Error) > 0 && string(p.Turn.Error) != "null" || state.latest.Kind != SessionContextFailure { + state.latest = sessionFailureContext(c, p.Turn.Error) + } + } + return + case "error": + if p.WillRetry == nil || *p.WillRetry || state.ended || state.activeTurn != "" && p.TurnID != state.activeTurn { + return + } + failure := sessionFailureContext(c, p.Error) + if !failureAffectsTurn(failure) { + return + } + state.latest = failure + state.ended, state.completed = true, false + state.streamItem, state.streamText = "", "" + clear(state.requests) return case "serverRequest/resolved": delete(state.requests, string(p.RequestID)) @@ -357,6 +384,14 @@ func daemonContextEvent(states map[string]*daemonContextState, method string, id } } +func (s *daemonContextState) acceptTurn(id string) bool { + current := s.activeTurn + if current == "" { + current = s.finishedTurn + } + return id == "" || current == "" || id == current +} + func distinctApprovalContext(prose, reason string) string { prose = SanitizeSessionContext(prose) if strings.EqualFold(strings.Join(strings.Fields(prose), " "), strings.Join(strings.Fields(SanitizeSessionContext(reason)), " ")) { diff --git a/internal/codex/session_failure.go b/internal/codex/session_failure.go new file mode 100644 index 0000000..c9bd486 --- /dev/null +++ b/internal/codex/session_failure.go @@ -0,0 +1,56 @@ +package codex + +import ( + "encoding/json" + "strings" +) + +// Failure labels are shared by both interfaces; backend messages remain bounded, +// sanitised observations, never commands or permission to retry a write. +func SessionFailureLabel(c SessionContext) string { + if c.FailureCode == "serverOverloaded" { + return "MODEL BUSY" + } + return "TURN FAILED" +} + +func failureAffectsTurn(c SessionContext) bool { + switch strings.ToLower(strings.ReplaceAll(c.FailureCode, "_", "")) { + case "activeturnnotsteerable", "threadrollbackfailed": + return false + } + return true +} + +func sessionFailureContext(c SessionContext, raw json.RawMessage) SessionContext { + var e struct { + Message string `json:"message"` + Code json.RawMessage `json:"codexErrorInfo"` + LegacyCode json.RawMessage `json:"codex_error_info"` + Details string `json:"additionalDetails"` + } + _ = json.Unmarshal(raw, &e) + code := e.Code + if len(code) == 0 { + code = e.LegacyCode + } + var name string + if json.Unmarshal(code, &name) != nil { + var variant map[string]json.RawMessage + if json.Unmarshal(code, &variant) == nil && len(variant) == 1 { + for key := range variant { + name = key + } + } + } + if strings.EqualFold(strings.ReplaceAll(name, "_", ""), "serverOverloaded") { + name = "serverOverloaded" + } + c.Kind, c.Streaming, c.Activity = SessionContextFailure, false, SessionActivity{} + c.FailureCode = SanitizeSessionContext(name) + c.Text = SanitizeSessionContext(strings.TrimSpace(e.Message + "\n" + e.Details)) + if c.Text == "" { + c.Text = "Codex reported a failed turn." + } + return c +} diff --git a/internal/codex/session_failure_test.go b/internal/codex/session_failure_test.go new file mode 100644 index 0000000..2b47626 --- /dev/null +++ b/internal/codex/session_failure_test.go @@ -0,0 +1,150 @@ +package codex + +import ( + "context" + "encoding/json" + "strings" + "testing" + "time" +) + +const busyMessage = "Selected model is at capacity. Please try a different model." + +func TestSessionFailureReaderBootstrapAndRecovery(t *testing.T) { + for _, compressed := range []bool{false, true} { + home := t.TempDir() + path := testRolloutPath(t, home, time.Now(), "failure") + start := string(contextRecord(t, "event_msg", map[string]string{"type": "task_started", "turn_id": "one"})) + "\n" + failed := string(contextRecord(t, "event_msg", map[string]any{"type": "task_complete", "turn_id": "one", "error": map[string]string{"message": busyMessage, "codex_error_info": "server_overloaded"}})) + "\n" + writeRollout(t, path, sessionMetaLine("s", `"cli"`, "/work", nil)+"\n"+start+failed) + if compressed { + compressTestRollout(t, path, true) + } + r, err := NewLiveUsageReader(home) + if err != nil { + t.Fatal(err) + } + r.statusProvider = nil + u, err := r.FetchTokenUsage(context.Background()) + if err != nil || len(u.Sessions) != 1 || u.Sessions[0].Attention != SessionAttentionError || u.Sessions[0].Context.Text != busyMessage { + t.Fatal(compressed, u, err) + } + if compressed { + continue + } + appendRollout(t, path, string(contextRecord(t, "event_msg", map[string]string{"type": "task_started", "turn_id": "two"}))+"\n"+failed) + u, err = r.FetchTokenUsage(context.Background()) + if err != nil || u.Sessions[0].Attention == SessionAttentionError || u.Sessions[0].Context.Kind == SessionContextFailure { + t.Fatal("late old failure replaced new turn", u, err) + } + } +} + +func TestSessionFailureDaemonLifecycle(t *testing.T) { + states := map[string]*daemonContextState{} + event := func(method, raw string) { daemonContextEvent(states, method, nil, json.RawMessage(raw), time.Now()) } + event("turn/started", `{"threadId":"s","turn":{"id":"one"}}`) + event("error", `{"threadId":"s","turnId":"one","willRetry":true,"error":{"message":"retrying","codexErrorInfo":"serverOverloaded"}}`) + if states["s"].latest.Kind == SessionContextFailure || states["s"].ended { + t.Fatal("retry marked failed") + } + event("error", `{"threadId":"s","turnId":"old","willRetry":false,"error":{"message":"old error"}}`) + if states["s"].ended { + t.Fatal("old turn ended new turn") + } + event("error", `{"threadId":"s","turnId":"one","willRetry":false,"error":{"message":"Selected model is at capacity. Please try a different model.","codexErrorInfo":"serverOverloaded"}}`) + if c := states["s"].latest; c.Text != busyMessage || SessionFailureLabel(c) != "MODEL BUSY" || c.Streaming { + t.Fatal(c) + } + event("turn/completed", `{"threadId":"s","turn":{"id":"one","status":"failed"}}`) + if states["s"].latest.Text != busyMessage || states["s"].completed { + t.Fatal("failure lost on completion") + } + event("turn/started", `{"threadId":"s","turn":{"id":"two"}}`) + event("turn/completed", `{"threadId":"s","turn":{"id":"one","status":"failed","error":{"message":"late"}}}`) + if states["s"].ended || states["s"].latest.Kind == SessionContextFailure { + t.Fatal("late completion displaced new turn") + } + event("turn/completed", `{"threadId":"s","turn":{"id":"two","status":"failed","error":{"message":"Connection lost","codexErrorInfo":{"httpConnectionFailed":{"httpStatusCode":503}},"additionalDetails":"Try later"}}}`) + if c := states["s"].latest; c.Text != "Connection lost\nTry later" || SessionFailureLabel(c) != "TURN FAILED" { + t.Fatal(c) + } + event("turn/started", `{"threadId":"s","turn":{"id":"three"}}`) + event("turn/completed", `{"threadId":"s","turn":{"id":"three","status":"completed"}}`) + if !states["s"].completed || states["s"].latest.Kind == SessionContextFailure { + t.Fatal("recovered turn still failed") + } +} + +func TestSessionFailureLocalHistory(t *testing.T) { + for _, nested := range []bool{false, true} { + cursor := &rolloutCursor{threadID: "s"} + payload := map[string]any{"type": "error", "message": busyMessage, "codex_error_info": "server_overloaded"} + if nested { + payload = map[string]any{"type": "task_complete", "error": map[string]string{"message": busyMessage, "codex_error_info": "server_overloaded"}} + } + c, ok := rolloutContextRecord(contextRecord(t, "event_msg", payload), cursor) + if !ok || c.Kind != SessionContextFailure || c.Text != busyMessage || SessionFailureLabel(c) != "MODEL BUSY" { + t.Fatal(c, ok) + } + cursor.preview = c + c, ok = rolloutContextRecord(contextRecord(t, "event_msg", map[string]string{"type": "task_complete"}), cursor) + if !ok || c.Kind != SessionContextFailure { + t.Fatal("empty completion lost failure", c) + } + c, ok = rolloutContextRecord(contextRecord(t, "event_msg", map[string]string{"type": "task_started"}), cursor) + if !ok || c.Kind != SessionContextNone { + t.Fatal("new turn retained failure", c) + } + } +} + +func TestSessionFailureNonTerminalErrorsAndSanitization(t *testing.T) { + for _, code := range []string{"thread_rollback_failed", "active_turn_not_steerable"} { + c, ok := rolloutContextRecord(contextRecord(t, "event_msg", map[string]any{"type": "error", "message": "not terminal", "codex_error_info": map[string]any{code: map[string]string{}}}), &rolloutCursor{}) + if ok { + t.Fatal("non-turn error changed context", c) + } + } + c, ok := rolloutContextRecord(contextRecord(t, "event_msg", map[string]any{"type": "error", "message": "retrying", "will_retry": true}), &rolloutCursor{}) + if ok { + t.Fatal("retry became failure", c) + } + raw, _ := json.Marshal(map[string]string{"message": "\x1b[31merror\x1b[0m\x00" + strings.Repeat("界", 5000)}) + c = sessionFailureContext(SessionContext{}, raw) + if strings.ContainsAny(c.Text, "\x1b\x00") || len([]rune(c.Text)) != sessionContextLimit { + t.Fatal("unsafe/unbounded error") + } +} + +func TestSessionFailureGroupingAndInputSeparation(t *testing.T) { + now := time.Now() + failure := sessionFailureContext(SessionContext{ThreadID: "child"}, json.RawMessage(`{"message":"busy","codexErrorInfo":"serverOverloaded"}`)) + r := &LiveUsageReader{files: map[string]*rolloutCursor{ + "root": {threadID: "root", lastModified: now}, + "child": {threadID: "child", parentThreadID: "root", nonRoot: true, lastModified: now, preview: failure}, + }} + rows, _, _ := r.sessionSnapshots(now, map[string]struct{}{"root": {}, "child": {}}, true, nil) + if len(rows) != 1 || rows[0].Attention != SessionAttentionError || rows[0].Context.Text != "busy" { + t.Fatal(rows) + } + for _, higher := range []SessionAttention{SessionAttentionApproval, SessionAttentionInput} { + if mergeSessionAttention(SessionAttentionError, higher) != higher { + t.Fatal("error displaced live request") + } + } + if got := sessionAttention(sessionAttentionIdle, true, true, 0, sessionRuntimeUnknown, false); got != SessionAttentionComplete { + t.Fatal("completion masqueraded as input", got) + } + if got := sessionAttention(sessionAttentionInput, true, true, 0, sessionRuntimeUnknown, false); got != SessionAttentionInput { + t.Fatal("blocking question lost", got) + } + if got := sessionAttention(sessionAttentionWorking, true, true, 0, sessionRuntimeFailed, true); got != SessionAttentionError { + t.Fatal(got) + } + r.files["child"].preview = SessionContext{} + rows, _, _ = r.sessionSnapshots(now, nil, false, map[string]sessionRuntimeStatus{"root": sessionRuntimeWorking, "child": sessionRuntimeWorking}) + if rows[0].Attention != SessionAttentionNone { + t.Fatal("recovery kept error", rows) + } +} diff --git a/internal/codex/session_prompt_unix.go b/internal/codex/session_prompt_unix.go index 01f9c8d..26dd568 100644 --- a/internal/codex/session_prompt_unix.go +++ b/internal/codex/session_prompt_unix.go @@ -25,6 +25,9 @@ func (p *daemonStatusProvider) promptLifecycleLocked(method string, raw json.Raw if json.Unmarshal(raw, &event) != nil || event.ThreadID == "" { return } + if s := p.contexts[event.ThreadID]; s != nil && (method == "turn/completed" || method == "turn/interrupted") && !s.acceptTurn(event.Turn.ID) { + return + } if method == "turn/started" { if p.contexts == nil { p.contexts = map[string]*daemonContextState{} diff --git a/internal/i18n/locales/da.json b/internal/i18n/locales/da.json index 954eb5b..1386780 100644 --- a/internal/i18n/locales/da.json +++ b/internal/i18n/locales/da.json @@ -1,4 +1,8 @@ { + "ERRORS": "FEJL", + "MODEL BUSY": "MODEL OPTAGET", + "TURN FAILED": "TUR MISLYKKEDES", + "TURN ERROR": "TURFEJL", "PACE": "TEMPO", "ZONE": "ZONE", "WINDOW START": "VINDUESSTART", diff --git a/internal/i18n/locales/de.json b/internal/i18n/locales/de.json index 56ad2c6..628e92d 100644 --- a/internal/i18n/locales/de.json +++ b/internal/i18n/locales/de.json @@ -1,4 +1,8 @@ { + "ERRORS": "FEHLER", + "MODEL BUSY": "MODELL AUSGELASTET", + "TURN FAILED": "TURN FEHLGESCHLAGEN", + "TURN ERROR": "TURN-FEHLER", "PACE": "TEMPO", "ZONE": "ZONE", "WINDOW START": "FENSTERBEGINN", diff --git a/internal/i18n/locales/en-GB.json b/internal/i18n/locales/en-GB.json index dfadddc..54a0c7d 100644 --- a/internal/i18n/locales/en-GB.json +++ b/internal/i18n/locales/en-GB.json @@ -1,4 +1,8 @@ { + "ERRORS": "ERRORS", + "MODEL BUSY": "MODEL BUSY", + "TURN FAILED": "TURN FAILED", + "TURN ERROR": "TURN ERROR", "PACE": "PACE", "ZONE": "ZONE", "WINDOW START": "WINDOW START", diff --git a/internal/i18n/locales/es.json b/internal/i18n/locales/es.json index 79207e1..83b8b30 100644 --- a/internal/i18n/locales/es.json +++ b/internal/i18n/locales/es.json @@ -1,4 +1,8 @@ { + "ERRORS": "ERRORES", + "MODEL BUSY": "MODELO SATURADO", + "TURN FAILED": "TURNO FALLIDO", + "TURN ERROR": "ERROR DEL TURNO", "PACE": "RITMO", "ZONE": "ZONA", "WINDOW START": "INICIO DE VENTANA", diff --git a/internal/i18n/locales/et.json b/internal/i18n/locales/et.json index 2389719..befe37a 100644 --- a/internal/i18n/locales/et.json +++ b/internal/i18n/locales/et.json @@ -1,4 +1,8 @@ { + "ERRORS": "VEAD", + "MODEL BUSY": "MUDEL HÕIVATUD", + "TURN FAILED": "VOOR NURJUS", + "TURN ERROR": "VOORU VIGA", "PACE": "TEMPO", "ZONE": "ALA", "WINDOW START": "AKNA ALGUS", diff --git a/internal/i18n/locales/fi.json b/internal/i18n/locales/fi.json index 3d708e3..88b4877 100644 --- a/internal/i18n/locales/fi.json +++ b/internal/i18n/locales/fi.json @@ -1,4 +1,8 @@ { + "ERRORS": "VIRHEET", + "MODEL BUSY": "MALLI VARATTU", + "TURN FAILED": "VUORO EPÄONNISTUI", + "TURN ERROR": "VUORON VIRHE", "PACE": "TAHTI", "ZONE": "ALUE", "WINDOW START": "JAKSON ALKU", diff --git a/internal/i18n/locales/fr.json b/internal/i18n/locales/fr.json index e07b9db..ebca0cd 100644 --- a/internal/i18n/locales/fr.json +++ b/internal/i18n/locales/fr.json @@ -1,4 +1,8 @@ { + "ERRORS": "ERREURS", + "MODEL BUSY": "MODÈLE SATURÉ", + "TURN FAILED": "TOUR ÉCHOUÉ", + "TURN ERROR": "ERREUR DU TOUR", "PACE": "RYTHME", "ZONE": "ZONE", "WINDOW START": "DÉBUT DE FENÊTRE", diff --git a/internal/i18n/locales/it.json b/internal/i18n/locales/it.json index 9947c53..5b7edae 100644 --- a/internal/i18n/locales/it.json +++ b/internal/i18n/locales/it.json @@ -1,4 +1,8 @@ { + "ERRORS": "ERRORI", + "MODEL BUSY": "MODELLO OCCUPATO", + "TURN FAILED": "TURNO FALLITO", + "TURN ERROR": "ERRORE DEL TURNO", "PACE": "RITMO", "ZONE": "ZONA", "WINDOW START": "INIZIO FINESTRA", diff --git a/internal/i18n/locales/ja.json b/internal/i18n/locales/ja.json index b4bc022..d93e30d 100644 --- a/internal/i18n/locales/ja.json +++ b/internal/i18n/locales/ja.json @@ -1,4 +1,8 @@ { + "ERRORS": "エラー", + "MODEL BUSY": "モデル混雑", + "TURN FAILED": "ターン失敗", + "TURN ERROR": "ターンエラー", "PACE": "ペース", "ZONE": "ゾーン", "WINDOW START": "期間の開始", diff --git a/internal/i18n/locales/nb.json b/internal/i18n/locales/nb.json index 707b97d..ac7df1c 100644 --- a/internal/i18n/locales/nb.json +++ b/internal/i18n/locales/nb.json @@ -1,4 +1,8 @@ { + "ERRORS": "FEIL", + "MODEL BUSY": "MODELL OPPTATT", + "TURN FAILED": "TUR MISLYKTES", + "TURN ERROR": "TURFEIL", "PACE": "TEMPO", "ZONE": "SONE", "WINDOW START": "VINDUSSTART", diff --git a/internal/i18n/locales/nl.json b/internal/i18n/locales/nl.json index 2abdc2b..d56113c 100644 --- a/internal/i18n/locales/nl.json +++ b/internal/i18n/locales/nl.json @@ -1,4 +1,8 @@ { + "ERRORS": "FOUTEN", + "MODEL BUSY": "MODEL BEZET", + "TURN FAILED": "BEURT MISLUKT", + "TURN ERROR": "BEURTFOUT", "PACE": "TEMPO", "ZONE": "ZONE", "WINDOW START": "VENSTERSTART", diff --git a/internal/i18n/locales/pt-BR.json b/internal/i18n/locales/pt-BR.json index 406c2e9..6510108 100644 --- a/internal/i18n/locales/pt-BR.json +++ b/internal/i18n/locales/pt-BR.json @@ -1,4 +1,8 @@ { + "ERRORS": "ERROS", + "MODEL BUSY": "MODELO OCUPADO", + "TURN FAILED": "TURNO FALHOU", + "TURN ERROR": "ERRO DO TURNO", "PACE": "RITMO", "ZONE": "ZONA", "WINDOW START": "INÍCIO DA JANELA", diff --git a/internal/i18n/locales/pt-PT.json b/internal/i18n/locales/pt-PT.json index cec3fda..a393774 100644 --- a/internal/i18n/locales/pt-PT.json +++ b/internal/i18n/locales/pt-PT.json @@ -1,4 +1,8 @@ { + "ERRORS": "ERROS", + "MODEL BUSY": "MODELO OCUPADO", + "TURN FAILED": "TURNO FALHOU", + "TURN ERROR": "ERRO DO TURNO", "PACE": "RITMO", "ZONE": "ZONA", "WINDOW START": "INÍCIO DA JANELA", diff --git a/internal/i18n/locales/ru.json b/internal/i18n/locales/ru.json index a6b5049..8ab6290 100644 --- a/internal/i18n/locales/ru.json +++ b/internal/i18n/locales/ru.json @@ -1,4 +1,8 @@ { + "ERRORS": "ОШИБКИ", + "MODEL BUSY": "МОДЕЛЬ ЗАНЯТА", + "TURN FAILED": "ХОД НЕ УДАЛСЯ", + "TURN ERROR": "ОШИБКА ХОДА", "PACE": "ТЕМП", "ZONE": "ЗОНА", "WINDOW START": "НАЧАЛО ОКНА", diff --git a/internal/i18n/locales/sv.json b/internal/i18n/locales/sv.json index 842c672..1af4a66 100644 --- a/internal/i18n/locales/sv.json +++ b/internal/i18n/locales/sv.json @@ -1,4 +1,8 @@ { + "ERRORS": "FEL", + "MODEL BUSY": "MODELL UPPTAGEN", + "TURN FAILED": "TUR MISSLYCKADES", + "TURN ERROR": "TURFEL", "PACE": "TAKT", "ZONE": "ZON", "WINDOW START": "FÖNSTERSTART", diff --git a/internal/i18n/locales/tr.json b/internal/i18n/locales/tr.json index 650b532..6ff75ea 100644 --- a/internal/i18n/locales/tr.json +++ b/internal/i18n/locales/tr.json @@ -1,4 +1,8 @@ { + "ERRORS": "HATALAR", + "MODEL BUSY": "MODEL MEŞGUL", + "TURN FAILED": "TUR BAŞARISIZ", + "TURN ERROR": "TUR HATASI", "PACE": "HIZ", "ZONE": "BÖLGE", "WINDOW START": "PENCERE BAŞLANGICI", diff --git a/internal/i18n/locales/zh-Hans.json b/internal/i18n/locales/zh-Hans.json index 5bb5e94..6c85278 100644 --- a/internal/i18n/locales/zh-Hans.json +++ b/internal/i18n/locales/zh-Hans.json @@ -1,4 +1,8 @@ { + "ERRORS": "错误", + "MODEL BUSY": "模型繁忙", + "TURN FAILED": "轮次失败", + "TURN ERROR": "轮次错误", "PACE": "速率", "ZONE": "区域", "WINDOW START": "窗口开始", diff --git a/internal/ui/english_snapshot_test.go b/internal/ui/english_snapshot_test.go index 007ddd5..2a83bc0 100644 --- a/internal/ui/english_snapshot_test.go +++ b/internal/ui/english_snapshot_test.go @@ -37,10 +37,10 @@ func TestEnglishPresentationSnapshot(t *testing.T) { } got := fmt.Sprintf("%x", hash.Sum(nil)) // Baseline includes Pace graph controls, explicit panel/border - // backgrounds, Sessions Zero/Close All, the ACTIVE category and responsive + // backgrounds, Sessions Zero/Close All, ACTIVE/ERRORS categories and responsive // summary filters; every theme, view and size // remains covered. The displayed pricing review date is now 2026-10-27. - const want = "20af39ed4d2355a8cc183775b36d8d0ed4dc51a1284858a98c0011587a84a0ca" + const want = "927550ee230c89085468c3aea6a7c9930beaa236d3e07ffc5a479690775fe2e1" if got != want { t.Fatalf("English presentation changed: got %s, want %s", got, want) } diff --git a/internal/ui/monitor.go b/internal/ui/monitor.go index a06b91d..7425841 100644 --- a/internal/ui/monitor.go +++ b/internal/ui/monitor.go @@ -300,7 +300,7 @@ func (m Model) renderMonitorSessionRow(width, height int, session monitorSession } func monitorNeedsAttention(attention codex.SessionAttention) bool { - return attention == codex.SessionAttentionInput || attention == codex.SessionAttentionApproval || attention == codex.SessionAttentionCheck + return attention == codex.SessionAttentionInput || attention == codex.SessionAttentionApproval || attention == codex.SessionAttentionCheck || attention == codex.SessionAttentionError } func monitorSessionColumnWidths(width int) (int, int, bool) { @@ -500,6 +500,8 @@ func monitorAttentionLabel(attention codex.SessionAttention) string { return i18n.Text("APPROVAL NEEDED") case codex.SessionAttentionCheck: return i18n.Text("CHECK SESSION") + case codex.SessionAttentionError: + return i18n.Text("TURN FAILED") default: return i18n.Text("INPUT NEEDED") } @@ -513,6 +515,8 @@ func monitorAttentionStatus(attention codex.SessionAttention) string { return i18n.Text("APPROVAL") case codex.SessionAttentionCheck: return i18n.Text("CHECK") + case codex.SessionAttentionError: + return i18n.Text("TURN FAILED") default: return i18n.Text("INPUT") } diff --git a/internal/ui/monitor_context.go b/internal/ui/monitor_context.go index 79b0a6f..a1a9bf9 100644 --- a/internal/ui/monitor_context.go +++ b/internal/ui/monitor_context.go @@ -13,6 +13,9 @@ import ( ) func monitorSessionAttentionLabel(s monitorSession) string { + if s.attention == codex.SessionAttentionError { + return i18n.Text(codex.SessionFailureLabel(s.preview)) + } return monitorAttentionLabel(s.attention) } @@ -27,6 +30,8 @@ func contextTitle(c codex.SessionContext) string { return i18n.Text("NO CONTEXT") } switch c.Kind { + case codex.SessionContextFailure: + return i18n.Text("TURN ERROR") case codex.SessionContextReply: if c.Streaming { return i18n.Text("REPLY") + " // " + i18n.Text("STREAMING") diff --git a/internal/ui/monitor_failure_test.go b/internal/ui/monitor_failure_test.go new file mode 100644 index 0000000..6b6121b --- /dev/null +++ b/internal/ui/monitor_failure_test.go @@ -0,0 +1,40 @@ +package ui + +import ( + "strings" + "testing" + + "github.com/charmbracelet/x/ansi" + "github.com/merefield/codexometer/internal/codex" +) + +func TestMonitorFailureSummaryFilterPillAndContext(t *testing.T) { + m := attentionTestModel() + s := &m.monitorSessionData[2] + s.attention, s.working = codex.SessionAttentionError, false + s.preview = codex.SessionContext{Kind: codex.SessionContextFailure, FailureCode: "serverOverloaded", Text: "Selected model is at capacity.", ThreadID: s.id} + if monitorSessionStatus(*s) != monitorFilterErrors || monitorSessionRecentlyActive(*s) { + t.Fatal("failure filter/active state wrong") + } + if monitorSessionAttentionLabel(*s) != "MODEL BUSY" || contextTitle(s.preview) != "TURN ERROR" { + t.Fatal("failure label missing") + } + items := m.monitorAttentionSessions() + if len(items) != 3 || items[0].attention != codex.SessionAttentionApproval || items[1].attention != codex.SessionAttentionInput || items[2].attention != codex.SessionAttentionError { + t.Fatal("failure pill priority", items) + } + buttons, _ := m.monitorAttentionButtons(300, 1) + if len(buttons) != 3 || !strings.Contains(buttons[2].label, "MODEL BUSY") { + t.Fatal("failure pill missing", buttons) + } + id := s.id + m.setMonitorFilter(monitorFilterErrors) + rows, _, _ := m.monitorSessionPage(100) + if len(rows) != 1 || rows[0].id != id { + t.Fatal("error filtering", rows) + } + m.setRowContext(id, contextFull) + if text := ansi.Strip(m.render()); !strings.Contains(text, "MODEL BUSY") || !strings.Contains(text, "Selected model is at capacity.") { + t.Fatal("detail omitted failure") + } +} diff --git a/internal/ui/monitor_filter.go b/internal/ui/monitor_filter.go index fbbe688..7e38b34 100644 --- a/internal/ui/monitor_filter.go +++ b/internal/ui/monitor_filter.go @@ -16,6 +16,7 @@ const ( monitorFilterWorking monitorFilterApproval monitorFilterInput + monitorFilterErrors monitorFilterCheck monitorFilterCount ) @@ -28,6 +29,8 @@ func monitorSessionStatus(s monitorSession) monitorStatusFilter { return monitorFilterInput case codex.SessionAttentionCheck: return monitorFilterCheck + case codex.SessionAttentionError: + return monitorFilterErrors case codex.SessionAttentionNone: if s.working { return monitorFilterWorking @@ -50,7 +53,7 @@ func (m Model) monitorSessionInList(s monitorSession) bool { // Use the existing live activity signal; a quiet fallback CHECK is not proof of // recent activity, even while its writer process remains open. func monitorSessionRecentlyActive(s monitorSession) bool { - return s.active && s.attention != codex.SessionAttentionCheck + return s.active && s.attention != codex.SessionAttentionCheck && s.attention != codex.SessionAttentionError } func (m Model) monitorListSessionCount() int { diff --git a/internal/ui/monitor_filter_test.go b/internal/ui/monitor_filter_test.go index fe1e591..cebf409 100644 --- a/internal/ui/monitor_filter_test.go +++ b/internal/ui/monitor_filter_test.go @@ -43,7 +43,7 @@ func filterKey(t *testing.T, m Model, code rune) Model { func TestMonitorStatusFilterCategoriesKeepGlobalTotals(t *testing.T) { m := statusFilterTestModel() - want := [][]string{{"work", "approval", "input", "check", "complete", "idle"}, {"work", "approval", "input", "complete"}, {"work"}, {"approval"}, {"input"}, {"check"}} + want := [][]string{{"work", "approval", "input", "check", "complete", "idle"}, {"work", "approval", "input", "complete"}, {"work"}, {"approval"}, {"input"}, nil, {"check"}} global := strings.Join(m.monitorSummaryLines(120, 2, paletteFor(m.theme)), "\n") for filter := monitorFilterAll; filter < monitorFilterCount; filter++ { m.setMonitorFilter(filter) @@ -237,7 +237,7 @@ func TestMonitorActiveSummaryOneReadySessionAndThreeChecks(t *testing.T) { }} m.syncMonitorSessions(usage, time.Now()) lines := m.monitorSummaryLines(120, 2, paletteFor(m.theme)) - if got := strings.Join(strings.Fields(ansi.Strip(lines[1])), ","); got != "0,4,1,0,0,0,3" { + if got := strings.Join(strings.Fields(ansi.Strip(lines[1])), ","); got != "0,4,1,0,0,0,0,3" { t.Fatalf("unexpected summary: %s; want 4 sessions / 1 active / 3 check", got) } m.setMonitorFilter(monitorFilterActive) diff --git a/internal/ui/monitor_summary.go b/internal/ui/monitor_summary.go index 3599fb1..2770838 100644 --- a/internal/ui/monitor_summary.go +++ b/internal/ui/monitor_summary.go @@ -31,7 +31,7 @@ func (m Model) monitorSummaryLines(width, rows int, colors palette) []string { counts[status]++ } } - labels := []string{"TOKENS", "SESSIONS", "ACTIVE", "WORKING", "APPROVAL", "INPUT", "CHECK"} + labels := []string{"TOKENS", "SESSIONS", "ACTIVE", "WORKING", "APPROVAL", "INPUT", "ERRORS", "CHECK"} values := []string{formatTokens(m.monitorRecordedTokens())} for i, n := range counts { value := strconv.Itoa(n) @@ -87,11 +87,11 @@ func (item monitorAttentionItem) action() string { func (m *Model) monitorAttentionSessions() []monitorAttentionItem { fresh := m.monitorState == monitorRunning && m.monitorError == "" - var groups [5][]monitorAttentionItem + var groups [6][]monitorAttentionItem for _, s := range m.monitorSessionData { scheduled := m.hasSchedule(s.id) if scheduled { - groups[4] = append(groups[4], monitorAttentionItem{monitorSession: s, trigger: true}) + groups[5] = append(groups[5], monitorAttentionItem{monitorSession: s, trigger: true}) } if !fresh || !m.monitorSessionVisible(s) { continue @@ -103,14 +103,16 @@ func (m *Model) monitorAttentionSessions() []monitorAttentionItem { groups[0] = append(groups[0], item) case codex.SessionAttentionInput: groups[1] = append(groups[1], item) + case codex.SessionAttentionError: + groups[2] = append(groups[2], item) case codex.SessionAttentionComplete: if !s.working && !profile && !scheduled { - groups[3] = append(groups[3], item) + groups[4] = append(groups[4], item) } } if profile { item.profile = true - groups[2] = append(groups[2], item) + groups[3] = append(groups[3], item) } } var items []monitorAttentionItem @@ -302,6 +304,9 @@ func (m *Model) layoutMonitorAttention(sessions []monitorAttentionItem, width, r for _, s := range sessions { id := shortSessionID(s.id) state := monitorAttentionStatus(s.attention) + if s.attention == codex.SessionAttentionError { + state = monitorSessionAttentionLabel(s.monitorSession) + } if !s.profile && s.attention == codex.SessionAttentionApproval && s.preview.PendingApprovals > 1 { state = i18n.Format("%s ×%d", state, s.preview.PendingApprovals) } diff --git a/internal/ui/monitor_summary_test.go b/internal/ui/monitor_summary_test.go index e972bdf..e686a76 100644 --- a/internal/ui/monitor_summary_test.go +++ b/internal/ui/monitor_summary_test.go @@ -31,22 +31,22 @@ func TestMonitorSummaryCountersAndObservationState(t *testing.T) { m.monitorSessionData[0].agentCount = 8 lines := m.monitorSummaryLines(120, 2, paletteFor(themeHacker)) values := strings.Fields(ansi.Strip(lines[1])) - if got := strings.Join(values, ","); got != "625,3,3,1,1,1,0" { + if got := strings.Join(values, ","); got != "625,3,3,1,1,1,0,0" { t.Fatalf("counts %s", got) } m.monitorSessionData[2].attention = codex.SessionAttentionCheck values = strings.Fields(ansi.Strip(m.monitorSummaryLines(120, 2, paletteFor(themeHacker))[1])) - if strings.Join(values, ",") != "625,3,2,0,1,1,1" { + if strings.Join(values, ",") != "625,3,2,0,1,1,0,1" { t.Fatal(values) } m.monitorDismissed = map[string]monitorSessionDismissal{"root-one": {}} values = strings.Fields(ansi.Strip(m.monitorSummaryLines(120, 2, paletteFor(themeHacker))[1])) - if strings.Join(values, ",") != "625,2,1,0,0,1,1" { + if strings.Join(values, ",") != "625,2,1,0,0,1,0,1" { t.Fatal("dismissal changed historical tokens or retained visible count", values) } m.monitorError = "lost" values = strings.Fields(ansi.Strip(m.monitorSummaryLines(120, 2, paletteFor(themeHacker))[1])) - if strings.Join(values, ",") != "625,2,—,—,—,—,—" { + if strings.Join(values, ",") != "625,2,—,—,—,—,—,—" { t.Fatal("stale live counts", values) } if len(m.monitorAttentionSessions()) != 0 { @@ -75,7 +75,7 @@ func TestMonitorSummaryCountColours(t *testing.T) { if state == "active" { if i == 2 || i == 3 { style = style.Foreground(colors.success) - } else { + } else if i != int(monitorFilterErrors)+1 { style = style.Foreground(colors.warning) } } diff --git a/internal/web/dist/assets/index-Bg6CQ-Bn.js b/internal/web/dist/assets/index-Bg6CQ-Bn.js deleted file mode 100644 index d338386..0000000 --- a/internal/web/dist/assets/index-Bg6CQ-Bn.js +++ /dev/null @@ -1,46 +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,D=1<<20,ee=1<<25,te=1<<21,O=1<<22,k=1<<23,ne=Symbol(`$state`),re=Symbol(`component`),ie=Symbol(`legacy props`),ae=Symbol(``),oe=Symbol(`attributes`),se=Symbol(`class`),A=Symbol(`style`),ce=Symbol(`text`),le=Symbol(`form reset`),ue=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},de=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),fe={},j=Symbol(`uninitialized`),pe=`http://www.w3.org/1999/xhtml`;function me(){console.warn(`https://svelte.dev/e/derived_inert`)}function he(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function ge(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function _e(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var M=!1;function ve(e){M=e}var N;function ye(e){if(e===null)throw he(),fe;return N=e}function be(){return ye(on(N))}function P(e){if(M){if(on(N)!==null)throw he(),fe;N=e}}function xe(e=1){if(M){for(var t=e,n=N;t--;)n=on(n);N=n}}function Se(e=!0){for(var t=0,n=N;;){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=on(n);e&&n.remove(),n=i}}function Ce(e){if(!e||e.nodeType!==8)throw he(),fe;return e.data}function we(e){return e===this.v}function Te(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Ee(e){return!Te(e,this.v)}function De(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function Oe(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function ke(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Ae(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function je(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Me(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Ne(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Pe(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Fe(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Ie(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Le(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Re(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var ze=!1;function Be(){ze=!0}var Ve=null;function He(e){Ve=e}function Ue(e,t=!1,n){Ve={p:Ve,i:!1,c:null,e:null,s:e,x:null,r:G,l:ze&&!t?{s:null,u:null,$:[]}:null}}function We(e){var t=Ve,n=t.e;if(n!==null){t.e=null;for(var r of n)yn(r)}return e!==void 0&&(t.x=e),t.i=!0,Ve=t.p,Ge(e)}function Ge(e={}){return i(e,re,{value:!0}),e}function Ke(){return!ze||Ve!==null&&Ve.l===null}var qe=[];function Je(){var e=qe;qe=[],m(e)}function Ye(e){if(qe.length===0&&!Ct){var t=qe;queueMicrotask(()=>{t===qe&&Je()})}qe.push(e)}function Xe(){for(;qe.length>0;)Je()}var Ze=~(y|b|v);function Qe(e,t){e.f=e.f&Ze|t}function $e(e){e.f&512||e.deps===null?Qe(e,v):Qe(e,b)}function et(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),Qe(e,v)}function tt(e){M&&an(e)!==null&&sn(e)}var nt=!1;function rt(){nt||(nt=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[le]?.()})},{capture:!0}))}function it(e){var t=W,n=G;Un(null),Wn(null);try{return e()}finally{Un(t),Wn(n)}}function at(e,t,n,r=n){e.addEventListener(t,()=>it(n));let i=e[le];e[le]=i?()=>{i(),r(!0)}:()=>r(!0),rt()}function ot(e,t,n,r){let i=Ke()?ut:pt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=G,c=st(),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){fn(e,s)}ct()}}var d=lt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>ft(e))).then(u).catch(e=>fn(e,s)).finally(d)}l?l.then(()=>{c(),f(),ct()}):f()}function st(){var e=G,t=W,n=Ve,r=I;return function(i=!0){Wn(e),Un(t),He(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function ct(e=!0){Wn(null),Un(null),He(null),e&&I?.deactivate()}function lt(){var e=G,t=e.b,n=I,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 ut(e){var t=2|y;return G!==null&&(G.f|=E),{ctx:Ve,deps:null,effects:null,equals:we,f:t,fn:e,reactions:null,rv:0,v:j,wv:0,parent:G,ac:null}}var dt=Symbol(`obsolete`);function ft(e,t,n){let r=G;r===null&&Oe();var i=void 0,a=Bt(j),o=!W,s=new Set;return Cn(()=>{var t=G,n=h();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==ue&&n.reject(e)}).finally(ct)}catch(e){n.reject(e),ct()}var c=I;if(o){if(t.f&32768)var l=lt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(dt);else for(let e of s.values())e.reject(dt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==dt&&(c.activate(),t?(a.f|=k,Wt(a,t)):(a.f&8388608&&(a.f^=k),Wt(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),_n(()=>{for(let e of s)e.reject(dt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function F(e){let t=ut(e);return Kn(t),t}function pt(e){let t=ut(e);return t.equals=Ee,t}function mt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n{t.ac.abort(ue),t.ac=null}),t.fn!==null&&(t.teardown=f),sr(t,0),On(t))}function vt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&cr(t)}var yt=null,I=null,bt=null,xt=null,St=null,Ct=!1,wt=!1,Tt=null,Et=null,Dt=0,Ot=1,kt=class e{id=Ot++;#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(){yt===null?yt=this:(yt.#n=this,this.#t=yt),yt=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)Qe(r,y),t(r);for(r of n.m)Qe(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),Qe(e,y),this.schedule(e);for(let e of this.#d)Qe(e,b),this.schedule(e);this.apply();for(var t=Tt=[],n=[],r=Et=[];this.#c.length>0;){Dt++>1e3&&(this.#S(),jt());for(let e of this.#g())try{this.#v(e,t,n)}catch(t){throw It(e),this.#h()||this.discard(),t}}if(I=null,r.length>0){var i=e.ensure();for(let e of r)i.schedule(e)}if(Tt=null,Et=null,this.#h()){this.#x(n),this.#x(t);for(let[e,t]of this.#f)Ft(e,t);r.length>0&&I.#_();return}let a=this.#y();if(a)this.#x(n),this.#x(t),a.#b(this);else{this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),bt=this,Nt(n),Nt(t),bt=null,this.#s?.resolve();var o=I;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&&(Rt.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):nr(r)&&(i&16&&this.#d.add(r),cr(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),Qe(i,y),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#S(),I=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(I===null){let t=I=new e;!wt&&!Ct&&Ye(()=>{t.#e||t.flush()})}return I}apply(){xt=null}schedule(e){St=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)?e.b.defer_effect(e):this.#c.push(e)}#S(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?yt=e:t.#t=e,this.linked=!1}}};function At(e){var t=Ct;Ct=!0;try{var n;for(e&&(I!==null&&!I.is_fork&&I.flush(),n=e());;){if(Xe(),I===null)return n;I.flush()}}finally{Ct=t}}function jt(){try{Ne()}catch(e){fn(e,St)}}var Mt=null;function Nt(e){var t=e.length;if(t!==0){for(var n=0;n0)){Rt.clear();for(let e of Mt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Mt.has(n)&&(Mt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||cr(n)}}Mt.clear()}}Mt=null}}function Pt(e){I.schedule(e)}function Ft(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),Qe(e,v);for(var n=e.first;n!==null;)Ft(n,t),n=n.next}}function It(e){Qe(e,v);for(var t=e.first;t!==null;)It(t),t=t.next}var Lt=new Set,Rt=new Map,zt=!1;function Bt(e,t){return{f:0,v:e,reactions:null,equals:we,rv:0,wv:0}}function L(e,t){let n=Bt(e,t);return Kn(n),n}function Vt(e,t=!1,n=!0){let r=Bt(e);return t||(r.equals=Ee),ze&&n&&Ve!==null&&Ve.l!==null&&(Ve.l.s??=[]).push(r),r}function R(e,t,n=!1){return W!==null&&(!Hn||W.f&131072)&&Ke()&&W.f&4325394&&(Gn===null||!Gn.has(e))&&Le(),Wt(e,n?Yt(t):t,Et)}var Ht=null,Ut=0;function Wt(e,t,n=null){if(!e.equals(t)){Bn?Rt.set(e,t):Rt.has(e)||Rt.set(e,e.v);var r=kt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&ht(t),xt===null&&$e(t)}e.wv=tr(),Ht=null,Ut=0,Jt(e,y,n),Ht=null,Ke()&&G!==null&&G.f&1024&&!(G.f&96)&&(Yn===null?Xn([e]):Yn.push(e)),!r.is_fork&&Lt.size>0&&!zt&&Gt()}return t}function Gt(){zt=!1;for(let e of Lt){e.f&1024&&Qe(e,b);let t;try{t=nr(e)}catch{t=!0}t&&cr(e)}Lt.clear()}function Kt(e,t=1){var n=K(e),r=t===1?n++:n--;return R(e,n),r}function qt(e){R(e,e.v+1)}function Jt(e,t,n){var r=e.reactions;if(r!==null){var i=Ke(),a=r.length;if(Ut+=a,Ut>1e5&&Ht===null&&(Ht=new Set),Ht!==null){if(Ht.has(e))return;Ht.add(e)}for(var o=0;o{if($n===d)return e();var t=W,n=$n;Un(null),er(d);var r=e();return Un(t),er(n),r};return i&&r.set(`length`,L(t.length,u)),new Proxy(t,{defineProperty(e,t,n){`value`in n&&n.configurable!==!1&&n.enumerable!==!1&&n.writable!==!1||Fe();var i=r.get(t);return i===void 0?f(()=>{var e=L(n.value,u);return r.set(t,e),e}):R(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>L(j,u));r.set(t,e),qt(o)}}else R(n,j),qt(o);return!0},get(e,n,i){if(n===ne)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>L(Yt(s?e[n]:j),u)),r.set(n,o)),o!==void 0){var c=K(o);return c===j?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=K(i);if(a===j)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===ne)return!0;var n=r.get(t),i=n!==void 0&&n.v!==j||Reflect.has(e,t);return(n!==void 0||G!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>L(i?Yt(e[t]):j,u)),r.set(t,n)),K(n)===j)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;dL(j,u)),r.set(d+``,p)):R(p,j)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>L(void 0,u)),R(c,Yt(n)),r.set(t,c));else{l=c.v!==j;var m=f(()=>Yt(n));R(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&&R(g,_+1)}qt(o)}return!0},ownKeys(e){K(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==j});for(var[n,i]of r)i.v!==j&&!(n in e)&&t.push(n);return t},setPrototypeOf(){Ie()}})}function Xt(e){try{if(typeof e==`object`&&e&&ne in e)return e[ne]}catch{}return e}function Zt(e,t){return Object.is(Xt(e),Xt(t))}var Qt,$t,en,tn;function nn(){if(Qt===void 0){Qt=window,$t=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;en=a(t,`firstChild`).get,tn=a(t,`nextSibling`).get,u(e)&&(e[se]=void 0,e[oe]=null,e[A]=void 0,e.__e=void 0),u(n)&&(n[ce]=void 0)}}function rn(e=``){return document.createTextNode(e)}function an(e){return en.call(e)}function on(e){return tn.call(e)}function z(e,t){if(!M)return an(e);var n=an(N);if(n===null)n=N.appendChild(rn());else if(t&&n.nodeType!==3){var r=rn();return n?.before(r),ye(r),r}return t&&un(n),ye(n),n}function B(e,t=!1){if(!M){var n=an(e);return n instanceof Comment&&n.data===``?on(n):n}if(t){if(N?.nodeType!==3){var r=rn();return N?.before(r),ye(r),r}un(N)}return N}function V(e,t=!1){if(!M)return an(e);var n=z(e,t);return P(e),n}function H(e,t=1,n=!1){let r=M?N:e;for(var i;t--;)i=r,r=on(r);if(!M)return r;if(n){if(r?.nodeType!==3){var a=rn();return r===null?i?.after(a):r.before(a),ye(a),a}un(r)}return ye(r),r}function sn(e){e.textContent=``}function cn(){return!1}function ln(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 un(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 dn(e){var t=G;if(t===null)return W.f|=k,e;if(!(t.f&32768)&&!(t.f&4))throw e;fn(e,t)}function fn(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 pn(e){G===null&&(W===null&&Me(e),je()),Bn&&Ae(e)}function mn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function hn(e,t){var n=G;n!==null&&n.f&8192&&(e|=x);var r={ctx:Ve,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};I?.register_created_effect(r);var i=r;if(e&4)Tt===null?kt.ensure().schedule(r):Tt.push(r);else if(t!==null){try{cr(r)}catch(e){throw An(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&&mn(i,n),W!==null&&W.f&2&&!(e&64))){var a=W;(a.effects??=[]).push(i)}return r}function gn(){return W!==null&&!Hn}function _n(e){let t=hn(8,null);return Qe(t,v),t.teardown=e,t}function vn(e){pn(`$effect`);var t=G.f;if(!W&&t&32&&Ve!==null&&!Ve.i){var n=Ve;(n.e??=[]).push(e)}else return yn(e)}function yn(e){return hn(4|D,e)}function bn(e){return pn(`$effect.pre`),hn(8|D,e)}function xn(e){kt.ensure();let t=hn(64|E,e);return(e={})=>new Promise(n=>{e.outro?Nn(t,()=>{An(t),n(void 0)}):(An(t),n(void 0))})}function Sn(e){return hn(4,e)}function Cn(e){return hn(O|E,e)}function wn(e,t=0){return hn(8|t,e)}function U(e,t=[],n=[],r=[]){ot(r,t,n,t=>{hn(8,()=>{e(...t.map(K))})})}function Tn(e,t=0){return hn(16|t,e)}function En(e){return hn(32|E,e)}function Dn(e){var t=e.teardown;if(t!==null){let n=Bn,r=W;Vn(!0),Un(null);try{t.call(null)}catch(t){fn(t,e.parent)}finally{Vn(n),Un(r)}}}function On(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&it(()=>{e.abort(ue)});var r=n.next;n.f&64?n.parent=null:An(n,t),n=r}}function kn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||An(t),t=n}}function An(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(jn(e.nodes.start,e.nodes.end),n=!0),e.f|=w,On(e,t&&!n),sr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();Dn(e),e.f^=w,e.f|=S;var i=e.parent;i!==null&&i.first!==null&&Mn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function jn(e,t){for(;e!==null;){var n=e===t?null:on(e);e.remove(),e=n}}function Mn(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 Nn(e,t,n=!0){var r=[];e.f|=256,Pn(e,r,!0);var i=()=>{n&&An(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Pn(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);Pn(i,t,o?n:!1)}i=a}}}function Fn(e){e.f&=-257,In(e,!0)}function In(e,t){if(!(e.f&256)&&e.f&8192){e.f^=x,e.f&1024||(Qe(e,y),kt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);In(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 Ln(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:on(n);t.append(n),n=i}}var Rn=null,zn=!1,Bn=!1;function Vn(e){Bn=e}var W=null,Hn=!1;function Un(e){W=e}var G=null;function Wn(e){G=e}var Gn=null;function Kn(e){W!==null&&(W.f&2097152||W.f&2)&&(Gn??=new Set).add(e)}var qn=null,Jn=0,Yn=null;function Xn(e){Yn=e}var Zn=1,Qn=0,$n=Qn;function er(e){$n=e}function tr(){return++Zn}function nr(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&&xt===null&&Qe(e,v)}return!1}function rr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Gn!==null&&Gn.has(e)))for(var i=0;i{e.ac.abort(ue)}),e.ac=null);try{e.f|=te;var u=e.fn,d=u();e.f|=C;var f=ar(e);if(Ke()&&Yn!==null&&!Hn&&f!==null&&!(e.f&6146))for(var p=0;p0)for(t.length=Jn+qn.length,r=0;r{s.ac.abort(ue),s.ac=null,Qe(s,y)}),_t(s),sr(s,0)}}function sr(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,Ye(()=>{i.__removed||t.addEventListener(e,i,r)})):t.addEventListener(e,i,r),i}function xr(e,t,n,r,i){var a={capture:r,passive:i},o=br(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&_n(()=>{o.__removed=!0,t.removeEventListener(e,o,a)})}function q(e,t,n){(t[_r]??={})[e]=n}function Sr(e){for(var t=0;t{wr=!1,Cr=null}));var s=0,c=Cr===e&&e[_r];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[_r]=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=W,f=G;Un(null),Wn(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[_r]?.[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[_r]=t,delete e.currentTarget,Un(d),Wn(f)}}}var Er=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function Dr(e){return Er?.createHTML(e)??e}function Or(e){var t=ln(`template`);return t.innerHTML=Dr(e.replaceAll(``,``)),t.content}function kr(e,t){var n=G;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function J(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(``);return()=>{if(M)return kr(N,null),N;i===void 0&&(i=Or(a?e:``+e),n||(i=an(i)));var t=r||$t?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=an(t),s=t.lastChild;kr(o,s)}else kr(t,t);return t}}function Ar(e,t,n=`svg`){var r=!e.startsWith(``),i=!!(t&1),a=`<${n}>${r?e:``+e}`,o;return()=>{if(M)return kr(N,null),N;if(!o){var e=an(Or(a));if(i)for(o=document.createDocumentFragment();an(e);)o.appendChild(an(e));else o=an(e)}var t=o.cloneNode(!0);if(i){var n=an(t),r=t.lastChild;kr(n,r)}else kr(t,t);return t}}function jr(e,t){return Ar(e,t,`svg`)}function Mr(e=``){if(!M){var t=rn(e+``);return kr(t,t),t}var n=N;return n.nodeType===3?un(n):(n.before(n=rn()),ye(n)),kr(n,n),n}function Nr(){if(M)return kr(N,null),N;var e=document.createDocumentFragment(),t=document.createComment(``),n=rn();return e.append(t,n),kr(t,n),e}function Y(e,t){if(M){var n=G;n.f&32768&&n.nodes.end!==null||(n.nodes.end=N),be()}else e!==null&&e.before(t)}function Pr(){if(M&&N&&N.nodeType===8&&N.textContent?.startsWith(`$`)){let e=N.textContent.substring(1);return be(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}function Fr(e){let t=0,n=Bt(0),r;return()=>{gn()&&(K(n),wn(()=>(t===0&&(r=fr(()=>e(()=>qt(n)))),t+=1,()=>{Ye(()=>{--t,t===0&&(r?.(),r=void 0,qt(n))})})))}}var Ir=T|E;function Lr(e,t,n,r){new Rr(e,t,n,r)}var Rr=class{parent;is_pending=!1;transform_error;#e;#t=M?N: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=Fr(()=>(this.#m=Bt(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=G;t.b=this,t.f|=128,n(e)},this.parent=G.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Tn(()=>{if(M){let e=this.#t;be();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()},Ir),M&&(this.#e=N)}#g(){try{this.#a=En(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);Ye(r),t&&(this.#s=En(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{t?_e():(t=!0,n&&Re(),this.#s!==null&&Nn(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){fn(e,this.#i&&this.#i.parent)}}}}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=En(()=>e(this.#e)),Ye(()=>{var e=this.#c=document.createDocumentFragment(),t=rn(),n=!1;e.append(t),this.#a=this.#S(()=>{try{return En(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){fn(e,this.#i.parent)}return null}}),this.#a===null?(this.#c=null,n&&this.#x(I)):this.#u===0&&(this.#e.before(e),this.#c=null,Nn(this.#o,()=>{this.#o=null}),this.#x(I))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=En(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();Ln(this.#a,e);let t=this.#n.pending;this.#o=En(()=>t(this.#e))}else this.#x(I)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){et(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=G,n=W,r=Ve;Wn(this.#i),Un(this.#i),He(this.#i.ctx);try{return kt.ensure(),e()}finally{Wn(t),Un(n),He(r)}}#C(e,t){this.has_pending_snippet()?(this.#u+=e,this.#u===0&&(this.#x(t),this.#o&&Nn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))):this.parent&&this.parent.#C(e,t)}update_pending_count(e,t){this.#C(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,Ye(()=>{this.#d=!1,this.#m&&Wt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),K(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;I?.is_fork?(this.#a&&I.skip_effect(this.#a),this.#o&&I.skip_effect(this.#o),this.#s&&I.skip_effect(this.#s),I.oncommit(()=>{this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(An(this.#a),null),this.#o&&=(An(this.#o),null),this.#s&&=(An(this.#s),null),M&&(ye(this.#t),xe(),ye(Se()));let t=this.#n.failed,n=e=>{let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&(this.#s=this.#S(()=>{try{return En(()=>{var r=G;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return fn(e,this.#i.parent),null}}))};Ye(()=>{var t;try{t=this.transform_error(e)}catch(e){fn(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>fn(e,this.#i&&this.#i.parent)):n(t)})}};function X(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[ce]??=e.nodeValue)&&(e[ce]=n,e.nodeValue=`${n}`)}function zr(e,t){return Vr(e,t)}var Br=new Map;function Vr(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){nn();var l=void 0,u=xn(()=>{var s=n??t.appendChild(rn());Lr(s,{pending:()=>{}},t=>{Ue({});var n=Ve;if(o&&(n.c=o),a&&(i.$$events=a),M&&kr(t,null),l=e(t,i)||Ge(),M&&(G.nodes.end=N,N===null||N.nodeType!==8||N.data!==`]`))throw he(),fe;We()},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=Br.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,Tr),r.delete(e),r.size===0&&Br.delete(n)):r.set(e,i)}yr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Hr.set(l,u),l}var Hr=new WeakMap,Ur=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)Fn(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(Fn(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&&(An(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();Ln(r,t),t.append(rn()),this.#n.set(e,{effect:r,fragment:t})}else An(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Nn(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)||(An(n.effect),this.#n.delete(e))};ensure(e,t){var n=I,r=cn();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=rn();i.append(a),this.#n.set(e,{effect:En(()=>t(a)),fragment:i})}else this.#t.set(e,En(()=>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 M&&(this.anchor=N),this.#a(n)}};function Z(e,t,n=!1){var r;M&&(r=N,be());var i=new Ur(e),a=n?T:0;function o(e,t){if(M){var n=Ce(r);if(e!==parseInt(n.substring(1))){var a=Se();ye(a),i.anchor=a,ve(!1),i.ensure(e,t),ve(!0);return}}i.ensure(e,t)}Tn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var Wr=Symbol(`NaN`);function Gr(e,t,n){M&&be();var r=new Ur(e),i=!Ke();Tn(()=>{var e=t();e!==e&&(e=Wr),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function Kr(e,t){return t}function qr(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;Jr(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;sn(d),d.append(u),e.items.clear()}Jr(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Jr(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^=ee,ei(d,null,c)):Fn(d):Nn(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:Tn(()=>{p=K(f);var e=p.length;let t=!1;M&&Ce(c)===`[!`!=(e===0)&&(c=Se(),ye(c),ve(!1),t=!0);for(var r=new Set,u=I,v=cn(),y=0;ys(c)):(d=En(()=>s(Yr??=rn())),d.f|=ee)),e>r.size&&ke(``,``,``),M&&e>0&&ye(Se()),!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&&ve(!0),K(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,M&&(c=N)}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?Bt(n):Vt(n,!1,!1):null,l=o&2?Bt(i):null;return{v:c,i:l,e:En(()=>(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=on(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;M&&(r=N,be());var i=new Ur(e);Tn(()=>{var e=t()??null;if(M&&Ce(r)===`[`!=(e!==null)){var a=Se();ye(a),i.anchor=a,ve(!1),i.ensure(e,e&&(t=>n(t,e))),ve(!0)}else 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`]}),_n(()=>{t.disconnect()})}function hi(e,t,n=t){var r=new WeakSet,i=!0;at(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,I!==null&&r.add(I)}),Sn(()=>{var a=t();if(e===document.activeElement){var o=I;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=de?`link`:`LINK`;function xi(e){if(M){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[le]=n,Ye(n),rt()}}function Si(e,t){var n=Ci(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function Q(e,t,n,r){var i=Ci(e);M&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===bi)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[ae]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&Ti(e).has(t)?e[t]=n:e.setAttribute(t,n))}function Ci(e){return e[oe]??={[vi]:e.nodeName.includes(`-`),[yi]:e.namespaceURI===pe}}var wi=new Map;function Ti(e){var t=e.getAttribute(`is`)||e.nodeName,n=wi.get(t);if(n)return n;wi.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 Ei(e,t,n=t){var r=new WeakSet;at(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=ji(e)?Mi(a):a,n(a),I!==null&&r.add(I),await lr(),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))}}}),(M&&e.defaultValue!==e.value||fr(t)==null&&e.value)&&(n(ji(e)?Mi(e.value):e.value),I!==null&&r.add(I)),wn(()=>{var n=t();if(e===document.activeElement){var i=I;if(r.has(i))return}ji(e)&&n===Mi(e.value)||(e.type!==`date`||n||e.value)&&n!==e.value&&(e.value=n??``)})}var Di=new Set;function Oi(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),at(n,`change`,()=>{var e=n.__value;a&&(e=Ai(o,e,n.checked)),i(e)},()=>i(a?[]:null)),wn(()=>{var e=r();M&&n.defaultChecked!==n.checked?s=!0:a?(e||=[],n.checked=e.includes(n.__value)):n.checked=Zt(n.__value,e)}),_n(()=>{var e=o.indexOf(n);e!==-1&&o.splice(e,1)}),Di.has(o)||(Di.add(o),Ye(()=>{o.sort((e,t)=>e.compareDocumentPosition(t)===4?-1:1),Di.delete(o)})),Ye(()=>{if(s){var e=a?Ai(o,e,n.checked):o.find(e=>e.checked)?.__value;i(e)}})}function ki(e,t,n=t){at(e,`change`,t=>{n(t?e.defaultChecked:e.checked)}),(M&&e.defaultChecked!==e.checked||fr(t)==null)&&n(e.checked),wn(()=>{e.checked=!!t()})}function Ai(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 Pi(e,t,n){var r=Ni.observe(e,()=>n(e[t]));Sn(()=>(fr(()=>n(e[t])),r))}function Fi(e,t){return e===t||e?.[ne]===t}function Ii(e=Ge(),t,n,r){var i=Ve.r,a=G;return Sn(()=>{var o,s;return wn(()=>{o=s,s=r?.()||[],fr(()=>{Fi(n(...s),e)||(t(e,...s),o&&Fi(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&&Fi(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Li(e,t,n,r,i){var a=()=>{r(n[e])};n.addEventListener(t,a),i?wn(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&_n(()=>{n.removeEventListener(t,a)})}function Ri(e=!1){let t=Ve,n=t.l.u;if(!n)return;let r=()=>pr(t.s);if(e){let e=0,n={},i=ut(()=>{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=()=>K(i)}n.b.length&&bn(()=>{zi(t,r),m(n.b)}),vn(()=>{let e=fr(()=>n.m.map(p));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&vn(()=>{zi(t,r),m(n.a)})}function zi(e,t){if(e.l.s)for(let t of e.l.s)K(t);t()}var Bi=!1;function Vi(e){var t=Bi;try{return Bi=!1,[e(),Bi]}finally{Bi=t}}var Hi={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===ne||t===ie)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 Ui(...e){return new Proxy({props:e},Hi)}function Wi(e,t,n,r){var i=!ze||!!(n&2),o=!!(n&8),s=!!(n&16),c=r,l=!0,u=void 0,d=()=>s&&i?(u??=ut(r),K(u)):(l&&(l=!1,c=s?fr(r):r),c);let f;if(o){var p=ne in e||ie in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=Vi(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&Pe(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?ut:pt)(()=>(v=!1,g()));o&&K(y);var b=G;return(function(e,t){if(arguments.length>0){let n=t?K(y):i&&o?Yt(e):e;return R(y,n),v=!0,c!==void 0&&(c=n),e}return Bn&&v||b.f&16384?y.v:K(y)})}function Gi(e){Ve===null&&De(`onMount`),ze&&Ve.l!==null?qi(Ve).m.push(e):vn(()=>{let t=fr(e);if(typeof t==`function`)return t})}function Ki(e){Ve===null&&De(`onDestroy`),Gi(()=>()=>fr(e))}function qi(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);function Ji(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 Yi=new class{#e=L(Xi());get _loc(){return K(this.#e)}set _loc(e){R(this.#e,e)}#t=F(()=>this._loc.location);get _location(){return K(this.#t)}set _location(e){R(this.#t,e)}#n=F(()=>this._loc.querystring);get _querystring(){return K(this.#n)}set _querystring(e){R(this.#n,e)}#r=L(void 0);get _params(){return K(this.#r)}set _params(e){R(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=Xi()}):console.warn(`[svelte-spa-router] window 'window' is not defined, skipping initiation`)}};function Xi(){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}}async function Zi(e){if(!e||e.length<1||e.charAt(0)!=`/`&&e.indexOf(`#/`)!==0)throw Error(`Invalid parameter location`);await lr();let t=(e.charAt(0)==`#`?``:`#`)+e;try{let e={...history.state};delete e.__svelte_spa_router_scrollX,delete e.__svelte_spa_router_scrollY,window.history.replaceState(e,``,t)}catch{console.warn("Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.")}window.dispatchEvent(new Event(`hashchange`))}function Qi(e){e?window.scrollTo(e.__svelte_spa_router_scrollX||0,e.__svelte_spa_router_scrollY||0):window.scrollTo(0,0)}function $i(e,t){Ue(t,!0);let n=Wi(t,`routes`,19,()=>({})),r=Wi(t,`prefix`,3,``),i=Wi(t,`restoreScrollState`,3,!1),a=Wi(t,`onConditionsFailed`,3,()=>{}),o=Wi(t,`onRouteLoaded`,3,()=>{}),s=Wi(t,`onRouteLoading`,3,()=>{}),c=Wi(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=Ji(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=L(null),f=L(null),p=L({}),m=null,h=null;vn(()=>{history.scrollRestoration=i()?`manual`:`auto`}),vn(()=>{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 lr(),e(t)}vn(()=>{let e=Yi.loc,t=!1;return fr(async()=>{let n=0;for(;n{t=!0}});function _(e){return e&&typeof e==`object`&&Object.keys(e).length?e:null}var v=Nr(),y=B(v),b=e=>{let t=F(()=>K(d));var n=Nr(),r=B(n),i=e=>{var n=Nr();ni(B(n),()=>K(t),(e,t)=>{t(e,Ui({get params(){return K(f)},get onRouteEvent(){return c()}},()=>K(p)))}),Y(e,n)},a=e=>{var n=Nr();ni(B(n),()=>K(t),(e,t)=>{t(e,Ui({get onRouteEvent(){return c()}},()=>K(p)))}),Y(e,n)};Z(r,e=>{K(f)?e(i):e(a,-1)}),Y(e,n)};Z(y,e=>{K(d)&&e(b)}),Y(e,v),We()}var ea=[`bars`,`pace`,`pie`,`fuel`,`resets`,`thresholds`];function ta(e){return e===`zone`||e===`consumption-pace`?`pace`:typeof e==`string`&&ea.includes(e)?e:`bars`}var na=`codexometer.web.preferences.v1`,ra={statusLine:null,tab:`quota`,view:`bars`,selected:``,defaultDetail:0,layouts:[]};function ia(){try{let e=JSON.parse(localStorage.getItem(na)||`null`);return!e||typeof e!=`object`?ra:{statusLine:Array.isArray(e.statusLine)?[...new Set(e.statusLine.filter(e=>typeof e==`string`&&e.length<64))].slice(0,32):null,tab:[`quota`,`sessions`,`usage`].includes(e.tab)?e.tab:`quota`,view:ta(e.view),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 ra}}var aa=Yt(ia()),oa=Yt({open:!1}),sa=Yt({requests:0});function ca(){let e=JSON.stringify(aa);try{localStorage.setItem(na,e)}catch{}}function la(){return aa.tab===`quota`?`/quota/`+aa.view:`/`+aa.tab}function ua(e){return aa.layouts.find(t=>t.id===e)?.level??aa.defaultDetail}function da(e){aa.defaultDetail=e,aa.layouts=[]}function fa(e,t){aa.layouts=[...aa.layouts.filter(t=>t.id!==e),{id:e,level:Math.max(0,Math.min(2,t))}].slice(-100)}var $=Yt({data:null,connected:!1,error:``}),pa=e=>e==null?`Unavailable`:e.toLocaleString(`en-GB`),ma=e=>!e||String(e).startsWith(`0001-`)?`Not yet available`:new Date(typeof e==`number`?e*1e3:e).toLocaleString(`en-GB`),ha=`codexometer.web.session`,ga=class extends Error{},_a;async function va(e,t,n){if(!_a||!$.connected||!$.data?.control||$.data.sessionsError)throw Error(`Session controls unavailable. Check the live connection.`);return await _a(e,t,n)}function ya(){let e=new AbortController,t,n=``;_a=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 ga(`Action rejected, expired or changed. Refresh and check Codex; nothing was retried.`);return a.json()};try{n=sessionStorage.getItem(ha)||``}catch{}let r=location.hash,i=r.startsWith(`#pair=`)?r.slice(6):``;(i||!r||r===`#`)&&(history.replaceState(null,``,`/#`+la()),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(ha,n)}catch{}}catch(t){e.signal.aborted||($.error=t instanceof Error?t.message:`Pairing failed`);return}n?await o():$.error=`Open the private pairing link printed by codexometer --web in your terminal.`}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(ha)}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(),()=>{_a=void 0,e.abort(),clearTimeout(t),$.connected=!1}}Be();var ba=J(`

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

`),xa=J(`

`),Sa=J(`

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),Ca=J(`

No threshold-based model steps were configured at launch.

`);function wa(e,t){Ue(t,!1),Ri();var n=Nr(),r=B(n),i=e=>{var t=Sa(),n=B(t),r=V(n),i=H(n,2),a=e=>{Y(e,ba())};Z(i,e=>{$.data.quotaError&&e(a)});var o=H(i,2),s=z(o),c=V(s),l=H(s,4);Xr(l,5,()=>$.data.thresholds,Kr,(e,t)=>{var n=xa();let r;var i=z(n),a=V(i),o=H(i,2),s=z(o),c=V(s,!0),l=V(H(s,2));P(o);var u=H(o,2),d=V(u,!0),f=V(H(u,2));P(n),U((e,i)=>{r=ci(n,1,``,null,r,{active:K(t).state===`ACTIVE`,next:K(t).state===`NEXT`}),X(a,`${K(t).threshold??``}%`),X(c,K(t).model),X(l,`${e??``} REASONING // ${i??``} - SPEED`),X(d,K(t).mode),X(f,`${K(t).state??``}${K(t).state===`NEXT`?` // ${K(t).remaining||0} PP TO GO`:``}`)},[()=>K(t).effort.toUpperCase(),()=>K(t).speed.toUpperCase()]),Y(e,n)}),P(l),P(o),U(e=>{X(r,`MODEL STEP POLICY // OBSERVED ${e??``}`),X(c,`THRESHOLDS // ${$.data.thresholds.length??``} CONFIGURED`)},[()=>ma($.data.quotaAt)]),Y(e,t)},a=e=>{Y(e,Ca())};Z(r,e=>{$.data?.thresholds?.length?e(i):e(a,-1)}),Y(e,n),We()}var Ta=jr(` `,1),Ea=jr(` `,1),Da=jr(` `,1),Oa=jr(` `,1),ka=J(`
`,1),Aa=J(` `),ja=J(`
Quota observations
Observed atPeriod elapsedConsumedTrail segment
`),Ma=J(`
OBSERVATION DATA
`),Na=J(`
CONSUMPTIONQUOTA PERIOD ELAPSED
`,1);function Pa(e,t){let n=Pr();Ue(t,!0);let r=Wi(t,`trail`,19,()=>[]),i=L(!1),a=L(!0),o=L(`window`),s=[0,25,50,75,100],c={off:0,halfHour:30,hour:60,day:1440,window:0},l=L(400),u=L(240),d=F(()=>K(l)-24),f=F(()=>K(u)-48),p=F(()=>Math.max(1,K(d)-48)),m=F(()=>Math.max(1,K(f)-20)),h=F(()=>48+Math.max(0,Math.min(100,t.elapsed))/100*K(p));function g(e){return K(f)-(e-0)/100*K(m)}let _=F(()=>g(t.used)),v=F(()=>t.used-t.elapsed),y=F(()=>r().map((e,t)=>`${t===0||e.break?`M`:`L`}${48+e.elapsed/100*K(p)} ${g(e.used)}`).join(` `)),b=F(()=>{let e=0;for(let t=r().length-1;t>0;t--)if(r()[t].break){e=t;break}return r().slice(e)}),x=F(()=>K(b).length<2?0:Math.max(0,Date.parse(K(b).at(-1).at)-Date.parse(K(b)[0].at)));function S(e){if(K(x)Date.parse(e.at)>=t).length>=2}let C=F(()=>({off:!0,halfHour:S(18e5),hour:S(36e5),day:S(864e5),window:Number.isFinite(t.elapsed)&&t.elapsed>0&&Number.isFinite(t.used)}));vn(()=>{K(o)!==`window`&&!K(C)[K(o)]&&R(o,`window`)});function w(e){if(e===`off`||!K(C)[e])return[];let t=c[e]*6e4,n=Date.parse(K(b).at(-1).at)-t,r=K(b).findIndex(e=>Date.parse(e.at)>=n);return r<0?[]:K(b).slice(r)}function T(e){if(e.length<2)return null;let t=e.reduce((e,t)=>e+t.elapsed,0)/e.length,n=e.reduce((e,t)=>e+t.used,0)/e.length,r=0,i=0;for(let a of e)r+=(a.elapsed-t)*(a.used-n),i+=(a.elapsed-t)**2;return i>0?Math.max(0,r/i):null}let E=F(()=>{let e=K(o)===`window`&&K(C).window?t.used/t.elapsed:T(w(K(o)));if(e===null||!t.duration)return null;let n=t.used+e*(100-t.elapsed),r=K(o)===`window`?0:t.used-e*t.elapsed,i=e,a=Math.max(0,t.elapsed-c[K(o)]/t.duration*100);K(o)===`window`&&(a=0);let s=100;if(i!==0){let e=(0-r)/i,t=(100-r)/i;a=Math.max(a,Math.min(e,t)),s=Math.min(100,Math.max(e,t))}if(a>s)return null;let l=r+i*a,u=r+i*s,d=Math.hypot((s-a)/100*K(p),(u-l)/100*K(m)),f=Math.max(3,Math.min(9,Math.floor(d/65)+2));return{path:`M${Array.from({length:f},(e,t)=>{let n=a+(s-a)*t/(f-1),r=l+(u-l)*t/(f-1);return`${48+n/100*K(p)} ${g(r)}`}).join(` L`)}`,projected:n,safe:n<=100}}),D=F(()=>{if(K(b).length===0)return`NO OBSERVATIONS`;if(K(b).length===1)return`ONE OBSERVATION`;let e=Math.floor(K(x)/6e4);if(e<60)return`${e} MIN CONTINUOUS`;let t=Math.floor(e/60);return t<24?`${t}H CONTINUOUS`:`${Math.floor(t/24)}D ${t%24}H CONTINUOUS`});var ee=Na(),te=B(ee),O=z(te);let k;var ne=z(O),re=z(ne),ie=H(re);P(ne);var ae=H(ne),oe=H(ae);Xr(oe,17,()=>s,Kr,(e,t)=>{var n=Ta(),r=B(n),i=H(r),a=V(i);U(()=>{Q(r,`x1`,48+K(t)/100*K(p)),Q(r,`x2`,48+K(t)/100*K(p)),Q(r,`y2`,K(f)),Q(i,`x`,48+K(t)/100*K(p)),Q(i,`y`,K(f)+20),X(a,`${K(t)??``}%`)}),Y(e,n)});var se=H(oe);Xr(se,17,()=>s,Kr,(e,t)=>{var n=Ea(),r=B(n),i=H(r),a=V(i);U((e,n,o)=>{Q(r,`y1`,e),Q(r,`x2`,K(d)),Q(r,`y2`,n),Q(i,`y`,o),X(a,`${K(t)??``}%`)},[()=>g(K(t)),()=>g(K(t)),()=>g(K(t))+4]),Y(e,n)});var A=H(se),ce=H(A),le=H(ce),ue=e=>{var t=Da(),n=B(t),i=H(n),a=H(i),o=V(z(a));P(a),U((e,t)=>{Q(n,`d`,K(y)),Q(i,`d`,K(y)),Q(a,`cx`,48+r()[0].elapsed/100*K(p)),Q(a,`cy`,e),X(o,`First observation: ${t??``}`)},[()=>g(r()[0].used),()=>ma(r()[0].at)]),Y(e,t)};Z(le,e=>{K(a)&&r().length&&e(ue)});var de=H(le),fe=e=>{var t=Oa(),r=B(t),i=H(r),a=V(z(i));P(i),U(e=>{Q(r,`d`,K(E).path),Q(i,`d`,K(E).path),Q(i,`marker-mid`,`url(#${n}-trend-arrow)`),X(a,`${K(o)===`window`?`Window-average pace`:`Recent consumption trajectory`} projects ${e??``}% at reset if continued`)},[()=>K(E).projected.toFixed(1)]),Y(e,t)};Z(de,e=>{K(E)&&e(fe)});var j=H(de,2),pe=H(j),me=H(pe),he=V(z(me));P(me),P(O),P(te);var ge=H(te,2),_e=z(ge),M=z(_e),ve=H(M,3),N=V(ve,!0),ye=H(ve,2),be=e=>{var t=ka(),n=V(H(B(t)));U(e=>X(n,`TREND // ${e??``}`),[()=>K(E).projected>=100?`QUOTA EXHAUSTION PROJECTED`:`${K(E).projected.toFixed(1)}% PROJECTED AT RESET`]),Y(e,t)};Z(ye,e=>{K(E)&&e(be)}),P(_e);var Se=H(_e,2),Ce=z(Se),we=z(Ce);xi(we),xe(),P(Ce);var Te=H(Ce,2),Ee=H(z(Te),2),De=z(Ee);De.value=De.__value=`off`;var Oe=H(De),ke=V(Oe);Oe.value=Oe.__value=`halfHour`;var Ae=H(Oe),je=V(Ae);Ae.value=Ae.__value=`hour`;var Me=H(Ae),Ne=V(Me);Me.value=Me.__value=`day`;var Pe=H(Me),Fe=V(Pe);Pe.value=Pe.__value=`window`,P(Ee),mi(Ee),P(Te);var Ie=V(H(Te,2));P(Se),P(ge);var Le=H(ge,2),Re=e=>{var t=Ma(),n=H(z(t),2),a=e=>{var t=ja(),n=z(t),i=H(z(n),2);Xr(i,21,r,Kr,(e,t,n)=>{var r=Aa(),i=z(r),a=z(i),o=V(a,!0);P(i);var s=H(i),c=V(s),l=H(s),u=V(l),d=V(H(l),!0);P(r),U((e,r)=>{Q(a,`datetime`,K(t).at),X(o,e),X(c,`${r??``}%`),X(u,`${K(t).used??``}%`),X(d,n===0?`First observation`:K(t).break?`Gap before this observation`:`Connected to previous observation`)},[()=>ma(K(t).at),()=>K(t).elapsed.toFixed(1)]),Y(e,r)}),P(i),P(n),P(t),Y(e,t)};Z(n,e=>{K(i)&&e(a)}),P(t),Li(`open`,`toggle`,t,e=>R(i,e),()=>K(i)),Y(e,t)};Z(Le,e=>{r().length&&e(Re)}),U((e,r,i,a,o,s)=>{Q(O,`viewBox`,`0 0 ${K(l)} ${K(u)}`),Q(O,`aria-label`,e),k=ui(O,``,k,{"--trend-color":K(E)?.safe?`#115b35`:`#7f1825`}),Q(re,`id`,n),Q(ie,`id`,n+`-trend-arrow`),Q(ae,`width`,K(p)),Q(ae,`height`,K(m)),Q(ae,`fill`,`url(#${n})`),Q(A,`d`,`M48 20 V${K(f)} H${K(d)}`),Q(ce,`y1`,r),Q(ce,`x2`,K(d)),Q(ce,`y2`,i),Q(j,`x`,48+K(p)/2),Q(j,`y`,K(u)-5),Q(pe,`cx`,K(h)),Q(pe,`cy`,K(_)),Q(me,`cx`,K(h)),Q(me,`cy`,K(_)),X(he,`${t.used??``}% consumed // ${a??``}% of period elapsed`),X(M,`${t.used??``}% USED // ${o??``}% TIME ELAPSED`),X(N,s),Oe.disabled=!K(C).halfHour,X(ke,`LAST 30 MINUTES${K(C).halfHour?``:` — UNAVAILABLE`}`),Ae.disabled=!K(C).hour,X(je,`LAST HOUR${K(C).hour?``:` — UNAVAILABLE`}`),Me.disabled=!K(C).day,X(Ne,`LAST 24 HOURS${K(C).day?``:` — UNAVAILABLE`}`),Pe.disabled=!K(C).window,X(Fe,`FROM WINDOW START${K(C).window?``:` — NO TIME ELAPSED`}`),X(Ie,`HISTORY // ${K(D)??``}`)},[()=>`Pace: ${t.used}% consumed, ${t.elapsed.toFixed(1)}% of quota period elapsed. ${K(v)>0?`Above`:K(v)<0?`Below`:`On`} the steady-consumption line.${K(a)&&r().length?` Trace path contains ${r().length} ${r().length===1?`observation`:`observations`}; gaps are not interpolated.`:``}`,()=>g(0),()=>g(100),()=>t.elapsed.toFixed(1),()=>t.elapsed.toFixed(1),()=>Math.abs(K(v))<.05?`ON PACE`:K(v)>0?`ABOVE THE LINE — CONSUMING FASTER THAN TIME`:`BELOW THE LINE — WITHIN PACE`]),Pi(te,`clientWidth`,e=>R(l,e)),Pi(te,`clientHeight`,e=>R(u,e)),ki(we,()=>K(a),e=>R(a,e)),hi(Ee,()=>K(o),e=>R(o,e)),Y(e,ee),We()}var Fa=J(` `),Ia=J(`

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

`),La=J(`

`),Ra=J(`

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

`),za=J(`

`),Ba=J(`

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

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

`),Va=J(` `,1),Ha=jr(``),Ua=jr(``),Wa=J(`
`),Ga=J(`

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

`),Ka=J(`
EMPTYFULL
`),qa=J(`

`,1),Ja=J(`
`,1),Ya=J(`

`),Xa=J(`

`),Za=J(`

No quota windows reported yet.

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

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

`,1),eo=J(` `,1);function to(e,t){Ue(t,!0);let n=Wi(t,`params`,19,()=>({})),r=F(()=>ea.filter(e=>e!==`thresholds`||!!$.data?.thresholds?.length)),i=L(Yt(Date.now())),a=F(()=>K(r).includes(ta(n().view))?ta(n().view):`bars`);Gi(()=>{let e=setInterval(()=>R(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-K(i))/(e.duration*6e4))))}vn(()=>{aa.view=K(a),(n().view===`zone`||n().view===`consumption-pace`)&&Zi(`/quota/pace`)});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=eo(),l=B(c);Xr(l,21,()=>K(r),Kr,(e,t)=>{var n=Fa();let r;var i=V(n,!0);U(e=>{Q(n,`href`,`#/quota/`+K(t)),Q(n,`aria-current`,K(a)===K(t)?`page`:void 0),r=ci(n,1,``,null,r,{active:K(a)===K(t)}),X(i,e)},[()=>K(t)===`fuel`?`FUEL TANK`:K(t).toUpperCase()]),Y(e,n)}),P(l);var u=H(l,2),d=e=>{var t=$a(),n=B(t),r=e=>{Y(e,Ia())};Z(n,e=>{$.data.quotaError&&e(r)});var i=H(n,2),c=e=>{var t=La(),n=V(t);U(()=>X(n,`Last usage accounting issue: - ${$.data.usageDiagnostic??``}`)),Y(e,t)};Z(i,e=>{$.data.usageDiagnostic&&e(c)});var l=H(i,2),u=V(l),d=H(l,2),f=e=>{wa(e,{})},p=e=>{var t=Ba(),n=z(t),r=V(n),i=H(n,4),a=e=>{Y(e,Ra())};Z(i,e=>{$.data.credits.length||e(a)}),Xr(H(i,2),17,()=>$.data.credits,Kr,(e,t)=>{var n=za(),r=z(n),i=V(r),a=V(H(r,2),!0);P(n),U(e=>{X(i,`${(K(t).title||`Quota reset`)??``} // ${K(t).status??``}`),X(a,e)},[()=>K(t).expiryKnown?K(t).expires?`EXPIRES `+ma(K(t).expires):`Does not expire`:`Expiry information unavailable`]),Y(e,n)}),xe(2),P(t),U(()=>X(r,`RESET INVENTORY // ${$.data.creditCount??``} AVAILABLE`)),Y(e,t)},m=e=>{var t=Qa(),n=B(t);let r;Xr(n,21,()=>$.data.meters,Kr,(e,t)=>{let n=F(()=>o(K(t)));var r=Xa(),i=z(r),c=V(i,!0),l=H(i,2),u=z(l),d=e=>{var n=Va(),r=B(n),i=V(r),a=V(H(r));U(()=>{X(i,`FREE ${100-K(t).used}%`),X(a,`USED ${K(t).used??``}%`)}),Y(e,n)},f=e=>{var n=Va(),r=B(n),i=V(r),a=V(H(r));U(()=>{X(i,`USED ${K(t).used??``}%`),X(a,`FREE ${100-K(t).used}%`)}),Y(e,n)};Z(u,e=>{K(a)===`fuel`?e(d):e(f,-1)}),P(l);var p=H(l,2);let m;var h=z(p),g=e=>{var n=Wa(),r=z(n),i=H(z(r)),a=e=>{Y(e,Ha())},o=e=>{var n=Ua();U(e=>Q(n,`d`,e),[()=>s(K(t).used)]),Y(e,n)};Z(i,e=>{K(t).used>=100?e(a):K(t).used>0&&e(o,1)}),P(r),P(n),U(()=>Q(r,`aria-label`,`${K(t).used}% quota used`)),Y(e,n)},_=e=>{var r=Nr(),i=B(r),a=e=>{{let r=F(()=>K(t).trail||[]);Pa(e,{get used(){return K(t).used},get elapsed(){return K(n)},get trail(){return K(r)},get duration(){return K(t).duration}})}},o=e=>{Y(e,Ga())};Z(i,e=>{K(n)===null?e(o,-1):e(a)}),Y(e,r)},v=e=>{var r=Ja(),i=B(r),o=z(i);let s;P(i);var c=H(i,2),l=e=>{Y(e,Ka())};Z(c,e=>{K(a)===`fuel`&&e(l)});var u=H(c,2),d=e=>{var t=qa(),r=B(t),i=V(r),o=H(r,2),s=z(o);let c;P(o),U(e=>{X(i,`RESET CYCLE // ${e??``}% ELAPSED`),c=ui(s,``,c,{width:`${K(a)===`fuel`?100-K(n):K(n)}%`})},[()=>Math.floor(K(n))]),Y(e,t)};Z(u,e=>{K(n)!==null&&e(d)}),U(()=>{Q(i,`aria-label`,K(a)===`fuel`?`Fuel remaining`:`Quota used`),Q(i,`aria-valuenow`,K(a)===`fuel`?100-K(t).used:K(t).used),s=ui(o,``,s,{width:`${K(a)===`fuel`?100-K(t).used:K(t).used}%`})}),Y(e,r)};Z(h,e=>{K(a)===`pie`?e(g):K(a)===`pace`?e(_,1):e(v,-1)}),P(p);var y=H(p,2),b=V(y),x=H(y,2),S=e=>{var n=Ya(),r=V(n,!0);U(()=>X(r,K(t).details)),Y(e,n)};Z(x,e=>{K(t).details&&e(S)}),P(r),U(e=>{X(c,K(t).name),m=ci(p,1,`meter-graphic`,null,m,{"bar-graphic":K(a)===`bars`||K(a)===`fuel`}),X(b,`RESETS // ${e??``}`)},[()=>ma(K(t).reset)]),Y(e,r)}),P(n);var i=H(n,2),c=e=>{Y(e,Za())};Z(i,e=>{$.data.meters.length||e(c)}),U(()=>r=ci(n,1,`quota-grid`,null,r,{radial:K(a)===`pie`,zone:K(a)===`pace`})),Y(e,t)};Z(d,e=>{K(a)===`thresholds`?e(f):K(a)===`resets`?e(p,1):e(m,-1)}),xe(2),U(e=>X(u,`QUOTA // OBSERVED ${e??``}`),[()=>ma($.data.quotaAt)]),Y(e,t)};Z(u,e=>{$.data&&e(d)}),Y(e,c),We()}var no=J(`
`),ro=J(`

`,1);function io(e,t){Ue(t,!0);let n=Wi(t,`values`,19,()=>[]),r=Wi(t,`label`,3,`Token activity`),i=Wi(t,`capacity`,3,0),a=F(()=>Math.max(0,...n())),o=F(()=>i()>n().length?[...Array(i()-n().length).fill(0),...n()]:n());var s=ro(),c=B(s),l=V(c),u=H(c,2);Xr(u,21,()=>K(o),Kr,(e,t)=>{var n=no();let r;U((e,t)=>{Q(n,`title`,e),r=ui(n,``,r,{height:t})},[()=>K(t).toLocaleString(`en-GB`)+` tokens`,()=>`${100*K(t)/Math.max(1,K(a))}%`]),Y(e,n)}),P(u),U((e,t)=>{X(l,`SCALE // 0 — ${e??``} TOKENS`),Q(u,`aria-label`,t)},[()=>K(a).toLocaleString(`en-GB`),()=>`${r()}. Peak ${K(a).toLocaleString(`en-GB`)} tokens.`]),Y(e,s),We()}function ao(e){if(!e||![`LAST REPLY`,`LAST ACTIVITY`].includes(e.contextKind))return``;let t=e.text||e.contextKind===`LAST ACTIVITY`&&e.workingCommand||``;return t.trim()?t:``}var oo=J(` `),so=J(``),co=J(`

`),lo=J(`

`,1),uo=J(`

`),fo=J(`

Loading / sending…

`),po=J(`
`),mo=J(`

`),ho=J(`

 
`),go=J(`
`),_o=J(`
`),vo=J(`

Review expired. Press Enter to review again.

`),yo=J(`

`,1),bo=J(`

`,1),xo=J(`

No available matching commands.

`),So=J(` `,1),Co=J(`

`),wo=J(`

Review expired. Review the option again.

`),To=J(``),Eo=J(``),Do=J(``),Oo=J(``),ko=J(``),Ao=J(``),jo=J(``),Mo=J(`
`),No=J(`
`);function Po(e,t){let n=Pr();Ue(t,!0);let r=e=>{var t=Nr();Xr(B(t),19,()=>K(fe),e=>e.id,(e,t,r)=>{var i=so();let o;var s=z(i),c=V(s,!0),l=H(s),u=V(l),d=H(l),f=e=>{var n=oo(),r=V(n,!0);U(()=>X(r,K(t).help)),Y(e,n)};Z(d,e=>{(K(v)?.path===``||K(A))&&e(f)}),P(i),U((e,s)=>{Q(i,`id`,`${n}-${K(r)}`),Q(i,`role`,K(A)?`option`:void 0),Q(i,`aria-selected`,K(A)?K(T)===K(r):void 0),Q(i,`tabindex`,K(A)?-1:void 0),i.disabled=K(g)||K(he)&&!a(),Q(i,`title`,K(t).help),Q(i,`aria-label`,e),o=ci(i,1,`svelte-7bfwr9`,null,o,{suggested:K(T)===K(r)}),X(c,K(t).label),X(u,`${K(A)&&K(t).selected?` // CURRENT`:``}${s??``}`)},[()=>K(t).label+(K(A)&&K(t).selected?` // CURRENT`:``)+ie(K(t)),()=>ie(K(t))]),xr(`focus`,i,()=>{K(A)||_e(K(r))}),q(`click`,i,()=>{_e(K(r)),ye(K(t))}),Y(e,i)}),Y(e,t)},i=Wi(t,`query`,3,``),a=Wi(t,`localOnly`,3,!1),o=Wi(t,`oncopy`,3,()=>{}),s=Wi(t,`onchange`,3,()=>{}),c=Wi(t,`oncomplete`,3,e=>{}),l=[`statusline`,`usage`,`copy`,`theme`,`exit`,`quit`];function u(){return[{id:`local-statusline`,label:`/statusline`,help:`Choose fields for Codexometer’s detail footer.`,next:`statusline`},{id:`local-usage`,label:`/usage`,help:`Open Codexometer’s usage history. Quota and reset views remain available.`,next:`usage`},{id:`local-copy`,label:`/copy`,help:`Copy the selected session’s observed reply or activity with its Copy control.`,next:`copy`},{id:`local-theme`,label:`/theme`,help:`Open the existing Codexometer theme selector. Saved browser display preferences only.`,next:`theme`},{id:`local-exit`,label:`/exit`,help:`Leave session detail and return to Sessions. The local server remains running.`,next:`exit`},{id:`local-quit`,label:`/quit`,help:`Alias for /exit: return to Sessions. The local server remains running.`,next:`quit`}]}function d(){return{title:`/ COMMANDS`,help:`Local Codexometer commands remain available without session control.`,path:``,revision:``,choices:u()}}function f(){R(b,``),R(O,``),R(x,0),R(k,[],!0)}function p(){w++,R(g,!1),R(h,!1),R(E,i()),f(),R(_,``),K(ue)?s()():c()(i())}async function m(e){if(!l.includes(e))return!1;if(e===`copy`&&!ao($.data?.sessions.find(e=>e.id===t.session)))return R(_,`No reply or activity text is available to copy for this session.`),!0;if(e===`copy`){let e=o()();p(),await e}else p(),e===`usage`?location.hash=`/usage`:e===`theme`?sa.requests++:e===`statusline`?oa.open=!0:location.hash=`/sessions`;return!0}let h=L(!1),g=L(!1),_=L(``),v=L(null),y=L(null),b=L(``),x=L(0),S=L(Yt(Date.now())),C=L(``),w=0,T=L(0),E=L(null),D=L(void 0),ee=L(void 0),te=L(void 0),O=L(``),k=L(Yt([])),ne=F(()=>K(v)?.path.startsWith(`rename/`)||K(v)?.path.startsWith(`cd/`)),re=F(()=>!!K(y)&&!K(ne)||!!K(O)||K(k).length>0);function ie(e){return e.unavailable?e.unavailable.startsWith(`Waiting for idle.`)?` // WAITING FOR IDLE`:` // UNAVAILABLE`:e.next?` →`:e.action?``:` // HELP`}async function ae(e){K(v)&&!(K(ge)&&K(de))&&R(k,[...K(k),{path:K(v).path,index:K(T),input:K(C)}],!0),await N(e)}async function oe(){if(!K(re))return;if(w++,R(g,!1),R(b,``),R(x,0),R(_,``),K(O)){R(O,``),K(D)?.focus();return}if(K(y)&&!K(ne)){R(y,null),await lr(),K(D)?.focus();return}let e=K(k).at(-1);e&&(R(k,K(k).slice(0,-1),!0),await N(e.path,e))}function se(){K(v)&&K(C).trim()&&!K(g)&&!K(he)&&ae(K(v).path+`/`+encodeURIComponent(K(C).trim()))}let A=F(()=>K(h)&&!!K(v)?.picker&&!K(y)),ce=F(()=>K(h)&&!K(v)?.input&&!K(y)),le=setInterval(()=>{R(S,Date.now(),!0)},1e3);Ki(()=>{clearInterval(le),w++});let ue=F(()=>i().trim().startsWith(`/`)&&!i().trim().startsWith(`//`)),de=F(()=>K(v)?.path===``&&K(ue)?i().trim().slice(1).toLowerCase():``),fe=F(()=>(K(v)?.choices||[]).filter(e=>!K(de)||e.label.toLowerCase().startsWith(`/`+K(de)))),j=F(()=>K(y)||K(fe)[K(T)]),pe=F(()=>!!K(b)&&K(S)K(fe).find(e=>e.id===K(O))),he=F(()=>!$.connected||!!$.data?.sessionsError),ge=F(()=>K(h)&&K(ue)&&(!K(v)||K(v).path===``)&&!K(y));vn(()=>{i(),R(T,0)}),vn(()=>{let e=K(T);K(fe),K(ce)&&lr().then(()=>{let t=K(D)?.children[e];if(!t||!K(D))return;let n=K(D).getBoundingClientRect(),r=t.getBoundingClientRect();r.topn.bottom&&(K(D).scrollTop+=r.bottom-n.bottom)})});function _e(e){K(T)!==e&&K(v)?.picker&&(R(O,``),R(b,``),R(x,0),R(_,``),w++),R(T,e,!0)}function M(){w++,R(g,!1),R(h,!1),R(E,i()),f(),c()(i())}function ve(e){let t=!!K(ee)?.contains(e.target);if(!K(h)||!K(ce)&&!K(y)&&!K(v)?.input||!K(ue)&&!t||K(he)&&!a()||e.isComposing||e.ctrlKey||e.metaKey||e.altKey)return;if(K(v)?.input){e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),M());return}let n=e.key===`ArrowLeft`,r=e.key.toLowerCase()===`f`,i=e.key.toLowerCase()===`c`;if((i||r||n)&&!t||![`ArrowUp`,`ArrowDown`,`Tab`,`Enter`,`Escape`].includes(e.key)&&!i&&!r&&!n||e.key===`Tab`&&(K(y)||K(v)?.path!==``||e.shiftKey)||e.key===`Enter`&&e.target instanceof Element&&e.target.closest(`button`)&&!K(D)?.contains(e.target)&&!e.target.closest(`[data-command-confirm]`)||K(y)&&!t||K(y)&&[`ArrowUp`,`ArrowDown`].includes(e.key))return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){M();return}if(K(g)||e.repeat&&i)return;if(n){K(re)&&oe();return}if(r){N(K(v)?.path||``,void 0,!0);return}if(i){(K(y)?.action||K(A)&&K(O))&&xe();return}if(K(y)){e.key===`Enter`&&K(y).action&&!K(pe)&&!K(_)&&be(K(y));return}if(e.key===`ArrowUp`||e.key===`ArrowDown`){_e(Math.min(Math.max(K(T)+(e.key===`ArrowUp`?-1:1),0),Math.max(K(fe).length-1,0))),!K(A)&&K(D)?.contains(e.target)&&lr().then(()=>(K(D)?.children[K(T)])?.focus());return}let o=K(fe)[K(T)];o&&(e.key===`Tab`?c()(o.label):K(A)?be(o):ye(o))}vn(()=>{K(he)&&!a()&&(w++,R(g,!1),f(),K(h)&&(R(h,!1),R(E,i())),R(v,null),R(y,null))}),vn(()=>{K(ue)&&!K(h)&&i()!==K(E)&&(!K(he)||a())&&(f(),R(h,!0),N(``))});async function N(e,n,r=!1){let i=++w;if(K(v)&&R(v,{...K(v),path:e},!0),n&&R(C,n.input,!0),R(g,!0),R(y,null),R(O,``),R(b,``),R(x,0),R(_,``),a())R(v,d(),!0),R(T,n?.index??0,!0),R(g,!1);else try{let a=await va(`commands`,{session:t.session,command:{mode:`list`,path:e,...r?{refresh:!0}:{}}});i===w&&((e===``||e===`help`)&&(a.choices=[...a.choices.filter(e=>!l.includes(e.label.replace(/^\//,``))),...u()]),R(v,a,!0),R(T,n?Math.min(n.index,Math.max(a.choices.length-1,0)):a.picker?Math.max(a.choices.findIndex(e=>e.selected),0):0,!0),a.picker&&lr().then(()=>K(D)?.focus()),R(C,n?.input??a.value??``,!0),n&&lr().then(()=>{a.input?K(ee)?.querySelector(`input`)?.focus():K(D)?.focus()}),(a.path.startsWith(`rename/`)||a.path.startsWith(`cd/`))&&a.choices.length===1&&(R(g,!1),ye(a.choices[0])))}catch{i===w&&(R(_,`Command catalogue unavailable. Use Codex.`),e===``||e===`help`?(R(v,d(),!0),R(_,``)):R(v,{title:`/`+e,help:``,path:e,revision:``,choices:[]},!0))}finally{i===w&&R(g,!1)}}async function ye(e){e.unavailable||K(g)||e.next&&await m(e.next)||K(_)||(K(v)?.picker?(_e(K(fe).findIndex(t=>t.id===e.id)),K(D)?.focus()):e.next?await ae(e.next):await be(e))}async function be(e){if(K(g)||K(he)||!K(v)||e.unavailable||K(_))return;if(K(v).picker){if(K(pe)&&K(O)===e.id)return;R(O,e.id,!0)}else R(y,e,!0),lr().then(()=>K(te)?.focus());if(R(b,``),R(x,0),R(_,``),!e.action)return;let n=++w;R(g,!0);try{let r=await va(`commands`,{session:t.session,command:{mode:`prepare`,path:K(v).path,revision:K(v).revision,choice:e.id}});if(n===w){let e=Date.parse(r.expires);if(!r.confirmation||!Number.isFinite(e)||Date.now()>=e)throw Error(`Review confirmation unavailable`);R(b,r.confirmation,!0),R(x,e,!0)}}catch{n===w&&R(_,`Option changed or unavailable. Refresh before retrying.`)}finally{n===w&&R(g,!1)}}async function xe(){if(!K(b)||K(he)||K(g)||Date.now()>=K(x)||!K(v)||K(v).picker&&K(O)!==K(fe)[K(T)]?.id)return;let e=K(b);R(b,``),R(g,!0);let n=++w;try{let r=await va(`commands`,{session:t.session,confirmation:e,command:{mode:`commit`,path:K(v).path}});n===w&&(R(_,r.message,!0),R(h,!1),R(v,null),R(y,null),f(),R(E,null),s()())}catch{n===w&&R(_,`Change unconfirmed. Check Codex before retrying.`)}finally{n===w&&R(g,!1)}}var Se={handleKey:ve},Ce=No(),we=z(Ce),Te=H(we,2),Ee=e=>{var t=co(),n=V(t,!0);U(()=>X(n,K(_))),Y(e,t)};Z(Te,e=>{K(_)&&!K(h)&&e(Ee)});var De=H(Te,2),Oe=e=>{var i=Mo();let o;var s=z(i),c=e=>{var t=lo(),n=B(t),r=V(n,!0),i=V(H(n,2),!0);U(()=>{X(r,K(v)?.title||`/ COMMANDS`),X(i,K(v)?.help||`Loading live options…`)}),Y(e,t)};Z(s,e=>{K(ge)||e(c)});var l=H(s,2),u=e=>{var t=uo(),n=V(t,!0);U(()=>X(n,K(_))),Y(e,t)};Z(l,e=>{K(_)&&e(u)});var d=H(l,2),f=e=>{Y(e,fo())};Z(d,e=>{K(g)&&e(f)});var p=H(d,2),m=e=>{var t=po(),r=z(t),i=z(r),o=H(i);xi(o),P(r),P(t),U(e=>{Q(t,`id`,`${n}-input`),X(i,`${e??``} `),Q(o,`aria-label`,K(v).inputLabel||`Session name`),Q(o,`maxlength`,K(v).inputLimit||512),o.disabled=K(g)||K(he)&&!a()},[()=>(K(v).inputLabel||`Session name`).toUpperCase()]),xr(`submit`,t,e=>{e.preventDefault(),se()}),Ei(o,()=>K(C),e=>R(C,e)),Y(e,t)},h=e=>{var n=ho(),r=z(n),i=V(r,!0),a=H(r,2),o=V(a,!0),s=H(a,2),c=e=>{var n=mo(),r=z(n),i=H(r),a=e=>{Y(e,Mr(`Only this session's saved - name changes.`))},o=F(()=>K(v)?.path.startsWith(`rename/`)),s=e=>{Y(e,Mr(`Only this session’s - directory changes; project configuration is not reloaded.`))},c=F(()=>K(v)?.path.startsWith(`cd/`)),l=e=>{Y(e,Mr(`No change sent yet. Model, reasoning and speed settings can - change token usage and cost. Changes affect subsequent turns of - this session, not global defaults. Automatic quota thresholds - may later supersede model settings.`))};Z(i,e=>{K(o)?e(a):K(c)?e(s,1):e(l,-1)}),P(n),U(()=>X(r,`TARGET // ${t.session??``}. `)),Y(e,n)};Z(s,e=>{K(y).action&&e(c)}),P(n),Ii(n,e=>R(te,e),()=>K(te)),U(()=>{X(i,K(y).label),X(o,K(y).help||`No additional help supplied by Codex.`)}),Y(e,n)},w=e=>{var t=So(),i=B(t),a=e=>{var t=go(),i=z(t);r(i),P(t),Ii(t,e=>R(D,e),()=>K(D)),U(()=>Q(t,`aria-activedescendant`,`${n}-${K(T)}`)),Y(e,t)},o=e=>{var t=_o();let n;var i=z(t);r(i),P(t),Ii(t,e=>R(D,e),()=>K(D)),U(()=>n=ci(t,1,`command-options svelte-7bfwr9`,null,n,{vertical:K(ge)})),Y(e,t)};Z(i,e=>{K(A)?e(a):e(o,-1)});var s=H(i,2),c=e=>{var t=bo(),n=B(t),r=V(n,!0),i=H(n,2),a=e=>{var t=yo(),n=B(t),r=V(n),i=H(n,2),a=e=>{Y(e,vo())};Z(i,e=>{K(b)&&K(S)>=K(x)&&e(a)}),U(()=>X(r,`REVIEW // ${K(me).label??``}. No change sent yet.`)),Y(e,t)};Z(i,e=>{K(me)&&e(a)}),U(()=>X(r,K(fe)[K(T)]?.help)),Y(e,t)};Z(s,e=>{K(A)&&e(c)});var l=H(s,2),u=e=>{Y(e,xo())};Z(l,e=>{!K(g)&&!K(fe).length&&e(u)}),Y(e,t)};Z(p,e=>{K(v)?.input?e(m):K(y)?e(h,1):e(w,-1)});var E=H(p,2),O=e=>{var t=Co(),n=V(t,!0);U(()=>X(n,K(j).unavailable)),Y(e,t)};Z(E,e=>{K(j)?.unavailable&&e(O)});var k=H(E,2),ne=e=>{Y(e,wo())};Z(k,e=>{K(b)&&K(S)>=K(x)&&!K(A)&&e(ne)});var ie=H(k,2),ae=z(ie),ce=e=>{var t=Nr(),r=B(t),i=e=>{var t=To();U(e=>{Q(t,`form`,`${n}-input`),t.disabled=e},[()=>K(g)||K(he)||!K(C).trim()]),Y(e,t)},o=e=>{var t=Nr(),n=B(t),r=e=>{var t=Eo();U(()=>t.disabled=K(g)||K(he)&&!a()),q(`click`,t,xe),Y(e,t)},i=e=>{var t=Do();U(()=>t.disabled=K(g)||K(he)&&!a()),q(`click`,t,()=>{K(j)&&be(K(j))}),Y(e,t)};Z(n,e=>{K(pe)?e(r):e(i,-1)}),Y(e,t)},s=e=>{var t=Oo(),n=V(t);U(()=>{t.disabled=K(g)||K(he)&&!a(),X(n,`ENTER ${K(j).next?`OPEN`:`HELP`}`)}),q(`click`,t,()=>{K(j)&&ye(K(j))}),Y(e,t)};Z(r,e=>{K(v)?.input?e(i):K(j)?.action&&!K(j).unavailable?e(o,1):!K(y)&&K(j)&&!K(j).unavailable&&e(s,2)}),Y(e,t)};Z(ae,e=>{K(_)||e(ce)});var le=H(ae,2),ue=e=>{var t=ko();U(()=>t.disabled=K(g)),q(`click`,t,oe),Y(e,t)};Z(le,e=>{K(re)&&e(ue)});var de=H(le,2),_e=e=>{var t=Ao();U(()=>t.disabled=K(g)),q(`click`,t,()=>N(K(v)?.path||``,void 0,!0)),Y(e,t)};Z(de,e=>{K(ge)||e(_e)});var Se=H(de,2);P(ie);var Ce=H(ie,2),we=e=>{var t=jo(),n=V(t);U(()=>X(n,`↑/↓ select${K(ge)?` · Tab complete`:``}`)),Y(e,t)};Z(Ce,e=>{!K(v)?.input&&!K(y)&&e(we)}),P(i),Ii(i,e=>R(ee,e),()=>K(ee)),U(()=>{Q(i,`aria-label`,K(ge)?`Slash command suggestions`:`Session command options`),o=ci(i,1,`svelte-7bfwr9`,null,o,{"command-popup":K(ge)})}),q(`keydown`,i,ve),q(`click`,Se,M),Y(e,i)};return Z(De,e=>{K(h)&&e(Oe)}),P(Ce),U(()=>we.disabled=K(he)&&!a()||K(g)),q(`click`,we,()=>{R(h,!K(h)),R(E,K(h)?null:i(),!0),R(b,``),K(h)?(R(k,[],!0),N(``)):M()}),Y(e,Ce),We(Se)}Sr([`click`,`keydown`]);var Fo=J(` `,1),Io=J(`
`),Lo=J(`
/
`);function Ro(e,t){Ue(t,!0);let n=F(()=>t.lines.filter(e=>e.kind===`addition`).length),r=F(()=>t.lines.filter(e=>e.kind===`removal`).length);var i=Lo(),a=z(i),o=z(a),s=V(o),c=V(H(o,2));P(a),Xr(H(a,2),17,()=>t.lines,Kr,(e,t)=>{var n=Io();let r;var i=z(n),a=e=>{var n=Fo(),r=B(n),i=V(r,!0),a=V(H(r),!0);U(()=>{X(i,K(t).old||``),X(a,K(t).new||``)}),Y(e,n)};Z(i,e=>{K(t).kind!==`heading`&&K(t).kind!==`metadata`&&e(a)});var o=V(H(i),!0);P(n),U(()=>{r=ci(n,1,`diff-line svelte-x4gtb6`,null,r,{added:K(t).kind===`addition`,removed:K(t).kind===`removal`,heading:K(t).kind===`heading`}),X(o,K(t).text)}),Y(e,n)}),P(i),U(()=>{Q(a,`aria-label`,`${K(n)} lines added, ${K(r)} lines removed`),X(s,`+${K(n)??``}`),X(c,`−${K(r)??``}`)}),Y(e,i),We()}var zo=J(`

`),Bo=J(`

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

`,1),Vo=J(``),Ho=J(`

 

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

`),Uo=J(`

CURRENT PROFILE

MODEL / REASONING LEVEL / SPEED

 

PROPOSED PROFILE

MODEL / REASONING LEVEL / SPEED

 

Applied settings remain after Codexometer closes.

`,1),Wo=J(`

`),Go=J(`

 
`,1),Ko=J(`

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

`),qo=J(`

Session controls temporarily unavailable. Check Codex for current state.

`),Jo=J(`

Checking session controls…

`),Yo=J(`

`),Xo=J(`
About browser controls

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

`),Zo=J(` `,1),Qo=J(` `),$o=J(`Grants permission beyond this one action. Check the scope - carefully.`),es=J(``),ts=J(``),ns=J(``),rs=J(``),is=J(`

Not before this time; when quota and idle allow.

`),as=J(`

`,1),os=J(`

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

`),ss=J(` `,1),cs=J(``),ls=J(``),us=J(``),ds=J(` `,1),fs=J(`
  • `),ps=J(`
    View fixed choices

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

      `),ms=J(` `,1),hs=J(`

      `),gs=J(`

      `,1),_s=J(` `,1),vs=J(``),ys=J(`

      `,1),bs=J(`

      `);function xs(e,t){Ue(t,!0);let n=[],r=Wi(t,`observedCommand`,3,``),i=Wi(t,`observedFileChanges`,19,()=>[]),a=Wi(t,`review`,3,``),o=Wi(t,`suspended`,3,!1),s=Wi(t,`openScheduler`,3,!1),c=Wi(t,`onProtectedChange`,3,e=>{}),l=Wi(t,`oncopy`,3,()=>{}),u=L(null),d=L(Yt([])),f=L(null),p=L(``),m=L(0),h=L(Yt(Date.now())),g=L(!1),_=L(``),v=L(!1),y=L(!1),b=L(``),x=L(!1),S=L(``),C=L(!1),w=L(``),T=L(`now`),E=L(60),D=L(``),ee=L(!1),te=L(``),O=L(Yt([])),k=F(()=>K(O).find(e=>e.status!==`sent`)),ne=L(void 0),re=L(void 0);function ie(e){if(K(x)){lr().then(()=>K(ne)?.focus());return}if(e.status!==`pending`||K(g)||!K(u)?.id||K(u).kind!==`prompt`||K(u).questions?.length)return;R(x,!0),R(S,e.id,!0),lr().then(()=>K(ne)?.focus()),R(d,[e.text],!0),R(T,e.trigger===`quota`?`quota`:`at`,!0),R(p,``),R(w,``);let t=new Date(e.at);e.trigger!==`quota`&&R(D,new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16),!0)}vn(()=>{s()&&K(k)&&!K(C)&&K(u)?.id&&K(u).kind===`prompt`&&!K(u).questions?.length&&(R(C,!0),ie(K(k)))});async function ae(){if(!a())try{R(O,await va(`schedules`,{session:t.session},M.signal),!0),K(x)&&!K(O).some(e=>e.id===K(S)&&e.status===`pending`)&&R(p,``),K(w)&&!K(O).some(e=>e.id===K(w)&&e.status===`pending`)&&(R(p,``),R(w,``))}catch{}}async function oe(e){try{R(O,await va(`schedules`,{session:t.session,cancelId:e},M.signal),!0),R(x,!1),R(p,``),R(w,``),R(d,[],!0)}catch(e){R(_,e instanceof Error?e.message:`Unable to cancel trigger.`,!0)}}vn(()=>(c()(K(g)||K(d).some(e=>e.length>0)),()=>c()(!1)));let se=F(()=>$.data?.sessions.find(e=>e.id===t.session)?.status),A=F(()=>!$.connected||!!$.data?.sessionsError),ce=F(()=>a()!==`profile`&&K(u)?.kind===`prompt`&&!K(u).questions?.length&&!!$.data?.profiles?.some(e=>e.session===t.session&&e.pending)),le=F(()=>!K(A)&&!K(y)&&!!K(u)?.id&&K(u).kind===`approval`&&K(b)!==K(u).id),ue=F(()=>K(le)?K(u).command:r()),de=F(()=>!!K(p)&&K(h)K(u)?.questions?.length?K(u).questions:[{text:`Follow-up message`,secret:!1,freeText:!0,options:[]}]),j=F(()=>K(u)?.kind===`approval`||K(u)?.kind===`profile`?K(f)!==null:K(d).length===K(fe).length&&K(d).every((e,t)=>e.trim().length>0&&(K(fe)[t].freeText||K(fe)[t].options?.includes(e)))),pe=F(()=>K(u)?.kind===`prompt`&&!K(u).questions?.length&&K(T)!==`now`),me=F(()=>K(T)===`delay`?K(h)+K(E)*6e4:Date.parse(K(D))),he=F(()=>{if(!K(pe))return``;if(K(x)&&!K(O).some(e=>e.id===K(S)&&e.status===`pending`))return`Trigger changed, removed or already sent. Go back and reopen it; your draft has not been saved.`;if(!K(d)[0]?.trim())return`Enter a message to schedule.`;if(K(T)===`quota`)return``;if(!Number.isFinite(K(me))||K(me)<=K(h))return`Choose a future date/time or a delay greater than zero.`;let e=new Date(K(h));return e.setFullYear(e.getFullYear()+1),K(me)>=e.getTime()?`Choose a time within one year.`:``});function ge(e){return new Date(e).toLocaleString([],{timeZoneName:`short`})}function _e(e){if(e.status!==`pending`)return e.status;if(e.trigger===`at`&&Date.parse(e.at)>K(h))return`Due in `+Math.ceil((Date.parse(e.at)-K(h))/6e4)+` min`;let t=K(A)?`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}vn(()=>{(K(A)||o()||K(ce)||K(h)>=K(m))&&R(p,``)});let M=new AbortController;Gi(()=>{let e=e=>{e.ctrlKey&&e.key.toLowerCase()===`s`&&!a()&&K(k)&&(e.preventDefault(),ie(K(k)))};window.addEventListener(`keydown`,e);let n,r=setInterval(()=>{R(h,Date.now(),!0)},1e3);async function i(){await ae();try{let e=await va(`offer`,{session:t.session,...a()?{review:a()}:{}},M.signal);if(M.signal.aborted)return;R(y,!1),K(u)?.id!==e.id&&(R(p,``),R(f,null),R(d,Array(Math.max(1,e.questions?.length||0)).fill(``),!0)),R(u,e,!0),K(v)&&e.id&&e.id!==K(b)&&(R(_,``),R(v,!1))}catch{M.signal.aborted||(R(u,null),R(y,!0),R(p,``))}finally{M.signal.aborted||(n=setTimeout(i,2e3))}}return i(),()=>{window.removeEventListener(`keydown`,e),M.abort(),clearTimeout(n),clearInterval(r)}});async function ve(e){if(!e&&K(u)?.kind===`prompt`&&!K(u).questions?.length&&K(d)[0]?.trim().startsWith(`/`)&&!K(d)[0]?.trim().startsWith(`//`)){R(_,`Choose a slash command from COMMANDS; use // for literal slash text.`);return}if(!K(u)?.id||K(g)||K(A)||o()||K(ce)||(e?!e.canSend:!K(j)||K(he)))return;let n=K(u).id;R(g,!0),R(_,``),R(v,!1),R(p,``),R(w,e?.id||``,!0);try{let r=!e&&K(u).kind===`prompt`&&!K(u).questions?.length&&K(T)!==`now`?{trigger:K(T)===`quota`?`quota`:`at`,zone:Intl.DateTimeFormat().resolvedOptions().timeZone,...K(T)===`quota`?{}:{at:(K(T)===`delay`?new Date(Date.now()+K(E)*6e4):new Date(K(D))).toISOString()}}:void 0;R(ee,!!r),R(te,r?r.trigger===`quota`?`After fresh quota becomes available, when the session is idle`:ge(r.at)+` — not before this time; when quota and idle allow`:``,!0);let i=await va(`prepare`,{session:t.session,...a()?{review:a()}:{},offer:n,...e?{sendId:e.id}:{},...r?{schedule:r}:{},...r&&K(x)?{editId:K(S)}:{},...K(u).kind===`approval`||K(u).kind===`profile`?{choice:K(f)}:{answers:e?[e.text]:[...K(d)]}},M.signal);K(u)?.id!==n||M.signal.aborted||K(A)||o()||K(ce)||(R(p,i.confirmation,!0),R(m,Date.parse(i.expires),!0))}catch(e){M.signal.aborted||R(_,e instanceof Error?e.message:`Unable to prepare action.`,!0)}finally{R(g,!1)}}async function N(){if(!K(u)?.id||K(g)||o()||K(ce)||!K(de))return;let e=K(u).id,n=K(u).kind,r=K(p);R(p,``),R(g,!0),R(b,e,!0);try{await va(`commit`,{session:t.session,...a()?{review:a()}:{},offer:e,confirmation:r},M.signal),R(v,!0),R(x,!1),K(ee)&&(R(b,``),await ae()),R(_,K(ee)?`Trigger set. Closing Codexometer cancels it.`:n===`profile`?`Profile decision completed.`:n===`approval`?`Decision sent.`:`Text sent.`,!0)}catch(e){R(_,e instanceof ga?e.message:`Outcome uncertain. Check Codex before taking another action; nothing was retried.`,!0)}finally{R(g,!1),R(w,``),await ae(),R(d,[],!0),R(f,null)}}var ye=Zo(),be=B(ye),Se=e=>{var t=Nr();Xr(B(t),17,()=>K(O).filter(e=>e.status!==`sent`),e=>e.id,(e,t)=>{var n=Ho(),r=z(n),i=V(r,!0),a=H(r,2),s=V(a),c=H(a,2),l=V(c,!0),d=H(c,2),f=V(d,!0),m=H(d,2),h=V(m,!0),v=H(m,2),y=e=>{var t=zo(),n=V(t,!0);U(()=>X(n,K(_))),Y(e,t)};Z(v,e=>{K(_)&&e(y)});var b=H(v,4),x=H(b,2),S=H(x,2),C=e=>{var n=Bo(),r=H(B(n),2),i=H(r,2);U(()=>r.disabled=K(g)||K(A)||!K(t).canSend),q(`click`,r,N),q(`click`,i,()=>{R(p,``),R(w,``)}),Y(e,n)},T=e=>{var n=Vo();U(()=>n.disabled=K(g)||K(A)||!K(t).canSend||o()),q(`click`,n,()=>ve(K(t))),Y(e,n)};Z(S,e=>{K(de)&&K(w)===K(t).id?e(C):e(T,-1)}),P(n),U((e,n)=>{X(i,K(t).status===`uncertain`?`CHECK TRIGGER — outcome uncertain; not retried`:`SCHEDULED FOLLOW-UP`),X(s,`TARGET // ${K(t).session??``}`),X(l,e),X(f,n),X(h,K(t).text),b.disabled=K(g)||!K(u)?.id||K(u).kind!==`prompt`||!!K(u).questions?.length||K(t).status!==`pending`,x.disabled=K(g)||K(t).status===`sending`},[()=>K(t).trigger===`quota`?`After confirmed quota recovery, when idle`:`Not before ${ge(K(t).at)}`,()=>_e(K(t))]),q(`click`,b,()=>ie(K(t))),q(`click`,x,()=>oe(K(t).id)),Y(e,n)}),Y(e,t)},Ce=F(()=>!a()&&K(u)?.kind!==`approval`&&!K(u)?.questions?.length&&![`APPROVAL NEEDED`,`INPUT NEEDED`].includes(K(se)||``));Z(be,e=>{K(Ce)&&e(Se)});var we=H(be,2),Te=e=>{var r=bs(),o=z(r),s=V(o,!0),c=H(o,2),S=e=>{var t=Uo(),n=B(t),r=V(n),i=H(n,6),a=V(i,!0),o=V(H(i,6),!0);xe(2),U(()=>{X(r,`Your ${K(u).profile.threshold??``}% quota threshold has been reached. Review - the profile for subsequent turns.`),X(a,K(u).profile.current),X(o,K(u).profile.proposed)}),Y(e,t)};Z(c,e=>{K(u)?.profile&&!K(A)&&!K(y)&&e(S)});var C=H(c,2),w=e=>{var t=Wo();let n;var r=V(t,!0);U(()=>{n=ci(t,1,`svelte-1oupzfc`,null,n,{notice:!K(v),sent:K(v)}),X(r,K(_))}),Y(e,t)};Z(C,e=>{K(_)&&e(w)});var O=H(C,2),k=e=>{Ro(e,{get lines(){return K(u).fileChanges}})},ie=e=>{Ro(e,{get lines(){return i()}})},ae=e=>{var t=Go(),n=B(t),r=V(n,!0),i=V(H(n,2),!0);U(()=>{X(r,K(le)?`EXACT COMMAND`:`LAST OBSERVED COMMAND`),X(i,K(ue))}),Y(e,t)},oe=e=>{Y(e,Ko())};Z(O,e=>{K(u)?.fileChanges?.length&&!K(A)&&!K(y)?e(k):i().length?e(ie,1):K(ue)?e(ae,2):a()!==`profile`&&K(se)===`APPROVAL NEEDED`&&!K(v)&&e(oe,3)});var ce=H(O,2),pe=e=>{Y(e,qo())},_e=e=>{Y(e,Jo())},M=e=>{var t=Zo(),n=B(t),r=e=>{var t=Yo(),n=V(t,!0);U(e=>X(n,e),[()=>K(se)===`WORKING`?`Codex is working — nothing to respond to.`:[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(K(se)||``)?`Respond in Codex for this request.`:`Nothing needs a response right now.`]),Y(e,t)};Z(n,e=>{(K(se)===`WORKING`||!K(v)&&!K(g))&&e(r)});var i=H(n,2),a=e=>{Y(e,Xo())},o=F(()=>[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(K(se)||``)&&!K(v));Z(i,e=>{K(o)&&e(a)}),Y(e,t)},ye=e=>{var r=ys(),i=B(r),o=V(i),s=H(i,2),c=z(s),_=V(c,!0),v=H(c,2),y=e=>{var r=Nr();Xr(B(r),17,()=>K(u).choices||[],Kr,(e,r,i)=>{var o=es(),s=z(o);xi(s),s.value=s.__value=i;var c=H(s),l=H(c),u=e=>{var t=Qo(),n=V(t,!0);U(()=>X(n,K(r).detail)),Y(e,t)};Z(l,e=>{K(r).detail&&e(u)});var d=H(l,2),p=e=>{Y(e,$o())};Z(d,e=>{K(r).persistent&&e(p)}),P(o),U(()=>{Q(s,`name`,`decision-`+t.session+`-`+a()),X(c,` ${K(r).label??``} `)}),Oi(n,[],s,()=>K(f),e=>R(f,e)),Y(e,o)}),Y(e,r)},b=e=>{var n=Zo(),r=B(n),i=e=>{var t=ss(),n=B(t),r=H(z(n)),i=z(r),a=e=>{var t=ts();t.value=t.__value=`now`,Y(e,t)};Z(i,e=>{K(x)||e(a)});var o=H(i);o.value=o.__value=`quota`;var s=H(o);s.value=s.__value=`delay`;var c=H(s);c.value=c.__value=`at`,P(r),mi(r),P(n);var l=H(n,2),u=e=>{var t=ns(),n=H(z(t));xi(n),P(t),Ei(n,()=>K(E),e=>R(E,e)),Y(e,t)};Z(l,e=>{K(T)===`delay`&&e(u)});var d=H(l,2),f=e=>{var t=rs(),n=H(z(t));xi(n),P(t),Ei(n,()=>K(D),e=>R(D,e)),Y(e,t)};Z(d,e=>{K(T)===`at`&&e(f)});var p=H(d,2),m=e=>{var t=as(),n=B(t),r=V(n),i=H(n,2),a=e=>{Y(e,is())};Z(i,e=>{K(T)!==`quota`&&e(a)});var o=H(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.`,U(e=>X(r,`Will send: ${e??``}`),[()=>K(T)===`quota`?`when quota is available and this session is idle`:Number.isFinite(K(me))?ge(K(me)):`choose a date and time`]),Y(e,t)};Z(p,e=>{K(T)!==`now`&&e(m)});var h=H(p,2),g=e=>{Y(e,os())};Z(h,e=>{K(x)&&e(g)}),hi(r,()=>K(T),e=>R(T,e)),Y(e,t)};Z(r,e=>{K(u).questions?.length||e(i)}),Xr(H(r,2),17,()=>K(fe),Kr,(e,n,r)=>{var i=ms(),o=B(i),s=e=>{{let n=F(()=>K(d)[0]||``);Ii(Po(e,{get session(){return t.session},get oncopy(){return l()},get query(){return K(n)},oncomplete:e=>{R(d,[e],!0),lr().then(()=>K(ne)?.focus())},onchange:()=>{R(d,[``],!0),lr().then(()=>K(ne)?.focus())}}),e=>R(re,e,!0),()=>K(re))}};Z(o,e=>{r===0&&a()!==`profile`&&K(u).kind===`prompt`&&!K(u).questions?.length&&e(s)});var c=H(o,2),f=z(c),p=H(f),m=e=>{var t=cs();xi(t),Ei(t,()=>K(d)[r],e=>K(d)[r]=e),Y(e,t)},h=e=>{var t=us(),i=z(t);i.value=i.__value=``,Xr(H(i),17,()=>K(n).options||[],Kr,(e,t)=>{var n=ls(),r=V(n,!0),i={};U(()=>{X(r,K(t)),i!==(i=K(t))&&(n.value=(n.__value=i)??``)}),Y(e,n)}),P(t),mi(t),hi(t,()=>K(d)[r],e=>K(d)[r]=e),Y(e,t)},g=e=>{var t=ds(),i=B(t);tt(i),Ii(i,e=>R(ne,e),()=>K(ne));var a=H(i,2),o=e=>{var t=Yo(),r=V(t);U(e=>X(r,`Suggested answers: ${e??``}`),[()=>K(n).options.join(` · `)]),Y(e,t)};Z(a,e=>{K(n).options?.length&&e(o)}),q(`keydown`,i,e=>{K(u)?.kind===`prompt`&&!K(u).questions?.length&&K(re)?.handleKey(e)}),Ei(i,()=>K(d)[r],e=>K(d)[r]=e),Y(e,t)};Z(p,e=>{K(n).secret?e(m):K(n).freeText?e(g,-1):e(h,1)}),P(c);var _=H(c,2),v=e=>{var t=ps(),r=H(z(t),4);Xr(r,21,()=>K(n).options||[],Kr,(e,t)=>{var n=fs(),r=V(n,!0);U(()=>X(r,K(t))),Y(e,n)}),P(r),P(t),Y(e,t)};Z(_,e=>{K(n).secret&&!K(n).freeText&&e(v)}),U(()=>X(f,`${K(n).text??``} `)),Y(e,i)}),Y(e,n)};Z(v,e=>{K(u).kind===`approval`||K(u).kind===`profile`?e(y):e(b,-1)}),P(s);var S=H(s,2),C=e=>{var t=gs(),n=B(t),r=e=>{var t=hs(),n=V(t);U(()=>X(n,`TRIGGER // ${K(te)??``}`)),Y(e,t)};Z(n,e=>{K(ee)&&e(r)});var i=H(n,2),a=V(i),o=H(i,2),s=V(o),c=H(o,2);U(e=>{X(a,`Check the target and ${K(u).kind===`profile`?`profile above`:K(u).kind===`approval`?K(u).fileChanges?.length?`proposed file changes above`:`exact command and permission scope`:`message above`}. ${K(ee)?`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=K(g)||K(A),X(s,`CONFIRM ${(K(u).kind===`approval`||K(u).kind===`profile`?K(u).choices?.[K(f)]?.label:K(ee)?K(x)?`SAVE CHANGES`:`SCHEDULE`:`SEND`)??``}`)},[()=>Math.max(0,Math.ceil((K(m)-K(h))/1e3))]),q(`click`,o,N),q(`click`,c,()=>{R(p,``)}),Y(e,t)},w=e=>{var t=_s(),n=B(t),r=e=>{var t=zo(),n=V(t,!0);U(()=>X(n,K(he))),Y(e,t)};Z(n,e=>{K(he)&&e(r)});var i=H(n,2),a=V(i,!0);U(()=>{i.disabled=K(g)||K(A)||!K(j)||!!K(he),X(a,K(g)?`SENDING…`:K(x)?`REVIEW CHANGES`:`REVIEW BEFORE SENDING`)}),q(`click`,i,()=>ve()),Y(e,t)};Z(S,e=>{K(de)?e(C):e(w,-1)});var O=H(S,2),k=e=>{var t=vs();q(`click`,t,()=>{R(x,!1),R(p,``),R(d,[],!0)}),Y(e,t)};Z(O,e=>{K(x)&&e(k)}),U(()=>{X(o,`TARGET // ${K(u).thread??``} // ${(K(u).directory||`Directory unavailable`)??``}`),s.disabled=K(g)||K(de)||K(A),X(_,K(u).kind===`approval`||K(u).kind===`profile`?`Choose a decision`:K(x)?`EDIT SCHEDULED FOLLOW-UP`:`Reply to this session`)}),Y(e,r)};Z(ce,e=>{K(A)||K(y)?e(pe):K(u)?K(u).id?K(b)!==K(u).id&&e(ye,3):e(M,2):e(_e,1)}),P(r),U(()=>X(s,a()===`profile`?`QUOTA THRESHOLD`:`SESSION CONTROL // EXPERIMENTAL`)),Y(e,r)};Z(we,e=>{!K(ce)&&(!K(k)||K(x)||a()||K(u)?.kind!==`prompt`||K(u).questions?.length)&&e(Te)}),Y(e,ye),We()}Sr([`click`,`keydown`]);var Ss=J(` `,1),Cs=J(`
      `),ws=J(`

      STATUS LINE // CODEXOMETER

      Choose multiple fields and their order. These display preferences do not - change Codex CLI configuration. Missing values are omitted.

      `),Ts=J(`

      `,1);function Es(e,t){Ue(t,!0);let n=Wi(t,`stale`,3,!1),r=L(Yt([])),i=L(!1),a=F(()=>$.data?.statusLineFields||[]),o=e=>[...new Set(e??K(a).filter(e=>e.default).map(e=>e.id))].filter(e=>K(a).some(t=>t.id===e)),s=e=>o(e).map(e=>e===`run-state`&&(n()||!$.connected||$.data?.sessionsError)?`STALE`:t.session.statusLine?.[e]).filter(Boolean).join(` · `),c=F(()=>[...K(r).map(e=>K(a).find(t=>t.id===e)).filter(Boolean),...K(a).filter(e=>!K(r).includes(e.id))]);vn(()=>{oa.open&&!K(i)?(R(r,o(aa.statusLine),!0),R(i,!0)):oa.open||R(i,!1)});function l(e,t){R(r,t?[...K(r),e]:K(r).filter(t=>t!==e),!0)}function u(e,t){let n=K(r).indexOf(e),i=n+t;if(n<0||i<0||i>=K(r).length)return;let a=[...K(r)];[a[n],a[i]]=[a[i],a[n]],R(r,a,!0)}var d=Ts(),f=B(d),p=e=>{var t=ws(),n=H(z(t),4);Xr(n,21,()=>K(c),e=>e.id,(e,t)=>{var n=Cs(),i=z(n),a=z(i);xi(a);var o=H(a,1,!0),s=V(H(o),!0);P(i);var c=H(i,2),d=e=>{var n=Ss(),i=B(n),a=H(i,2);U((e,n)=>{Q(i,`aria-label`,`Move `+K(t).label+` earlier`),i.disabled=e,Q(a,`aria-label`,`Move `+K(t).label+` later`),a.disabled=n},[()=>K(r).indexOf(K(t).id)===0,()=>K(r).indexOf(K(t).id)===K(r).length-1]),q(`click`,i,()=>u(K(t).id,-1)),q(`click`,a,()=>u(K(t).id,1)),Y(e,n)},f=F(()=>K(r).includes(K(t).id));Z(c,e=>{K(f)&&e(d)}),P(n),U(e=>{Q(i,`title`,K(t).help),Si(a,e),X(o,K(t).label),X(s,K(t).help)},[()=>K(r).includes(K(t).id)]),q(`change`,a,e=>l(K(t).id,e.currentTarget.checked)),Y(e,n)}),P(n);var i=H(n,2),a=V(i),o=H(i,2),d=H(o,2);P(t),U(e=>X(a,`Preview // ${e??``}`),[()=>s(K(r))||`—`]),q(`click`,o,()=>{aa.statusLine=[...K(r)],ca(),oa.open=!1}),q(`click`,d,()=>{oa.open=!1}),Y(e,t)};Z(f,e=>{oa.open&&e(p)});var m=H(f,2),h=z(m),g=V(h,!0),_=H(h,2);P(m),U((e,t)=>{Q(h,`title`,e),X(g,t)},[()=>s(aa.statusLine),()=>s(aa.statusLine)]),q(`click`,_,()=>{oa.open=!oa.open}),Y(e,d),We()}Sr([`change`,`click`]);var Ds=J(`
      `);function Os(e,t){Ue(t,!0);let n=Wi(t,`active`,3,!1),r=F(()=>ao(t.session)),i=F(()=>!!K(r)),a=L(!1),o=L(``),s=L(!1);vn(()=>{if(!K(s))return;let e=setTimeout(()=>{R(s,!1)},150);return()=>clearTimeout(e)}),vn(()=>{K(r),t.session.status,R(o,``)});async function c(){if(!K(i)||K(a))return;let e=K(r);R(a,!0),R(s,!0),R(o,``);try{await navigator.clipboard.writeText(e),K(r)===e&&R(o,`Copied.`)}catch{K(r)===e&&R(o,`Clipboard unavailable. Select the visible text and copy it manually.`)}finally{R(a,!1)}}function l(e){!n()||!K(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={copy:c},d=Nr();xr(`keydown`,Qt,l);var f=B(d),p=e=>{var t=Ds(),n=z(t),r=V(n,!0),i=H(n,2);let l;P(t),U(()=>{X(r,K(o)),i.disabled=K(a),l=ci(i,1,`svelte-543j00`,null,l,{flashed:K(s)})}),q(`click`,i,c),Y(e,t)};return Z(f,e=>{K(i)&&e(p)}),Y(e,d),We(u)}Sr([`click`]);var ks=J(`

       
      `,1),As=J(`

      LATEST GUIDANCE

       
      `,1),js=J(`

      CONTEXT

       

      `,1),Ms=J(`

      `),Ns=J(`

      `),Ps=J(`
       
      `),Fs=J(`

       
      `,1),Is=J(`
       
      `),Ls=J(`

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

      `),Rs=J(`

      `,1),zs=J(`

      `),Bs=J(` `,1),Vs=J(`
      `),Hs=J(`

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

      `),Us=J(`

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

      `),Ws=J(` `),Gs=J(` `),Ks=J(` `),qs=J(``),Js=J(`

      Read only — reply or approve in Codex.

      `),Ys=J(`

      `),Xs=J(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),Zs=J(`
      `),Qs=J(`
      `),$s=J(`

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

      `),ec=J(`

      `),tc=J(``),nc=J(`

      `),rc=J(` `),ic=J(`

      `),ac=J(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),oc=J(` `,1),sc=J(`

      `),cc=J(`

      TOKEN ACTIVITY // 30 SECOND SAMPLES

      `),lc=J(`

      TOKENS

      FULL DETAIL →
      `),uc=J(`

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

      `),dc=J(`

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

      `,1),fc=J(`

      SESSION TOTALS

      `,1);function pc(e,t){Ue(t,!0);let n=(e,t=f,n,r)=>{let i=pt(()=>g(n?.(),!0)),a=pt(()=>g(r?.(),!1));var o=Bs(),s=B(o),c=e=>{var n=ks(),r=B(n),i=V(r,!0),a=V(H(r,2),!0);U(()=>{X(i,t().contextKind===`LAST REPLY`&&!t().streaming?`TASK`:`CURRENT TASK`),X(a,t().currentTask)}),Y(e,n)};Z(s,e=>{t().currentTask&&e(c)});var l=H(s,2),u=e=>{var n=As(),r=V(H(B(n),2),!0);U(()=>X(r,t().latestGuidance)),Y(e,n)};Z(l,e=>{t().latestGuidance&&e(u)});var d=H(l,2),p=e=>{var n=js(),r=V(H(B(n),2),!0);xe(2),U(()=>X(r,t().approvalContext)),Y(e,n)};Z(d,e=>{K(a)&&t().contextKind===`APPROVAL REQUEST`&&t().approvalContext&&e(p)});var m=H(d,2),h=e=>{var n=Ms();let r;var i=V(n,!0);U(e=>{r=ci(n,1,`attention-note`,null,r,{inferred:t().status===`CHECK SESSION`}),X(i,e)},[()=>w(t())]),Y(e,n)},_=F(()=>w(t())&&(!K(a)||K(v)||t().status===`CHECK SESSION`));Z(m,e=>{K(_)&&e(h)});var y=H(m,2),b=e=>{var n=Ns(),r=V(n,!0);U(e=>X(r,e),[()=>T(t())]),Y(e,n)};Z(y,e=>{K(i)&&e(b)});var x=H(y,2),S=e=>{var n=Ps(),r=V(n,!0);U(()=>X(r,t().text||`No session context available.`)),Y(e,n)};Z(x,e=>{(t().text||!t().workingCommand)&&e(S)});var C=H(x,2),E=e=>{var n=Fs(),r=H(B(n),2),i=z(r),a=H(i),o=e=>{var n=Mr();U(()=>X(n,`// +${(t().runningCommands||0)-+(t().commandStatus===`running`)} RUNNING`)),Y(e,n)};Z(a,e=>{!K(v)&&(t().runningCommands||0)>+(t().commandStatus===`running`)&&e(o)});var s=H(a,2),c=e=>{Y(e,Mr(`+`))};Z(s,e=>{t().runningLimited&&e(c)}),P(r);var l=V(H(r,2),!0);U(e=>{X(i,`COMMAND // ${e??``} `),X(l,t().workingCommand)},[()=>K(v)?`UNKNOWN`:(t().commandStatus||`unknown`).toUpperCase()]),Y(e,n)};Z(C,e=>{t().workingCommand&&e(E)});var D=H(C,2),ee=e=>{Ro(e,{get lines(){return t().fileChanges}})},te=e=>{var n=Rs(),r=H(B(n),2),i=V(r,!0),a=H(r,2),o=e=>{var n=Is(),r=V(n,!0);U(()=>X(r,t().command)),Y(e,n)},s=e=>{Y(e,Ls())};Z(a,e=>{t().command?e(o):e(s,-1)}),U(()=>X(i,K(v)||t().status!==`APPROVAL NEEDED`?`LAST OBSERVED COMMAND`:$.data?.control?`COMMAND REQUEST`:`COMMAND TO APPROVE IN CODEX`)),Y(e,n)};Z(D,e=>{(!K(a)||!$.data?.control)&&t().fileChanges?.length?e(ee):K(a)&&$.data?.control||!t().command&&t().status!==`APPROVAL NEEDED`||e(te,1)});var O=H(D,2),k=e=>{var n=zs(),r=V(n);U(()=>X(r,`CONTEXT SOURCE // ${(t().source||`LOCAL`)??``} // OBSERVATION`)),Y(e,n)};Z(O,e=>{K(a)||e(k)}),Y(e,o)},r=L(void 0),i=Wi(t,`params`,19,()=>({})),a=F(()=>$.data?.sessions||[]),o=F(()=>$.data?.control&&$.data.profiles||[]),s=F(()=>($.data?.triggers||[]).filter(e=>K(a).some(t=>t.id===e.session)));function c(e,t){i().id&&i().id!==t&&K(u)?e.preventDefault():x(t)}function l(e){return[`TURN COMPLETE`,`IDLE`,`ACTIVE`].includes(e.status)&&K(s).some(t=>t.session===e.id)?`TRIGGER SET`:e.status}let u=L(!1);function d(e,t){i().id&&i().id!==t&&K(u)?e.preventDefault():x(t)}vn(()=>{let e=i().id;e&&fr(()=>{aa.selected=e,fa(e,2)})});let p=F(()=>K(a).find(e=>e.id===i().id)),m=F(()=>new URLSearchParams(Yi.querystring).get(`review`)===`profile`&&K(o).some(e=>e.session===i().id&&e.pending)),h=F(()=>K(a).some(e=>e.id===aa.selected)?aa.selected:K(a)[0]?.id),v=F(()=>!$.connected||!!$.data?.sessionsError),y=F(()=>[[`OBSERVED TOKENS`,pa(K(a).reduce((e,t)=>e+t.tokens,0))],[`LISTED SESSIONS`,pa(K(a).length)],...[[`WORKING`,`WORKING`],[`AWAITING APPROVAL`,`APPROVAL NEEDED`],[`AWAITING INPUT`,`INPUT NEEDED`],[`CHECK · INFERRED`,`CHECK SESSION`]].map(([e,t])=>[e,K(v)?`—`:pa(K(a).filter(e=>e.status===t).length)])]),b=F(()=>K(a).filter(e=>[`INPUT NEEDED`,`APPROVAL NEEDED`,`CHECK SESSION`].includes(e.status)));function x(e){aa.selected=e,lr().then(()=>document.querySelector(`.session-row.selected`)?.scrollIntoView({block:`nearest`}))}function S(e,t){if(x(e),i().id){t<0&&(fa(e,2),location.hash=`/sessions`);return}let n=ua(e)+t;n>2?location.hash=`/sessions/`+encodeURIComponent(e):fa(e,n)}function C(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`&&i().id)e.preventDefault(),S(i().id,-1);else if([`ArrowLeft`,`ArrowRight`].includes(e.key)&&(i().id||K(h)))e.preventDefault(),S(i().id||K(h),e.key===`ArrowLeft`?-1:1);else if(!i().id&&[`ArrowUp`,`ArrowDown`].includes(e.key)&&K(a).length){e.preventDefault();let t=K(a).findIndex(e=>e.id===K(h));x(K(a)[Math.max(0,Math.min(K(a).length-1,t+(e.key===`ArrowUp`?-1:1)))].id)}}}function w(e){return K(v)?`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 T(e){return e.streaming&&e.contextKind===`LAST REPLY`?`REPLY // STREAMING`:e.contextKind||`LAST ACTIVITY`}var E=fc();xr(`keydown`,Qt,C);var D=B(E),ee=V(H(z(D),2));P(D);var te=H(D,2);let O;Xr(te,21,()=>K(y),Kr,(e,t)=>{var n=F(()=>_(K(t),2));let r=()=>K(n)[0],i=()=>K(n)[1];var a=Vs(),o=z(a),s=V(o,!0),c=V(H(o,2),!0);P(a),U(()=>{X(s,r()),X(c,i())}),Y(e,a)}),P(te);var k=H(te,2),ne=V(k),re=H(k,2),ie=e=>{Y(e,Hs())};Z(re,e=>{K(v)&&e(ie)});var ae=H(re,2),oe=e=>{Y(e,Us())};Z(ae,e=>{$.data?.profileError&&e(oe)});var se=H(ae,2),A=e=>{var t=qs(),n=z(t);Xr(n,17,()=>K(b),Kr,(e,t)=>{var n=Ws();let r;var i=V(n);U((e,a)=>{r=ci(n,1,`button`,null,r,{approval:K(t).status===`APPROVAL NEEDED`}),Q(n,`href`,e),X(i,`${K(t).status??``} - ${a??``} // ${(K(t).name||K(t).directory||K(t).id)??``}`)},[()=>`#/sessions/`+encodeURIComponent(K(t).id),()=>Array.from(K(t).id).slice(-5).join(``).toUpperCase()]),q(`click`,n,()=>x(K(t).id)),Y(e,n)});var r=H(n,2);Xr(r,17,()=>K(o).filter(e=>e.pending&&K(a).some(t=>t.id===e.session)),Kr,(e,t)=>{var n=Gs(),r=V(n);U((e,a,o)=>{Q(n,`title`,i().id&&i().id!==K(t).session&&K(u)?`Finish sending or clear your current draft before switching sessions.`:`Review this session’s quota threshold`),Q(n,`href`,e),X(r,`QUOTA THRESHOLD ${a??``} // ${o??``}`)},[()=>`#/sessions/`+encodeURIComponent(K(t).session)+`?review=profile`,()=>Array.from(K(t).session).slice(-5).join(``).toUpperCase(),()=>K(a).find(e=>e.id===K(t).session)?.name||K(a).find(e=>e.id===K(t).session)?.directory||K(t).session]),q(`click`,n,e=>d(e,K(t).session)),Y(e,n)}),Xr(H(r,2),17,()=>K(s),Kr,(e,t)=>{var n=Ks(),r=V(n);U((e,t,i)=>{Q(n,`href`,e),X(r,`TRIGGER SET ${t??``} // ${i??``}`)},[()=>`#/sessions/`+encodeURIComponent(K(t).session),()=>Array.from(K(t).session).slice(-5).join(``).toUpperCase(),()=>K(a).find(e=>e.id===K(t).session)?.name||K(a).find(e=>e.id===K(t).session)?.directory]),q(`click`,n,e=>c(e,K(t).session)),Y(e,n)}),P(t),Y(e,t)},ce=F(()=>(K(b).length||K(o).some(e=>e.pending)||K(s).length)&&!K(v));Z(se,e=>{K(ce)&&e(A)});var le=H(se,2),ue=e=>{var t=Nr(),a=B(t),s=e=>{var t=Qs(),a=z(t),s=z(a),c=z(s);let d;var f=H(c);P(s);var h=H(s,2);P(a);var g=H(a,2),_=e=>{var t=zs(),n=V(t,!0);U(()=>X(n,K(p).directory)),Y(e,t)};Z(g,e=>{K(p).name&&K(p).directory&&e(_)});var y=H(g,2),b=V(y),S=H(y,2);let C;var w=z(S),T=z(w);n(T,()=>K(p),()=>!0,()=>!0),P(w);var E=H(w,2),D=e=>{var t=Nr();Gr(B(t),()=>K(p).id,e=>{{let t=F(()=>new URLSearchParams(Yi.querystring).get(`schedule`)===`edit`),n=F(()=>K(p).fileChanges||[]);xs(e,{get session(){return K(p).id},oncopy:()=>K(r)?.copy(),get openScheduler(){return K(t)},get observedCommand(){return K(p).command},get observedFileChanges(){return K(n)},get suspended(){return K(m)},onProtectedChange:e=>{R(u,e,!0)}})}}),Y(e,t)},ee=e=>{var t=Js();Gr(H(z(t),2),()=>K(p).id,e=>{Po(e,{get session(){return K(p).id},localOnly:!0,oncopy:()=>K(r)?.copy()})}),P(t),Y(e,t)};Z(E,e=>{$.data?.control?e(D):e(ee,-1)}),P(S);var te=H(S,2);Xr(te,17,()=>K(o).filter(e=>e.session===K(p).id),e=>e.session,(e,t)=>{var n=Zs(),r=z(n),i=e=>{var n=Ys(),r=V(n,!0);U(()=>X(r,K(t).notice)),Y(e,n)};Z(r,e=>{K(t).notice&&e(i)});var a=H(r,2),o=e=>{xs(e,{get session(){return K(p).id},review:`profile`})},s=e=>{var t=Xs();U(e=>Q(t,`href`,e),[()=>`#/sessions/`+encodeURIComponent(K(p).id)+`?review=profile`]),Y(e,t)};Z(a,e=>{K(t).pending&&K(m)?e(o):K(t).pending&&e(s,1)}),P(n),U(()=>Q(n,`id`,`quota-profile-`+K(p).id)),Y(e,n)});var O=H(te,2),k=e=>{var t=Nr();Gr(B(t),()=>K(p).id,e=>{Ii(Os(e,{get session(){return K(p)},active:!0}),e=>R(r,e,!0),()=>K(r))}),Y(e,t)};Z(O,e=>{K(m)||e(k)}),Gr(H(O,2),()=>K(p).id,e=>{Es(e,{get session(){return K(p)},get stale(){return K(v)}})}),P(t),U((e,t)=>{d=ci(c,1,`lamp lit`,null,d,{working:K(p).status===`WORKING`&&!K(v)}),X(f,`${e??``} // ${(K(p).name||K(p).directory)??``}`),X(b,`${t??``} TOKENS // ${K(p).id??``} // CONTEXT SOURCE // ${(K(p).source||`LOCAL`)??``}`),C=ui(S,``,C,{display:K(m)?`none`:void 0})},[()=>K(v)?`STALE`:K(m)?`QUOTA THRESHOLD`:l(K(p)),()=>pa(K(p).tokens)]),q(`click`,h,()=>{x(i().id),fa(i().id,2)}),Y(e,t)},c=e=>{Y(e,$s())};Z(a,e=>{K(p)?e(s):e(c,-1)}),Y(e,t)},de=e=>{var t=dc(),r=B(t),i=H(z(r),2),s=z(i),c=H(s,2);P(i),P(r);var u=H(r,2);Xr(u,17,()=>K(a),e=>e.id,(e,t)=>{let r=F(()=>ua(K(t).id));var i=lc();let a;var s=z(i),c=z(s),u=e=>{var n=ec(),r=z(n),i=V(r);P(n),U(e=>{Q(r,`aria-pressed`,K(h)===K(t).id),X(i,`${e??``} // ${K(t).name??``}`)},[()=>Array.from(K(t).id).slice(-5).join(``).toUpperCase()]),q(`click`,r,()=>x(K(t).id)),Y(e,n)};Z(c,e=>{K(t).name&&e(u)});var f=H(c,2),p=z(f),m=z(p);let g;var _=H(m,1,!0);P(p),P(f);var y=H(f,2),b=e=>{var n=tc(),r=V(n,!0);U(()=>{Q(n,`aria-pressed`,K(h)===K(t).id),X(r,K(t).directory||K(t).id)}),q(`click`,n,()=>x(K(t).id)),Y(e,n)};Z(y,e=>{K(t).name||e(b)});var C=H(y,2),w=z(C);xe(),P(C);var E=H(C,2),D=e=>{var n=zs(),r=V(n,!0);U(()=>X(r,K(t).directory)),Y(e,n)};Z(E,e=>{K(t).name&&K(t).directory&&e(D)});var ee=H(E,2),te=V(ee),O=H(ee,2),k=V(O),ne=H(O,2),re=z(ne),ie=H(re,2),ae=V(ie,!0),oe=H(ie,2);P(ne);var se=H(ne,2),A=H(se,2),ce=e=>{var n=nc(),r=V(n,!0);U(()=>X(r,K(t).status===`CHECK SESSION`?`INFERRED INACTIVITY`:$.data?.control?`OPEN FULL DETAIL OR REPLY IN CODEX`:K(t).status===`APPROVAL NEEDED`?`APPROVE OR DECLINE IN CODEX`:`REPLY IN CODEX`)),Y(e,n)},le=F(()=>!K(v)&&[`APPROVAL NEEDED`,`INPUT NEEDED`,`CHECK SESSION`].includes(K(t).status));Z(A,e=>{K(le)&&e(ce)}),P(s);var ue=H(s,2),de=e=>{var r=sc(),i=z(r),a=z(i),s=V(a,!0),c=H(a,2),l=e=>{var n=rc(),r=V(n,!0);U(e=>{Q(n,`href`,e),X(r,$.data?.control?`REVIEW IN FULL DETAIL ↗`:`APPROVAL IN CODEX ↗`)},[()=>`#/sessions/`+encodeURIComponent(K(t).id)]),Y(e,n)};Z(c,e=>{!K(v)&&K(t).status===`APPROVAL NEEDED`&&e(l)}),P(i);var u=H(i,2);n(u,()=>K(t),()=>!1);var f=H(u,2);Xr(f,17,()=>K(o).filter(e=>e.session===K(t).id),Kr,(e,n)=>{var r=oc(),i=B(r),a=e=>{var t=ic(),r=V(t,!0);U(()=>X(r,K(n).notice)),Y(e,t)};Z(i,e=>{K(n).notice&&e(a)});var o=H(i,2),s=e=>{var n=ac();U(e=>Q(n,`href`,e),[()=>`#/sessions/`+encodeURIComponent(K(t).id)+`?review=profile`]),q(`click`,n,e=>d(e,K(t).id)),Y(e,n)};Z(o,e=>{K(n).pending&&e(s)}),Y(e,r)});var p=H(f,2);{let e=F(()=>K(h)===K(t).id);Os(p,{get session(){return K(t)},get active(){return K(e)}})}P(r),U(e=>X(s,e),[()=>T(K(t))]),Y(e,r)};Z(ue,e=>{K(r)>0&&e(de)});var fe=H(ue,2),j=e=>{var n=cc(),r=H(z(n),2);{let e=F(()=>(K(t).samples||[]).map(e=>e.tokens));io(r,{get values(){return K(e)},capacity:120})}var i=V(H(r,2));P(n),U(()=>X(i,`LAST ${(K(t).samples?.length||0)??``} SAMPLES // AUTO SCALE`)),Y(e,n)};Z(fe,e=>{K(r)<2&&e(j)}),P(i),U((e,n,o,s,c)=>{a=ci(i,1,`session-row`,null,a,{selected:K(h)===K(t).id,wide:K(r)===2,split:K(r)===1}),Q(i,`aria-label`,`Session `+(K(t).name||K(t).directory||K(t).id)),Q(p,`href`,e),g=ci(m,1,`lamp lit`,null,g,{working:K(t).status===`WORKING`&&!K(v)}),X(_,n),X(w,`${o??``} `),X(te,`${K(t).agents??``} LINKED AGENTS`),X(k,`ACTIVE // ${s??``}`),re.disabled=K(r)===0,Q(ie,`aria-expanded`,K(r)>0),X(ae,K(r)?`HIDE DETAIL`:`SHOW DETAIL`),Q(se,`href`,c)},[()=>`#/sessions/`+encodeURIComponent(K(t).id),()=>K(v)?`STALE`:l(K(t)),()=>pa(K(t).tokens),()=>ma(K(t).activity),()=>`#/sessions/`+encodeURIComponent(K(t).id)]),q(`click`,p,()=>x(K(t).id)),q(`click`,re,()=>S(K(t).id,-1)),q(`click`,ie,()=>{x(K(t).id),fa(K(t).id,+!K(r))}),q(`click`,oe,()=>S(K(t).id,1)),q(`click`,se,()=>x(K(t).id)),Y(e,i)});var f=H(u,2),p=e=>{Y(e,uc())};Z(f,e=>{K(a).length||e(p)}),q(`click`,s,()=>da(1)),q(`click`,c,()=>da(0)),Y(e,t)};Z(le,e=>{i().id?e(ue):e(de,-1)}),U(e=>{X(ee,`OBSERVED ${e??``}`),O=ci(te,1,`session-totals`,null,O,{stale:K(v)}),X(ne,`${K(v)?`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.`)},[()=>ma($.data?.sessionsAt)]),Y(e,E),We()}Sr([`click`]);var mc=J(`

      `),hc=J(`

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

      `,1),gc=J(`// APPROXIMATE`),_c=J(`

      Partial accounting: totals may still change.

      `),vc=J(`

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

      `,1),yc=J(`

      `,1),bc=J(`

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

      `),xc=J(`
      `),Sc=J(`
      `),Cc=J(`

      No usage reported for this day.

      `),wc=J(`

      Selected breakdown unavailable; missing does not mean zero.

      `),Tc=J(`

      `,1);function Ec(e,t){Ue(t,!0);let n=L(`surface`),r=L(0),i=F(()=>t.reports?.daily),a=F(()=>t.reports?.plan),o=F(()=>t.mode===`breakdown`?K(i)?.days.length||0:K(a)?.periods.length||0),s=F(()=>Math.min(K(r),Math.max(0,K(o)-1))),c=F(()=>K(i)?.days[(K(i)?.days.length||0)-1-K(s)]),l=F(()=>K(a)?.periods[K(s)]),u=F(()=>t.mode===`breakdown`?K(i)?.units||``:`%`),d=F(()=>{let e=Object.create(null);if(t.mode===`breakdown`)e=K(c)?.groups[K(n)]||{};else{let t=K(n)===`feature`?`thread_source`:K(n)===`task start`?`turn_trigger`:K(n);for(let n of K(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=F(()=>t.mode===`breakdown`?K(c)?.total:K(l)?.used_basis_points==null?null:K(l).used_basis_points/100),p=F(()=>Math.max(1,K(f)||0,...K(d).map(([,e])=>e))),m=e=>e==null?`UNKNOWN`:e.toLocaleString(`en-GB`,{maximumFractionDigits:2});var h=Tc(),g=B(h),v=z(g),y=H(z(v)),b=z(y);b.value=b.__value=`surface`;var x=H(b);x.value=x.__value=`model`;var S=H(x);S.value=S.__value=`feature`;var C=H(S);C.value=C.__value=`task start`,P(y),mi(y),P(v);var w=H(v,2),T=H(w,2),E=V(H(T,2),!0);P(g);var D=H(g,2),ee=z(D),te=V(ee,!0),O=H(ee,2),k=V(O),ne=H(O,2),re=e=>{var t=hc(),n=B(t),r=V(n),a=H(n,2),o=e=>{var t=mc(),n=V(t);U(()=>X(n,`Data as of ${K(i).dataAsOf??``}`)),Y(e,t)};Z(a,e=>{K(i).dataAsOf&&e(o)});var s=V(H(a,2));xe(2),U((e,t)=>{X(r,`Latest fetch ${e??``} // queried ${K(i).from??``} → ${K(i).through??``}. - Reports are fetched from OpenAI and are not saved between runs.`),X(s,`${(K(c)?.date||`No daily buckets reported`)??``} // ${t??``} - ${K(u)??``}`)},[()=>ma(K(i).fetchedAt),()=>m(K(f))]),Y(e,t)},ie=e=>{var t=yc(),n=B(t),r=z(n);let i;var o=V(r,!0),s=H(r),c=e=>{Y(e,gc())};Z(s,e=>{K(a).approximate&&e(c)});var u=H(s);P(n);var d=H(n,2),p=z(d),h=H(p),g=e=>{var t=Mr();U(()=>X(t,`// Boundary tolerance ${K(a).boundary_tolerance_seconds??``}s`)),Y(e,t)};Z(h,e=>{K(a).boundary_tolerance_seconds!=null&&e(g)}),P(d);var _=H(d,2),v=e=>{var t=vc(),n=B(t),r=z(n),i=H(r);let a;var o=V(i);P(n);var s=H(n,2),c=V(s),u=H(s,2),d=e=>{Y(e,_c())};Z(u,e=>{K(l).accounting_complete||e(d)}),xe(2),U(e=>{X(r,`${K(l).window_minutes??``} MIN // ${K(l).plan_type??``} // `),a=ci(i,1,`svelte-1fbui7h`,null,a,{muted:K(f)==null,"quota-near":K(f)!=null&&K(f)>=80&&K(f)<100,"quota-full":K(f)!=null&&K(f)>=100}),X(o,`USED ${e??``}${K(f)==null?``:`%`}`),X(c,`${K(l).starts_at??``} → ${K(l).ends_at??``}`)},[()=>m(K(f))]),Y(e,t)};Z(_,e=>{K(l)&&e(v)}),U(e=>{i=ci(r,1,`svelte-1fbui7h`,null,i,{"quality-warning":!K(a).coverage_complete}),X(o,K(a).coverage_complete?`Reported range complete`:`Partial coverage`),X(u,` // Latest fetch ${e??``}`),X(p,`Coverage starts ${(K(a).coverage_start||`unknown`)??``} // Data as of ${(K(a).data_as_of||`unknown`)??``}`)},[()=>ma(K(a).fetchedAt)]),Y(e,t)},ae=e=>{Y(e,bc())};Z(ne,e=>{t.mode===`breakdown`&&K(i)?e(re):t.mode===`periods`&&K(a)?e(ie,1):e(ae,-1)});var oe=H(ne,2),se=e=>{var n=Sc(),r=z(n),i=V(H(z(r),2),!0);P(r),Xr(H(r,2),17,()=>K(d),Kr,(e,n,r)=>{var i=F(()=>_(K(n),2));let a=()=>K(i)[0],o=()=>K(i)[1];var s=xc();let c;var l=z(s),u=V(l,!0),d=H(l,2),f=z(d);let h;P(d);var g=V(H(d,2));P(s),U((e,n,i)=>{c=ci(s,1,`report-row svelte-1fbui7h`,null,c,{unknown:e,alternate:r%2==1}),Q(l,`title`,a()),X(u,a()),h=ui(f,``,h,{width:n}),X(g,`${i??``}${t.mode===`periods`?`%`:``}`)},[()=>a().trim().toLowerCase()===`unknown`,()=>`${Math.max(0,100*o()/K(p))}%`,()=>m(o())]),Y(e,s)}),P(n),U(()=>X(i,t.mode===`breakdown`?K(u):`QUOTA USED`)),Y(e,n)},A=e=>{Y(e,Cc())},ce=e=>{Y(e,wc())};Z(oe,e=>{K(d).length?e(se):t.mode===`breakdown`&&K(c)?.total===0&&K(c)?.groups[K(n)]!=null?e(A,1):(K(i)&&t.mode===`breakdown`||K(a)&&t.mode===`periods`)&&e(ce,2)}),P(D),U(()=>{w.disabled=K(s)>=K(o)-1,T.disabled=K(s)===0,X(E,K(o)?`${K(s)+1} / ${K(o)}`:`NO DATA`),X(te,t.mode===`breakdown`?`DAILY BREAKDOWN`:`QUOTA WINDOWS`),X(k,`${(t.mode===`breakdown`?t.reports?.dailyStatus||`UNAVAILABLE`:t.reports?.planStatus||`UNAVAILABLE`)??``} // UTC`)}),hi(y,()=>K(n),e=>R(n,e)),q(`click`,w,()=>R(r,K(s)+1)),q(`click`,T,()=>R(r,K(s)-1)),Y(e,h),We()}Sr([`click`]);var Dc=864e5;function Oc(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 kc(e,t,n){let r=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));for(let e=0;;e++){let i=Oc(r,-t),a=new Date(i.getTime()+Dc);if(e===n)return{start:a,end:r};r=i}}var Ac=J(``),jc=J(``,1),Mc=J(`

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

      `),Nc=J(`

      Token history unavailable; other reports may still be available.

      `),Pc=J(``),Fc=J(`
      `),Ic=J(`

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

      `,1),Lc=J(`
      `,1),Rc=J(` `),zc=J(`

      LIFETIME TOKENS

      PEAK DAY

      CURRENT STREAK

      DAYS

      LONGEST TURN

      SECONDS

      LONGEST STREAK

      DAYS

      OPENAI // UTC

      Accessible data table
      Date (UTC)Tokens

      `,1),Bc=J(`

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

      `),Vc=J(`

      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 Hc(e,t){Ue(t,!0);let n=L(`daily`),r=L(12),i=L(0),a=F(()=>{let e=$.data?.usage?.dailyUsageBuckets;if(!e)return[];let{start:t,end:n}=kc(new Date,K(r),K(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=F(()=>Math.max(1,...K(a).map(e=>e.tokens))),s=F(()=>K(a).length?new Date(K(a)[0].date+`T00:00:00Z`).getUTCDay():0),c=F(()=>{if(K(n)===`monthly`){let e=new Map;for(let t of K(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 K(a).map(t=>({date:t.date,tokens:e+=t.tokens}))});var l=Vc(),u=H(B(l),4);Xr(u,20,()=>[[`daily`,`Daily`],[`monthly`,`Monthly`],[`cumulative`,`Cumulative`],[`breakdown`,`Breakdown`],[`periods`,`Windows`]],Kr,(e,t)=>{var r=F(()=>_(t,2));let a=()=>K(r)[0],o=()=>K(r)[1];var s=Ac();let c;var l=V(s,!0);U(()=>{Q(s,`aria-pressed`,K(n)===a()),c=ci(s,1,``,null,c,{active:K(n)===a()}),X(l,o())}),q(`click`,s,()=>{R(n,a(),!0),R(i,0)}),Y(e,s)}),P(u);var d=H(u,2),f=z(d),p=e=>{var t=jc(),n=B(t),a=H(z(n)),o=z(a);o.value=o.__value=6;var s=H(o);s.value=s.__value=12,P(a),mi(a),P(n);var c=H(n),l=H(c);U(()=>l.disabled=K(i)===0),q(`change`,a,()=>R(i,0)),hi(a,()=>K(r),e=>R(r,e)),q(`click`,c,()=>Kt(i)),q(`click`,l,()=>Kt(i,-1)),Y(e,t)};Z(f,e=>{K(n)!==`breakdown`&&K(n)!==`periods`&&e(p)}),P(d);var m=H(d,2),h=e=>{Y(e,Mc())};Z(m,e=>{$.data?.usageError&&e(h)});var g=H(m,2),v=e=>{Y(e,Nc())};Z(g,e=>{$.data?.usage?.tokenStatus===`UNAVAILABLE`&&K(n)!==`breakdown`&&K(n)!==`periods`&&e(v)});var y=H(g,2),b=e=>{var t=Nr();Gr(B(t),()=>K(n),e=>{{let t=F(()=>$.data?.usage?.reports);Ec(e,{get reports(){return K(t)},get mode(){return K(n)}})}}),Y(e,t)},x=e=>{var t=zc(),r=B(t),i=z(r),l=V(H(z(i),2),!0);P(i);var u=H(i,2),d=V(H(z(u),2),!0);P(u);var f=H(u,2),p=H(z(f),2),m=z(p);xe(),P(p),P(f);var h=H(f,2),g=H(z(h),2),_=z(g);xe(),P(g),P(h);var v=H(h,2),y=H(z(v),2),b=z(y);xe(),P(y),P(v),P(r);var x=H(r,4),S=z(x),C=V(S),w=H(S,2),T=e=>{var t=Ic(),n=B(t),r=z(n),i=z(r);Xr(i,17,()=>Array(K(s)),Kr,(e,t)=>{Y(e,Pc())}),Xr(H(i,2),17,()=>K(a),Kr,(e,t)=>{var n=Fc();let r,i;U(e=>{r=ci(n,1,`heat-cell`,null,r,{zero:K(t).tokens===0}),Q(n,`title`,e),i=ui(n,``,i,{opacity:K(t).tokens?.25+.75*K(t).tokens/K(o):1})},[()=>`${K(t).date}: ${pa(K(t).tokens)} tokens`]),Y(e,n)}),P(r),P(n),xe(2),Y(e,t)},E=e=>{var t=Lc(),r=B(t);{let e=F(()=>K(c).map(e=>e.tokens)),t=F(()=>K(n)+` usage`);io(r,{get values(){return K(e)},get label(){return K(t)}})}var i=H(r,2),a=z(i),o=V(a,!0),s=V(H(a),!0);P(i),U(e=>{X(o,K(c)[0]?.date),X(s,e)},[()=>K(c).at(-1)?.date]),Y(e,t)};Z(w,e=>{K(n)===`daily`?e(T):e(E,-1)});var D=H(w,2),ee=H(z(D),2),te=z(ee),O=H(z(te));Xr(O,21,()=>K(n)===`daily`?K(a):K(c),Kr,(e,t)=>{var n=Rc(),r=z(n),i=V(r,!0),a=V(H(r),!0);P(n),U(e=>{X(i,K(t).date),X(a,e)},[()=>pa(K(t).tokens)]),Y(e,n)}),P(O),P(te),P(ee),P(D),P(x);var k=V(H(x,2));U((e,t,n,r,i,o,s)=>{X(l,e),X(d,t),X(m,`${n??``} `),X(_,`${r??``} `),X(b,`${i??``} `),X(C,`${K(a)[0]?.date??``} — ${o??``}`),X(k,`OBSERVED ${s??``} // CUMULATIVE IS FOR THE SELECTED PERIOD`)},[()=>pa($.data.usage.summary.lifetimeTokens),()=>pa($.data.usage.summary.peakDailyTokens),()=>pa($.data.usage.summary.currentStreakDays),()=>pa($.data.usage.summary.longestRunningTurnSec),()=>pa($.data.usage.summary.longestStreakDays),()=>K(a).at(-1)?.date,()=>ma($.data.usageAt)]),Y(e,t)},S=e=>{Y(e,Bc())};Z(y,e=>{K(n)===`breakdown`||K(n)===`periods`?e(b):$.data?.usage&&$.data.usage.dailyUsageBuckets!==null?e(x,1):e(S,-1)}),Y(e,l),We()}Sr([`click`,`change`]);var Uc=J(`

      Page not found

      Return to Quota

      `,1);function Wc(e){var t=Uc();xe(2),Y(e,t)}var Gc=`CODEXOMETER`,Kc=[`█▀▀ █▀█ █▀▄ █▀▀ ▀▄▀ █▀█ █▀▄▀█ █▀▀ ▀█▀ █▀▀ █▀█`,`█▄▄ █▄█ █▄▀ ██▄ █ █ █▄█ █ ▀ █ ██▄ █ ██▄ █▀▄`].flatMap(e=>[[...e].map(e=>e===`█`||e===`▀`),[...e].map(e=>e===`█`||e===`▄`)]),qc=Kc[0].length,Jc=Kc.length,Yc=0,Xc=[...Gc].map(e=>{let t=e===`M`?5:3,n={start:Yc,width:t};return Yc+=t+1,n}),Zc=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`,Qc=`010 101 111 101.110 111 101 110.111 100 100 111.110 101 101 110.111 100 110 111.111 100 110 100.111 100 101 111.101 101 111 101.111 010 010 111.001 001 101 111.101 110 110 101.100 100 100 111.101 111 101 101.101 111 111 101.111 101 101 111.111 101 111 100.111 101 111 001.111 101 110 101.111 100 001 111.111 010 010 010.101 101 101 111.101 101 101 010.101 101 111 101.101 010 010 101.101 101 010 010.111 001 100 111.111 101 101 111.110 010 010 111.111 001 110 111.111 011 001 111.101 101 111 001.111 110 001 111.100 111 101 111.111 001 010 010.111 111 101 111.111 101 111 001`.split(`.`).map(e=>e.split(` `));function $c(e=Gc,t=-1,n=!1){let r=``;for(let i=0;i{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}function rl(){let e=el[Math.floor(Math.random()*el.length)],t=Math.floor(Math.random()*4294967296),n=nl(t),r=[...Gc].map((e,t)=>t);for(let e=r.length-1;e>0;e--){let t=Math.floor(n()*(e+1));[r[e],r[t]]=[r[t],r[e]]}return{variant:e,seed:t,order:r}}function il(e,t){if(e.variant===`typing`){let e=t<1080,n=e?0:Math.min(Math.floor((t-1080)/90)+1,11);return{text:Gc.slice(0,n).padEnd(11),cursor:n,dot:e?Math.floor(t/180)%2==0:n<11}}if(e.variant===`shuffle`){let n=nl(e.seed^Math.floor(t/70)),r=[...Gc].map(e=>{let t;do t=Zc[Math.floor(n()*36)];while(t===e);return t}),i=Math.min(Math.floor(t/110),11);for(let t of e.order.slice(0,i))r[t]=Gc[t];return{text:r.join(``),cursor:-1,dot:!1}}return{text:Gc,cursor:-1,dot:!1}}var al=jr(``);function ol(e,t){Ue(t,!0);let n=Wi(t,`text`,3,Gc),r=Wi(t,`cursor`,19,()=>-1),i=Wi(t,`dot`,3,!1),a=F(()=>$c(n(),r(),i()));var o=al(),s=V(o);U(()=>{Q(o,`viewBox`,`0 0 ${qc} ${Jc}`),Q(o,`width`,qc),Q(o,`height`,Jc),Q(s,`d`,K(a))}),Y(e,o),We()}var sl=J(`
      `),cl=J(`
      `);function ll(e,t){Ue(t,!0);let n=L(void 0),r=L(0),i=L(Yt({width:0,height:0,pixelRatio:1})),a=L(Yt({x:0,y:0,width:0})),o=F(()=>K(n)?il(K(n),K(r)):void 0),s=F(()=>{if(!K(n))return{x:0,y:0,width:0};let e=tl[K(n).variant],t=Math.min(Math.max((K(r)-e-180)/800,0),1),o=t*t*(3-2*t),s=K(i).width+(K(a).width-K(i).width)*o,c=Math.max((K(i).height-K(i).width*Jc/qc)/2,0),l=(K(n).variant===`slide`&&K(r)Math.round(e*K(i).pixelRatio)/K(i).pixelRatio;return{x:d(l),y:d(u),width:d(s)}});Gi(()=>{let e=matchMedia(`(prefers-reduced-motion: reduce)`);if(e.matches){t.onfinish();return}R(n,rl(),!0);let o=tl[K(n).variant]+180+800,s=0,c=!1,l=performance.now(),u=()=>{let e=t.target?.getBoundingClientRect();R(i,{width:window.innerWidth,height:window.innerHeight,pixelRatio:window.devicePixelRatio||1},!0),e&&R(a,{x:e.x,y:e.y,width:e.width},!0)},d=()=>{c||(c=!0,cancelAnimationFrame(s),t.onfinish())},f=e=>{e instanceof PointerEvent&&e.button!==0||e instanceof KeyboardEvent&&(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)||e instanceof KeyboardEvent&&[`Shift`,`Control`,`Alt`,`Meta`].includes(e.key)||(e.preventDefault(),e.stopImmediatePropagation(),d())},p=()=>{e.matches&&d()},m=e=>{R(r,Math.max(e-l,0),!0),K(r)>=o?d():s=requestAnimationFrame(m)},h=new ResizeObserver(u);if(t.target){h.observe(t.target),t.target.parentElement&&h.observe(t.target.parentElement);let e=t.target.closest(`header`);e&&h.observe(e)}return u(),window.addEventListener(`resize`,u),document.addEventListener(`keydown`,f,!0),document.addEventListener(`pointerdown`,f,!0),e.addEventListener(`change`,p),s=requestAnimationFrame(m),()=>{c=!0,cancelAnimationFrame(s),h.disconnect(),window.removeEventListener(`resize`,u),document.removeEventListener(`keydown`,f,!0),document.removeEventListener(`pointerdown`,f,!0),e.removeEventListener(`change`,p)}});var c=cl(),l=z(c),u=e=>{var t=sl();let n;ol(z(t),{get text(){return K(o).text},get cursor(){return K(o).cursor},get dot(){return K(o).dot}}),P(t),U(()=>{Q(t,`data-text`,K(o).text),Q(t,`data-cursor`,K(o).dot?K(o).cursor:void 0),n=ui(t,``,n,{left:`${K(s).x}px`,top:`${K(s).y}px`,width:`${K(s).width}px`})}),Y(e,t)};Z(l,e=>{K(o)&&e(u)});var d=H(l,2);P(c),U(()=>Q(c,`data-entrance`,K(n)?.variant)),q(`click`,d,function(...e){t.onfinish?.apply(this,e)}),Y(e,c),We()}Sr([`click`]);var ul=J(` `),dl=J(`

      `),fl=J(`

      Connecting to your local Codexometer…

      `),pl=J(``),ml=J(`

      Your quota. Your sessions. Your command centre.

      `);function hl(e,t){Ue(t,!0);let n={"/":to,"/quota/:view?":to,"/sessions/:id?":pc,"/usage":Hc,"*":Wc},r={quota:/^(?:\/|\/quota(?:\/[^/]+)?\/?)$/,sessions:/^\/sessions(?:\/[^/]+)?\/?$/,usage:/^\/usage\/?$/},i=L(`hacker`),a=L(!0),o=L(void 0);vn(()=>{sa.requests&&lr().then(()=>{K(o)?.focus(),K(o)?.scrollIntoView({block:`nearest`})})});let s=L(void 0),c=[`hacker`,`rust`,`blue-steel`,`ultraviolet`,`nightshade`];vn(()=>{ca()}),vn(()=>{if($.data)for(let[e,t]of Object.entries(r))t.test(Yi.location)&&(aa.tab=e)}),Gi(()=>{try{let e=localStorage.getItem(`codexometer.web.theme`);e&&c.includes(e)&&R(i,e,!0)}catch{}return ya()});function l(){try{localStorage.setItem(`codexometer.web.theme`,K(i))}catch{}}var u=ml(),d=z(u),f=z(d),p=z(f);ol(z(p),{}),P(p),Ii(p,e=>R(s,e),()=>K(s)),xe(2),P(f);var m=H(f,2),h=z(m);let g;var v=H(h,1,!0),y=V(H(v));P(m),P(d);var b=H(d,2);Xr(b,21,()=>Object.entries(r),Kr,(e,t)=>{var n=F(()=>_(K(t),2));let r=()=>K(n)[0],i=()=>K(n)[1],a=F(()=>i().test(Yi.location));var o=ul();let s;var c=V(o,!0);U(e=>{Q(o,`href`,r()===`quota`?`#/quota/`+aa.view:`#/`+r()),Q(o,`aria-current`,K(a)?`page`:void 0),s=ci(o,1,``,null,s,{active:K(a)}),X(c,e)},[()=>r().toUpperCase()]),Y(e,o)}),P(b);var x=H(b,2),S=z(x),C=e=>{var t=dl(),n=V(t,!0);U(()=>X(n,$.error)),Y(e,t)};Z(S,e=>{$.error&&e(C)});var w=H(S,2),T=e=>{$i(e,{get routes(){return n}})},E=e=>{Y(e,fl())};Z(w,e=>{$.data?e(T):$.error||e(E,1)}),P(x);var D=H(x,2),ee=z(D),te=V(ee),O=H(ee,2),k=V(O,!0),ne=H(O,2),re=H(z(ne));Xr(re,21,()=>c,Kr,(e,t)=>{var n=pl(),r=V(n,!0),i={};U(e=>{X(r,e),i!==(i=K(t))&&(n.value=(n.__value=i)??``)},[()=>K(t).replace(`-`,` `).toUpperCase()]),Y(e,n)}),P(re),Ii(re,e=>R(o,e),()=>K(o)),mi(re),P(ne),P(D);var ie=H(D,2),ae=e=>{ll(e,{get target(){return K(s)},onfinish:()=>R(a,!1)})};Z(ie,e=>{K(a)&&e(ae)}),P(u),U(()=>{Q(u,`data-theme`,K(i)),Q(u,`data-starting`,K(a)),d.inert=K(a),g=ci(h,1,`lamp`,null,g,{lit:$.connected}),X(v,$.connected?`CONNECTED`:`OFFLINE`),X(y,`EXPERIMENTAL // ${$.data?.control?`SESSION CONTROL`:`READ ONLY`}`),b.inert=K(a),x.inert=K(a),D.inert=K(a),X(te,`v${($.data?.version||`…`)??``} // LOCAL ONLY`),X(k,$.data?.control?`Session control enabled. Stop the server to revoke access.`:`No actions can be sent from this preview.`)}),q(`change`,re,l),hi(re,()=>K(i),e=>R(i,e)),Y(e,u),We()}Sr([`change`]),zr(hl,{target:document.getElementById(`app`)}); \ No newline at end of file diff --git a/internal/web/dist/assets/index-Bjr_1drg.css b/internal/web/dist/assets/index-Bjr_1drg.css deleted file mode 100644 index 85fdd1b..0000000 --- a/internal/web/dist/assets/index-Bjr_1drg.css +++ /dev/null @@ -1 +0,0 @@ -.observation-details.svelte-1vgdi83{font-size:12px}summary.svelte-1vgdi83{cursor:pointer;color:var(--accent)}.observation-table.svelte-1vgdi83{max-height:240px;overflow:auto}.zone-canvas.svelte-1vgdi83{flex:1;min-height:170px;margin-top:6px;position:relative}svg.svelte-1vgdi83{width:100%;height:100%;display:block;position:absolute;inset:0}text.svelte-1vgdi83{fill:var(--ink);font:14px Cascadia Code,Consolas,monospace}.axis-title.svelte-1vgdi83{letter-spacing:.04em;font-size:12px}.grid.svelte-1vgdi83{stroke:#fff;stroke-opacity:.14;stroke-width:1px}.axes.svelte-1vgdi83{stroke:var(--ink);stroke-width:1.5px;fill:none}.pace-line.svelte-1vgdi83{stroke:#fff;stroke-width:2px;stroke-dasharray:6 4}.position-halo.svelte-1vgdi83{fill:#101820;stroke:#fff;stroke-width:1.5px}.position-dot.svelte-1vgdi83{fill:#fff}.observation-trail.svelte-1vgdi83{fill:none;stroke:#101820;stroke-width:2.5px;stroke-linejoin:round}.observation-trail-casing.svelte-1vgdi83{fill:none;stroke:#ffffff73;stroke-width:4.5px;stroke-linejoin:round}.trail-start.svelte-1vgdi83{fill:#101820;stroke:#ffffffb3;stroke-width:2px}.trend-line.svelte-1vgdi83{fill:none;stroke:var(--trend-color);stroke-width:2px;stroke-dasharray:3 6}.trend-arrow.svelte-1vgdi83{fill:var(--trend-color);stroke:#ffffff73;stroke-width:.5px}.trend-casing.svelte-1vgdi83{fill:none;stroke:#ffffff73;stroke-width:4px;stroke-dasharray:3 6}.zone-caption.svelte-1vgdi83{min-width:0;color:var(--accent);flex:auto;margin:0}.trend-summary.svelte-1vgdi83{color:var(--ink)}.zone-footer.svelte-1vgdi83{justify-content:space-between;align-items:flex-start;gap:12px;margin-top:4px;display:flex}.zone-controls.svelte-1vgdi83{color:var(--muted);text-align:right;flex-direction:column;align-items:flex-end;gap:5px;font-size:11px;display:flex}.trace-control.svelte-1vgdi83,.trend-control.svelte-1vgdi83{cursor:pointer;white-space:nowrap}.trace-control.svelte-1vgdi83 input:where(.svelte-1vgdi83){accent-color:var(--accent)}.trend-control.svelte-1vgdi83 select:where(.svelte-1vgdi83){border:1px solid var(--edge);background:var(--panel);max-width:min(230px,45vw);color:var(--ink);font:inherit}.trend-control.svelte-1vgdi83 option:where(.svelte-1vgdi83):disabled{color:var(--muted)}.zone-controls.svelte-1vgdi83 small:where(.svelte-1vgdi83){font-size:10px}@container (width<=560px){.zone-footer.svelte-1vgdi83{flex-direction:column}.zone-controls.svelte-1vgdi83{align-self:stretch;align-items:flex-end}}.usage-diagnostic.svelte-16u6dmb{white-space:pre-wrap;overflow-wrap:anywhere}.slash-commands.svelte-7bfwr9{margin:.4rem 0;position:relative}.command-popup.svelte-7bfwr9{z-index:5;box-sizing:border-box;border:1px solid var(--accent);background:var(--panel);width:min(40rem,100%);padding:.35rem;position:absolute;bottom:100%;left:0;box-shadow:0 .3rem 1rem #0006}.command-popup.svelte-7bfwr9 p:where(.svelte-7bfwr9){margin:.3rem 0;font-size:.8em}.command-options.vertical.svelte-7bfwr9{flex-flow:column;gap:.15rem;display:flex}.vertical.svelte-7bfwr9 button:where(.svelte-7bfwr9){text-align:left;white-space:nowrap;width:100%;min-width:0;color:var(--muted);background:var(--panel);border-color:#0000;flex:none;align-items:baseline;gap:.4rem;display:flex}.vertical.svelte-7bfwr9 .command-name:where(.svelte-7bfwr9),.vertical.svelte-7bfwr9 .command-tail:where(.svelte-7bfwr9){flex:none}.vertical.svelte-7bfwr9 .command-name:where(.svelte-7bfwr9){text-overflow:ellipsis;max-width:100%;overflow:hidden}.vertical.svelte-7bfwr9 button.suggested:where(.svelte-7bfwr9){outline:none}.command-options.svelte-7bfwr9 button.suggested:where(.svelte-7bfwr9) .command-name:where(.svelte-7bfwr9){color:var(--ink);font-weight:700}.command-options.svelte-7bfwr9 button:where(.svelte-7bfwr9):not(.suggested):hover .command-name:where(.svelte-7bfwr9){text-decoration:underline}.command-options.svelte-7bfwr9 button:where(.svelte-7bfwr9){color:var(--muted)}.vertical.svelte-7bfwr9 .command-help:where(.svelte-7bfwr9){min-width:0;max-width:none;color:var(--muted);flex:1}.command-options.svelte-7bfwr9{flex-wrap:wrap;gap:.35rem;max-height:35vh;display:flex;overflow:auto}.command-options.svelte-7bfwr9 .suggested:where(.svelte-7bfwr9){outline:none}.command-help.svelte-7bfwr9{text-overflow:ellipsis;white-space:nowrap;opacity:.75;max-width:32ch;font-size:.8em;display:block;overflow:hidden}.command-actions.svelte-7bfwr9{flex-wrap:wrap;gap:.35rem;margin-top:.4rem;display:flex}.availability.svelte-7bfwr9{font-weight:600}.navigation.svelte-7bfwr9{font-size:.8em}pre.svelte-7bfwr9{white-space:pre-wrap;overflow-wrap:anywhere;max-height:35vh;overflow:auto}.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)}.status-line.svelte-gprptn{align-items:center;gap:.5rem;min-width:0;margin-top:.5rem;display:flex}.status-line.svelte-gprptn p:where(.svelte-gprptn){white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;margin:0;font-size:.8rem;overflow:hidden}.configure.svelte-gprptn{padding:.15rem .35rem;font-size:.75rem}.status-picker.svelte-gprptn{border:1px solid var(--edge);margin:.5rem 0;padding:.6rem}.fields.svelte-gprptn{max-height:35vh;overflow:auto}.field.svelte-gprptn{align-items:center;gap:.35rem;display:flex}.field.svelte-gprptn label:where(.svelte-gprptn){flex:1;align-items:center;gap:.4rem;display:flex}.field.svelte-gprptn label:where(.svelte-gprptn) span:where(.svelte-gprptn){font-size:.75rem}.field.svelte-gprptn button:where(.svelte-gprptn){padding:.1rem .35rem}.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%}svg.svelte-1jpy949{fill:currentColor;width:100%;height:auto;display:block}.startup.svelte-19xbbtg{z-index:100;background:var(--bg);color:var(--accent);position:fixed;inset:0;overflow:hidden}.wordmark.svelte-19xbbtg{position:absolute}button.svelte-19xbbtg{color:var(--muted);font:inherit;white-space:nowrap;background:0 0;border:0;font-size:12px;position:absolute;bottom:24px;left:50%;transform:translate(-50%)}: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}.shell[data-starting=true]>header,.shell[data-starting=true]>nav,.shell[data-starting=true]>main,.shell[data-starting=true]>footer{visibility:hidden}.brand{width:clamp(240px,32vw,405px);max-width:calc(100vw - 40px);color:var(--accent);text-decoration:none;display:block}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;container-type:inline-size}.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-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)}.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-DiPYjudz.css b/internal/web/dist/assets/index-DiPYjudz.css new file mode 100644 index 0000000..1fdde2c --- /dev/null +++ b/internal/web/dist/assets/index-DiPYjudz.css @@ -0,0 +1 @@ +.observation-details.svelte-1vgdi83{font-size:12px}summary.svelte-1vgdi83{cursor:pointer;color:var(--accent)}.observation-table.svelte-1vgdi83{max-height:240px;overflow:auto}.zone-canvas.svelte-1vgdi83{flex:1;min-height:170px;margin-top:6px;position:relative}svg.svelte-1vgdi83{width:100%;height:100%;display:block;position:absolute;inset:0}text.svelte-1vgdi83{fill:var(--ink);font:14px Cascadia Code,Consolas,monospace}.axis-title.svelte-1vgdi83{letter-spacing:.04em;font-size:12px}.grid.svelte-1vgdi83{stroke:#fff;stroke-opacity:.14;stroke-width:1px}.axes.svelte-1vgdi83{stroke:var(--ink);stroke-width:1.5px;fill:none}.pace-line.svelte-1vgdi83{stroke:#fff;stroke-width:2px;stroke-dasharray:6 4}.position-halo.svelte-1vgdi83{fill:#101820;stroke:#fff;stroke-width:1.5px}.position-dot.svelte-1vgdi83{fill:#fff}.observation-trail.svelte-1vgdi83{fill:none;stroke:#101820;stroke-width:2.5px;stroke-linejoin:round}.observation-trail-casing.svelte-1vgdi83{fill:none;stroke:#ffffff73;stroke-width:4.5px;stroke-linejoin:round}.trail-start.svelte-1vgdi83{fill:#101820;stroke:#ffffffb3;stroke-width:2px}.trend-line.svelte-1vgdi83{fill:none;stroke:var(--trend-color);stroke-width:2px;stroke-dasharray:3 6}.trend-arrow.svelte-1vgdi83{fill:var(--trend-color);stroke:#ffffff73;stroke-width:.5px}.trend-casing.svelte-1vgdi83{fill:none;stroke:#ffffff73;stroke-width:4px;stroke-dasharray:3 6}.zone-caption.svelte-1vgdi83{min-width:0;color:var(--accent);flex:auto;margin:0}.trend-summary.svelte-1vgdi83{color:var(--ink)}.zone-footer.svelte-1vgdi83{justify-content:space-between;align-items:flex-start;gap:12px;margin-top:4px;display:flex}.zone-controls.svelte-1vgdi83{color:var(--muted);text-align:right;flex-direction:column;align-items:flex-end;gap:5px;font-size:11px;display:flex}.trace-control.svelte-1vgdi83,.trend-control.svelte-1vgdi83{cursor:pointer;white-space:nowrap}.trace-control.svelte-1vgdi83 input:where(.svelte-1vgdi83){accent-color:var(--accent)}.trend-control.svelte-1vgdi83 select:where(.svelte-1vgdi83){border:1px solid var(--edge);background:var(--panel);max-width:min(230px,45vw);color:var(--ink);font:inherit}.trend-control.svelte-1vgdi83 option:where(.svelte-1vgdi83):disabled{color:var(--muted)}.zone-controls.svelte-1vgdi83 small:where(.svelte-1vgdi83){font-size:10px}@container (width<=560px){.zone-footer.svelte-1vgdi83{flex-direction:column}.zone-controls.svelte-1vgdi83{align-self:stretch;align-items:flex-end}}.usage-diagnostic.svelte-16u6dmb{white-space:pre-wrap;overflow-wrap:anywhere}.slash-commands.svelte-7bfwr9{margin:.4rem 0;position:relative}.command-popup.svelte-7bfwr9{z-index:5;box-sizing:border-box;border:1px solid var(--accent);background:var(--panel);width:min(40rem,100%);padding:.35rem;position:absolute;bottom:100%;left:0;box-shadow:0 .3rem 1rem #0006}.command-popup.svelte-7bfwr9 p:where(.svelte-7bfwr9){margin:.3rem 0;font-size:.8em}.command-options.vertical.svelte-7bfwr9{flex-flow:column;gap:.15rem;display:flex}.vertical.svelte-7bfwr9 button:where(.svelte-7bfwr9){text-align:left;white-space:nowrap;width:100%;min-width:0;color:var(--muted);background:var(--panel);border-color:#0000;flex:none;align-items:baseline;gap:.4rem;display:flex}.vertical.svelte-7bfwr9 .command-name:where(.svelte-7bfwr9),.vertical.svelte-7bfwr9 .command-tail:where(.svelte-7bfwr9){flex:none}.vertical.svelte-7bfwr9 .command-name:where(.svelte-7bfwr9){text-overflow:ellipsis;max-width:100%;overflow:hidden}.vertical.svelte-7bfwr9 button.suggested:where(.svelte-7bfwr9){outline:none}.command-options.svelte-7bfwr9 button.suggested:where(.svelte-7bfwr9) .command-name:where(.svelte-7bfwr9){color:var(--ink);font-weight:700}.command-options.svelte-7bfwr9 button:where(.svelte-7bfwr9):not(.suggested):hover .command-name:where(.svelte-7bfwr9){text-decoration:underline}.command-options.svelte-7bfwr9 button:where(.svelte-7bfwr9){color:var(--muted)}.vertical.svelte-7bfwr9 .command-help:where(.svelte-7bfwr9){min-width:0;max-width:none;color:var(--muted);flex:1}.command-options.svelte-7bfwr9{flex-wrap:wrap;gap:.35rem;max-height:35vh;display:flex;overflow:auto}.command-options.svelte-7bfwr9 .suggested:where(.svelte-7bfwr9){outline:none}.command-help.svelte-7bfwr9{text-overflow:ellipsis;white-space:nowrap;opacity:.75;max-width:32ch;font-size:.8em;display:block;overflow:hidden}.command-actions.svelte-7bfwr9{flex-wrap:wrap;gap:.35rem;margin-top:.4rem;display:flex}.availability.svelte-7bfwr9{font-weight:600}.navigation.svelte-7bfwr9{font-size:.8em}pre.svelte-7bfwr9{white-space:pre-wrap;overflow-wrap:anywhere;max-height:35vh;overflow:auto}.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)}.status-line.svelte-gprptn{align-items:center;gap:.5rem;min-width:0;margin-top:.5rem;display:flex}.status-line.svelte-gprptn p:where(.svelte-gprptn){white-space:nowrap;text-overflow:ellipsis;flex:1;min-width:0;margin:0;font-size:.8rem;overflow:hidden}.configure.svelte-gprptn{padding:.15rem .35rem;font-size:.75rem}.status-picker.svelte-gprptn{border:1px solid var(--edge);margin:.5rem 0;padding:.6rem}.fields.svelte-gprptn{max-height:35vh;overflow:auto}.field.svelte-gprptn{align-items:center;gap:.35rem;display:flex}.field.svelte-gprptn label:where(.svelte-gprptn){flex:1;align-items:center;gap:.4rem;display:flex}.field.svelte-gprptn label:where(.svelte-gprptn) span:where(.svelte-gprptn){font-size:.75rem}.field.svelte-gprptn button:where(.svelte-gprptn){padding:.1rem .35rem}.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)}.failed.svelte-mm4wfe{color:var(--approval)}.lamp.failed.svelte-mm4wfe{background:var(--approval);box-shadow:0 0 8px color-mix(in srgb, var(--approval) 40%, transparent)}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%}svg.svelte-1jpy949{fill:currentColor;width:100%;height:auto;display:block}.startup.svelte-19xbbtg{z-index:100;background:var(--bg);color:var(--accent);position:fixed;inset:0;overflow:hidden}.wordmark.svelte-19xbbtg{position:absolute}button.svelte-19xbbtg{color:var(--muted);font:inherit;white-space:nowrap;background:0 0;border:0;font-size:12px;position:absolute;bottom:24px;left:50%;transform:translate(-50%)}: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}.shell[data-starting=true]>header,.shell[data-starting=true]>nav,.shell[data-starting=true]>main,.shell[data-starting=true]>footer{visibility:hidden}.brand{width:clamp(240px,32vw,405px);max-width:calc(100vw - 40px);color:var(--accent);text-decoration:none;display:block}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;container-type:inline-size}.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-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)}.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-zYOUcPV1.js b/internal/web/dist/assets/index-zYOUcPV1.js new file mode 100644 index 0000000..70ec690 --- /dev/null +++ b/internal/web/dist/assets/index-zYOUcPV1.js @@ -0,0 +1,47 @@ +(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,D=1<<20,ee=1<<25,te=1<<21,O=1<<22,ne=1<<23,k=Symbol(`$state`),re=Symbol(`component`),ie=Symbol(`legacy props`),ae=Symbol(``),oe=Symbol(`attributes`),se=Symbol(`class`),A=Symbol(`style`),ce=Symbol(`text`),le=Symbol(`form reset`),ue=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},de=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`),fe={},j=Symbol(`uninitialized`),pe=`http://www.w3.org/1999/xhtml`;function me(){console.warn(`https://svelte.dev/e/derived_inert`)}function he(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function ge(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function _e(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var M=!1;function ve(e){M=e}var N;function ye(e){if(e===null)throw he(),fe;return N=e}function be(){return ye(on(N))}function P(e){if(M){if(on(N)!==null)throw he(),fe;N=e}}function xe(e=1){if(M){for(var t=e,n=N;t--;)n=on(n);N=n}}function Se(e=!0){for(var t=0,n=N;;){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=on(n);e&&n.remove(),n=i}}function Ce(e){if(!e||e.nodeType!==8)throw he(),fe;return e.data}function we(e){return e===this.v}function Te(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Ee(e){return!Te(e,this.v)}function De(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function Oe(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function ke(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Ae(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function je(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Me(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Ne(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Pe(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Fe(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function Ie(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Le(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Re(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var ze=!1;function Be(){ze=!0}var Ve=null;function He(e){Ve=e}function Ue(e,t=!1,n){Ve={p:Ve,i:!1,c:null,e:null,s:e,x:null,r:G,l:ze&&!t?{s:null,u:null,$:[]}:null}}function We(e){var t=Ve,n=t.e;if(n!==null){t.e=null;for(var r of n)yn(r)}return e!==void 0&&(t.x=e),t.i=!0,Ve=t.p,Ge(e)}function Ge(e={}){return i(e,re,{value:!0}),e}function Ke(){return!ze||Ve!==null&&Ve.l===null}var qe=[];function Je(){var e=qe;qe=[],m(e)}function Ye(e){if(qe.length===0&&!Ct){var t=qe;queueMicrotask(()=>{t===qe&&Je()})}qe.push(e)}function Xe(){for(;qe.length>0;)Je()}var Ze=~(y|b|v);function Qe(e,t){e.f=e.f&Ze|t}function $e(e){e.f&512||e.deps===null?Qe(e,v):Qe(e,b)}function et(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),Qe(e,v)}function tt(e){M&&an(e)!==null&&sn(e)}var nt=!1;function rt(){nt||(nt=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[le]?.()})},{capture:!0}))}function it(e){var t=W,n=G;Un(null),Wn(null);try{return e()}finally{Un(t),Wn(n)}}function at(e,t,n,r=n){e.addEventListener(t,()=>it(n));let i=e[le];e[le]=i?()=>{i(),r(!0)}:()=>r(!0),rt()}function ot(e,t,n,r){let i=Ke()?ut:pt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=G,c=st(),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){fn(e,s)}ct()}}var d=lt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>ft(e))).then(u).catch(e=>fn(e,s)).finally(d)}l?l.then(()=>{c(),f(),ct()}):f()}function st(){var e=G,t=W,n=Ve,r=I;return function(i=!0){Wn(e),Un(t),He(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function ct(e=!0){Wn(null),Un(null),He(null),e&&I?.deactivate()}function lt(){var e=G,t=e.b,n=I,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 ut(e){var t=2|y;return G!==null&&(G.f|=E),{ctx:Ve,deps:null,effects:null,equals:we,f:t,fn:e,reactions:null,rv:0,v:j,wv:0,parent:G,ac:null}}var dt=Symbol(`obsolete`);function ft(e,t,n){let r=G;r===null&&Oe();var i=void 0,a=Bt(j),o=!W,s=new Set;return Cn(()=>{var t=G,n=h();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==ue&&n.reject(e)}).finally(ct)}catch(e){n.reject(e),ct()}var c=I;if(o){if(t.f&32768)var l=lt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(dt);else for(let e of s.values())e.reject(dt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==dt&&(c.activate(),t?(a.f|=ne,Wt(a,t)):(a.f&8388608&&(a.f^=ne),Wt(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),_n(()=>{for(let e of s)e.reject(dt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function F(e){let t=ut(e);return Kn(t),t}function pt(e){let t=ut(e);return t.equals=Ee,t}function mt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n{t.ac.abort(ue),t.ac=null}),t.fn!==null&&(t.teardown=f),sr(t,0),On(t))}function vt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&cr(t)}var yt=null,I=null,bt=null,xt=null,St=null,Ct=!1,wt=!1,Tt=null,Et=null,Dt=0,Ot=1,kt=class e{id=Ot++;#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(){yt===null?yt=this:(yt.#n=this,this.#t=yt),yt=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)Qe(r,y),t(r);for(r of n.m)Qe(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),Qe(e,y),this.schedule(e);for(let e of this.#d)Qe(e,b),this.schedule(e);this.apply();for(var t=Tt=[],n=[],r=Et=[];this.#c.length>0;){Dt++>1e3&&(this.#S(),jt());for(let e of this.#g())try{this.#v(e,t,n)}catch(t){throw It(e),this.#h()||this.discard(),t}}if(I=null,r.length>0){var i=e.ensure();for(let e of r)i.schedule(e)}if(Tt=null,Et=null,this.#h()){this.#x(n),this.#x(t);for(let[e,t]of this.#f)Ft(e,t);r.length>0&&I.#_();return}let a=this.#y();if(a)this.#x(n),this.#x(t),a.#b(this);else{this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),bt=this,Nt(n),Nt(t),bt=null,this.#s?.resolve();var o=I;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&&(Rt.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):nr(r)&&(i&16&&this.#d.add(r),cr(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),Qe(i,y),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#S(),I=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(I===null){let t=I=new e;!wt&&!Ct&&Ye(()=>{t.#e||t.flush()})}return I}apply(){xt=null}schedule(e){St=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)?e.b.defer_effect(e):this.#c.push(e)}#S(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?yt=e:t.#t=e,this.linked=!1}}};function At(e){var t=Ct;Ct=!0;try{var n;for(e&&(I!==null&&!I.is_fork&&I.flush(),n=e());;){if(Xe(),I===null)return n;I.flush()}}finally{Ct=t}}function jt(){try{Ne()}catch(e){fn(e,St)}}var Mt=null;function Nt(e){var t=e.length;if(t!==0){for(var n=0;n0)){Rt.clear();for(let e of Mt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Mt.has(n)&&(Mt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||cr(n)}}Mt.clear()}}Mt=null}}function Pt(e){I.schedule(e)}function Ft(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),Qe(e,v);for(var n=e.first;n!==null;)Ft(n,t),n=n.next}}function It(e){Qe(e,v);for(var t=e.first;t!==null;)It(t),t=t.next}var Lt=new Set,Rt=new Map,zt=!1;function Bt(e,t){return{f:0,v:e,reactions:null,equals:we,rv:0,wv:0}}function L(e,t){let n=Bt(e,t);return Kn(n),n}function Vt(e,t=!1,n=!0){let r=Bt(e);return t||(r.equals=Ee),ze&&n&&Ve!==null&&Ve.l!==null&&(Ve.l.s??=[]).push(r),r}function R(e,t,n=!1){return W!==null&&(!Hn||W.f&131072)&&Ke()&&W.f&4325394&&(Gn===null||!Gn.has(e))&&Le(),Wt(e,n?Yt(t):t,Et)}var Ht=null,Ut=0;function Wt(e,t,n=null){if(!e.equals(t)){Bn?Rt.set(e,t):Rt.has(e)||Rt.set(e,e.v);var r=kt.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&ht(t),xt===null&&$e(t)}e.wv=tr(),Ht=null,Ut=0,Jt(e,y,n),Ht=null,Ke()&&G!==null&&G.f&1024&&!(G.f&96)&&(Yn===null?Xn([e]):Yn.push(e)),!r.is_fork&&Lt.size>0&&!zt&&Gt()}return t}function Gt(){zt=!1;for(let e of Lt){e.f&1024&&Qe(e,b);let t;try{t=nr(e)}catch{t=!0}t&&cr(e)}Lt.clear()}function Kt(e,t=1){var n=K(e),r=t===1?n++:n--;return R(e,n),r}function qt(e){R(e,e.v+1)}function Jt(e,t,n){var r=e.reactions;if(r!==null){var i=Ke(),a=r.length;if(Ut+=a,Ut>1e5&&Ht===null&&(Ht=new Set),Ht!==null){if(Ht.has(e))return;Ht.add(e)}for(var o=0;o{if($n===d)return e();var t=W,n=$n;Un(null),er(d);var r=e();return Un(t),er(n),r};return i&&r.set(`length`,L(t.length,u)),new Proxy(t,{defineProperty(e,t,n){`value`in n&&n.configurable!==!1&&n.enumerable!==!1&&n.writable!==!1||Fe();var i=r.get(t);return i===void 0?f(()=>{var e=L(n.value,u);return r.set(t,e),e}):R(i,n.value,!0),!0},deleteProperty(e,t){var n=r.get(t);if(n===void 0){if(t in e){let e=f(()=>L(j,u));r.set(t,e),qt(o)}}else R(n,j),qt(o);return!0},get(e,n,i){if(n===k)return t;var o=r.get(n),s=n in e;if(o===void 0&&(!s||a(e,n)?.writable)&&(o=f(()=>L(Yt(s?e[n]:j),u)),r.set(n,o)),o!==void 0){var c=K(o);return c===j?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=K(i);if(a===j)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===k)return!0;var n=r.get(t),i=n!==void 0&&n.v!==j||Reflect.has(e,t);return(n!==void 0||G!==null&&(!i||a(e,t)?.writable))&&(n===void 0&&(n=f(()=>L(i?Yt(e[t]):j,u)),r.set(t,n)),K(n)===j)?!1:i},set(e,t,n,s){var c=r.get(t),l=t in e;if(i&&t===`length`)for(var d=n;dL(j,u)),r.set(d+``,p)):R(p,j)}if(c===void 0)(!l||a(e,t)?.writable)&&(c=f(()=>L(void 0,u)),R(c,Yt(n)),r.set(t,c));else{l=c.v!==j;var m=f(()=>Yt(n));R(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&&R(g,_+1)}qt(o)}return!0},ownKeys(e){K(o);var t=Reflect.ownKeys(e).filter(e=>{var t=r.get(e);return t===void 0||t.v!==j});for(var[n,i]of r)i.v!==j&&!(n in e)&&t.push(n);return t},setPrototypeOf(){Ie()}})}function Xt(e){try{if(typeof e==`object`&&e&&k in e)return e[k]}catch{}return e}function Zt(e,t){return Object.is(Xt(e),Xt(t))}var Qt,$t,en,tn;function nn(){if(Qt===void 0){Qt=window,$t=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;en=a(t,`firstChild`).get,tn=a(t,`nextSibling`).get,u(e)&&(e[se]=void 0,e[oe]=null,e[A]=void 0,e.__e=void 0),u(n)&&(n[ce]=void 0)}}function rn(e=``){return document.createTextNode(e)}function an(e){return en.call(e)}function on(e){return tn.call(e)}function z(e,t){if(!M)return an(e);var n=an(N);if(n===null)n=N.appendChild(rn());else if(t&&n.nodeType!==3){var r=rn();return n?.before(r),ye(r),r}return t&&un(n),ye(n),n}function B(e,t=!1){if(!M){var n=an(e);return n instanceof Comment&&n.data===``?on(n):n}if(t){if(N?.nodeType!==3){var r=rn();return N?.before(r),ye(r),r}un(N)}return N}function V(e,t=!1){if(!M)return an(e);var n=z(e,t);return P(e),n}function H(e,t=1,n=!1){let r=M?N:e;for(var i;t--;)i=r,r=on(r);if(!M)return r;if(n){if(r?.nodeType!==3){var a=rn();return r===null?i?.after(a):r.before(a),ye(a),a}un(r)}return ye(r),r}function sn(e){e.textContent=``}function cn(){return!1}function ln(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 un(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 dn(e){var t=G;if(t===null)return W.f|=ne,e;if(!(t.f&32768)&&!(t.f&4))throw e;fn(e,t)}function fn(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 pn(e){G===null&&(W===null&&Me(e),je()),Bn&&Ae(e)}function mn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function hn(e,t){var n=G;n!==null&&n.f&8192&&(e|=x);var r={ctx:Ve,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};I?.register_created_effect(r);var i=r;if(e&4)Tt===null?kt.ensure().schedule(r):Tt.push(r);else if(t!==null){try{cr(r)}catch(e){throw An(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&&mn(i,n),W!==null&&W.f&2&&!(e&64))){var a=W;(a.effects??=[]).push(i)}return r}function gn(){return W!==null&&!Hn}function _n(e){let t=hn(8,null);return Qe(t,v),t.teardown=e,t}function vn(e){pn(`$effect`);var t=G.f;if(!W&&t&32&&Ve!==null&&!Ve.i){var n=Ve;(n.e??=[]).push(e)}else return yn(e)}function yn(e){return hn(4|D,e)}function bn(e){return pn(`$effect.pre`),hn(8|D,e)}function xn(e){kt.ensure();let t=hn(64|E,e);return(e={})=>new Promise(n=>{e.outro?Nn(t,()=>{An(t),n(void 0)}):(An(t),n(void 0))})}function Sn(e){return hn(4,e)}function Cn(e){return hn(O|E,e)}function wn(e,t=0){return hn(8|t,e)}function U(e,t=[],n=[],r=[]){ot(r,t,n,t=>{hn(8,()=>{e(...t.map(K))})})}function Tn(e,t=0){return hn(16|t,e)}function En(e){return hn(32|E,e)}function Dn(e){var t=e.teardown;if(t!==null){let n=Bn,r=W;Vn(!0),Un(null);try{t.call(null)}catch(t){fn(t,e.parent)}finally{Vn(n),Un(r)}}}function On(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&it(()=>{e.abort(ue)});var r=n.next;n.f&64?n.parent=null:An(n,t),n=r}}function kn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||An(t),t=n}}function An(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(jn(e.nodes.start,e.nodes.end),n=!0),e.f|=w,On(e,t&&!n),sr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();Dn(e),e.f^=w,e.f|=S;var i=e.parent;i!==null&&i.first!==null&&Mn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function jn(e,t){for(;e!==null;){var n=e===t?null:on(e);e.remove(),e=n}}function Mn(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 Nn(e,t,n=!0){var r=[];e.f|=256,Pn(e,r,!0);var i=()=>{n&&An(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Pn(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);Pn(i,t,o?n:!1)}i=a}}}function Fn(e){e.f&=-257,In(e,!0)}function In(e,t){if(!(e.f&256)&&e.f&8192){e.f^=x,e.f&1024||(Qe(e,y),kt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=!!(n.f&65536)||!!(n.f&32);In(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 Ln(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:on(n);t.append(n),n=i}}var Rn=null,zn=!1,Bn=!1;function Vn(e){Bn=e}var W=null,Hn=!1;function Un(e){W=e}var G=null;function Wn(e){G=e}var Gn=null;function Kn(e){W!==null&&(W.f&2097152||W.f&2)&&(Gn??=new Set).add(e)}var qn=null,Jn=0,Yn=null;function Xn(e){Yn=e}var Zn=1,Qn=0,$n=Qn;function er(e){$n=e}function tr(){return++Zn}function nr(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&&xt===null&&Qe(e,v)}return!1}function rr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Gn!==null&&Gn.has(e)))for(var i=0;i{e.ac.abort(ue)}),e.ac=null);try{e.f|=te;var u=e.fn,d=u();e.f|=C;var f=ar(e);if(Ke()&&Yn!==null&&!Hn&&f!==null&&!(e.f&6146))for(var p=0;p0)for(t.length=Jn+qn.length,r=0;r{s.ac.abort(ue),s.ac=null,Qe(s,y)}),_t(s),sr(s,0)}}function sr(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,Ye(()=>{i.__removed||t.addEventListener(e,i,r)})):t.addEventListener(e,i,r),i}function xr(e,t,n,r,i){var a={capture:r,passive:i},o=br(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&_n(()=>{o.__removed=!0,t.removeEventListener(e,o,a)})}function q(e,t,n){(t[_r]??={})[e]=n}function Sr(e){for(var t=0;t{wr=!1,Cr=null}));var s=0,c=Cr===e&&e[_r];if(c){var l=a.indexOf(c);if(l!==-1&&(t===document||t===window)){e[_r]=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=W,f=G;Un(null),Wn(null);try{for(var p,m=[];o!==null&&o!==t;){try{var h=o[_r]?.[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[_r]=t,delete e.currentTarget,Un(d),Wn(f)}}}var Er=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function Dr(e){return Er?.createHTML(e)??e}function Or(e){var t=ln(`template`);return t.innerHTML=Dr(e.replaceAll(``,``)),t.content}function kr(e,t){var n=G;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function J(e,t){var n=!!(t&1),r=!!(t&2),i,a=!e.startsWith(``);return()=>{if(M)return kr(N,null),N;i===void 0&&(i=Or(a?e:``+e),n||(i=an(i)));var t=r||$t?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=an(t),s=t.lastChild;kr(o,s)}else kr(t,t);return t}}function Ar(e,t,n=`svg`){var r=!e.startsWith(``),i=!!(t&1),a=`<${n}>${r?e:``+e}`,o;return()=>{if(M)return kr(N,null),N;if(!o){var e=an(Or(a));if(i)for(o=document.createDocumentFragment();an(e);)o.appendChild(an(e));else o=an(e)}var t=o.cloneNode(!0);if(i){var n=an(t),r=t.lastChild;kr(n,r)}else kr(t,t);return t}}function jr(e,t){return Ar(e,t,`svg`)}function Mr(e=``){if(!M){var t=rn(e+``);return kr(t,t),t}var n=N;return n.nodeType===3?un(n):(n.before(n=rn()),ye(n)),kr(n,n),n}function Nr(){if(M)return kr(N,null),N;var e=document.createDocumentFragment(),t=document.createComment(``),n=rn();return e.append(t,n),kr(t,n),e}function Y(e,t){if(M){var n=G;n.f&32768&&n.nodes.end!==null||(n.nodes.end=N),be()}else e!==null&&e.before(t)}function Pr(){if(M&&N&&N.nodeType===8&&N.textContent?.startsWith(`$`)){let e=N.textContent.substring(1);return be(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}function Fr(e){let t=0,n=Bt(0),r;return()=>{gn()&&(K(n),wn(()=>(t===0&&(r=fr(()=>e(()=>qt(n)))),t+=1,()=>{Ye(()=>{--t,t===0&&(r?.(),r=void 0,qt(n))})})))}}var Ir=T|E;function Lr(e,t,n,r){new Rr(e,t,n,r)}var Rr=class{parent;is_pending=!1;transform_error;#e;#t=M?N: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=Fr(()=>(this.#m=Bt(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=G;t.b=this,t.f|=128,n(e)},this.parent=G.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Tn(()=>{if(M){let e=this.#t;be();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()},Ir),M&&(this.#e=N)}#g(){try{this.#a=En(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed,{reset:n,invoke_onerror:r}=this.#v(e);Ye(r),t&&(this.#s=En(()=>{t(this.#e,()=>e,()=>n)}))}#v(e){var t=!1,n=!1;let r=()=>{t?_e():(t=!0,n&&Re(),this.#s!==null&&Nn(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){fn(e,this.#i&&this.#i.parent)}}}}#y(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=En(()=>e(this.#e)),Ye(()=>{var e=this.#c=document.createDocumentFragment(),t=rn(),n=!1;e.append(t),this.#a=this.#S(()=>{try{return En(()=>this.#r(t))}catch(e){try{this.error(e),n=!0}catch(e){fn(e,this.#i.parent)}return null}}),this.#a===null?(this.#c=null,n&&this.#x(I)):this.#u===0&&(this.#e.before(e),this.#c=null,Nn(this.#o,()=>{this.#o=null}),this.#x(I))}))}#b(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=En(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();Ln(this.#a,e);let t=this.#n.pending;this.#o=En(()=>t(this.#e))}else this.#x(I)}catch(e){this.error(e)}}#x(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){et(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=G,n=W,r=Ve;Wn(this.#i),Un(this.#i),He(this.#i.ctx);try{return kt.ensure(),e()}finally{Wn(t),Un(n),He(r)}}#C(e,t){this.has_pending_snippet()?(this.#u+=e,this.#u===0&&(this.#x(t),this.#o&&Nn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))):this.parent&&this.parent.#C(e,t)}update_pending_count(e,t){this.#C(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,Ye(()=>{this.#d=!1,this.#m&&Wt(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),K(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;I?.is_fork?(this.#a&&I.skip_effect(this.#a),this.#o&&I.skip_effect(this.#o),this.#s&&I.skip_effect(this.#s),I.oncommit(()=>{this.#w(e)})):this.#w(e)}#w(e){this.#a&&=(An(this.#a),null),this.#o&&=(An(this.#o),null),this.#s&&=(An(this.#s),null),M&&(ye(this.#t),xe(),ye(Se()));let t=this.#n.failed,n=e=>{let{reset:n,invoke_onerror:r}=this.#v(e);r(),t&&(this.#s=this.#S(()=>{try{return En(()=>{var r=G;r.b=this,r.f|=128,t(this.#e,()=>e,()=>n)})}catch(e){return fn(e,this.#i.parent),null}}))};Ye(()=>{var t;try{t=this.transform_error(e)}catch(e){fn(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(n,e=>fn(e,this.#i&&this.#i.parent)):n(t)})}};function X(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[ce]??=e.nodeValue)&&(e[ce]=n,e.nodeValue=`${n}`)}function zr(e,t){return Vr(e,t)}var Br=new Map;function Vr(e,{target:t,anchor:n,props:i={},events:a,context:o,intro:s=!0,transformError:c}){nn();var l=void 0,u=xn(()=>{var s=n??t.appendChild(rn());Lr(s,{pending:()=>{}},t=>{Ue({});var n=Ve;if(o&&(n.c=o),a&&(i.$$events=a),M&&kr(t,null),l=e(t,i)||Ge(),M&&(G.nodes.end=N,N===null||N.nodeType!==8||N.data!==`]`))throw he(),fe;We()},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=Br.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,Tr),r.delete(e),r.size===0&&Br.delete(n)):r.set(e,i)}yr.delete(d),s!==n&&s.parentNode?.removeChild(s)}});return Hr.set(l,u),l}var Hr=new WeakMap,Ur=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)Fn(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(Fn(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&&(An(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();Ln(r,t),t.append(rn()),this.#n.set(e,{effect:r,fragment:t})}else An(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Nn(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)||(An(n.effect),this.#n.delete(e))};ensure(e,t){var n=I,r=cn();if(t&&!this.#t.has(e)&&!this.#n.has(e)){if(r){var i=document.createDocumentFragment(),a=rn();i.append(a),this.#n.set(e,{effect:En(()=>t(a)),fragment:i})}else this.#t.set(e,En(()=>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 M&&(this.anchor=N),this.#a(n)}};function Z(e,t,n=!1){var r;M&&(r=N,be());var i=new Ur(e),a=n?T:0;function o(e,t){if(M){var n=Ce(r);if(e!==parseInt(n.substring(1))){var a=Se();ye(a),i.anchor=a,ve(!1),i.ensure(e,t),ve(!0);return}}i.ensure(e,t)}Tn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var Wr=Symbol(`NaN`);function Gr(e,t,n){M&&be();var r=new Ur(e),i=!Ke();Tn(()=>{var e=t();e!==e&&(e=Wr),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function Kr(e,t){return t}function qr(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;Jr(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;sn(d),d.append(u),e.items.clear()}Jr(e,t,!l)}else o={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(o)}function Jr(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^=ee,ei(d,null,c)):Fn(d):Nn(d,()=>{d=null})))}function _(e){v.pending.delete(e)}var v={effect:Tn(()=>{p=K(f);var e=p.length;let t=!1;M&&Ce(c)===`[!`!=(e===0)&&(c=Se(),ye(c),ve(!1),t=!0);for(var r=new Set,u=I,v=cn(),y=0;ys(c)):(d=En(()=>s(Yr??=rn())),d.f|=ee)),e>r.size&&ke(``,``,``),M&&e>0&&ye(Se()),!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&&ve(!0),K(f)}),flags:n,items:l,pending:m,outrogroups:null,fallback:d};h=!1,M&&(c=N)}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?Bt(n):Vt(n,!1,!1):null,l=o&2?Bt(i):null;return{v:c,i:l,e:En(()=>(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=on(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;M&&(r=N,be());var i=new Ur(e);Tn(()=>{var e=t()??null;if(M&&Ce(r)===`[`!=(e!==null)){var a=Se();ye(a),i.anchor=a,ve(!1),i.ensure(e,e&&(t=>n(t,e))),ve(!0)}else 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`]}),_n(()=>{t.disconnect()})}function hi(e,t,n=t){var r=new WeakSet,i=!0;at(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,I!==null&&r.add(I)}),Sn(()=>{var a=t();if(e===document.activeElement){var o=I;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=de?`link`:`LINK`;function xi(e){if(M){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[le]=n,Ye(n),rt()}}function Si(e,t){var n=Ci(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function Q(e,t,n,r){var i=Ci(e);M&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===bi)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[ae]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&Ti(e).has(t)?e[t]=n:e.setAttribute(t,n))}function Ci(e){return e[oe]??={[vi]:e.nodeName.includes(`-`),[yi]:e.namespaceURI===pe}}var wi=new Map;function Ti(e){var t=e.getAttribute(`is`)||e.nodeName,n=wi.get(t);if(n)return n;wi.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 Ei(e,t,n=t){var r=new WeakSet;at(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=ji(e)?Mi(a):a,n(a),I!==null&&r.add(I),await lr(),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))}}}),(M&&e.defaultValue!==e.value||fr(t)==null&&e.value)&&(n(ji(e)?Mi(e.value):e.value),I!==null&&r.add(I)),wn(()=>{var n=t();if(e===document.activeElement){var i=I;if(r.has(i))return}ji(e)&&n===Mi(e.value)||(e.type!==`date`||n||e.value)&&n!==e.value&&(e.value=n??``)})}var Di=new Set;function Oi(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),at(n,`change`,()=>{var e=n.__value;a&&(e=Ai(o,e,n.checked)),i(e)},()=>i(a?[]:null)),wn(()=>{var e=r();M&&n.defaultChecked!==n.checked?s=!0:a?(e||=[],n.checked=e.includes(n.__value)):n.checked=Zt(n.__value,e)}),_n(()=>{var e=o.indexOf(n);e!==-1&&o.splice(e,1)}),Di.has(o)||(Di.add(o),Ye(()=>{o.sort((e,t)=>e.compareDocumentPosition(t)===4?-1:1),Di.delete(o)})),Ye(()=>{if(s){var e=a?Ai(o,e,n.checked):o.find(e=>e.checked)?.__value;i(e)}})}function ki(e,t,n=t){at(e,`change`,t=>{n(t?e.defaultChecked:e.checked)}),(M&&e.defaultChecked!==e.checked||fr(t)==null)&&n(e.checked),wn(()=>{e.checked=!!t()})}function Ai(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 Pi(e,t,n){var r=Ni.observe(e,()=>n(e[t]));Sn(()=>(fr(()=>n(e[t])),r))}function Fi(e,t){return e===t||e?.[k]===t}function Ii(e=Ge(),t,n,r){var i=Ve.r,a=G;return Sn(()=>{var o,s;return wn(()=>{o=s,s=r?.()||[],fr(()=>{Fi(n(...s),e)||(t(e,...s),o&&Fi(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&&Fi(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Li(e,t,n,r,i){var a=()=>{r(n[e])};n.addEventListener(t,a),i?wn(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&_n(()=>{n.removeEventListener(t,a)})}function Ri(e=!1){let t=Ve,n=t.l.u;if(!n)return;let r=()=>pr(t.s);if(e){let e=0,n={},i=ut(()=>{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=()=>K(i)}n.b.length&&bn(()=>{zi(t,r),m(n.b)}),vn(()=>{let e=fr(()=>n.m.map(p));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&vn(()=>{zi(t,r),m(n.a)})}function zi(e,t){if(e.l.s)for(let t of e.l.s)K(t);t()}var Bi=!1;function Vi(e){var t=Bi;try{return Bi=!1,[e(),Bi]}finally{Bi=t}}var Hi={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===k||t===ie)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 Ui(...e){return new Proxy({props:e},Hi)}function Wi(e,t,n,r){var i=!ze||!!(n&2),o=!!(n&8),s=!!(n&16),c=r,l=!0,u=void 0,d=()=>s&&i?(u??=ut(r),K(u)):(l&&(l=!1,c=s?fr(r):r),c);let f;if(o){var p=k in e||ie in e;f=a(e,t)?.set??(p&&t in e?n=>e[t]=n:void 0)}var m,h=!1;o?[m,h]=Vi(()=>e[t]):m=e[t],m===void 0&&r!==void 0&&(m=d(),f&&(i&&Pe(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?ut:pt)(()=>(v=!1,g()));o&&K(y);var b=G;return(function(e,t){if(arguments.length>0){let n=t?K(y):i&&o?Yt(e):e;return R(y,n),v=!0,c!==void 0&&(c=n),e}return Bn&&v||b.f&16384?y.v:K(y)})}function Gi(e){Ve===null&&De(`onMount`),ze&&Ve.l!==null?qi(Ve).m.push(e):vn(()=>{let t=fr(e);if(typeof t==`function`)return t})}function Ki(e){Ve===null&&De(`onDestroy`),Gi(()=>()=>fr(e))}function qi(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);function Ji(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 Yi=new class{#e=L(Xi());get _loc(){return K(this.#e)}set _loc(e){R(this.#e,e)}#t=F(()=>this._loc.location);get _location(){return K(this.#t)}set _location(e){R(this.#t,e)}#n=F(()=>this._loc.querystring);get _querystring(){return K(this.#n)}set _querystring(e){R(this.#n,e)}#r=L(void 0);get _params(){return K(this.#r)}set _params(e){R(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=Xi()}):console.warn(`[svelte-spa-router] window 'window' is not defined, skipping initiation`)}};function Xi(){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}}async function Zi(e){if(!e||e.length<1||e.charAt(0)!=`/`&&e.indexOf(`#/`)!==0)throw Error(`Invalid parameter location`);await lr();let t=(e.charAt(0)==`#`?``:`#`)+e;try{let e={...history.state};delete e.__svelte_spa_router_scrollX,delete e.__svelte_spa_router_scrollY,window.history.replaceState(e,``,t)}catch{console.warn("Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.")}window.dispatchEvent(new Event(`hashchange`))}function Qi(e){e?window.scrollTo(e.__svelte_spa_router_scrollX||0,e.__svelte_spa_router_scrollY||0):window.scrollTo(0,0)}function $i(e,t){Ue(t,!0);let n=Wi(t,`routes`,19,()=>({})),r=Wi(t,`prefix`,3,``),i=Wi(t,`restoreScrollState`,3,!1),a=Wi(t,`onConditionsFailed`,3,()=>{}),o=Wi(t,`onRouteLoaded`,3,()=>{}),s=Wi(t,`onRouteLoading`,3,()=>{}),c=Wi(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=Ji(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=L(null),f=L(null),p=L({}),m=null,h=null;vn(()=>{history.scrollRestoration=i()?`manual`:`auto`}),vn(()=>{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 lr(),e(t)}vn(()=>{let e=Yi.loc,t=!1;return fr(async()=>{let n=0;for(;n{t=!0}});function _(e){return e&&typeof e==`object`&&Object.keys(e).length?e:null}var v=Nr(),y=B(v),b=e=>{let t=F(()=>K(d));var n=Nr(),r=B(n),i=e=>{var n=Nr();ni(B(n),()=>K(t),(e,t)=>{t(e,Ui({get params(){return K(f)},get onRouteEvent(){return c()}},()=>K(p)))}),Y(e,n)},a=e=>{var n=Nr();ni(B(n),()=>K(t),(e,t)=>{t(e,Ui({get onRouteEvent(){return c()}},()=>K(p)))}),Y(e,n)};Z(r,e=>{K(f)?e(i):e(a,-1)}),Y(e,n)};Z(y,e=>{K(d)&&e(b)}),Y(e,v),We()}var ea=[`bars`,`pace`,`pie`,`fuel`,`resets`,`thresholds`];function ta(e){return e===`zone`||e===`consumption-pace`?`pace`:typeof e==`string`&&ea.includes(e)?e:`bars`}var na=`codexometer.web.preferences.v1`,ra={statusLine:null,tab:`quota`,view:`bars`,selected:``,defaultDetail:0,layouts:[]};function ia(){try{let e=JSON.parse(localStorage.getItem(na)||`null`);return!e||typeof e!=`object`?ra:{statusLine:Array.isArray(e.statusLine)?[...new Set(e.statusLine.filter(e=>typeof e==`string`&&e.length<64))].slice(0,32):null,tab:[`quota`,`sessions`,`usage`].includes(e.tab)?e.tab:`quota`,view:ta(e.view),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 ra}}var aa=Yt(ia()),oa=Yt({open:!1}),sa=Yt({requests:0});function ca(){let e=JSON.stringify(aa);try{localStorage.setItem(na,e)}catch{}}function la(){return aa.tab===`quota`?`/quota/`+aa.view:`/`+aa.tab}function ua(e){return aa.layouts.find(t=>t.id===e)?.level??aa.defaultDetail}function da(e){aa.defaultDetail=e,aa.layouts=[]}function fa(e,t){aa.layouts=[...aa.layouts.filter(t=>t.id!==e),{id:e,level:Math.max(0,Math.min(2,t))}].slice(-100)}var $=Yt({data:null,connected:!1,error:``}),pa=e=>e==null?`Unavailable`:e.toLocaleString(`en-GB`),ma=e=>!e||String(e).startsWith(`0001-`)?`Not yet available`:new Date(typeof e==`number`?e*1e3:e).toLocaleString(`en-GB`),ha=`codexometer.web.session`,ga=class extends Error{},_a;async function va(e,t,n){if(!_a||!$.connected||!$.data?.control||$.data.sessionsError)throw Error(`Session controls unavailable. Check the live connection.`);return await _a(e,t,n)}function ya(){let e=new AbortController,t,n=``;_a=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 ga(`Action rejected, expired or changed. Refresh and check Codex; nothing was retried.`);return a.json()};try{n=sessionStorage.getItem(ha)||``}catch{}let r=location.hash,i=r.startsWith(`#pair=`)?r.slice(6):``;(i||!r||r===`#`)&&(history.replaceState(null,``,`/#`+la()),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(ha,n)}catch{}}catch(t){e.signal.aborted||($.error=t instanceof Error?t.message:`Pairing failed`);return}n?await o():$.error=`Open the private pairing link printed by codexometer --web in your terminal.`}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(ha)}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(),()=>{_a=void 0,e.abort(),clearTimeout(t),$.connected=!1}}Be();var ba=J(`

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

      `),xa=J(`

      `),Sa=J(`

      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),Ca=J(`

      No threshold-based model steps were configured at launch.

      `);function wa(e,t){Ue(t,!1),Ri();var n=Nr(),r=B(n),i=e=>{var t=Sa(),n=B(t),r=V(n),i=H(n,2),a=e=>{Y(e,ba())};Z(i,e=>{$.data.quotaError&&e(a)});var o=H(i,2),s=z(o),c=V(s),l=H(s,4);Xr(l,5,()=>$.data.thresholds,Kr,(e,t)=>{var n=xa();let r;var i=z(n),a=V(i),o=H(i,2),s=z(o),c=V(s,!0),l=V(H(s,2));P(o);var u=H(o,2),d=V(u,!0),f=V(H(u,2));P(n),U((e,i)=>{r=ci(n,1,``,null,r,{active:K(t).state===`ACTIVE`,next:K(t).state===`NEXT`}),X(a,`${K(t).threshold??``}%`),X(c,K(t).model),X(l,`${e??``} REASONING // ${i??``} + SPEED`),X(d,K(t).mode),X(f,`${K(t).state??``}${K(t).state===`NEXT`?` // ${K(t).remaining||0} PP TO GO`:``}`)},[()=>K(t).effort.toUpperCase(),()=>K(t).speed.toUpperCase()]),Y(e,n)}),P(l),P(o),U(e=>{X(r,`MODEL STEP POLICY // OBSERVED ${e??``}`),X(c,`THRESHOLDS // ${$.data.thresholds.length??``} CONFIGURED`)},[()=>ma($.data.quotaAt)]),Y(e,t)},a=e=>{Y(e,Ca())};Z(r,e=>{$.data?.thresholds?.length?e(i):e(a,-1)}),Y(e,n),We()}var Ta=jr(` `,1),Ea=jr(` `,1),Da=jr(` `,1),Oa=jr(` `,1),ka=J(`
      `,1),Aa=J(` `),ja=J(`
      Quota observations
      Observed atPeriod elapsedConsumedTrail segment
      `),Ma=J(`
      OBSERVATION DATA
      `),Na=J(`
      CONSUMPTIONQUOTA PERIOD ELAPSED
      `,1);function Pa(e,t){let n=Pr();Ue(t,!0);let r=Wi(t,`trail`,19,()=>[]),i=L(!1),a=L(!0),o=L(`window`),s=[0,25,50,75,100],c={off:0,halfHour:30,hour:60,day:1440,window:0},l=L(400),u=L(240),d=F(()=>K(l)-24),f=F(()=>K(u)-48),p=F(()=>Math.max(1,K(d)-48)),m=F(()=>Math.max(1,K(f)-20)),h=F(()=>48+Math.max(0,Math.min(100,t.elapsed))/100*K(p));function g(e){return K(f)-(e-0)/100*K(m)}let _=F(()=>g(t.used)),v=F(()=>t.used-t.elapsed),y=F(()=>r().map((e,t)=>`${t===0||e.break?`M`:`L`}${48+e.elapsed/100*K(p)} ${g(e.used)}`).join(` `)),b=F(()=>{let e=0;for(let t=r().length-1;t>0;t--)if(r()[t].break){e=t;break}return r().slice(e)}),x=F(()=>K(b).length<2?0:Math.max(0,Date.parse(K(b).at(-1).at)-Date.parse(K(b)[0].at)));function S(e){if(K(x)Date.parse(e.at)>=t).length>=2}let C=F(()=>({off:!0,halfHour:S(18e5),hour:S(36e5),day:S(864e5),window:Number.isFinite(t.elapsed)&&t.elapsed>0&&Number.isFinite(t.used)}));vn(()=>{K(o)!==`window`&&!K(C)[K(o)]&&R(o,`window`)});function w(e){if(e===`off`||!K(C)[e])return[];let t=c[e]*6e4,n=Date.parse(K(b).at(-1).at)-t,r=K(b).findIndex(e=>Date.parse(e.at)>=n);return r<0?[]:K(b).slice(r)}function T(e){if(e.length<2)return null;let t=e.reduce((e,t)=>e+t.elapsed,0)/e.length,n=e.reduce((e,t)=>e+t.used,0)/e.length,r=0,i=0;for(let a of e)r+=(a.elapsed-t)*(a.used-n),i+=(a.elapsed-t)**2;return i>0?Math.max(0,r/i):null}let E=F(()=>{let e=K(o)===`window`&&K(C).window?t.used/t.elapsed:T(w(K(o)));if(e===null||!t.duration)return null;let n=t.used+e*(100-t.elapsed),r=K(o)===`window`?0:t.used-e*t.elapsed,i=e,a=Math.max(0,t.elapsed-c[K(o)]/t.duration*100);K(o)===`window`&&(a=0);let s=100;if(i!==0){let e=(0-r)/i,t=(100-r)/i;a=Math.max(a,Math.min(e,t)),s=Math.min(100,Math.max(e,t))}if(a>s)return null;let l=r+i*a,u=r+i*s,d=Math.hypot((s-a)/100*K(p),(u-l)/100*K(m)),f=Math.max(3,Math.min(9,Math.floor(d/65)+2));return{path:`M${Array.from({length:f},(e,t)=>{let n=a+(s-a)*t/(f-1),r=l+(u-l)*t/(f-1);return`${48+n/100*K(p)} ${g(r)}`}).join(` L`)}`,projected:n,safe:n<=100}}),D=F(()=>{if(K(b).length===0)return`NO OBSERVATIONS`;if(K(b).length===1)return`ONE OBSERVATION`;let e=Math.floor(K(x)/6e4);if(e<60)return`${e} MIN CONTINUOUS`;let t=Math.floor(e/60);return t<24?`${t}H CONTINUOUS`:`${Math.floor(t/24)}D ${t%24}H CONTINUOUS`});var ee=Na(),te=B(ee),O=z(te);let ne;var k=z(O),re=z(k),ie=H(re);P(k);var ae=H(k),oe=H(ae);Xr(oe,17,()=>s,Kr,(e,t)=>{var n=Ta(),r=B(n),i=H(r),a=V(i);U(()=>{Q(r,`x1`,48+K(t)/100*K(p)),Q(r,`x2`,48+K(t)/100*K(p)),Q(r,`y2`,K(f)),Q(i,`x`,48+K(t)/100*K(p)),Q(i,`y`,K(f)+20),X(a,`${K(t)??``}%`)}),Y(e,n)});var se=H(oe);Xr(se,17,()=>s,Kr,(e,t)=>{var n=Ea(),r=B(n),i=H(r),a=V(i);U((e,n,o)=>{Q(r,`y1`,e),Q(r,`x2`,K(d)),Q(r,`y2`,n),Q(i,`y`,o),X(a,`${K(t)??``}%`)},[()=>g(K(t)),()=>g(K(t)),()=>g(K(t))+4]),Y(e,n)});var A=H(se),ce=H(A),le=H(ce),ue=e=>{var t=Da(),n=B(t),i=H(n),a=H(i),o=V(z(a));P(a),U((e,t)=>{Q(n,`d`,K(y)),Q(i,`d`,K(y)),Q(a,`cx`,48+r()[0].elapsed/100*K(p)),Q(a,`cy`,e),X(o,`First observation: ${t??``}`)},[()=>g(r()[0].used),()=>ma(r()[0].at)]),Y(e,t)};Z(le,e=>{K(a)&&r().length&&e(ue)});var de=H(le),fe=e=>{var t=Oa(),r=B(t),i=H(r),a=V(z(i));P(i),U(e=>{Q(r,`d`,K(E).path),Q(i,`d`,K(E).path),Q(i,`marker-mid`,`url(#${n}-trend-arrow)`),X(a,`${K(o)===`window`?`Window-average pace`:`Recent consumption trajectory`} projects ${e??``}% at reset if continued`)},[()=>K(E).projected.toFixed(1)]),Y(e,t)};Z(de,e=>{K(E)&&e(fe)});var j=H(de,2),pe=H(j),me=H(pe),he=V(z(me));P(me),P(O),P(te);var ge=H(te,2),_e=z(ge),M=z(_e),ve=H(M,3),N=V(ve,!0),ye=H(ve,2),be=e=>{var t=ka(),n=V(H(B(t)));U(e=>X(n,`TREND // ${e??``}`),[()=>K(E).projected>=100?`QUOTA EXHAUSTION PROJECTED`:`${K(E).projected.toFixed(1)}% PROJECTED AT RESET`]),Y(e,t)};Z(ye,e=>{K(E)&&e(be)}),P(_e);var Se=H(_e,2),Ce=z(Se),we=z(Ce);xi(we),xe(),P(Ce);var Te=H(Ce,2),Ee=H(z(Te),2),De=z(Ee);De.value=De.__value=`off`;var Oe=H(De),ke=V(Oe);Oe.value=Oe.__value=`halfHour`;var Ae=H(Oe),je=V(Ae);Ae.value=Ae.__value=`hour`;var Me=H(Ae),Ne=V(Me);Me.value=Me.__value=`day`;var Pe=H(Me),Fe=V(Pe);Pe.value=Pe.__value=`window`,P(Ee),mi(Ee),P(Te);var Ie=V(H(Te,2));P(Se),P(ge);var Le=H(ge,2),Re=e=>{var t=Ma(),n=H(z(t),2),a=e=>{var t=ja(),n=z(t),i=H(z(n),2);Xr(i,21,r,Kr,(e,t,n)=>{var r=Aa(),i=z(r),a=z(i),o=V(a,!0);P(i);var s=H(i),c=V(s),l=H(s),u=V(l),d=V(H(l),!0);P(r),U((e,r)=>{Q(a,`datetime`,K(t).at),X(o,e),X(c,`${r??``}%`),X(u,`${K(t).used??``}%`),X(d,n===0?`First observation`:K(t).break?`Gap before this observation`:`Connected to previous observation`)},[()=>ma(K(t).at),()=>K(t).elapsed.toFixed(1)]),Y(e,r)}),P(i),P(n),P(t),Y(e,t)};Z(n,e=>{K(i)&&e(a)}),P(t),Li(`open`,`toggle`,t,e=>R(i,e),()=>K(i)),Y(e,t)};Z(Le,e=>{r().length&&e(Re)}),U((e,r,i,a,o,s)=>{Q(O,`viewBox`,`0 0 ${K(l)} ${K(u)}`),Q(O,`aria-label`,e),ne=ui(O,``,ne,{"--trend-color":K(E)?.safe?`#115b35`:`#7f1825`}),Q(re,`id`,n),Q(ie,`id`,n+`-trend-arrow`),Q(ae,`width`,K(p)),Q(ae,`height`,K(m)),Q(ae,`fill`,`url(#${n})`),Q(A,`d`,`M48 20 V${K(f)} H${K(d)}`),Q(ce,`y1`,r),Q(ce,`x2`,K(d)),Q(ce,`y2`,i),Q(j,`x`,48+K(p)/2),Q(j,`y`,K(u)-5),Q(pe,`cx`,K(h)),Q(pe,`cy`,K(_)),Q(me,`cx`,K(h)),Q(me,`cy`,K(_)),X(he,`${t.used??``}% consumed // ${a??``}% of period elapsed`),X(M,`${t.used??``}% USED // ${o??``}% TIME ELAPSED`),X(N,s),Oe.disabled=!K(C).halfHour,X(ke,`LAST 30 MINUTES${K(C).halfHour?``:` — UNAVAILABLE`}`),Ae.disabled=!K(C).hour,X(je,`LAST HOUR${K(C).hour?``:` — UNAVAILABLE`}`),Me.disabled=!K(C).day,X(Ne,`LAST 24 HOURS${K(C).day?``:` — UNAVAILABLE`}`),Pe.disabled=!K(C).window,X(Fe,`FROM WINDOW START${K(C).window?``:` — NO TIME ELAPSED`}`),X(Ie,`HISTORY // ${K(D)??``}`)},[()=>`Pace: ${t.used}% consumed, ${t.elapsed.toFixed(1)}% of quota period elapsed. ${K(v)>0?`Above`:K(v)<0?`Below`:`On`} the steady-consumption line.${K(a)&&r().length?` Trace path contains ${r().length} ${r().length===1?`observation`:`observations`}; gaps are not interpolated.`:``}`,()=>g(0),()=>g(100),()=>t.elapsed.toFixed(1),()=>t.elapsed.toFixed(1),()=>Math.abs(K(v))<.05?`ON PACE`:K(v)>0?`ABOVE THE LINE — CONSUMING FASTER THAN TIME`:`BELOW THE LINE — WITHIN PACE`]),Pi(te,`clientWidth`,e=>R(l,e)),Pi(te,`clientHeight`,e=>R(u,e)),ki(we,()=>K(a),e=>R(a,e)),hi(Ee,()=>K(o),e=>R(o,e)),Y(e,ee),We()}var Fa=J(` `),Ia=J(`

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

      `),La=J(`

      `),Ra=J(`

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

      `),za=J(`

      `),Ba=J(`

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

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

      `),Va=J(` `,1),Ha=jr(``),Ua=jr(``),Wa=J(`
      `),Ga=J(`

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

      `),Ka=J(`
      EMPTYFULL
      `),qa=J(`

      `,1),Ja=J(`
      `,1),Ya=J(`

      `),Xa=J(`

      `),Za=J(`

      No quota windows reported yet.

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

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

      `,1),eo=J(` `,1);function to(e,t){Ue(t,!0);let n=Wi(t,`params`,19,()=>({})),r=F(()=>ea.filter(e=>e!==`thresholds`||!!$.data?.thresholds?.length)),i=L(Yt(Date.now())),a=F(()=>K(r).includes(ta(n().view))?ta(n().view):`bars`);Gi(()=>{let e=setInterval(()=>R(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-K(i))/(e.duration*6e4))))}vn(()=>{aa.view=K(a),(n().view===`zone`||n().view===`consumption-pace`)&&Zi(`/quota/pace`)});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=eo(),l=B(c);Xr(l,21,()=>K(r),Kr,(e,t)=>{var n=Fa();let r;var i=V(n,!0);U(e=>{Q(n,`href`,`#/quota/`+K(t)),Q(n,`aria-current`,K(a)===K(t)?`page`:void 0),r=ci(n,1,``,null,r,{active:K(a)===K(t)}),X(i,e)},[()=>K(t)===`fuel`?`FUEL TANK`:K(t).toUpperCase()]),Y(e,n)}),P(l);var u=H(l,2),d=e=>{var t=$a(),n=B(t),r=e=>{Y(e,Ia())};Z(n,e=>{$.data.quotaError&&e(r)});var i=H(n,2),c=e=>{var t=La(),n=V(t);U(()=>X(n,`Last usage accounting issue: + ${$.data.usageDiagnostic??``}`)),Y(e,t)};Z(i,e=>{$.data.usageDiagnostic&&e(c)});var l=H(i,2),u=V(l),d=H(l,2),f=e=>{wa(e,{})},p=e=>{var t=Ba(),n=z(t),r=V(n),i=H(n,4),a=e=>{Y(e,Ra())};Z(i,e=>{$.data.credits.length||e(a)}),Xr(H(i,2),17,()=>$.data.credits,Kr,(e,t)=>{var n=za(),r=z(n),i=V(r),a=V(H(r,2),!0);P(n),U(e=>{X(i,`${(K(t).title||`Quota reset`)??``} // ${K(t).status??``}`),X(a,e)},[()=>K(t).expiryKnown?K(t).expires?`EXPIRES `+ma(K(t).expires):`Does not expire`:`Expiry information unavailable`]),Y(e,n)}),xe(2),P(t),U(()=>X(r,`RESET INVENTORY // ${$.data.creditCount??``} AVAILABLE`)),Y(e,t)},m=e=>{var t=Qa(),n=B(t);let r;Xr(n,21,()=>$.data.meters,Kr,(e,t)=>{let n=F(()=>o(K(t)));var r=Xa(),i=z(r),c=V(i,!0),l=H(i,2),u=z(l),d=e=>{var n=Va(),r=B(n),i=V(r),a=V(H(r));U(()=>{X(i,`FREE ${100-K(t).used}%`),X(a,`USED ${K(t).used??``}%`)}),Y(e,n)},f=e=>{var n=Va(),r=B(n),i=V(r),a=V(H(r));U(()=>{X(i,`USED ${K(t).used??``}%`),X(a,`FREE ${100-K(t).used}%`)}),Y(e,n)};Z(u,e=>{K(a)===`fuel`?e(d):e(f,-1)}),P(l);var p=H(l,2);let m;var h=z(p),g=e=>{var n=Wa(),r=z(n),i=H(z(r)),a=e=>{Y(e,Ha())},o=e=>{var n=Ua();U(e=>Q(n,`d`,e),[()=>s(K(t).used)]),Y(e,n)};Z(i,e=>{K(t).used>=100?e(a):K(t).used>0&&e(o,1)}),P(r),P(n),U(()=>Q(r,`aria-label`,`${K(t).used}% quota used`)),Y(e,n)},_=e=>{var r=Nr(),i=B(r),a=e=>{{let r=F(()=>K(t).trail||[]);Pa(e,{get used(){return K(t).used},get elapsed(){return K(n)},get trail(){return K(r)},get duration(){return K(t).duration}})}},o=e=>{Y(e,Ga())};Z(i,e=>{K(n)===null?e(o,-1):e(a)}),Y(e,r)},v=e=>{var r=Ja(),i=B(r),o=z(i);let s;P(i);var c=H(i,2),l=e=>{Y(e,Ka())};Z(c,e=>{K(a)===`fuel`&&e(l)});var u=H(c,2),d=e=>{var t=qa(),r=B(t),i=V(r),o=H(r,2),s=z(o);let c;P(o),U(e=>{X(i,`RESET CYCLE // ${e??``}% ELAPSED`),c=ui(s,``,c,{width:`${K(a)===`fuel`?100-K(n):K(n)}%`})},[()=>Math.floor(K(n))]),Y(e,t)};Z(u,e=>{K(n)!==null&&e(d)}),U(()=>{Q(i,`aria-label`,K(a)===`fuel`?`Fuel remaining`:`Quota used`),Q(i,`aria-valuenow`,K(a)===`fuel`?100-K(t).used:K(t).used),s=ui(o,``,s,{width:`${K(a)===`fuel`?100-K(t).used:K(t).used}%`})}),Y(e,r)};Z(h,e=>{K(a)===`pie`?e(g):K(a)===`pace`?e(_,1):e(v,-1)}),P(p);var y=H(p,2),b=V(y),x=H(y,2),S=e=>{var n=Ya(),r=V(n,!0);U(()=>X(r,K(t).details)),Y(e,n)};Z(x,e=>{K(t).details&&e(S)}),P(r),U(e=>{X(c,K(t).name),m=ci(p,1,`meter-graphic`,null,m,{"bar-graphic":K(a)===`bars`||K(a)===`fuel`}),X(b,`RESETS // ${e??``}`)},[()=>ma(K(t).reset)]),Y(e,r)}),P(n);var i=H(n,2),c=e=>{Y(e,Za())};Z(i,e=>{$.data.meters.length||e(c)}),U(()=>r=ci(n,1,`quota-grid`,null,r,{radial:K(a)===`pie`,zone:K(a)===`pace`})),Y(e,t)};Z(d,e=>{K(a)===`thresholds`?e(f):K(a)===`resets`?e(p,1):e(m,-1)}),xe(2),U(e=>X(u,`QUOTA // OBSERVED ${e??``}`),[()=>ma($.data.quotaAt)]),Y(e,t)};Z(u,e=>{$.data&&e(d)}),Y(e,c),We()}var no=J(`
      `),ro=J(`

      `,1);function io(e,t){Ue(t,!0);let n=Wi(t,`values`,19,()=>[]),r=Wi(t,`label`,3,`Token activity`),i=Wi(t,`capacity`,3,0),a=F(()=>Math.max(0,...n())),o=F(()=>i()>n().length?[...Array(i()-n().length).fill(0),...n()]:n());var s=ro(),c=B(s),l=V(c),u=H(c,2);Xr(u,21,()=>K(o),Kr,(e,t)=>{var n=no();let r;U((e,t)=>{Q(n,`title`,e),r=ui(n,``,r,{height:t})},[()=>K(t).toLocaleString(`en-GB`)+` tokens`,()=>`${100*K(t)/Math.max(1,K(a))}%`]),Y(e,n)}),P(u),U((e,t)=>{X(l,`SCALE // 0 — ${e??``} TOKENS`),Q(u,`aria-label`,t)},[()=>K(a).toLocaleString(`en-GB`),()=>`${r()}. Peak ${K(a).toLocaleString(`en-GB`)} tokens.`]),Y(e,s),We()}function ao(e){if(!e||![`LAST REPLY`,`LAST ACTIVITY`].includes(e.contextKind))return``;let t=e.text||e.contextKind===`LAST ACTIVITY`&&e.workingCommand||``;return t.trim()?t:``}var oo=J(` `),so=J(``),co=J(`

      `),lo=J(`

      `,1),uo=J(`

      `),fo=J(`

      Loading / sending…

      `),po=J(`
      `),mo=J(`

      `),ho=J(`

       
      `),go=J(`
      `),_o=J(`
      `),vo=J(`

      Review expired. Press Enter to review again.

      `),yo=J(`

      `,1),bo=J(`

      `,1),xo=J(`

      No available matching commands.

      `),So=J(` `,1),Co=J(`

      `),wo=J(`

      Review expired. Review the option again.

      `),To=J(``),Eo=J(``),Do=J(``),Oo=J(``),ko=J(``),Ao=J(``),jo=J(``),Mo=J(`
      `),No=J(`
      `);function Po(e,t){let n=Pr();Ue(t,!0);let r=e=>{var t=Nr();Xr(B(t),19,()=>K(fe),e=>e.id,(e,t,r)=>{var i=so();let o;var s=z(i),c=V(s,!0),l=H(s),u=V(l),d=H(l),f=e=>{var n=oo(),r=V(n,!0);U(()=>X(r,K(t).help)),Y(e,n)};Z(d,e=>{(K(v)?.path===``||K(A))&&e(f)}),P(i),U((e,s)=>{Q(i,`id`,`${n}-${K(r)}`),Q(i,`role`,K(A)?`option`:void 0),Q(i,`aria-selected`,K(A)?K(T)===K(r):void 0),Q(i,`tabindex`,K(A)?-1:void 0),i.disabled=K(g)||K(he)&&!a(),Q(i,`title`,K(t).help),Q(i,`aria-label`,e),o=ci(i,1,`svelte-7bfwr9`,null,o,{suggested:K(T)===K(r)}),X(c,K(t).label),X(u,`${K(A)&&K(t).selected?` // CURRENT`:``}${s??``}`)},[()=>K(t).label+(K(A)&&K(t).selected?` // CURRENT`:``)+ie(K(t)),()=>ie(K(t))]),xr(`focus`,i,()=>{K(A)||_e(K(r))}),q(`click`,i,()=>{_e(K(r)),ye(K(t))}),Y(e,i)}),Y(e,t)},i=Wi(t,`query`,3,``),a=Wi(t,`localOnly`,3,!1),o=Wi(t,`oncopy`,3,()=>{}),s=Wi(t,`onchange`,3,()=>{}),c=Wi(t,`oncomplete`,3,e=>{}),l=[`statusline`,`usage`,`copy`,`theme`,`exit`,`quit`];function u(){return[{id:`local-statusline`,label:`/statusline`,help:`Choose fields for Codexometer’s detail footer.`,next:`statusline`},{id:`local-usage`,label:`/usage`,help:`Open Codexometer’s usage history. Quota and reset views remain available.`,next:`usage`},{id:`local-copy`,label:`/copy`,help:`Copy the selected session’s observed reply or activity with its Copy control.`,next:`copy`},{id:`local-theme`,label:`/theme`,help:`Open the existing Codexometer theme selector. Saved browser display preferences only.`,next:`theme`},{id:`local-exit`,label:`/exit`,help:`Leave session detail and return to Sessions. The local server remains running.`,next:`exit`},{id:`local-quit`,label:`/quit`,help:`Alias for /exit: return to Sessions. The local server remains running.`,next:`quit`}]}function d(){return{title:`/ COMMANDS`,help:`Local Codexometer commands remain available without session control.`,path:``,revision:``,choices:u()}}function f(){R(b,``),R(O,``),R(x,0),R(ne,[],!0)}function p(){w++,R(g,!1),R(h,!1),R(E,i()),f(),R(_,``),K(ue)?s()():c()(i())}async function m(e){if(!l.includes(e))return!1;if(e===`copy`&&!ao($.data?.sessions.find(e=>e.id===t.session)))return R(_,`No reply or activity text is available to copy for this session.`),!0;if(e===`copy`){let e=o()();p(),await e}else p(),e===`usage`?location.hash=`/usage`:e===`theme`?sa.requests++:e===`statusline`?oa.open=!0:location.hash=`/sessions`;return!0}let h=L(!1),g=L(!1),_=L(``),v=L(null),y=L(null),b=L(``),x=L(0),S=L(Yt(Date.now())),C=L(``),w=0,T=L(0),E=L(null),D=L(void 0),ee=L(void 0),te=L(void 0),O=L(``),ne=L(Yt([])),k=F(()=>K(v)?.path.startsWith(`rename/`)||K(v)?.path.startsWith(`cd/`)),re=F(()=>!!K(y)&&!K(k)||!!K(O)||K(ne).length>0);function ie(e){return e.unavailable?e.unavailable.startsWith(`Waiting for idle.`)?` // WAITING FOR IDLE`:` // UNAVAILABLE`:e.next?` →`:e.action?``:` // HELP`}async function ae(e){K(v)&&!(K(ge)&&K(de))&&R(ne,[...K(ne),{path:K(v).path,index:K(T),input:K(C)}],!0),await N(e)}async function oe(){if(!K(re))return;if(w++,R(g,!1),R(b,``),R(x,0),R(_,``),K(O)){R(O,``),K(D)?.focus();return}if(K(y)&&!K(k)){R(y,null),await lr(),K(D)?.focus();return}let e=K(ne).at(-1);e&&(R(ne,K(ne).slice(0,-1),!0),await N(e.path,e))}function se(){K(v)&&K(C).trim()&&!K(g)&&!K(he)&&ae(K(v).path+`/`+encodeURIComponent(K(C).trim()))}let A=F(()=>K(h)&&!!K(v)?.picker&&!K(y)),ce=F(()=>K(h)&&!K(v)?.input&&!K(y)),le=setInterval(()=>{R(S,Date.now(),!0)},1e3);Ki(()=>{clearInterval(le),w++});let ue=F(()=>i().trim().startsWith(`/`)&&!i().trim().startsWith(`//`)),de=F(()=>K(v)?.path===``&&K(ue)?i().trim().slice(1).toLowerCase():``),fe=F(()=>(K(v)?.choices||[]).filter(e=>!K(de)||e.label.toLowerCase().startsWith(`/`+K(de)))),j=F(()=>K(y)||K(fe)[K(T)]),pe=F(()=>!!K(b)&&K(S)K(fe).find(e=>e.id===K(O))),he=F(()=>!$.connected||!!$.data?.sessionsError),ge=F(()=>K(h)&&K(ue)&&(!K(v)||K(v).path===``)&&!K(y));vn(()=>{i(),R(T,0)}),vn(()=>{let e=K(T);K(fe),K(ce)&&lr().then(()=>{let t=K(D)?.children[e];if(!t||!K(D))return;let n=K(D).getBoundingClientRect(),r=t.getBoundingClientRect();r.topn.bottom&&(K(D).scrollTop+=r.bottom-n.bottom)})});function _e(e){K(T)!==e&&K(v)?.picker&&(R(O,``),R(b,``),R(x,0),R(_,``),w++),R(T,e,!0)}function M(){w++,R(g,!1),R(h,!1),R(E,i()),f(),c()(i())}function ve(e){let t=!!K(ee)?.contains(e.target);if(!K(h)||!K(ce)&&!K(y)&&!K(v)?.input||!K(ue)&&!t||K(he)&&!a()||e.isComposing||e.ctrlKey||e.metaKey||e.altKey)return;if(K(v)?.input){e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),M());return}let n=e.key===`ArrowLeft`,r=e.key.toLowerCase()===`f`,i=e.key.toLowerCase()===`c`;if((i||r||n)&&!t||![`ArrowUp`,`ArrowDown`,`Tab`,`Enter`,`Escape`].includes(e.key)&&!i&&!r&&!n||e.key===`Tab`&&(K(y)||K(v)?.path!==``||e.shiftKey)||e.key===`Enter`&&e.target instanceof Element&&e.target.closest(`button`)&&!K(D)?.contains(e.target)&&!e.target.closest(`[data-command-confirm]`)||K(y)&&!t||K(y)&&[`ArrowUp`,`ArrowDown`].includes(e.key))return;if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){M();return}if(K(g)||e.repeat&&i)return;if(n){K(re)&&oe();return}if(r){N(K(v)?.path||``,void 0,!0);return}if(i){(K(y)?.action||K(A)&&K(O))&&xe();return}if(K(y)){e.key===`Enter`&&K(y).action&&!K(pe)&&!K(_)&&be(K(y));return}if(e.key===`ArrowUp`||e.key===`ArrowDown`){_e(Math.min(Math.max(K(T)+(e.key===`ArrowUp`?-1:1),0),Math.max(K(fe).length-1,0))),!K(A)&&K(D)?.contains(e.target)&&lr().then(()=>(K(D)?.children[K(T)])?.focus());return}let o=K(fe)[K(T)];o&&(e.key===`Tab`?c()(o.label):K(A)?be(o):ye(o))}vn(()=>{K(he)&&!a()&&(w++,R(g,!1),f(),K(h)&&(R(h,!1),R(E,i())),R(v,null),R(y,null))}),vn(()=>{K(ue)&&!K(h)&&i()!==K(E)&&(!K(he)||a())&&(f(),R(h,!0),N(``))});async function N(e,n,r=!1){let i=++w;if(K(v)&&R(v,{...K(v),path:e},!0),n&&R(C,n.input,!0),R(g,!0),R(y,null),R(O,``),R(b,``),R(x,0),R(_,``),a())R(v,d(),!0),R(T,n?.index??0,!0),R(g,!1);else try{let a=await va(`commands`,{session:t.session,command:{mode:`list`,path:e,...r?{refresh:!0}:{}}});i===w&&((e===``||e===`help`)&&(a.choices=[...a.choices.filter(e=>!l.includes(e.label.replace(/^\//,``))),...u()]),R(v,a,!0),R(T,n?Math.min(n.index,Math.max(a.choices.length-1,0)):a.picker?Math.max(a.choices.findIndex(e=>e.selected),0):0,!0),a.picker&&lr().then(()=>K(D)?.focus()),R(C,n?.input??a.value??``,!0),n&&lr().then(()=>{a.input?K(ee)?.querySelector(`input`)?.focus():K(D)?.focus()}),(a.path.startsWith(`rename/`)||a.path.startsWith(`cd/`))&&a.choices.length===1&&(R(g,!1),ye(a.choices[0])))}catch{i===w&&(R(_,`Command catalogue unavailable. Use Codex.`),e===``||e===`help`?(R(v,d(),!0),R(_,``)):R(v,{title:`/`+e,help:``,path:e,revision:``,choices:[]},!0))}finally{i===w&&R(g,!1)}}async function ye(e){e.unavailable||K(g)||e.next&&await m(e.next)||K(_)||(K(v)?.picker?(_e(K(fe).findIndex(t=>t.id===e.id)),K(D)?.focus()):e.next?await ae(e.next):await be(e))}async function be(e){if(K(g)||K(he)||!K(v)||e.unavailable||K(_))return;if(K(v).picker){if(K(pe)&&K(O)===e.id)return;R(O,e.id,!0)}else R(y,e,!0),lr().then(()=>K(te)?.focus());if(R(b,``),R(x,0),R(_,``),!e.action)return;let n=++w;R(g,!0);try{let r=await va(`commands`,{session:t.session,command:{mode:`prepare`,path:K(v).path,revision:K(v).revision,choice:e.id}});if(n===w){let e=Date.parse(r.expires);if(!r.confirmation||!Number.isFinite(e)||Date.now()>=e)throw Error(`Review confirmation unavailable`);R(b,r.confirmation,!0),R(x,e,!0)}}catch{n===w&&R(_,`Option changed or unavailable. Refresh before retrying.`)}finally{n===w&&R(g,!1)}}async function xe(){if(!K(b)||K(he)||K(g)||Date.now()>=K(x)||!K(v)||K(v).picker&&K(O)!==K(fe)[K(T)]?.id)return;let e=K(b);R(b,``),R(g,!0);let n=++w;try{let r=await va(`commands`,{session:t.session,confirmation:e,command:{mode:`commit`,path:K(v).path}});n===w&&(R(_,r.message,!0),R(h,!1),R(v,null),R(y,null),f(),R(E,null),s()())}catch{n===w&&R(_,`Change unconfirmed. Check Codex before retrying.`)}finally{n===w&&R(g,!1)}}var Se={handleKey:ve},Ce=No(),we=z(Ce),Te=H(we,2),Ee=e=>{var t=co(),n=V(t,!0);U(()=>X(n,K(_))),Y(e,t)};Z(Te,e=>{K(_)&&!K(h)&&e(Ee)});var De=H(Te,2),Oe=e=>{var i=Mo();let o;var s=z(i),c=e=>{var t=lo(),n=B(t),r=V(n,!0),i=V(H(n,2),!0);U(()=>{X(r,K(v)?.title||`/ COMMANDS`),X(i,K(v)?.help||`Loading live options…`)}),Y(e,t)};Z(s,e=>{K(ge)||e(c)});var l=H(s,2),u=e=>{var t=uo(),n=V(t,!0);U(()=>X(n,K(_))),Y(e,t)};Z(l,e=>{K(_)&&e(u)});var d=H(l,2),f=e=>{Y(e,fo())};Z(d,e=>{K(g)&&e(f)});var p=H(d,2),m=e=>{var t=po(),r=z(t),i=z(r),o=H(i);xi(o),P(r),P(t),U(e=>{Q(t,`id`,`${n}-input`),X(i,`${e??``} `),Q(o,`aria-label`,K(v).inputLabel||`Session name`),Q(o,`maxlength`,K(v).inputLimit||512),o.disabled=K(g)||K(he)&&!a()},[()=>(K(v).inputLabel||`Session name`).toUpperCase()]),xr(`submit`,t,e=>{e.preventDefault(),se()}),Ei(o,()=>K(C),e=>R(C,e)),Y(e,t)},h=e=>{var n=ho(),r=z(n),i=V(r,!0),a=H(r,2),o=V(a,!0),s=H(a,2),c=e=>{var n=mo(),r=z(n),i=H(r),a=e=>{Y(e,Mr(`Only this session's saved + name changes.`))},o=F(()=>K(v)?.path.startsWith(`rename/`)),s=e=>{Y(e,Mr(`Only this session’s + directory changes; project configuration is not reloaded.`))},c=F(()=>K(v)?.path.startsWith(`cd/`)),l=e=>{Y(e,Mr(`No change sent yet. Model, reasoning and speed settings can + change token usage and cost. Changes affect subsequent turns of + this session, not global defaults. Automatic quota thresholds + may later supersede model settings.`))};Z(i,e=>{K(o)?e(a):K(c)?e(s,1):e(l,-1)}),P(n),U(()=>X(r,`TARGET // ${t.session??``}. `)),Y(e,n)};Z(s,e=>{K(y).action&&e(c)}),P(n),Ii(n,e=>R(te,e),()=>K(te)),U(()=>{X(i,K(y).label),X(o,K(y).help||`No additional help supplied by Codex.`)}),Y(e,n)},w=e=>{var t=So(),i=B(t),a=e=>{var t=go(),i=z(t);r(i),P(t),Ii(t,e=>R(D,e),()=>K(D)),U(()=>Q(t,`aria-activedescendant`,`${n}-${K(T)}`)),Y(e,t)},o=e=>{var t=_o();let n;var i=z(t);r(i),P(t),Ii(t,e=>R(D,e),()=>K(D)),U(()=>n=ci(t,1,`command-options svelte-7bfwr9`,null,n,{vertical:K(ge)})),Y(e,t)};Z(i,e=>{K(A)?e(a):e(o,-1)});var s=H(i,2),c=e=>{var t=bo(),n=B(t),r=V(n,!0),i=H(n,2),a=e=>{var t=yo(),n=B(t),r=V(n),i=H(n,2),a=e=>{Y(e,vo())};Z(i,e=>{K(b)&&K(S)>=K(x)&&e(a)}),U(()=>X(r,`REVIEW // ${K(me).label??``}. No change sent yet.`)),Y(e,t)};Z(i,e=>{K(me)&&e(a)}),U(()=>X(r,K(fe)[K(T)]?.help)),Y(e,t)};Z(s,e=>{K(A)&&e(c)});var l=H(s,2),u=e=>{Y(e,xo())};Z(l,e=>{!K(g)&&!K(fe).length&&e(u)}),Y(e,t)};Z(p,e=>{K(v)?.input?e(m):K(y)?e(h,1):e(w,-1)});var E=H(p,2),O=e=>{var t=Co(),n=V(t,!0);U(()=>X(n,K(j).unavailable)),Y(e,t)};Z(E,e=>{K(j)?.unavailable&&e(O)});var ne=H(E,2),k=e=>{Y(e,wo())};Z(ne,e=>{K(b)&&K(S)>=K(x)&&!K(A)&&e(k)});var ie=H(ne,2),ae=z(ie),ce=e=>{var t=Nr(),r=B(t),i=e=>{var t=To();U(e=>{Q(t,`form`,`${n}-input`),t.disabled=e},[()=>K(g)||K(he)||!K(C).trim()]),Y(e,t)},o=e=>{var t=Nr(),n=B(t),r=e=>{var t=Eo();U(()=>t.disabled=K(g)||K(he)&&!a()),q(`click`,t,xe),Y(e,t)},i=e=>{var t=Do();U(()=>t.disabled=K(g)||K(he)&&!a()),q(`click`,t,()=>{K(j)&&be(K(j))}),Y(e,t)};Z(n,e=>{K(pe)?e(r):e(i,-1)}),Y(e,t)},s=e=>{var t=Oo(),n=V(t);U(()=>{t.disabled=K(g)||K(he)&&!a(),X(n,`ENTER ${K(j).next?`OPEN`:`HELP`}`)}),q(`click`,t,()=>{K(j)&&ye(K(j))}),Y(e,t)};Z(r,e=>{K(v)?.input?e(i):K(j)?.action&&!K(j).unavailable?e(o,1):!K(y)&&K(j)&&!K(j).unavailable&&e(s,2)}),Y(e,t)};Z(ae,e=>{K(_)||e(ce)});var le=H(ae,2),ue=e=>{var t=ko();U(()=>t.disabled=K(g)),q(`click`,t,oe),Y(e,t)};Z(le,e=>{K(re)&&e(ue)});var de=H(le,2),_e=e=>{var t=Ao();U(()=>t.disabled=K(g)),q(`click`,t,()=>N(K(v)?.path||``,void 0,!0)),Y(e,t)};Z(de,e=>{K(ge)||e(_e)});var Se=H(de,2);P(ie);var Ce=H(ie,2),we=e=>{var t=jo(),n=V(t);U(()=>X(n,`↑/↓ select${K(ge)?` · Tab complete`:``}`)),Y(e,t)};Z(Ce,e=>{!K(v)?.input&&!K(y)&&e(we)}),P(i),Ii(i,e=>R(ee,e),()=>K(ee)),U(()=>{Q(i,`aria-label`,K(ge)?`Slash command suggestions`:`Session command options`),o=ci(i,1,`svelte-7bfwr9`,null,o,{"command-popup":K(ge)})}),q(`keydown`,i,ve),q(`click`,Se,M),Y(e,i)};return Z(De,e=>{K(h)&&e(Oe)}),P(Ce),U(()=>we.disabled=K(he)&&!a()||K(g)),q(`click`,we,()=>{R(h,!K(h)),R(E,K(h)?null:i(),!0),R(b,``),K(h)?(R(ne,[],!0),N(``)):M()}),Y(e,Ce),We(Se)}Sr([`click`,`keydown`]);var Fo=J(` `,1),Io=J(`
      `),Lo=J(`
      /
      `);function Ro(e,t){Ue(t,!0);let n=F(()=>t.lines.filter(e=>e.kind===`addition`).length),r=F(()=>t.lines.filter(e=>e.kind===`removal`).length);var i=Lo(),a=z(i),o=z(a),s=V(o),c=V(H(o,2));P(a),Xr(H(a,2),17,()=>t.lines,Kr,(e,t)=>{var n=Io();let r;var i=z(n),a=e=>{var n=Fo(),r=B(n),i=V(r,!0),a=V(H(r),!0);U(()=>{X(i,K(t).old||``),X(a,K(t).new||``)}),Y(e,n)};Z(i,e=>{K(t).kind!==`heading`&&K(t).kind!==`metadata`&&e(a)});var o=V(H(i),!0);P(n),U(()=>{r=ci(n,1,`diff-line svelte-x4gtb6`,null,r,{added:K(t).kind===`addition`,removed:K(t).kind===`removal`,heading:K(t).kind===`heading`}),X(o,K(t).text)}),Y(e,n)}),P(i),U(()=>{Q(a,`aria-label`,`${K(n)} lines added, ${K(r)} lines removed`),X(s,`+${K(n)??``}`),X(c,`−${K(r)??``}`)}),Y(e,i),We()}var zo=J(`

      `),Bo=J(`

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

      `,1),Vo=J(``),Ho=J(`

       

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

      `),Uo=J(`

      CURRENT PROFILE

      MODEL / REASONING LEVEL / SPEED

       

      PROPOSED PROFILE

      MODEL / REASONING LEVEL / SPEED

       

      Applied settings remain after Codexometer closes.

      `,1),Wo=J(`

      `),Go=J(`

       
      `,1),Ko=J(`

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

      `),qo=J(`

      Session controls temporarily unavailable. Check Codex for current state.

      `),Jo=J(`

      Checking session controls…

      `),Yo=J(`

      `),Xo=J(`
      About browser controls

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

      `),Zo=J(` `,1),Qo=J(` `),$o=J(`Grants permission beyond this one action. Check the scope + carefully.`),es=J(``),ts=J(``),ns=J(``),rs=J(``),is=J(`

      Not before this time; when quota and idle allow.

      `),as=J(`

      `,1),os=J(`

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

      `),ss=J(` `,1),cs=J(``),ls=J(``),us=J(``),ds=J(` `,1),fs=J(`
    • `),ps=J(`
      View fixed choices

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

        `),ms=J(` `,1),hs=J(`

        `),gs=J(`

        `,1),_s=J(` `,1),vs=J(``),ys=J(`

        `,1),bs=J(`

        `);function xs(e,t){Ue(t,!0);let n=[],r=Wi(t,`observedCommand`,3,``),i=Wi(t,`observedFileChanges`,19,()=>[]),a=Wi(t,`review`,3,``),o=Wi(t,`suspended`,3,!1),s=Wi(t,`openScheduler`,3,!1),c=Wi(t,`onProtectedChange`,3,e=>{}),l=Wi(t,`oncopy`,3,()=>{}),u=L(null),d=L(Yt([])),f=L(null),p=L(``),m=L(0),h=L(Yt(Date.now())),g=L(!1),_=L(``),v=L(!1),y=L(!1),b=L(``),x=L(!1),S=L(``),C=L(!1),w=L(``),T=L(`now`),E=L(60),D=L(``),ee=L(!1),te=L(``),O=L(Yt([])),ne=F(()=>K(O).find(e=>e.status!==`sent`)),k=L(void 0),re=L(void 0);function ie(e){if(K(x)){lr().then(()=>K(k)?.focus());return}if(e.status!==`pending`||K(g)||!K(u)?.id||K(u).kind!==`prompt`||K(u).questions?.length)return;R(x,!0),R(S,e.id,!0),lr().then(()=>K(k)?.focus()),R(d,[e.text],!0),R(T,e.trigger===`quota`?`quota`:`at`,!0),R(p,``),R(w,``);let t=new Date(e.at);e.trigger!==`quota`&&R(D,new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16),!0)}vn(()=>{s()&&K(ne)&&!K(C)&&K(u)?.id&&K(u).kind===`prompt`&&!K(u).questions?.length&&(R(C,!0),ie(K(ne)))});async function ae(){if(!a())try{R(O,await va(`schedules`,{session:t.session},M.signal),!0),K(x)&&!K(O).some(e=>e.id===K(S)&&e.status===`pending`)&&R(p,``),K(w)&&!K(O).some(e=>e.id===K(w)&&e.status===`pending`)&&(R(p,``),R(w,``))}catch{}}async function oe(e){try{R(O,await va(`schedules`,{session:t.session,cancelId:e},M.signal),!0),R(x,!1),R(p,``),R(w,``),R(d,[],!0)}catch(e){R(_,e instanceof Error?e.message:`Unable to cancel trigger.`,!0)}}vn(()=>(c()(K(g)||K(d).some(e=>e.length>0)),()=>c()(!1)));let se=F(()=>$.data?.sessions.find(e=>e.id===t.session)?.status),A=F(()=>!$.connected||!!$.data?.sessionsError),ce=F(()=>a()!==`profile`&&K(u)?.kind===`prompt`&&!K(u).questions?.length&&!!$.data?.profiles?.some(e=>e.session===t.session&&e.pending)),le=F(()=>!K(A)&&!K(y)&&!!K(u)?.id&&K(u).kind===`approval`&&K(b)!==K(u).id),ue=F(()=>K(le)?K(u).command:r()),de=F(()=>!!K(p)&&K(h)K(u)?.questions?.length?K(u).questions:[{text:`Follow-up message`,secret:!1,freeText:!0,options:[]}]),j=F(()=>K(u)?.kind===`approval`||K(u)?.kind===`profile`?K(f)!==null:K(d).length===K(fe).length&&K(d).every((e,t)=>e.trim().length>0&&(K(fe)[t].freeText||K(fe)[t].options?.includes(e)))),pe=F(()=>K(u)?.kind===`prompt`&&!K(u).questions?.length&&K(T)!==`now`),me=F(()=>K(T)===`delay`?K(h)+K(E)*6e4:Date.parse(K(D))),he=F(()=>{if(!K(pe))return``;if(K(x)&&!K(O).some(e=>e.id===K(S)&&e.status===`pending`))return`Trigger changed, removed or already sent. Go back and reopen it; your draft has not been saved.`;if(!K(d)[0]?.trim())return`Enter a message to schedule.`;if(K(T)===`quota`)return``;if(!Number.isFinite(K(me))||K(me)<=K(h))return`Choose a future date/time or a delay greater than zero.`;let e=new Date(K(h));return e.setFullYear(e.getFullYear()+1),K(me)>=e.getTime()?`Choose a time within one year.`:``});function ge(e){return new Date(e).toLocaleString([],{timeZoneName:`short`})}function _e(e){if(e.status!==`pending`)return e.status;if(e.trigger===`at`&&Date.parse(e.at)>K(h))return`Due in `+Math.ceil((Date.parse(e.at)-K(h))/6e4)+` min`;let t=K(A)?`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}vn(()=>{(K(A)||o()||K(ce)||K(h)>=K(m))&&R(p,``)});let M=new AbortController;Gi(()=>{let e=e=>{e.ctrlKey&&e.key.toLowerCase()===`s`&&!a()&&K(ne)&&(e.preventDefault(),ie(K(ne)))};window.addEventListener(`keydown`,e);let n,r=setInterval(()=>{R(h,Date.now(),!0)},1e3);async function i(){await ae();try{let e=await va(`offer`,{session:t.session,...a()?{review:a()}:{}},M.signal);if(M.signal.aborted)return;R(y,!1),K(u)?.id!==e.id&&(R(p,``),R(f,null),R(d,Array(Math.max(1,e.questions?.length||0)).fill(``),!0)),R(u,e,!0),K(v)&&e.id&&e.id!==K(b)&&(R(_,``),R(v,!1))}catch{M.signal.aborted||(R(u,null),R(y,!0),R(p,``))}finally{M.signal.aborted||(n=setTimeout(i,2e3))}}return i(),()=>{window.removeEventListener(`keydown`,e),M.abort(),clearTimeout(n),clearInterval(r)}});async function ve(e){if(!e&&K(u)?.kind===`prompt`&&!K(u).questions?.length&&K(d)[0]?.trim().startsWith(`/`)&&!K(d)[0]?.trim().startsWith(`//`)){R(_,`Choose a slash command from COMMANDS; use // for literal slash text.`);return}if(!K(u)?.id||K(g)||K(A)||o()||K(ce)||(e?!e.canSend:!K(j)||K(he)))return;let n=K(u).id;R(g,!0),R(_,``),R(v,!1),R(p,``),R(w,e?.id||``,!0);try{let r=!e&&K(u).kind===`prompt`&&!K(u).questions?.length&&K(T)!==`now`?{trigger:K(T)===`quota`?`quota`:`at`,zone:Intl.DateTimeFormat().resolvedOptions().timeZone,...K(T)===`quota`?{}:{at:(K(T)===`delay`?new Date(Date.now()+K(E)*6e4):new Date(K(D))).toISOString()}}:void 0;R(ee,!!r),R(te,r?r.trigger===`quota`?`After fresh quota becomes available, when the session is idle`:ge(r.at)+` — not before this time; when quota and idle allow`:``,!0);let i=await va(`prepare`,{session:t.session,...a()?{review:a()}:{},offer:n,...e?{sendId:e.id}:{},...r?{schedule:r}:{},...r&&K(x)?{editId:K(S)}:{},...K(u).kind===`approval`||K(u).kind===`profile`?{choice:K(f)}:{answers:e?[e.text]:[...K(d)]}},M.signal);K(u)?.id!==n||M.signal.aborted||K(A)||o()||K(ce)||(R(p,i.confirmation,!0),R(m,Date.parse(i.expires),!0))}catch(e){M.signal.aborted||R(_,e instanceof Error?e.message:`Unable to prepare action.`,!0)}finally{R(g,!1)}}async function N(){if(!K(u)?.id||K(g)||o()||K(ce)||!K(de))return;let e=K(u).id,n=K(u).kind,r=K(p);R(p,``),R(g,!0),R(b,e,!0);try{await va(`commit`,{session:t.session,...a()?{review:a()}:{},offer:e,confirmation:r},M.signal),R(v,!0),R(x,!1),K(ee)&&(R(b,``),await ae()),R(_,K(ee)?`Trigger set. Closing Codexometer cancels it.`:n===`profile`?`Profile decision completed.`:n===`approval`?`Decision sent.`:`Text sent.`,!0)}catch(e){R(_,e instanceof ga?e.message:`Outcome uncertain. Check Codex before taking another action; nothing was retried.`,!0)}finally{R(g,!1),R(w,``),await ae(),R(d,[],!0),R(f,null)}}var ye=Zo(),be=B(ye),Se=e=>{var t=Nr();Xr(B(t),17,()=>K(O).filter(e=>e.status!==`sent`),e=>e.id,(e,t)=>{var n=Ho(),r=z(n),i=V(r,!0),a=H(r,2),s=V(a),c=H(a,2),l=V(c,!0),d=H(c,2),f=V(d,!0),m=H(d,2),h=V(m,!0),v=H(m,2),y=e=>{var t=zo(),n=V(t,!0);U(()=>X(n,K(_))),Y(e,t)};Z(v,e=>{K(_)&&e(y)});var b=H(v,4),x=H(b,2),S=H(x,2),C=e=>{var n=Bo(),r=H(B(n),2),i=H(r,2);U(()=>r.disabled=K(g)||K(A)||!K(t).canSend),q(`click`,r,N),q(`click`,i,()=>{R(p,``),R(w,``)}),Y(e,n)},T=e=>{var n=Vo();U(()=>n.disabled=K(g)||K(A)||!K(t).canSend||o()),q(`click`,n,()=>ve(K(t))),Y(e,n)};Z(S,e=>{K(de)&&K(w)===K(t).id?e(C):e(T,-1)}),P(n),U((e,n)=>{X(i,K(t).status===`uncertain`?`CHECK TRIGGER — outcome uncertain; not retried`:`SCHEDULED FOLLOW-UP`),X(s,`TARGET // ${K(t).session??``}`),X(l,e),X(f,n),X(h,K(t).text),b.disabled=K(g)||!K(u)?.id||K(u).kind!==`prompt`||!!K(u).questions?.length||K(t).status!==`pending`,x.disabled=K(g)||K(t).status===`sending`},[()=>K(t).trigger===`quota`?`After confirmed quota recovery, when idle`:`Not before ${ge(K(t).at)}`,()=>_e(K(t))]),q(`click`,b,()=>ie(K(t))),q(`click`,x,()=>oe(K(t).id)),Y(e,n)}),Y(e,t)},Ce=F(()=>!a()&&K(u)?.kind!==`approval`&&!K(u)?.questions?.length&&![`APPROVAL NEEDED`,`INPUT NEEDED`].includes(K(se)||``));Z(be,e=>{K(Ce)&&e(Se)});var we=H(be,2),Te=e=>{var r=bs(),o=z(r),s=V(o,!0),c=H(o,2),S=e=>{var t=Uo(),n=B(t),r=V(n),i=H(n,6),a=V(i,!0),o=V(H(i,6),!0);xe(2),U(()=>{X(r,`Your ${K(u).profile.threshold??``}% quota threshold has been reached. Review + the profile for subsequent turns.`),X(a,K(u).profile.current),X(o,K(u).profile.proposed)}),Y(e,t)};Z(c,e=>{K(u)?.profile&&!K(A)&&!K(y)&&e(S)});var C=H(c,2),w=e=>{var t=Wo();let n;var r=V(t,!0);U(()=>{n=ci(t,1,`svelte-1oupzfc`,null,n,{notice:!K(v),sent:K(v)}),X(r,K(_))}),Y(e,t)};Z(C,e=>{K(_)&&e(w)});var O=H(C,2),ne=e=>{Ro(e,{get lines(){return K(u).fileChanges}})},ie=e=>{Ro(e,{get lines(){return i()}})},ae=e=>{var t=Go(),n=B(t),r=V(n,!0),i=V(H(n,2),!0);U(()=>{X(r,K(le)?`EXACT COMMAND`:`LAST OBSERVED COMMAND`),X(i,K(ue))}),Y(e,t)},oe=e=>{Y(e,Ko())};Z(O,e=>{K(u)?.fileChanges?.length&&!K(A)&&!K(y)?e(ne):i().length?e(ie,1):K(ue)?e(ae,2):a()!==`profile`&&K(se)===`APPROVAL NEEDED`&&!K(v)&&e(oe,3)});var ce=H(O,2),pe=e=>{Y(e,qo())},_e=e=>{Y(e,Jo())},M=e=>{var t=Zo(),n=B(t),r=e=>{var t=Yo(),n=V(t,!0);U(e=>X(n,e),[()=>K(se)===`WORKING`?`Codex is working — nothing to respond to.`:[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(K(se)||``)?`Respond in Codex for this request.`:`Nothing needs a response right now.`]),Y(e,t)};Z(n,e=>{(K(se)===`WORKING`||!K(v)&&!K(g))&&e(r)});var i=H(n,2),a=e=>{Y(e,Xo())},o=F(()=>[`APPROVAL NEEDED`,`INPUT NEEDED`].includes(K(se)||``)&&!K(v));Z(i,e=>{K(o)&&e(a)}),Y(e,t)},ye=e=>{var r=ys(),i=B(r),o=V(i),s=H(i,2),c=z(s),_=V(c,!0),v=H(c,2),y=e=>{var r=Nr();Xr(B(r),17,()=>K(u).choices||[],Kr,(e,r,i)=>{var o=es(),s=z(o);xi(s),s.value=s.__value=i;var c=H(s),l=H(c),u=e=>{var t=Qo(),n=V(t,!0);U(()=>X(n,K(r).detail)),Y(e,t)};Z(l,e=>{K(r).detail&&e(u)});var d=H(l,2),p=e=>{Y(e,$o())};Z(d,e=>{K(r).persistent&&e(p)}),P(o),U(()=>{Q(s,`name`,`decision-`+t.session+`-`+a()),X(c,` ${K(r).label??``} `)}),Oi(n,[],s,()=>K(f),e=>R(f,e)),Y(e,o)}),Y(e,r)},b=e=>{var n=Zo(),r=B(n),i=e=>{var t=ss(),n=B(t),r=H(z(n)),i=z(r),a=e=>{var t=ts();t.value=t.__value=`now`,Y(e,t)};Z(i,e=>{K(x)||e(a)});var o=H(i);o.value=o.__value=`quota`;var s=H(o);s.value=s.__value=`delay`;var c=H(s);c.value=c.__value=`at`,P(r),mi(r),P(n);var l=H(n,2),u=e=>{var t=ns(),n=H(z(t));xi(n),P(t),Ei(n,()=>K(E),e=>R(E,e)),Y(e,t)};Z(l,e=>{K(T)===`delay`&&e(u)});var d=H(l,2),f=e=>{var t=rs(),n=H(z(t));xi(n),P(t),Ei(n,()=>K(D),e=>R(D,e)),Y(e,t)};Z(d,e=>{K(T)===`at`&&e(f)});var p=H(d,2),m=e=>{var t=as(),n=B(t),r=V(n),i=H(n,2),a=e=>{Y(e,is())};Z(i,e=>{K(T)!==`quota`&&e(a)});var o=H(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.`,U(e=>X(r,`Will send: ${e??``}`),[()=>K(T)===`quota`?`when quota is available and this session is idle`:Number.isFinite(K(me))?ge(K(me)):`choose a date and time`]),Y(e,t)};Z(p,e=>{K(T)!==`now`&&e(m)});var h=H(p,2),g=e=>{Y(e,os())};Z(h,e=>{K(x)&&e(g)}),hi(r,()=>K(T),e=>R(T,e)),Y(e,t)};Z(r,e=>{K(u).questions?.length||e(i)}),Xr(H(r,2),17,()=>K(fe),Kr,(e,n,r)=>{var i=ms(),o=B(i),s=e=>{{let n=F(()=>K(d)[0]||``);Ii(Po(e,{get session(){return t.session},get oncopy(){return l()},get query(){return K(n)},oncomplete:e=>{R(d,[e],!0),lr().then(()=>K(k)?.focus())},onchange:()=>{R(d,[``],!0),lr().then(()=>K(k)?.focus())}}),e=>R(re,e,!0),()=>K(re))}};Z(o,e=>{r===0&&a()!==`profile`&&K(u).kind===`prompt`&&!K(u).questions?.length&&e(s)});var c=H(o,2),f=z(c),p=H(f),m=e=>{var t=cs();xi(t),Ei(t,()=>K(d)[r],e=>K(d)[r]=e),Y(e,t)},h=e=>{var t=us(),i=z(t);i.value=i.__value=``,Xr(H(i),17,()=>K(n).options||[],Kr,(e,t)=>{var n=ls(),r=V(n,!0),i={};U(()=>{X(r,K(t)),i!==(i=K(t))&&(n.value=(n.__value=i)??``)}),Y(e,n)}),P(t),mi(t),hi(t,()=>K(d)[r],e=>K(d)[r]=e),Y(e,t)},g=e=>{var t=ds(),i=B(t);tt(i),Ii(i,e=>R(k,e),()=>K(k));var a=H(i,2),o=e=>{var t=Yo(),r=V(t);U(e=>X(r,`Suggested answers: ${e??``}`),[()=>K(n).options.join(` · `)]),Y(e,t)};Z(a,e=>{K(n).options?.length&&e(o)}),q(`keydown`,i,e=>{K(u)?.kind===`prompt`&&!K(u).questions?.length&&K(re)?.handleKey(e)}),Ei(i,()=>K(d)[r],e=>K(d)[r]=e),Y(e,t)};Z(p,e=>{K(n).secret?e(m):K(n).freeText?e(g,-1):e(h,1)}),P(c);var _=H(c,2),v=e=>{var t=ps(),r=H(z(t),4);Xr(r,21,()=>K(n).options||[],Kr,(e,t)=>{var n=fs(),r=V(n,!0);U(()=>X(r,K(t))),Y(e,n)}),P(r),P(t),Y(e,t)};Z(_,e=>{K(n).secret&&!K(n).freeText&&e(v)}),U(()=>X(f,`${K(n).text??``} `)),Y(e,i)}),Y(e,n)};Z(v,e=>{K(u).kind===`approval`||K(u).kind===`profile`?e(y):e(b,-1)}),P(s);var S=H(s,2),C=e=>{var t=gs(),n=B(t),r=e=>{var t=hs(),n=V(t);U(()=>X(n,`TRIGGER // ${K(te)??``}`)),Y(e,t)};Z(n,e=>{K(ee)&&e(r)});var i=H(n,2),a=V(i),o=H(i,2),s=V(o),c=H(o,2);U(e=>{X(a,`Check the target and ${K(u).kind===`profile`?`profile above`:K(u).kind===`approval`?K(u).fileChanges?.length?`proposed file changes above`:`exact command and permission scope`:`message above`}. ${K(ee)?`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=K(g)||K(A),X(s,`CONFIRM ${(K(u).kind===`approval`||K(u).kind===`profile`?K(u).choices?.[K(f)]?.label:K(ee)?K(x)?`SAVE CHANGES`:`SCHEDULE`:`SEND`)??``}`)},[()=>Math.max(0,Math.ceil((K(m)-K(h))/1e3))]),q(`click`,o,N),q(`click`,c,()=>{R(p,``)}),Y(e,t)},w=e=>{var t=_s(),n=B(t),r=e=>{var t=zo(),n=V(t,!0);U(()=>X(n,K(he))),Y(e,t)};Z(n,e=>{K(he)&&e(r)});var i=H(n,2),a=V(i,!0);U(()=>{i.disabled=K(g)||K(A)||!K(j)||!!K(he),X(a,K(g)?`SENDING…`:K(x)?`REVIEW CHANGES`:`REVIEW BEFORE SENDING`)}),q(`click`,i,()=>ve()),Y(e,t)};Z(S,e=>{K(de)?e(C):e(w,-1)});var O=H(S,2),ne=e=>{var t=vs();q(`click`,t,()=>{R(x,!1),R(p,``),R(d,[],!0)}),Y(e,t)};Z(O,e=>{K(x)&&e(ne)}),U(()=>{X(o,`TARGET // ${K(u).thread??``} // ${(K(u).directory||`Directory unavailable`)??``}`),s.disabled=K(g)||K(de)||K(A),X(_,K(u).kind===`approval`||K(u).kind===`profile`?`Choose a decision`:K(x)?`EDIT SCHEDULED FOLLOW-UP`:`Reply to this session`)}),Y(e,r)};Z(ce,e=>{K(A)||K(y)?e(pe):K(u)?K(u).id?K(b)!==K(u).id&&e(ye,3):e(M,2):e(_e,1)}),P(r),U(()=>X(s,a()===`profile`?`QUOTA THRESHOLD`:`SESSION CONTROL // EXPERIMENTAL`)),Y(e,r)};Z(we,e=>{!K(ce)&&(!K(ne)||K(x)||a()||K(u)?.kind!==`prompt`||K(u).questions?.length)&&e(Te)}),Y(e,ye),We()}Sr([`click`,`keydown`]);var Ss=J(` `,1),Cs=J(`
        `),ws=J(`

        STATUS LINE // CODEXOMETER

        Choose multiple fields and their order. These display preferences do not + change Codex CLI configuration. Missing values are omitted.

        `),Ts=J(`

        `,1);function Es(e,t){Ue(t,!0);let n=Wi(t,`stale`,3,!1),r=L(Yt([])),i=L(!1),a=F(()=>$.data?.statusLineFields||[]),o=e=>[...new Set(e??K(a).filter(e=>e.default).map(e=>e.id))].filter(e=>K(a).some(t=>t.id===e)),s=e=>o(e).map(e=>e===`run-state`&&(n()||!$.connected||$.data?.sessionsError)?`STALE`:t.session.statusLine?.[e]).filter(Boolean).join(` · `),c=F(()=>[...K(r).map(e=>K(a).find(t=>t.id===e)).filter(Boolean),...K(a).filter(e=>!K(r).includes(e.id))]);vn(()=>{oa.open&&!K(i)?(R(r,o(aa.statusLine),!0),R(i,!0)):oa.open||R(i,!1)});function l(e,t){R(r,t?[...K(r),e]:K(r).filter(t=>t!==e),!0)}function u(e,t){let n=K(r).indexOf(e),i=n+t;if(n<0||i<0||i>=K(r).length)return;let a=[...K(r)];[a[n],a[i]]=[a[i],a[n]],R(r,a,!0)}var d=Ts(),f=B(d),p=e=>{var t=ws(),n=H(z(t),4);Xr(n,21,()=>K(c),e=>e.id,(e,t)=>{var n=Cs(),i=z(n),a=z(i);xi(a);var o=H(a,1,!0),s=V(H(o),!0);P(i);var c=H(i,2),d=e=>{var n=Ss(),i=B(n),a=H(i,2);U((e,n)=>{Q(i,`aria-label`,`Move `+K(t).label+` earlier`),i.disabled=e,Q(a,`aria-label`,`Move `+K(t).label+` later`),a.disabled=n},[()=>K(r).indexOf(K(t).id)===0,()=>K(r).indexOf(K(t).id)===K(r).length-1]),q(`click`,i,()=>u(K(t).id,-1)),q(`click`,a,()=>u(K(t).id,1)),Y(e,n)},f=F(()=>K(r).includes(K(t).id));Z(c,e=>{K(f)&&e(d)}),P(n),U(e=>{Q(i,`title`,K(t).help),Si(a,e),X(o,K(t).label),X(s,K(t).help)},[()=>K(r).includes(K(t).id)]),q(`change`,a,e=>l(K(t).id,e.currentTarget.checked)),Y(e,n)}),P(n);var i=H(n,2),a=V(i),o=H(i,2),d=H(o,2);P(t),U(e=>X(a,`Preview // ${e??``}`),[()=>s(K(r))||`—`]),q(`click`,o,()=>{aa.statusLine=[...K(r)],ca(),oa.open=!1}),q(`click`,d,()=>{oa.open=!1}),Y(e,t)};Z(f,e=>{oa.open&&e(p)});var m=H(f,2),h=z(m),g=V(h,!0),_=H(h,2);P(m),U((e,t)=>{Q(h,`title`,e),X(g,t)},[()=>s(aa.statusLine),()=>s(aa.statusLine)]),q(`click`,_,()=>{oa.open=!oa.open}),Y(e,d),We()}Sr([`change`,`click`]);var Ds=J(`
        `);function Os(e,t){Ue(t,!0);let n=Wi(t,`active`,3,!1),r=F(()=>ao(t.session)),i=F(()=>!!K(r)),a=L(!1),o=L(``),s=L(!1);vn(()=>{if(!K(s))return;let e=setTimeout(()=>{R(s,!1)},150);return()=>clearTimeout(e)}),vn(()=>{K(r),t.session.status,R(o,``)});async function c(){if(!K(i)||K(a))return;let e=K(r);R(a,!0),R(s,!0),R(o,``);try{await navigator.clipboard.writeText(e),K(r)===e&&R(o,`Copied.`)}catch{K(r)===e&&R(o,`Clipboard unavailable. Select the visible text and copy it manually.`)}finally{R(a,!1)}}function l(e){!n()||!K(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={copy:c},d=Nr();xr(`keydown`,Qt,l);var f=B(d),p=e=>{var t=Ds(),n=z(t),r=V(n,!0),i=H(n,2);let l;P(t),U(()=>{X(r,K(o)),i.disabled=K(a),l=ci(i,1,`svelte-543j00`,null,l,{flashed:K(s)})}),q(`click`,i,c),Y(e,t)};return Z(f,e=>{K(i)&&e(p)}),Y(e,d),We(u)}Sr([`click`]);var ks=J(`

         
        `,1),As=J(`

        LATEST GUIDANCE

         
        `,1),js=J(`

        CONTEXT

         

        `,1),Ms=J(`

        `),Ns=J(`

        `),Ps=J(`
         
        `),Fs=J(`

         
        `,1),Is=J(`
         
        `),Ls=J(`

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

        `),Rs=J(`

        `,1),zs=J(`

        `),Bs=J(` `,1),Vs=J(`
        `),Hs=J(`

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

        `),Us=J(`

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

        `),Ws=J(` `),Gs=J(` `),Ks=J(` `),qs=J(``),Js=J(`

        Read only — reply or approve in Codex.

        `),Ys=J(`

        `),Xs=J(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),Zs=J(`
        `),Qs=J(`
        `),$s=J(`

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

        `),ec=J(`

        `),tc=J(``),nc=J(`

        `),rc=J(` `),ic=J(`

        `),ac=J(`QUOTA THRESHOLD // REVIEW PROFILE ↗`),oc=J(` `,1),sc=J(`

        `),cc=J(`

        TOKEN ACTIVITY // 30 SECOND SAMPLES

        `),lc=J(`

        TOKENS

        FULL DETAIL →
        `),uc=J(`

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

        `),dc=J(`

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

        `,1),fc=J(`

        SESSION TOTALS

        `,1);function pc(e,t){Ue(t,!0);let n=(e,t=f,n,r)=>{let i=pt(()=>g(n?.(),!0)),a=pt(()=>g(r?.(),!1));var o=Bs(),s=B(o),c=e=>{var n=ks(),r=B(n),i=V(r,!0),a=V(H(r,2),!0);U(()=>{X(i,t().contextKind===`LAST REPLY`&&!t().streaming?`TASK`:`CURRENT TASK`),X(a,t().currentTask)}),Y(e,n)};Z(s,e=>{t().currentTask&&e(c)});var l=H(s,2),u=e=>{var n=As(),r=V(H(B(n),2),!0);U(()=>X(r,t().latestGuidance)),Y(e,n)};Z(l,e=>{t().latestGuidance&&e(u)});var d=H(l,2),p=e=>{var n=js(),r=V(H(B(n),2),!0);xe(2),U(()=>X(r,t().approvalContext)),Y(e,n)};Z(d,e=>{K(a)&&t().contextKind===`APPROVAL REQUEST`&&t().approvalContext&&e(p)});var m=H(d,2),h=e=>{var n=Ms();let r;var i=V(n,!0);U(e=>{r=ci(n,1,`attention-note`,null,r,{inferred:t().status===`CHECK SESSION`}),X(i,e)},[()=>D(t())]),Y(e,n)},_=F(()=>D(t())&&(!K(a)||K(v)||t().status===`CHECK SESSION`||y(t())));Z(m,e=>{K(_)&&e(h)});var b=H(m,2),x=e=>{var n=Ns(),r=V(n,!0);U(e=>X(r,e),[()=>ee(t())]),Y(e,n)};Z(b,e=>{K(i)&&e(x)});var S=H(b,2),C=e=>{var n=Ps(),r=V(n,!0);U(()=>X(r,t().text||`No session context available.`)),Y(e,n)};Z(S,e=>{(t().text||!t().workingCommand)&&e(C)});var w=H(S,2),T=e=>{var n=Fs(),r=H(B(n),2),i=z(r),a=H(i),o=e=>{var n=Mr();U(()=>X(n,`// +${(t().runningCommands||0)-+(t().commandStatus===`running`)} RUNNING`)),Y(e,n)};Z(a,e=>{!K(v)&&(t().runningCommands||0)>+(t().commandStatus===`running`)&&e(o)});var s=H(a,2),c=e=>{Y(e,Mr(`+`))};Z(s,e=>{t().runningLimited&&e(c)}),P(r);var l=V(H(r,2),!0);U(e=>{X(i,`COMMAND // ${e??``} `),X(l,t().workingCommand)},[()=>K(v)?`UNKNOWN`:(t().commandStatus||`unknown`).toUpperCase()]),Y(e,n)};Z(w,e=>{t().workingCommand&&e(T)});var E=H(w,2),te=e=>{Ro(e,{get lines(){return t().fileChanges}})},O=e=>{var n=Rs(),r=H(B(n),2),i=V(r,!0),a=H(r,2),o=e=>{var n=Is(),r=V(n,!0);U(()=>X(r,t().command)),Y(e,n)},s=e=>{Y(e,Ls())};Z(a,e=>{t().command?e(o):e(s,-1)}),U(()=>X(i,K(v)||t().status!==`APPROVAL NEEDED`?`LAST OBSERVED COMMAND`:$.data?.control?`COMMAND REQUEST`:`COMMAND TO APPROVE IN CODEX`)),Y(e,n)};Z(E,e=>{(!K(a)||!$.data?.control)&&t().fileChanges?.length?e(te):K(a)&&$.data?.control||!t().command&&t().status!==`APPROVAL NEEDED`||e(O,1)});var ne=H(E,2),k=e=>{var n=zs(),r=V(n);U(()=>X(r,`CONTEXT SOURCE // ${(t().source||`LOCAL`)??``} // OBSERVATION`)),Y(e,n)};Z(ne,e=>{K(a)||e(k)}),Y(e,o)},r=L(void 0),i=Wi(t,`params`,19,()=>({})),a=F(()=>$.data?.sessions||[]),o=F(()=>$.data?.control&&$.data.profiles||[]),s=F(()=>($.data?.triggers||[]).filter(e=>K(a).some(t=>t.id===e.session)));function c(e,t){i().id&&i().id!==t&&K(u)?e.preventDefault():w(t)}function l(e){return[`TURN COMPLETE`,`IDLE`,`ACTIVE`].includes(e.status)&&K(s).some(t=>t.session===e.id)?`TRIGGER SET`:e.status}let u=L(!1);function d(e,t){i().id&&i().id!==t&&K(u)?e.preventDefault():w(t)}vn(()=>{let e=i().id;e&&fr(()=>{aa.selected=e,fa(e,2)})});let p=F(()=>K(a).find(e=>e.id===i().id)),m=F(()=>new URLSearchParams(Yi.querystring).get(`review`)===`profile`&&K(o).some(e=>e.session===i().id&&e.pending)),h=F(()=>K(a).some(e=>e.id===aa.selected)?aa.selected:K(a)[0]?.id),v=F(()=>!$.connected||!!$.data?.sessionsError);function y(e){return[`MODEL BUSY`,`TURN FAILED`].includes(e.status)}let b=F(()=>[[`OBSERVED TOKENS`,pa(K(a).reduce((e,t)=>e+t.tokens,0))],[`LISTED SESSIONS`,pa(K(a).length)],...[[`WORKING`,`WORKING`],[`AWAITING APPROVAL`,`APPROVAL NEEDED`],[`AWAITING INPUT`,`INPUT NEEDED`],[`ERRORS`,`ERRORS`],[`CHECK · INFERRED`,`CHECK SESSION`]].map(([e,t])=>[e,K(v)?`—`:pa(K(a).filter(e=>t===`ERRORS`?y(e):e.status===t).length)])]),x=F(()=>K(a).filter(e=>[`INPUT NEEDED`,`APPROVAL NEEDED`].includes(e.status)||y(e)).sort((e,t)=>S(e)-S(t)));function S(e){return e.status===`APPROVAL NEEDED`?0:e.status===`INPUT NEEDED`?1:2}let C=F(()=>K(a).filter(e=>e.status===`TURN COMPLETE`&&!K(s).some(t=>t.session===e.id)&&!K(o).some(t=>t.session===e.id&&t.pending)));function w(e){aa.selected=e,lr().then(()=>document.querySelector(`.session-row.selected`)?.scrollIntoView({block:`nearest`}))}function T(e,t){if(w(e),i().id){t<0&&(fa(e,2),location.hash=`/sessions`);return}let n=ua(e)+t;n>2?location.hash=`/sessions/`+encodeURIComponent(e):fa(e,n)}function E(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`&&i().id)e.preventDefault(),T(i().id,-1);else if([`ArrowLeft`,`ArrowRight`].includes(e.key)&&(i().id||K(h)))e.preventDefault(),T(i().id||K(h),e.key===`ArrowLeft`?-1:1);else if(!i().id&&[`ArrowUp`,`ArrowDown`].includes(e.key)&&K(a).length){e.preventDefault();let t=K(a).findIndex(e=>e.id===K(h));w(K(a)[Math.max(0,Math.min(K(a).length-1,t+(e.key===`ArrowUp`?-1:1)))].id)}}}function D(e){return K(v)?`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.`:y(e)?e.status===`MODEL BUSY`?`CONFIRMED TURN FAILURE — the selected model was at capacity. Choose another model with /model or retry later in Codex. This is not a quota-exhaustion signal.`:`CONFIRMED TURN FAILURE — inspect the error below before sending another prompt. No automatic retry or model change.`:$.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 ee(e){return e.streaming&&e.contextKind===`LAST REPLY`?`REPLY // STREAMING`:e.contextKind||`LAST ACTIVITY`}var te=fc();xr(`keydown`,Qt,E);var O=B(te),ne=V(H(z(O),2));P(O);var k=H(O,2);let re;Xr(k,21,()=>K(b),Kr,(e,t)=>{var n=F(()=>_(K(t),2));let r=()=>K(n)[0],i=()=>K(n)[1];var a=Vs();let o;var s=z(a),c=V(s,!0),l=V(H(s,2),!0);P(a),U(()=>{o=ci(a,1,`svelte-mm4wfe`,null,o,{failed:r()===`ERRORS`&&i()!==`0`&&i()!==`—`}),X(c,r()),X(l,i())}),Y(e,a)}),P(k);var ie=H(k,2),ae=V(ie),oe=H(ie,2),se=e=>{Y(e,Hs())};Z(oe,e=>{K(v)&&e(se)});var A=H(oe,2),ce=e=>{Y(e,Us())};Z(A,e=>{$.data?.profileError&&e(ce)});var le=H(A,2),ue=e=>{var t=qs(),n=z(t);Xr(n,17,()=>K(x),Kr,(e,t)=>{var n=Ws();let r;var i=V(n);U((e,a,o)=>{r=ci(n,1,`button`,null,r,{approval:e}),Q(n,`href`,a),X(i,`${K(t).status??``} + ${o??``} // ${(K(t).name||K(t).directory||K(t).id)??``}`)},[()=>K(t).status===`APPROVAL NEEDED`||K(t).status===`INPUT NEEDED`||y(K(t)),()=>`#/sessions/`+encodeURIComponent(K(t).id),()=>Array.from(K(t).id).slice(-5).join(``).toUpperCase()]),q(`click`,n,()=>w(K(t).id)),Y(e,n)});var r=H(n,2);Xr(r,17,()=>K(o).filter(e=>e.pending&&K(a).some(t=>t.id===e.session)),Kr,(e,t)=>{var n=Gs(),r=V(n);U((e,a,o)=>{Q(n,`title`,i().id&&i().id!==K(t).session&&K(u)?`Finish sending or clear your current draft before switching sessions.`:`Review this session’s quota threshold`),Q(n,`href`,e),X(r,`QUOTA THRESHOLD ${a??``} // ${o??``}`)},[()=>`#/sessions/`+encodeURIComponent(K(t).session)+`?review=profile`,()=>Array.from(K(t).session).slice(-5).join(``).toUpperCase(),()=>K(a).find(e=>e.id===K(t).session)?.name||K(a).find(e=>e.id===K(t).session)?.directory||K(t).session]),q(`click`,n,e=>d(e,K(t).session)),Y(e,n)});var l=H(r,2);Xr(l,17,()=>K(C),Kr,(e,t)=>{var n=Ks(),r=V(n);U((e,i)=>{Q(n,`href`,e),X(r,`TURN COMPLETE ${i??``} // + ${(K(t).name||K(t).directory||K(t).id)??``}`)},[()=>`#/sessions/`+encodeURIComponent(K(t).id),()=>Array.from(K(t).id).slice(-5).join(``).toUpperCase()]),q(`click`,n,()=>w(K(t).id)),Y(e,n)}),Xr(H(l,2),17,()=>K(s),Kr,(e,t)=>{var n=Ks(),r=V(n);U((e,t,i)=>{Q(n,`href`,e),X(r,`TRIGGER SET ${t??``} // ${i??``}`)},[()=>`#/sessions/`+encodeURIComponent(K(t).session),()=>Array.from(K(t).session).slice(-5).join(``).toUpperCase(),()=>K(a).find(e=>e.id===K(t).session)?.name||K(a).find(e=>e.id===K(t).session)?.directory]),q(`click`,n,e=>c(e,K(t).session)),Y(e,n)}),P(t),Y(e,t)},de=F(()=>(K(x).length||K(C).length||K(o).some(e=>e.pending)||K(s).length)&&!K(v));Z(le,e=>{K(de)&&e(ue)});var fe=H(le,2),j=e=>{var t=Nr(),a=B(t),s=e=>{var t=Qs(),a=z(t),s=z(a);let c;var d=z(s);let f;var h=H(d);P(s);var g=H(s,2);P(a);var _=H(a,2),b=e=>{var t=zs(),n=V(t,!0);U(()=>X(n,K(p).directory)),Y(e,t)};Z(_,e=>{K(p).name&&K(p).directory&&e(b)});var x=H(_,2),S=V(x),C=H(x,2);let T;var E=z(C),D=z(E);n(D,()=>K(p),()=>!0,()=>!0),P(E);var ee=H(E,2),te=e=>{var t=Nr();Gr(B(t),()=>K(p).id,e=>{{let t=F(()=>new URLSearchParams(Yi.querystring).get(`schedule`)===`edit`),n=F(()=>K(p).fileChanges||[]);xs(e,{get session(){return K(p).id},oncopy:()=>K(r)?.copy(),get openScheduler(){return K(t)},get observedCommand(){return K(p).command},get observedFileChanges(){return K(n)},get suspended(){return K(m)},onProtectedChange:e=>{R(u,e,!0)}})}}),Y(e,t)},O=e=>{var t=Js();Gr(H(z(t),2),()=>K(p).id,e=>{Po(e,{get session(){return K(p).id},localOnly:!0,oncopy:()=>K(r)?.copy()})}),P(t),Y(e,t)};Z(ee,e=>{$.data?.control?e(te):e(O,-1)}),P(C);var ne=H(C,2);Xr(ne,17,()=>K(o).filter(e=>e.session===K(p).id),e=>e.session,(e,t)=>{var n=Zs(),r=z(n),i=e=>{var n=Ys(),r=V(n,!0);U(()=>X(r,K(t).notice)),Y(e,n)};Z(r,e=>{K(t).notice&&e(i)});var a=H(r,2),o=e=>{xs(e,{get session(){return K(p).id},review:`profile`})},s=e=>{var t=Xs();U(e=>Q(t,`href`,e),[()=>`#/sessions/`+encodeURIComponent(K(p).id)+`?review=profile`]),Y(e,t)};Z(a,e=>{K(t).pending&&K(m)?e(o):K(t).pending&&e(s,1)}),P(n),U(()=>Q(n,`id`,`quota-profile-`+K(p).id)),Y(e,n)});var k=H(ne,2),re=e=>{var t=Nr();Gr(B(t),()=>K(p).id,e=>{Ii(Os(e,{get session(){return K(p)},active:!0}),e=>R(r,e,!0),()=>K(r))}),Y(e,t)};Z(k,e=>{K(m)||e(re)}),Gr(H(k,2),()=>K(p).id,e=>{Es(e,{get session(){return K(p)},get stale(){return K(v)}})}),P(t),U((e,t,n,r)=>{c=ci(s,1,`svelte-mm4wfe`,null,c,{failed:e}),f=ci(d,1,`lamp lit svelte-mm4wfe`,null,f,{failed:t,working:K(p).status===`WORKING`&&!K(v)}),X(h,`${n??``} // ${(K(p).name||K(p).directory)??``}`),X(S,`${r??``} TOKENS // ${K(p).id??``} // CONTEXT SOURCE // ${(K(p).source||`LOCAL`)??``}`),T=ui(C,``,T,{display:K(m)?`none`:void 0})},[()=>y(K(p))&&!K(v)&&!K(m),()=>y(K(p))&&!K(v),()=>K(v)?`STALE`:K(m)?`QUOTA THRESHOLD`:l(K(p)),()=>pa(K(p).tokens)]),q(`click`,g,()=>{w(i().id),fa(i().id,2)}),Y(e,t)},c=e=>{Y(e,$s())};Z(a,e=>{K(p)?e(s):e(c,-1)}),Y(e,t)},pe=e=>{var t=dc(),r=B(t),i=H(z(r),2),s=z(i),c=H(s,2);P(i),P(r);var u=H(r,2);Xr(u,17,()=>K(a),e=>e.id,(e,t)=>{let r=F(()=>ua(K(t).id));var i=lc();let a;var s=z(i),c=z(s),u=e=>{var n=ec(),r=z(n),i=V(r);P(n),U(e=>{Q(r,`aria-pressed`,K(h)===K(t).id),X(i,`${e??``} // ${K(t).name??``}`)},[()=>Array.from(K(t).id).slice(-5).join(``).toUpperCase()]),q(`click`,r,()=>w(K(t).id)),Y(e,n)};Z(c,e=>{K(t).name&&e(u)});var f=H(c,2),p=z(f);let m;var g=z(p);let _;var b=H(g,1,!0);P(p),P(f);var x=H(f,2),S=e=>{var n=tc(),r=V(n,!0);U(()=>{Q(n,`aria-pressed`,K(h)===K(t).id),X(r,K(t).directory||K(t).id)}),q(`click`,n,()=>w(K(t).id)),Y(e,n)};Z(x,e=>{K(t).name||e(S)});var C=H(x,2),E=z(C);xe(),P(C);var D=H(C,2),te=e=>{var n=zs(),r=V(n,!0);U(()=>X(r,K(t).directory)),Y(e,n)};Z(D,e=>{K(t).name&&K(t).directory&&e(te)});var O=H(D,2),ne=V(O),k=H(O,2),re=V(k),ie=H(k,2),ae=z(ie),oe=H(ae,2),se=V(oe,!0),A=H(oe,2);P(ie);var ce=H(ie,2),le=H(ce,2),ue=e=>{var n=nc(),r=V(n,!0);U(e=>X(r,e),[()=>K(t).status===`CHECK SESSION`?`INFERRED INACTIVITY`:y(K(t))?`OPEN DETAIL FOR THE TURN ERROR`:$.data?.control?`OPEN FULL DETAIL OR REPLY IN CODEX`:K(t).status===`APPROVAL NEEDED`?`APPROVE OR DECLINE IN CODEX`:`REPLY IN CODEX`]),Y(e,n)},de=F(()=>!K(v)&&([`APPROVAL NEEDED`,`INPUT NEEDED`,`CHECK SESSION`].includes(K(t).status)||y(K(t))));Z(le,e=>{K(de)&&e(ue)}),P(s);var fe=H(s,2),j=e=>{var r=sc(),i=z(r),a=z(i),s=V(a,!0),c=H(a,2),l=e=>{var n=rc(),r=V(n,!0);U(e=>{Q(n,`href`,e),X(r,$.data?.control?`REVIEW IN FULL DETAIL ↗`:`APPROVAL IN CODEX ↗`)},[()=>`#/sessions/`+encodeURIComponent(K(t).id)]),Y(e,n)};Z(c,e=>{!K(v)&&K(t).status===`APPROVAL NEEDED`&&e(l)}),P(i);var u=H(i,2);n(u,()=>K(t),()=>!1);var f=H(u,2);Xr(f,17,()=>K(o).filter(e=>e.session===K(t).id),Kr,(e,n)=>{var r=oc(),i=B(r),a=e=>{var t=ic(),r=V(t,!0);U(()=>X(r,K(n).notice)),Y(e,t)};Z(i,e=>{K(n).notice&&e(a)});var o=H(i,2),s=e=>{var n=ac();U(e=>Q(n,`href`,e),[()=>`#/sessions/`+encodeURIComponent(K(t).id)+`?review=profile`]),q(`click`,n,e=>d(e,K(t).id)),Y(e,n)};Z(o,e=>{K(n).pending&&e(s)}),Y(e,r)});var p=H(f,2);{let e=F(()=>K(h)===K(t).id);Os(p,{get session(){return K(t)},get active(){return K(e)}})}P(r),U(e=>X(s,e),[()=>ee(K(t))]),Y(e,r)};Z(fe,e=>{K(r)>0&&e(j)});var pe=H(fe,2),me=e=>{var n=cc(),r=H(z(n),2);{let e=F(()=>(K(t).samples||[]).map(e=>e.tokens));io(r,{get values(){return K(e)},capacity:120})}var i=V(H(r,2));P(n),U(()=>X(i,`LAST ${(K(t).samples?.length||0)??``} SAMPLES // AUTO SCALE`)),Y(e,n)};Z(pe,e=>{K(r)<2&&e(me)}),P(i),U((e,n,o,s,c,l,u)=>{a=ci(i,1,`session-row`,null,a,{selected:K(h)===K(t).id,wide:K(r)===2,split:K(r)===1}),Q(i,`aria-label`,`Session `+(K(t).name||K(t).directory||K(t).id)),m=ci(p,1,`status-detail svelte-mm4wfe`,null,m,{failed:e}),Q(p,`href`,n),_=ci(g,1,`lamp lit svelte-mm4wfe`,null,_,{failed:o,working:K(t).status===`WORKING`&&!K(v)}),X(b,s),X(E,`${c??``} `),X(ne,`${K(t).agents??``} LINKED AGENTS`),X(re,`ACTIVE // ${l??``}`),ae.disabled=K(r)===0,Q(oe,`aria-expanded`,K(r)>0),X(se,K(r)?`HIDE DETAIL`:`SHOW DETAIL`),Q(ce,`href`,u)},[()=>y(K(t))&&!K(v),()=>`#/sessions/`+encodeURIComponent(K(t).id),()=>y(K(t))&&!K(v),()=>K(v)?`STALE`:l(K(t)),()=>pa(K(t).tokens),()=>ma(K(t).activity),()=>`#/sessions/`+encodeURIComponent(K(t).id)]),q(`click`,p,()=>w(K(t).id)),q(`click`,ae,()=>T(K(t).id,-1)),q(`click`,oe,()=>{w(K(t).id),fa(K(t).id,+!K(r))}),q(`click`,A,()=>T(K(t).id,1)),q(`click`,ce,()=>w(K(t).id)),Y(e,i)});var f=H(u,2),p=e=>{Y(e,uc())};Z(f,e=>{K(a).length||e(p)}),q(`click`,s,()=>da(1)),q(`click`,c,()=>da(0)),Y(e,t)};Z(fe,e=>{i().id?e(j):e(pe,-1)}),U(e=>{X(ne,`OBSERVED ${e??``}`),re=ci(k,1,`session-totals`,null,re,{stale:K(v)}),X(ae,`${K(v)?`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.`)},[()=>ma($.data?.sessionsAt)]),Y(e,te),We()}Sr([`click`]);var mc=J(`

        `),hc=J(`

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

        `,1),gc=J(`// APPROXIMATE`),_c=J(`

        Partial accounting: totals may still change.

        `),vc=J(`

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

        `,1),yc=J(`

        `,1),bc=J(`

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

        `),xc=J(`
        `),Sc=J(`
        `),Cc=J(`

        No usage reported for this day.

        `),wc=J(`

        Selected breakdown unavailable; missing does not mean zero.

        `),Tc=J(`

        `,1);function Ec(e,t){Ue(t,!0);let n=L(`surface`),r=L(0),i=F(()=>t.reports?.daily),a=F(()=>t.reports?.plan),o=F(()=>t.mode===`breakdown`?K(i)?.days.length||0:K(a)?.periods.length||0),s=F(()=>Math.min(K(r),Math.max(0,K(o)-1))),c=F(()=>K(i)?.days[(K(i)?.days.length||0)-1-K(s)]),l=F(()=>K(a)?.periods[K(s)]),u=F(()=>t.mode===`breakdown`?K(i)?.units||``:`%`),d=F(()=>{let e=Object.create(null);if(t.mode===`breakdown`)e=K(c)?.groups[K(n)]||{};else{let t=K(n)===`feature`?`thread_source`:K(n)===`task start`?`turn_trigger`:K(n);for(let n of K(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=F(()=>t.mode===`breakdown`?K(c)?.total:K(l)?.used_basis_points==null?null:K(l).used_basis_points/100),p=F(()=>Math.max(1,K(f)||0,...K(d).map(([,e])=>e))),m=e=>e==null?`UNKNOWN`:e.toLocaleString(`en-GB`,{maximumFractionDigits:2});var h=Tc(),g=B(h),v=z(g),y=H(z(v)),b=z(y);b.value=b.__value=`surface`;var x=H(b);x.value=x.__value=`model`;var S=H(x);S.value=S.__value=`feature`;var C=H(S);C.value=C.__value=`task start`,P(y),mi(y),P(v);var w=H(v,2),T=H(w,2),E=V(H(T,2),!0);P(g);var D=H(g,2),ee=z(D),te=V(ee,!0),O=H(ee,2),ne=V(O),k=H(O,2),re=e=>{var t=hc(),n=B(t),r=V(n),a=H(n,2),o=e=>{var t=mc(),n=V(t);U(()=>X(n,`Data as of ${K(i).dataAsOf??``}`)),Y(e,t)};Z(a,e=>{K(i).dataAsOf&&e(o)});var s=V(H(a,2));xe(2),U((e,t)=>{X(r,`Latest fetch ${e??``} // queried ${K(i).from??``} → ${K(i).through??``}. + Reports are fetched from OpenAI and are not saved between runs.`),X(s,`${(K(c)?.date||`No daily buckets reported`)??``} // ${t??``} + ${K(u)??``}`)},[()=>ma(K(i).fetchedAt),()=>m(K(f))]),Y(e,t)},ie=e=>{var t=yc(),n=B(t),r=z(n);let i;var o=V(r,!0),s=H(r),c=e=>{Y(e,gc())};Z(s,e=>{K(a).approximate&&e(c)});var u=H(s);P(n);var d=H(n,2),p=z(d),h=H(p),g=e=>{var t=Mr();U(()=>X(t,`// Boundary tolerance ${K(a).boundary_tolerance_seconds??``}s`)),Y(e,t)};Z(h,e=>{K(a).boundary_tolerance_seconds!=null&&e(g)}),P(d);var _=H(d,2),v=e=>{var t=vc(),n=B(t),r=z(n),i=H(r);let a;var o=V(i);P(n);var s=H(n,2),c=V(s),u=H(s,2),d=e=>{Y(e,_c())};Z(u,e=>{K(l).accounting_complete||e(d)}),xe(2),U(e=>{X(r,`${K(l).window_minutes??``} MIN // ${K(l).plan_type??``} // `),a=ci(i,1,`svelte-1fbui7h`,null,a,{muted:K(f)==null,"quota-near":K(f)!=null&&K(f)>=80&&K(f)<100,"quota-full":K(f)!=null&&K(f)>=100}),X(o,`USED ${e??``}${K(f)==null?``:`%`}`),X(c,`${K(l).starts_at??``} → ${K(l).ends_at??``}`)},[()=>m(K(f))]),Y(e,t)};Z(_,e=>{K(l)&&e(v)}),U(e=>{i=ci(r,1,`svelte-1fbui7h`,null,i,{"quality-warning":!K(a).coverage_complete}),X(o,K(a).coverage_complete?`Reported range complete`:`Partial coverage`),X(u,` // Latest fetch ${e??``}`),X(p,`Coverage starts ${(K(a).coverage_start||`unknown`)??``} // Data as of ${(K(a).data_as_of||`unknown`)??``}`)},[()=>ma(K(a).fetchedAt)]),Y(e,t)},ae=e=>{Y(e,bc())};Z(k,e=>{t.mode===`breakdown`&&K(i)?e(re):t.mode===`periods`&&K(a)?e(ie,1):e(ae,-1)});var oe=H(k,2),se=e=>{var n=Sc(),r=z(n),i=V(H(z(r),2),!0);P(r),Xr(H(r,2),17,()=>K(d),Kr,(e,n,r)=>{var i=F(()=>_(K(n),2));let a=()=>K(i)[0],o=()=>K(i)[1];var s=xc();let c;var l=z(s),u=V(l,!0),d=H(l,2),f=z(d);let h;P(d);var g=V(H(d,2));P(s),U((e,n,i)=>{c=ci(s,1,`report-row svelte-1fbui7h`,null,c,{unknown:e,alternate:r%2==1}),Q(l,`title`,a()),X(u,a()),h=ui(f,``,h,{width:n}),X(g,`${i??``}${t.mode===`periods`?`%`:``}`)},[()=>a().trim().toLowerCase()===`unknown`,()=>`${Math.max(0,100*o()/K(p))}%`,()=>m(o())]),Y(e,s)}),P(n),U(()=>X(i,t.mode===`breakdown`?K(u):`QUOTA USED`)),Y(e,n)},A=e=>{Y(e,Cc())},ce=e=>{Y(e,wc())};Z(oe,e=>{K(d).length?e(se):t.mode===`breakdown`&&K(c)?.total===0&&K(c)?.groups[K(n)]!=null?e(A,1):(K(i)&&t.mode===`breakdown`||K(a)&&t.mode===`periods`)&&e(ce,2)}),P(D),U(()=>{w.disabled=K(s)>=K(o)-1,T.disabled=K(s)===0,X(E,K(o)?`${K(s)+1} / ${K(o)}`:`NO DATA`),X(te,t.mode===`breakdown`?`DAILY BREAKDOWN`:`QUOTA WINDOWS`),X(ne,`${(t.mode===`breakdown`?t.reports?.dailyStatus||`UNAVAILABLE`:t.reports?.planStatus||`UNAVAILABLE`)??``} // UTC`)}),hi(y,()=>K(n),e=>R(n,e)),q(`click`,w,()=>R(r,K(s)+1)),q(`click`,T,()=>R(r,K(s)-1)),Y(e,h),We()}Sr([`click`]);var Dc=864e5;function Oc(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 kc(e,t,n){let r=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));for(let e=0;;e++){let i=Oc(r,-t),a=new Date(i.getTime()+Dc);if(e===n)return{start:a,end:r};r=i}}var Ac=J(``),jc=J(``,1),Mc=J(`

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

        `),Nc=J(`

        Token history unavailable; other reports may still be available.

        `),Pc=J(``),Fc=J(`
        `),Ic=J(`

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

        `,1),Lc=J(`
        `,1),Rc=J(` `),zc=J(`

        LIFETIME TOKENS

        PEAK DAY

        CURRENT STREAK

        DAYS

        LONGEST TURN

        SECONDS

        LONGEST STREAK

        DAYS

        OPENAI // UTC

        Accessible data table
        Date (UTC)Tokens

        `,1),Bc=J(`

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

        `),Vc=J(`

        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 Hc(e,t){Ue(t,!0);let n=L(`daily`),r=L(12),i=L(0),a=F(()=>{let e=$.data?.usage?.dailyUsageBuckets;if(!e)return[];let{start:t,end:n}=kc(new Date,K(r),K(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=F(()=>Math.max(1,...K(a).map(e=>e.tokens))),s=F(()=>K(a).length?new Date(K(a)[0].date+`T00:00:00Z`).getUTCDay():0),c=F(()=>{if(K(n)===`monthly`){let e=new Map;for(let t of K(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 K(a).map(t=>({date:t.date,tokens:e+=t.tokens}))});var l=Vc(),u=H(B(l),4);Xr(u,20,()=>[[`daily`,`Daily`],[`monthly`,`Monthly`],[`cumulative`,`Cumulative`],[`breakdown`,`Breakdown`],[`periods`,`Windows`]],Kr,(e,t)=>{var r=F(()=>_(t,2));let a=()=>K(r)[0],o=()=>K(r)[1];var s=Ac();let c;var l=V(s,!0);U(()=>{Q(s,`aria-pressed`,K(n)===a()),c=ci(s,1,``,null,c,{active:K(n)===a()}),X(l,o())}),q(`click`,s,()=>{R(n,a(),!0),R(i,0)}),Y(e,s)}),P(u);var d=H(u,2),f=z(d),p=e=>{var t=jc(),n=B(t),a=H(z(n)),o=z(a);o.value=o.__value=6;var s=H(o);s.value=s.__value=12,P(a),mi(a),P(n);var c=H(n),l=H(c);U(()=>l.disabled=K(i)===0),q(`change`,a,()=>R(i,0)),hi(a,()=>K(r),e=>R(r,e)),q(`click`,c,()=>Kt(i)),q(`click`,l,()=>Kt(i,-1)),Y(e,t)};Z(f,e=>{K(n)!==`breakdown`&&K(n)!==`periods`&&e(p)}),P(d);var m=H(d,2),h=e=>{Y(e,Mc())};Z(m,e=>{$.data?.usageError&&e(h)});var g=H(m,2),v=e=>{Y(e,Nc())};Z(g,e=>{$.data?.usage?.tokenStatus===`UNAVAILABLE`&&K(n)!==`breakdown`&&K(n)!==`periods`&&e(v)});var y=H(g,2),b=e=>{var t=Nr();Gr(B(t),()=>K(n),e=>{{let t=F(()=>$.data?.usage?.reports);Ec(e,{get reports(){return K(t)},get mode(){return K(n)}})}}),Y(e,t)},x=e=>{var t=zc(),r=B(t),i=z(r),l=V(H(z(i),2),!0);P(i);var u=H(i,2),d=V(H(z(u),2),!0);P(u);var f=H(u,2),p=H(z(f),2),m=z(p);xe(),P(p),P(f);var h=H(f,2),g=H(z(h),2),_=z(g);xe(),P(g),P(h);var v=H(h,2),y=H(z(v),2),b=z(y);xe(),P(y),P(v),P(r);var x=H(r,4),S=z(x),C=V(S),w=H(S,2),T=e=>{var t=Ic(),n=B(t),r=z(n),i=z(r);Xr(i,17,()=>Array(K(s)),Kr,(e,t)=>{Y(e,Pc())}),Xr(H(i,2),17,()=>K(a),Kr,(e,t)=>{var n=Fc();let r,i;U(e=>{r=ci(n,1,`heat-cell`,null,r,{zero:K(t).tokens===0}),Q(n,`title`,e),i=ui(n,``,i,{opacity:K(t).tokens?.25+.75*K(t).tokens/K(o):1})},[()=>`${K(t).date}: ${pa(K(t).tokens)} tokens`]),Y(e,n)}),P(r),P(n),xe(2),Y(e,t)},E=e=>{var t=Lc(),r=B(t);{let e=F(()=>K(c).map(e=>e.tokens)),t=F(()=>K(n)+` usage`);io(r,{get values(){return K(e)},get label(){return K(t)}})}var i=H(r,2),a=z(i),o=V(a,!0),s=V(H(a),!0);P(i),U(e=>{X(o,K(c)[0]?.date),X(s,e)},[()=>K(c).at(-1)?.date]),Y(e,t)};Z(w,e=>{K(n)===`daily`?e(T):e(E,-1)});var D=H(w,2),ee=H(z(D),2),te=z(ee),O=H(z(te));Xr(O,21,()=>K(n)===`daily`?K(a):K(c),Kr,(e,t)=>{var n=Rc(),r=z(n),i=V(r,!0),a=V(H(r),!0);P(n),U(e=>{X(i,K(t).date),X(a,e)},[()=>pa(K(t).tokens)]),Y(e,n)}),P(O),P(te),P(ee),P(D),P(x);var ne=V(H(x,2));U((e,t,n,r,i,o,s)=>{X(l,e),X(d,t),X(m,`${n??``} `),X(_,`${r??``} `),X(b,`${i??``} `),X(C,`${K(a)[0]?.date??``} — ${o??``}`),X(ne,`OBSERVED ${s??``} // CUMULATIVE IS FOR THE SELECTED PERIOD`)},[()=>pa($.data.usage.summary.lifetimeTokens),()=>pa($.data.usage.summary.peakDailyTokens),()=>pa($.data.usage.summary.currentStreakDays),()=>pa($.data.usage.summary.longestRunningTurnSec),()=>pa($.data.usage.summary.longestStreakDays),()=>K(a).at(-1)?.date,()=>ma($.data.usageAt)]),Y(e,t)},S=e=>{Y(e,Bc())};Z(y,e=>{K(n)===`breakdown`||K(n)===`periods`?e(b):$.data?.usage&&$.data.usage.dailyUsageBuckets!==null?e(x,1):e(S,-1)}),Y(e,l),We()}Sr([`click`,`change`]);var Uc=J(`

        Page not found

        Return to Quota

        `,1);function Wc(e){var t=Uc();xe(2),Y(e,t)}var Gc=`CODEXOMETER`,Kc=[`█▀▀ █▀█ █▀▄ █▀▀ ▀▄▀ █▀█ █▀▄▀█ █▀▀ ▀█▀ █▀▀ █▀█`,`█▄▄ █▄█ █▄▀ ██▄ █ █ █▄█ █ ▀ █ ██▄ █ ██▄ █▀▄`].flatMap(e=>[[...e].map(e=>e===`█`||e===`▀`),[...e].map(e=>e===`█`||e===`▄`)]),qc=Kc[0].length,Jc=Kc.length,Yc=0,Xc=[...Gc].map(e=>{let t=e===`M`?5:3,n={start:Yc,width:t};return Yc+=t+1,n}),Zc=`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`,Qc=`010 101 111 101.110 111 101 110.111 100 100 111.110 101 101 110.111 100 110 111.111 100 110 100.111 100 101 111.101 101 111 101.111 010 010 111.001 001 101 111.101 110 110 101.100 100 100 111.101 111 101 101.101 111 111 101.111 101 101 111.111 101 111 100.111 101 111 001.111 101 110 101.111 100 001 111.111 010 010 010.101 101 101 111.101 101 101 010.101 101 111 101.101 010 010 101.101 101 010 010.111 001 100 111.111 101 101 111.110 010 010 111.111 001 110 111.111 011 001 111.101 101 111 001.111 110 001 111.100 111 101 111.111 001 010 010.111 111 101 111.111 101 111 001`.split(`.`).map(e=>e.split(` `));function $c(e=Gc,t=-1,n=!1){let r=``;for(let i=0;i{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}function rl(){let e=el[Math.floor(Math.random()*el.length)],t=Math.floor(Math.random()*4294967296),n=nl(t),r=[...Gc].map((e,t)=>t);for(let e=r.length-1;e>0;e--){let t=Math.floor(n()*(e+1));[r[e],r[t]]=[r[t],r[e]]}return{variant:e,seed:t,order:r}}function il(e,t){if(e.variant===`typing`){let e=t<1080,n=e?0:Math.min(Math.floor((t-1080)/90)+1,11);return{text:Gc.slice(0,n).padEnd(11),cursor:n,dot:e?Math.floor(t/180)%2==0:n<11}}if(e.variant===`shuffle`){let n=nl(e.seed^Math.floor(t/70)),r=[...Gc].map(e=>{let t;do t=Zc[Math.floor(n()*36)];while(t===e);return t}),i=Math.min(Math.floor(t/110),11);for(let t of e.order.slice(0,i))r[t]=Gc[t];return{text:r.join(``),cursor:-1,dot:!1}}return{text:Gc,cursor:-1,dot:!1}}var al=jr(``);function ol(e,t){Ue(t,!0);let n=Wi(t,`text`,3,Gc),r=Wi(t,`cursor`,19,()=>-1),i=Wi(t,`dot`,3,!1),a=F(()=>$c(n(),r(),i()));var o=al(),s=V(o);U(()=>{Q(o,`viewBox`,`0 0 ${qc} ${Jc}`),Q(o,`width`,qc),Q(o,`height`,Jc),Q(s,`d`,K(a))}),Y(e,o),We()}var sl=J(`
        `),cl=J(`
        `);function ll(e,t){Ue(t,!0);let n=L(void 0),r=L(0),i=L(Yt({width:0,height:0,pixelRatio:1})),a=L(Yt({x:0,y:0,width:0})),o=F(()=>K(n)?il(K(n),K(r)):void 0),s=F(()=>{if(!K(n))return{x:0,y:0,width:0};let e=tl[K(n).variant],t=Math.min(Math.max((K(r)-e-180)/800,0),1),o=t*t*(3-2*t),s=K(i).width+(K(a).width-K(i).width)*o,c=Math.max((K(i).height-K(i).width*Jc/qc)/2,0),l=(K(n).variant===`slide`&&K(r)Math.round(e*K(i).pixelRatio)/K(i).pixelRatio;return{x:d(l),y:d(u),width:d(s)}});Gi(()=>{let e=matchMedia(`(prefers-reduced-motion: reduce)`);if(e.matches){t.onfinish();return}R(n,rl(),!0);let o=tl[K(n).variant]+180+800,s=0,c=!1,l=performance.now(),u=()=>{let e=t.target?.getBoundingClientRect();R(i,{width:window.innerWidth,height:window.innerHeight,pixelRatio:window.devicePixelRatio||1},!0),e&&R(a,{x:e.x,y:e.y,width:e.width},!0)},d=()=>{c||(c=!0,cancelAnimationFrame(s),t.onfinish())},f=e=>{e instanceof PointerEvent&&e.button!==0||e instanceof KeyboardEvent&&(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)||e instanceof KeyboardEvent&&[`Shift`,`Control`,`Alt`,`Meta`].includes(e.key)||(e.preventDefault(),e.stopImmediatePropagation(),d())},p=()=>{e.matches&&d()},m=e=>{R(r,Math.max(e-l,0),!0),K(r)>=o?d():s=requestAnimationFrame(m)},h=new ResizeObserver(u);if(t.target){h.observe(t.target),t.target.parentElement&&h.observe(t.target.parentElement);let e=t.target.closest(`header`);e&&h.observe(e)}return u(),window.addEventListener(`resize`,u),document.addEventListener(`keydown`,f,!0),document.addEventListener(`pointerdown`,f,!0),e.addEventListener(`change`,p),s=requestAnimationFrame(m),()=>{c=!0,cancelAnimationFrame(s),h.disconnect(),window.removeEventListener(`resize`,u),document.removeEventListener(`keydown`,f,!0),document.removeEventListener(`pointerdown`,f,!0),e.removeEventListener(`change`,p)}});var c=cl(),l=z(c),u=e=>{var t=sl();let n;ol(z(t),{get text(){return K(o).text},get cursor(){return K(o).cursor},get dot(){return K(o).dot}}),P(t),U(()=>{Q(t,`data-text`,K(o).text),Q(t,`data-cursor`,K(o).dot?K(o).cursor:void 0),n=ui(t,``,n,{left:`${K(s).x}px`,top:`${K(s).y}px`,width:`${K(s).width}px`})}),Y(e,t)};Z(l,e=>{K(o)&&e(u)});var d=H(l,2);P(c),U(()=>Q(c,`data-entrance`,K(n)?.variant)),q(`click`,d,function(...e){t.onfinish?.apply(this,e)}),Y(e,c),We()}Sr([`click`]);var ul=J(` `),dl=J(`

        `),fl=J(`

        Connecting to your local Codexometer…

        `),pl=J(``),ml=J(`

        Your quota. Your sessions. Your command centre.

        `);function hl(e,t){Ue(t,!0);let n={"/":to,"/quota/:view?":to,"/sessions/:id?":pc,"/usage":Hc,"*":Wc},r={quota:/^(?:\/|\/quota(?:\/[^/]+)?\/?)$/,sessions:/^\/sessions(?:\/[^/]+)?\/?$/,usage:/^\/usage\/?$/},i=L(`hacker`),a=L(!0),o=L(void 0);vn(()=>{sa.requests&&lr().then(()=>{K(o)?.focus(),K(o)?.scrollIntoView({block:`nearest`})})});let s=L(void 0),c=[`hacker`,`rust`,`blue-steel`,`ultraviolet`,`nightshade`];vn(()=>{ca()}),vn(()=>{if($.data)for(let[e,t]of Object.entries(r))t.test(Yi.location)&&(aa.tab=e)}),Gi(()=>{try{let e=localStorage.getItem(`codexometer.web.theme`);e&&c.includes(e)&&R(i,e,!0)}catch{}return ya()});function l(){try{localStorage.setItem(`codexometer.web.theme`,K(i))}catch{}}var u=ml(),d=z(u),f=z(d),p=z(f);ol(z(p),{}),P(p),Ii(p,e=>R(s,e),()=>K(s)),xe(2),P(f);var m=H(f,2),h=z(m);let g;var v=H(h,1,!0),y=V(H(v));P(m),P(d);var b=H(d,2);Xr(b,21,()=>Object.entries(r),Kr,(e,t)=>{var n=F(()=>_(K(t),2));let r=()=>K(n)[0],i=()=>K(n)[1],a=F(()=>i().test(Yi.location));var o=ul();let s;var c=V(o,!0);U(e=>{Q(o,`href`,r()===`quota`?`#/quota/`+aa.view:`#/`+r()),Q(o,`aria-current`,K(a)?`page`:void 0),s=ci(o,1,``,null,s,{active:K(a)}),X(c,e)},[()=>r().toUpperCase()]),Y(e,o)}),P(b);var x=H(b,2),S=z(x),C=e=>{var t=dl(),n=V(t,!0);U(()=>X(n,$.error)),Y(e,t)};Z(S,e=>{$.error&&e(C)});var w=H(S,2),T=e=>{$i(e,{get routes(){return n}})},E=e=>{Y(e,fl())};Z(w,e=>{$.data?e(T):$.error||e(E,1)}),P(x);var D=H(x,2),ee=z(D),te=V(ee),O=H(ee,2),ne=V(O,!0),k=H(O,2),re=H(z(k));Xr(re,21,()=>c,Kr,(e,t)=>{var n=pl(),r=V(n,!0),i={};U(e=>{X(r,e),i!==(i=K(t))&&(n.value=(n.__value=i)??``)},[()=>K(t).replace(`-`,` `).toUpperCase()]),Y(e,n)}),P(re),Ii(re,e=>R(o,e),()=>K(o)),mi(re),P(k),P(D);var ie=H(D,2),ae=e=>{ll(e,{get target(){return K(s)},onfinish:()=>R(a,!1)})};Z(ie,e=>{K(a)&&e(ae)}),P(u),U(()=>{Q(u,`data-theme`,K(i)),Q(u,`data-starting`,K(a)),d.inert=K(a),g=ci(h,1,`lamp`,null,g,{lit:$.connected}),X(v,$.connected?`CONNECTED`:`OFFLINE`),X(y,`EXPERIMENTAL // ${$.data?.control?`SESSION CONTROL`:`READ ONLY`}`),b.inert=K(a),x.inert=K(a),D.inert=K(a),X(te,`v${($.data?.version||`…`)??``} // LOCAL ONLY`),X(ne,$.data?.control?`Session control enabled. Stop the server to revoke access.`:`No actions can be sent from this preview.`)}),q(`change`,re,l),hi(re,()=>K(i),e=>R(i,e)),Y(e,u),We()}Sr([`change`]),zr(hl,{target:document.getElementById(`app`)}); \ No newline at end of file diff --git a/internal/web/dist/index.html b/internal/web/dist/index.html index 9845735..efe56cb 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/session_failure_test.go b/internal/web/session_failure_test.go new file mode 100644 index 0000000..2fe1d10 --- /dev/null +++ b/internal/web/session_failure_test.go @@ -0,0 +1,17 @@ +package web + +import ( + "github.com/merefield/codexometer/internal/codex" + "testing" +) + +func TestSessionFailurePresentation(t *testing.T) { + row := codex.LiveUsageSession{Attention: codex.SessionAttentionError, Context: codex.SessionContext{Kind: codex.SessionContextFailure, FailureCode: "serverOverloaded"}} + if sessionStatus(row) != "MODEL BUSY" || contextKind(row.Context.Kind) != "TURN ERROR" { + t.Fatal("capacity failure not exposed") + } + row.Context.FailureCode = "httpConnectionFailed" + if sessionStatus(row) != "TURN FAILED" { + t.Fatal("generic failure mislabeled") + } +} diff --git a/internal/web/state.go b/internal/web/state.go index bf3f7e4..3b33891 100644 --- a/internal/web/state.go +++ b/internal/web/state.go @@ -371,6 +371,8 @@ func sessionStatus(s codex.LiveUsageSession) string { return "APPROVAL NEEDED" case codex.SessionAttentionCheck: return "CHECK SESSION" + case codex.SessionAttentionError: + return codex.SessionFailureLabel(s.Context) case codex.SessionAttentionComplete: return "TURN COMPLETE" } @@ -385,6 +387,8 @@ func sessionStatus(s codex.LiveUsageSession) string { func contextKind(k codex.SessionContextKind) string { switch k { + case codex.SessionContextFailure: + return "TURN ERROR" case codex.SessionContextReply: return "LAST REPLY" case codex.SessionContextApproval: diff --git a/intro-post.md b/intro-post.md index df5df44..788580d 100644 --- a/intro-post.md +++ b/intro-post.md @@ -115,6 +115,8 @@ Use `--reset-warning-hours 24` to warn one day ahead, or `--reset-warning-hours Expiry warnings are reminders to review, not instructions to reset immediately. Confirmation warns that unused allowance does not carry over or stack and that the weekly schedule changes. Missing or incomplete expiry information is explicitly flagged: no warning is not proof that nothing expires soon, and undisclosed credits may expire sooner. +Confirmed turn failures also get their own **ERRORS** category: **MODEL BUSY** for model-capacity failures, or **TURN FAILED** with the observed explanation. Click the warning pill to inspect the session. Retrying errors stay **WORKING**; **INPUT NEEDED** means an actual blocking question, not merely a completed turn. The terminal and browser use the same failure detection, with no automatic retry or model switch. + ## An experimental browser companion Prefer a browser window? `codexometer --web` now offers an **experimental, diff --git a/web/src/Sessions.svelte b/web/src/Sessions.svelte index c601693..d1f5d63 100644 --- a/web/src/Sessions.svelte +++ b/web/src/Sessions.svelte @@ -65,6 +65,9 @@ : sessions[0]?.id, ); let stale = $derived(!live.connected || !!live.data?.sessionsError); + function isFailure(session: Session) { + return ['MODEL BUSY', 'TURN FAILED'].includes(session.status); + } // Parent rows already include linked-agent usage. Sum each listed row once; // do not add agent counts or activity samples to its observed token counter. let totals = $derived([ @@ -74,15 +77,41 @@ ['WORKING', 'WORKING'], ['AWAITING APPROVAL', 'APPROVAL NEEDED'], ['AWAITING INPUT', 'INPUT NEEDED'], + ['ERRORS', 'ERRORS'], ['CHECK · INFERRED', 'CHECK SESSION'], ].map(([label, status]) => [ label, - stale ? '—' : number(sessions.filter((s) => s.status === status).length), + stale + ? '—' + : number( + sessions.filter((s) => + status === 'ERRORS' ? isFailure(s) : s.status === status, + ).length, + ), ]), ]); let attention = $derived( - sessions.filter((s) => - ['INPUT NEEDED', 'APPROVAL NEEDED', 'CHECK SESSION'].includes(s.status), + sessions + .filter( + (s) => + ['INPUT NEEDED', 'APPROVAL NEEDED'].includes(s.status) || + isFailure(s), + ) + .sort((a, b) => attentionRank(a) - attentionRank(b)), + ); + function attentionRank(s: Session) { + return s.status === 'APPROVAL NEEDED' + ? 0 + : s.status === 'INPUT NEEDED' + ? 1 + : 2; + } + let completed = $derived( + sessions.filter( + (s) => + s.status === 'TURN COMPLETE' && + !triggers.some((t) => t.session === s.id) && + !profiles.some((p) => p.session === s.id && p.pending), ), ); @@ -151,6 +180,10 @@ return 'Last observation only — refresh unavailable. Check Codex for current state.'; if (session.status === 'CHECK SESSION') return 'INFERRED INACTIVITY — a quiet session, not a confirmed input or approval request. Local tools may still be running.'; + if (isFailure(session)) + return session.status === 'MODEL BUSY' + ? 'CONFIRMED TURN FAILURE — the selected model was at capacity. Choose another model with /model or retry later in Codex. This is not a quota-exhaustion signal.' + : 'CONFIRMED TURN FAILURE — inspect the error below before sending another prompt. No automatic retry or model change.'; if ( live.data?.control && ['APPROVAL NEEDED', 'INPUT NEEDED'].includes(session.status) @@ -191,7 +224,7 @@
        {session.approvalContext}

        {/if} - {#if explanation(session) && (!full || stale || session.status === 'CHECK SESSION')}

        @@ -245,7 +278,9 @@ OBSERVED {date(live.data?.sessionsAt)}

        - {#each totals as [label, value]}
        + {#each totals as [label, value]}
        {label}
        {value}
        {/each} @@ -265,13 +300,15 @@ verified quota and settings can be updated; previous outcome notices remain visible.

        {/if} -{#if (attention.length || profiles.some((p) => p.pending) || triggers.length) && !stale}