ccdeck 4.0.0 → 4.0.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/README.md +7 -7
- package/dist/web/assets/AccountBridge-fp-fsMx-.js +1 -0
- package/dist/web/assets/{AccountSection-BpIHPhF3.js → AccountSection-Cu-96Q00.js} +1 -1
- package/dist/web/assets/{BrowserWatchModal-DBdt52v7.js → BrowserWatchModal-CvUx07C6.js} +1 -1
- package/dist/web/assets/{FeedbackConversations-BJjgXI0-.js → FeedbackConversations-BgVk0nkA.js} +1 -1
- package/dist/web/assets/{IntegrationModal-DQ0vEz4X.js → IntegrationModal-CEj5oJg4.js} +1 -1
- package/dist/web/assets/{IntegrationSkeleton-JCPbqp96.js → IntegrationSkeleton-DD7YiFgd.js} +1 -1
- package/dist/web/assets/{RadioPanel-Be6AkrKl.js → RadioPanel-BhnzWRCT.js} +1 -1
- package/dist/web/assets/{StageShell-Dq0JOQhd.js → StageShell-DmJu3dU1.js} +3 -3
- package/dist/web/assets/{TrafficRadar-7jqJbhaK.js → TrafficRadar-C8-ieIw5.js} +1 -1
- package/dist/web/assets/{UsageHistoryModal-ckawZGoe.js → UsageHistoryModal-BThv9Kja.js} +1 -1
- package/dist/web/assets/{app-BRjYF6oD.css → app-DtosBis5.css} +1 -1
- package/dist/web/assets/{app-40gNTTfq.js → app-ZMmmEHxF.js} +94 -94
- package/dist/web/assets/{index-XIY3yFiN.js → index-zSxC5ueJ.js} +1 -1
- package/dist/web/assets/{inspector-status-pane-BV_m7eBv.js → inspector-status-pane-BgQG0bQi.js} +1 -1
- package/dist/web/assets/{screens-9_ivqfcF.js → screens-DD0uCtat.js} +1 -1
- package/dist/web/assets/{stage-board-NF_wgGRA.js → stage-board-J2rKA9Pg.js} +1 -1
- package/dist/web/assets/{use-account-BUmI-A8e.js → use-account-DvFObI4M.js} +1 -1
- package/dist/web/index.html +3 -3
- package/package.json +1 -1
- package/release-notes.json +3 -2
- package/dist/web/assets/AccountBridge-OQHT5qmS.js +0 -1
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ The deck opens on these seven pictures the first time it runs — they are the w
|
|
|
98
98
|
| **Both providers, one canvas** | Claude Code through hooks, Codex through its rollout log. The card names a Codex session, and the Inspector shows each session's model (`Opus 5`, `GPT-5.5`). Codex child sessions are connected when their rollout records an explicit parent. Each thread keeps its own tool calls and token totals. |
|
|
99
99
|
| **Cost and quota, live** | Spend per model and per session, plus Claude and Codex quota windows as they refill. |
|
|
100
100
|
| **Tool activity** | Which tools and commands your Claude Code and Codex agents ran on this machine, over the last day or up to 90 days: how many calls, how long they took, which ones fail. Kept on this machine and nowhere else. |
|
|
101
|
-
| **Skill activity** | Which skills your agents used, whether you typed them or the agent called them, how often and when last —
|
|
101
|
+
| **Skill activity** | Which skills your agents used, whether you typed them or the agent called them, how often and when last — on the right stripe, below Tool activity. Kept on this machine and nowhere else. |
|
|
102
102
|
| **Jira beside your agents** | Connect Jira Cloud or Jira Server / Data Center in **Settings › Integrations**, and a Jira control joins the left stripe (`I`). It opens a board's backlog laid out the way Jira's Backlog page lays it out — active sprints first, then the future ones and the backlog, in Jira's rank order, with the board's own quick filters, *Only my issues* and *Hide done* — and an issue's description, comments, attachments and sub-tasks beside the list. Browsing only reads; from an issue's details you can add a comment or change its status, and on a Scrum board ordered by Rank you can also drag issues, or use **Move**, to reorder them or send them to another sprint or the backlog (see [What it touches](#what-it-touches)). |
|
|
103
103
|
| **GitHub and GitLab beside your agents** | Connect GitHub, or GitLab.com or your own GitLab, with a personal access token in **Settings › Integrations**, and its control joins the left stripe. It opens the screens you already work through on GitLab — Branches, Merge requests (Pull requests), Pipelines (Actions) and Issues, for one project or across them — with the merge request, branch, pipeline with its jobs and the failed job's last log lines, or issue beside the list. Paste a link to open it. Read-only: it never comments, approves, merges or re-runs anything. |
|
|
104
104
|
| **Double-click to inspect** | Any card opens its prompt, tool calls, token usage and timing in the Inspector. A single click opens its session's terminal pane; with the terminal turned off, it selects the card and frames its session. |
|
|
@@ -174,7 +174,7 @@ holds the terminal the way every version before 3.20 did.
|
|
|
174
174
|
|
|
175
175
|
Sessions already working when ccdeck starts can appear with a **restored** marker. Codex recovery reads recent unfinished turns from local rollouts; an absent ending does not confirm that its process is still running. On macOS and Linux, Claude recovery verifies a busy session against its process-start identity. **Settings › General** has a separate startup-recovery switch for each provider. Earlier tool calls are not replayed. [Recovery behavior and limits](docs/features/session-recovery.md).
|
|
176
176
|
|
|
177
|
-
The panels open from two stripes, one on each edge of the window, each door on the side its panel opens. The left stripe holds **Sessions** and **Accounts**, then a door for each connected Jira, GitHub or GitLab
|
|
177
|
+
The panels open from two stripes, one on each edge of the window, each door on the side its panel opens. The left stripe holds **Sessions** and **Accounts**, then **Account capacity** and the **Reset calendar**, then a door for each connected Jira, GitHub or GitLab and **Explore integrations**; **Radio** and **Settings** sit at its foot. The right stripe holds the **Inspector**, then **Usage** and **This machine**, then **Usage history**, **Tool activity** and **Skill activity**, then **Browser watch** and **Telemetry Radar**. Each panel shows or hides beside the canvas, and several can be open at once. Point at a door, or Tab to it, and its hint names its key — `L`, `A`, `D`, `U`, `S`, `H`, `B` — while the single-key shortcuts are on; Account capacity, the Reset calendar, Tool activity, Skill activity, Telemetry Radar and Radio have none. **Hide words**, at the foot of the left stripe, folds both stripes to their icons. **Search** in the top bar (⌘K or Ctrl+K, which works with the single keys off) opens any of them, a setting or a session by name. On a phone the board is a full-width stack of cards, and the panels are in a dock along the bottom: Accounts, Sessions, Usage and Machine, with the rest, Settings included, behind its **More**.
|
|
178
178
|
|
|
179
179
|
**The board** draws each session as a card, grouped by project, and a card's colour says its state. The top bar counts the sessions working and done, and **Board | Workspace** beside Search switches the view. The **⋯** among the canvas controls holds the board's commands — **Re-arrange the canvas** (`R`), **Clear the deck…** (`C`), **Open the Command Panel** and **Keyboard shortcuts** (`?`) — and which kinds of tool call the cards show. The board always stays live: nothing pauses it. `J` and `K` walk the cards, `N` goes to the next session waiting on you (`Shift+N` back), and `P` peeks at the selected card without opening anything. **The Sessions list** reads like an inbox: **Needs you** first, longest wait first, then **Done · new**, **Working** and **Done**; a row stays put while your pointer is in the list. **The Inspector** is about the session in focus, in three tabs, **Agents**, **Time** and **Context**, with its next step under the title: **Answer** for a session waiting on you, **Open** for any other, and **Show recap** beside it once a Claude Code session has finished.
|
|
180
180
|
|
|
@@ -182,9 +182,9 @@ Two notes can appear at the bottom of the canvas: **Undo**, for a few seconds af
|
|
|
182
182
|
|
|
183
183
|
Everything the page lets you set apart from the music — the theme, the text size and spacing, the character on the canvas, the single-key shortcuts, the sounds and notifications, how long Tool activity keeps its history — is in **Settings**, at the foot of the left stripe (on a phone, in the dock), or `Cmd+,` (`Ctrl+,` on Windows and Linux); the music is in **Radio**, below. Changes apply immediately except startup recovery, which applies at the next server start. **Settings › Appearance** holds thirteen color themes, Ink the newest, a light one with warm paper surfaces and charcoal text — a fresh install starts in Rider Black rather than following your system's light or dark setting, a theme you picked stays, `T` steps through all thirteen, from inside any dialog too unless you are typing in a field, and the deck fades from one theme to the next over 180 ms, or switches at once when your system asks for reduced motion — and the character: Deck companion, Fox or Penguin, with a switch to hide it. **Settings › Text & density** has five text sizes — Smallest, Smaller, Default, Larger and Largest, 11, 12, 13, 15 and 17 px for body text — and five densities for the spacing in lists, panels and controls: Tightest, Tighter, Compact, Default and Comfortable, at 30%, 50%, 70%, 100% and 140% of the designed spacing. Both are kept in this browser, and neither is a zoom: your browser's zoom and the canvas's stay where they were, the panels widen for larger text, and the cards on the canvas follow it. **Reset to defaults** puts both back. The sounds and how loud each tone is are in **Settings › Sounds**, which `V` opens straight away; `M` turns sounds off or on from anywhere. With **While the deck is closed** on in **Settings › Notifications** (off until you turn it on), a session that finishes its turn sends a notification while the deck is out of sight, as one waiting on you does. `?` lists every key. If you use voice control or press letters by accident, turn off **Single-key shortcuts** in **Settings › Keyboard**, which also lists every shortcut: letters, digits and `?` then do nothing, while `Cmd+,`, `Esc`, `Enter`, `Tab`, `Delete` and the arrows keep working. **Settings › Claude Code**, there when Claude Code is, changes twelve of Claude Code's own settings in your `settings.json` — whether your sessions take messages from and can find each other, auto memory, automatic compaction, how long conversations are kept, checkpoints for rewind, the Co-Authored-By credit, the terminal's tips, turn duration and motion, and the update channel. It shows only what it read: a value that comes from somewhere else, such as an environment variable or your organization, is said under its row, and a `settings.json` it cannot read shows no values, only why. Below them it lists every setting Claude Code documents, the ones your file sets first, each with a link to Claude Code's reference (see [What it touches](#what-it-touches)).
|
|
184
184
|
|
|
185
|
-
**Radio**,
|
|
185
|
+
**Radio**, at the foot of the left stripe (pressing the character on the canvas plays it too), opens a responsive Radio Explorer with a large interactive map, station discovery and a persistent player. Filter by country, sound or language, save favorites, return to recent stations, or choose **Surprise me**. Your existing Claude FM, Lofi Girl and custom streams are under **Your streams**. Select a station to inspect it, then press Play to listen; closing Radio or hiding the character keeps it playing. Favorites, history and the last catalogue are saved in this browser. Control music directly in Radio Explorer; character settings are in **Settings › Appearance**.
|
|
186
186
|
|
|
187
|
-
**Tool activity**,
|
|
187
|
+
**Tool activity**, on the right stripe below Usage history, is a page of which tools and commands the Claude Code and Codex agents on this machine used. For the last 24 hours, 7, 30 or 90 days, and both CLIs or one, it lists each tool's calls, its total and usual time and its failures, sortable by any of them and searchable, under up to three findings worth a look: the tool that takes the most time, one that fails often, the slowest. A row opens that tool's details beside the list: who used it, its calls per day, its latest and slowest calls. A shell command counts per operation — `git status`, `git push` and `npm run build` are rows of their own — and an MCP tool under its own name. A call's time runs from the agent starting the tool to its result, so it includes any wait for your approval, and Claude Code and Codex time their tools differently. **Skill activity**, the next door on that stripe, lists the skills those agents used, ranked by uses, with when each last ran: a skill Claude calls, a slash command you type (when every Claude Code on the machine is 2.1.116 or newer — see [How it works](#how-it-works)), a skill you pick in Codex, and one Codex picks itself, counted when it reads that skill's instructions. The same command run again in a session with the same arguments, such as a `/loop` tick, is a repeat and is left out of the count. A skill opens its details: its uses per day, the projects it ran in, and its latest uses, each linking to its session while that is still on the canvas. It counts what the deck captures from the first time it runs at 3.42.0 or later — earlier sessions are not read back — and it is kept apart from the canvas: Clear empties the canvas and leaves the tool history. What it keeps, and where, is in [What it touches](#what-it-touches).
|
|
188
188
|
|
|
189
189
|
No config file. No account. What your sessions contain — your prompts, the replies, the files they touch — is never reported anywhere. The deck does send usage reports, on by default: its version, your system, your IP address and a device fingerprint, rough counts such as how many sessions ran in a day, the provider names (Jira, GitHub or GitLab) for any locally saved tracker connections and how many of each are saved, and the errors it hits. Only these three provider names and a count of each, capped at 50, are included in the daily connection snapshot — never tracker URLs, connection IDs or names, account details or tokens; when the deck cannot read its list of connections, the snapshot says only that. The snapshot says what is configured, not whether a connection is still valid. It has no switch for them; `AGENTS_DECK_NO_REPORTS=1` keeps them off from the first start.
|
|
190
190
|
|
|
@@ -246,7 +246,7 @@ be chosen explicitly.
|
|
|
246
246
|
|
|
247
247
|
### Claude Telemetry Radar (macOS, Linux and Windows)
|
|
248
248
|
|
|
249
|
-
Open **Telemetry Radar** from
|
|
249
|
+
Open **Telemetry Radar** from the right stripe, or from
|
|
250
250
|
**More** in the dock on a phone. Three views keep configuration, observed traffic and saved files separate:
|
|
251
251
|
|
|
252
252
|
- **Monitor** lists decoded messages and unreadable connection observations.
|
|
@@ -499,7 +499,7 @@ Local network, Claude accounts, Usage and the empty canvas each carry a small **
|
|
|
499
499
|
|
|
500
500
|
## Browser Watch
|
|
501
501
|
|
|
502
|
-
**Browser watch**,
|
|
502
|
+
**Browser watch**, on the right stripe (`B`), answers one question: **did something drive your browser while you were away?** Chromium marks the most common way a program goes to an address: a page loaded with the DevTools protocol's `Page.navigate` (what Playwright and Puppeteer navigate with), or by an extension's `tabs.update`, carries the `FROM_API` flag in `visits.transition`, on top of its type (`LINK`, `TYPED` and the rest). So a run of those, in a stretch when nobody opened a page by hand in that profile, is a finding worth showing. The deck has no idle timer: it goes by the history alone.
|
|
503
503
|
|
|
504
504
|
**What it misses.** Not every way a program opens a page sets the flag. A tab opened straight at an address (`Target.createTarget` over the DevTools protocol, or an extension's `tabs.create`), a link a program clicks, and a URL handed to the browser by `open` or `xdg-open` carry none (tested on Google Chrome 155 on macOS and Brave 1.95 on Linux, against Chromium's source). Those pages are not reported, and because any visit without the flag counts as a person at the browser, they can also cancel a finding close to them.
|
|
505
505
|
|
|
@@ -568,7 +568,7 @@ Two choices change where Auto-switch goes, and do nothing while it is off. **Nex
|
|
|
568
568
|
|
|
569
569
|
A small **shield** on an account's row says that account's organization turns on Claude Code's telemetry export, before you switch to it. Point at it or focus it for the whole sentence — the organization, what is sent, where to, and how long ago the deck saw it; a click opens the same sentence as **Organization telemetry**, on touch too. A Team or Enterprise organization can turn this on for every member, and Claude Code applies it without asking in the VS Code panel, the desktop app and `claude -p`. The deck learns it from `~/.claude/remote-settings.json`, which describes whichever organization last fetched it, so it records the file only once it was written after claude-swap's last switch and the live login is that account's; an organization it has not seen that way yet shows nothing, which means unknown, not off. While Auto-switch is on, that sentence also says how to keep it off such an account: **Hold out of rotation**, in the account's ⋯ menu.
|
|
570
570
|
|
|
571
|
-
**Account capacity**,
|
|
571
|
+
**Account capacity**, on the left stripe, says how many accounts are ready and what their 5-hour and 7-day windows have left. **Reset calendar**, the door below it, lays out today and the next six days, with each account's 7-day reset on the day it falls, and marks the readings that need refreshing.
|
|
572
572
|
|
|
573
573
|
**Account notifications** are four switches in **Settings › Notifications** (at the foot of the left stripe, or `Cmd+,`; `Ctrl+,` on Windows and Linux), each on its own and none of them tied to **While the deck is closed**: they are sent whether the deck is open or not, because nothing on the page says them. The desktop app shows them as ccdeck, without a sound.
|
|
574
574
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,p as t}from"./app-ZMmmEHxF.js";import{u as o,a as s,f as n}from"./use-account-DvFObI4M.js";function r({appliers:u}){o(u);const{view:c}=s();return e.useEffect(()=>{t(n(c))},[c]),e.useEffect(()=>()=>t(null),[]),null}export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as V,r as d,j as e,k as a,b_ as I,s as K,b$ as w,c0 as u,t as A,g as q}from"./app-40gNTTfq.js";import{b as m,o as _,a as z}from"./use-account-BUmI-A8e.js";function L(n,s,o){return o==null?n("settings.account.notSet"):typeof o=="boolean"?n(o?"settings.claude.effect.on":"settings.claude.effect.off"):s==="hideFinishedAfter"?o===0?n("settings.board.never"):n("settings.board.minutes",{n:String(o)}):String(o)}const C={loading:"settings.account.preview.loading",failed:"settings.account.preview.failed",none:"settings.account.preview.none",same:"settings.account.preview.same",stale:"settings.account.preview.stale"};function H({onDone:n}){var S;const s=V(),[o,R]=d.useState(null),[t,f]=d.useState(!1),[x,r]=d.useState(!1),v=d.useRef(!1),[y,M]=d.useState(""),N=()=>{f(!1),m.preview().then(i=>{i!=null&&i.error?f(!0):R(i)}).catch(()=>f(!0))};d.useEffect(N,[]);const k=async i=>{if(K(v.current)){v.current=!0,r(!0);try{const h=await m.setMode(i);if((h==null?void 0:h.error)==="revision_conflict"){M(C.stale),N();return}if(h!=null&&h.error){M(C.failed);return}n()}finally{v.current=!1,r(!1)}}};if(t)return e.jsxs("div",{className:"account-preview",role:"group","aria-label":s("settings.account.shareLabel"),children:[e.jsx("p",{className:"settings-row-note",children:s(C.failed)}),e.jsx("div",{className:"account-actions",children:e.jsx("button",{type:"button",className:"btn",onClick:n,children:s("common.close")})})]});if(!o)return e.jsx("p",{className:"settings-row-note account-preview",children:s(C.loading)});const p=o.shared;return e.jsxs("div",{className:"account-preview",role:"group","aria-label":s("settings.account.shareLabel"),children:[y&&e.jsx("p",{className:"settings-row-said",role:"status",children:s(y)}),p?e.jsxs(e.Fragment,{children:[o.differences.length===0?e.jsx("p",{className:"settings-row-note",children:s(C.same)}):e.jsxs("table",{className:"account-diff",children:[e.jsx("caption",{className:"settings-row-note",children:(S=p.updatedBy)!=null&&S.name?s("settings.account.sharedRevisionBy",{revision:p.revision,name:p.updatedBy.name}):s("settings.account.sharedRevision",{revision:p.revision})}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:s("settings.account.colSetting")}),e.jsx("th",{scope:"col",children:s("settings.account.colThisDeck")}),e.jsx("th",{scope:"col",children:s("settings.account.colShared")})]})}),e.jsx("tbody",{children:o.differences.map(i=>e.jsxs("tr",{children:[e.jsx("th",{scope:"row",children:I(s,i.key)??i.key}),e.jsx("td",{children:L(s,i.key,i.local)}),e.jsx("td",{children:L(s,i.key,i.shared)})]},i.key))})]}),e.jsxs("div",{className:"account-actions",children:[e.jsx("button",{type:"button",className:"btn",onClick:n,...a(x),children:s("common.cancel")}),e.jsx("button",{type:"button",className:"btn",...a(x),onClick:()=>k({mode:"shared",join:"publish",previewRevision:p.revision}),children:s("settings.account.useDeckForAll")}),e.jsx("button",{type:"button",className:"btn primary",...a(x),onClick:()=>k({mode:"shared",join:"use-shared"}),children:s("settings.account.useShared")})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"settings-row-note",children:s(C.none)}),e.jsxs("div",{className:"account-actions",children:[e.jsx("button",{type:"button",className:"btn",onClick:n,...a(x),children:s("common.cancel")}),e.jsx("button",{type:"button",className:"btn primary",...a(x),onClick:()=>k({mode:"shared",join:"publish",previewRevision:0}),children:s("settings.account.publishDeck")})]})]})]})}const g={vetoed:"settings.account.copy.vetoed",loading:"settings.account.copy.loading",unreachable:"settings.account.copy.unreachable",explain:"settings.account.copy.explain",sent:"settings.account.copy.sent",nameNote:"settings.account.copy.nameNote",connecting:"settings.account.copy.connecting",revoked:"settings.account.copy.revoked",accountGone:"settings.account.copy.accountGone",disconnectNote:"settings.account.copy.disconnectNote",tokenMissing:"settings.account.copy.tokenMissing"},Q={"api-disabled":"settings.account.problem.apiDisabled",offline:"settings.account.problem.offline","rate-limited":"settings.account.problem.rateLimited","connect-denied":"settings.account.problem.connectDenied","connect-expired":"settings.account.problem.connectExpired","connect-failed":"settings.account.problem.connectFailed","keychain-locked":"settings.account.problem.keychainLocked","token-missing":g.tokenMissing},X={keychain:"settings.account.storage.keychain",dpapi:"settings.account.storage.dpapi","secret-service":"settings.account.storage.secretService",file:"settings.account.storage.file"},Z={keychain:"settings.account.signIn.keychain",dpapi:"settings.account.signIn.dpapi","secret-service":"settings.account.signIn.secretService",file:"settings.account.signIn.file"},G=n=>{if(!n)return"";const s=new Date(n);return Number.isFinite(s.getTime())?s.toLocaleTimeString(q(),{hour:"2-digit",minute:"2-digit",second:"2-digit"}):""};function ee(n){const s=n.status;return!s||!s.lastSentAt?A("settings.account.status.notSent"):s.lastResult==="offline"?A("settings.account.status.offline",{time:G(s.lastSentAt)}):s.lastResult==="rejected"?A("settings.account.status.refused",{time:G(s.lastSentAt)}):A("settings.account.status.sent",{time:G(s.lastSentAt),seconds:s.everySec})}function $(n){const s=n.sync;return s?s.appliedRevision==null?A("settings.account.revisionsNotYet",{saved:s.savedRevision}):A("settings.account.revisions",{saved:s.savedRevision,applied:s.appliedRevision}):""}function te(n,s){const o=Math.max(0,Math.round((Date.parse(n)-s)/1e3));return`${Math.floor(o/60)}:${String(o%60).padStart(2,"0")}`}function Y({view:n,failed:s=!1,vetoed:o,now:R=Date.now()}){var T,U,O;const t=V(),[f,x]=d.useState(null),[r,v]=d.useState(!1),y=d.useRef(!1),[M,N]=d.useState(!1),[k,p]=d.useState(!1),[S,i]=d.useState(!1);if(o)return e.jsx(w,{id:"settings-account-caption",title:t("settings.account.title"),children:e.jsx(u,{as:"div",name:t("settings.section.account.label"),note:t(g.vetoed)})});if(!n)return e.jsx("p",{className:"settings-row-note",children:t(s?g.unreachable:g.loading)});const h=n.problem?Q[n.problem]:void 0,B=h?t(h):null,D=X[n.tokenStorage??""],b=async c=>{if(K(y.current)){y.current=!0,v(!0);try{await c()}catch{}finally{y.current=!1,v(!1)}}},J=()=>b(async()=>{var l;const c=await m.connect(f??n.suggestedName),j=(l=c==null?void 0:c.connect)==null?void 0:l.verificationUriComplete;j&&_(j)&&window.open(j,"_blank","noopener,noreferrer")});if(n.state==="connecting"&&n.connect){const c=n.connect;return e.jsxs(w,{id:"settings-account-caption",title:t("settings.account.connecting"),children:[e.jsx(u,{as:"div",name:t("settings.account.code"),note:t(g.connecting),control:e.jsx("span",{className:"account-code",children:c.userCode})}),e.jsx(u,{as:"div",name:t("settings.account.waiting"),note:t("settings.account.expiresIn",{time:te(c.expiresAt,R)}),control:e.jsxs("span",{className:"account-actions",children:[_(c.verificationUriComplete)&&e.jsx("a",{className:"settings-link",href:c.verificationUriComplete,target:"_blank",rel:"noopener noreferrer",children:t("settings.account.openAgain")}),e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>b(m.cancel),children:t("common.cancel")})]})})]})}if(n.state==="connected"&&n.device){const c=n.sync,j=((T=n.account)==null?void 0:T.email)??t("settings.account.yourAccount");return e.jsxs(e.Fragment,{children:[e.jsxs(w,{id:"settings-account-caption",title:t("settings.account.title"),children:[e.jsx(u,{as:"div",name:j,note:ee(n),control:n.device.consoleUrl&&_(n.device.consoleUrl)?e.jsx("a",{className:"settings-link",href:n.device.consoleUrl,target:"_blank",rel:"noopener noreferrer",children:t("settings.account.openMachines")}):void 0}),e.jsx(u,{as:"div",name:t("settings.account.thisDeck",{name:n.device.name}),note:B??(D?t(D):"")})]}),c&&e.jsxs(w,{id:"settings-account-sync-caption",title:t("settings.account.syncTitle"),children:[e.jsx(u,{as:"div",name:t(c.mode==="shared"?"settings.account.sharedName":"settings.account.deckOnlyName"),note:c.mode==="shared"?t("settings.account.sharedNote",{stays:c.overrides.map(l=>{var P;return((P=I(t,l))==null?void 0:P.toLowerCase())??l}).join(", ")||t("settings.account.nothing"),revisions:$(n)}):t("settings.account.deckOnlyNote",{revisions:$(n)}),control:c.mode==="shared"?e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>b(()=>m.setMode({mode:"independent"})),children:t("settings.account.stopSharing")}):e.jsx("button",{type:"button",className:"btn",...a(r,k),onClick:()=>p(!0),children:t("settings.account.shareSettings")})}),k&&e.jsx(u,{as:"div",className:"settings-row-wide",name:t("settings.account.joinName"),children:e.jsx(H,{onDone:()=>p(!1)})}),c.pending&&!c.conflict&&e.jsx(u,{as:"div",name:t("settings.account.pending"),note:t("settings.account.pendingNote",{keys:c.pending.keys.map(l=>I(t,l)??l).join(", "),state:t(c.saving==="offline"?"settings.account.pendingOffline":c.saving==="refused"?"settings.account.pendingRefused":"settings.account.pendingSaving")})}),c.conflict&&e.jsx(u,{as:"div",className:S?"settings-row-wide":void 0,name:t("settings.account.changedElsewhere"),note:(U=c.conflict.latest.updatedBy)!=null&&U.name?t("settings.account.changedElsewhereBy",{revision:c.conflict.latest.revision,name:c.conflict.latest.updatedBy.name}):t("settings.account.changedElsewhereNote",{revision:c.conflict.latest.revision}),control:S?void 0:e.jsxs("span",{className:"account-actions",children:[e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>i(!0),children:t("settings.account.review")}),e.jsx("button",{type:"button",className:"btn primary",...a(r),onClick:()=>b(()=>m.resolve("use-latest")),children:t("settings.account.useLatest")})]}),children:S&&e.jsxs("div",{className:"account-preview",children:[e.jsxs("table",{className:"account-diff",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:t("settings.account.colSetting")}),e.jsx("th",{scope:"col",children:t("settings.account.colYours")}),e.jsx("th",{scope:"col",children:`r${c.conflict.latest.revision}`})]})}),e.jsx("tbody",{children:Object.keys(c.conflict.mine).map(l=>e.jsxs("tr",{children:[e.jsx("th",{scope:"row",children:I(t,l)??l}),e.jsx("td",{children:L(t,l,c.conflict.mine[l])}),e.jsx("td",{children:L(t,l,c.conflict.latest.values[l])})]},l))})]}),e.jsxs("div",{className:"account-actions",children:[e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>i(!1),children:t("settings.account.back")}),e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>b(()=>m.resolve("use-latest")),children:t("settings.account.useLatest")}),e.jsx("button",{type:"button",className:"btn primary",...a(r),onClick:()=>b(async()=>{await m.resolve("reapply"),i(!1)}),children:t("settings.account.saveMine",{revision:c.conflict.latest.revision})})]})]})}),c.askUploadForNewAccount&&e.jsx(u,{as:"div",name:t("settings.account.notSavedName"),note:t("settings.account.notSavedNote",{email:j}),control:e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>b(m.upload),children:t("settings.account.saveToAccount",{email:j})})}),((O=c.skipped)==null?void 0:O.theme)&&e.jsx(u,{as:"div",name:t("settings.account.themeKept"),note:t("settings.account.themeKeptNote",{theme:c.skipped.theme})})]}),e.jsx(w,{id:"settings-account-leave-caption",title:t("settings.account.disconnectTitle"),children:e.jsx(u,{as:"div",name:t("settings.account.disconnectName"),note:t(g.disconnectNote),control:M?e.jsxs("span",{className:"account-actions",children:[e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>N(!1),children:t("common.cancel")}),e.jsx("button",{type:"button",className:"btn danger",...a(r),onClick:()=>b(async()=>{await m.disconnect(),N(!1)}),children:t("settings.account.disconnect")})]}):e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>N(!0),children:t("settings.account.disconnectAsk")})})})]})}const E=n.state==="revoked",W=E?n.revokedReason==="account_gone"?g.accountGone:g.revoked:n.state==="error"?g.tokenMissing:g.explain,F=Z[n.tokenStorage??""];return e.jsxs(w,{id:"settings-account-caption",title:t("settings.account.title"),note:t(W),children:[e.jsx(u,{as:"div",name:t("settings.account.whatIsSent"),note:t(g.sent)}),e.jsx(u,{name:t("settings.account.appearAs"),nameId:"settings-account-name-label",note:t(g.nameNote),noteId:"settings-account-name-note",control:e.jsx("input",{className:"ap-manage-input account-name",type:"text",value:f??n.suggestedName,maxLength:48,spellCheck:!1,autoComplete:"off","aria-labelledby":"settings-account-name-label","aria-describedby":"settings-account-name-note",onChange:c=>x(c.target.value)})}),e.jsx(u,{as:"div",name:t(E?"settings.account.connectAgain":"settings.account.connect"),note:B??(F?t(F):void 0),control:e.jsx("button",{type:"button",className:"btn primary",...a(r),onClick:J,children:t(E?"settings.account.connectAgain":"settings.account.connect")})})]})}function oe({vetoed:n}){return n?e.jsx(Y,{view:null,vetoed:!0}):e.jsx(ne,{})}function ne(){const{view:n,failed:s}=z(),[o,R]=d.useState(()=>Date.now()),t=(n==null?void 0:n.state)==="connecting";return d.useEffect(()=>{if(!t)return;const f=window.setInterval(()=>R(Date.now()),1e3);return()=>window.clearInterval(f)},[t]),d.useEffect(()=>{m.refresh()},[]),e.jsx(Y,{view:n,failed:s,vetoed:!1,now:o})}export{g as ACCOUNT_MSGS,Y as AccountPanel,Q as PROBLEM_MSGS,X as STORAGE_MSGS,oe as default,te as expiresIn,$ as revisionsLine,ee as statusLine};
|
|
1
|
+
import{u as V,r as d,j as e,k as a,b_ as I,s as K,b$ as w,c0 as u,t as A,g as q}from"./app-ZMmmEHxF.js";import{b as m,o as _,a as z}from"./use-account-DvFObI4M.js";function L(n,s,o){return o==null?n("settings.account.notSet"):typeof o=="boolean"?n(o?"settings.claude.effect.on":"settings.claude.effect.off"):s==="hideFinishedAfter"?o===0?n("settings.board.never"):n("settings.board.minutes",{n:String(o)}):String(o)}const C={loading:"settings.account.preview.loading",failed:"settings.account.preview.failed",none:"settings.account.preview.none",same:"settings.account.preview.same",stale:"settings.account.preview.stale"};function H({onDone:n}){var S;const s=V(),[o,R]=d.useState(null),[t,f]=d.useState(!1),[x,r]=d.useState(!1),v=d.useRef(!1),[y,M]=d.useState(""),N=()=>{f(!1),m.preview().then(i=>{i!=null&&i.error?f(!0):R(i)}).catch(()=>f(!0))};d.useEffect(N,[]);const k=async i=>{if(K(v.current)){v.current=!0,r(!0);try{const h=await m.setMode(i);if((h==null?void 0:h.error)==="revision_conflict"){M(C.stale),N();return}if(h!=null&&h.error){M(C.failed);return}n()}finally{v.current=!1,r(!1)}}};if(t)return e.jsxs("div",{className:"account-preview",role:"group","aria-label":s("settings.account.shareLabel"),children:[e.jsx("p",{className:"settings-row-note",children:s(C.failed)}),e.jsx("div",{className:"account-actions",children:e.jsx("button",{type:"button",className:"btn",onClick:n,children:s("common.close")})})]});if(!o)return e.jsx("p",{className:"settings-row-note account-preview",children:s(C.loading)});const p=o.shared;return e.jsxs("div",{className:"account-preview",role:"group","aria-label":s("settings.account.shareLabel"),children:[y&&e.jsx("p",{className:"settings-row-said",role:"status",children:s(y)}),p?e.jsxs(e.Fragment,{children:[o.differences.length===0?e.jsx("p",{className:"settings-row-note",children:s(C.same)}):e.jsxs("table",{className:"account-diff",children:[e.jsx("caption",{className:"settings-row-note",children:(S=p.updatedBy)!=null&&S.name?s("settings.account.sharedRevisionBy",{revision:p.revision,name:p.updatedBy.name}):s("settings.account.sharedRevision",{revision:p.revision})}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:s("settings.account.colSetting")}),e.jsx("th",{scope:"col",children:s("settings.account.colThisDeck")}),e.jsx("th",{scope:"col",children:s("settings.account.colShared")})]})}),e.jsx("tbody",{children:o.differences.map(i=>e.jsxs("tr",{children:[e.jsx("th",{scope:"row",children:I(s,i.key)??i.key}),e.jsx("td",{children:L(s,i.key,i.local)}),e.jsx("td",{children:L(s,i.key,i.shared)})]},i.key))})]}),e.jsxs("div",{className:"account-actions",children:[e.jsx("button",{type:"button",className:"btn",onClick:n,...a(x),children:s("common.cancel")}),e.jsx("button",{type:"button",className:"btn",...a(x),onClick:()=>k({mode:"shared",join:"publish",previewRevision:p.revision}),children:s("settings.account.useDeckForAll")}),e.jsx("button",{type:"button",className:"btn primary",...a(x),onClick:()=>k({mode:"shared",join:"use-shared"}),children:s("settings.account.useShared")})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"settings-row-note",children:s(C.none)}),e.jsxs("div",{className:"account-actions",children:[e.jsx("button",{type:"button",className:"btn",onClick:n,...a(x),children:s("common.cancel")}),e.jsx("button",{type:"button",className:"btn primary",...a(x),onClick:()=>k({mode:"shared",join:"publish",previewRevision:0}),children:s("settings.account.publishDeck")})]})]})]})}const g={vetoed:"settings.account.copy.vetoed",loading:"settings.account.copy.loading",unreachable:"settings.account.copy.unreachable",explain:"settings.account.copy.explain",sent:"settings.account.copy.sent",nameNote:"settings.account.copy.nameNote",connecting:"settings.account.copy.connecting",revoked:"settings.account.copy.revoked",accountGone:"settings.account.copy.accountGone",disconnectNote:"settings.account.copy.disconnectNote",tokenMissing:"settings.account.copy.tokenMissing"},Q={"api-disabled":"settings.account.problem.apiDisabled",offline:"settings.account.problem.offline","rate-limited":"settings.account.problem.rateLimited","connect-denied":"settings.account.problem.connectDenied","connect-expired":"settings.account.problem.connectExpired","connect-failed":"settings.account.problem.connectFailed","keychain-locked":"settings.account.problem.keychainLocked","token-missing":g.tokenMissing},X={keychain:"settings.account.storage.keychain",dpapi:"settings.account.storage.dpapi","secret-service":"settings.account.storage.secretService",file:"settings.account.storage.file"},Z={keychain:"settings.account.signIn.keychain",dpapi:"settings.account.signIn.dpapi","secret-service":"settings.account.signIn.secretService",file:"settings.account.signIn.file"},G=n=>{if(!n)return"";const s=new Date(n);return Number.isFinite(s.getTime())?s.toLocaleTimeString(q(),{hour:"2-digit",minute:"2-digit",second:"2-digit"}):""};function ee(n){const s=n.status;return!s||!s.lastSentAt?A("settings.account.status.notSent"):s.lastResult==="offline"?A("settings.account.status.offline",{time:G(s.lastSentAt)}):s.lastResult==="rejected"?A("settings.account.status.refused",{time:G(s.lastSentAt)}):A("settings.account.status.sent",{time:G(s.lastSentAt),seconds:s.everySec})}function $(n){const s=n.sync;return s?s.appliedRevision==null?A("settings.account.revisionsNotYet",{saved:s.savedRevision}):A("settings.account.revisions",{saved:s.savedRevision,applied:s.appliedRevision}):""}function te(n,s){const o=Math.max(0,Math.round((Date.parse(n)-s)/1e3));return`${Math.floor(o/60)}:${String(o%60).padStart(2,"0")}`}function Y({view:n,failed:s=!1,vetoed:o,now:R=Date.now()}){var T,U,O;const t=V(),[f,x]=d.useState(null),[r,v]=d.useState(!1),y=d.useRef(!1),[M,N]=d.useState(!1),[k,p]=d.useState(!1),[S,i]=d.useState(!1);if(o)return e.jsx(w,{id:"settings-account-caption",title:t("settings.account.title"),children:e.jsx(u,{as:"div",name:t("settings.section.account.label"),note:t(g.vetoed)})});if(!n)return e.jsx("p",{className:"settings-row-note",children:t(s?g.unreachable:g.loading)});const h=n.problem?Q[n.problem]:void 0,B=h?t(h):null,D=X[n.tokenStorage??""],b=async c=>{if(K(y.current)){y.current=!0,v(!0);try{await c()}catch{}finally{y.current=!1,v(!1)}}},J=()=>b(async()=>{var l;const c=await m.connect(f??n.suggestedName),j=(l=c==null?void 0:c.connect)==null?void 0:l.verificationUriComplete;j&&_(j)&&window.open(j,"_blank","noopener,noreferrer")});if(n.state==="connecting"&&n.connect){const c=n.connect;return e.jsxs(w,{id:"settings-account-caption",title:t("settings.account.connecting"),children:[e.jsx(u,{as:"div",name:t("settings.account.code"),note:t(g.connecting),control:e.jsx("span",{className:"account-code",children:c.userCode})}),e.jsx(u,{as:"div",name:t("settings.account.waiting"),note:t("settings.account.expiresIn",{time:te(c.expiresAt,R)}),control:e.jsxs("span",{className:"account-actions",children:[_(c.verificationUriComplete)&&e.jsx("a",{className:"settings-link",href:c.verificationUriComplete,target:"_blank",rel:"noopener noreferrer",children:t("settings.account.openAgain")}),e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>b(m.cancel),children:t("common.cancel")})]})})]})}if(n.state==="connected"&&n.device){const c=n.sync,j=((T=n.account)==null?void 0:T.email)??t("settings.account.yourAccount");return e.jsxs(e.Fragment,{children:[e.jsxs(w,{id:"settings-account-caption",title:t("settings.account.title"),children:[e.jsx(u,{as:"div",name:j,note:ee(n),control:n.device.consoleUrl&&_(n.device.consoleUrl)?e.jsx("a",{className:"settings-link",href:n.device.consoleUrl,target:"_blank",rel:"noopener noreferrer",children:t("settings.account.openMachines")}):void 0}),e.jsx(u,{as:"div",name:t("settings.account.thisDeck",{name:n.device.name}),note:B??(D?t(D):"")})]}),c&&e.jsxs(w,{id:"settings-account-sync-caption",title:t("settings.account.syncTitle"),children:[e.jsx(u,{as:"div",name:t(c.mode==="shared"?"settings.account.sharedName":"settings.account.deckOnlyName"),note:c.mode==="shared"?t("settings.account.sharedNote",{stays:c.overrides.map(l=>{var P;return((P=I(t,l))==null?void 0:P.toLowerCase())??l}).join(", ")||t("settings.account.nothing"),revisions:$(n)}):t("settings.account.deckOnlyNote",{revisions:$(n)}),control:c.mode==="shared"?e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>b(()=>m.setMode({mode:"independent"})),children:t("settings.account.stopSharing")}):e.jsx("button",{type:"button",className:"btn",...a(r,k),onClick:()=>p(!0),children:t("settings.account.shareSettings")})}),k&&e.jsx(u,{as:"div",className:"settings-row-wide",name:t("settings.account.joinName"),children:e.jsx(H,{onDone:()=>p(!1)})}),c.pending&&!c.conflict&&e.jsx(u,{as:"div",name:t("settings.account.pending"),note:t("settings.account.pendingNote",{keys:c.pending.keys.map(l=>I(t,l)??l).join(", "),state:t(c.saving==="offline"?"settings.account.pendingOffline":c.saving==="refused"?"settings.account.pendingRefused":"settings.account.pendingSaving")})}),c.conflict&&e.jsx(u,{as:"div",className:S?"settings-row-wide":void 0,name:t("settings.account.changedElsewhere"),note:(U=c.conflict.latest.updatedBy)!=null&&U.name?t("settings.account.changedElsewhereBy",{revision:c.conflict.latest.revision,name:c.conflict.latest.updatedBy.name}):t("settings.account.changedElsewhereNote",{revision:c.conflict.latest.revision}),control:S?void 0:e.jsxs("span",{className:"account-actions",children:[e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>i(!0),children:t("settings.account.review")}),e.jsx("button",{type:"button",className:"btn primary",...a(r),onClick:()=>b(()=>m.resolve("use-latest")),children:t("settings.account.useLatest")})]}),children:S&&e.jsxs("div",{className:"account-preview",children:[e.jsxs("table",{className:"account-diff",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:t("settings.account.colSetting")}),e.jsx("th",{scope:"col",children:t("settings.account.colYours")}),e.jsx("th",{scope:"col",children:`r${c.conflict.latest.revision}`})]})}),e.jsx("tbody",{children:Object.keys(c.conflict.mine).map(l=>e.jsxs("tr",{children:[e.jsx("th",{scope:"row",children:I(t,l)??l}),e.jsx("td",{children:L(t,l,c.conflict.mine[l])}),e.jsx("td",{children:L(t,l,c.conflict.latest.values[l])})]},l))})]}),e.jsxs("div",{className:"account-actions",children:[e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>i(!1),children:t("settings.account.back")}),e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>b(()=>m.resolve("use-latest")),children:t("settings.account.useLatest")}),e.jsx("button",{type:"button",className:"btn primary",...a(r),onClick:()=>b(async()=>{await m.resolve("reapply"),i(!1)}),children:t("settings.account.saveMine",{revision:c.conflict.latest.revision})})]})]})}),c.askUploadForNewAccount&&e.jsx(u,{as:"div",name:t("settings.account.notSavedName"),note:t("settings.account.notSavedNote",{email:j}),control:e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>b(m.upload),children:t("settings.account.saveToAccount",{email:j})})}),((O=c.skipped)==null?void 0:O.theme)&&e.jsx(u,{as:"div",name:t("settings.account.themeKept"),note:t("settings.account.themeKeptNote",{theme:c.skipped.theme})})]}),e.jsx(w,{id:"settings-account-leave-caption",title:t("settings.account.disconnectTitle"),children:e.jsx(u,{as:"div",name:t("settings.account.disconnectName"),note:t(g.disconnectNote),control:M?e.jsxs("span",{className:"account-actions",children:[e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>N(!1),children:t("common.cancel")}),e.jsx("button",{type:"button",className:"btn danger",...a(r),onClick:()=>b(async()=>{await m.disconnect(),N(!1)}),children:t("settings.account.disconnect")})]}):e.jsx("button",{type:"button",className:"btn",...a(r),onClick:()=>N(!0),children:t("settings.account.disconnectAsk")})})})]})}const E=n.state==="revoked",W=E?n.revokedReason==="account_gone"?g.accountGone:g.revoked:n.state==="error"?g.tokenMissing:g.explain,F=Z[n.tokenStorage??""];return e.jsxs(w,{id:"settings-account-caption",title:t("settings.account.title"),note:t(W),children:[e.jsx(u,{as:"div",name:t("settings.account.whatIsSent"),note:t(g.sent)}),e.jsx(u,{name:t("settings.account.appearAs"),nameId:"settings-account-name-label",note:t(g.nameNote),noteId:"settings-account-name-note",control:e.jsx("input",{className:"ap-manage-input account-name",type:"text",value:f??n.suggestedName,maxLength:48,spellCheck:!1,autoComplete:"off","aria-labelledby":"settings-account-name-label","aria-describedby":"settings-account-name-note",onChange:c=>x(c.target.value)})}),e.jsx(u,{as:"div",name:t(E?"settings.account.connectAgain":"settings.account.connect"),note:B??(F?t(F):void 0),control:e.jsx("button",{type:"button",className:"btn primary",...a(r),onClick:J,children:t(E?"settings.account.connectAgain":"settings.account.connect")})})]})}function oe({vetoed:n}){return n?e.jsx(Y,{view:null,vetoed:!0}):e.jsx(ne,{})}function ne(){const{view:n,failed:s}=z(),[o,R]=d.useState(()=>Date.now()),t=(n==null?void 0:n.state)==="connecting";return d.useEffect(()=>{if(!t)return;const f=window.setInterval(()=>R(Date.now()),1e3);return()=>window.clearInterval(f)},[t]),d.useEffect(()=>{m.refresh()},[]),e.jsx(Y,{view:n,failed:s,vetoed:!1,now:o})}export{g as ACCOUNT_MSGS,Y as AccountPanel,Q as PROBLEM_MSGS,X as STORAGE_MSGS,oe as default,te as expiresIn,$ as revisionsLine,ee as statusLine};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as P,j as e,r as h,ak as Z,al as ee,g as V,t as I,am as se,h as te,an as ne,y as ae,ao as ie,s as re,ap as U,o as H,G as le,J as ce,Q as oe,R as de,k as he,aq as we}from"./app-40gNTTfq.js";function be({snap:s}){const a=P();return e.jsxs("section",{className:"bw-feed",children:[e.jsxs("h4",{className:"bw-sec-head bw-head-row",children:[a("settings.bw.feed"),e.jsx("span",{className:"bw-feed-count",children:a("settings.bw.feed.count",{count:s.log.length})})]}),e.jsx("p",{className:"bw-since bw-feed-note",children:a("settings.bw.feed.note")}),e.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:s.log.length===0?e.jsx("p",{className:"bw-note",children:a("settings.bw.feed.empty")}):s.log.map(t=>e.jsxs("div",{className:`bw-log-line ${t.level}${t.parts?"":" sys"}`,children:[e.jsx("span",{className:"bw-log-time",children:new Date(t.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),t.parts?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"bw-log-browser",children:t.parts.browser}),e.jsx("span",{className:"bw-log-profile",title:t.parts.profile,children:t.parts.profile}),e.jsxs("span",{className:"bw-log-value",children:[t.parts.value,t.parts.flagged>0&&e.jsx("span",{className:"bw-log-flag",children:a("settings.bw.feed.flagged",{count:t.parts.flagged})})]})]}):e.jsx("span",{className:"bw-log-sys",children:t.text})]},`${t.atMs}-${t.level}-${t.text}`))})]})}const D=s=>`${s.host}-${s.startMs}`;function ue(s){const a=t=>new Date(t).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1});return s.count===1||s.endMs-s.startMs<6e4?a(s.startMs):`${a(s.startMs)} → ${a(s.endMs)}`}function ge(s){return new Date(s).toLocaleDateString(V(),{weekday:"short",day:"numeric",month:"short"})}function _(s,a){const t=Math.round((s.endMs-s.startMs)/6e4);return t<1?"":a("settings.bw.findings.minutes",{n:t})}function me({snap:s,dismiss:a,refreshRef:t}){const i=P(),[l,d]=h.useState(null),o=h.useRef(new Map),n=h.useRef(null);h.useEffect(()=>{var c,u;const b=n.current;!b||s.episodes.some(g=>D(g)===b.id)||(n.current=null,Z(((c=document.activeElement)==null?void 0:c.tagName)??null)&&((u=(b.next?o.current.get(b.next):void 0)??t.current)==null||u.focus()))},[s]);const r=b=>{n.current={id:D(b),next:ee(s.episodes.map(D),D(b))},a(b)},w=h.useMemo(()=>{const b=[];for(const c of s.episodes){const u=ge(c.startMs),g=b[b.length-1];g&&g.label===u?g.episodes.push(c):b.push({label:u,episodes:[c]})}return b},[s]);return e.jsxs("section",{className:"bw-findings",children:[e.jsxs("h4",{className:"bw-sec-head bw-head-row",children:[i("settings.bw.findings"),s.episodes.length>0&&e.jsx("span",{className:"bw-feed-count",children:i("settings.bw.findings.count",{count:s.episodes.length})})]}),e.jsx("div",{className:"bw-eps",children:w.length===0?e.jsxs("div",{className:"bw-empty",children:[e.jsx("p",{className:"bw-empty-head",children:i("settings.bw.findings.none")}),e.jsx("p",{className:"bw-empty-note",children:i("settings.bw.findings.noneNote",{count:s.settings.quietMinutes})}),!s.settings.enabled&&e.jsx("p",{className:"bw-empty-note",children:i("settings.bw.findings.offNote")})]}):w.map(b=>e.jsxs("div",{className:"bw-day",children:[e.jsx("h4",{className:"bw-sec-head",children:b.label}),b.episodes.map(c=>{const u=D(c),g=l===u;return e.jsxs("div",{className:`bw-ep${g?" open":""}`,children:[e.jsxs("div",{className:"bw-ep-row",children:[e.jsxs("button",{className:"bw-ep-head",ref:p=>{p?o.current.set(u,p):o.current.delete(u)},onClick:()=>d(g?null:u),"aria-expanded":g,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:g?"▾":"▸"}),e.jsx("span",{className:"bw-ep-host",children:c.host}),e.jsxs("span",{className:"bw-ep-meta",children:[ue(c),_(c,i)&&e.jsxs(e.Fragment,{children:[" · ",_(c,i)]}),c.provisional&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("span",{title:i("settings.bw.findings.provisionalTip"),children:i("settings.bw.findings.provisional")})]})]}),e.jsx("span",{className:"bw-ep-count",children:i("settings.bw.findings.pages",{count:c.count})})]}),e.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>r(c),"aria-label":i("settings.bw.findings.dismissHost",{host:c.host}),title:i("settings.bw.findings.dismissTip"),children:"×"})]}),g&&e.jsx("ul",{className:"bw-urls",children:c.urls.map((p,f)=>e.jsxs("li",{children:[e.jsx("span",{className:"bw-url-time",children:new Date(p.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),e.jsx("span",{className:"bw-url",children:p.url})]},`${p.url}-${p.timeMs}-${f}`))})]},u)})]},b.label))})]})}function fe(s){const a=/^#?([0-9a-f]{6})$/i.exec((s??"").trim());if(!a)return!1;const t=parseInt(a[1],16),i=[t>>16&255,t>>8&255,t&255].map(l=>{const d=l/255;return d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4)});return .2126*i[0]+.7152*i[1]+.0722*i[2]>.5}const z=1e4,xe=12e3;function pe({browsers:s,findings:a,watching:t,palette:i}){const l=P(),d=h.useRef(null),o=h.useRef(null);return o.current={browsers:s,findings:a,watching:t},h.useEffect(()=>{var g;const n=d.current;if(!n)return;const r=n.getContext("2d");if(!r)return;const w=((g=window.matchMedia)==null?void 0:g.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let b=0,c=!1;const u=()=>{var J;if(c)return;const p=o.current;if(!p)return;const{browsers:f,findings:W,watching:T}=p,m=i["--accent"]||"#7dd3fc",y=i["--line"]||"#1f2229",B=i["--text-dim"]||"#6e727c",k=fe(i["--bg"]),v=k?42:26,F=k?.85:.65,R=Date.now(),C=Math.min(window.devicePixelRatio||1,2),S=n.clientWidth,$=n.clientHeight;(n.width!==S*C||n.height!==$*C)&&(n.width=S*C,n.height=$*C),r.setTransform(C,0,0,C,0,0),r.clearRect(0,0,S,$);const x=S/2,N=$/2,M=Math.min(S,$)/2-6;r.strokeStyle=y,r.lineWidth=1,r.globalAlpha=k?1:.9;for(const j of[.4,.7,1])r.beginPath(),r.arc(x,N,M*j,0,Math.PI*2),r.stroke();r.beginPath(),r.moveTo(x-M,N),r.lineTo(x+M,N),r.moveTo(x,N-M),r.lineTo(x,N+M),r.stroke(),r.globalAlpha=1;const A=(T&&!w?R%z/z:0)*Math.PI*2-Math.PI/2;if(T){const j=(J=r.createConicGradient)==null?void 0:J.call(r,A-.85,x,N);j&&(j.addColorStop(0,"transparent"),j.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${m} ${v}%, transparent)`),j.addColorStop(1,"transparent"),r.fillStyle=j,r.beginPath(),r.moveTo(x,N),r.arc(x,N,M,A-.85,A),r.closePath(),r.fill()),r.strokeStyle=m,r.globalAlpha=F,r.beginPath(),r.moveTo(x,N),r.lineTo(x+Math.cos(A)*M,N+Math.sin(A)*M),r.stroke(),r.globalAlpha=1}f.forEach((j,E)=>{const O=E/Math.max(f.length,1)*Math.PI*2-Math.PI/2,q=j.lastReadMs===null?1:Math.min(1,(R-j.lastReadMs)/12e4),L=M*(.42+q*.5),G=x+Math.cos(O)*L,K=N+Math.sin(O)*L,Y=Math.abs((A-O+Math.PI*3)%(Math.PI*2)-Math.PI),Q=T?Math.max(0,1-Y/.55):0;r.beginPath(),r.arc(G,K,3+Q*1.6,0,Math.PI*2),r.fillStyle=j.running?m:B,r.globalAlpha=j.running?.55+Q*.45:.35,r.fill(),r.globalAlpha=1});for(const j of W){const E=(R-j.atMs)/xe;if(E<0||E>1)continue;const q=Math.max(0,f.findIndex(K=>K.key===j.browser))/Math.max(f.length,1)*Math.PI*2-Math.PI/2,L=x+Math.cos(q)*M*.6,G=N+Math.sin(q)*M*.6;r.beginPath(),r.arc(L,G,4+E*22,0,Math.PI*2),r.strokeStyle=m,r.globalAlpha=(1-E)*.8,r.lineWidth=1.5,r.stroke(),r.globalAlpha=1}b=requestAnimationFrame(u)};return u(),()=>{c=!0,cancelAnimationFrame(b)}},[i]),e.jsx("canvas",{ref:d,className:"bw-radar",role:"img","aria-label":t?l("radar.watch.watching",{count:s.length}):l("radar.watch.idle")})}function je(s,a,t){if(s===null)return null;const i=s+a-t;return i>0?i:null}function Ne(s){const a=Math.ceil(s/1e3),t=Math.floor(a/60),i=a%60;return t>0?`${t}m ${i}s`:`${i}s`}function X(s){return(s??[]).filter(a=>a.installed&&a.profiles>0)}function ve(s,a=I){return!Number.isFinite(s)||s<=0?a("settings.bw.logEmpty"):se(s)}function ye(s,a){return s.map(t=>({key:t.key,name:t.name,running:t.running,visits:a.filter(i=>i.browser===t.key).reduce((i,l)=>i+l.programVisits,0)}))}function ke(s,a,t=I){if(s===null)return null;const i=Math.max(0,Math.round((a-s)/1e3));if(i<5)return t("settings.bw.ago.now");if(i<60)return t("settings.bw.ago.sec",{n:i});const l=Math.round(i/60);return l<60?t("settings.bw.ago.min",{n:l}):t("settings.bw.ago.hr",{n:Math.round(l/60)})}function Me(s,a=I){const t=s.profiles.filter(l=>l.degraded);if(t.length>0){const l=t[0],d=t.length-1;return{kind:"unreadable",text:a(d>0?"settings.bw.trouble.unreadableMore":"settings.bw.trouble.unreadable",{browser:l.name,profile:l.profile,reason:l.reason??a("settings.bw.trouble.noReason"),more:d})}}const i=X(s.browsers);return i.length===0?{kind:"no-profiles",text:a("settings.bw.trouble.noProfiles")}:i.some(l=>l.running)?null:{kind:"none-running",text:a("settings.bw.trouble.noneRunning")}}function Se({snap:s,watching:a,palette:t}){const i=P(),[l,d]=h.useState(!1),[o,n]=h.useState(()=>Date.now());h.useEffect(()=>{const w=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(w)},[]);const r=je(s.coverage.lastHumanMs,s.coverage.quietMs,o);return e.jsxs("section",{className:"bw-sec",children:[e.jsxs("h4",{className:"bw-sec-head",children:[i("settings.bw.overview"),e.jsx("button",{className:"bw-help",onClick:()=>d(w=>!w),"aria-expanded":l,"aria-label":i("settings.bw.overview.help"),children:"?"})]}),e.jsxs("div",{className:"bw-glance",children:[e.jsx(pe,{browsers:a.map(w=>{var b;return{key:w.key,name:w.name,running:w.running,lastReadMs:((b=s.profiles.find(c=>c.browser===w.key))==null?void 0:b.lastWrittenMs)??null}}),findings:s.episodes.slice(0,6).map(w=>({browser:w.browser??null,atMs:w.endMs})),watching:s.settings.enabled,palette:t}),e.jsx("ul",{className:"bw-counts",children:ye(a,s.profiles).map(w=>e.jsxs("li",{children:[e.jsx("span",{className:"bw-count-n",children:te(w.visits,0)}),e.jsx("span",{className:"bw-count-of",children:w.name})]},w.key))})]}),e.jsx("p",{className:"bw-since",children:i("settings.bw.overview.since")}),s.coverage.checkedMs>0&&e.jsxs("p",{className:"bw-since",children:[i("settings.bw.overview.checked",{ago:ke(s.coverage.checkedMs,o,i)??""}),s.coverage.checks>0&&e.jsxs(e.Fragment,{children:[" · ",i("settings.bw.overview.checks",{count:s.coverage.checks})]})]}),r!==null&&e.jsx("p",{className:"bw-gate",children:i("settings.bw.overview.gate",{time:Ne(r)})}),l&&e.jsxs("dl",{className:"bw-key",children:[e.jsx("dt",{children:i("settings.bw.key.sweep")}),e.jsx("dd",{children:i("settings.bw.key.sweepText")}),e.jsx("dt",{children:i("settings.bw.key.dot")}),e.jsx("dd",{children:i("settings.bw.key.dotText")}),e.jsx("dt",{children:i("settings.bw.key.ring")}),e.jsx("dd",{children:i("settings.bw.key.ringText")})]})]})}function Pe({watching:s,rest:a}){const t=P(),[i,l]=h.useState(!1),[d,o]=h.useState(!1);return e.jsxs("section",{className:"bw-sec",children:[e.jsxs("h4",{className:"bw-sec-head",children:[t("settings.bw.profiles"),e.jsx("button",{className:"bw-help",onClick:()=>l(n=>!n),"aria-expanded":i,"aria-label":t("settings.bw.profiles.help"),children:"?"})]}),i&&e.jsxs("dl",{className:"bw-key",children:[e.jsx("dt",{children:t("settings.bw.key.running")}),e.jsx("dd",{children:t("settings.bw.key.runningText")}),e.jsx("dt",{children:t("settings.bw.key.connected")}),e.jsx("dd",{children:t("settings.bw.key.connectedText")})]}),e.jsx("ul",{className:"bw-profiles",children:s.map(n=>e.jsxs("li",{children:[e.jsx("span",{className:`bw-prof-dot${n.running?" on":""}`,"aria-hidden":!0}),e.jsx("span",{className:"bw-prof-name",children:n.name}),e.jsx("span",{className:"bw-prof-state",children:n.running?t("settings.bw.running"):t("settings.bw.idle")}),n.running&&n.relay.state==="live"&&e.jsx("span",{className:"bw-relay",children:t("settings.bw.relay")})]},n.key))}),a.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>o(n=>!n),"aria-expanded":d,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:d?"▾":"▸"})," ",t("settings.bw.notWatched",{count:a.length})]}),d&&e.jsx("p",{className:"bw-rest",children:t("settings.bw.notWatchedText",{names:a.map(n=>n.name).join(", ")})})]})]})}function Te({snap:s,quiet:a,setQuiet:t,save:i,access:l,setAccess:d}){const o=P();return e.jsxs("div",{className:"bw-settings",children:[e.jsxs("label",{title:o("settings.bw.quiet.tip"),children:[e.jsx("span",{children:o("settings.bw.quiet.label")}),e.jsx("select",{value:a??s.settings.quietMinutes,onChange:n=>{t(Number(n.target.value)),i({quietMinutes:Number(n.target.value)})},children:[1,5,15,30,60].map(n=>e.jsx("option",{value:n,children:o("settings.bw.minutes",{n})},n))})]}),e.jsxs("label",{children:[e.jsx("span",{children:o("settings.bw.reaction.label")}),e.jsx("select",{value:s.settings.reaction,onChange:n=>void i({reaction:n.target.value}),disabled:!s.settings.enabled,title:s.settings.enabled?o("settings.bw.reaction.hintOn"):o("settings.bw.reaction.hintOff"),children:(s.reactions??["notify"]).map(n=>e.jsx("option",{value:n,children:o(n==="notify"?"settings.bw.reaction.notify":n==="close-tab"?"settings.bw.reaction.closeTab":"settings.bw.reaction.quit")},n))})]}),e.jsxs("div",{className:"bw-settings-note",children:[e.jsxs("p",{children:[o("settings.bw.note.chrome")," ",e.jsx("strong",{children:o("settings.bw.note.usually")})]}),e.jsxs("button",{className:"bw-why",onClick:()=>d(n=>!n),"aria-expanded":l,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:l?"▾":"▸"})," ",o("settings.bw.access.toggle")]}),l&&e.jsxs("dl",{className:"bw-access",children:[e.jsx("dt",{children:o("settings.bw.access.reads")}),e.jsx("dd",{children:o("settings.bw.access.readsText",{when:new Date(s.coverage.startedMs).toLocaleString(V())})}),e.jsx("dt",{children:o("settings.bw.access.keeps")}),e.jsx("dd",{children:ne(o("settings.bw.access.keepsText",{path:"{path}",size:typeof s.coverage.logBytes=="number"?` (${ve(s.coverage.logBytes)})`:""}),{path:e.jsx("code",{className:"bw-path",children:s.coverage.logPath})})}),e.jsx("dt",{children:o("settings.bw.access.sends")}),e.jsx("dd",{children:o("settings.bw.access.sendsText")}),e.jsx("dt",{children:o("settings.bw.access.never")}),e.jsx("dd",{children:o("settings.bw.access.neverText")})]})]})]})}function Ce(s,a,t){return a?{kind:"saving",word:t("settings.bw.mode.saving")}:s.settings.enabled?{kind:"on",word:t("settings.bw.mode.watching")}:{kind:"off",word:t("settings.bw.mode.paused")}}function Re({snap:s,saving:a,save:t,why:i,setWhy:l}){const d=P(),o=Ce(s,a,d);return e.jsxs("footer",{className:"bw-status",children:[e.jsx("span",{className:`bw-mode-dot${s.settings.enabled?" on":""}`,"aria-hidden":!0}),e.jsx("span",{className:"bw-mode-word",children:o.word},o.kind),e.jsx("span",{className:"bw-status-text",children:s.coverage.archived===0?s.settings.enabled?d("settings.bw.disk.none"):d("settings.bw.disk.noneOff"):d("settings.bw.disk.some",{count:s.coverage.archived})}),e.jsx("button",{className:`glyph-btn bw-gear${i?" on":""}`,onClick:()=>l(n=>!n),"aria-expanded":i,"aria-label":d("settings.bw.settings"),title:d("settings.bw.settings"),children:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[e.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),e.jsx("path",{d:"M7 1.2v1.6M7 11.2v1.6M1.2 7h1.6M11.2 7h1.6M2.9 2.9l1.1 1.1M10 10l1.1 1.1M11.1 2.9L10 4M4 10l-1.1 1.1"})]})}),e.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[e.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:d("settings.bw.switch")}),e.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":s.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"switch",onClick:()=>void t({enabled:!s.settings.enabled}),title:s.settings.enabled?d("settings.bw.switch.on"):d("settings.bw.switch.off"),children:e.jsx("span",{className:"switch-knob"})})]})]})}function $e({relay:s}){const a=P(),[t,i]=h.useState(!1),[l,d]=h.useState(!1),o=s.killswitch.blocked?"unblock":"block",n=s.command[o],r=h.useCallback(async()=>{await ae(n.command)&&(d(!0),window.setTimeout(()=>d(!1),1600))},[n.command]),w=s.profiles.filter(c=>{var u;return(u=c.report)==null?void 0:u.present}),b=s.profiles.filter(c=>c.report===null);return e.jsxs("section",{className:"bw-sec",children:[e.jsx("h4",{className:"bw-sec-head",children:a("shell.remote.title")}),e.jsx("p",{className:`bw-rc-verdict ${s.verdict}`,role:"status",children:s.verdict==="exposed"?a("shell.remote.exposed"):s.verdict==="protected"?a("shell.remote.protected",{path:s.hostsPath}):a("shell.remote.nothing")}),s.killswitch.foreign.length>0&&e.jsxs("p",{className:"bw-rc-foreign",children:[a("shell.remote.foreign",{path:s.hostsPath}),s.killswitch.foreign.map(c=>e.jsx("code",{className:"bw-path",children:c},c))]}),e.jsxs("button",{className:"bw-why",onClick:()=>i(c=>!c),"aria-expanded":t,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:t?"▾":"▸"})," ",s.verdict==="protected"?a("shell.remote.undo"):a("shell.remote.reach")]}),t&&e.jsxs("div",{className:"bw-rc-body",children:[w.length>0&&e.jsx("dl",{className:"bw-key",children:w.map(c=>e.jsxs(h.Fragment,{children:[e.jsxs("dt",{children:[c.name,c.profile==="Default"?"":` · ${c.profile}`]}),e.jsxs("dd",{children:[a("shell.remote.detail",{state:c.report.enabled?a("shell.remote.enabled"):a("shell.remote.switchedOff"),scope:c.report.allUrls?a("shell.remote.allSites"):a("shell.remote.limited")}),c.report.sensitiveApis.length>0&&e.jsxs(e.Fragment,{children:[" — ",c.report.sensitiveApis.join(", ")]})]})]},`${c.browser}/${c.profile}`))}),b.length>0&&e.jsx("p",{className:"bw-rc-note",children:a("shell.remote.unreadable",{names:b.map(c=>c.name).join(", ")})}),!s.hostsRead&&e.jsx("p",{className:"bw-rc-note",children:a("shell.remote.hostsUnread",{path:s.hostsPath})}),w.some(c=>c.report.allUrls)&&e.jsx("p",{className:"bw-rc-note",children:ie(a("shell.remote.narrow"),"code",e.jsx("code",{className:"bw-path",children:"chrome://extensions"}))}),e.jsxs("div",{className:"bw-rc-cmd",children:[e.jsx("code",{children:n.command}),e.jsx("button",{className:"btn bw-rc-copy",onClick:r,children:a(l?"shell.copied":"shell.copy")})]}),e.jsx("p",{className:"bw-rc-note",children:n.note})]})]})}function Ie(s){const[a,t]=h.useState(null),[i,l]=h.useState(null),[d,o]=h.useState(null),[n,r]=h.useState(!1),w=h.useRef(!1),[b,c]=h.useState(null),[u,g]=h.useState(!1),p=h.useRef(!1),f=h.useCallback(async m=>{var y,B;if(!(m&&!re(w.current))){m&&(w.current=!0,r(!0));try{const k=await fetch(`/api/browser-watch${m?"?refresh=1":""}`);if(!k.ok)throw new U(I("settings.bw.deckAnswered",{status:k.status}));const v=await k.json();t(v),p.current||c(((y=v==null?void 0:v.settings)==null?void 0:y.quietMinutes)??15),s(((B=v==null?void 0:v.settings)==null?void 0:B.enabled)===!0),l(null)}catch(k){l(H(k,I("settings.bw.noAnswer")))}finally{m&&(w.current=!1,r(!1))}}},[s]);h.useEffect(()=>{f(!1)},[f]),h.useEffect(()=>{const m=setInterval(()=>{f(!1)},1e4);return()=>clearInterval(m)},[f]);const W=h.useCallback(async m=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:m.host,startMs:m.startMs})})}finally{await f(!1)}},[f]),T=h.useCallback(async m=>{p.current=!0,g(!0);try{const y=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(m)});if(!y.ok)throw new U(I("settings.bw.deckAnswered",{status:y.status}));await f(!1),o(null)}catch(y){o(H(y,I("settings.bw.noAnswer")))}finally{p.current=!1,g(!1)}},[f]);return{snap:a,error:i,writeError:d,setWriteError:o,busy:n,quiet:b,setQuiet:c,saving:u,load:f,dismiss:W,save:T}}function Ee({onClose:s,onSeen:a,onWatching:t,palette:i}){const l=P(),d=le(s),o=ce(s),{snap:n,error:r,writeError:w,setWriteError:b,busy:c,quiet:u,setQuiet:g,saving:p,load:f,dismiss:W,save:T}=Ie(t),[m,y]=h.useState(!1),[B,k]=h.useState(!1),v=h.useRef(null),F=h.useRef(a);F.current=a,h.useEffect(()=>()=>F.current(Date.now()),[]);const R=X(n==null?void 0:n.browsers),C=((n==null?void 0:n.browsers)??[]).filter(x=>!(x.installed&&x.profiles>0)),S=n?Me(n,l):null,$=R.reduce((x,N)=>x+N.profiles,0);return e.jsxs(oe,{scrim:o,dialogRef:d,className:"bw-modal",labelledBy:"bw-title",children:[e.jsxs("header",{className:"modal-head",children:[e.jsxs("div",{className:"modal-title",children:[e.jsx("span",{className:"modal-tool-name",id:"bw-title",children:l("settings.bw.title")}),e.jsx("span",{className:"modal-tool-id",children:n?l("settings.bw.scope.profiles",{count:$}):l("settings.bw.scope.localOnly")})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{ref:v,className:"glyph-btn",onClick:()=>void f(!0),...he(c),"aria-label":l("settings.bw.reread"),title:l("settings.bw.reread"),children:e.jsx(de,{})}),e.jsx(we,{onClick:s,label:l("settings.bw.close")})]})]}),e.jsxs("div",{className:"modal-body bw-body",children:[!n&&!r&&e.jsxs("div",{className:"bw-loading",children:[e.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),e.jsx("p",{children:l("settings.bw.loading")})]}),r&&e.jsx("div",{className:"bw-state",children:e.jsxs("div",{className:"bw-row err",children:[e.jsx("span",{className:"bw-dot","aria-hidden":!0}),e.jsx("span",{className:"bw-row-label",children:l("settings.bw.readFail")}),e.jsx("span",{className:"bw-row-detail",children:r})]})}),n&&S&&e.jsx("p",{className:`bw-trouble ${S.kind}`,role:"status",children:S.text}),n&&e.jsxs("div",{className:"bw-work",children:[e.jsxs("aside",{className:"bw-side",children:[e.jsx(Se,{snap:n,watching:R,palette:i}),e.jsx(Pe,{watching:R,rest:C}),n.relay&&e.jsx($e,{relay:n.relay})]}),e.jsxs("div",{className:"bw-main",children:[e.jsx(me,{snap:n,dismiss:W,refreshRef:v}),e.jsx(be,{snap:n})]})]}),n&&m&&e.jsx(Te,{snap:n,quiet:u,setQuiet:g,save:T,access:B,setAccess:k}),w&&e.jsx("div",{className:"bw-state bw-write-err",role:"alert",children:e.jsxs("div",{className:"bw-row err",children:[e.jsx("span",{className:"bw-dot","aria-hidden":!0}),e.jsx("span",{className:"bw-row-label",children:l("settings.bw.saveFail")}),e.jsx("span",{className:"bw-row-detail",children:l("settings.bw.saveFailDetail",{error:w})}),e.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>b(null),"aria-label":l("settings.bw.dismiss"),title:l("settings.bw.dismiss"),children:"×"})]})}),n&&e.jsx(Re,{snap:n,saving:p,save:T,why:m,setWhy:y})]})]})}export{Ee as default};
|
|
1
|
+
import{u as P,j as e,r as h,ak as Z,al as ee,g as V,t as I,am as se,h as te,an as ne,y as ae,ao as ie,s as re,ap as U,o as H,G as le,J as ce,Q as oe,R as de,k as he,aq as we}from"./app-ZMmmEHxF.js";function be({snap:s}){const a=P();return e.jsxs("section",{className:"bw-feed",children:[e.jsxs("h4",{className:"bw-sec-head bw-head-row",children:[a("settings.bw.feed"),e.jsx("span",{className:"bw-feed-count",children:a("settings.bw.feed.count",{count:s.log.length})})]}),e.jsx("p",{className:"bw-since bw-feed-note",children:a("settings.bw.feed.note")}),e.jsx("div",{className:"bw-log","aria-live":"polite","aria-relevant":"additions",children:s.log.length===0?e.jsx("p",{className:"bw-note",children:a("settings.bw.feed.empty")}):s.log.map(t=>e.jsxs("div",{className:`bw-log-line ${t.level}${t.parts?"":" sys"}`,children:[e.jsx("span",{className:"bw-log-time",children:new Date(t.atMs).toLocaleTimeString("en-GB",{hour12:!1})}),t.parts?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"bw-log-browser",children:t.parts.browser}),e.jsx("span",{className:"bw-log-profile",title:t.parts.profile,children:t.parts.profile}),e.jsxs("span",{className:"bw-log-value",children:[t.parts.value,t.parts.flagged>0&&e.jsx("span",{className:"bw-log-flag",children:a("settings.bw.feed.flagged",{count:t.parts.flagged})})]})]}):e.jsx("span",{className:"bw-log-sys",children:t.text})]},`${t.atMs}-${t.level}-${t.text}`))})]})}const D=s=>`${s.host}-${s.startMs}`;function ue(s){const a=t=>new Date(t).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1});return s.count===1||s.endMs-s.startMs<6e4?a(s.startMs):`${a(s.startMs)} → ${a(s.endMs)}`}function ge(s){return new Date(s).toLocaleDateString(V(),{weekday:"short",day:"numeric",month:"short"})}function _(s,a){const t=Math.round((s.endMs-s.startMs)/6e4);return t<1?"":a("settings.bw.findings.minutes",{n:t})}function me({snap:s,dismiss:a,refreshRef:t}){const i=P(),[l,d]=h.useState(null),o=h.useRef(new Map),n=h.useRef(null);h.useEffect(()=>{var c,u;const b=n.current;!b||s.episodes.some(g=>D(g)===b.id)||(n.current=null,Z(((c=document.activeElement)==null?void 0:c.tagName)??null)&&((u=(b.next?o.current.get(b.next):void 0)??t.current)==null||u.focus()))},[s]);const r=b=>{n.current={id:D(b),next:ee(s.episodes.map(D),D(b))},a(b)},w=h.useMemo(()=>{const b=[];for(const c of s.episodes){const u=ge(c.startMs),g=b[b.length-1];g&&g.label===u?g.episodes.push(c):b.push({label:u,episodes:[c]})}return b},[s]);return e.jsxs("section",{className:"bw-findings",children:[e.jsxs("h4",{className:"bw-sec-head bw-head-row",children:[i("settings.bw.findings"),s.episodes.length>0&&e.jsx("span",{className:"bw-feed-count",children:i("settings.bw.findings.count",{count:s.episodes.length})})]}),e.jsx("div",{className:"bw-eps",children:w.length===0?e.jsxs("div",{className:"bw-empty",children:[e.jsx("p",{className:"bw-empty-head",children:i("settings.bw.findings.none")}),e.jsx("p",{className:"bw-empty-note",children:i("settings.bw.findings.noneNote",{count:s.settings.quietMinutes})}),!s.settings.enabled&&e.jsx("p",{className:"bw-empty-note",children:i("settings.bw.findings.offNote")})]}):w.map(b=>e.jsxs("div",{className:"bw-day",children:[e.jsx("h4",{className:"bw-sec-head",children:b.label}),b.episodes.map(c=>{const u=D(c),g=l===u;return e.jsxs("div",{className:`bw-ep${g?" open":""}`,children:[e.jsxs("div",{className:"bw-ep-row",children:[e.jsxs("button",{className:"bw-ep-head",ref:p=>{p?o.current.set(u,p):o.current.delete(u)},onClick:()=>d(g?null:u),"aria-expanded":g,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:g?"▾":"▸"}),e.jsx("span",{className:"bw-ep-host",children:c.host}),e.jsxs("span",{className:"bw-ep-meta",children:[ue(c),_(c,i)&&e.jsxs(e.Fragment,{children:[" · ",_(c,i)]}),c.provisional&&e.jsxs(e.Fragment,{children:[" · ",e.jsx("span",{title:i("settings.bw.findings.provisionalTip"),children:i("settings.bw.findings.provisional")})]})]}),e.jsx("span",{className:"bw-ep-count",children:i("settings.bw.findings.pages",{count:c.count})})]}),e.jsx("button",{className:"glyph-btn bw-ep-x",onClick:()=>r(c),"aria-label":i("settings.bw.findings.dismissHost",{host:c.host}),title:i("settings.bw.findings.dismissTip"),children:"×"})]}),g&&e.jsx("ul",{className:"bw-urls",children:c.urls.map((p,f)=>e.jsxs("li",{children:[e.jsx("span",{className:"bw-url-time",children:new Date(p.timeMs).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",hour12:!1})}),e.jsx("span",{className:"bw-url",children:p.url})]},`${p.url}-${p.timeMs}-${f}`))})]},u)})]},b.label))})]})}function fe(s){const a=/^#?([0-9a-f]{6})$/i.exec((s??"").trim());if(!a)return!1;const t=parseInt(a[1],16),i=[t>>16&255,t>>8&255,t&255].map(l=>{const d=l/255;return d<=.03928?d/12.92:Math.pow((d+.055)/1.055,2.4)});return .2126*i[0]+.7152*i[1]+.0722*i[2]>.5}const z=1e4,xe=12e3;function pe({browsers:s,findings:a,watching:t,palette:i}){const l=P(),d=h.useRef(null),o=h.useRef(null);return o.current={browsers:s,findings:a,watching:t},h.useEffect(()=>{var g;const n=d.current;if(!n)return;const r=n.getContext("2d");if(!r)return;const w=((g=window.matchMedia)==null?void 0:g.call(window,"(prefers-reduced-motion: reduce)").matches)??!1;let b=0,c=!1;const u=()=>{var J;if(c)return;const p=o.current;if(!p)return;const{browsers:f,findings:W,watching:T}=p,m=i["--accent"]||"#7dd3fc",y=i["--line"]||"#1f2229",B=i["--text-dim"]||"#6e727c",k=fe(i["--bg"]),v=k?42:26,F=k?.85:.65,R=Date.now(),C=Math.min(window.devicePixelRatio||1,2),S=n.clientWidth,$=n.clientHeight;(n.width!==S*C||n.height!==$*C)&&(n.width=S*C,n.height=$*C),r.setTransform(C,0,0,C,0,0),r.clearRect(0,0,S,$);const x=S/2,N=$/2,M=Math.min(S,$)/2-6;r.strokeStyle=y,r.lineWidth=1,r.globalAlpha=k?1:.9;for(const j of[.4,.7,1])r.beginPath(),r.arc(x,N,M*j,0,Math.PI*2),r.stroke();r.beginPath(),r.moveTo(x-M,N),r.lineTo(x+M,N),r.moveTo(x,N-M),r.lineTo(x,N+M),r.stroke(),r.globalAlpha=1;const A=(T&&!w?R%z/z:0)*Math.PI*2-Math.PI/2;if(T){const j=(J=r.createConicGradient)==null?void 0:J.call(r,A-.85,x,N);j&&(j.addColorStop(0,"transparent"),j.addColorStop(.85/(Math.PI*2),`color-mix(in srgb, ${m} ${v}%, transparent)`),j.addColorStop(1,"transparent"),r.fillStyle=j,r.beginPath(),r.moveTo(x,N),r.arc(x,N,M,A-.85,A),r.closePath(),r.fill()),r.strokeStyle=m,r.globalAlpha=F,r.beginPath(),r.moveTo(x,N),r.lineTo(x+Math.cos(A)*M,N+Math.sin(A)*M),r.stroke(),r.globalAlpha=1}f.forEach((j,E)=>{const O=E/Math.max(f.length,1)*Math.PI*2-Math.PI/2,q=j.lastReadMs===null?1:Math.min(1,(R-j.lastReadMs)/12e4),L=M*(.42+q*.5),G=x+Math.cos(O)*L,K=N+Math.sin(O)*L,Y=Math.abs((A-O+Math.PI*3)%(Math.PI*2)-Math.PI),Q=T?Math.max(0,1-Y/.55):0;r.beginPath(),r.arc(G,K,3+Q*1.6,0,Math.PI*2),r.fillStyle=j.running?m:B,r.globalAlpha=j.running?.55+Q*.45:.35,r.fill(),r.globalAlpha=1});for(const j of W){const E=(R-j.atMs)/xe;if(E<0||E>1)continue;const q=Math.max(0,f.findIndex(K=>K.key===j.browser))/Math.max(f.length,1)*Math.PI*2-Math.PI/2,L=x+Math.cos(q)*M*.6,G=N+Math.sin(q)*M*.6;r.beginPath(),r.arc(L,G,4+E*22,0,Math.PI*2),r.strokeStyle=m,r.globalAlpha=(1-E)*.8,r.lineWidth=1.5,r.stroke(),r.globalAlpha=1}b=requestAnimationFrame(u)};return u(),()=>{c=!0,cancelAnimationFrame(b)}},[i]),e.jsx("canvas",{ref:d,className:"bw-radar",role:"img","aria-label":t?l("radar.watch.watching",{count:s.length}):l("radar.watch.idle")})}function je(s,a,t){if(s===null)return null;const i=s+a-t;return i>0?i:null}function Ne(s){const a=Math.ceil(s/1e3),t=Math.floor(a/60),i=a%60;return t>0?`${t}m ${i}s`:`${i}s`}function X(s){return(s??[]).filter(a=>a.installed&&a.profiles>0)}function ve(s,a=I){return!Number.isFinite(s)||s<=0?a("settings.bw.logEmpty"):se(s)}function ye(s,a){return s.map(t=>({key:t.key,name:t.name,running:t.running,visits:a.filter(i=>i.browser===t.key).reduce((i,l)=>i+l.programVisits,0)}))}function ke(s,a,t=I){if(s===null)return null;const i=Math.max(0,Math.round((a-s)/1e3));if(i<5)return t("settings.bw.ago.now");if(i<60)return t("settings.bw.ago.sec",{n:i});const l=Math.round(i/60);return l<60?t("settings.bw.ago.min",{n:l}):t("settings.bw.ago.hr",{n:Math.round(l/60)})}function Me(s,a=I){const t=s.profiles.filter(l=>l.degraded);if(t.length>0){const l=t[0],d=t.length-1;return{kind:"unreadable",text:a(d>0?"settings.bw.trouble.unreadableMore":"settings.bw.trouble.unreadable",{browser:l.name,profile:l.profile,reason:l.reason??a("settings.bw.trouble.noReason"),more:d})}}const i=X(s.browsers);return i.length===0?{kind:"no-profiles",text:a("settings.bw.trouble.noProfiles")}:i.some(l=>l.running)?null:{kind:"none-running",text:a("settings.bw.trouble.noneRunning")}}function Se({snap:s,watching:a,palette:t}){const i=P(),[l,d]=h.useState(!1),[o,n]=h.useState(()=>Date.now());h.useEffect(()=>{const w=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(w)},[]);const r=je(s.coverage.lastHumanMs,s.coverage.quietMs,o);return e.jsxs("section",{className:"bw-sec",children:[e.jsxs("h4",{className:"bw-sec-head",children:[i("settings.bw.overview"),e.jsx("button",{className:"bw-help",onClick:()=>d(w=>!w),"aria-expanded":l,"aria-label":i("settings.bw.overview.help"),children:"?"})]}),e.jsxs("div",{className:"bw-glance",children:[e.jsx(pe,{browsers:a.map(w=>{var b;return{key:w.key,name:w.name,running:w.running,lastReadMs:((b=s.profiles.find(c=>c.browser===w.key))==null?void 0:b.lastWrittenMs)??null}}),findings:s.episodes.slice(0,6).map(w=>({browser:w.browser??null,atMs:w.endMs})),watching:s.settings.enabled,palette:t}),e.jsx("ul",{className:"bw-counts",children:ye(a,s.profiles).map(w=>e.jsxs("li",{children:[e.jsx("span",{className:"bw-count-n",children:te(w.visits,0)}),e.jsx("span",{className:"bw-count-of",children:w.name})]},w.key))})]}),e.jsx("p",{className:"bw-since",children:i("settings.bw.overview.since")}),s.coverage.checkedMs>0&&e.jsxs("p",{className:"bw-since",children:[i("settings.bw.overview.checked",{ago:ke(s.coverage.checkedMs,o,i)??""}),s.coverage.checks>0&&e.jsxs(e.Fragment,{children:[" · ",i("settings.bw.overview.checks",{count:s.coverage.checks})]})]}),r!==null&&e.jsx("p",{className:"bw-gate",children:i("settings.bw.overview.gate",{time:Ne(r)})}),l&&e.jsxs("dl",{className:"bw-key",children:[e.jsx("dt",{children:i("settings.bw.key.sweep")}),e.jsx("dd",{children:i("settings.bw.key.sweepText")}),e.jsx("dt",{children:i("settings.bw.key.dot")}),e.jsx("dd",{children:i("settings.bw.key.dotText")}),e.jsx("dt",{children:i("settings.bw.key.ring")}),e.jsx("dd",{children:i("settings.bw.key.ringText")})]})]})}function Pe({watching:s,rest:a}){const t=P(),[i,l]=h.useState(!1),[d,o]=h.useState(!1);return e.jsxs("section",{className:"bw-sec",children:[e.jsxs("h4",{className:"bw-sec-head",children:[t("settings.bw.profiles"),e.jsx("button",{className:"bw-help",onClick:()=>l(n=>!n),"aria-expanded":i,"aria-label":t("settings.bw.profiles.help"),children:"?"})]}),i&&e.jsxs("dl",{className:"bw-key",children:[e.jsx("dt",{children:t("settings.bw.key.running")}),e.jsx("dd",{children:t("settings.bw.key.runningText")}),e.jsx("dt",{children:t("settings.bw.key.connected")}),e.jsx("dd",{children:t("settings.bw.key.connectedText")})]}),e.jsx("ul",{className:"bw-profiles",children:s.map(n=>e.jsxs("li",{children:[e.jsx("span",{className:`bw-prof-dot${n.running?" on":""}`,"aria-hidden":!0}),e.jsx("span",{className:"bw-prof-name",children:n.name}),e.jsx("span",{className:"bw-prof-state",children:n.running?t("settings.bw.running"):t("settings.bw.idle")}),n.running&&n.relay.state==="live"&&e.jsx("span",{className:"bw-relay",children:t("settings.bw.relay")})]},n.key))}),a.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"bw-why bw-rest-head",onClick:()=>o(n=>!n),"aria-expanded":d,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:d?"▾":"▸"})," ",t("settings.bw.notWatched",{count:a.length})]}),d&&e.jsx("p",{className:"bw-rest",children:t("settings.bw.notWatchedText",{names:a.map(n=>n.name).join(", ")})})]})]})}function Te({snap:s,quiet:a,setQuiet:t,save:i,access:l,setAccess:d}){const o=P();return e.jsxs("div",{className:"bw-settings",children:[e.jsxs("label",{title:o("settings.bw.quiet.tip"),children:[e.jsx("span",{children:o("settings.bw.quiet.label")}),e.jsx("select",{value:a??s.settings.quietMinutes,onChange:n=>{t(Number(n.target.value)),i({quietMinutes:Number(n.target.value)})},children:[1,5,15,30,60].map(n=>e.jsx("option",{value:n,children:o("settings.bw.minutes",{n})},n))})]}),e.jsxs("label",{children:[e.jsx("span",{children:o("settings.bw.reaction.label")}),e.jsx("select",{value:s.settings.reaction,onChange:n=>void i({reaction:n.target.value}),disabled:!s.settings.enabled,title:s.settings.enabled?o("settings.bw.reaction.hintOn"):o("settings.bw.reaction.hintOff"),children:(s.reactions??["notify"]).map(n=>e.jsx("option",{value:n,children:o(n==="notify"?"settings.bw.reaction.notify":n==="close-tab"?"settings.bw.reaction.closeTab":"settings.bw.reaction.quit")},n))})]}),e.jsxs("div",{className:"bw-settings-note",children:[e.jsxs("p",{children:[o("settings.bw.note.chrome")," ",e.jsx("strong",{children:o("settings.bw.note.usually")})]}),e.jsxs("button",{className:"bw-why",onClick:()=>d(n=>!n),"aria-expanded":l,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:l?"▾":"▸"})," ",o("settings.bw.access.toggle")]}),l&&e.jsxs("dl",{className:"bw-access",children:[e.jsx("dt",{children:o("settings.bw.access.reads")}),e.jsx("dd",{children:o("settings.bw.access.readsText",{when:new Date(s.coverage.startedMs).toLocaleString(V())})}),e.jsx("dt",{children:o("settings.bw.access.keeps")}),e.jsx("dd",{children:ne(o("settings.bw.access.keepsText",{path:"{path}",size:typeof s.coverage.logBytes=="number"?` (${ve(s.coverage.logBytes)})`:""}),{path:e.jsx("code",{className:"bw-path",children:s.coverage.logPath})})}),e.jsx("dt",{children:o("settings.bw.access.sends")}),e.jsx("dd",{children:o("settings.bw.access.sendsText")}),e.jsx("dt",{children:o("settings.bw.access.never")}),e.jsx("dd",{children:o("settings.bw.access.neverText")})]})]})]})}function Ce(s,a,t){return a?{kind:"saving",word:t("settings.bw.mode.saving")}:s.settings.enabled?{kind:"on",word:t("settings.bw.mode.watching")}:{kind:"off",word:t("settings.bw.mode.paused")}}function Re({snap:s,saving:a,save:t,why:i,setWhy:l}){const d=P(),o=Ce(s,a,d);return e.jsxs("footer",{className:"bw-status",children:[e.jsx("span",{className:`bw-mode-dot${s.settings.enabled?" on":""}`,"aria-hidden":!0}),e.jsx("span",{className:"bw-mode-word",children:o.word},o.kind),e.jsx("span",{className:"bw-status-text",children:s.coverage.archived===0?s.settings.enabled?d("settings.bw.disk.none"):d("settings.bw.disk.noneOff"):d("settings.bw.disk.some",{count:s.coverage.archived})}),e.jsx("button",{className:`glyph-btn bw-gear${i?" on":""}`,onClick:()=>l(n=>!n),"aria-expanded":i,"aria-label":d("settings.bw.settings"),title:d("settings.bw.settings"),children:e.jsxs("svg",{width:"13",height:"13",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.3","aria-hidden":!0,children:[e.jsx("circle",{cx:"7",cy:"7",r:"2.1"}),e.jsx("path",{d:"M7 1.2v1.6M7 11.2v1.6M1.2 7h1.6M11.2 7h1.6M2.9 2.9l1.1 1.1M10 10l1.1 1.1M11.1 2.9L10 4M4 10l-1.1 1.1"})]})}),e.jsxs("label",{className:"bw-switch",htmlFor:"bw-enabled",children:[e.jsx("span",{className:"bw-switch-label",id:"bw-enabled-label",children:d("settings.bw.switch")}),e.jsx("button",{id:"bw-enabled",type:"button",role:"switch","aria-checked":s.settings.enabled,"aria-labelledby":"bw-enabled-label",className:"switch",onClick:()=>void t({enabled:!s.settings.enabled}),title:s.settings.enabled?d("settings.bw.switch.on"):d("settings.bw.switch.off"),children:e.jsx("span",{className:"switch-knob"})})]})]})}function $e({relay:s}){const a=P(),[t,i]=h.useState(!1),[l,d]=h.useState(!1),o=s.killswitch.blocked?"unblock":"block",n=s.command[o],r=h.useCallback(async()=>{await ae(n.command)&&(d(!0),window.setTimeout(()=>d(!1),1600))},[n.command]),w=s.profiles.filter(c=>{var u;return(u=c.report)==null?void 0:u.present}),b=s.profiles.filter(c=>c.report===null);return e.jsxs("section",{className:"bw-sec",children:[e.jsx("h4",{className:"bw-sec-head",children:a("shell.remote.title")}),e.jsx("p",{className:`bw-rc-verdict ${s.verdict}`,role:"status",children:s.verdict==="exposed"?a("shell.remote.exposed"):s.verdict==="protected"?a("shell.remote.protected",{path:s.hostsPath}):a("shell.remote.nothing")}),s.killswitch.foreign.length>0&&e.jsxs("p",{className:"bw-rc-foreign",children:[a("shell.remote.foreign",{path:s.hostsPath}),s.killswitch.foreign.map(c=>e.jsx("code",{className:"bw-path",children:c},c))]}),e.jsxs("button",{className:"bw-why",onClick:()=>i(c=>!c),"aria-expanded":t,children:[e.jsx("span",{className:"bw-chev","aria-hidden":!0,children:t?"▾":"▸"})," ",s.verdict==="protected"?a("shell.remote.undo"):a("shell.remote.reach")]}),t&&e.jsxs("div",{className:"bw-rc-body",children:[w.length>0&&e.jsx("dl",{className:"bw-key",children:w.map(c=>e.jsxs(h.Fragment,{children:[e.jsxs("dt",{children:[c.name,c.profile==="Default"?"":` · ${c.profile}`]}),e.jsxs("dd",{children:[a("shell.remote.detail",{state:c.report.enabled?a("shell.remote.enabled"):a("shell.remote.switchedOff"),scope:c.report.allUrls?a("shell.remote.allSites"):a("shell.remote.limited")}),c.report.sensitiveApis.length>0&&e.jsxs(e.Fragment,{children:[" — ",c.report.sensitiveApis.join(", ")]})]})]},`${c.browser}/${c.profile}`))}),b.length>0&&e.jsx("p",{className:"bw-rc-note",children:a("shell.remote.unreadable",{names:b.map(c=>c.name).join(", ")})}),!s.hostsRead&&e.jsx("p",{className:"bw-rc-note",children:a("shell.remote.hostsUnread",{path:s.hostsPath})}),w.some(c=>c.report.allUrls)&&e.jsx("p",{className:"bw-rc-note",children:ie(a("shell.remote.narrow"),"code",e.jsx("code",{className:"bw-path",children:"chrome://extensions"}))}),e.jsxs("div",{className:"bw-rc-cmd",children:[e.jsx("code",{children:n.command}),e.jsx("button",{className:"btn bw-rc-copy",onClick:r,children:a(l?"shell.copied":"shell.copy")})]}),e.jsx("p",{className:"bw-rc-note",children:n.note})]})]})}function Ie(s){const[a,t]=h.useState(null),[i,l]=h.useState(null),[d,o]=h.useState(null),[n,r]=h.useState(!1),w=h.useRef(!1),[b,c]=h.useState(null),[u,g]=h.useState(!1),p=h.useRef(!1),f=h.useCallback(async m=>{var y,B;if(!(m&&!re(w.current))){m&&(w.current=!0,r(!0));try{const k=await fetch(`/api/browser-watch${m?"?refresh=1":""}`);if(!k.ok)throw new U(I("settings.bw.deckAnswered",{status:k.status}));const v=await k.json();t(v),p.current||c(((y=v==null?void 0:v.settings)==null?void 0:y.quietMinutes)??15),s(((B=v==null?void 0:v.settings)==null?void 0:B.enabled)===!0),l(null)}catch(k){l(H(k,I("settings.bw.noAnswer")))}finally{m&&(w.current=!1,r(!1))}}},[s]);h.useEffect(()=>{f(!1)},[f]),h.useEffect(()=>{const m=setInterval(()=>{f(!1)},1e4);return()=>clearInterval(m)},[f]);const W=h.useCallback(async m=>{try{await fetch("/api/browser-watch/dismiss",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({host:m.host,startMs:m.startMs})})}finally{await f(!1)}},[f]),T=h.useCallback(async m=>{p.current=!0,g(!0);try{const y=await fetch("/api/browser-watch",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(m)});if(!y.ok)throw new U(I("settings.bw.deckAnswered",{status:y.status}));await f(!1),o(null)}catch(y){o(H(y,I("settings.bw.noAnswer")))}finally{p.current=!1,g(!1)}},[f]);return{snap:a,error:i,writeError:d,setWriteError:o,busy:n,quiet:b,setQuiet:c,saving:u,load:f,dismiss:W,save:T}}function Ee({onClose:s,onSeen:a,onWatching:t,palette:i}){const l=P(),d=le(s),o=ce(s),{snap:n,error:r,writeError:w,setWriteError:b,busy:c,quiet:u,setQuiet:g,saving:p,load:f,dismiss:W,save:T}=Ie(t),[m,y]=h.useState(!1),[B,k]=h.useState(!1),v=h.useRef(null),F=h.useRef(a);F.current=a,h.useEffect(()=>()=>F.current(Date.now()),[]);const R=X(n==null?void 0:n.browsers),C=((n==null?void 0:n.browsers)??[]).filter(x=>!(x.installed&&x.profiles>0)),S=n?Me(n,l):null,$=R.reduce((x,N)=>x+N.profiles,0);return e.jsxs(oe,{scrim:o,dialogRef:d,className:"bw-modal",labelledBy:"bw-title",children:[e.jsxs("header",{className:"modal-head",children:[e.jsxs("div",{className:"modal-title",children:[e.jsx("span",{className:"modal-tool-name",id:"bw-title",children:l("settings.bw.title")}),e.jsx("span",{className:"modal-tool-id",children:n?l("settings.bw.scope.profiles",{count:$}):l("settings.bw.scope.localOnly")})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{ref:v,className:"glyph-btn",onClick:()=>void f(!0),...he(c),"aria-label":l("settings.bw.reread"),title:l("settings.bw.reread"),children:e.jsx(de,{})}),e.jsx(we,{onClick:s,label:l("settings.bw.close")})]})]}),e.jsxs("div",{className:"modal-body bw-body",children:[!n&&!r&&e.jsxs("div",{className:"bw-loading",children:[e.jsx("span",{className:"bw-loading-bar","aria-hidden":!0}),e.jsx("p",{children:l("settings.bw.loading")})]}),r&&e.jsx("div",{className:"bw-state",children:e.jsxs("div",{className:"bw-row err",children:[e.jsx("span",{className:"bw-dot","aria-hidden":!0}),e.jsx("span",{className:"bw-row-label",children:l("settings.bw.readFail")}),e.jsx("span",{className:"bw-row-detail",children:r})]})}),n&&S&&e.jsx("p",{className:`bw-trouble ${S.kind}`,role:"status",children:S.text}),n&&e.jsxs("div",{className:"bw-work",children:[e.jsxs("aside",{className:"bw-side",children:[e.jsx(Se,{snap:n,watching:R,palette:i}),e.jsx(Pe,{watching:R,rest:C}),n.relay&&e.jsx($e,{relay:n.relay})]}),e.jsxs("div",{className:"bw-main",children:[e.jsx(me,{snap:n,dismiss:W,refreshRef:v}),e.jsx(be,{snap:n})]})]}),n&&m&&e.jsx(Te,{snap:n,quiet:u,setQuiet:g,save:T,access:B,setAccess:k}),w&&e.jsx("div",{className:"bw-state bw-write-err",role:"alert",children:e.jsxs("div",{className:"bw-row err",children:[e.jsx("span",{className:"bw-dot","aria-hidden":!0}),e.jsx("span",{className:"bw-row-label",children:l("settings.bw.saveFail")}),e.jsx("span",{className:"bw-row-detail",children:l("settings.bw.saveFailDetail",{error:w})}),e.jsx("button",{className:"glyph-btn bw-write-err-x",onClick:()=>b(null),"aria-label":l("settings.bw.dismiss"),title:l("settings.bw.dismiss"),children:"×"})]})}),n&&e.jsx(Re,{snap:n,saving:p,save:T,why:m,setWhy:y})]})]})}export{Ee as default};
|
package/dist/web/assets/{FeedbackConversations-BJjgXI0-.js → FeedbackConversations-BgVk0nkA.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as S,g as ue,r as c,s as de,c1 as fe,u as $,j as l,k as V,c2 as me,c3 as he}from"./app-40gNTTfq.js";import{o as Z}from"./use-account-BUmI-A8e.js";const _=e=>!!e&&typeof e=="object"&&!Array.isArray(e),f=e=>typeof e=="string",R=e=>Number.isInteger(e)&&e>=0,v=e=>e==="user"||e==="team";function ee(e){return!_(e)||!f(e.code)||!f(e.label)?null:{code:e.code,label:e.label,fixedIn:f(e.fixedIn)?e.fixedIn:null,reason:f(e.reason)?e.reason:null,released:e.released===!0}}function te(e){return _(e)&&R(e.number)&&f(e.url)?{number:e.number,url:e.url}:null}function w(e){if(!_(e)||!f(e.id)||!f(e.title)||!f(e.createdAt)||!f(e.lastActivityAt))return null;const t=ee(e.status),s=_(e.preview)&&v(e.preview.side)&&f(e.preview.text)?{side:e.preview.side,text:e.preview.text}:null;return!t||!s||!R(e.lastSeq)||!R(e.readSeq)?null:{id:e.id,kind:f(e.kind)?e.kind:"other",title:e.title,status:t,createdAt:e.createdAt,lastActivityAt:e.lastActivityAt,lastSeq:e.lastSeq,readSeq:e.readSeq,hasUnread:e.hasUnread===!0,preview:s,trackedIssue:te(e.trackedIssue),images:R(e.images)?e.images:0,webUrl:f(e.webUrl)?e.webUrl:""}}function se(e){if(!_(e)||!R(e.seq)||!f(e.at)||!f(e.type)||!v(e.side)||!f(e.text))return null;const t={seq:e.seq,at:e.at,type:e.type,side:e.side,text:e.text};f(e.via)&&(t.via=e.via),f(e.signature)&&(t.signature=e.signature);const s=ee(e.status);s&&(t.status=s);const n=te(e.issue);return n&&(t.issue=n),f(e.version)&&(t.version=e.version),Array.isArray(e.images)&&(t.images=e.images.filter(r=>_(r)&&f(r.id)&&f(r.type)&&R(r.width)&&R(r.height)&&R(r.bytes))),t}const pe=e=>Array.isArray(e)?e.map(se).filter(t=>t!==null):[];function K(e){if(!_(e))return null;const t=w(e.thread);return t?{thread:t,items:pe(e.items).sort((s,n)=>s.seq-n.seq),earlier:R(e.earlier)?e.earlier:null}:null}function X(e){return!_(e)||!Array.isArray(e.threads)?null:{threads:e.threads.map(w).filter(t=>t!==null),next:f(e.next)&&/^[A-Za-z0-9_-]{1,64}$/.test(e.next)?e.next:null,unread:R(e.unread)?e.unread:0,latestAt:f(e.latestAt)?e.latestAt:null}}function be(e){if(!_(e))return null;const t=se(e.item),s=w(e.thread);return t&&s?{item:t,thread:s}:null}function P(e,t){const s=new Map;for(const n of e)s.set(n.seq,n);for(const n of t)s.set(n.seq,n);return[...s.values()].sort((n,r)=>n.seq-r.seq)}const ne=e=>e.reduce((t,s)=>Math.max(t,s.seq),-1),ye=/https?:\/\/[^\s<>"'\x60]+/g,ge=`.,;:!?'"`,xe={")":"(","]":"[","}":"{"},Ne=2048,ke="noopener noreferrer nofollow ugc",z=(e,t,s)=>{let n=0;for(let r=0;r<t;r++)e[r]===s&&n++;return n};function Se(e){let t=e.length;for(;t>0;){const s=e[t-1];if(ge.includes(s)){t--;continue}const n=xe[s];if(n&&z(e,t,s)>z(e,t,n)){t--;continue}break}return e.slice(0,t)}function je(e){const t=[];if(!e)return t;let s="",n=0;for(const r of e.matchAll(ye)){const a=Se(r[0]),i=a.startsWith("https://")?8:7;a.length<=i||a.length>Ne||(s+=e.slice(n,r.index),s&&(t.push({text:s}),s=""),t.push({url:a,text:a}),n=r.index+a.length)}return s+=e.slice(n),s&&t.push({text:s}),t}const Ae=300*1e3,Ee=new Set(["status","issue","duplicate","released","reopened"]);function M(e,t){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit",timeZone:t}).format(e)}function B(e,t,s){const n=M(Date.parse(e),s);if(n===M(t,s))return"today";const r=M(t,s),[a,i,m]=r.split("-").map(Number),o=M(Date.UTC(a,i-1,m-1,12),"UTC");return n===o?"yesterday":"date"}function H(e,t,s){const n=B(e,t,s);if(n==="today")return S("insights.audit.today");if(n==="yesterday")return S("insights.audit.yesterday");const r=Date.parse(e),a=M(r,s).slice(0,4)===M(t,s).slice(0,4);return new Intl.DateTimeFormat(ue(),{month:"short",day:"numeric",...a?{}:{year:"numeric"},timeZone:s}).format(r)}function G(e,t){return new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",hourCycle:"h23",timeZone:t}).format(Date.parse(e))}function Re(e,t,s){return B(e,t,s)==="today"?G(e,s):H(e,t,s)}function _e(e,t,s){const n=[];let r="",a=null;for(const i of e){const m=Date.parse(i.at),o=M(m,s);if(o!==r&&(r=o,a=null,n.push({kind:"day",key:`day-${o}`,label:H(i.at,t,s)})),i.type!=="message"){a=null,n.push({kind:"event",key:`item-${i.seq}`,item:i,time:G(i.at,s),known:Ee.has(i.type)});continue}const b=i.side==="team"?i.signature??null:null,u=a==null?void 0:a.messages[a.messages.length-1];if(a&&u&&a.side===i.side&&a.signature===b&&m-Date.parse(u.at)<Ae){a.messages.push(i),a.time=G(i.at,s);continue}a={kind:"run",key:`run-${i.seq}`,side:i.side,signature:b,messages:[i],time:G(i.at,s)},n.push(a)}return n}function Te(e){return e.preview.side==="user"?S("shell.feedback.previewYou",{text:e.preview.text}):e.preview.text}function Le(e){return e==="looking"||e==="planned"?"progress":e==="fixed"?"done":e==="wont_do"?"closed":"open"}const Ie="shell.feedback.allConversations",Ce="shell.feedback.noConversations",De="shell.feedback.loadingConversations",Me="shell.feedback.loadingConversation",qe="board.rail.more",Oe="shell.feedback.showEarlier",re="board.stage.tryAgain",Ge="shell.feedback.replyPlaceholder",Ue="shell.feedback.replySend",Pe="shell.feedback.sending",Fe="shell.feedback.replyLabel",Ve="shell.feedback.replySent",Ye="shell.feedback.newReply",ae="shell.feedback.conversationGone",le="shell.feedback.conversationsUnavailable",$e="shell.feedback.replyUnavailable",we="shell.feedback.replyRefused",Be=e=>S("shell.feedback.trackedPublicly",{number:e.number});function He(e){return S("shell.feedback.imagesOnWeb",{count:e})}function We(e,t,s,n){const r=H(e,s,n),i=B(e,s,n)==="date"?r:r.toLowerCase();return S(t==="web"?"shell.feedback.startedWeb":t==="deck"?"shell.feedback.startedDeck":"shell.feedback.started",{when:i})}const Y="/api/account/feedback/threads",O=e=>`${Y}/${encodeURIComponent(e)}`;async function q(e,t){try{const s=await fetch(e,{headers:{accept:"application/json",...t!=null&&t.body?{"content-type":"application/json"}:{}},...t});return{status:s.status,body:await s.json().catch(()=>null)}}catch{return{status:0,body:null}}}const J=(e,t)=>q(e,{method:"POST",body:JSON.stringify(t)}),F=new Map;function Ke(e,t,s=Date.now()){const n=t==null?void 0:t.reason;return n==="too_many"&&Number.isInteger(t==null?void 0:t.limit)&&Number.isInteger(t==null?void 0:t.retryAfterSec)?fe("replies",t.limit,new Date(s+t.retryAfterSec*1e3)):n==="not_found"||e===404?S(ae):n==="invalid"||n==="too_large"||n==="bad_request"?S(we):S($e)}function Xe(e,t){const[s,n]=c.useState([]),[r,a]=c.useState(null),[i,m]=c.useState("loading"),[o,b]=c.useState(!1),u=c.useRef(0),A=c.useCallback(async()=>{const D=++u.current,{status:T,body:E}=await q(Y);if(D!==u.current)return;const x=T===200?X(E):null;if(!x){m(N=>N==="ready"?N:"failed");return}n(x.threads),a(x.next),m("ready")},[]);c.useEffect(()=>{e&&A()},[e,t,A]);const C=c.useCallback(async()=>{if(!r||o)return;b(!0);const D=u.current,{status:T,body:E}=await q(`${Y}?before=${encodeURIComponent(r)}`);if(b(!1),D!==u.current)return;const x=T===200?X(E):null;x&&(n(N=>[...N,...x.threads.filter(d=>!N.some(y=>y.id===d.id))]),a(x.next))},[r,o]);return{threads:s,next:r,state:i,loadingMore:o,more:C,reload:A}}function ze(e,t,s){const[n,r]=c.useState(null),[a,i]=c.useState("loading"),[m,o]=c.useState(!1),[b,u]=c.useState(()=>F.get(e)??""),[A,C]=c.useState(!1),[D,T]=c.useState(""),E=c.useRef(!1),x=c.useRef(0),N=c.useRef(-1),d=c.useRef(-1),y=c.useRef(s);y.current=s;const L=c.useCallback(async()=>{const h=++x.current,{status:g,body:j}=await q(O(e));if(h!==x.current)return;if(g===404&&(j==null?void 0:j.reason)==="not_found"){i("gone");return}const k=g===200?K(j):null;if(!k){i(p=>p==="ready"?p:"failed");return}r(p=>p?{thread:k.thread,items:P(p.items,k.items),earlier:p.earlier}:k),i("ready")},[e]);c.useEffect(()=>{L()},[L,t]);const I=n==null?void 0:n.items,W=(n==null?void 0:n.thread.readSeq)??-1;c.useEffect(()=>{if(!I)return;const h=I.reduce((g,j)=>j.side==="team"?Math.max(g,j.seq):g,-1);N.current>=0&&h>N.current&&y.current(S(Ye)),N.current=Math.max(N.current,h,0)},[I]),c.useEffect(()=>{if(!I||I.length===0)return;const h=ne(I),g=()=>{document.visibilityState==="visible"&&(h<=Math.max(W,d.current)||(d.current=h,J(`${O(e)}/read`,{seq:h})))};return g(),document.addEventListener("visibilitychange",g),()=>document.removeEventListener("visibilitychange",g)},[e,I,W]);const ce=c.useCallback(async()=>{const h=n==null?void 0:n.earlier;if(h==null||m)return;o(!0);const{status:g,body:j}=await q(`${O(e)}?before=${h}`);o(!1);const k=g===200?K(j):null;k&&r(p=>p?{...p,items:P(k.items,p.items),earlier:k.earlier}:k)},[e,n==null?void 0:n.earlier,m]),U=c.useCallback(h=>{u(h),h?F.set(e,h):F.delete(e)},[e]),oe=c.useCallback(async()=>{if(!de(E.current))return!1;const h=b.trim();if(!h)return!1;E.current=!0,C(!0),T("");const{status:g,body:j}=await J(`${O(e)}/replies`,{body:h});E.current=!1,C(!1);const k=g===201?be(j):null;return k?(U(""),r(p=>p&&{...p,thread:k.thread,items:P(p.items,[k.item])}),y.current(S(Ve)),L(),!0):(T(Ke(g,j)),!1)},[b,e,L,U]);return{view:n,state:a,items:I??[],loadingEarlier:m,earlier:ce,reload:L,draft:b,setDraft:U,sending:A,failure:D,reply:oe,problem:a==="gone"?S(ae):a==="failed"?S(le):""}}function ie({status:e}){return l.jsx("span",{className:"fc-pill","data-tone":Le(e.code),children:e.label})}function Q({text:e}){return l.jsx(l.Fragment,{children:je(e).map((t,s)=>t.url?l.jsx("a",{className:"fc-link",href:t.url,rel:ke,target:"_blank",children:t.text},s):l.jsx(c.Fragment,{children:t.text},s))})}function Je({item:e,webUrl:t}){var n;const s=((n=e.images)==null?void 0:n.length)??0;return s===0||!Z(t)?null:l.jsx("a",{className:"fc-link fc-images",href:t,target:"_blank",rel:"noopener noreferrer",children:He(s)})}function Qe({items:e,webUrl:t,now:s}){const n=$();return l.jsx(l.Fragment,{children:_e(e,s).map(r=>{if(r.kind==="day")return l.jsx("p",{className:"fc-day",children:l.jsx("span",{children:r.label})},r.key);if(r.kind==="event")return l.jsxs("p",{className:"fc-event","data-type":r.known?r.item.type:"other",children:[l.jsx("span",{children:l.jsx(Q,{text:r.item.text})}),l.jsx("time",{className:"fc-time",dateTime:r.item.at,children:r.time})]},r.key);const a=r.messages[r.messages.length-1];return l.jsxs("div",{className:"fc-run","data-side":r.side,children:[r.side==="team"?l.jsx("p",{className:"fc-signature",children:r.signature??n("shell.feedback.teamSignature")}):l.jsx("p",{className:"vis-hidden",children:n("shell.feedback.you")}),r.messages.map(i=>l.jsxs("div",{className:"fc-message",children:[l.jsx("p",{className:"fc-bubble",children:l.jsx(Q,{text:i.text})}),l.jsx(Je,{item:i,webUrl:t})]},i.seq)),l.jsx("time",{className:"fc-time",dateTime:a.at,children:r.time})]},r.key)})})}function Ze({summary:e,latestAt:t,announce:s,onBack:n}){var x,N;const r=$(),a=ze(e.id,t,s),i=((x=a.view)==null?void 0:x.thread)??e,m=c.useRef(null),o=c.useRef(null),b=c.useRef(-1),u=c.useRef(-1),A=c.useRef(0),C=Date.now();c.useEffect(()=>{var d;(d=m.current)==null||d.focus()},[]),c.useLayoutEffect(()=>{const d=o.current;if(!d||a.items.length===0)return;const y=ne(a.items),L=a.items[0].seq;y>b.current?d.scrollTop=d.scrollHeight:L<u.current&&(d.scrollTop=d.scrollHeight-A.current),b.current=y,u.current=L,A.current=d.scrollHeight-d.scrollTop},[a.items]);function D(d){var y;if(d.preventDefault(),!a.draft.trim()){(y=m.current)==null||y.focus();return}a.reply()}function T(d){var y;he(d.nativeEvent)&&(d.preventDefault(),(y=d.currentTarget.form)==null||y.requestSubmit())}const E=a.items.find(d=>d.seq===0);return l.jsxs("div",{className:"fc-thread",children:[l.jsxs("div",{className:"fc-thread-head",children:[l.jsxs("button",{type:"button",className:"fb-tool fc-back",onClick:n,children:[l.jsx("span",{"aria-hidden":"true",children:"←"})," ",r(Ie)]}),l.jsx("h3",{className:"fc-thread-title",children:i.title}),l.jsxs("p",{className:"fc-thread-meta",children:[l.jsx(ie,{status:i.status}),i.trackedIssue&&Z(i.trackedIssue.url)&&l.jsx("a",{className:"fc-link",href:i.trackedIssue.url,target:"_blank",rel:"noopener noreferrer",children:Be(i.trackedIssue)}),l.jsx("span",{children:We(i.createdAt,E==null?void 0:E.via,C)})]})]}),l.jsxs("div",{ref:o,className:"fc-timeline",children:[((N=a.view)==null?void 0:N.earlier)!=null&&l.jsx("button",{type:"button",className:"btn fc-earlier",onClick:()=>void a.earlier(),...V(a.loadingEarlier),children:r(Oe)}),a.state==="loading"&&l.jsx("p",{className:"fc-note",children:r(Me)}),a.problem&&l.jsxs("div",{className:"fc-missing",children:[l.jsx("p",{className:"fc-note",children:a.problem}),a.state==="failed"&&l.jsx("button",{type:"button",className:"btn",onClick:()=>void a.reload(),children:r(re)})]}),l.jsx(Qe,{items:a.items,webUrl:i.webUrl,now:C})]}),l.jsxs("form",{className:"fc-composer",onSubmit:D,noValidate:!0,children:[l.jsx("label",{className:"vis-hidden",htmlFor:"fc-reply",children:r(Fe)}),l.jsx("textarea",{ref:m,id:"fc-reply",className:"ap-manage-input fc-reply",value:a.draft,maxLength:me,rows:1,placeholder:r(Ge),onChange:d=>a.setDraft(d.target.value),onKeyDown:T,"aria-describedby":a.failure?"fc-reply-error":void 0}),l.jsx("button",{type:"submit",className:"btn primary fc-send","aria-keyshortcuts":"Meta+Enter Control+Enter",...V(a.sending),children:l.jsxs("span",{className:"fb-send-label",children:[l.jsx("span",{className:"fb-send-idle",children:r(Ue)}),l.jsx("span",{className:"fb-send-busy",children:r(Pe)})]})})]}),a.failure&&l.jsx("p",{id:"fc-reply-error",className:"fb-error fc-reply-error",role:"alert",children:a.failure})]})}function tt({account:e,active:t,announce:s}){const[n,r]=c.useState(null),a=$(),i=c.useRef(null),m=c.useRef(null),o=Xe(t&&n===null,e.latestAt),b=Date.now();return n?l.jsx(Ze,{summary:n,latestAt:e.latestAt,announce:s,onBack:()=>{i.current=n.id,r(null),requestAnimationFrame(()=>{var u,A;(A=(u=m.current)==null?void 0:u.querySelector(`[data-thread="${CSS.escape(i.current??"")}"]`))==null||A.focus()})}},n.id):l.jsxs("div",{ref:m,className:"fc-list-view",children:[o.state==="loading"&&o.threads.length===0&&l.jsx("p",{className:"fc-note",children:a(De)}),o.state==="failed"&&l.jsxs("div",{className:"fc-missing",children:[l.jsx("p",{className:"fc-note",children:a(le)}),l.jsx("button",{type:"button",className:"btn",onClick:()=>void o.reload(),children:a(re)})]}),o.state==="ready"&&o.threads.length===0&&l.jsx("p",{className:"fc-note",children:a(Ce)}),o.threads.length>0&&l.jsx("ul",{className:"fc-list",children:o.threads.map(u=>l.jsx("li",{children:l.jsxs("button",{type:"button",className:"fc-row","data-thread":u.id,onClick:()=>r(u),children:[l.jsxs("span",{className:"fc-row-head",children:[l.jsx("span",{className:"fc-row-title",children:u.title}),l.jsx("time",{className:"fc-row-time",dateTime:u.lastActivityAt,children:Re(u.lastActivityAt,b)})]}),l.jsxs("span",{className:"fc-row-foot",children:[l.jsx(ie,{status:u.status}),l.jsx("span",{className:"fc-row-preview",children:Te(u)}),u.hasUnread&&l.jsx("span",{className:"fc-dot","aria-hidden":"true"}),u.hasUnread&&l.jsx("span",{className:"vis-hidden",children:a("shell.feedback.unreadSuffix")})]})]})},u.id))}),o.next&&l.jsx("button",{type:"button",className:"btn fc-more",onClick:()=>void o.more(),...V(o.loadingMore),children:a(qe)})]})}export{tt as default};
|
|
1
|
+
import{t as S,g as ue,r as c,s as de,c1 as fe,u as $,j as l,k as V,c2 as me,c3 as he}from"./app-ZMmmEHxF.js";import{o as Z}from"./use-account-DvFObI4M.js";const _=e=>!!e&&typeof e=="object"&&!Array.isArray(e),f=e=>typeof e=="string",R=e=>Number.isInteger(e)&&e>=0,v=e=>e==="user"||e==="team";function ee(e){return!_(e)||!f(e.code)||!f(e.label)?null:{code:e.code,label:e.label,fixedIn:f(e.fixedIn)?e.fixedIn:null,reason:f(e.reason)?e.reason:null,released:e.released===!0}}function te(e){return _(e)&&R(e.number)&&f(e.url)?{number:e.number,url:e.url}:null}function w(e){if(!_(e)||!f(e.id)||!f(e.title)||!f(e.createdAt)||!f(e.lastActivityAt))return null;const t=ee(e.status),s=_(e.preview)&&v(e.preview.side)&&f(e.preview.text)?{side:e.preview.side,text:e.preview.text}:null;return!t||!s||!R(e.lastSeq)||!R(e.readSeq)?null:{id:e.id,kind:f(e.kind)?e.kind:"other",title:e.title,status:t,createdAt:e.createdAt,lastActivityAt:e.lastActivityAt,lastSeq:e.lastSeq,readSeq:e.readSeq,hasUnread:e.hasUnread===!0,preview:s,trackedIssue:te(e.trackedIssue),images:R(e.images)?e.images:0,webUrl:f(e.webUrl)?e.webUrl:""}}function se(e){if(!_(e)||!R(e.seq)||!f(e.at)||!f(e.type)||!v(e.side)||!f(e.text))return null;const t={seq:e.seq,at:e.at,type:e.type,side:e.side,text:e.text};f(e.via)&&(t.via=e.via),f(e.signature)&&(t.signature=e.signature);const s=ee(e.status);s&&(t.status=s);const n=te(e.issue);return n&&(t.issue=n),f(e.version)&&(t.version=e.version),Array.isArray(e.images)&&(t.images=e.images.filter(r=>_(r)&&f(r.id)&&f(r.type)&&R(r.width)&&R(r.height)&&R(r.bytes))),t}const pe=e=>Array.isArray(e)?e.map(se).filter(t=>t!==null):[];function K(e){if(!_(e))return null;const t=w(e.thread);return t?{thread:t,items:pe(e.items).sort((s,n)=>s.seq-n.seq),earlier:R(e.earlier)?e.earlier:null}:null}function X(e){return!_(e)||!Array.isArray(e.threads)?null:{threads:e.threads.map(w).filter(t=>t!==null),next:f(e.next)&&/^[A-Za-z0-9_-]{1,64}$/.test(e.next)?e.next:null,unread:R(e.unread)?e.unread:0,latestAt:f(e.latestAt)?e.latestAt:null}}function be(e){if(!_(e))return null;const t=se(e.item),s=w(e.thread);return t&&s?{item:t,thread:s}:null}function P(e,t){const s=new Map;for(const n of e)s.set(n.seq,n);for(const n of t)s.set(n.seq,n);return[...s.values()].sort((n,r)=>n.seq-r.seq)}const ne=e=>e.reduce((t,s)=>Math.max(t,s.seq),-1),ye=/https?:\/\/[^\s<>"'\x60]+/g,ge=`.,;:!?'"`,xe={")":"(","]":"[","}":"{"},Ne=2048,ke="noopener noreferrer nofollow ugc",z=(e,t,s)=>{let n=0;for(let r=0;r<t;r++)e[r]===s&&n++;return n};function Se(e){let t=e.length;for(;t>0;){const s=e[t-1];if(ge.includes(s)){t--;continue}const n=xe[s];if(n&&z(e,t,s)>z(e,t,n)){t--;continue}break}return e.slice(0,t)}function je(e){const t=[];if(!e)return t;let s="",n=0;for(const r of e.matchAll(ye)){const a=Se(r[0]),i=a.startsWith("https://")?8:7;a.length<=i||a.length>Ne||(s+=e.slice(n,r.index),s&&(t.push({text:s}),s=""),t.push({url:a,text:a}),n=r.index+a.length)}return s+=e.slice(n),s&&t.push({text:s}),t}const Ae=300*1e3,Ee=new Set(["status","issue","duplicate","released","reopened"]);function M(e,t){return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit",timeZone:t}).format(e)}function B(e,t,s){const n=M(Date.parse(e),s);if(n===M(t,s))return"today";const r=M(t,s),[a,i,m]=r.split("-").map(Number),o=M(Date.UTC(a,i-1,m-1,12),"UTC");return n===o?"yesterday":"date"}function H(e,t,s){const n=B(e,t,s);if(n==="today")return S("insights.audit.today");if(n==="yesterday")return S("insights.audit.yesterday");const r=Date.parse(e),a=M(r,s).slice(0,4)===M(t,s).slice(0,4);return new Intl.DateTimeFormat(ue(),{month:"short",day:"numeric",...a?{}:{year:"numeric"},timeZone:s}).format(r)}function G(e,t){return new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",hourCycle:"h23",timeZone:t}).format(Date.parse(e))}function Re(e,t,s){return B(e,t,s)==="today"?G(e,s):H(e,t,s)}function _e(e,t,s){const n=[];let r="",a=null;for(const i of e){const m=Date.parse(i.at),o=M(m,s);if(o!==r&&(r=o,a=null,n.push({kind:"day",key:`day-${o}`,label:H(i.at,t,s)})),i.type!=="message"){a=null,n.push({kind:"event",key:`item-${i.seq}`,item:i,time:G(i.at,s),known:Ee.has(i.type)});continue}const b=i.side==="team"?i.signature??null:null,u=a==null?void 0:a.messages[a.messages.length-1];if(a&&u&&a.side===i.side&&a.signature===b&&m-Date.parse(u.at)<Ae){a.messages.push(i),a.time=G(i.at,s);continue}a={kind:"run",key:`run-${i.seq}`,side:i.side,signature:b,messages:[i],time:G(i.at,s)},n.push(a)}return n}function Te(e){return e.preview.side==="user"?S("shell.feedback.previewYou",{text:e.preview.text}):e.preview.text}function Le(e){return e==="looking"||e==="planned"?"progress":e==="fixed"?"done":e==="wont_do"?"closed":"open"}const Ie="shell.feedback.allConversations",Ce="shell.feedback.noConversations",De="shell.feedback.loadingConversations",Me="shell.feedback.loadingConversation",qe="board.rail.more",Oe="shell.feedback.showEarlier",re="board.stage.tryAgain",Ge="shell.feedback.replyPlaceholder",Ue="shell.feedback.replySend",Pe="shell.feedback.sending",Fe="shell.feedback.replyLabel",Ve="shell.feedback.replySent",Ye="shell.feedback.newReply",ae="shell.feedback.conversationGone",le="shell.feedback.conversationsUnavailable",$e="shell.feedback.replyUnavailable",we="shell.feedback.replyRefused",Be=e=>S("shell.feedback.trackedPublicly",{number:e.number});function He(e){return S("shell.feedback.imagesOnWeb",{count:e})}function We(e,t,s,n){const r=H(e,s,n),i=B(e,s,n)==="date"?r:r.toLowerCase();return S(t==="web"?"shell.feedback.startedWeb":t==="deck"?"shell.feedback.startedDeck":"shell.feedback.started",{when:i})}const Y="/api/account/feedback/threads",O=e=>`${Y}/${encodeURIComponent(e)}`;async function q(e,t){try{const s=await fetch(e,{headers:{accept:"application/json",...t!=null&&t.body?{"content-type":"application/json"}:{}},...t});return{status:s.status,body:await s.json().catch(()=>null)}}catch{return{status:0,body:null}}}const J=(e,t)=>q(e,{method:"POST",body:JSON.stringify(t)}),F=new Map;function Ke(e,t,s=Date.now()){const n=t==null?void 0:t.reason;return n==="too_many"&&Number.isInteger(t==null?void 0:t.limit)&&Number.isInteger(t==null?void 0:t.retryAfterSec)?fe("replies",t.limit,new Date(s+t.retryAfterSec*1e3)):n==="not_found"||e===404?S(ae):n==="invalid"||n==="too_large"||n==="bad_request"?S(we):S($e)}function Xe(e,t){const[s,n]=c.useState([]),[r,a]=c.useState(null),[i,m]=c.useState("loading"),[o,b]=c.useState(!1),u=c.useRef(0),A=c.useCallback(async()=>{const D=++u.current,{status:T,body:E}=await q(Y);if(D!==u.current)return;const x=T===200?X(E):null;if(!x){m(N=>N==="ready"?N:"failed");return}n(x.threads),a(x.next),m("ready")},[]);c.useEffect(()=>{e&&A()},[e,t,A]);const C=c.useCallback(async()=>{if(!r||o)return;b(!0);const D=u.current,{status:T,body:E}=await q(`${Y}?before=${encodeURIComponent(r)}`);if(b(!1),D!==u.current)return;const x=T===200?X(E):null;x&&(n(N=>[...N,...x.threads.filter(d=>!N.some(y=>y.id===d.id))]),a(x.next))},[r,o]);return{threads:s,next:r,state:i,loadingMore:o,more:C,reload:A}}function ze(e,t,s){const[n,r]=c.useState(null),[a,i]=c.useState("loading"),[m,o]=c.useState(!1),[b,u]=c.useState(()=>F.get(e)??""),[A,C]=c.useState(!1),[D,T]=c.useState(""),E=c.useRef(!1),x=c.useRef(0),N=c.useRef(-1),d=c.useRef(-1),y=c.useRef(s);y.current=s;const L=c.useCallback(async()=>{const h=++x.current,{status:g,body:j}=await q(O(e));if(h!==x.current)return;if(g===404&&(j==null?void 0:j.reason)==="not_found"){i("gone");return}const k=g===200?K(j):null;if(!k){i(p=>p==="ready"?p:"failed");return}r(p=>p?{thread:k.thread,items:P(p.items,k.items),earlier:p.earlier}:k),i("ready")},[e]);c.useEffect(()=>{L()},[L,t]);const I=n==null?void 0:n.items,W=(n==null?void 0:n.thread.readSeq)??-1;c.useEffect(()=>{if(!I)return;const h=I.reduce((g,j)=>j.side==="team"?Math.max(g,j.seq):g,-1);N.current>=0&&h>N.current&&y.current(S(Ye)),N.current=Math.max(N.current,h,0)},[I]),c.useEffect(()=>{if(!I||I.length===0)return;const h=ne(I),g=()=>{document.visibilityState==="visible"&&(h<=Math.max(W,d.current)||(d.current=h,J(`${O(e)}/read`,{seq:h})))};return g(),document.addEventListener("visibilitychange",g),()=>document.removeEventListener("visibilitychange",g)},[e,I,W]);const ce=c.useCallback(async()=>{const h=n==null?void 0:n.earlier;if(h==null||m)return;o(!0);const{status:g,body:j}=await q(`${O(e)}?before=${h}`);o(!1);const k=g===200?K(j):null;k&&r(p=>p?{...p,items:P(k.items,p.items),earlier:k.earlier}:k)},[e,n==null?void 0:n.earlier,m]),U=c.useCallback(h=>{u(h),h?F.set(e,h):F.delete(e)},[e]),oe=c.useCallback(async()=>{if(!de(E.current))return!1;const h=b.trim();if(!h)return!1;E.current=!0,C(!0),T("");const{status:g,body:j}=await J(`${O(e)}/replies`,{body:h});E.current=!1,C(!1);const k=g===201?be(j):null;return k?(U(""),r(p=>p&&{...p,thread:k.thread,items:P(p.items,[k.item])}),y.current(S(Ve)),L(),!0):(T(Ke(g,j)),!1)},[b,e,L,U]);return{view:n,state:a,items:I??[],loadingEarlier:m,earlier:ce,reload:L,draft:b,setDraft:U,sending:A,failure:D,reply:oe,problem:a==="gone"?S(ae):a==="failed"?S(le):""}}function ie({status:e}){return l.jsx("span",{className:"fc-pill","data-tone":Le(e.code),children:e.label})}function Q({text:e}){return l.jsx(l.Fragment,{children:je(e).map((t,s)=>t.url?l.jsx("a",{className:"fc-link",href:t.url,rel:ke,target:"_blank",children:t.text},s):l.jsx(c.Fragment,{children:t.text},s))})}function Je({item:e,webUrl:t}){var n;const s=((n=e.images)==null?void 0:n.length)??0;return s===0||!Z(t)?null:l.jsx("a",{className:"fc-link fc-images",href:t,target:"_blank",rel:"noopener noreferrer",children:He(s)})}function Qe({items:e,webUrl:t,now:s}){const n=$();return l.jsx(l.Fragment,{children:_e(e,s).map(r=>{if(r.kind==="day")return l.jsx("p",{className:"fc-day",children:l.jsx("span",{children:r.label})},r.key);if(r.kind==="event")return l.jsxs("p",{className:"fc-event","data-type":r.known?r.item.type:"other",children:[l.jsx("span",{children:l.jsx(Q,{text:r.item.text})}),l.jsx("time",{className:"fc-time",dateTime:r.item.at,children:r.time})]},r.key);const a=r.messages[r.messages.length-1];return l.jsxs("div",{className:"fc-run","data-side":r.side,children:[r.side==="team"?l.jsx("p",{className:"fc-signature",children:r.signature??n("shell.feedback.teamSignature")}):l.jsx("p",{className:"vis-hidden",children:n("shell.feedback.you")}),r.messages.map(i=>l.jsxs("div",{className:"fc-message",children:[l.jsx("p",{className:"fc-bubble",children:l.jsx(Q,{text:i.text})}),l.jsx(Je,{item:i,webUrl:t})]},i.seq)),l.jsx("time",{className:"fc-time",dateTime:a.at,children:r.time})]},r.key)})})}function Ze({summary:e,latestAt:t,announce:s,onBack:n}){var x,N;const r=$(),a=ze(e.id,t,s),i=((x=a.view)==null?void 0:x.thread)??e,m=c.useRef(null),o=c.useRef(null),b=c.useRef(-1),u=c.useRef(-1),A=c.useRef(0),C=Date.now();c.useEffect(()=>{var d;(d=m.current)==null||d.focus()},[]),c.useLayoutEffect(()=>{const d=o.current;if(!d||a.items.length===0)return;const y=ne(a.items),L=a.items[0].seq;y>b.current?d.scrollTop=d.scrollHeight:L<u.current&&(d.scrollTop=d.scrollHeight-A.current),b.current=y,u.current=L,A.current=d.scrollHeight-d.scrollTop},[a.items]);function D(d){var y;if(d.preventDefault(),!a.draft.trim()){(y=m.current)==null||y.focus();return}a.reply()}function T(d){var y;he(d.nativeEvent)&&(d.preventDefault(),(y=d.currentTarget.form)==null||y.requestSubmit())}const E=a.items.find(d=>d.seq===0);return l.jsxs("div",{className:"fc-thread",children:[l.jsxs("div",{className:"fc-thread-head",children:[l.jsxs("button",{type:"button",className:"fb-tool fc-back",onClick:n,children:[l.jsx("span",{"aria-hidden":"true",children:"←"})," ",r(Ie)]}),l.jsx("h3",{className:"fc-thread-title",children:i.title}),l.jsxs("p",{className:"fc-thread-meta",children:[l.jsx(ie,{status:i.status}),i.trackedIssue&&Z(i.trackedIssue.url)&&l.jsx("a",{className:"fc-link",href:i.trackedIssue.url,target:"_blank",rel:"noopener noreferrer",children:Be(i.trackedIssue)}),l.jsx("span",{children:We(i.createdAt,E==null?void 0:E.via,C)})]})]}),l.jsxs("div",{ref:o,className:"fc-timeline",children:[((N=a.view)==null?void 0:N.earlier)!=null&&l.jsx("button",{type:"button",className:"btn fc-earlier",onClick:()=>void a.earlier(),...V(a.loadingEarlier),children:r(Oe)}),a.state==="loading"&&l.jsx("p",{className:"fc-note",children:r(Me)}),a.problem&&l.jsxs("div",{className:"fc-missing",children:[l.jsx("p",{className:"fc-note",children:a.problem}),a.state==="failed"&&l.jsx("button",{type:"button",className:"btn",onClick:()=>void a.reload(),children:r(re)})]}),l.jsx(Qe,{items:a.items,webUrl:i.webUrl,now:C})]}),l.jsxs("form",{className:"fc-composer",onSubmit:D,noValidate:!0,children:[l.jsx("label",{className:"vis-hidden",htmlFor:"fc-reply",children:r(Fe)}),l.jsx("textarea",{ref:m,id:"fc-reply",className:"ap-manage-input fc-reply",value:a.draft,maxLength:me,rows:1,placeholder:r(Ge),onChange:d=>a.setDraft(d.target.value),onKeyDown:T,"aria-describedby":a.failure?"fc-reply-error":void 0}),l.jsx("button",{type:"submit",className:"btn primary fc-send","aria-keyshortcuts":"Meta+Enter Control+Enter",...V(a.sending),children:l.jsxs("span",{className:"fb-send-label",children:[l.jsx("span",{className:"fb-send-idle",children:r(Ue)}),l.jsx("span",{className:"fb-send-busy",children:r(Pe)})]})})]}),a.failure&&l.jsx("p",{id:"fc-reply-error",className:"fb-error fc-reply-error",role:"alert",children:a.failure})]})}function tt({account:e,active:t,announce:s}){const[n,r]=c.useState(null),a=$(),i=c.useRef(null),m=c.useRef(null),o=Xe(t&&n===null,e.latestAt),b=Date.now();return n?l.jsx(Ze,{summary:n,latestAt:e.latestAt,announce:s,onBack:()=>{i.current=n.id,r(null),requestAnimationFrame(()=>{var u,A;(A=(u=m.current)==null?void 0:u.querySelector(`[data-thread="${CSS.escape(i.current??"")}"]`))==null||A.focus()})}},n.id):l.jsxs("div",{ref:m,className:"fc-list-view",children:[o.state==="loading"&&o.threads.length===0&&l.jsx("p",{className:"fc-note",children:a(De)}),o.state==="failed"&&l.jsxs("div",{className:"fc-missing",children:[l.jsx("p",{className:"fc-note",children:a(le)}),l.jsx("button",{type:"button",className:"btn",onClick:()=>void o.reload(),children:a(re)})]}),o.state==="ready"&&o.threads.length===0&&l.jsx("p",{className:"fc-note",children:a(Ce)}),o.threads.length>0&&l.jsx("ul",{className:"fc-list",children:o.threads.map(u=>l.jsx("li",{children:l.jsxs("button",{type:"button",className:"fc-row","data-thread":u.id,onClick:()=>r(u),children:[l.jsxs("span",{className:"fc-row-head",children:[l.jsx("span",{className:"fc-row-title",children:u.title}),l.jsx("time",{className:"fc-row-time",dateTime:u.lastActivityAt,children:Re(u.lastActivityAt,b)})]}),l.jsxs("span",{className:"fc-row-foot",children:[l.jsx(ie,{status:u.status}),l.jsx("span",{className:"fc-row-preview",children:Te(u)}),u.hasUnread&&l.jsx("span",{className:"fc-dot","aria-hidden":"true"}),u.hasUnread&&l.jsx("span",{className:"vis-hidden",children:a("shell.feedback.unreadSuffix")})]})]})},u.id))}),o.next&&l.jsx("button",{type:"button",className:"btn fc-more",onClick:()=>void o.more(),...V(o.loadingMore),children:a(qe)})]})}export{tt as default};
|