prreviewbuddy 0.87.2 → 0.88.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.88.1
4
+
5
+ **One change to a review at a time, from anywhere on the Reviews list.** While a change made from a
6
+ card's pills, its `…` menu or the selection bar is still being saved, that review's pills and its
7
+ menu's Mark, lifecycle and queue items are dimmed and do nothing. Before, a pill and the menu could
8
+ both send a change, and the card could end up showing the one that was not kept. A selection that
9
+ includes such a review says so and waits to be tried again.
10
+
11
+ **Pressing a pill no longer pulls focus back.** If you move to the search box or another card while
12
+ a pill's change is being saved, focus stays where you put it.
13
+
14
+ ## 0.88.0
15
+
16
+ **Status and lifecycle are pills you can press.** On every Reviews card and in a review's header,
17
+ the status pill (Not reviewed or Reviewed) and the lifecycle pill (Active, Waiting or Done) now
18
+ change what they show. Press Not reviewed to mark the review reviewed, and Reviewed to take that
19
+ back. Press Active to mark it done, and Done to move it back to active. Waiting has more than one
20
+ way out, so its pill opens a short list: Move to active or Mark done. The pill keeps its words and
21
+ dims until the change is saved, and if it could not be saved, a notice says why. Every item in the
22
+ `…` menu is still there.
23
+
24
+ **Every review shows its lifecycle.** Active now has a pill of its own, so a card always says where
25
+ it stands next: blue for Active, amber for Waiting and slate for Done. "Changed while waiting" and
26
+ "Changed since done" stay beside the pills as their own badge, a little stronger than before, so a
27
+ parked review that moved is easy to find in a long list.
28
+
29
+ **What is left on a card is easier to scan.** All issues resolved and all questions answered show
30
+ as green badges, and open issues or unanswered questions as amber ones. "Nothing flagged" stays
31
+ plain text, because a review that raised nothing has nothing to resolve. "Branch updated" is now a
32
+ small purple badge.
33
+
3
34
  ## 0.87.2
4
35
 
5
36
  **The compact sidebar shows what is left on Issues and Questions.** With the sidebar folded to its
@@ -6097,22 +6097,25 @@ function parseLifecycle(raw) {
6097
6097
  function lifecycleAction(lifecycle) {
6098
6098
  return LIFECYCLES.find((entry) => entry.id === lifecycle).action;
6099
6099
  }
6100
+ /** A lifecycle's name, which is what its pill says on the card and on the review page. */
6101
+ function lifecycleName(lifecycle) {
6102
+ return LIFECYCLES.find((entry) => entry.id === (lifecycle?.state ?? "active")).name;
6103
+ }
6100
6104
  /**
6101
- * The review page's lifecycle pill, or absent for Active, which says nothing (as an open pull
6102
- * request says nothing). A parked review that has changed since reads as the card's chip does, so
6103
- * the page and the list give one answer about the same review.
6105
+ * What pressing the lifecycle pill does. Active and Done each have one way out that the pill can
6106
+ * name, so the pill is that action. Waiting has two (back to Active, or Done) and a third once the
6107
+ * branch moved (settle it), so it opens a menu of the items `offersLifecycle` allows rather than
6108
+ * guessing one. Waiting is never collapsed into Active here: the menu is the same transitions the
6109
+ * `…` menu offers.
6104
6110
  */
6105
- function lifecyclePill(lifecycle, activity) {
6106
- if (!lifecycle) return void 0;
6107
- const chip = lifecycleChip(lifecycle, activity);
6108
- if (chip !== void 0) return {
6109
- text: chip,
6110
- changed: true
6111
- };
6112
- return {
6113
- text: LIFECYCLES.find((entry) => entry.id === lifecycle.state).name,
6114
- changed: false
6115
- };
6111
+ function lifecyclePillAction(lifecycle) {
6112
+ if (lifecycle?.state === "waiting") return "menu";
6113
+ return lifecycle?.state === "done" ? "active" : "done";
6114
+ }
6115
+ /** The pill's accessible name: the state it shows, then what pressing it does. */
6116
+ function lifecyclePillLabel(lifecycle) {
6117
+ const action = lifecyclePillAction(lifecycle);
6118
+ return `${lifecycleName(lifecycle)}. ${action === "menu" ? "Choose what happens next" : lifecycleAction(action)}`;
6116
6119
  }
6117
6120
  var ACTIVITY_LABELS = {
6118
6121
  created: "Created",
@@ -20457,4 +20460,4 @@ function lineageIds(id) {
20457
20460
  return [.../* @__PURE__ */ new Set([id, ...lineage.map((review) => review.id)])];
20458
20461
  }
20459
20462
  //#endregion
20460
- export { MAX_WORKSPACE_PORT as $, resolveBase as $i, fillFileUrlTemplate as $n, createWithMembers as $r, markAllRead as $t, relativeTime as A, currentGradeIn as Ai, CODE_COPY_CLASS as An, mutateWorkspace as Ar, checkArchitecture as At, readIndexToken as B, statusLookup as Bi, isWorktreeHeld as Bn, workspaceStamps as Br, REPOSITORY_SCOPE as Bt, RUN_KINDS as C, isExplanationAction as Ci, chatConversationSection as Cn, kissDecisionRefusal as Cr, waitingHistory as Ct, heldRuns as D, analysisRefOf as Di, GITHUB_MARKDOWN as Dn, lineagePosition as Dr, describeRuntimes as Dt, endRun as E, NO_STATUS as Ei, hasAuthorContent as En, lineageKey as Er, RUNTIME_WORDS as Et, runBatch as F, isGradeFor as Fi, isBusy as Fn, reviewedCommit as Fr, storeArchitecture as Ft, reviewsUrl as G, objectWithAnyOf as Gi, describeSubject as Gn, lifecycleChip as Gr, branchOf as Gt, clearServerRecordOwnedBy as H, followUpFindingId as Hi, removeWorktree as Hn, activityAttributes as Hr, isArchitectureId as Ht, activateQueued as I, isOffered as Ii, withReviewLock as In, reviewedRepositories as Ir, storedScopes as It, stopChild as J, kissOutcome as Ji, checkReview as Jn, offersLifecycle as Jr, createArchitectureNotification as Jt, serverEntryExists as K, describeAuthorship as Ki, findExistingReview as Kn, lifecycleItemLabel as Kr, subjectOf as Kt, compactQueue as L, promptGrade as Li, MANAGED_ROOT as Ln, summarise as Lr, trackedFiles as Lt, extractPullRequestLinks as M, findingIn as Mi, renderInlineText as Mn, presentedKissRunOf as Mr, partFiles as Mt, parsePullRequestLink as N, findingStatus as Ni, modelHelpLines as Nn, previousKissResult as Nr, readArchitecture as Nt, reportRun as O, assessmentLookup as Oi, renderMarkdown as On, loadWorkspace as Or, formatDuration as Ot, unsupportedReason as P, gradeScale as Pi, ReviewBeingDeletedError as Pn, recentWorkspaces as Pr, repositoryKey as Pt, DEFAULT_WORKSPACE_PORT as Q, isCommitReview as Qi, forgeResolver as Qn, createCollection as Qr, listNotifications as Qt, queueForReview as R, reassessIn as Ri, createWorktree as Rn, touchWorkspace as Rr, ownersOf as Rt, track as S, AgentUnavailableError as Sa, explanationOf as Si, EXPLAIN_SIMPLY_PROMPT as Sn, indexReviewGroups as Sr, feedbackUrl as St, completeRun as T, ANALYSIS_ONLY as Ti, authorPreview as Tn, latestKissRun as Tr, recordRuntimeBestEffort as Tt, ensureServer as U, asString$1 as Ui, requestJobStop as Un, activityLabel as Ur, writeJsonAtomically as Ut, bootstrapUrl as V, wasReassessed as Vi, readMarker as Vn, LIFECYCLES as Vr, ancestorsOf as Vt, readServerRecord as W, extractJsonText as Wi, describeMovement as Wn, isLifecycle as Wr, announceJob as Wt, workspaceUrl as X, originRemote as Xi, reviewedShaOf as Xn, sectionOf as Xr, createPrUpdate as Xt, stopServer as Y, resolveTarget as Yi, followedBranch as Yn, parseLifecycle as Yr, createPrState as Yt, writeServerRecord as Z, DetachedHeadError as Zi, fetchHead as Zn, collectionsStamp as Zr, eventName as Zt, runningJobs as _, detectAgents as _a, reviewerDispositions as _i, storedConversation as _n, CLAIM_LEASE_MS as _r, recordTelemetryUploadConsent as _t, wasBlocked as a, resolveAgent as aa, updateCollections as ai, readStateOf as an, isTerminal as ar, failureOf as at, startKissJob as b, runnableAgents as ba, recommendationsOf as bi, isUnchanged as bn, groupByLineage as br, BUILD_VERSION as bt, RefreshUnavailableError as c, clearAgentPreference as ca, queueRemove as ci, toneOf as cn, saveJob as cr, settleReview as ct, mergeUpdateInto as d, CONFIG_PATH as da, doneVerb as di, withUsageRecorded as dn, isTerminalJobPhase as dr, startJob as dt, AmbiguousRefError as ea, deleteCollection as ei, markRead as en, RUN_RECORD_RETENTION_MS as er, MIN_WORKSPACE_PORT as et, parkedUpdateRefusal as f, STORE_ROOT as fa, isIssueOutstanding as fi, existingPaths as fn, phasesFor as fr, append as ft, liveUpdateFor as g, agentIdentityOf as ga, resolvedByConversation as gi, saveRefresh as gn, isClaimed as gr, deliver as gt, UpdateAlreadyRunningError as h, agentFor as ha, questionsOutstanding as hi, prepareConversationWithin as hn, clearClaim as hr, stamp as ht, liveJobsFor as i, refExists as ia, setMembership as ii, readNotification as in, fail as ir, writePortPreference as it, batchIdentity as j, findingAssessment as ji, escapeHtml as jn, positionInLineage as jr, loadArchitecture as jt, stopRun as k, closesFinding as ki, CODE_BLOCK_CLASS as kn, matchingWorkspaceIds as kr, ARCHITECTURE_DIR as kt, cancelUpdate as l, readAgentPreference as la, queueStamp as li, unreadAround as ln, PHASES as lr, reanalyseReview as lt, askCheckout as m, agentById as ma, issuesOutstanding as mi, adoptLegacyBaseline as mn, purposeOf as mr, record as mt, deleteReview as n, shorthandOf as na, readCollections as ni, moveIds as nn, attemptIdOf as nr, resolveWorkspacePort as nt, discardJob as o, resolveModel as oa, queueAdd as oi, removeNotification as on, loadJob as or, observeReview as ot, updateReview as p, AGENT_IDS as pa, isQuestionOutstanding as pi, ASK_REREAD_CEILING_MS as pn, progressSteps as pr, readEvents as pt, spawnServer as q, WITHHELD_REASON as qi, checkCodeFreshness as qn, lifecyclePill as qr, categoryOf as qt, lineageIds as r, git as ra, renameCollection as ri, pruneNotifications as rn, endedAt as rr, statedWorkspacePort as rt, FETCH_TIMEOUT_MS as s, agentIdOf as sa, queueAddMany as si, retireNotification as sn, pruneJobResidue as sr, prepareReview as st, deleteLineage as t, shortNameOf as ta, nameProblemText as ti, markReadForReview as tn, allJobs as tr, parseWorkspacePort as tt, cancellableHere as u, writeAgentPreference as ua, readQueue as ui, unreadCount as un, isLiveJob as ur, runJob as ut, kissAgentId as v, isAgentId as va, verdictClosure as vi, unforeseenFailure as vn, decideKissRecommendation as vr, telemetryUploadConsent as vt, beginRun as w, withExplanation as wi, UNESTABLISHED_MOTIVATION as wn, kissDecisionsOf as wr, mapRuntimes as wt, isDriving as x, AgentCancelledError as xa, explanationActionOf as xi, agentEnvOf as xn, indexKeptIds as xr, PACKAGE_NAME as xt, recordKissRun as y, parkedReason as ya, processDiscussion as yi, refreshPrContext as yn, followedRefName as yr, telemetryUploadEnabled as yt, settleQueue as z, sourcePhrase as zi, holdWorktree as zn, workspaceRevision as zr, QUOTE_LIMITS as zt };
20463
+ export { MAX_WORKSPACE_PORT as $, DetachedHeadError as $i, fillFileUrlTemplate as $n, collectionsStamp as $r, markAllRead as $t, relativeTime as A, assessmentLookup as Ai, CODE_COPY_CLASS as An, mutateWorkspace as Ar, checkArchitecture as At, readIndexToken as B, reassessIn as Bi, isWorktreeHeld as Bn, workspaceStamps as Br, REPOSITORY_SCOPE as Bt, RUN_KINDS as C, AgentCancelledError as Ca, explanationActionOf as Ci, chatConversationSection as Cn, kissDecisionRefusal as Cr, waitingHistory as Ct, heldRuns as D, ANALYSIS_ONLY as Di, GITHUB_MARKDOWN as Dn, lineagePosition as Dr, describeRuntimes as Dt, endRun as E, withExplanation as Ei, hasAuthorContent as En, lineageKey as Er, RUNTIME_WORDS as Et, runBatch as F, findingStatus as Fi, isBusy as Fn, reviewedCommit as Fr, storeArchitecture as Ft, reviewsUrl as G, asString$1 as Gi, describeSubject as Gn, lifecycleChip as Gr, branchOf as Gt, clearServerRecordOwnedBy as H, statusLookup as Hi, removeWorktree as Hn, activityAttributes as Hr, isArchitectureId as Ht, activateQueued as I, gradeScale as Ii, withReviewLock as In, reviewedRepositories as Ir, storedScopes as It, stopChild as J, describeAuthorship as Ji, checkReview as Jn, lifecyclePillAction as Jr, createArchitectureNotification as Jt, serverEntryExists as K, extractJsonText as Ki, findExistingReview as Kn, lifecycleItemLabel as Kr, subjectOf as Kt, compactQueue as L, isGradeFor as Li, MANAGED_ROOT as Ln, summarise as Lr, trackedFiles as Lt, extractPullRequestLinks as M, currentGradeIn as Mi, renderInlineText as Mn, presentedKissRunOf as Mr, partFiles as Mt, parsePullRequestLink as N, findingAssessment as Ni, modelHelpLines as Nn, previousKissResult as Nr, readArchitecture as Nt, reportRun as O, NO_STATUS as Oi, renderMarkdown as On, loadWorkspace as Or, formatDuration as Ot, unsupportedReason as P, findingIn as Pi, ReviewBeingDeletedError as Pn, recentWorkspaces as Pr, repositoryKey as Pt, DEFAULT_WORKSPACE_PORT as Q, originRemote as Qi, forgeResolver as Qn, sectionOf as Qr, listNotifications as Qt, queueForReview as R, isOffered as Ri, createWorktree as Rn, touchWorkspace as Rr, ownersOf as Rt, track as S, runnableAgents as Sa, recommendationsOf as Si, EXPLAIN_SIMPLY_PROMPT as Sn, indexReviewGroups as Sr, feedbackUrl as St, completeRun as T, isExplanationAction as Ti, authorPreview as Tn, latestKissRun as Tr, recordRuntimeBestEffort as Tt, ensureServer as U, wasReassessed as Ui, requestJobStop as Un, activityLabel as Ur, writeJsonAtomically as Ut, bootstrapUrl as V, sourcePhrase as Vi, readMarker as Vn, LIFECYCLES as Vr, ancestorsOf as Vt, readServerRecord as W, followUpFindingId as Wi, describeMovement as Wn, isLifecycle as Wr, announceJob as Wt, workspaceUrl as X, kissOutcome as Xi, reviewedShaOf as Xn, offersLifecycle as Xr, createPrUpdate as Xt, stopServer as Y, WITHHELD_REASON as Yi, followedBranch as Yn, lifecyclePillLabel as Yr, createPrState as Yt, writeServerRecord as Z, resolveTarget as Zi, fetchHead as Zn, parseLifecycle as Zr, eventName as Zt, runningJobs as _, agentFor as _a, questionsOutstanding as _i, storedConversation as _n, CLAIM_LEASE_MS as _r, recordTelemetryUploadConsent as _t, wasBlocked as a, git as aa, renameCollection as ai, readStateOf as an, isTerminal as ar, failureOf as at, startKissJob as b, isAgentId as ba, verdictClosure as bi, isUnchanged as bn, groupByLineage as br, BUILD_VERSION as bt, RefreshUnavailableError as c, resolveModel as ca, queueAdd as ci, toneOf as cn, saveJob as cr, settleReview as ct, mergeUpdateInto as d, readAgentPreference as da, queueStamp as di, withUsageRecorded as dn, isTerminalJobPhase as dr, startJob as dt, isCommitReview as ea, createCollection as ei, markRead as en, RUN_RECORD_RETENTION_MS as er, MIN_WORKSPACE_PORT as et, parkedUpdateRefusal as f, writeAgentPreference as fa, readQueue as fi, existingPaths as fn, phasesFor as fr, append as ft, liveUpdateFor as g, agentById as ga, issuesOutstanding as gi, saveRefresh as gn, isClaimed as gr, deliver as gt, UpdateAlreadyRunningError as h, AGENT_IDS as ha, isQuestionOutstanding as hi, prepareConversationWithin as hn, clearClaim as hr, stamp as ht, liveJobsFor as i, shorthandOf as ia, readCollections as ii, readNotification as in, fail as ir, writePortPreference as it, batchIdentity as j, closesFinding as ji, escapeHtml as jn, positionInLineage as jr, loadArchitecture as jt, stopRun as k, analysisRefOf as ki, CODE_BLOCK_CLASS as kn, matchingWorkspaceIds as kr, ARCHITECTURE_DIR as kt, cancelUpdate as l, agentIdOf as la, queueAddMany as li, unreadAround as ln, PHASES as lr, reanalyseReview as lt, askCheckout as m, STORE_ROOT as ma, isIssueOutstanding as mi, adoptLegacyBaseline as mn, purposeOf as mr, record as mt, deleteReview as n, AmbiguousRefError as na, deleteCollection as ni, moveIds as nn, attemptIdOf as nr, resolveWorkspacePort as nt, discardJob as o, refExists as oa, setMembership as oi, removeNotification as on, loadJob as or, observeReview as ot, updateReview as p, CONFIG_PATH as pa, doneVerb as pi, ASK_REREAD_CEILING_MS as pn, progressSteps as pr, readEvents as pt, spawnServer as q, objectWithAnyOf as qi, checkCodeFreshness as qn, lifecycleName as qr, categoryOf as qt, lineageIds as r, shortNameOf as ra, nameProblemText as ri, pruneNotifications as rn, endedAt as rr, statedWorkspacePort as rt, FETCH_TIMEOUT_MS as s, resolveAgent as sa, updateCollections as si, retireNotification as sn, pruneJobResidue as sr, prepareReview as st, deleteLineage as t, resolveBase as ta, createWithMembers as ti, markReadForReview as tn, allJobs as tr, parseWorkspacePort as tt, cancellableHere as u, clearAgentPreference as ua, queueRemove as ui, unreadCount as un, isLiveJob as ur, runJob as ut, kissAgentId as v, agentIdentityOf as va, resolvedByConversation as vi, unforeseenFailure as vn, decideKissRecommendation as vr, telemetryUploadConsent as vt, beginRun as w, AgentUnavailableError as wa, explanationOf as wi, UNESTABLISHED_MOTIVATION as wn, kissDecisionsOf as wr, mapRuntimes as wt, isDriving as x, parkedReason as xa, processDiscussion as xi, agentEnvOf as xn, indexKeptIds as xr, PACKAGE_NAME as xt, recordKissRun as y, detectAgents as ya, reviewerDispositions as yi, refreshPrContext as yn, followedRefName as yr, telemetryUploadEnabled as yt, settleQueue as z, promptGrade as zi, holdWorktree as zn, workspaceRevision as zr, QUOTE_LIMITS as zt };
package/dist/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { $ as MAX_WORKSPACE_PORT, A as relativeTime, Ar as mutateWorkspace, B as readIndexToken, F as runBatch, G as reviewsUrl, Gn as describeSubject, Hn as removeWorktree, Ir as reviewedRepositories, Ji as kissOutcome, Kn as findExistingReview, Ln as MANAGED_ROOT, Lr as summarise, Nn as modelHelpLines, Or as loadWorkspace, Pr as recentWorkspaces, Q as DEFAULT_WORKSPACE_PORT, Qn as forgeResolver, R as queueForReview, U as ensureServer, V as bootstrapUrl, Vn as readMarker, Wn as describeMovement, X as workspaceUrl, Y as stopServer, Yi as resolveTarget, _ as runningJobs, _a as detectAgents, _t as recordTelemetryUploadConsent, a as wasBlocked, aa as resolveAgent, ba as runnableAgents, bt as BUILD_VERSION, ct as settleReview, d as mergeUpdateInto, da as CONFIG_PATH, dt as startJob, et as MIN_WORKSPACE_PORT, f as parkedUpdateRefusal, fa as STORE_ROOT, ft as append, g as liveUpdateFor, gt as deliver, h as UpdateAlreadyRunningError, hr as clearClaim, ht as stamp, i as liveJobsFor, it as writePortPreference, j as batchIdentity, jr as positionInLineage, kr as matchingWorkspaceIds, la as readAgentPreference, lr as PHASES, lt as reanalyseReview, ma as agentById, mr as purposeOf, mt as record$1, n as deleteReview$1, oa as resolveModel, or as loadJob, p as updateReview, pa as AGENT_IDS, pr as progressSteps, qi as WITHHELD_REASON, ra as git, rt as statedWorkspacePort, st as prepareReview, tr as allJobs, tt as parseWorkspacePort, ua as writeAgentPreference, vt as telemetryUploadConsent, xt as PACKAGE_NAME, y as recordKissRun, ya as parkedReason, yr as followedRefName, yt as telemetryUploadEnabled } from "./delete_review-D7TXn5ck.js";
2
+ import { $ as MAX_WORKSPACE_PORT, A as relativeTime, Ar as mutateWorkspace, B as readIndexToken, F as runBatch, G as reviewsUrl, Gn as describeSubject, Hn as removeWorktree, Ir as reviewedRepositories, Kn as findExistingReview, Ln as MANAGED_ROOT, Lr as summarise, Nn as modelHelpLines, Or as loadWorkspace, Pr as recentWorkspaces, Q as DEFAULT_WORKSPACE_PORT, Qn as forgeResolver, R as queueForReview, Sa as runnableAgents, U as ensureServer, V as bootstrapUrl, Vn as readMarker, Wn as describeMovement, X as workspaceUrl, Xi as kissOutcome, Y as stopServer, Yi as WITHHELD_REASON, Zi as resolveTarget, _ as runningJobs, _t as recordTelemetryUploadConsent, a as wasBlocked, aa as git, bt as BUILD_VERSION, ca as resolveModel, ct as settleReview, d as mergeUpdateInto, da as readAgentPreference, dt as startJob, et as MIN_WORKSPACE_PORT, f as parkedUpdateRefusal, fa as writeAgentPreference, ft as append, g as liveUpdateFor, ga as agentById, gt as deliver, h as UpdateAlreadyRunningError, ha as AGENT_IDS, hr as clearClaim, ht as stamp, i as liveJobsFor, it as writePortPreference, j as batchIdentity, jr as positionInLineage, kr as matchingWorkspaceIds, lr as PHASES, lt as reanalyseReview, ma as STORE_ROOT, mr as purposeOf, mt as record$1, n as deleteReview$1, or as loadJob, p as updateReview, pa as CONFIG_PATH, pr as progressSteps, rt as statedWorkspacePort, sa as resolveAgent, st as prepareReview, tr as allJobs, tt as parseWorkspacePort, vt as telemetryUploadConsent, xa as parkedReason, xt as PACKAGE_NAME, y as recordKissRun, ya as detectAgents, yr as followedRefName, yt as telemetryUploadEnabled } from "./delete_review-CeiSTV7u.js";
3
3
  import { basename, dirname, join, resolve } from "node:path";
4
4
  import { spawn } from "node:child_process";
5
5
  import { existsSync, mkdirSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
package/dist/server.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as MAX_WORKSPACE_PORT, $i as resolveBase, $n as fillFileUrlTemplate, $r as createWithMembers, $t as markAllRead, A as relativeTime$1, Ai as currentGradeIn, An as CODE_COPY_CLASS, Ar as mutateWorkspace, At as checkArchitecture, B as readIndexToken, Bi as statusLookup, Bn as isWorktreeHeld, Br as workspaceStamps, Bt as REPOSITORY_SCOPE, C as RUN_KINDS, Ci as isExplanationAction, Cn as chatConversationSection, Cr as kissDecisionRefusal, Ct as waitingHistory, D as heldRuns, Di as analysisRefOf, Dn as GITHUB_MARKDOWN, Dr as lineagePosition, Dt as describeRuntimes, E as endRun, Ei as NO_STATUS, En as hasAuthorContent, Er as lineageKey, Et as RUNTIME_WORDS, F as runBatch, Fi as isGradeFor, Fn as isBusy, Fr as reviewedCommit, Ft as storeArchitecture, Gi as objectWithAnyOf, Gr as lifecycleChip, Gt as branchOf, H as clearServerRecordOwnedBy, Hi as followUpFindingId, Hn as removeWorktree, Hr as activityAttributes, Ht as isArchitectureId, I as activateQueued, Ii as isOffered, In as withReviewLock, It as storedScopes, J as stopChild, Ji as kissOutcome, Jn as checkReview, Jr as offersLifecycle, Jt as createArchitectureNotification, K as serverEntryExists, Ki as describeAuthorship, Kn as findExistingReview, Kr as lifecycleItemLabel, Kt as subjectOf, L as compactQueue, Li as promptGrade, Ln as MANAGED_ROOT, Lr as summarise, Lt as trackedFiles, M as extractPullRequestLinks, Mi as findingIn, Mn as renderInlineText, Mr as presentedKissRunOf, Mt as partFiles, N as parsePullRequestLink, Ni as findingStatus, Nr as previousKissResult, Nt as readArchitecture, O as reportRun, Oi as assessmentLookup, On as renderMarkdown, Or as loadWorkspace, Ot as formatDuration, P as unsupportedReason, Pi as gradeScale, Pn as ReviewBeingDeletedError, Pr as recentWorkspaces, Pt as repositoryKey, Q as DEFAULT_WORKSPACE_PORT, Qi as isCommitReview, Qn as forgeResolver, Qr as createCollection, Qt as listNotifications, Ri as reassessIn, Rn as createWorktree, Rr as touchWorkspace, Rt as ownersOf, S as track, Sa as AgentUnavailableError, Si as explanationOf, Sn as EXPLAIN_SIMPLY_PROMPT, Sr as indexReviewGroups, St as feedbackUrl, T as completeRun, Ti as ANALYSIS_ONLY, Tn as authorPreview, Tr as latestKissRun, Tt as recordRuntimeBestEffort, Ui as asString, Un as requestJobStop, Ur as activityLabel, Ut as writeJsonAtomically, Vi as wasReassessed, Vn as readMarker, Vr as LIFECYCLES, Vt as ancestorsOf, W as readServerRecord, Wi as extractJsonText, Wr as isLifecycle, Wt as announceJob, Xi as originRemote, Xn as reviewedShaOf, Xr as sectionOf, Xt as createPrUpdate, Yi as resolveTarget, Yn as followedBranch, Yr as parseLifecycle, Yt as createPrState, Z as writeServerRecord, Zi as DetachedHeadError, Zn as fetchHead, Zr as collectionsStamp, Zt as eventName, _ as runningJobs, _a as detectAgents, _i as reviewerDispositions, _n as storedConversation, _t as recordTelemetryUploadConsent, a as wasBlocked, aa as resolveAgent, ai as updateCollections, an as readStateOf, ar as isTerminal, at as failureOf$1, b as startKissJob, ba as runnableAgents, bi as recommendationsOf, bn as isUnchanged, br as groupByLineage, bt as BUILD_VERSION, c as RefreshUnavailableError, ca as clearAgentPreference, ci as queueRemove, cn as toneOf, cr as saveJob, ct as settleReview, d as mergeUpdateInto, di as doneVerb, dn as withUsageRecorded, dr as isTerminalJobPhase, ea as AmbiguousRefError, ei as deleteCollection, en as markRead, er as RUN_RECORD_RETENTION_MS, et as MIN_WORKSPACE_PORT, fa as STORE_ROOT, fi as isIssueOutstanding, fn as existingPaths, fr as phasesFor, g as liveUpdateFor, ga as agentIdentityOf, gi as resolvedByConversation, gn as saveRefresh, gr as isClaimed, h as UpdateAlreadyRunningError, ha as agentFor$1, hi as questionsOutstanding, hn as prepareConversationWithin, i as liveJobsFor, ia as refExists, ii as setMembership, in as readNotification, ir as fail$1, it as writePortPreference, j as batchIdentity, ji as findingAssessment, jn as escapeHtml$1, jt as loadArchitecture, k as stopRun, ki as closesFinding, kn as CODE_BLOCK_CLASS, kt as ARCHITECTURE_DIR, l as cancelUpdate, la as readAgentPreference, li as queueStamp, ln as unreadAround, lt as reanalyseReview, m as askCheckout, ma as agentById, mi as issuesOutstanding, mn as adoptLegacyBaseline, mr as purposeOf, mt as record, n as deleteReview, na as shorthandOf, ni as readCollections, nn as moveIds, nr as attemptIdOf, nt as resolveWorkspacePort, o as discardJob, oa as resolveModel, oi as queueAdd, on as removeNotification, or as loadJob, ot as observeReview, p as updateReview, pa as AGENT_IDS, pi as isQuestionOutstanding, pn as ASK_REREAD_CEILING_MS, pr as progressSteps, pt as readEvents, q as spawnServer, qi as WITHHELD_REASON, qn as checkCodeFreshness, qr as lifecyclePill, qt as categoryOf, r as lineageIds, ra as git, ri as renameCollection, rn as pruneNotifications, rr as endedAt, rt as statedWorkspacePort, s as FETCH_TIMEOUT_MS, sa as agentIdOf, si as queueAddMany, sn as retireNotification, sr as pruneJobResidue, st as prepareReview, t as deleteLineage, ta as shortNameOf, ti as nameProblemText, tn as markReadForReview, tr as allJobs, tt as parseWorkspacePort, u as cancellableHere, ua as writeAgentPreference, ui as readQueue, un as unreadCount$1, ur as isLiveJob, ut as runJob, v as kissAgentId, va as isAgentId, vi as verdictClosure, vn as unforeseenFailure, vr as decideKissRecommendation, vt as telemetryUploadConsent, w as beginRun, wi as withExplanation, wn as UNESTABLISHED_MOTIVATION, wr as kissDecisionsOf, wt as mapRuntimes, x as isDriving, xa as AgentCancelledError, xi as explanationActionOf, xn as agentEnvOf, xr as indexKeptIds, ya as parkedReason, yi as processDiscussion, yn as refreshPrContext, yr as followedRefName, z as settleQueue, zi as sourcePhrase, zn as holdWorktree, zr as workspaceRevision, zt as QUOTE_LIMITS } from "./delete_review-D7TXn5ck.js";
1
+ import { $ as MAX_WORKSPACE_PORT, $i as DetachedHeadError, $n as fillFileUrlTemplate, $r as collectionsStamp, $t as markAllRead, A as relativeTime$1, Ai as assessmentLookup, An as CODE_COPY_CLASS, Ar as mutateWorkspace, At as checkArchitecture, B as readIndexToken, Bi as reassessIn, Bn as isWorktreeHeld, Br as workspaceStamps, Bt as REPOSITORY_SCOPE, C as RUN_KINDS, Ca as AgentCancelledError, Ci as explanationActionOf, Cn as chatConversationSection, Cr as kissDecisionRefusal, Ct as waitingHistory, D as heldRuns, Di as ANALYSIS_ONLY, Dn as GITHUB_MARKDOWN, Dr as lineagePosition, Dt as describeRuntimes, E as endRun, Ei as withExplanation, En as hasAuthorContent, Er as lineageKey, Et as RUNTIME_WORDS, F as runBatch, Fi as findingStatus, Fn as isBusy, Fr as reviewedCommit, Ft as storeArchitecture, Gi as asString, Gr as lifecycleChip, Gt as branchOf, H as clearServerRecordOwnedBy, Hi as statusLookup, Hn as removeWorktree, Hr as activityAttributes, Ht as isArchitectureId, I as activateQueued, Ii as gradeScale, In as withReviewLock, It as storedScopes, J as stopChild, Ji as describeAuthorship, Jn as checkReview, Jr as lifecyclePillAction, Jt as createArchitectureNotification, K as serverEntryExists, Ki as extractJsonText, Kn as findExistingReview, Kr as lifecycleItemLabel, Kt as subjectOf, L as compactQueue, Li as isGradeFor, Ln as MANAGED_ROOT, Lr as summarise, Lt as trackedFiles, M as extractPullRequestLinks, Mi as currentGradeIn, Mn as renderInlineText, Mr as presentedKissRunOf, Mt as partFiles, N as parsePullRequestLink, Ni as findingAssessment, Nr as previousKissResult, Nt as readArchitecture, O as reportRun, Oi as NO_STATUS, On as renderMarkdown, Or as loadWorkspace, Ot as formatDuration, P as unsupportedReason, Pi as findingIn, Pn as ReviewBeingDeletedError, Pr as recentWorkspaces, Pt as repositoryKey, Q as DEFAULT_WORKSPACE_PORT, Qi as originRemote, Qn as forgeResolver, Qr as sectionOf, Qt as listNotifications, Ri as isOffered, Rn as createWorktree, Rr as touchWorkspace, Rt as ownersOf, S as track, Sa as runnableAgents, Si as recommendationsOf, Sn as EXPLAIN_SIMPLY_PROMPT, Sr as indexReviewGroups, St as feedbackUrl, T as completeRun, Ti as isExplanationAction, Tn as authorPreview, Tr as latestKissRun, Tt as recordRuntimeBestEffort, Ui as wasReassessed, Un as requestJobStop, Ur as activityLabel, Ut as writeJsonAtomically, Vi as sourcePhrase, Vn as readMarker, Vr as LIFECYCLES, Vt as ancestorsOf, W as readServerRecord, Wi as followUpFindingId, Wr as isLifecycle, Wt as announceJob, Xi as kissOutcome, Xn as reviewedShaOf, Xr as offersLifecycle, Xt as createPrUpdate, Yi as WITHHELD_REASON, Yn as followedBranch, Yr as lifecyclePillLabel, Yt as createPrState, Z as writeServerRecord, Zi as resolveTarget, Zn as fetchHead, Zr as parseLifecycle, Zt as eventName, _ as runningJobs, _a as agentFor$1, _i as questionsOutstanding, _n as storedConversation, _t as recordTelemetryUploadConsent, a as wasBlocked, aa as git, ai as renameCollection, an as readStateOf, ar as isTerminal, at as failureOf$1, b as startKissJob, ba as isAgentId, bi as verdictClosure, bn as isUnchanged, br as groupByLineage, bt as BUILD_VERSION, c as RefreshUnavailableError, ca as resolveModel, ci as queueAdd, cn as toneOf, cr as saveJob, ct as settleReview, d as mergeUpdateInto, da as readAgentPreference, di as queueStamp, dn as withUsageRecorded, dr as isTerminalJobPhase, ea as isCommitReview, ei as createCollection, en as markRead, er as RUN_RECORD_RETENTION_MS, et as MIN_WORKSPACE_PORT, fa as writeAgentPreference, fi as readQueue, fn as existingPaths, fr as phasesFor, g as liveUpdateFor, ga as agentById, gi as issuesOutstanding, gn as saveRefresh, gr as isClaimed, h as UpdateAlreadyRunningError, ha as AGENT_IDS, hi as isQuestionOutstanding, hn as prepareConversationWithin, i as liveJobsFor, ia as shorthandOf, ii as readCollections, in as readNotification, ir as fail$1, it as writePortPreference, j as batchIdentity, ji as closesFinding, jn as escapeHtml$1, jt as loadArchitecture, k as stopRun, ki as analysisRefOf, kn as CODE_BLOCK_CLASS, kt as ARCHITECTURE_DIR, l as cancelUpdate, la as agentIdOf, li as queueAddMany, ln as unreadAround, lt as reanalyseReview, m as askCheckout, ma as STORE_ROOT, mi as isIssueOutstanding, mn as adoptLegacyBaseline, mr as purposeOf, mt as record, n as deleteReview, na as AmbiguousRefError, ni as deleteCollection, nn as moveIds, nr as attemptIdOf, nt as resolveWorkspacePort, o as discardJob, oa as refExists, oi as setMembership, on as removeNotification, or as loadJob, ot as observeReview, p as updateReview, pi as doneVerb, pn as ASK_REREAD_CEILING_MS, pr as progressSteps, pt as readEvents, q as spawnServer, qi as objectWithAnyOf, qn as checkCodeFreshness, qr as lifecycleName$1, qt as categoryOf, r as lineageIds, ra as shortNameOf, ri as nameProblemText, rn as pruneNotifications, rr as endedAt, rt as statedWorkspacePort, s as FETCH_TIMEOUT_MS, sa as resolveAgent, si as updateCollections, sn as retireNotification, sr as pruneJobResidue, st as prepareReview, t as deleteLineage, ta as resolveBase, ti as createWithMembers, tn as markReadForReview, tr as allJobs, tt as parseWorkspacePort, u as cancellableHere, ua as clearAgentPreference, ui as queueRemove, un as unreadCount$1, ur as isLiveJob, ut as runJob, v as kissAgentId, va as agentIdentityOf, vi as resolvedByConversation, vn as unforeseenFailure, vr as decideKissRecommendation, vt as telemetryUploadConsent, w as beginRun, wa as AgentUnavailableError, wi as explanationOf, wn as UNESTABLISHED_MOTIVATION, wr as kissDecisionsOf, wt as mapRuntimes, x as isDriving, xa as parkedReason, xi as processDiscussion, xn as agentEnvOf, xr as indexKeptIds, ya as detectAgents, yi as reviewerDispositions, yn as refreshPrContext, yr as followedRefName, z as settleQueue, zi as promptGrade, zn as holdWorktree, zr as workspaceRevision, zt as QUOTE_LIMITS } from "./delete_review-CeiSTV7u.js";
2
2
  import { basename, isAbsolute, join, relative, resolve } from "node:path";
3
3
  import { execFile } from "node:child_process";
4
4
  import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
@@ -395,16 +395,6 @@ function ordersExplicitly(filter) {
395
395
  return filter === "queue";
396
396
  }
397
397
  /**
398
- * The lifecycle chip on a card, or absent.
399
- *
400
- * In a lifecycle section the heading already names the lifecycle, so the chip only says what moved
401
- * (`lifecycleChip`). In Pinned nothing names it, so the chip does, in the words the review page's
402
- * pill uses: the list and the page give one answer about the same review.
403
- */
404
- function cardLifecycleChip(pinned, lifecycle, activity) {
405
- return pinned ? lifecyclePill(lifecycle, activity)?.text : lifecycleChip(lifecycle, activity);
406
- }
407
- /**
408
398
  * "45 reviews · 13 branches", and "13 reviews" when those are the same thirteen things.
409
399
  *
410
400
  * The two numbers are different questions and only both worth asking once they differ. A page of
@@ -497,6 +487,13 @@ function statusLabel(status) {
497
487
  return status === "in-progress" ? "Not reviewed" : "New";
498
488
  }
499
489
  /**
490
+ * The status pill's accessible name: where the reviewer is, then what pressing it does. The visible
491
+ * words are the state, so a screen reader hears both rather than only a state it cannot act on.
492
+ */
493
+ function statusPillLabel(status) {
494
+ return `${statusLabel(status)}. Mark as ${status === "complete" ? "not reviewed" : "reviewed"}`;
495
+ }
496
+ /**
500
497
  * The bulk bar's way to tick everything the filters show, across pages.
501
498
  *
502
499
  * Counted ("Select all 7") only while the headline is not already saying "of 7", so the number is
@@ -758,6 +755,47 @@ function renderFeedbackDraftBody() {
758
755
  </div>`;
759
756
  }
760
757
  //#endregion
758
+ //#region ../../packages/review-harness/src/workspace/state_pills.ts
759
+ /**
760
+ * The two pills that say where a review stands, and change it: status (what the reviewer has done)
761
+ * and lifecycle (what happens next). Drawn on every Reviews card and in the review page's header,
762
+ * from this one module, so the two places cannot disagree in words, shape or behaviour.
763
+ *
764
+ * Pure, with no node builtins: the server renders the markup and both pages' scripts repaint it
765
+ * from an answer, through `paintStatusPill` and `paintLifecyclePill`.
766
+ *
767
+ * The pills are shortcuts for the `…` menu's items, never a second set of rules. The status pill is
768
+ * the menu's Mark reviewed / Mark not reviewed. The lifecycle pill is Mark done on Active and Move
769
+ * to active on Done. On Waiting it opens the lifecycle items the menu would offer (`offersLifecycle`),
770
+ * because Waiting has more than one way out and a toggle would have to guess which.
771
+ *
772
+ * Every lifecycle draws a pill, Active included. The pill names the stored state only; why a parked
773
+ * card is back in Active is the change chip's job (`lifecycleChip`), a separate fact.
774
+ */
775
+ /** The status pill as a button. `attributes` carries whatever the page needs to find it by. */
776
+ function statusPillHtml(status, attributes = "") {
777
+ return `<button type="button" class="prb-card-status prb-state-pill" data-status="${status}"${attributes} aria-label="${escapeHtml$1(statusPillLabel(status))}">${statusLabel(status)}</button>`;
778
+ }
779
+ /**
780
+ * The lifecycle pill. Interactive, it is a button inside a `[data-menu]`, which the shared menus
781
+ * open only while the pill is a trigger (Waiting); otherwise the page acts on the press directly.
782
+ * The panel ships with all three items so a repaint never builds markup. Not interactive (an older
783
+ * review in a lineage, where lifecycle is not offered), it is a span that only says.
784
+ */
785
+ function lifecycleControlHtml(lifecycle, activity, options) {
786
+ const state = lifecycle?.state ?? "active";
787
+ const name = escapeHtml$1(lifecycleName$1(lifecycle));
788
+ const attributes = options.attributes ?? "";
789
+ if (!options.interactive) return `<span class="prb-state-pill prb-lifecycle-pill" data-lifecycle-pill="${state}"${attributes}>${name}</span>`;
790
+ const action = lifecyclePillAction(lifecycle);
791
+ const trigger = action === "menu" ? " data-menu-trigger aria-haspopup=\"true\" aria-expanded=\"false\"" : "";
792
+ const items = LIFECYCLES.map(({ id }) => `<button type="button" class="prb-menu-item" data-lifecycle-set="${id}"${offersLifecycle(id, lifecycle, activity) ? "" : " hidden"}>${escapeHtml$1(lifecycleItemLabel(id, lifecycle, activity))}</button>`).join("");
793
+ return `<div class="prb-menu prb-pill-menu" data-menu data-lifecycle-control>
794
+ <button type="button" class="prb-state-pill prb-lifecycle-pill" data-lifecycle-pill="${state}" data-lifecycle-press="${action}"${attributes}${trigger} aria-label="${escapeHtml$1(lifecyclePillLabel(lifecycle))}">${name}</button>
795
+ <div class="prb-menu-panel" data-menu-panel hidden>${items}</div>
796
+ </div>`;
797
+ }
798
+ //#endregion
761
799
  //#region ../../packages/review-harness/src/workspace/way_back.ts
762
800
  var CLI = {
763
801
  command: "prreviewbuddy open",
@@ -6942,20 +6980,30 @@ function renderReviewBar(view, freshness) {
6942
6980
  </div>`;
6943
6981
  }
6944
6982
  /**
6945
- * Where this review stands, as pills that say and never do.
6983
+ * Where this review stands, as two pills that say it and change it.
6946
6984
  *
6947
6985
  * Two, because they answer two questions. Reviewed or Not reviewed is what the reviewer has done;
6948
- * Waiting or Done is what happens next with the branch. A review can be Reviewed and Waiting, so a
6949
- * single pill would have to drop one of them. Active draws nothing, as an open pull request does
6950
- * not: it is where every review starts, and a pill that never varies teaches nothing.
6986
+ * Active, Waiting or Done is what happens next with the branch. A review can be Reviewed and
6987
+ * Waiting, so a single pill would have to drop one of them. Each is a shortcut for its `…` items
6988
+ * (see `state_pills.ts`); the lifecycle pill acts only where those items are offered, on the newest
6989
+ * review of the branch, and on an older one only says.
6990
+ *
6991
+ * Why a parked review has moved is its own chip beside them, the card's chip, never the pill's text.
6951
6992
  *
6952
6993
  * Never "New" here, because being on this page is what ends it.
6953
6994
  */
6954
6995
  function renderStatePills(view) {
6955
6996
  const status = view.complete ? "complete" : "in-progress";
6956
- const pill = lifecyclePill(view.lifecycle, view.activity);
6957
- return `<span class="prb-card-status" data-status="${status}" data-page-status>${statusLabel(status)}</span>
6958
- <span class="prb-card-status prb-page-lifecycle" data-page-lifecycle${pill?.changed ? " data-changed" : ""}${pill ? "" : " hidden"}>${escapeHtml$1(pill?.text ?? "")}</span>`;
6997
+ const latest = !view.lineage || view.lineage.position >= view.lineage.total;
6998
+ const chip = lifecycleChip(view.lifecycle, view.activity);
6999
+ return `<span class="prb-state-pills">
7000
+ ${statusPillHtml(status, " data-page-status")}
7001
+ ${lifecycleControlHtml(view.lifecycle, view.activity, {
7002
+ interactive: latest,
7003
+ attributes: " data-page-lifecycle"
7004
+ })}
7005
+ <span class="prb-card-lifecycle" data-page-lifecycle-chip${chip === void 0 ? " hidden" : ""}>${escapeHtml$1(chip ?? "")}</span>
7006
+ </span>`;
6959
7007
  }
6960
7008
  /**
6961
7009
  * Everything that can be done to this review, from the page you are reading it on.
@@ -10535,7 +10583,10 @@ function renderBulkBar() {
10535
10583
  * this branch as far as the product knows; the earlier ones are history and are folded away until
10536
10584
  * asked for.
10537
10585
  *
10538
- * The checkbox sits outside the link, like the pin and the menu and for the same reason: it is a
10586
+ * The two pills, the menu and the pin are one row of controls over the card's top-right corner,
10587
+ * outside its link and after it, so a reader meets the title first and then what can be done to it:
10588
+ * where the reviewer is, what happens next, then the menu and the star. Outside because a button inside a link is not a thing HTML has, and a press on any of
10589
+ * them must never open the review. The checkbox sits outside the link for the same reason: it is a
10539
10590
  * control on the row rather than a way into the review. It is named by its branch, because fifteen
10540
10591
  * boxes announcing themselves as "Select" are fifteen identical announcements. It ships on every
10541
10592
  * card and is shown only in selection mode, so entering that mode is a stylesheet change rather
@@ -10552,17 +10603,14 @@ function renderCard(group, now, activity, rank, analysis, queued, moved, prState
10552
10603
  const line = collectionsLine(instance.memberOf, instance.refs, instance.placement === "home" ? void 0 : instance.placement.collection);
10553
10604
  const hidden = inProgressOnly || instance.hidden;
10554
10605
  const status = statusOf(review);
10555
- const chip = cardLifecycleChip(review.pinned === true, review.lifecycle, activity);
10606
+ const chip = lifecycleChip(review.lifecycle, activity);
10556
10607
  const href = `/r/${encodeURIComponent(review.id)}?t=${encodeURIComponent(review.token)}`;
10557
10608
  const followed = review.targetType === "commit" ? `commit ${(review.commitSha ?? review.branch).slice(0, 7)}` : followedRefName(review.branch, review.headResolvedRef) ?? review.branch;
10558
10609
  return `<article class="prb-card" data-card data-id="${escapeHtml$1(review.id)}" data-status="${status}" data-pinned="${review.pinned}"${queued === void 0 ? "" : ` data-queue="${queued}"`}${prState === void 0 ? "" : ` data-pr-state="${prState}"`}${review.authorHandle ? ` data-author="${escapeHtml$1(review.authorHandle)}"` : ""} data-lifecycle="${review.lifecycle?.state ?? "active"}"${review.lifecycle ? ` data-lifecycle-at="${review.lifecycle.at}"` : ""}${activityAttributes(activity)} data-rank="${rank}" data-reviews="${group.history.length}" data-lineage="${escapeHtml$1(group.history.map((entry) => entry.id).join(" "))}" data-search-text="${escapeHtml$1(groupSearchText(group))}" data-placement="${escapeHtml$1(placement)}" data-collections="${escapeHtml$1(instance.memberOf.join(" "))}"${inProgressOnly ? " data-in-progress-only" : ""}${hidden ? " hidden" : ""}>
10559
10610
  <input type="checkbox" class="prb-card-select" data-select="${escapeHtml$1(review.id)}" aria-label="Select ${escapeHtml$1(followed)}">
10560
- <button type="button" class="prb-card-pin" data-pin="${escapeHtml$1(review.id)}" aria-pressed="${review.pinned}" aria-label="${review.pinned ? "Unpin" : "Pin"} this review">${review.pinned ? "&#9733;" : "&#9734;"}</button>
10561
- ${renderCardMenu(group, followed, queued !== void 0, status, activity)}
10562
10611
  <a class="prb-card-link" href="${escapeHtml$1(href)}">
10563
10612
  <div class="prb-card-head">
10564
10613
  <h2>${escapeHtml$1(review.title)}</h2>
10565
- ${renderStatus(status)}
10566
10614
  ${renderPrState(prState)}
10567
10615
  ${`<span class="prb-card-lifecycle" data-lifecycle-chip${chip === void 0 ? " hidden" : ""}>${escapeHtml$1(chip ?? "")}</span>`}
10568
10616
  </div>
@@ -10579,12 +10627,18 @@ function renderCard(group, now, activity, rank, analysis, queued, moved, prState
10579
10627
  ${moved ? `<span class="prb-card-moved">${moved === "branch" ? "Branch updated" : "PR updated"}</span>` : ""}
10580
10628
  <span>${review.changedFiles} file${review.changedFiles === 1 ? "" : "s"}</span>
10581
10629
  <span class="prb-card-diffstat"><span class="prb-add">+${review.additions}</span> <span class="prb-del">&minus;${review.deletions}</span></span>
10582
- ${analysis !== void 0 && !review.hasStandardReview ? "" : `<span class="prb-card-left">${escapeHtml$1(whatIsLeft(review))}</span>`}
10630
+ ${analysis !== void 0 && !review.hasStandardReview ? "" : `<span class="prb-card-left">${renderLeft(whatIsLeft(review))}</span>`}
10583
10631
  ${renderAnalysisState(analysis)}
10584
10632
  <span class="prb-card-collections" data-collections-line${line === void 0 ? " hidden" : ""}>${escapeHtml$1(line ?? "")}</span>
10585
10633
  <span class="prb-card-when"><time datetime="${new Date(activity.at).toISOString()}" title="${escapeHtml$1(new Date(activity.at).toLocaleString())}">${escapeHtml$1(`${activityLabel(activity.kind)} ${relativeTime(activity.at, now)}`)}</time></span>
10586
10634
  </p>
10587
10635
  </a>
10636
+ <div class="prb-card-controls">
10637
+ ${statusPillHtml(status)}
10638
+ ${lifecycleControlHtml(review.lifecycle, activity, { interactive: true })}
10639
+ ${renderCardMenu(group, followed, queued !== void 0, status, activity)}
10640
+ <button type="button" class="prb-card-pin" data-pin="${escapeHtml$1(review.id)}" aria-pressed="${review.pinned}" aria-label="${review.pinned ? "Unpin" : "Pin"} this review">${review.pinned ? "&#9733;" : "&#9734;"}</button>
10641
+ </div>
10588
10642
  ${renderHistory(group, now)}
10589
10643
  </article>`;
10590
10644
  }
@@ -10770,14 +10824,30 @@ function renderAnalysisState(analysis) {
10770
10824
  * product does not track file-by-file review, so the card does not pretend it does.
10771
10825
  */
10772
10826
  function whatIsLeft(review) {
10773
- if (!review.hasStandardReview) return "No standard review yet";
10827
+ if (!review.hasStandardReview) return [{ text: "No standard review yet" }];
10774
10828
  const parts = [];
10775
- if (review.openIssues > 0) parts.push(`${review.openIssues} issue${review.openIssues === 1 ? "" : "s"}`);
10776
- else if (review.issues > 0) parts.push("all issues resolved");
10777
- if (review.unansweredQuestions > 0) parts.push(`${review.unansweredQuestions} unanswered question${review.unansweredQuestions === 1 ? "" : "s"}`);
10778
- else if (review.questions > 0) parts.push("all questions answered");
10779
- if (review.messages > 0) parts.push(`${review.messages} Buddy AI message${review.messages === 1 ? "" : "s"}`);
10780
- return parts.length > 0 ? parts.join(" · ") : "Nothing flagged";
10829
+ if (review.openIssues > 0) parts.push({
10830
+ text: `${review.openIssues} issue${review.openIssues === 1 ? "" : "s"}`,
10831
+ tone: "attention"
10832
+ });
10833
+ else if (review.issues > 0) parts.push({
10834
+ text: "Issues resolved",
10835
+ tone: "success"
10836
+ });
10837
+ if (review.unansweredQuestions > 0) parts.push({
10838
+ text: `${review.unansweredQuestions} unanswered question${review.unansweredQuestions === 1 ? "" : "s"}`,
10839
+ tone: "attention"
10840
+ });
10841
+ else if (review.questions > 0) parts.push({
10842
+ text: "Questions answered",
10843
+ tone: "success"
10844
+ });
10845
+ if (review.messages > 0) parts.push({ text: `${review.messages} Buddy AI message${review.messages === 1 ? "" : "s"}` });
10846
+ return parts.length > 0 ? parts : [{ text: "Nothing flagged" }];
10847
+ }
10848
+ /** The parts as the meta line draws them: a badge where there is a tone, plain words otherwise. */
10849
+ function renderLeft(parts) {
10850
+ return parts.map((part) => part.tone === void 0 ? `<span>${escapeHtml$1(part.text)}</span>` : `<span class="prb-card-badge" data-tone="${part.tone}">${part.tone === "success" ? "<span aria-hidden=\"true\">✓</span> " : ""}${escapeHtml$1(part.text)}</span>`).join("");
10781
10851
  }
10782
10852
  /**
10783
10853
  * Three states, and only one of them is inferred from anything.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prreviewbuddy",
3
- "version": "0.87.2",
3
+ "version": "0.88.1",
4
4
  "description": "Understand code changes before you approve them. Local branch and pull request reviews with Claude Code or Codex.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://prreviewbuddy.com",
@@ -1 +1 @@
1
- import{B as e}from"./chunk-CMC5F4_t.js";function t(e=document){for(let t of e.querySelectorAll(`.prb-index-status`))t.addEventListener(`click`,e=>{let n=t.querySelector(`select`);if(!(!n||e.target instanceof Node&&n.contains(e.target))){e.preventDefault(),n.focus();try{n.showPicker()}catch{}}})}function n(t,n){r(t,t=>e(t.dataset.section)?t.dataset.section:void 0,n)}function r(e,t,n){let r=Promise.resolve();for(let i of e){let e=t(i);if(e===void 0)continue;let a=i.open;i.addEventListener(`toggle`,()=>{if(i.open===a)return;a=i.open;let t=!i.open;r=r.then(()=>n(e,t)).catch(()=>{})})}}export{n,t as r,r as t};
1
+ import{z as e}from"./chunk-DRtin0n-.js";function t(e=document){for(let t of e.querySelectorAll(`.prb-index-status`))t.addEventListener(`click`,e=>{let n=t.querySelector(`select`);if(!(!n||e.target instanceof Node&&n.contains(e.target))){e.preventDefault(),n.focus();try{n.showPicker()}catch{}}})}function n(t,n){r(t,t=>e(t.dataset.section)?t.dataset.section:void 0,n)}function r(e,t,n){let r=Promise.resolve();for(let i of e){let e=t(i);if(e===void 0)continue;let a=i.open;i.addEventListener(`toggle`,()=>{if(i.open===a)return;a=i.open;let t=!i.open;r=r.then(()=>n(e,t)).catch(()=>{})})}}export{n,t as r,r as t};
@@ -0,0 +1 @@
1
+ import{at as e,bt as t,ct as n,et as r,it as i,ot as a,st as o,tt as s}from"./chunk-DRtin0n-.js";async function c(e,t){try{await navigator.clipboard.writeText(t);let n=e.textContent;e.textContent=`Copied`,window.setTimeout(()=>{e.textContent=n},1200)}catch{let n=document.createElement(`input`);n.type=`text`,n.readOnly=!0,n.value=t,n.className=`prb-menu-id`,n.setAttribute(`data-id-field`,``),e.after(n),n.select()}}var l=[`progress`,`overview`,`guide`,`issues`,`questions`,`files`,`prcontext`,`architecture`,`map`,`diagram`,`kiss`,`kissrecs`],u=`#theme-`,d=[`buddy`,`overview`,`guide`,`architecture`,`map`,`diagram`,`issues`,`questions`,`files`,`prcontext`,`kiss`,`kissrecs`,`progress`],f=`&focus=`;function p(e){return`#${e}`}function m(e){return`${u}${encodeURIComponent(e)}`}function h(e){let t=e.kind===`view`?p(e.view):m(e.sectionId);return e.focus?`${t}${f}${e.focus}`:t}var g=[`architecture`,`map`,`diagram`];function _(e,t){return g.includes(e)&&g.includes(t??``)?e:void 0}function v(e,t){let n=C(e),r=n?.kind===`view`&&n.view===t?n.focus:_(t,n?.focus);return h({kind:`view`,view:t,...r?{focus:r}:{}})}function y(e){let{focus:t,...n}=e;return n}function b(e,t){return e.kind!==`view`||e.view!==`guide`||!t?e:{kind:`section`,sectionId:t,...e.focus?{focus:e.focus}:{}}}function x(e){return d.includes(e)}function S(e){if(!e||typeof e!=`object`)return null;let{kind:t,view:n,sectionId:r,focus:i}=e,a=typeof i==`string`&&x(i)?{focus:i}:{};return t===`view`&&typeof n==`string`&&l.includes(n)?{kind:t,view:n,...a}:t===`section`&&typeof r==`string`&&r!==``?{kind:t,sectionId:r,...a}:null}function C(e){let t=e.indexOf(f);if(t===-1)return w(e);let n=w(e.slice(0,t));if(!n)return null;let r=e.slice(t+7);return x(r)?{...n,focus:r}:n}function w(e){if(e.startsWith(u)){let t=e.slice(7);if(!t)return null;try{return{kind:`section`,sectionId:decodeURIComponent(t)}}catch{return null}}let t=e.replace(/^#/,``);return l.includes(t)?{kind:`view`,view:t}:null}var T=`pushedFocus`;function E(e){let{[T]:t,...n}=e;return n}function D(e,t){return e.kind===`view`&&t.kind===`view`?e.view===t.view:e.kind===`section`&&t.kind===`section`&&e.sectionId===t.sectionId}function O(e,t,n){if(e.focus===t)return;let r={...y(E(e)),focus:t};e.focus&&n.history.state?.[T]?n.history.replaceState({...r,[T]:!0},``,h(r)):n.history.pushState({...r,[T]:!0},``,h(r)),n.apply(r)}function k(e,t){if(!e.focus)return;if(t.history.state?.[T]){t.history.back();return}let n=y(E(e));t.history.replaceState(n,``,h(n)),t.apply(n)}function A(e,n,r){if(!r||e.key!==`Escape`||e.defaultPrevented||n.querySelector(`dialog[open], [data-menu-panel]:not([hidden]), [data-analysis-details][open], [data-range-details][open], .pr-helper-selection-popover`))return!1;let i=e.target;return!(i?.closest?.(`[data-ask-resize]`)||i instanceof HTMLInputElement&&t(i)&&i.value!==``)}function j(e,t,n){e&&(n?e.dataset.focus=n:delete e.dataset.focus);for(let e of t.querySelectorAll(`[data-focus-toggle]`)){let t=e.dataset.focusToggle===n,r=e.dataset.focusName??`this`,i=t?`Exit focus on ${r}`:`Expand ${r}`;e.setAttribute(`aria-pressed`,String(t)),e.setAttribute(`aria-label`,i),e.setAttribute(`title`,t?`${i} (Esc)`:i)}}function M(e,t){e.dataset.status=t,e.textContent=r(t),e.tagName===`BUTTON`&&e.setAttribute(`aria-label`,s(t))}function N(t,r,s){if(t.dataset.lifecyclePill=r?.state??`active`,t.textContent=e(r),t.tagName!==`BUTTON`)return;let c=a(r);t.dataset.lifecyclePress=c,t.setAttribute(`aria-label`,o(r)),c===`menu`?(t.setAttribute(`data-menu-trigger`,``),t.setAttribute(`aria-haspopup`,`true`),t.hasAttribute(`aria-expanded`)||t.setAttribute(`aria-expanded`,`false`)):(t.removeAttribute(`data-menu-trigger`),t.removeAttribute(`aria-haspopup`),t.removeAttribute(`aria-expanded`));let l=t.closest(`[data-lifecycle-control]`);for(let e of l?.querySelectorAll(`[data-lifecycle-set]`)??[]){let t=e.dataset.lifecycleSet;e.hidden=!n(t,r,s),e.textContent=i(t,r,s)}}function P(e,t){!e||e.tagName!==`BUTTON`||(t?(e.setAttribute(`aria-busy`,`true`),e.setAttribute(`aria-disabled`,`true`)):(e.removeAttribute(`aria-busy`),e.removeAttribute(`aria-disabled`)))}function F(e){return e?.getAttribute(`aria-busy`)===`true`}function I(e,t){let n=t.toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?[...e]:e.filter(e=>{let t=`${e.name}\n${e.prompt}`.toLowerCase();return n.every(e=>t.includes(e))})}function L(e){return e<0||e>=10?null:e===9?`0`:String(e+1)}function R(e){return/^[0-9]$/.test(e)?e===`0`?9:Number(e)-1:null}function z(e){return{title:`Choose a prompt`,mount(t,n){let r=t.ownerDocument,i=e.prompts(),a=r.createElement(`input`);a.type=`search`,a.className=`prb-palette-input`,a.placeholder=`Filter prompts`,a.setAttribute(`aria-label`,`Filter prompts`),a.spellcheck=!1;let o=r.createElement(`p`);o.className=`prb-palette-summary`,o.setAttribute(`aria-live`,`polite`);let s=r.createElement(`div`);s.className=`prb-palette-results`,s.setAttribute(`role`,`group`),s.setAttribute(`aria-label`,`Prompts`);let c=[],l=()=>[...s.querySelectorAll(`[data-prompt-choice]`)],u=()=>{let e=r.activeElement===a;for(let[t,n]of l().entries())n.toggleAttribute(`data-enter-target`,e&&t===0)},d=()=>{c=I(i,a.value),s.replaceChildren(...c.map((e,t)=>{let n=r.createElement(`button`);n.type=`button`,n.className=`prb-palette-result prb-palette-prompt`,n.dataset.promptChoice=e.id;let i=r.createElement(`kbd`);i.className=`prb-kbd prb-palette-num`;let a=L(t);a?i.textContent=a:i.setAttribute(`aria-hidden`,`true`);let o=r.createElement(`span`);o.className=`prb-palette-prompt-text`;let s=r.createElement(`span`);s.className=`prb-palette-result-title`,s.textContent=e.name;let c=r.createElement(`span`);return c.className=`prb-palette-prompt-said`,c.textContent=e.prompt,o.append(s,c),n.append(i,o),n})),o.textContent=i.length===0?`No saved prompts yet. Add one under Your prompts in Buddy AI.`:c.length===0?`No prompts match.`:c.length===i.length?`${i.length} ${i.length===1?`prompt`:`prompts`}`:`${c.length} of ${i.length} prompts`,u()},f=t=>{!t||!c.some(e=>e.id===t)||(n(),e.choose(t))},p=e=>{a.value=e===`Backspace`?a.value.slice(0,-1):a.value+e,a.focus(),a.dispatchEvent(new Event(`input`,{bubbles:!0}))};a.addEventListener(`input`,d),a.addEventListener(`focus`,u),a.addEventListener(`blur`,u),s.addEventListener(`click`,e=>{f(e.target.closest(`[data-prompt-choice]`)?.dataset.promptChoice)}),t.addEventListener(`keydown`,e=>{if(e.isComposing||e.metaKey||e.ctrlKey||e.altKey)return;let t=l(),n=e.target===a,r=t.indexOf(e.target),i=R(e.key);if(i!==null)return e.preventDefault(),f(t[i]?.dataset.promptChoice);if(e.key===`Enter`)return e.preventDefault(),f((n?t[0]:t[r])?.dataset.promptChoice);let o=e.key===`ArrowDown`||!n&&e.key===`j`,s=e.key===`ArrowUp`||!n&&e.key===`k`;if(o||s){let n=o?r<0?t[0]:t[r+1]:r<=0?a:t[r-1];e.preventDefault(),n?.focus();return}!n&&(e.key.length===1||e.key===`Backspace`)&&(e.preventDefault(),p(e.key))}),t.append(a,o,s),d(),a.focus()}}}var B=`Fetch selected`;function V(e){return`${e} ${e===1?`repository`:`repositories`}`}function H(e){return`Fetching ${V(e)}…`}function U(e){return e.fetched===0?`Could not fetch ${V(e.repositories)}`:e.fetched===e.repositories?`Fetched ${V(e.repositories)}`:`Fetched ${e.fetched} of ${V(e.repositories)}`}function W(e,t){let n=new Set,r=new Set;for(let i of e)for(let e of i.lineage){let i=t[e];i!==void 0&&(n.add(e),r.add(i))}return{ids:[...n],repositories:r.size}}function G(e,t){return W(t,e).repositories>0}export{b as C,C as S,c as T,D as _,H as a,h as b,L as c,F as d,P as f,j as g,k as h,U as i,N as l,A as m,G as n,z as o,O as p,W as r,R as s,B as t,M as u,d as v,v as w,S as x,_ as y};
@@ -1 +1 @@
1
- import{_t as e}from"./chunk-CMC5F4_t.js";var t=`button:not([disabled])`;function n(e){return e.querySelector(`[data-menu-panel]`)}function r(e){return e.querySelector(`[data-menu-trigger]`)}function i(e){let t=n(e);return t?[...t.querySelectorAll(`input:not([disabled]), textarea:not([disabled]), button:not([disabled])`)].filter(e=>!e.closest(`[hidden]`)):[]}function a(e){let r=n(e);return r?[...r.querySelectorAll(t)].filter(e=>!e.closest(`[hidden]`)):[]}var o=`data-menu-placement`,s=`data-menu-align`;function c(e){let t=e.ownerDocument.defaultView,n=0,r=t?.innerHeight??1/0,i=0,a=t?.innerWidth??1/0,o=e=>e!==`visible`&&e!==``;for(let s=e.parentElement;s&&t;s=s.parentElement){let e=t.getComputedStyle(s);if(!o(e.overflowY)&&!o(e.overflowX))continue;let c=s.getBoundingClientRect();o(e.overflowY)&&(n=Math.max(n,c.top),r=Math.min(r,c.bottom)),o(e.overflowX)&&(i=Math.max(i,c.left),a=Math.min(a,c.right))}return{top:n,bottom:r,left:i,right:a}}var l=8,u=120;function d(e){let t=n(e),i=r(e);if(!t||!i)return;t.removeAttribute(o),t.removeAttribute(s),t.style.removeProperty(`max-height`),t.style.removeProperty(`overflow-y`),t.style.removeProperty(`box-sizing`),t.scrollTop=0;let a=t.getBoundingClientRect(),d=i.getBoundingClientRect(),f=c(e);a.right>f.right-l&&d.right-a.width>=f.left+l&&t.setAttribute(s,`end`);let p=Math.max(0,a.top-d.bottom),m=f.bottom-d.bottom-p-l,h=d.top-f.top-p-l,g=a.height,_=g<=m?`below`:g<=h||h>m?`above`:`below`;_===`above`&&t.setAttribute(o,`above`);let v=_===`above`?h:m;g<=v||(t.style.boxSizing=`border-box`,t.style.maxHeight=`${Math.max(Math.floor(v),u)}px`,t.style.overflowY=`auto`)}function f(e){return!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey?e.key===`j`?`ArrowDown`:e.key===`k`?`ArrowUp`:e.key:e.key}function p(t,o={}){let s=null,c=null,l=o.within?`${o.within} [data-menu]`:`[data-menu]`,u=e=>e&&(!o.within||e.closest(o.within))?e:null,p=(e,t={})=>{let i=n(e);if(!i||i.hidden)return;i.hidden=!0;let a=r(e);a?.setAttribute(`aria-expanded`,`false`);let l=s===e?c:null;s===e&&(s=null,c=null),o.onClose?.(e),t.returnFocus&&(l??(()=>a?.focus()))()},m=()=>{for(let e of t.querySelectorAll(l))p(e)},h=(e,t,i=null)=>{let l=n(e);l&&(m(),c=i,o.onOpen?.(e),l.hidden=!1,d(e),r(e)?.setAttribute(`aria-expanded`,`true`),s=e,t&&a(e)[0]?.focus())};return t.addEventListener(`click`,e=>{let t=e.target,r=u(t?.closest?.(`[data-menu]`)??null);if(!r){m();return}if(t?.closest(`[data-menu-trigger]`)){let t=e.detail===0;n(r)?.hidden?h(r,t):p(r);return}s&&s!==r&&p(s)}),t.addEventListener(`keydown`,t=>{if(s&&!s.isConnected&&(s=null),!s)return;let n=s;if(t.key===`Escape`){t.preventDefault(),p(n,{returnFocus:!0});return}if(!n.contains(t.target))return;if(t.key===`Tab`){if(n.hasAttribute(`data-menu-form`)){let e=i(n),r=e.indexOf(t.target);if(e.length>0){t.preventDefault(),e[(r+(t.shiftKey?-1:1)+e.length)%e.length].focus();return}}p(n);return}if(e(t.target))return;let r=a(n);if(r.length===0)return;let o=r.indexOf(t.target),c=f(t),l=c===`ArrowDown`?r[(o+1)%r.length]:c===`ArrowUp`?r[(o-1+r.length)%r.length]:c===`Home`?r[0]:c===`End`?r[r.length-1]:null;l&&(t.preventDefault(),l.focus(),l.scrollIntoView({block:`nearest`}))}),{open:(e,t={})=>h(e,t.focusFirst===!0,t.returnFocus??null),close:p,closeAll:m}}function m(e){return e<3e4?1e3:e<12e4?3e3:e<6e5?8e3:15e3}export{p as n,m as t};
1
+ import{bt as e}from"./chunk-DRtin0n-.js";var t=`button:not([disabled])`;function n(e){return e.querySelector(`[data-menu-panel]`)}function r(e){return e.querySelector(`[data-menu-trigger]`)}function i(e){let t=n(e);return t?[...t.querySelectorAll(`input:not([disabled]), textarea:not([disabled]), button:not([disabled])`)].filter(e=>!e.closest(`[hidden]`)):[]}function a(e){let r=n(e);return r?[...r.querySelectorAll(t)].filter(e=>!e.closest(`[hidden]`)):[]}var o=`data-menu-placement`,s=`data-menu-align`;function c(e){let t=e.ownerDocument.defaultView,n=0,r=t?.innerHeight??1/0,i=0,a=t?.innerWidth??1/0,o=e=>e!==`visible`&&e!==``;for(let s=e.parentElement;s&&t;s=s.parentElement){let e=t.getComputedStyle(s);if(!o(e.overflowY)&&!o(e.overflowX))continue;let c=s.getBoundingClientRect();o(e.overflowY)&&(n=Math.max(n,c.top),r=Math.min(r,c.bottom)),o(e.overflowX)&&(i=Math.max(i,c.left),a=Math.min(a,c.right))}return{top:n,bottom:r,left:i,right:a}}var l=8,u=120;function d(e){let t=n(e),i=r(e);if(!t||!i)return;t.removeAttribute(o),t.removeAttribute(s),t.style.removeProperty(`max-height`),t.style.removeProperty(`overflow-y`),t.style.removeProperty(`box-sizing`),t.scrollTop=0;let a=t.getBoundingClientRect(),d=i.getBoundingClientRect(),f=c(e);a.right>f.right-l&&d.right-a.width>=f.left+l&&t.setAttribute(s,`end`);let p=Math.max(0,a.top-d.bottom),m=f.bottom-d.bottom-p-l,h=d.top-f.top-p-l,g=a.height,_=g<=m?`below`:g<=h||h>m?`above`:`below`;_===`above`&&t.setAttribute(o,`above`);let v=_===`above`?h:m;g<=v||(t.style.boxSizing=`border-box`,t.style.maxHeight=`${Math.max(Math.floor(v),u)}px`,t.style.overflowY=`auto`)}function f(e){return!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey?e.key===`j`?`ArrowDown`:e.key===`k`?`ArrowUp`:e.key:e.key}function p(t,o={}){let s=null,c=null,l=o.within?`${o.within} [data-menu]`:`[data-menu]`,u=e=>e&&(!o.within||e.closest(o.within))?e:null,p=(e,t={})=>{let i=n(e);if(!i||i.hidden)return;i.hidden=!0;let a=r(e);a?.setAttribute(`aria-expanded`,`false`);let l=s===e?c:null;s===e&&(s=null,c=null),o.onClose?.(e),t.returnFocus&&(l??(()=>a?.focus()))()},m=()=>{for(let e of t.querySelectorAll(l))p(e)},h=(e,t,i=null)=>{let l=n(e);l&&(m(),c=i,o.onOpen?.(e),l.hidden=!1,d(e),r(e)?.setAttribute(`aria-expanded`,`true`),s=e,t&&a(e)[0]?.focus())};return t.addEventListener(`click`,e=>{let t=e.target,r=u(t?.closest?.(`[data-menu]`)??null);if(!r){m();return}if(t?.closest(`[data-menu-trigger]`)){let t=e.detail===0;n(r)?.hidden?h(r,t):p(r);return}s&&s!==r&&p(s)}),t.addEventListener(`keydown`,t=>{if(s&&!s.isConnected&&(s=null),!s)return;let n=s;if(t.key===`Escape`){t.preventDefault(),p(n,{returnFocus:!0});return}if(!n.contains(t.target))return;if(t.key===`Tab`){if(n.hasAttribute(`data-menu-form`)){let e=i(n),r=e.indexOf(t.target);if(e.length>0){t.preventDefault(),e[(r+(t.shiftKey?-1:1)+e.length)%e.length].focus();return}}p(n);return}if(e(t.target))return;let r=a(n);if(r.length===0)return;let o=r.indexOf(t.target),c=f(t),l=c===`ArrowDown`?r[(o+1)%r.length]:c===`ArrowUp`?r[(o-1+r.length)%r.length]:c===`Home`?r[0]:c===`End`?r[r.length-1]:null;l&&(t.preventDefault(),l.focus(),l.scrollIntoView({block:`nearest`}))}),{open:(e,t={})=>h(e,t.focusFirst===!0,t.returnFocus??null),close:p,closeAll:m}}function m(e){return e<3e4?1e3:e<12e4?3e3:e<6e5?8e3:15e3}export{p as n,m as t};
@@ -0,0 +1 @@
1
+ function e(e,t){e.addEventListener(`pageshow`,e=>{e.persisted&&t()})}var t=[`checkbox`,`radio`,`button`,`submit`,`reset`].map(e=>`:not([type="${e}"])`).join(``);function n(e){if(!e||typeof e.closest!=`function`)return!1;let n=e;return n.isContentEditable?!0:n.closest(`input${t}, textarea, select, [contenteditable=""], [contenteditable="true"]`)!==null}var r=`prbNav`,i=`prb-workspace`,a=`prb-nav-session`,o=`prb-nav-head`,s=`prb-nav-handoff`,c=`prb-nav-places`,l=200,u=15e3,d=`unstored`;function f(e){if(!e||typeof e!=`object`)return null;let t=e[r];if(!t||typeof t!=`object`)return null;let{v:n,owner:i,session:a,idx:o,id:s,ui:c}=t;if(n!==1||i!==`prb-workspace`||typeof a!=`string`||a===``||typeof o!=`number`||!Number.isInteger(o)||o<0)return null;let l=c&&typeof c==`object`&&!Array.isArray(c)?c:null;return{v:n,owner:i,session:a,idx:o,...typeof s==`string`&&s!==``?{id:s}:{},ui:l}}function p(e){if(!e||typeof e!=`object`)return{};let{[r]:t,...n}=e;return n}function m(e,t){if(!e||typeof e!=`object`)return!1;let n=e;return n.owner===`prb-workspace`&&n.session===t}function h(e,t){try{return e?.getItem(t)??null}catch{return null}}function g(e,t,n){try{n===null?e?.removeItem(t):e?.setItem(t,n)}catch{}}function _(e){let{history:t,storage:n,location:_}=e,v=e.navigation??null,y=[],b=null,x=null,S=null,C=t=>{S!==null&&e.clearTimeout(S),S=t?t():null,e.capturePending(S!==null)},w=null,T=(()=>{if(!n)return d;let t=h(n,a);if(t)return t;let r=e.uuid();return g(n,a,r),h(n,a)===r?r:d})(),E=()=>`${_.pathname}${_.search}`,D=e=>`${E()}${e}`,O=()=>{try{v?.updateCurrentEntry({state:{owner:i,session:T}})}catch{}},k=()=>{for(let e of y)e()},A=(e,n)=>{n===void 0?t.replaceState(e,``):t.replaceState(e,``,n),O()},j=()=>Number(h(n,o)??0)||0,M=()=>{try{let e=JSON.parse(h(n,c)??`{}`);return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}catch{return{}}},ee=(e,t)=>{if(!e||!n)return;let r=M();delete r[e],r[e]=t;let i=Object.keys(r);for(let e of i.slice(0,Math.max(0,i.length-l)))delete r[e];g(n,c,JSON.stringify(r))},te=e=>{if(!e)return null;let t=e.id?M()[e.id]:void 0;return t&&typeof t==`object`&&!Array.isArray(t)?t:e.ui},ne=()=>{if(!b)return null;try{return b()}catch{return null}},re=()=>{let a=f(t.state);if(a&&a.session===T&&a.id){w=a.id,O();return}let c=a?.idx??0;if(!a){let t=h(n,s);g(n,s,null),c=0;try{let n=t?JSON.parse(t):null,r=e.referrer!==``&&new URL(e.referrer).origin===_.origin;n&&r&&n.session===T&&typeof n.idx==`number`&&typeof n.at==`number`&&e.now()-n.at<u&&(c=n.idx+1)}catch{c=0}g(n,o,String(c))}let l=a?.id??e.uuid();w=l;let d={v:1,owner:i,session:T,idx:c,id:l,ui:a?.ui??null};A({...p(t.state),[r]:d})},N=()=>f(t.state)??{v:1,owner:`prb-workspace`,session:T,idx:0,ui:null},P=()=>{S!==null&&C(null);let e=ne();if(!e||!w)return;let n=JSON.stringify(e),i=f(t.state);if(!i||i.id!==w){ee(w,e);return}(n!==x||JSON.stringify(i.ui)!==n)&&(x=n,ee(w,e),A({...p(t.state),[r]:{...i,ui:e}}))},F=e=>{if(v){let t=v.currentEntry?.index;if(typeof t!=`number`||t<0)return!1;let n=v.entries()[t+e];if(!n)return!1;try{return m(n.getState(),T)}catch{return!1}}let n=f(t.state);return!n||n.session!==T||t.length<2?!1:e===-1?n.idx>0:n.idx<j()};re();try{t.scrollRestoration=`manual`}catch{}return{session:T,current(){return{route:p(t.state),ui:te(f(t.state))}},push(a,s){if(a!==``&&!a.startsWith(`#`))throw Error(`Workspace history pushes within this document only; "${a}" is not a fragment.`);if(D(a)===`${E()}${_.hash}`)return!1;P();let c=N().idx+1;g(n,o,String(c));let l=e.uuid(),u={v:1,owner:i,session:T,idx:c,id:l,ui:null};return w=l,t.pushState({...p(s),[r]:u},``,D(a)),x=null,O(),k(),!0},replace(e,t){if(e!==``&&!e.startsWith(`#`))throw Error(`Workspace history replaces within this document only; "${e}" is not a fragment.`);A({...p(t),[r]:N()},D(e))},setCapturer(e){b=e},captureNow:P,scheduleCapture(){C(()=>e.setTimeout(P,250))},leaving(){P(),g(n,s,JSON.stringify({session:T,idx:N().idx,at:e.now()}))},canGoBack:()=>F(-1),canGoForward:()=>F(1),back(){return F(-1)?(P(),t.back(),!0):!1},forward(){return F(1)?(P(),t.forward(),!0):!1},moved(){S!==null&&C(null);let e=ne();e&&ee(w,e),x=null,w=f(t.state)?.id??null;let n=f(t.state);!n||!n.id||n.session!==T?re():O(),k()},onAvailability(e){y.push(e)}}}function v(e){return e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey}function y(e){let t=e?.userAgentData?.platform??e?.platform??``;return/mac|iphone|ipad/i.test(t)}function b(e,t,r){if(e.defaultPrevented||e.isComposing)return null;let i=t?e.metaKey:e.ctrlKey,a=t?e.ctrlKey:e.metaKey;if(!i||a||e.altKey||e.shiftKey)return null;let o=e.key===`[`||e.key!==`]`&&e.code===`BracketLeft`?`back`:e.key===`]`||e.code===`BracketRight`?`forward`:null;return!o||n(e.target)||r.querySelector(`dialog[open], [data-menu-panel]:not([hidden])`)?null:o}var x=[`data-id`,`data-finding-card`,`data-goto-section`,`data-view-nav`,`data-file`,`data-line`,`data-history`,`data-history-toggle`,`data-load-more`,`data-select`,`data-pin`,`data-focus-toggle`,`data-ask-toggle`,`data-rail-toggle`,`data-search`,`data-status-filter`,`data-author-filter`,`data-pr-filter`,`data-card`,`data-placement`,`data-collection`,`data-notification-id`,`data-guide-section`,`data-guide-detail`,`data-view`];function S(e){if(e.id)return{attrs:[[`id`,e.id]]};let t=x.filter(t=>e.hasAttribute(t)).map(t=>[t,e.getAttribute(t)??``]);return t.length>0?{attrs:t}:null}function C(e,t){if(!e||e===t||!t.contains(e))return null;let n=[],r=e;for(;r&&r!==t&&n.length<3;){let t=S(r);t?n.unshift(t):r===e&&n.unshift({tag:r.tagName.toLowerCase(),...r.classList[0]?{cls:r.classList[0]}:{}}),r=r.parentElement}return n.length>0?n:null}function w(e){if(!e||typeof e!=`object`)return!1;let{attrs:t,tag:n,cls:r}=e;return t===void 0?typeof n==`string`&&/^[a-z][a-z0-9-]*$/.test(n)&&(r===void 0||typeof r==`string`):Array.isArray(t)&&t.length>0&&t.every(e=>Array.isArray(e)&&e.length===2&&x.concat(`id`).includes(e[0])&&typeof e[1]==`string`)}function T(e,t){return t.attrs?t.attrs.every(([t,n])=>e.getAttribute(t)===n):e.tagName.toLowerCase()===t.tag&&(t.cls===void 0||e.classList.contains(t.cls))}function E(e,t){let n=t.attrs?`[${t.attrs[0][0]}]`:t.tag;for(let r of e.querySelectorAll(n))if(T(r,t))return r;return null}function D(e,t){if(!Array.isArray(t)||t.length===0||!t.every(w))return null;let n=null,r=e;for(let e of t){let t=E(r,e);if(!t)return n;n=t,r=t}return n}function O(e){let t=e.activeElement;return{focus:C(t,e.body),focusVisible:t!==null&&t!==e.body&&t.matches(`:focus-visible`)}}function k(e,t,n){let r=D(e,t);if(!r)return;let i={preventScroll:!0,focusVisible:n===!0};if(r.tabIndex<0&&!r.matches(`a[href], button, input, select, textarea, summary`)){r.querySelector(`a[href], button:not([disabled]), input, select, textarea, [tabindex="0"]`)?.focus(i);return}r.focus(i)}function A(e,t){let n=e?.[t];return typeof n==`number`&&Number.isFinite(n)&&n>=0?n:null}function j(e,t){let n=e?.[t];return Array.isArray(n)?n.filter(e=>typeof e==`string`):[]}function M(e){try{return e.sessionStorage}catch{return null}}function ee(e,t){let n=e===`back`?`[`:`]`;return`${e===`back`?`Back`:`Forward`} (${t?`⌘${n}`:`Ctrl+${n}`})`}function te(e,t){if(e.target&&e.target!==`_self`||e.hasAttribute(`download`))return!1;let n;try{n=new URL(e.getAttribute(`href`)??``,t.href)}catch{return!1}return n.origin===t.origin?n.pathname!==t.pathname||n.search!==t.search:!1}function ne(e,t){let n=e.querySelector(`[data-nav-announce]`);!n||!t||(n.textContent=``,e.defaultView?.setTimeout(()=>{n.textContent=t},50))}function re(e={},t=window,n=document){let r=t.navigation??null,i=_({history:t.history,navigation:r,storage:M(t),location:t.location,referrer:n.referrer,now:()=>Date.now(),uuid:()=>t.crypto?.randomUUID?.()??`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,setTimeout:(e,n)=>t.setTimeout(e,n),clearTimeout:e=>t.clearTimeout(e),capturePending:e=>n.documentElement.toggleAttribute(`data-nav-capture-pending`,e)}),a=y(t.navigator),o=[...n.querySelectorAll(`[data-history]`)],s=()=>{for(let e of o)e.disabled=!((e.dataset.history===`forward`?`forward`:`back`)==`back`?i.canGoBack():i.canGoForward())};for(let e of o){let t=e.dataset.history===`forward`?`forward`:`back`;e.dataset.tip=ee(t,a),e.addEventListener(`click`,()=>{t===`back`?i.back():i.forward()})}s(),i.onAvailability(s),r?.addEventListener?.(`currententrychange`,s),t.addEventListener(`keydown`,e=>{let t=b(e,a,n);t&&(e.preventDefault(),t===`back`?i.back():i.forward())}),t.addEventListener(`popstate`,()=>i.moved()),t.addEventListener(`pagehide`,()=>i.captureNow()),n.addEventListener(`visibilitychange`,()=>{n.visibilityState===`hidden`&&i.captureNow()}),n.addEventListener(`click`,e=>{let n=e.target?.closest?.(`a[href]`);!n||!v(e)||e.defaultPrevented||te(n,t.location)&&i.leaving()},!0),n.addEventListener(`pointerdown`,e=>{(e.button===3||e.button===4)&&i.captureNow()},!0);let c=()=>i.scheduleCapture();for(let e of[`scroll`,`click`,`input`,`toggle`,`focusin`])n.addEventListener(e,c,{capture:!0,passive:!0});if(!e.ownsRestore){let e=n.querySelector(`.prb-shell > main`);i.setCapturer(()=>({main:e?.scrollTop??0,...O(n)}));let{ui:t}=i.current(),r=A(t,`main`);e&&r!==null&&(e.scrollTop=r),t&&k(n,t.focus,t.focusVisible)}return i}var N=[{id:`active`,name:`Active`,action:`Move to active`},{id:`waiting`,name:`Waiting`,action:`Mark waiting`},{id:`done`,name:`Done`,action:`Mark done`}];function P(e){if(typeof e!=`object`||!e)return;let{state:t,at:n}=e;if(!(t!==`waiting`&&t!==`done`||typeof n!=`number`||!Number.isFinite(n)))return{state:t,at:n}}function F(e){return N.find(t=>t.id===e).action}function ie(e){return N.find(t=>t.id===(e?.state??`active`)).name}function ae(e){return e?.state===`waiting`?`menu`:e?.state===`done`?`active`:`done`}function oe(e){let t=ae(e);return`${ie(e)}. ${t===`menu`?`Choose what happens next`:F(t)}`}var se=[`created`,`updated`,`merged`,`closed`,`reopened`];function ce(e){return le({at:Number(e.activityAt),kind:e.activityKind,...e.activityMovedAt===void 0?{}:{movedAt:Number(e.activityMovedAt)}})}function le(e){if(typeof e!=`object`||!e)return;let{at:t,kind:n,movedAt:r}=e;if(!(typeof t!=`number`||!Number.isFinite(t)||!se.includes(n)))return{at:t,kind:n,...typeof r==`number`&&Number.isFinite(r)?{movedAt:r}:{}}}function ue(e,t){return!e||e.state===`waiting`&&fe(e,t)?`active`:e.state}function de(e,t){if(!e||!t)return;if(e.state===`waiting`)return fe(e,t)?`Changed while waiting`:void 0;if(t.kind===`reopened`&&t.at>e.at)return`Reopened since done`;let n=t.movedAt??(t.kind===`updated`?t.at:void 0);return n!==void 0&&n>e.at?`Changed since done`:void 0}function fe(e,t){return t!==void 0&&t.kind!==`created`&&t.at>e.at}function pe(e,t,n){return de(t,n)!==void 0||e!==(t?.state??`active`)}function me(e,t,n){return e===`done`&&t?.state===`done`&&de(t,n)!==void 0?`Keep done`:F(e)}var he=[`pinned`,`active`,`waiting`,`done`],ge=[`in-progress`,...he],_e=e=>N.find(t=>t.id===e).name,ve={"in-progress":{title:`In progress`,key:`i`},pinned:{title:`Pinned`,key:`p`},active:{title:_e(`active`),key:`a`},waiting:{title:_e(`waiting`),key:`w`},done:{title:_e(`done`),key:`d`}};function ye(e){return typeof e==`string`&&ge.includes(e)}function be(e){if(ye(e))return!0;if(typeof e!=`string`)return!1;let t=/^collection(?:-done)?:(.*)$/.exec(e);return t!==null&&Se(t[1])}var xe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Se(e){return typeof e==`string`&&xe.test(e)}function Ce(e,t,n,r){return e&&!I(r)?`pinned`:ue(t,n)}function we(e,t,n,r,i){if(!(r&&!e&&!I(i)))return Ce(e,t,n,i)}function Te(e,t,n,r){if(!(e||I(r)))return ue(t,n)===`done`?`completed`:`active`}function Ee(e,t){let n=`${e} active`;return t===0?n:`${n} · ${t} pinned`}function De(e,t,n){let r=t.filter(t=>t.id!==n&&e.includes(t.id)).map(e=>e.name);if(r.length!==0)return`${n===void 0?`In`:`Also in`} ${r.join(`, `)}`}function Oe(e,t){if(!(e.active>0))return t?`Nothing in this collection matches the filters.`:e.members===0?`Nothing here yet. Add reviews from a card’s menu, or select several and choose Manage collections.`:e.pinned>0&&e.completed===0?`Its reviews are pinned, so they are listed under Pinned.`:`No active reviews`}function ke(e){return`Show completed (${e})`}function Ae(e,t,n){let r=new Map;for(let i of e){let e=t(i);if(e===void 0)continue;let a=r.get(e)??{shown:[],total:0};a.total<n(e)&&a.shown.push(i),a.total+=1,r.set(e,a)}return r}function je(e,t){let n=e.filter(e=>e.includes(t)).length;return n===0?`none`:n===e.length?`all`:`some`}function Me(e){return e===`all`?`remove`:`add`}var Ne=`none`;function Pe(e,t){if(t.length===0)return!0;let n=e??[];return n.length===0?t.includes(Ne):n.some(e=>t.includes(e))}function Fe(e,t){return e.length===0?`All`:e.length>1?`${e.length} chosen`:e[0]===`none`?`Uncollected`:t.find(t=>t.id===e[0])?.name??`All`}function I(e){return e===`queue`}var Ie=[`all`,`queue`,`in-progress`,`complete`],Le=[`any`,`open`,`merged`,`closed`],Re=[`q`,`f`,`by`,`pr`,`col`,`page`],L={query:``,filter:`all`,author:``,pr:`any`,collections:[]};function ze(e){return e.query.trim()!==``||e.filter!==L.filter||e.author!==L.author||e.pr!==L.pr||e.collections.length>0}function Be(e,t,n){let r=n===void 0?`${e} review${e===1?``:`s`}`:`${e} of ${n} review${n===1?``:`s`}`;return e===t?r:`${r} · ${t} branch${t===1?``:`es`}`}function Ve(e,t,n){let r={pinned:{shown:[],total:0},active:{shown:[],total:0},waiting:{shown:[],total:0},done:{shown:[],total:0}};for(let i of e){let e=t(i),a=r[e];a.total<n[e]&&a.shown.push(i),a.total+=1}return r}function He(){return{pinned:15,active:15,waiting:15,done:15}}function Ue(e){let t=new URLSearchParams(e.replace(/^#/,``)),n=t.get(`f`)??``,r=t.get(`pr`)??``,i=new URLSearchParams;for(let[e,n]of t)!Re.includes(e)&&/^[a-z][a-z0-9_-]*$/i.test(e)&&n!==``&&i.append(e,n);let a=i.toString();return{query:t.get(`q`)??``,filter:Ie.includes(n)?n:`all`,author:t.get(`by`)??``,pr:Le.includes(r)?r:`any`,collections:[...new Set((t.get(`col`)??``).split(`,`).filter(e=>e===`none`||Se(e)))],...a===``?{}:{extra:a}}}function We(e){let t=new URLSearchParams;e.query!==``&&t.set(`q`,e.query),e.filter!==`all`&&t.set(`f`,e.filter),e.author!==``&&t.set(`by`,e.author),e.pr!==`any`&&t.set(`pr`,e.pr),e.collections.length>0&&t.set(`col`,e.collections.join(`,`));for(let[n,r]of new URLSearchParams(e.extra??``))Re.includes(n)||t.append(n,r);let n=t.toString();return n===``?``:`#${n}`}function Ge(e,t){return t===`all`||t===`queue`?!0:t===`in-progress`?e.status!==`complete`:e.status===t}function Ke(e,t){return t===`any`||e.prState===t}function qe(e,t){return t===``||e===t}function Je(e){return e===`complete`?`Mark reviewed`:`Mark not reviewed`}function Ye(e){return e?`Unpin review`:`Pin review`}function Xe(e){return e?`Remove from review queue`:`Add to review queue`}function Ze(e,t){let n=t.query.trim().toLowerCase();return Qe(e.filter(e=>(!n||e.searchText.includes(n))&&Ge(e,t.filter)&&qe(e.author,t.author)&&Ke(e,t.pr)&&Pe(e.collections,t.collections??[])),t.filter)}function Qe(e,t){return I(t)?e.filter(e=>e.queue!==void 0).sort((e,t)=>(e.queue??0)-(t.queue??0)):e}function $e(e){return e===0?`Queue`:`Queue (${e})`}function et(e){return e===`complete`?`Reviewed`:e===`in-progress`?`Not reviewed`:`New`}function tt(e){return`${et(e)}. Mark as ${e===`complete`?`not reviewed`:`reviewed`}`}function nt(e){return e===0?`Select reviews to take action`:`${e} review${e===1?``:`s`} selected`}var rt=`Use the checkboxes or choose Select all.`;function it(e,t,n){return e===0?rt:[t===null?``:`of ${t}`,n>0?`${n} not shown`:``].filter(Boolean).join(` · `)}function at(e,t=!1){return e===0||t?`Select all`:`Select all ${e}`}function ot(e){return e===0?`Delete`:`Delete ${e} review${e===1?``:`s`}`}function st(e){return`${ot(e)}?`}function ct(e,t,n){return e===``||t===``||t===e?`wait`:n?`hold`:`reload`}var lt=[`in-progress`,`recent`],ut={"in-progress":{title:`In progress`,key:`i`},recent:{title:`Recent runs and issues`,key:`r`}};function dt(e){return typeof e==`string`&&lt.includes(e)}var ft=[{id:`global`,label:`Global`},{id:`reviews`,label:`Reviews list`},{id:`runs`,label:`Runs list`},{id:`notifications`,label:`Activity list`},{id:`findings`,label:`Issues and Questions`},{id:`sections`,label:`Review sections`},{id:`buddy`,label:`Buddy AI`},{id:`actions`,label:`Review actions`},{id:`workspace`,label:`Workspace and focus`}],R=(...e)=>({kind:`chord`,keys:e}),z=(e,t)=>({kind:`key`,key:e,...t?{shift:t}:{}}),pt=e=>({kind:`key`,key:e,primary:!0}),mt=ge.map(e=>({id:`reviews.section.${e}`,label:`${ve[e].title} section`,group:`reviews`,page:`reviews`,binding:R(`l`,ve[e].key)})),ht=lt.map(e=>({id:`runs.section.${e}`,label:`${ut[e].title} section`,group:`runs`,page:`runs`,binding:R(`l`,ut[e].key)})),B=[{id:`palette.open`,label:`Command palette`,group:`global`,page:`global`,binding:{kind:`combo`,key:`k`}},{id:`add.open`,label:`New review`,group:`global`,page:`global`,binding:{kind:`combo`,key:`p`}},{id:`add.pullRequest`,label:`Review pull requests`,group:`global`,page:`global`,binding:R(`p`,`p`)},{id:`add.branch`,label:`Review branch`,group:`global`,page:`global`,binding:R(`p`,`b`)},{id:`navigate.reviews`,label:`Go to Reviews`,group:`global`,page:`global`,binding:R(`r`)},{id:`navigate.runs`,label:`Go to Runs`,group:`global`,page:`global`,binding:R(`e`)},{id:`navigate.notifications`,label:`Go to Activity`,group:`global`,page:`global`,binding:R(`n`)},{id:`sidebar.hide`,label:`Hide or show the sidebar`,group:`global`,page:`global`,binding:R(`h`)},{id:`help.shortcuts`,label:`Keyboard shortcuts`,group:`global`,page:`global`,binding:R(`?`)},{id:`reviews.search`,label:`Search reviews`,group:`reviews`,page:`reviews`,binding:R(`s`)},{id:`reviews.filters`,label:`Filters`,group:`reviews`,page:`reviews`,binding:R(`f`)},...mt,{id:`reviews.collection.new`,label:`New collection`,group:`reviews`,page:`reviews`,binding:R(`l`,`n`)},{id:`reviews.collection.fold`,label:`Expand or collapse a collection`,group:`reviews`,page:`reviews`,binding:R(`l`,`c`)},{id:`reviews.next`,label:`Next review`,group:`reviews`,page:`reviews`,binding:z(`j`)},{id:`reviews.previous`,label:`Previous review`,group:`reviews`,page:`reviews`,binding:z(`k`)},{id:`reviews.open`,label:`Open review`,group:`reviews`,page:`reviews`,binding:z(`Enter`)},{id:`reviews.openInNewTab`,label:`Open review in new tab`,group:`reviews`,page:`reviews`,binding:z(`Enter`,!0)},{id:`reviews.menu`,label:`Open review menu`,group:`reviews`,page:`reviews`,binding:z(` `)},{id:`reviews.selection.exit`,label:`Exit selection`,group:`reviews`,page:`reviews`,binding:z(`Escape`),hint:`[data-bulk-exit]`,showHint:!0},{id:`runs.search`,label:`Search runs`,group:`runs`,page:`runs`,binding:R(`s`)},{id:`runs.next`,label:`Next run`,group:`runs`,page:`runs`,binding:z(`j`)},{id:`runs.previous`,label:`Previous run`,group:`runs`,page:`runs`,binding:z(`k`)},{id:`runs.open`,label:`Open run’s review`,group:`runs`,page:`runs`,binding:z(`Enter`)},{id:`runs.openInNewTab`,label:`Open run’s review in new tab`,group:`runs`,page:`runs`,binding:z(`Enter`,!0)},{id:`runs.menu`,label:`Open run menu`,group:`runs`,page:`runs`,binding:z(` `)},...ht,{id:`notifications.next`,label:`Next activity`,group:`notifications`,page:`notifications`,binding:z(`j`)},{id:`notifications.previous`,label:`Previous activity`,group:`notifications`,page:`notifications`,binding:z(`k`)},{id:`notifications.open`,label:`Open activity`,group:`notifications`,page:`notifications`,binding:z(`Enter`)},{id:`notifications.openInNewTab`,label:`Open activity in new tab`,group:`notifications`,page:`notifications`,binding:z(`Enter`,!0)},{id:`review.findings.next`,label:`Next card`,group:`findings`,page:`review`,binding:z(`j`)},{id:`review.findings.previous`,label:`Previous card`,group:`findings`,page:`review`,binding:z(`k`)},{id:`review.findings.askBuddy`,label:`Ask Buddy about the card`,group:`findings`,page:`review`,binding:z(` `)},{id:`review.findings.copy`,label:`Copy the card`,group:`findings`,page:`review`,binding:pt(`c`)},{id:`review.findings.choose`,label:`Include in feedback, or leave out`,group:`findings`,page:`review`,binding:z(`Enter`)},{id:`review.feedback.prepare`,label:`Prepare feedback from the chosen cards`,group:`findings`,page:`review`,binding:pt(`Enter`),hint:`[data-feedback-prepare]`,showHint:!0},{id:`review.feedback.copyDraft`,label:`Copy the feedback draft`,group:`findings`,page:`review`,binding:pt(`c`),within:`[data-feedback-dialog]`,hint:`[data-feedback-copy]`,showHint:!0},{id:`review.section.review`,label:`Review overview`,group:`sections`,page:`review`,binding:R(`s`,`r`)},{id:`review.section.kiss`,label:`KISS`,group:`sections`,page:`review`,binding:R(`s`,`k`)},{id:`review.section.issues`,label:`Issues`,group:`sections`,page:`review`,binding:R(`s`,`i`)},{id:`review.section.diagrams`,label:`Diagrams`,group:`sections`,page:`review`,binding:R(`s`,`g`)},{id:`review.section.questions`,label:`Questions`,group:`sections`,page:`review`,binding:R(`s`,`q`)},{id:`review.section.files`,label:`Files`,group:`sections`,page:`review`,binding:R(`s`,`f`)},{id:`review.buddy.open`,label:`Open Buddy AI`,group:`buddy`,page:`review`,binding:R(`b`,`o`)},{id:`review.buddy.prompt`,label:`Choose a prompt`,group:`buddy`,page:`review`,binding:R(`b`,`p`)},{id:`review.mark.reviewed`,label:`Mark reviewed`,group:`actions`,page:`review`,binding:R(`m`,`r`),hint:`[data-review-menu] [data-mark-status]`},{id:`review.mark.waiting`,label:`Mark waiting`,group:`actions`,page:`review`,binding:R(`m`,`w`),hint:`[data-review-menu] [data-lifecycle-set="waiting"]`},{id:`review.mark.done`,label:`Mark done`,group:`actions`,page:`review`,binding:R(`m`,`d`),hint:`[data-review-menu] [data-lifecycle-set="done"]`},{id:`review.checkUpdates`,label:`Check for updates`,group:`actions`,page:`review`,binding:R(`a`,`c`),hint:`[data-review-menu] [data-fresh-check]`},{id:`review.update`,label:`Update review`,group:`actions`,page:`review`,binding:R(`a`,`u`)},{id:`review.queue.toggle`,label:`Queue`,group:`actions`,page:`review`,binding:R(`a`,`q`),hint:`[data-review-menu] [data-queue-action]`},{id:`review.feedback.toggle`,label:`Start or exit Prepare feedback`,group:`actions`,page:`review`,binding:R(`a`,`p`)},{id:`review.delete`,label:`Delete`,group:`actions`,page:`review`,binding:R(`a`,`d`),hint:`[data-review-menu] [data-delete]`},{id:`review.focus.toggle`,label:`Expand or collapse this section`,group:`workspace`,page:`review`,binding:z(`\\`),hint:`[data-focus-toggle]`},{id:`review.leave`,label:`Leave the Buddy AI field, Prepare feedback, or focus mode`,group:`workspace`,page:`review`,binding:z(`Escape`)}],gt=[{page:`global`,keys:[`p`],label:`New review`,combo:`p`},{page:`review`,keys:[`s`],label:`Sections`},{page:`review`,keys:[`m`],label:`Mark`},{page:`review`,keys:[`a`],label:`Actions`},{page:`review`,keys:[`b`],label:`Buddy AI`},{page:`reviews`,keys:[`l`],label:`List sections`},{page:`runs`,keys:[`l`],label:`List sections`}];function _t(e,t=B){return t.filter(t=>t.page===`global`||t.page===e)}function vt(e,t=B){let n={kind:`node`,key:``,label:`Commands`,children:[]},r=(t,r)=>{let i=n;for(let[n,a]of t.entries()){let o=i.children.find(e=>e.key===a);if(o?.kind===`leaf`)throw Error(`Chord ${t.slice(0,n+1).join(` `)} is a command and a namespace on ${e}`);if(o){i=o;continue}let s={kind:`node`,key:a,label:gt.find(r=>(r.page===e||r.page===`global`)&&r.keys.join(` `)===t.slice(0,n+1).join(` `))?.label??r??a.toUpperCase(),children:[]};i.children.push(s),i=s}return i};for(let n of _t(e,t)){if(n.binding.kind!==`chord`)continue;let t=n.binding.keys,i=r(t.slice(0,-1)),a=t[t.length-1];if(i.children.some(e=>e.key===a))throw Error(`Chord ${t.join(` `)} is bound twice on ${e}`);i.children.push({kind:`leaf`,key:a,command:n})}return n}function yt(e){return _t(e).filter(e=>e.binding.kind===`key`)}var bt=new Set([`Shift`,`Control`,`Alt`,`Meta`,`CapsLock`,`Fn`,`AltGraph`,`OS`]);function xt(e){return bt.has(e.key)}function St(e){let t=e.key;if(t.length===1){if(/^[a-z]$/i.test(t))return t.toLowerCase();let n=/^Key([A-Z])$/.exec(e.code??``);return n&&/\p{L}/u.test(t)?n[1].toLowerCase():t}return null}var Ct=new Set(B.flatMap(e=>e.binding.kind===`combo`?[e.binding.key]:[]));function wt(e,t){let n=t?e.metaKey:e.ctrlKey,r=t?e.ctrlKey:e.metaKey;if(!n||r||e.altKey||e.shiftKey||e.isComposing)return null;let i=St(e);return i!==null&&Ct.has(i)?i:null}function Tt(e){return B.find(t=>t.binding.kind===`combo`&&t.binding.key===e)}function Et(e,t,n=!1){if(e.kind!==`key`||t.altKey||t.isComposing)return!1;let r=n?t.metaKey:t.ctrlKey;return(n?t.ctrlKey:t.metaKey)||r!==(e.primary===!0)||t.shiftKey!==(e.shift===!0)?!1:e.key===`\\`?t.key===`\\`||t.code===`Backslash`:e.key.length===1?St(t)===e.key:t.key===e.key}function Dt(e){let t=null,n=[];return{get at(){return t},get path(){return n},start(r=[]){let i=e,a=[];for(let e of r){let t=i.children.find(t=>t.key===e);if(t?.kind!==`node`)break;i=t,a.push(e)}t=i,n=a},press(e){let r=t?.children.find(t=>t.key===e);return r?r.kind===`leaf`?(t=null,n=[],{kind:`run`,command:r.command}):(t=r,n=[...n,e],{kind:`descend`,node:r}):(t=null,n=[],{kind:`cancel`})},reset(){t=null,n=[]}}}var Ot={Escape:`Esc`,Enter:`Enter`,"\\":`\\`," ":`Space`};function V(e){return Ot[e]??(e.length===1?e.toUpperCase():e)}function H(e,t=`k`){let n=t.toUpperCase();return e?`⌘${n}`:`Ctrl+${n}`}function U(e,t){let n=gt.find(t=>t.combo!==void 0&&t.keys.every((t,n)=>e[n]===t));return n?[H(t,n.combo),...e.slice(n.keys.length).map(V)]:[H(t),...e.map(V)]}function W(e,t){return e.kind===`combo`?t?`⌘${V(e.key)}`:`Ctrl+${V(e.key)}`:e.kind===`chord`?U(e.keys,t).join(` `):e.primary?t?`⌘${V(e.key)}`:`Ctrl+${V(e.key)}`:e.shift?`Shift+${V(e.key)}`:V(e.key)}function kt(e,t){return e.kind===`chord`?U(e.keys,t):[W(e,t)]}function At(e,t){if(e.kind===`chord`)return null;if(e.kind===`combo`)return`${t?`Meta`:`Control`}+${e.key.toUpperCase()}`;let n=e.key===` `?`Space`:e.key.length===1?e.key.toUpperCase():e.key;return e.primary?`${t?`Meta`:`Control`}+${n}`:e.shift?`Shift+${n}`:n}function jt(e){return ft.map(t=>({group:t.id,label:t.label,rows:B.filter(e=>e.group===t.id).map(t=>({id:t.id,keys:kt(t.binding,e),label:t.label}))})).filter(e=>e.rows.length>0)}function G(e,t,n,r){let i=e.createElement(t);return n&&(i.className=n),r!==void 0&&(i.textContent=r),i}function K(e,t){return G(e,`kbd`,`prb-kbd`,t)}function Mt(e,t,n){let r=G(e,`dialog`,`prb-palette`);r.setAttribute(`data-command-palette`,``),r.setAttribute(`aria-labelledby`,`prb-palette-title`);let i=G(e,`div`,`prb-palette-panel`);i.tabIndex=-1,r.append(i),e.body.append(r),r.addEventListener(`click`,e=>{if(e.stopPropagation(),e.target===r)return n();let i=e.target?.closest?.(`[data-palette-key]`);i?.dataset.paletteKey!==void 0&&i.getAttribute(`aria-disabled`)!==`true`&&t(i.dataset.paletteKey)}),r.addEventListener(`cancel`,e=>{e.preventDefault(),n()});let a=(t,n)=>{let r=G(e,`div`,`prb-palette-head`),i=G(e,`span`,`prb-palette-trail`);for(let[n,r]of t.entries())n>0&&i.append(G(e,`span`,`prb-palette-sep`,`›`)),i.append(K(e,r));let a=G(e,`h2`,`prb-palette-title`,n);return a.id=`prb-palette-title`,r.append(i,a),r};return{dialog:r,show:t=>{i.replaceChildren(a(t.trail,t.title));let n=G(e,`div`,`prb-palette-list`);n.setAttribute(`role`,`group`),n.setAttribute(`aria-labelledby`,`prb-palette-title`);let o=null;for(let r of t.rows){t.groupLabels&&r.group!==o&&(n.append(G(e,`p`,`prb-palette-group`,t.groupLabels[r.group]??r.group)),o=r.group);let i=G(e,`button`,`prb-palette-row`);i.type=`button`,i.dataset.paletteKey=r.key,r.available||i.setAttribute(`aria-disabled`,`true`),r.namespace&&i.setAttribute(`aria-haspopup`,`true`),i.append(K(e,r.keyLabel),G(e,`span`,`prb-palette-label`,r.namespace?`${r.label}…`:r.label)),r.state&&i.append(G(e,`span`,`prb-palette-state`,r.state)),n.append(i)}if(t.rows.length===0&&n.append(G(e,`p`,`prb-palette-empty`,`Nothing here on this page.`)),i.append(n),t.footer.length>0){let n=G(e,`div`,`prb-palette-footer`);n.append(G(e,`p`,`prb-palette-group`,`Keys on this page`));let r=G(e,`ul`,`prb-palette-keys`);for(let n of t.footer){let t=G(e,`li`);t.append(K(e,n.keys),G(e,`span`,void 0,n.label)),r.append(t)}n.append(r),i.append(n)}r.open||r.showModal(),i.focus()},showPanel:(t,n,o)=>{i.replaceChildren(a(t,n.title));let s=G(e,`div`,`prb-palette-body`);i.append(s),r.open||r.showModal(),i.dataset.mode=n.title;let c=n.mount(s,o);return()=>{delete i.dataset.mode,c?.()}},close:()=>{r.open&&r.close()},isOpen:()=>r.open}}function Nt(e,t,n){let r=[...e.querySelectorAll(`[data-palette-key]`)];if(r.length===0)return!1;let i=r.indexOf(n),a=t===`ArrowDown`?r[i<0?0:(i+1)%r.length]:t===`ArrowUp`?r[i<0?r.length-1:(i-1+r.length)%r.length]:t===`Home`?r[0]:t===`End`?r[r.length-1]:null;return a?(a.focus(),!0):!1}function Pt(e,t){let n=G(e,`div`,`prb-shortcuts-table`);for(let r of t){let t=G(e,`section`,`prb-shortcuts-group`);t.append(G(e,`h3`,`prb-shortcuts-heading`,r.label));let i=G(e,`dl`,`prb-shortcuts-list`);for(let t of r.rows){let n=G(e,`dt`,`prb-shortcuts-keys`);n.dataset.commandId=t.id;for(let r of t.keys)n.append(K(e,r));i.append(n,G(e,`dd`,`prb-shortcuts-label`,t.label))}t.append(i),n.append(t)}return n}function Ft(e,t,n,r){let i=G(e,`dialog`,`prb-dialog prb-shortcuts`);i.setAttribute(`data-shortcuts-dialog`,``),i.setAttribute(`aria-labelledby`,`prb-shortcuts-title`);let a=G(e,`div`,`prb-shortcuts-head`),o=G(e,`h2`,void 0,`Keyboard shortcuts`);o.id=`prb-shortcuts-title`;let s=G(e,`button`,`prb-shortcuts-close`,`Close`);s.type=`button`,s.setAttribute(`data-shortcuts-close`,``),a.append(o,s),i.append(a,G(e,`p`,`prb-shortcuts-hint`,n),Pt(e,t)),e.body.append(i);let c=null;return s.addEventListener(`click`,()=>i.close()),i.addEventListener(`click`,e=>{e.target===i&&i.close()}),i.addEventListener(`close`,()=>{c?.isConnected&&c.focus(),c=null,r?.()}),{dialog:i,open:()=>{if(i.open)return;let t=e.activeElement;c=t instanceof HTMLElement&&t!==e.body?t:null,i.showModal(),s.focus()},isOpen:()=>i.open}}var It=/https?:\/\/[^\s<>()"'`]+/gi,Lt=/^https?:\/\/(?:www\.)?github\.com\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\/pull\/(\d+)(?:[/?#]|$)/i,Rt=/^https?:\/\/([^/]+)\/((?:[^/?#]+\/)+?)(?:-\/)?merge_requests\/(\d+)(?:[/?#]|$)/i,zt=/^https?:\/\/(?:www\.)?bitbucket\.org\/([^/?#]+)\/([^/?#]+)\/pull-requests\/(\d+)(?:[/?#]|$)/i;function Bt(e){let t=e.replace(/[.,;:!?)\]]+$/,``),n=Lt.exec(t);if(n){let[,e,t,r]=n,i=t.replace(/\.git$/i,``),a=Number(r);return{kind:`github`,owner:e,repo:i,number:a,url:`https://github.com/${e}/${i}/pull/${a}`,key:`${e}/${i}#${a}`.toLowerCase()}}let r=zt.exec(t);if(r){let[,e,n,i]=r;return{kind:`unsupported`,provider:`Bitbucket`,label:`${e}/${n} #${i}`,url:t,key:`bitbucket:${e}/${n}#${i}`.toLowerCase()}}let i=Rt.exec(t);if(i){let[,e,n,r]=i,a=n.replace(/\/$/,``);return{kind:`unsupported`,provider:`GitLab`,label:`${a} !${r}`,url:t,key:`gitlab:${e}/${a}!${r}`.toLowerCase()}}return null}function Vt(e){let t=[],n=new Set;for(let r of e.matchAll(It)){let e=Bt(r[0]);!e||n.has(e.key)||(n.add(e.key),t.push(e))}return t}function Ht(e){return`${e} isn't supported yet`}var Ut=`prb:review-started`;function Wt(e){e.dispatchEvent(new(e.defaultView??window).Event(Ut))}function Gt(e,t){e.addEventListener(Ut,t)}function Kt(e,t){let n=null,r=!1,i=!1,a=!1,o=async()=>{n=null,r=!0;let s=await t();if(r=!1,s===null){a=!0;return}let c=i?0:s;i=!1,n=e.setTimeout(()=>void o(),c)};return o(),{now:()=>{if(!a){if(r){i=!0;return}n!==null&&e.clearTimeout(n),o()}}}}function qt(e){return e.model?`Keeps its original agent and model: ${e.agent}, ${e.model}`:`Keeps its original agent: ${e.agent}`}var Jt={waiting:`Queued`,reviewing:`Analysing`,"already-reviewed":`Already reviewed`,ready:`Ready`,failed:`Failed`},Yt={waiting:`○`,reviewing:`◐`,"already-reviewed":`✓`,ready:`✓`,failed:`!`},Xt=250,Zt=1500,Qt=6e4;async function q(e,t,n){try{let r=await e.fetch(t,n===void 0?{}:{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n)}),i=await r.json().catch(()=>({}));if(!r.ok){let e=i;return{...e,ok:!1,status:r.status,error:typeof e.error==`string`?e.error:`Something went wrong. Try again.`}}return{ok:!0,value:i}}catch{return{ok:!1,status:0,error:`The workspace server did not answer. Check it is still running.`}}}function $t(e,t,n){let r=null,i=!1,a=o=>{r=e.setTimeout(async()=>{let r=await q(e,`/add-review/batches/${t}`);i||(r.ok?(n.rows(r.value.rows,r.value.finished),a(r.value.finished?Qt:Zt)):r.status===404?n.lost(r.error):a(Zt))},o)};return a(Zt),()=>{i=!0,r!==null&&e.clearTimeout(r)}}function J(e,t,n,r){let i=e.createElement(t);return n&&(i.className=n),r!==void 0&&(i.textContent=r),i}function Y(e,t,n){let r=J(e,`option`,void 0,t);return r.value=n,r}function X(e,t,n){let r=J(e,`a`,`prb-addreview-link`,n);return r.href=`/open?id=${encodeURIComponent(t)}`,r}function en(e,t){let n=J(e,`details`,`prb-addreview-technical`);return n.append(J(e,`summary`,void 0,`Technical details`),J(e,`pre`,void 0,t)),n}function tn(e){let t=J(e,`div`,`prb-addreview-problemblock`);t.setAttribute(`role`,`alert`);let n=J(e,`p`,`prb-addreview-error`);return n.hidden=!0,t.append(n),{element:t,show(r){n.textContent=r.error,n.hidden=!1,t.querySelector(`.prb-addreview-technical`)?.remove(),r.detail&&t.append(en(e,r.detail))},hide(){n.hidden=!0,t.querySelector(`.prb-addreview-technical`)?.remove()}}}function nn(e,t,n=`prb-addreview-path`){let r=J(e,`span`,n),i=t.replace(/\/+$/,``).lastIndexOf(`/`);return i<=0?r.textContent=t:r.append(J(e,`span`,`prb-addreview-path-parent`,t.slice(0,i+1)),J(e,`span`,`prb-addreview-path-name`,t.slice(i+1))),r}function Z(e,t){return J(e,`code`,void 0,t)}var Q=e=>`${e} commit${e===1?``:`s`}`;function rn(e,t){let n=t.options.find(e=>e.where===`remote`)?.display??`origin/${t.name}`,r=J(e,`p`,`prb-addreview-choice-text`),i=t.divergence,a=i&&i.ahead>0&&i.behind>0?[`Your local `,Z(e,t.name),` and `,Z(e,n),` have diverged: ${Q(i.ahead)} on the local side, ${Q(i.behind)} on the remote.`]:i&&i.ahead>0?[`Your local `,Z(e,t.name),` is ${Q(i.ahead)} ahead of `,Z(e,n),`.`]:i&&i.behind>0?[`Your local `,Z(e,t.name),` is ${Q(i.behind)} behind `,Z(e,n),`.`]:[`Your local `,Z(e,t.name),` and `,Z(e,n),` are different commits.`];return r.append(...a),r}function an(e,t,n){let r=t.baseChoice,i=J(e,`div`,`prb-addreview-choice`);i.setAttribute(`data-addreview-base-choice`,``);let a=J(e,`p`,`prb-addreview-choice-title`,`Choose a base branch`);a.id=`prb-addreview-choice-title`;let o=J(e,`div`,`prb-addreview-choice-options`);o.setAttribute(`role`,`radiogroup`),o.setAttribute(`aria-labelledby`,a.id);for(let t of r.options){let i=J(e,`label`,`prb-addreview-choice-option`),a=J(e,`input`);a.type=`radio`,a.name=`prb-addreview-base-choice`,a.value=t.base,a.addEventListener(`change`,()=>{a.checked&&n(t.base)});let s=`${t.where===`remote`?`Remote`:`Local`} ${r.name}`,c=t.commits===void 0?``:t.commits===0?` (no new changes)`:` (${Q(t.commits)} to review)`;i.append(a,Z(e,t.display),J(e,`span`,`prb-addreview-choice-what`,` ${s}${c}`)),o.append(i)}return i.append(a,rn(e,r),J(e,`p`,`prb-addreview-choice-text`,`Select which branch to compare against:`),o),t.detail&&i.append(en(e,t.detail)),i}function on(e,t){return t&&e.status===`waiting`?`Not started`:t&&e.status===`reviewing`?`Started`:Jt[e.status]}function sn(e,t){let n=e.filter(e=>e.status===`ready`||e.status===`already-reviewed`).length,r=[`reviewing`,`waiting`,`failed`].map(n=>[on({status:n},t).toLowerCase(),e.filter(e=>e.status===n).length]).filter(([,e])=>e>0);return[`${n} of ${e.length} ${e.length===1?`review`:`reviews`} ready`,...r.map(([e,t])=>`${t} ${e}`)].join(` · `)}function cn(e,t,n,r,i){let a=J(e,`div`,`prb-addreview-progress`);a.setAttribute(`data-addreview-progress`,``);let o=J(e,`p`,`prb-addreview-summary`);o.setAttribute(`aria-live`,`polite`);let s=J(e,`ul`,`prb-addreview-rows`);s.setAttribute(`aria-label`,`Started reviews`);let c=J(e,`p`,`prb-palette-summary`),l=tn(e),u=J(e,`div`,`prb-addreview-footer`),d=J(e,`button`,`prb-addreview-start`,`Close`);d.type=`button`,d.setAttribute(`data-addreview-close`,``),d.addEventListener(`click`,i),u.append(d),a.append(o,s,c,l.element,u);let f=r,p=null,m=!1,h=!1,g=new Map,_=(t,n)=>{let r=n.contains(e.activeElement),i=n.querySelector(`.prb-addreview-technical`)?.open??!1;n.replaceChildren(),n.dataset.status=h&&t.status===`waiting`?`not-started`:t.status,n.dataset.state=t.status===`failed`?`problem`:`ok`;let a=J(e,`div`,`prb-addreview-row-head`),o=J(e,`span`,`prb-addreview-mark`,Yt[t.status]);if(o.setAttribute(`aria-hidden`,`true`),a.append(o,t.reviewId?X(e,t.reviewId,t.label):J(e,`span`,`prb-addreview-row-label`,t.label)),a.append(J(e,`span`,`prb-addreview-badge`,on(t,h))),n.append(a),t.reason&&n.append(J(e,`span`,`prb-addreview-status prb-addreview-${t.status===`failed`?`problem`:`muted`}`,t.reason)),t.kept&&n.append(J(e,`span`,`prb-addreview-status prb-addreview-muted`,qt(t.kept))),t.detail){let r=en(e,t.detail);r.open=i,n.append(r)}if(t.status===`failed`&&!h){let r=t.stale===!0,i=J(e,`button`,`prb-addreview-retry`,r?`Start fresh review`:`Retry`);i.type=`button`,i.setAttribute(r?`data-addreview-fresh`:`data-addreview-retry`,``),i.setAttribute(`aria-label`,`${r?`Start a fresh review of`:`Retry`} ${t.label}`),i.addEventListener(`click`,()=>void b(t.key,i,r)),n.append(i)}r&&n.focus()},v=()=>{let t=f.map(t=>{let n=JSON.stringify([t,h]),r=g.get(t.key);if(!r){let n=J(e,`li`,`prb-addreview-row`);n.dataset.rowKey=t.key,n.tabIndex=-1,r={item:n,json:``},g.set(t.key,r)}return r.json!==n&&(_(t,r.item),r.json=n),r.item});(t.some((e,t)=>s.children[t]!==e)||s.children.length!==t.length)&&s.replaceChildren(...t),o.textContent=sn(f,h),c.textContent=!h&&f.some(e=>e.status===`waiting`)?`Queued reviews start as running ones finish. Reviews carry on in the background, so you can close this; they appear in your reviews list.`:`Reviews carry on in the background, so you can close this; they appear in your reviews list.`},y=()=>{p?.(),p=$t(t,n,{rows:e=>{f=e,v()},lost:e=>{l.show({error:e}),h=!0,v()}})},b=async(r,i,a)=>{i.disabled=!0;let o=await q(t,`/add-review/batches/${n}/retry`,{key:r,...a?{fresh:!0}:{}});if(o.ok&&Wt(e),!m){if(!o.ok){i.disabled=!1,l.show(o),o.status===404&&(h=!0,p?.(),v());return}l.hide(),f=o.value.rows,v(),y()}};return v(),y(),{element:a,focus:()=>d.focus(),stop:()=>{m=!0,p?.()}}}function ln(e,t,n){let r=J(e,`details`,`prb-addreview-options`);r.append(J(e,`summary`,void 0,`Review options`));let i=J(e,`div`,`prb-addreview-grid`);r.append(i);let a=(t,n)=>{let r=J(e,`label`,`prb-addreview-key`,t),a=`prb-addreview-${t.toLowerCase()}`;n.id=a,r.htmlFor=a,i.append(r,n)},o=J(e,`select`,`prb-addreview-control`);o.setAttribute(`data-addreview-agent`,``);let s=J(e,`input`,`prb-addreview-control`);s.type=`text`,s.placeholder=`Default`,s.spellcheck=!1,s.autocomplete=`off`,s.setAttribute(`data-addreview-model`,``);let c=J(e,`input`,`prb-addreview-control`);c.type=`text`,c.placeholder=`Auto`,c.spellcheck=!1,c.autocomplete=`off`,c.setAttribute(`data-addreview-base`,``),a(`Agent`,o),a(`Model`,s);let l=J(e,`div`,`prb-addreview-modelhelp`),u=J(e,`button`,`prb-addreview-helplink`,`How do I find model names?`);u.type=`button`,u.setAttribute(`aria-expanded`,`false`),u.setAttribute(`data-addreview-model-help`,``);let d=J(e,`p`,`prb-addreview-help`);d.id=`prb-addreview-model-help`,d.hidden=!0,u.setAttribute(`aria-controls`,d.id),l.append(u,d),i.append(l),n&&a(`Base`,c);let f=tn(e);r.append(f.element);let p=[],m=()=>{let t=p.find(e=>e.id===o.value);if(!t){d.replaceChildren(`Choose an agent to see how to find its model names.`);return}let n=t.displayName,r=t.modelHelp;d.replaceChildren(...r?.command?[`To see the models ${n} offers, run `,Z(e,r.command),` in a terminal.`]:r?.note?[`To see the models ${n} offers, ${r.note}.`]:[`${n} does not say how to list its models. Use a name from its own documentation.`],` Leave Model empty to use ${n}'s default.`)};u.addEventListener(`click`,()=>{d.hidden=!d.hidden,u.setAttribute(`aria-expanded`,String(!d.hidden)),d.hidden?s.removeAttribute(`aria-describedby`):s.setAttribute(`aria-describedby`,d.id),m()}),o.addEventListener(`change`,m);let h=null,g=!1;return{element:r,base:c,loaded:q(t,`/add-review/options`).then(t=>{if(g=!0,!t.ok)return f.show(t),r.open=!0,null;p=t.value.agents;let{agent:n}=t.value,i=p.filter(e=>e.installed);n.kind!==`resolved`&&o.append(Y(e,`Choose an agent`,``));for(let t of i)o.append(Y(e,t.displayName,t.id));return n.kind===`resolved`?(h=n.id,i.some(e=>e.id===n.id)||o.append(Y(e,n.displayName,n.id)),o.value=n.id):(o.value=``,r.open=!0,n.kind===`refused`&&f.show({error:n.error})),m(),t.value}),complete:()=>g&&o.value!==``,values:()=>({...o.value&&o.value!==h?{agent:o.value}:{},...s.value.trim()?{model:s.value.trim()}:{},...n&&c.value.trim()?{base:c.value.trim()}:{}}),setBasePlaceholder:e=>{c.placeholder=e?`Auto (${e})`:`Auto`},showProblem:e=>{r.open=!0,f.show(e),(e.field===`model`?s:o).focus()},hideProblem:()=>f.hide()}}function un(e){let t=J(e,`button`,`prb-addreview-start`);return t.type=`button`,t.setAttribute(`data-addreview-start`,``),t}function dn(e){return{title:`New review`,escape:`close`,mount(t,n){let r=e.defaultView,i=J(e,`div`,`prb-addreview`);i.setAttribute(`data-addreview`,`pull-requests`);let a=J(e,`div`,`prb-addreview-config`),o=J(e,`label`,`prb-addreview-label`,`Paste PR links`),s=J(e,`textarea`,`prb-palette-input prb-addreview-paste`);s.id=`prb-addreview-paste`,o.htmlFor=s.id,s.rows=3,s.spellcheck=!1,s.autocomplete=`off`,s.placeholder=`https://github.com/owner/repo/pull/123`;let c=J(e,`p`,`prb-palette-summary`);c.setAttribute(`aria-live`,`polite`);let l=J(e,`ul`,`prb-addreview-rows`),u=ln(e,r,!1),d=tn(e),f=J(e,`p`,`prb-addreview-error`);f.setAttribute(`data-addreview-limit`,``),f.hidden=!0;let p=J(e,`div`,`prb-addreview-footer`),m=un(e);p.append(m),a.append(o,s,c,f,l,u.element,d.element,p),i.append(J(e,`p`,`prb-addreview-mode`,`Pull request`),a),t.append(i);let h=[],g=new Map,_=!1,v=0,y=null,b=null,x=!1,S=!1,C=()=>h.filter(e=>(e.ok||e.needsFolder)&&!!g.get(e.key)),w=0,T=()=>{let e=C().length;m.textContent=e>1?`Review ${e} PRs`:`Review PR`,m.disabled=b!==null||x||_||w>0||e===0||!u.complete()},E=()=>{f.hidden=w===0,f.textContent=`At most 20 pull requests can be reviewed at once. Remove ${w} to continue.`},D=(t,n)=>J(e,`span`,`prb-addreview-status prb-addreview-${n}`,t),O=()=>{l.replaceChildren(...h.map(t=>{let n=J(e,`li`,`prb-addreview-row`);n.dataset.rowKey=t.key;let r=t.ok||!!g.get(t.key);n.dataset.state=r?`ok`:`problem`;let i=J(e,`div`,`prb-addreview-row-head`),a=J(e,`span`,`prb-addreview-mark`,r?`✓`:`!`);if(a.setAttribute(`aria-hidden`,`true`),i.append(a,J(e,`span`,`prb-addreview-row-label`,t.label)),n.append(i),t.reviewed?.kept){let r=D(``,`muted`);r.append(X(e,t.reviewed.reviewId,`Resumes where it stopped`)),n.append(r,D(qt(t.reviewed.kept),`muted`))}else if(t.reviewed){let r=D(``,`muted`);r.append(X(e,t.reviewed.reviewId,`Already reviewed`)),n.append(r)}else t.ok?n.append(D(`Ready to start`,`muted`)):t.reason&&n.append(D(t.reason,`problem`));if(t.folders.length>1){let r=J(e,`select`,`prb-addreview-control prb-addreview-folder`);r.setAttribute(`aria-label`,`Local folder for ${t.label}`);for(let n of t.folders)r.append(Y(e,n.branch?`${n.display} (${n.branch})`:n.display,n.path));r.value=g.get(t.key)??t.folder??``,r.addEventListener(`change`,()=>g.set(t.key,r.value)),n.append(r)}else if(t.folders.length===1)n.append(nn(e,t.folders[0].display));else if(t.needsFolder){let r=J(e,`input`,`prb-addreview-control prb-addreview-folder`);r.type=`text`,r.placeholder=`Local folder for this repository, e.g. ~/code/repo`,r.setAttribute(`aria-label`,`Local folder for ${t.label}`),r.spellcheck=!1,r.autocomplete=`off`,r.value=g.get(t.key)??``,r.addEventListener(`input`,()=>{r.value.trim()?g.set(t.key,r.value.trim()):g.delete(t.key),n.dataset.state=r.value.trim()?`ok`:`problem`,T()}),n.append(r)}return n}))},k=()=>{let e=Vt(s.value),t=e.filter(e=>e.kind===`github`).length;c.textContent=e.length===0?s.value.trim()?`No pull request links found.`:``:t===1?`1 pull request recognised`:`${t} pull requests recognised`,h=e.map(e=>e.kind===`github`?h.find(t=>t.key===e.key)??{key:e.key,label:`${e.owner}/${e.repo} #${e.number}`,url:e.url,ok:!1,folders:[]}:{key:e.key,label:`${e.provider} ${e.provider===`GitLab`?`merge request`:`pull request`}`,url:e.url,ok:!1,reason:Ht(e.provider),folders:[]}),_=e.some(e=>e.kind===`github`),w=Math.max(0,t-20);let n=++v;O(),E(),T(),y!==null&&r.clearTimeout(y),_&&(y=r.setTimeout(async()=>{y=null;let e=await q(r,`/add-review/pull-requests/preview`,{text:s.value});if(!(S||n!==v)){if(_=!1,!e.ok)d.show(e);else{d.hide(),h=e.value.rows;for(let e of h)e.folder&&!g.has(e.key)&&g.set(e.key,e.folder)}O(),T()}},Xt))},A=async()=>{if(T(),m.disabled)return;x=!0,T();let t=C().map(e=>({url:e.url,folder:g.get(e.key)})),i=await q(r,`/add-review/pull-requests`,{items:t,...u.values()});if(x=!1,i.ok&&Wt(e),!S){if(!i.ok){i.field?(d.hide(),u.showProblem(i)):(u.hideProblem(),d.show(i)),T();return}b=cn(e,r,i.value.batchId,i.value.rows,n),a.replaceWith(b.element),b.focus()}};return s.addEventListener(`input`,k),m.addEventListener(`click`,()=>void A()),i.addEventListener(`change`,()=>T()),i.addEventListener(`keydown`,e=>{if(b||e.key!==`Enter`||e.shiftKey||e.isComposing)return;let t=e.target;t.tagName!==`SELECT`&&t.tagName!==`BUTTON`&&t.tagName!==`A`&&t.tagName!==`SUMMARY`&&(e.preventDefault(),A())}),u.loaded.then(()=>T()),T(),s.focus(),()=>{S=!0,y!==null&&r.clearTimeout(y),b?.stop()}}}}function fn(e){return{title:`New review`,escape:`close`,mount(t,n){let r=e.defaultView,i=J(e,`div`,`prb-addreview`);i.setAttribute(`data-addreview`,`branch`);let a=J(e,`div`,`prb-addreview-config`),o=J(e,`label`,`prb-addreview-label`,`Working folder`),s=J(e,`div`,`prb-addreview-pathrow`),c=J(e,`input`,`prb-palette-input`);c.id=`prb-addreview-folder`,o.htmlFor=c.id,c.type=`text`,c.spellcheck=!1,c.autocomplete=`off`,c.placeholder=`~/code/project`;let l=J(e,`button`,`prb-addreview-browse`,`Browse…`);l.type=`button`,l.hidden=!0,s.append(c,l);let u=J(e,`div`,`prb-addreview-detected`);u.setAttribute(`aria-live`,`polite`);let d=J(e,`p`,`prb-palette-group`,`Recent`),f=J(e,`div`,`prb-palette-results prb-addreview-recent`);f.setAttribute(`role`,`group`),f.setAttribute(`aria-label`,`Recent folders`),d.hidden=!0;let p=ln(e,r,!0),m=tn(e),h=J(e,`div`,`prb-addreview-footer`),g=un(e);g.textContent=`Review branch`,h.append(g),a.append(o,s,u,d,f,p.element,m.element,h),i.append(J(e,`p`,`prb-addreview-mode`,`Branch`),a),t.append(i);let _=null,v=null,y=!1,b=null,x=!1,S=null,C=(e,t)=>`${e}\n${t.trim()}`,w=()=>C(c.value,p.base.value),T=()=>{g.disabled=y||b!==null||!_?.result.ok||_.key!==w()||!p.complete()},E=e=>{S={base:e,path:c.value},p.base.value=e,v!==null&&r.clearTimeout(v),T(),O().then(e=>{!x&&e.ok&&g.focus()})},D=t=>{if(u.replaceChildren(),!t)return;if(!t.ok){if(t.baseChoice){u.append(an(e,{error:t.error??``,...t.detail?{detail:t.detail}:{},baseChoice:t.baseChoice},E));return}u.append(J(e,`p`,`prb-addreview-error`,t.error??`This folder cannot be reviewed.`)),t.detail&&u.append(en(e,t.detail));return}let n=J(e,`dl`,`prb-addreview-grid prb-addreview-facts`),r=(t,r)=>{let i=J(e,`dd`);i.append(r),n.append(J(e,`dt`,`prb-addreview-key`,t),i)};if(r(`Repository`,t.repo??``),r(`Branch`,t.branch??``),r(`Base`,t.base??`Not found`),t.reviewed?.kept){let n=X(e,t.reviewed.reviewId,`Resumes where it stopped`),i=J(e,`span`,`prb-addreview-kept`,qt(t.reviewed.kept)),a=J(e,`span`);a.append(n,J(e,`br`),i),r(`Review`,a)}else t.reviewed&&r(`Review`,X(e,t.reviewed.reviewId,t.reviewed.inProgress?`Being reviewed now`:`Already reviewed`));u.append(n),p.setBasePlaceholder(t.base??null)},O=()=>{let e=c.value,t=p.base.value.trim(),n=C(e,t);return _?.key===n?Promise.resolve(_.result):e.trim()?q(r,`/add-review/folder/inspect`,{path:e,...t?{base:t}:{}}).then(e=>{let t=e.ok?e.value:{ok:!1,error:e.error,...e.detail?{detail:e.detail}:{}};return!x&&w()===n&&(_={key:n,result:t},D(t),T()),t}):(_=null,D(null),T(),Promise.resolve({ok:!1}))},k=e=>{c.value=e,A(),v!==null&&r.clearTimeout(v),T(),O(),c.focus()},A=()=>{!S||S.path===c.value||(p.base.value===S.base&&(p.base.value=``),S=null)},j=async()=>{if(y||b)return;y=!0;let t=w(),i=c.value,o=p.values();T(),v!==null&&(r.clearTimeout(v),v=null);let s=await O();if(x)return;if(!s.ok||!p.complete()||w()!==t)return y=!1,T();let l=await q(r,`/add-review/branch`,{path:i,...o});if(y=!1,l.ok&&Wt(e),!x){if(!l.ok){l.baseChoice?(_={key:t,result:{...l,ok:!1}},D(_.result),m.hide()):l.field?p.showProblem(l):m.show(l),T();return}b=cn(e,r,l.value.batchId,l.value.rows,n),a.replaceWith(b.element),b.focus()}},M=()=>{T(),v!==null&&r.clearTimeout(v),v=r.setTimeout(()=>{v=null,O()},Xt)};return c.addEventListener(`input`,()=>{A(),M()}),p.base.addEventListener(`input`,M),l.addEventListener(`click`,async()=>{let e=await q(r,`/add-review/folder/choose`,{});if(!x){if(!e.ok){m.show(e);return}e.value.path?k(e.value.path):c.focus()}}),f.addEventListener(`click`,e=>{let t=e.target.closest(`[data-folder-path]`);t?.dataset.folderPath&&k(t.dataset.folderDisplay??t.dataset.folderPath)}),g.addEventListener(`click`,()=>void j()),i.addEventListener(`keydown`,e=>{if(b||e.isComposing)return;let t=[...f.querySelectorAll(`[data-folder-path]`)],n=t.indexOf(e.target);if(e.key===`ArrowDown`||e.key===`ArrowUp`){let r=e.key===`ArrowDown`?e.target===c?t[0]:n>=0?t[n+1]:null:n===0?c:n>0?t[n-1]:null;if(!r)return;e.preventDefault(),r.focus();return}if(e.key!==`Enter`||e.shiftKey||n>=0)return;let r=e.target;r.tagName!==`SELECT`&&r.tagName!==`BUTTON`&&r.tagName!==`A`&&r.tagName!==`SUMMARY`&&(e.preventDefault(),j())}),i.addEventListener(`change`,()=>T()),p.loaded.then(e=>{x||(l.hidden=!e?.canChooseFolder,T())}),q(r,`/add-review/folders`).then(t=>{x||!t.ok||(f.replaceChildren(...t.value.folders.map(t=>{let n=J(e,`button`,`prb-palette-result`);return n.type=`button`,n.dataset.folderPath=t.path,n.dataset.folderDisplay=t.display,n.append(J(e,`span`,`prb-palette-result-title`,t.branch?`${t.repo} · ${t.branch}`:t.repo),nn(e,t.display,`prb-palette-result-where`)),n})),d.hidden=t.value.folders.length===0)}),T(),c.focus(),()=>{x=!0,b?.stop(),v!==null&&r.clearTimeout(v)}}}}function pn(e){return e?.compact?`Expand sidebar`:`Collapse sidebar`}function mn(e,t){let n=e.documentElement,r=()=>({compact:n.hasAttribute(`data-sidebar-compact`),hidden:n.hasAttribute(`data-sidebar-hidden`)}),i=()=>{let t=r();for(let n of e.querySelectorAll(`[data-sidebar-toggle="rail"]`)){let e=n.querySelector(`.prb-rail-title`);e&&(e.textContent=pn(t)),n.setAttribute(`aria-expanded`,String(!t.compact))}},a=n=>{let r=e.body,i=r?.dataset.token,a=i?`${r.dataset.apiBase??``}/prefs?t=${encodeURIComponent(i)}`:`/sidebar`;t.fetch(a,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({sidebar:n})}).catch(()=>{})},o=e.querySelector(`.prb-rail`),s,c=!1,l=()=>{let e=r();return e.compact===!0&&!e.hidden},u=e=>{t.clearTimeout(s),s=void 0,n.toggleAttribute(`data-sidebar-peek`,e&&l())},d=e=>{try{return typeof e?.matches==`function`&&e.matches(`:focus-visible`)}catch{return!1}},f=()=>o?.contains(e.activeElement)===!0&&d(e.activeElement);o?.addEventListener(`pointerenter`,()=>{c=!0,l()&&(t.clearTimeout(s),s=t.setTimeout(()=>u(!0),150))}),o?.addEventListener(`pointerleave`,()=>{c=!1,f()||u(!1)}),o?.addEventListener(`focusin`,e=>{d(e.target)&&l()&&u(!0)}),o?.addEventListener(`focusout`,e=>{let t=e.relatedTarget;t&&o.contains(t)||c||u(!1)});let p=e=>{n.toggleAttribute(`data-sidebar-compact`,e),u(!1),i(),a({compact:e})},m=t=>{n.toggleAttribute(`data-sidebar-hidden`,t),u(!1);let r=e.activeElement;t&&r?.closest(`.prb-rail`)&&e.querySelector(`[data-sidebar-toggle="strip"]`)?.focus(),!t&&r?.matches(`[data-sidebar-toggle="strip"]`)&&e.querySelector(`[data-sidebar-toggle="rail"]`)?.focus(),i(),a({hidden:t})};for(let t of e.querySelectorAll(`[data-sidebar-toggle]`))t.addEventListener(`click`,()=>{r().hidden?m(!1):p(!r().compact)});return i(),{hidden:()=>r().hidden===!0,setHidden:m}}function hn(e){return e.querySelector(`dialog[open], [data-menu-panel]:not([hidden])`)!==null}function gn(e){for(let t of e.children)return t.kind===`leaf`?t.command.group:gn(t);return`global`}function _n(e,t,r={}){let i=r.win??window,a=r.doc??document,o=r.isMac??y(i.navigator),s=Dt(vt(e)),c=null,l=e=>{let t=a.querySelector(`a[href="${e}"]:not([target])`);t?t.click():i.location.assign(e)},u=Ft(a,jt(o),`${H(o)} opens the command palette and ${H(o,`p`)} starts a new review, from anywhere in the workspace. Single keys never act while you are typing.`,()=>r.onSettle?.()),d=mn(a,i),f={"palette.open":{run:()=>D()},"add.open":{run:()=>D([`p`])},"add.pullRequest":{panel:dn(a)},"add.branch":{panel:fn(a)},"navigate.reviews":{run:()=>l(`/`)},"navigate.runs":{run:()=>l(`/runs`)},"navigate.notifications":{run:()=>l(`/notifications`)},"help.shortcuts":{run:()=>u.open()},"sidebar.hide":{run:()=>d.setHidden(!d.hidden()),label:()=>d.hidden()?`Show sidebar`:`Hide sidebar`}},p=B.find(e=>e.id===`add.open`),m=W(p.binding,o);for(let e of a.querySelectorAll(`[data-new-review]`)){e.setAttribute(`aria-keyshortcuts`,At(p.binding,o)??``),e.dataset.newReview===`strip`&&(e.dataset.tip=`New review (${m})`);let t=e.querySelector(`[data-new-review-key]`);t&&(t.textContent=m),e.addEventListener(`click`,()=>f[`add.open`].run?.())}let h=e=>f[e.id]??t[e.id],g=(e,t)=>{let n=h(e);return!!n&&(n.available?.(t)??!0)},_=null,v=`back`,b=[],x=()=>{_?.(),_=null},S=(e=`dismissed`)=>{x(),s.reset(),C.close();let t=c;c=null,t?.isConnected&&t.focus(),e===`dismissed`&&r.onSettle?.()},C=Mt(a,e=>O(e),S),w=yt(e).map(e=>({keys:W(e.binding,o),label:e.label})),T=Object.fromEntries(ft.map(e=>[e.id,e.label])),E=()=>{let e=s.at;if(!e)return;let t=e.children.map(e=>e.kind===`leaf`?{key:e.key,keyLabel:e.key.toUpperCase(),label:h(e.command)?.label?.()??e.command.label,namespace:!1,available:g(e.command),group:e.command.group,state:h(e.command)?.state?.()??null}:{key:e.key,keyLabel:e.key.toUpperCase(),label:e.label,namespace:!0,available:!0,group:gn(e)}),n=s.path.length===0?ft.flatMap(e=>t.filter(t=>t.group===e.id)):t;C.show({trail:U(s.path,o),title:e.label,rows:n,groupLabels:s.path.length===0?T:null,footer:w})};function D(e=[]){if(C.isOpen())return S();r.onOpen?.();let t=a.activeElement;c=t instanceof HTMLElement&&t!==a.body?t:null,s.start(e),E()}function O(e){let t=s.press(e);if(t.kind===`descend`)return E();let n=t.kind===`run`&&g(t.command)?h(t.command):null;if(n?.panel&&t.kind===`run`)return k(t.command,n.panel);S(n?`running`:`dismissed`),n?.run?.()}function k(e,t){b=e.binding.kind===`chord`?e.binding.keys.slice(0,-1):[],v=t.escape??`back`;let n=e.binding.kind===`chord`?U(e.binding.keys,o):[H(o)];_=C.showPanel(n,t,()=>S(`running`))}function A(){x(),s.start();for(let e of b)s.press(e);E()}let j=yt(e);return i.addEventListener(`keydown`,e=>{if(C.isOpen()){if(xt(e))return;let t=()=>{e.preventDefault(),e.stopPropagation()};if(_)return e.key===`Escape`&&!e.isComposing?(t(),v===`close`?S():A()):wt(e,o)?(t(),S()):void 0;if(e.key===`Escape`||wt(e,o))return t(),S();if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)){t(),Nt(C.dialog,e.key,a.activeElement);return}if(e.target?.closest?.(`[data-palette-key]`)&&(e.key===`Enter`||e.key===` `)||e.key===`Tab`||e.metaKey||e.ctrlKey||e.altKey)return;t(),O(St(e)??``);return}if(e.defaultPrevented||e.isComposing)return;let t=wt(e,o),r=t?Tt(t):void 0;if(r){if(a.querySelector(`dialog[open]`))return;e.preventDefault(),e.stopPropagation(),h(r)?.run?.(e);return}for(let t of j){if(!Et(t.binding,e,o))continue;let r=t.within;if(r){if(!a.querySelector(r)?.matches(`[open]`))continue}else if(t.binding.kind===`key`&&t.binding.key!==`Escape`&&(n(e.target)||hn(a)))continue;if(g(t,e)){e.preventDefault(),h(t).run?.(e);return}}},!0),i.addEventListener(`pagehide`,()=>{C.isOpen()&&S(`unloading`)}),vn(a,e,o),{isOpen:()=>C.isOpen()||u.isOpen(),close:()=>S()}}function vn(e,t,n){for(let r of _t(t)){let t=r.hint;if(t)for(let i of e.querySelectorAll(t))if(r.binding.kind===`chord`)i.dataset.shortcutHint=W(r.binding,n);else{let e=At(r.binding,n);if(e&&i.setAttribute(`aria-keyshortcuts`,e),r.showHint&&!i.querySelector(`:scope > .prb-key-hint`)){let e=i.ownerDocument.createElement(`kbd`);e.className=`prb-key-hint`,e.setAttribute(`aria-hidden`,`true`),e.textContent=W(r.binding,n),i.append(e)}}}}function yn(e){return`${e} more`}function bn(e){return e===0?`Nothing unread`:`${e} unread`}function xn(e){return e===`moved-again`?`replaced by a later move`:`replaced when the review caught up`}function Sn(e){return e===`restarting`?`Workspace server restarting`:e===`unreachable`?`Workspace server not running`:`Workspace server running`}function $(e,t){let n=e.querySelector(`[data-server-status]`);if(!n)return;n.dataset.serverStatus=t;let r=n.querySelector(`[data-server-status-label]`);r&&(r.textContent=Sn(t))}function Cn(e,t){let n=e.querySelector(`[data-server-status]`);!n||n.dataset.serverStatus===`restarting`||$(e,t?`running`:`unreachable`)}function wn(e,t){if(typeof t==`number`)for(let n of e.querySelectorAll(`[data-unread-count]`))n.dataset.unreadStyle===`rail`&&(n.textContent=t===0?``:bn(t)),n.hidden=t===0}function Tn(e){return e===0?`Nothing running`:`${e} ${e===1?`run`:`runs`} in progress`}function En(e){return e>9?`9+`:String(e)}function Dn(e,t){if(typeof t==`number`)for(let n of e.querySelectorAll(`[data-running-count]`)){let e=n.dataset.runningStyle;e===`rail`?(n.textContent=t===0?``:String(t),n.setAttribute(`aria-label`,Tn(t))):n.textContent=e===`digit`?t===0?``:En(t):t===0?``:Tn(t),e!==`words`&&(n.hidden=t===0)}}var On=6e3,kn=5e3;function An(e=document){let t=e.querySelector(`.prb-toasts`);if(t)return t;let n=e.createElement(`div`);return n.className=`prb-toasts`,n.setAttribute(`role`,`status`),n.setAttribute(`aria-live`,`polite`),e.body.append(n),n}function jn(e,t,n=window){return Mn(e,{kind:t.kind,text:t.text},n)}function Mn(e,t,n){let r=e.ownerDocument,i=r.createElement(`div`);i.className=`prb-toast`,i.dataset.kind=t.kind;let a=r.createElement(`span`);a.className=`prb-toast-text`,a.textContent=t.text;let o=r.createElement(`a`);o.className=`prb-toast-open`,t.href!==void 0&&t.link!==void 0&&(o.href=t.href,o.textContent=t.link);let s=r.createElement(`button`);for(s.type=`button`,s.className=`prb-toast-close`,s.setAttribute(`aria-label`,`Dismiss: ${t.text}`),s.textContent=`×`,i.append(a,...t.href===void 0?[]:[o],s),e.append(i);e.children.length>3;)e.firstElementChild?.remove();let c=n.setTimeout(()=>i.remove(),On),l=()=>n.clearTimeout(c),u=()=>{n.clearTimeout(c),c=n.setTimeout(()=>i.remove(),On)};return i.addEventListener(`mouseenter`,l),i.addEventListener(`mouseleave`,u),i.addEventListener(`focusin`,l),i.addEventListener(`focusout`,u),s.addEventListener(`click`,()=>{n.clearTimeout(c),i.remove()}),i}var Nn=`prb-carried-notices`;function Pn(e=document,t=window){let n=[...e.querySelectorAll(`.prb-toast[data-kind="failed"] .prb-toast-text`)].map(e=>e.textContent??``).filter(Boolean);try{n.length>0&&t.sessionStorage.setItem(Nn,JSON.stringify(n))}catch{}t.location.reload()}function Fn(e=document,t=window){let n;try{n=JSON.parse(t.sessionStorage.getItem(Nn)??`null`),t.sessionStorage.removeItem(Nn)}catch{return}if(Array.isArray(n))for(let r of n)typeof r==`string`&&jn(An(e),{kind:`failed`,text:r},t)}function In(e,t,n=window){return Mn(e,{kind:t.tone,text:t.headline,href:`/notifications/open?id=${encodeURIComponent(t.id)}`,link:`Open`},n)}function Ln(e,t,n=window){return Mn(e,{kind:`more`,text:yn(t),href:`/notifications`,link:`View all`},n)}function Rn(e=document,t=window,n={}){let r=Number(e.body.dataset.notificationsSince);if(!Number.isFinite(r)||r<=0)return;let i=An(e),a=async()=>{try{let a=await t.fetch(`/notifications/recent?after=${r}`);if(Cn(e,!0),a.status===403)return;if(a.ok){let o=await a.json();n.paintUnread&&(wn(e,o.unread),Dn(e,o.running)),typeof o.now==`number`&&(r=o.now);for(let e of[...o.notifications??[]].reverse())In(i,e,t);typeof o.more==`number`&&o.more>0&&Ln(i,o.more,t)}}catch{Cn(e,!1)}t.setTimeout(()=>void a(),kn)};t.setTimeout(()=>void a(),kn)}function zn(e,t){wn(e,t.unread),Dn(e,t.running),typeof t.driving==`boolean`&&Bn(e,t.driving)}function Bn(e,t){let n=e.querySelector(`[data-restart]`),r=e.querySelector(`[data-restart-note]`);n&&(n.disabled=t),r&&(r.hidden=!t)}var Vn=`prb-server-restarted`;function Hn(e=document,t=window){let n=null;try{n=t.sessionStorage.getItem(Vn),t.sessionStorage.removeItem(Vn)}catch{}n!==null&&jn(An(e),{kind:`ready`,text:`Server restarted. Workspace is back online.`},t)}var Un=2e4,Wn=300;function Gn(e){Hn();let t=document.querySelector(`[data-restart]`),n=document.querySelector(`[data-restart-note]`);t&&t.addEventListener(`click`,()=>{t.disabled=!0,Kn(e,t,n)})}async function Kn(e,t,n){let r,i=null;try{let a=await fetch(e,{method:`POST`});if(a.status===409){Bn(document,!0);return}if(!a.ok)return void tr(t,n,await er(a));let o=await a.json();r=typeof o.startedAt==`number`?o.startedAt:null,i=Qn(window.location.href,o.port)}catch{tr(t,n,`The workspace server could not be reached.`);return}if(document.body.dataset.restarting=`true`,$(document,`restarting`),i!==null){if(await Xn(Number(new URL(i).port)))return void window.location.assign(i)}else if(await qn(r)){try{window.sessionStorage.setItem(Vn,`1`)}catch{}window.location.reload();return}if(delete document.body.dataset.restarting,await $n()){$(document,`running`),tr(t,n,`The server did not restart, and is still the one that was running.`);return}$(document,`unreachable`),tr(t,n,`Server restart failed. Run prreviewbuddy open to start the workspace again.`)}async function qn(e){let t=Date.now()+Un;for(;Date.now()<t;){await new Promise(e=>setTimeout(e,Wn));try{let t=await fetch(`/health`,{cache:`no-store`});if(!t.ok)continue;let n=await t.json();if(typeof n.startedAt==`number`&&n.startedAt!==e)return!0}catch{}}return!1}var Jn=4,Yn={now:()=>Date.now(),sleep:e=>new Promise(t=>setTimeout(t,e))};async function Xn(e,t=()=>Zn(e),n=Yn){let r=n.now()+Un,i=0;for(;n.now()<r;){await n.sleep(Wn);let e=await t();if(e===`moved`||(i=e===`gone`?i+1:0,i>=Jn))return!0}for(let e=0;e<Jn;e+=1){let e=await t();if(e!==`gone`)return e===`moved`;await n.sleep(Wn)}return!0}async function Zn(e){try{let t=await fetch(`/health`,{cache:`no-store`});return t.ok&&(await t.json()).movedTo===e?`moved`:`here`}catch{return`gone`}}function Qn(e,t){if(typeof t!=`number`||!Number.isInteger(t))return null;let n=new URL(e);return t===(n.port===``?n.protocol===`https:`?443:80:Number(n.port))?null:(n.port=String(t),n.href)}async function $n(){try{return(await fetch(`/health`,{cache:`no-store`})).ok}catch{return!1}}async function er(e){try{return(await e.json()).error??`The server could not be restarted.`}catch{return`The server could not be restarted.`}}function tr(e,t,n){e.disabled=!1,t&&(t.textContent=n,t.hidden=!1)}export{nt as $,ke as A,Ae as B,ge as C,Te as D,Oe as E,We as F,Ue as G,Me as H,we as I,$e as J,Ye as K,He as L,ot as M,st as N,Fe as O,Ze as P,it as Q,ze as R,he as S,Ee as T,je as U,Je as V,I as W,Ve as X,ct as Y,at as Z,Pt as _,k as _t,jn as a,ie as at,dt as b,n as bt,Dn as c,pe as ct,$ as d,ne as dt,et,xn as f,re as ft,Kt as g,A as gt,Gt as h,v as ht,Fn as i,me as it,Be as j,De as k,wn as l,le as lt,_n as m,y as mt,zn as n,ce as nt,Rn as o,ae as ot,bn as p,O as pt,Xe as q,Pn as r,de as rt,An as s,oe as st,Gn as t,tt,Cn as u,P as ut,jt as v,p as vt,Ne as w,L as x,e as xt,lt as y,j as yt,be as z};
package/static/help.js CHANGED
@@ -1 +1 @@
1
- import{_ as e,dt as t,lt as n,m as r,o as i,t as a,v as o,vt as s}from"./chunk-CMC5F4_t.js";function c(e,t){if(e.length===0)return-1;if(t)return e.length-1;let n=0;return e.forEach((e,t)=>{e<=120&&(n=t)}),n}var l=new Set([`ArrowDown`,`ArrowUp`,`PageDown`,`PageUp`,`Home`,`End`,` `]);function u(e,t){let n=[...e.querySelectorAll(`.prb-help-contents a[href^="#"]`)],r=n.map(t=>e.getElementById(decodeURIComponent(t.hash.slice(1)))),i=e.defaultView;if(n.length===0||!i)return;let a=r.findIndex(e=>e!==null&&`#${e.id}`===i.location.hash),o=e=>{n.forEach((t,n)=>{n===e?t.setAttribute(`aria-current`,`location`):t.removeAttribute(`aria-current`)})},s=()=>{if(a>=0)return o(a);let n=t.scrollHeight>t.clientHeight?t:e.scrollingElement??e.documentElement,i=Math.max(0,n===t?t.getBoundingClientRect().top:0),s=r.map(e=>e?e.getBoundingClientRect().top-i:1/0),l=n.scrollTop>0&&n.scrollTop+n.clientHeight>=n.scrollHeight-2;o(c(s,l))},u=e=>{let t=r.findIndex(t=>t!==null&&`#${t.id}`===e);t<0||(a=t,o(t))},d=()=>{a<0||(a=-1,s())};e.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[href^="#"]`);t&&u(t.hash)}),i.addEventListener(`hashchange`,()=>u(i.location.hash)),t.addEventListener(`wheel`,d,{passive:!0}),t.addEventListener(`touchmove`,d,{passive:!0}),t.addEventListener(`pointerdown`,d),e.addEventListener(`keydown`,e=>{l.has(e.key)&&d()}),e.addEventListener(`scroll`,s,{capture:!0,passive:!0}),i.addEventListener(`resize`,s),s()}n(),r(`global`,{}),document.querySelector(`[data-shortcut-table]`)?.replaceChildren(e(document,o(t(navigator)))),a(`/restart`);var d=document.querySelector(`main.prb-help`);d&&u(document,d),i(document,window,{paintUnread:!0}),s(window,()=>window.location.reload());
1
+ import{_ as e,ft as t,m as n,mt as r,o as i,t as a,v as o,xt as s}from"./chunk-DRtin0n-.js";function c(e,t){if(e.length===0)return-1;if(t)return e.length-1;let n=0;return e.forEach((e,t)=>{e<=120&&(n=t)}),n}var l=new Set([`ArrowDown`,`ArrowUp`,`PageDown`,`PageUp`,`Home`,`End`,` `]);function u(e,t){let n=[...e.querySelectorAll(`.prb-help-contents a[href^="#"]`)],r=n.map(t=>e.getElementById(decodeURIComponent(t.hash.slice(1)))),i=e.defaultView;if(n.length===0||!i)return;let a=r.findIndex(e=>e!==null&&`#${e.id}`===i.location.hash),o=e=>{n.forEach((t,n)=>{n===e?t.setAttribute(`aria-current`,`location`):t.removeAttribute(`aria-current`)})},s=()=>{if(a>=0)return o(a);let n=t.scrollHeight>t.clientHeight?t:e.scrollingElement??e.documentElement,i=Math.max(0,n===t?t.getBoundingClientRect().top:0),s=r.map(e=>e?e.getBoundingClientRect().top-i:1/0),l=n.scrollTop>0&&n.scrollTop+n.clientHeight>=n.scrollHeight-2;o(c(s,l))},u=e=>{let t=r.findIndex(t=>t!==null&&`#${t.id}`===e);t<0||(a=t,o(t))},d=()=>{a<0||(a=-1,s())};e.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[href^="#"]`);t&&u(t.hash)}),i.addEventListener(`hashchange`,()=>u(i.location.hash)),t.addEventListener(`wheel`,d,{passive:!0}),t.addEventListener(`touchmove`,d,{passive:!0}),t.addEventListener(`pointerdown`,d),e.addEventListener(`keydown`,e=>{l.has(e.key)&&d()}),e.addEventListener(`scroll`,s,{capture:!0,passive:!0}),i.addEventListener(`resize`,s),s()}t(),n(`global`,{}),document.querySelector(`[data-shortcut-table]`)?.replaceChildren(e(document,o(r(navigator)))),a(`/restart`);var d=document.querySelector(`main.prb-help`);d&&u(document,d),i(document,window,{paintUnread:!0}),s(window,()=>window.location.reload());