ccdeck 3.82.3 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/LICENSING.md +42 -4
  2. package/README.md +183 -72
  3. package/THIRD_PARTY_NOTICES.md +243 -17
  4. package/bin/cli/login-item.js +5 -0
  5. package/bin/cli/tui.js +58 -4
  6. package/bin/deck.js +27 -1
  7. package/dist/web/assets/AccountBridge-OQHT5qmS.js +1 -0
  8. package/dist/web/assets/AccountSection-BpIHPhF3.js +1 -0
  9. package/dist/web/assets/BrowserWatchModal-DBdt52v7.js +1 -0
  10. package/dist/web/assets/FeedbackConversations-BJjgXI0-.js +1 -0
  11. package/dist/web/assets/IntegrationModal-DQ0vEz4X.js +7 -0
  12. package/dist/web/assets/IntegrationSkeleton-JCPbqp96.js +1 -0
  13. package/dist/web/assets/RadioPanel-Be6AkrKl.js +1 -0
  14. package/dist/web/assets/StageShell-Dq0JOQhd.js +4 -0
  15. package/dist/web/assets/TrafficRadar-7jqJbhaK.js +8 -0
  16. package/dist/web/assets/UsageHistoryModal-ckawZGoe.js +1 -0
  17. package/dist/web/assets/addon-unicode-graphemes-DW3WJwyh.js +18 -0
  18. package/dist/web/assets/addon-web-links-BWjmmSgS.js +12 -0
  19. package/dist/web/assets/addon-webgl-CLK4R-_u.js +75 -0
  20. package/dist/web/assets/app-40gNTTfq.js +361 -0
  21. package/dist/web/assets/app-BRjYF6oD.css +1 -0
  22. package/dist/web/assets/{index-B4c5MZCc.js → index-XIY3yFiN.js} +1 -1
  23. package/dist/web/assets/inspector-status-pane-BV_m7eBv.js +1 -0
  24. package/dist/web/assets/screens-9_ivqfcF.js +12 -0
  25. package/dist/web/assets/screens-DUniTTbC.css +1 -0
  26. package/dist/web/assets/stage-board-NF_wgGRA.js +2 -0
  27. package/dist/web/assets/use-account-BUmI-A8e.js +1 -0
  28. package/dist/web/assets/xterm-4jYizCpg.js +27 -0
  29. package/dist/web/assets/xterm-sheet-6GBZ9nXN.css +32 -0
  30. package/dist/web/index.html +16 -6
  31. package/package.json +13 -1
  32. package/release-notes.json +79 -0
  33. package/src/server/account-client.mjs +196 -0
  34. package/src/server/account-connect.mjs +238 -0
  35. package/src/server/account-flag.mjs +106 -0
  36. package/src/server/account-projects.mjs +1 -1
  37. package/src/server/account-service.mjs +532 -0
  38. package/src/server/account-status.mjs +293 -0
  39. package/src/server/account-store.mjs +137 -0
  40. package/src/server/account-sync.mjs +473 -0
  41. package/src/server/account-token-store.mjs +216 -0
  42. package/src/server/account-ui-fields.mjs +126 -0
  43. package/src/server/account-watch.mjs +1 -1
  44. package/src/server/browser-watch-log.mjs +1 -1
  45. package/src/server/browser-watch-store.mjs +1 -1
  46. package/src/server/ccdeck-account-routes.mjs +252 -0
  47. package/src/server/ccusage-install.mjs +2 -2
  48. package/src/server/ccusage-registry.mjs +4 -4
  49. package/src/server/ccusage-session.mjs +11 -0
  50. package/src/server/claude-accounts.mjs +1 -1
  51. package/src/server/claude-recovery.mjs +9 -4
  52. package/src/server/claude-settings-catalog.mjs +6 -6
  53. package/src/server/claude-settings.mjs +1 -1
  54. package/src/server/codex-auto.mjs +1 -1
  55. package/src/server/codex-cost-usage.mjs +7 -2
  56. package/src/server/codex-live-checkpoint.mjs +24 -9
  57. package/src/server/codex-live-engine.mjs +14 -4
  58. package/src/server/codex-live-handoff.mjs +53 -9
  59. package/src/server/codex-names.mjs +49 -0
  60. package/src/server/codex-translate.mjs +1 -1
  61. package/src/server/codex-ultrafast.d.mts +3 -0
  62. package/src/server/codex-ultrafast.mjs +5 -0
  63. package/src/server/codex-watch.mjs +25 -0
  64. package/src/server/command-panel-engine.mjs +300 -0
  65. package/src/server/command-panel-platform.mjs +99 -0
  66. package/src/server/cswap-auto-choice.mjs +1 -1
  67. package/src/server/cswap-auto-loop.mjs +1 -1
  68. package/src/server/cswap-install.mjs +21 -40
  69. package/src/server/deck-home.mjs +6 -0
  70. package/src/server/deck-prefs.mjs +53 -1
  71. package/src/server/detach.mjs +1 -1
  72. package/src/server/engine-download.mjs +277 -0
  73. package/src/server/engine-install.mjs +378 -0
  74. package/src/server/engine-package.mjs +267 -0
  75. package/src/server/event-log.mjs +7 -1
  76. package/src/server/event-pipeline.mjs +29 -1
  77. package/src/server/ghostty-handoff.mjs +81 -0
  78. package/src/server/index.mjs +143 -5
  79. package/src/server/installer.mjs +4 -1
  80. package/src/server/integrations/jira-write-guard.mjs +14 -208
  81. package/src/server/integrations/store.mjs +37 -19
  82. package/src/server/integrations/write-guard.mjs +223 -0
  83. package/src/server/intel-cpu-temperature.mjs +26 -0
  84. package/src/server/lifecycle.mjs +69 -6
  85. package/src/server/log-replay.mjs +4 -0
  86. package/src/server/login-service.mjs +116 -14
  87. package/src/server/macmon.mjs +1 -1
  88. package/src/server/npm-latest.mjs +1 -1
  89. package/src/server/org-telemetry.mjs +1 -1
  90. package/src/server/output-watch.mjs +4 -1
  91. package/src/server/panel-provenance.mjs +390 -0
  92. package/src/server/pinned-build.mjs +14 -0
  93. package/src/server/prefs-refusal.mjs +8 -1
  94. package/src/server/prefs-routes.mjs +60 -11
  95. package/src/server/pro-engine-client.mjs +339 -0
  96. package/src/server/pro-engine-install.mjs +294 -0
  97. package/src/server/pro-engine-terminal.mjs +308 -0
  98. package/src/server/project-discovery.mjs +139 -0
  99. package/src/server/provider-session-name.mjs +58 -0
  100. package/src/server/quota-closes.mjs +1 -1
  101. package/src/server/quota-history.mjs +1 -1
  102. package/src/server/reports.mjs +86 -21
  103. package/src/server/request-gates.mjs +34 -5
  104. package/src/server/restart-note.mjs +1 -1
  105. package/src/server/seed-boundary.mjs +489 -0
  106. package/src/server/session-counts.mjs +244 -0
  107. package/src/server/session-deck-names.mjs +143 -0
  108. package/src/server/session-enrichment.mjs +43 -6
  109. package/src/server/session-name-route.mjs +73 -0
  110. package/src/server/session-summary.mjs +12 -1
  111. package/src/server/session-transcript-routes.mjs +167 -0
  112. package/src/server/swap-log.mjs +1 -1
  113. package/src/server/system-metrics.mjs +57 -0
  114. package/src/server/terminal-bridge.mjs +485 -0
  115. package/src/server/terminal-folder.mjs +61 -0
  116. package/src/server/terminal-js-routes.mjs +752 -0
  117. package/src/server/terminal-routes.mjs +553 -0
  118. package/src/server/terminal-sessions.mjs +759 -0
  119. package/src/server/terminal-socket.mjs +403 -0
  120. package/src/server/terminal-target.mjs +928 -0
  121. package/src/server/thermal-metrics.mjs +13 -9
  122. package/src/server/tmux-control.mjs +1319 -0
  123. package/src/server/tmux-download.mjs +220 -0
  124. package/src/server/tmux.mjs +542 -0
  125. package/src/server/token-redact.mjs +42 -3
  126. package/src/server/tool-audit-report.mjs +44 -6
  127. package/src/server/tool-audit-routes.mjs +12 -1
  128. package/src/server/tool-audit.mjs +42 -8
  129. package/src/server/traffic-radar-monitor.mjs +1 -1
  130. package/src/server/traffic-radar-permission.mjs +1 -1
  131. package/src/server/transcript-gate.mjs +1 -1
  132. package/src/server/transcript-scan.mjs +15 -7
  133. package/src/server/transcript-turns.mjs +154 -0
  134. package/src/server/tui-network.mjs +1 -0
  135. package/src/server/tui-view.mjs +28 -0
  136. package/src/server/utf8-carry.mjs +159 -0
  137. package/src/server/uv-bootstrap.mjs +2 -2
  138. package/src/server/windows-acl.mjs +158 -0
  139. package/src/server/ws-frames.mjs +690 -0
  140. package/dist/web/assets/BrowserWatchModal-BmRTh_xT.js +0 -1
  141. package/dist/web/assets/IntegrationModal-C_f526aV.js +0 -7
  142. package/dist/web/assets/RadioPanel-D2rkf9cg.js +0 -1
  143. package/dist/web/assets/TrafficRadar-BOgVBLIN.js +0 -8
  144. package/dist/web/assets/UsageHistoryModal-BJPTFwM9.js +0 -1
  145. package/dist/web/assets/app-CbXmr9rC.css +0 -1
  146. package/dist/web/assets/app-DZdZoqJ6.js +0 -358
@@ -100,7 +100,7 @@ resolver packages credit Holepunch. They are not compiled into the browser
100
100
  bundle listed below. Desktop also includes this file, `LICENSE` and
101
101
  `LICENSING.md` alongside the hosted server.
102
102
 
103
- ## Bundled packages (27)
103
+ ## Bundled packages (31)
104
104
 
105
105
  | Package | Version | Licence | Copyright |
106
106
  | --- | --- | --- | --- |
@@ -109,6 +109,10 @@ bundle listed below. Desktop also includes this file, `LICENSE` and
109
109
  | `@reactflow/core` | 11.11.4 | MIT | Copyright (c) 2019-2023 webkid GmbH |
110
110
  | `@reactflow/minimap` | 11.7.14 | MIT | Copyright (c) 2019-2023 webkid GmbH |
111
111
  | `@reactflow/node-resizer` | 2.2.14 | MIT | Copyright (c) 2019-2023 webkid GmbH |
112
+ | `@xterm/addon-unicode-graphemes` | 0.4.0 | MIT | Copyright (c) 2023, The xterm.js authors (https://github.com/xtermjs/xterm.js) |
113
+ | `@xterm/addon-web-links` | 0.12.0 | MIT | Copyright (c) 2017, The xterm.js authors (https://github.com/xtermjs/xterm.js) |
114
+ | `@xterm/addon-webgl` | 0.19.0 | MIT | Copyright (c) 2018, The xterm.js authors (https://github.com/xtermjs/xterm.js) |
115
+ | `@xterm/xterm` | 6.0.0 | MIT | Copyright (c) 2017-2019, The xterm.js authors (https://github.com/xtermjs/xterm.js) |
112
116
  | `classcat` | 5.0.5 | MIT | Copyright © Jorge Bucaran <<https://jorgebucaran.com>> |
113
117
  | `d3-color` | 3.1.0 | ISC | Copyright 2010-2022 Mike Bostock |
114
118
  | `d3-dispatch` | 3.0.1 | ISC | Copyright 2010-2021 Mike Bostock |
@@ -140,26 +144,31 @@ for more than a notice — a copy of the licence itself travels with the work
140
144
  and it is compatible with version 3 of the GNU licences, which is the version
141
145
  ccdeck is under.
142
146
 
143
- `hls.js` and `json-edit-react` are the two entries that are not in the page
144
- every visit loads. `hls.js` is its own chunk, `dist/web/assets/hls-*.js`,
145
- fetched only when somebody plays an HLS custom station in a browser without
146
- native HLS (#1208). `json-edit-react` is the JSON tree in Radar's event
147
- inspector and is compiled into Radar's chunk,
147
+ `hls.js`, `json-edit-react` and the four `@xterm/*` rows are the entries that
148
+ are not in the page every visit loads. `hls.js` is its own chunk,
149
+ `dist/web/assets/hls-*.js`, fetched only when somebody plays an HLS custom
150
+ station in a browser without native HLS (#1208). `json-edit-react` is the JSON
151
+ tree in Radar's event inspector and is compiled into Radar's chunk,
148
152
  `dist/web/assets/TrafficRadar-*.js`, fetched only when somebody opens Radar; it
149
153
  adds its own stylesheet from that JavaScript the first time it renders, so it
150
- has no CSS file of its own. Both chunks are in `dist/web` like every other, and
151
- so in the tarball. None of these licences is changed by ccdeck's relicensing,
152
- and no copyleft obligation flows back to their authors.
154
+ has no CSS file of its own. The four `@xterm/*` rows are the terminal panel's,
155
+ which is off unless it is turned on: `@xterm/xterm`, its graphemes addon and its
156
+ web-links addon are fetched in chunks of their own the first time the panel
157
+ draws a terminal, and the WebGL addon after them, and never while the panel is
158
+ off — `notices-bundle.test.ts` holds them out of the entry chunk and its
159
+ stylesheet. Every one of those chunks is in `dist/web` like every other, and so
160
+ in the tarball. None of these licences is changed by ccdeck's relicensing, and
161
+ no copyleft obligation flows back to their authors.
153
162
 
154
163
  ### Declared but not emitted (3)
155
164
 
156
165
  Three packages resolve into `node_modules` and do **not** survive the build.
157
- They were in the table above until #962, which is over-attribution rather than
158
- under-attribution and so harmless legally — but the paragraph at the top of this
159
- file says everything in the table is *physically present in the published
160
- tarball*, and that is a factual claim a redistributor is entitled to rely on. So
161
- they are listed here instead, with what was looked for in the built chunks and
162
- not found.
166
+ They were in the table above until #962, which is over-attribution
167
+ rather than under-attribution and so harmless legally — but the paragraph at the
168
+ top of this file says everything in the table is *physically present in the
169
+ published tarball*, and that is a factual claim a redistributor is entitled to
170
+ rely on. So they are listed here instead, with what was looked for in the built
171
+ chunks and not found.
163
172
 
164
173
  | Package | Version | Licence | Searched for in `dist/web/assets/*` | Why it is not there |
165
174
  | --- | --- | --- | --- | --- |
@@ -167,8 +176,14 @@ not found.
167
176
  | `loose-envify` | 1.4.0 | MIT | `[_$a-zA-Z][$\w]+` — the body of its `process.env.` matcher, likewise a regex literal | Same: it is a browserify transform, declared by `react` and never part of a Rollup graph. |
168
177
  | `@reactflow/node-toolbar` | 1.3.14 | MIT | `react-flow__node-toolbar` | Tree-shaken. The deck renders no node toolbar, and unlike its siblings this one contributes no stylesheet either. |
169
178
 
170
- Their licence texts are still reproduced below — §3, §6 and §7 — because dropping
171
- a notice is the expensive mistake and keeping one is free.
179
+ Their licence texts are still reproduced below — §3, §6 and §7 — because
180
+ dropping a notice is the expensive mistake and keeping one is free.
181
+
182
+ `@xterm/xterm` and the WebGL addon were on this list until the terminal panel
183
+ was wired into the page; they moved to the bundled table above when the build
184
+ started to emit them, which is the move `notices-bundle.test.ts` asks for. The
185
+ fit and Unicode 11 addons were declared for the panel and left the dependencies
186
+ once it was clear it would load neither.
172
187
 
173
188
  `@reactflow/node-resizer` is deliberately **not** in this list, and it is the one
174
189
  entry #962 got wrong. Its JavaScript is tree-shaken exactly as the toolbar's is —
@@ -721,6 +736,145 @@ SOFTWARE.
721
736
  Source: https://github.com/CarlosNZ/json-edit-react. The package has no
722
737
  dependencies of its own; React, its one peer, is §1.
723
738
 
739
+ ### 16. `@xterm/xterm` 6.0.0
740
+
741
+ Reproduced verbatim from `node_modules/@xterm/xterm/LICENSE`:
742
+
743
+ ```text
744
+ Copyright (c) 2017-2019, The xterm.js authors (https://github.com/xtermjs/xterm.js)
745
+ Copyright (c) 2014-2016, SourceLair Private Company (https://www.sourcelair.com)
746
+ Copyright (c) 2012-2013, Christopher Jeffrey (https://github.com/chjj/)
747
+
748
+ Permission is hereby granted, free of charge, to any person obtaining a copy
749
+ of this software and associated documentation files (the "Software"), to deal
750
+ in the Software without restriction, including without limitation the rights
751
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
752
+ copies of the Software, and to permit persons to whom the Software is
753
+ furnished to do so, subject to the following conditions:
754
+
755
+ The above copyright notice and this permission notice shall be included in
756
+ all copies or substantial portions of the Software.
757
+
758
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
759
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
760
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
761
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
762
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
763
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
764
+ THE SOFTWARE.
765
+ ```
766
+
767
+ `lib/xterm.mjs` opens with two more notices, and each addon's `lib/*.mjs` below
768
+ opens with the same two: the code xterm.js grew out of, and the code it adapted
769
+ from Visual Studio Code. They are reproduced here as they appear there. In a
770
+ Vite build the first survives minification as a `@license` comment and the
771
+ second does not, which is why it is written out here.
772
+
773
+ ```text
774
+ /**
775
+ * Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
776
+ * @license MIT
777
+ *
778
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
779
+ * @license MIT
780
+ *
781
+ * Originally forked from (with the author's permission):
782
+ * Fabrice Bellard's javascript vt100 for jslinux:
783
+ * http://bellard.org/jslinux/
784
+ * Copyright (c) 2011 Fabrice Bellard
785
+ */
786
+ /*---------------------------------------------------------------------------------------------
787
+ * Copyright (c) Microsoft Corporation. All rights reserved.
788
+ * Licensed under the MIT License. See License.txt in the project root for license information.
789
+ *--------------------------------------------------------------------------------------------*/
790
+ ```
791
+
792
+ ### 17. `@xterm/addon-webgl` 0.19.0
793
+
794
+ Reproduced verbatim from `node_modules/@xterm/addon-webgl/LICENSE`:
795
+
796
+ ```text
797
+ Copyright (c) 2018, The xterm.js authors (https://github.com/xtermjs/xterm.js)
798
+
799
+ Permission is hereby granted, free of charge, to any person obtaining a copy
800
+ of this software and associated documentation files (the "Software"), to deal
801
+ in the Software without restriction, including without limitation the rights
802
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
803
+ copies of the Software, and to permit persons to whom the Software is
804
+ furnished to do so, subject to the following conditions:
805
+
806
+ The above copyright notice and this permission notice shall be included in
807
+ all copies or substantial portions of the Software.
808
+
809
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
810
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
811
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
812
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
813
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
814
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
815
+ THE SOFTWARE.
816
+ ```
817
+
818
+ ### 18. `@xterm/addon-unicode-graphemes` 0.4.0
819
+
820
+ Reproduced verbatim from `node_modules/@xterm/addon-unicode-graphemes/LICENSE`:
821
+
822
+ ```text
823
+ Copyright (c) 2023, The xterm.js authors (https://github.com/xtermjs/xterm.js)
824
+
825
+ Permission is hereby granted, free of charge, to any person obtaining a copy
826
+ of this software and associated documentation files (the "Software"), to deal
827
+ in the Software without restriction, including without limitation the rights
828
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
829
+ copies of the Software, and to permit persons to whom the Software is
830
+ furnished to do so, subject to the following conditions:
831
+
832
+ The above copyright notice and this permission notice shall be included in
833
+ all copies or substantial portions of the Software.
834
+
835
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
836
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
837
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
838
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
839
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
840
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
841
+ THE SOFTWARE.
842
+ ```
843
+
844
+ The addon carries, in `src/third-party/`, TypeScript ports of `tiny-inflate`
845
+ and `unicode-trie`, both by Devon Govett and published under the MIT licence
846
+ (github.com/devongovett/tiny-inflate, github.com/devongovett/unicode-trie), and
847
+ a Unicode property table generated with Per Bothner's `unicode-properties`
848
+ (github.com/PerBothner/unicode-properties). The ports carry no notice of their
849
+ own in the package; they are named here so that the attribution travels with
850
+ the code.
851
+
852
+ ### 19. `@xterm/addon-web-links` 0.12.0
853
+
854
+ Reproduced verbatim from `node_modules/@xterm/addon-web-links/LICENSE`:
855
+
856
+ ```text
857
+ Copyright (c) 2017, The xterm.js authors (https://github.com/xtermjs/xterm.js)
858
+
859
+ Permission is hereby granted, free of charge, to any person obtaining a copy
860
+ of this software and associated documentation files (the "Software"), to deal
861
+ in the Software without restriction, including without limitation the rights
862
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
863
+ copies of the Software, and to permit persons to whom the Software is
864
+ furnished to do so, subject to the following conditions:
865
+
866
+ The above copyright notice and this permission notice shall be included in
867
+ all copies or substantial portions of the Software.
868
+
869
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
870
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
871
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
872
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
873
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
874
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
875
+ THE SOFTWARE.
876
+ ```
877
+
724
878
  ## Radio world map
725
879
 
726
880
  The radio map includes simplified country geometry from Natural Earth
@@ -812,3 +966,75 @@ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
812
966
  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
813
967
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
814
968
  ```
969
+
970
+
971
+ ## Claude Code and Codex provider marks — LobeHub
972
+
973
+ The monochrome SVGs below are copied byte for byte from
974
+ [LobeHub Icons](https://github.com/lobehub/lobe-icons) commit
975
+ `34270bc208d7122778dc00b30bd460f97ea03216`, with their artwork unchanged.
976
+ Both use `currentColor`, with no background or gradients. They identify
977
+ third-party providers and are separate from the ccdeck brand kit.
978
+
979
+ | Distributed asset | LobeHub source | SHA-256 |
980
+ | --- | --- | --- |
981
+ | `src/web/assets/providers/claude-code.svg` | [claudecode.svg](https://github.com/lobehub/lobe-icons/blob/34270bc208d7122778dc00b30bd460f97ea03216/packages/static-svg/icons/claudecode.svg) | `d7eb2d876b49e51cc16291a42b681d7cf4906e60e0150776dbfb353ec4ca3746` |
982
+ | `src/web/assets/providers/codex.svg` | [codex.svg](https://github.com/lobehub/lobe-icons/blob/34270bc208d7122778dc00b30bd460f97ea03216/packages/static-svg/icons/codex.svg) | `d08b4e824cd6727e89617f59e4737273ff53e44c1da849d016dd64dfd08b33e1` |
983
+
984
+ The icons are distributed under the MIT licence. Trademark rights are not
985
+ granted by the MIT licence.
986
+
987
+ The full [upstream LobeHub notice](https://github.com/lobehub/lobe-icons/blob/34270bc208d7122778dc00b30bd460f97ea03216/LICENSE)
988
+ is reproduced unchanged:
989
+
990
+ ```text
991
+ MIT License
992
+
993
+ Copyright (c) 2023 LobeHub
994
+
995
+ Permission is hereby granted, free of charge, to any person obtaining a copy
996
+ of this software and associated documentation files (the "Software"), to deal
997
+ in the Software without restriction, including without limitation the rights
998
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
999
+ copies of the Software, and to permit persons to whom the Software is
1000
+ furnished to do so, subject to the following conditions:
1001
+
1002
+ The above copyright notice and this permission notice shall be included in all
1003
+ copies or substantial portions of the Software.
1004
+
1005
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1006
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1007
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1008
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1009
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1010
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1011
+ SOFTWARE.
1012
+ ```
1013
+
1014
+ ## shadcn/ui form components
1015
+
1016
+ `src/web/components/ui/button.tsx` and `input.tsx` adapt the new-york
1017
+ Button and Input recipes from https://github.com/shadcn-ui/ui. Their styles
1018
+ are adapted to ccdeck's CSS tokens and native controls.
1019
+
1020
+ MIT License
1021
+
1022
+ Copyright (c) 2023 shadcn
1023
+
1024
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1025
+ of this software and associated documentation files (the "Software"), to deal
1026
+ in the Software without restriction, including without limitation the rights
1027
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1028
+ copies of the Software, and to permit persons to whom the Software is
1029
+ furnished to do so, subject to the following conditions:
1030
+
1031
+ The above copyright notice and this permission notice shall be included in all
1032
+ copies or substantial portions of the Software.
1033
+
1034
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1035
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1036
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1037
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1038
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1039
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1040
+ SOFTWARE.
@@ -198,6 +198,11 @@ export async function offerLoginItem({ deckDataDir, deckLogDir }) {
198
198
  : out.enable
199
199
  ? ` ${P.muted}${G.dash} ${PRODUCT}'s login item is written but systemd did not enable it (${out.reason}) ${G.dash} \`${out.enable}\` turns it on${P.reset}\n\n`
200
200
  : ` ${P.muted}${G.dash} ${PRODUCT} will now start when you log in ${G.dash} \`${COMMAND} --uninstall-service\` undoes it${P.reset}\n\n`);
201
+ } else {
202
+ // A login item an older deck wrote runs node on the script bare, which
203
+ // is a stack at every login once the package is removed. Rewritten in
204
+ // place to the guarded form: file content only, silent, never enabled.
205
+ await svc.refreshLoginItem();
201
206
  }
202
207
  } catch (err) {
203
208
  // Never fatal. The deck is up; this is a convenience that did not happen.
package/bin/cli/tui.js CHANGED
@@ -77,7 +77,7 @@ export async function runTui(flags, out, deps = {}) {
77
77
  const { CODEX_REFUSED, codexLiveSaid, codexSigninRunning } = await load("src/server/tui-codex.mjs");
78
78
  const { LAN_REFUSED } = await load("src/server/tui-network.mjs");
79
79
  const port = flags.port != null ? Number(flags.port) : null;
80
- const src = deps.source ?? deckSource(port);
80
+ const base = deps.source ?? deckSource(port);
81
81
  const look = {
82
82
  tone: deps.tone ?? P, g: deps.g ?? G, unicode: deps.unicode ?? UNICODE, profile: deps.profile ?? PROFILE, links: deps.links ?? LINKS,
83
83
  };
@@ -86,7 +86,7 @@ export async function runTui(flags, out, deps = {}) {
86
86
 
87
87
  // The deck is looked for before the screen is taken, so a `--port` nobody
88
88
  // listens on is answered on the command line, the way the commands answer it.
89
- let deck = await src.find();
89
+ let deck = await base.find();
90
90
  if (!deck && port != null) {
91
91
  return out.fail(EXIT.NO_DECK, "no_deck", `no deck is listening on ${port} ${G.dash} \`${COMMAND} status\` lists them`);
92
92
  }
@@ -99,6 +99,47 @@ export async function runTui(flags, out, deps = {}) {
99
99
 
100
100
  const set = (patch) => { state = { ...state, ...patch }; };
101
101
  const tell = (tone, text) => set({ notice: view.note(tone, text, clock()) });
102
+
103
+ /**
104
+ * The deck held here, looked up again (#100). A deck that restarts — an
105
+ * update, the banner's Restart, a CLI installed while it ran, a crash its
106
+ * supervisor brought back — is up again on the same port within a second,
107
+ * with a new token (request-gates.mjs makes one per start). Every reading
108
+ * this screen asked with the old one was refused 401 from then on, and none
109
+ * of the refusals looked like a deck gone, so the numbers stopped where they
110
+ * were until the screen was quit and opened again, which is a fresh look.
111
+ *
112
+ * One look at a time, shared by every reading refused at once. Answers the
113
+ * record to ask now, or null when there is none other than the one held.
114
+ */
115
+ let refinding = null;
116
+ const refind = () => (refinding ??= (async () => {
117
+ const held = deck;
118
+ const found = await base.find().catch(() => null);
119
+ if (deck !== held) return deck;
120
+ if (!found || !held || (found.port === held.port && found.token === held.token)) return null;
121
+ deck = found;
122
+ set({ deck: { port: found.port, version: found.version ?? null }, silent: [] });
123
+ return found;
124
+ })().finally(() => { refinding = null; }));
125
+
126
+ /** Whether an answer is the deck's token gate refusing the one asked with. */
127
+ const refused = (r) => r?.status === 401;
128
+
129
+ /**
130
+ * The source, its asks answered by the deck now running. A 401 is the token
131
+ * gate, which answers before a route runs, so the deck did nothing with the
132
+ * request and asking it again of the deck found again is safe — a POST too.
133
+ */
134
+ const src = {
135
+ ...base,
136
+ ask: async (d, opts) => {
137
+ const r = await base.ask(d, opts);
138
+ if (!refused(r) || !d) return r;
139
+ const now = d === deck ? await refind() : deck;
140
+ return now && now !== d && now.token !== d.token ? base.ask(now, opts) : r;
141
+ },
142
+ };
102
143
  const size = () => ({
103
144
  columns: Number.isInteger(output.columns) && output.columns > 0 ? output.columns : 80,
104
145
  rows: Number.isInteger(output.rows) && output.rows > 0 ? output.rows : 24,
@@ -143,14 +184,20 @@ export async function runTui(flags, out, deps = {}) {
143
184
  last.roster = 0;
144
185
  };
145
186
 
187
+ // What the last failed roster reading said, so the next good one can take
188
+ // its notice down: an error notice otherwise stays until a key, and stood
189
+ // beside "live" and fresh numbers long after the deck answered again.
190
+ let rosterSaid = null;
146
191
  const readRoster = once("roster", async (force = false) => {
147
192
  if (deck) {
148
193
  const r = await src.ask(deck, { path: force ? "/api/claude-accounts?refresh=1" : "/api/claude-accounts" });
149
194
  if (r.ok && r.body) {
150
195
  state = view.withRoster(state, r.body, r.body.ok ? null : [].concat(rosterTrouble(r.body)));
151
196
  set({ source: "deck", silent: [], readAt: clock() });
197
+ if (rosterSaid && state.notice?.text === rosterSaid) set({ notice: null });
198
+ rosterSaid = null;
152
199
  } else if (r.status === 0) lost();
153
- else tell("err", deckTrouble(deck, r));
200
+ else tell("err", (rosterSaid = deckTrouble(deck, r)));
154
201
  return;
155
202
  }
156
203
  const silent = await src.silent();
@@ -303,7 +350,14 @@ export async function runTui(flags, out, deps = {}) {
303
350
  }
304
351
  set({ busy: { text: `switching to ${accountName(row)}`, since: clock() }, notice: null });
305
352
  render();
306
- const result = deck ? await src.switchDeck(deck, row.num) : await src.switchHere(row.num);
353
+ let result = deck ? await src.switchDeck(deck, row.num) : await src.switchHere(row.num);
354
+ // Refused by the token gate: a deck that restarted since the last reading.
355
+ // The gate answers before the route, so nothing was switched; the deck
356
+ // found again is asked once more.
357
+ if (deck && result?.error === "unauthenticated") {
358
+ const now = await refind();
359
+ if (now) result = await src.switchDeck(now, row.num);
360
+ }
307
361
  set({ busy: null });
308
362
  if (!result.ok && result.reason === "deck_timeout") {
309
363
  tell("warn", `the deck has not finished switching to ${accountName(row)} ${g.dash} it may still land`);
package/bin/deck.js CHANGED
@@ -215,7 +215,9 @@ const { installHooks, keepDiscovery, removeDiscovery, hasCodexInstalled, leftove
215
215
  // here is how the banner came to print ~/.codex/sessions on machines whose
216
216
  // sessions are somewhere else entirely — see the Codex sessions row in
217
217
  // bin/cli/startup.js.
218
- const { startServer, hookToken, releaseRestart, markDeckReady, CODEX_SESSIONS_DIR, canonicalWorkspace } =
218
+ // closeAllTerminals and stopCommandPanelEngine because shutdown, below, has to
219
+ // reach the Command Panel's sockets and its engine itself — see the note there.
220
+ const { startServer, hookToken, releaseRestart, markDeckReady, beforeShutdown, CODEX_SESSIONS_DIR, canonicalWorkspace, closeAllTerminals, stopCommandPanelEngine } =
219
221
  await import(pathToFileURL(join(PKG_ROOT, "src/server/index.mjs")).href);
220
222
  // What this boot set up, for the usage reports — see activation.mjs.
221
223
  const { noteSetup, respawnHooksJob } = await import(pathToFileURL(join(PKG_ROOT, "src/server/activation.mjs")).href);
@@ -672,6 +674,26 @@ async function shutdown(code = 0) {
672
674
  if (tty && code !== RESTART_CODE && code !== UPGRADE_CODE && !hungUp) {
673
675
  write(`\n\n ${P.warn}${G.stop} shutting down${G.ellipsis}${P.reset}\n`);
674
676
  }
677
+ // THE TERMINAL PANELS ARE TOLD BEFORE ANYTHING IS REAPED. Each open panel
678
+ // has a `tmux -C` client among the children killed just below, and a panel
679
+ // whose client died first would draw an unexplained error instead of "the
680
+ // deck went away". Upgraded sockets are also not in the HTTP server's
681
+ // connection list, so the closeAllConnections() at the end never sees
682
+ // them, and server.close() would sit out the whole fallback waiting on
683
+ // them. The sessions themselves keep running in tmux; only the views go.
684
+ //
685
+ // Behind `server` because that is what says the import above has run:
686
+ // `server` is only ever set from startServer, which came out of the same
687
+ // destructuring as this, so a shutdown that arrives earlier — when there
688
+ // can be no terminal open — never touches a binding still in its TDZ.
689
+ //
690
+ // Then the Command Panel's engine, which the panels were relayed to: told
691
+ // to stop and not waited for. It has already been handed each panel's
692
+ // shutdown, and an engine that outlives the deck ends with its stdin.
693
+ if (server) {
694
+ try { closeAllTerminals("server-shutdown"); } catch { /* nothing open, or nothing left to tell */ }
695
+ try { stopCommandPanelEngine(); } catch { /* none was started */ }
696
+ }
675
697
  // WHAT THIS DECK STARTED, ENDED WITH IT. Every deadline in exec.mjs lives
676
698
  // in a timer in THIS process — `run` states the outcome and only then kills
677
699
  // — so an exit that reaps nothing leaves the hung tool a deadline exists
@@ -691,6 +713,10 @@ async function shutdown(code = 0) {
691
713
  const { killLiveChildren } = await import(pathToFileURL(join(PKG_ROOT, "src/server/exec.mjs")).href);
692
714
  killLiveChildren();
693
715
  } catch { /* exec.mjs never loaded, so nothing was ever spawned */ }
716
+ // What the server registered for the way out — the account's last status
717
+ // frame, when there is an account (lifecycle.mjs onBeforeShutdown). Free
718
+ // when nothing registered, and never more than a second and a half.
719
+ try { await beforeShutdown?.(); } catch { /* leaving anyway */ }
694
720
  // Stopped first, always: a tick landing after the unlink would re-register a
695
721
  // deck that is on its way out, and leave the file behind for the hooks to
696
722
  // find once nothing is listening.
@@ -0,0 +1 @@
1
+ import{r as e,p as t}from"./app-40gNTTfq.js";import{u as o,a as s,f as n}from"./use-account-BUmI-A8e.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};
@@ -0,0 +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};
@@ -0,0 +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};
@@ -0,0 +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};