@alexsun-top/opencode-chat-room 0.8.2 → 0.8.4

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 (92) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +18 -62
  3. package/README.zh-CN.md +25 -69
  4. package/dist/cli.js +466 -188
  5. package/package.json +11 -5
  6. package/packages/chat-room-channeld/README.md +25 -3
  7. package/packages/chat-room-channeld/dist/mock-adapter.js +5 -5
  8. package/packages/chat-room-channeld/src/adapter.ts +5 -0
  9. package/packages/chat-room-channeld/src/cli.ts +72 -5
  10. package/packages/chat-room-channeld/src/host.ts +17 -2
  11. package/packages/chat-room-channeld/src/pg/database.ts +187 -0
  12. package/packages/chat-room-channeld/src/pg/migrate.ts +150 -0
  13. package/packages/chat-room-channeld/src/pg/schema.ts +60 -0
  14. package/packages/chat-room-channeld/src/pg/sql.mjs +175 -0
  15. package/packages/chat-room-channeld/src/pg/sqlite.ts +100 -0
  16. package/packages/chat-room-channeld/src/pg/worker.mjs +133 -0
  17. package/packages/chat-room-channeld/src/protocol.ts +1 -0
  18. package/packages/chat-room-channeld/src/state.ts +73 -97
  19. package/packages/chat-room-channeld/src/stats.ts +140 -109
  20. package/server/assets/base.css +3 -1
  21. package/server/assets/chat/admin-badge.js +32 -30
  22. package/server/assets/chat/admin.js +201 -161
  23. package/server/assets/chat/announcements.js +302 -208
  24. package/server/assets/chat/attachment-store.js +116 -76
  25. package/server/assets/chat/attachments.js +701 -441
  26. package/server/assets/chat/chat-background.js +179 -156
  27. package/server/assets/chat/clipboard.js +45 -25
  28. package/server/assets/chat/confirm-dialog.js +38 -35
  29. package/server/assets/chat/copy-action.js +40 -41
  30. package/server/assets/chat/create-room-dialog.js +50 -47
  31. package/server/assets/chat/diagram-viewer.js +293 -236
  32. package/server/assets/chat/doc-preview.js +516 -443
  33. package/server/assets/chat/editor.js +446 -336
  34. package/server/assets/chat/events.js +650 -510
  35. package/server/assets/chat/files.js +505 -431
  36. package/server/assets/chat/history-loader.js +81 -73
  37. package/server/assets/chat/icons.js +9 -11
  38. package/server/assets/chat/image-zoom.js +246 -179
  39. package/server/assets/chat/index.js +2 -3
  40. package/server/assets/chat/install-prompt.js +90 -69
  41. package/server/assets/chat/integration-account-schema.js +91 -87
  42. package/server/assets/chat/integration-editor.js +162 -155
  43. package/server/assets/chat/integration-values.js +116 -101
  44. package/server/assets/chat/integrations.js +750 -626
  45. package/server/assets/chat/join-requests.js +415 -358
  46. package/server/assets/chat/locales/de.js +193 -194
  47. package/server/assets/chat/locales/es.js +193 -194
  48. package/server/assets/chat/locales/fr.js +193 -194
  49. package/server/assets/chat/locales/index.js +1 -2
  50. package/server/assets/chat/locales/it.js +193 -194
  51. package/server/assets/chat/locales/ja.js +193 -193
  52. package/server/assets/chat/locales/ko.js +193 -193
  53. package/server/assets/chat/markdown-footnotes.js +134 -103
  54. package/server/assets/chat/markdown.js +557 -404
  55. package/server/assets/chat/members.js +259 -197
  56. package/server/assets/chat/mentions.js +181 -133
  57. package/server/assets/chat/message-cache.js +40 -33
  58. package/server/assets/chat/message-polling.js +299 -227
  59. package/server/assets/chat/message-window.js +78 -55
  60. package/server/assets/chat/messages.js +562 -480
  61. package/server/assets/chat/office-preview.js +46 -45
  62. package/server/assets/chat/palette.js +464 -417
  63. package/server/assets/chat/panels.js +94 -79
  64. package/server/assets/chat/pwa.js +147 -75
  65. package/server/assets/chat/questions.js +374 -302
  66. package/server/assets/chat/recall.js +338 -273
  67. package/server/assets/chat/receipts.js +151 -121
  68. package/server/assets/chat/reminders.js +345 -214
  69. package/server/assets/chat/replies.js +181 -130
  70. package/server/assets/chat/resource-format.js +59 -62
  71. package/server/assets/chat/room-list.js +58 -55
  72. package/server/assets/chat/room-watcher.js +76 -50
  73. package/server/assets/chat/rooms.js +631 -500
  74. package/server/assets/chat/search.js +138 -114
  75. package/server/assets/chat/settings.js +225 -201
  76. package/server/assets/chat/shiki.js +62 -63
  77. package/server/assets/chat/shortcuts.js +212 -189
  78. package/server/assets/chat/side-pane.js +161 -150
  79. package/server/assets/chat/state.js +860 -737
  80. package/server/assets/chat/system-events.js +46 -44
  81. package/server/assets/chat/system-messages.js +57 -56
  82. package/server/assets/chat/task-form.js +179 -183
  83. package/server/assets/chat/task-row.js +158 -155
  84. package/server/assets/chat/tasks.js +665 -587
  85. package/server/assets/chat/viewport.js +32 -29
  86. package/server/assets/chat/window-controls.js +32 -32
  87. package/server/assets/conversation.css +10 -4
  88. package/server/chat-server.ts +9 -1
  89. package/server/chat.html +3 -1
  90. package/server/routes/pages.ts +7 -5
  91. package/server/sw.js +346 -268
  92. package/src/web/integration-rules-editor.ts +2 -0
@@ -1,664 +1,761 @@
1
1
  import { extraLocales } from "./locales/index.js";
2
-
3
2
  // Upper bound on messages kept in memory per open room; older pages load on scroll.
4
3
  export const LOADED_MESSAGE_LIMIT = 5000;
5
-
6
4
  export const app = {
7
- $: (selector) => document.querySelector(selector),
8
- state: {
9
- room: null, myName: "", unread: 0, drafts: new Map(), rooms: new Map(),
10
- pollGeneration: 0, navigationGeneration: 0, draftRevision: new Map(), memberSessions: new Map(),
11
- retryingFailedIds: new Set(), pollController: null, memberRefreshTimer: 0, receiptRefreshTimer: 0, receiptObservationFrame: 0,
12
- receiptObservation: null,
13
- memberApiUnavailable: new Set(), receiptApiUnavailable: new Set(),
14
- receipts: new Map(), acknowledgedMessages: new Map(), pendingAcknowledgements: new Map(),
15
- pendingAction: null, watcherTimer: 0, restored: false, resizeScrollAdjusting: false, layoutScrollAdjusting: false,
16
- readAnchorGuard: null, userScrollIntentUntil: 0, listMetrics: { height: 0, top: 0, client: 0 }, followBottom: true, threadPointerDown: false,
17
- },
18
- rendered: 0,
19
- firstMessageId: null,
20
- locale: "en",
21
- pollDelay: 2000,
22
- copyTimer: 0,
23
- failedRenderIds: new Set(),
5
+ $: (selector) => document.querySelector(selector),
6
+ state: {
7
+ room: null, myName: "", unread: 0, drafts: new Map(), rooms: new Map(),
8
+ pollGeneration: 0, navigationGeneration: 0, draftRevision: new Map(), memberSessions: new Map(),
9
+ retryingFailedIds: new Set(), pollController: null, memberRefreshTimer: 0, receiptRefreshTimer: 0, receiptObservationFrame: 0,
10
+ receiptObservation: null,
11
+ memberApiUnavailable: new Set(), receiptApiUnavailable: new Set(),
12
+ receipts: new Map(), acknowledgedMessages: new Map(), pendingAcknowledgements: new Map(),
13
+ pendingAction: null, watcherTimer: 0, restored: false, resizeScrollAdjusting: false, layoutScrollAdjusting: false,
14
+ readAnchorGuard: null, userScrollIntentUntil: 0, listMetrics: { height: 0, top: 0, client: 0 }, followBottom: true, threadPointerDown: false,
15
+ },
16
+ rendered: 0,
17
+ firstMessageId: null,
18
+ locale: "en",
19
+ pollDelay: 2000,
20
+ copyTimer: 0,
21
+ failedRenderIds: new Set(),
22
+ };
23
+ const $ = (selector) => {
24
+ const element = app.$(selector);
25
+ if (!element)
26
+ throw new Error(`Missing element: ${selector}`);
27
+ return element;
24
28
  };
25
-
26
29
  // Phones and tablets lack the hardware keyboard the shortcut hint assumes.
27
30
  // iPadOS reports a desktop Macintosh UA, so touch points identify it there.
28
31
  export function isMobileDevice() {
29
- const ua = navigator.userAgent || "";
30
- return /Android|iPhone|iPad|iPod/i.test(ua) || (/Macintosh/.test(ua) && (navigator.maxTouchPoints || 0) > 1);
32
+ const ua = navigator.userAgent || "";
33
+ return /Android|iPhone|iPad|iPod/i.test(ua) || (/Macintosh/.test(ua) && (navigator.maxTouchPoints || 0) > 1);
31
34
  }
32
-
33
35
  export function createRandomId() {
34
- const crypto = globalThis.crypto;
35
- if (crypto?.randomUUID) return crypto.randomUUID();
36
- if (!crypto?.getRandomValues) throw new Error("Secure session ID generation is unavailable");
37
- const bytes = crypto.getRandomValues(new Uint8Array(16));
38
- bytes[6] = (bytes[6] & 15) | 64;
39
- bytes[8] = (bytes[8] & 63) | 128;
40
- const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
41
- return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
36
+ const crypto = globalThis.crypto;
37
+ if (crypto?.randomUUID)
38
+ return crypto.randomUUID();
39
+ if (!crypto?.getRandomValues)
40
+ throw new Error("Secure session ID generation is unavailable");
41
+ const bytes = crypto.getRandomValues(new Uint8Array(16));
42
+ bytes[6] = (bytes[6] & 15) | 64;
43
+ bytes[8] = (bytes[8] & 63) | 128;
44
+ const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, "0")).join("");
45
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
42
46
  }
43
-
44
47
  // Media cached by the service worker belongs to a browser identity; drop it whenever
45
48
  // that identity changes and keep only the current identity record.
46
49
  const clearMediaCache = () => {
47
- try { globalThis.navigator?.serviceWorker?.controller?.postMessage({ type: "CLEAR_MEDIA_CACHE" }); } catch { /* Cache cleanup is best effort. */ }
48
- };
49
-
50
- export function createAuth(storage, fetcher, translate = (key) => key, sessionStore) {
51
- const memory = Object.create(null);
52
- let browserIdentity, identityPersistent = false, identityConflict = false;
53
- const identityKey = "chat.browserIdentity";
54
- const validSessionID = (id) => typeof id === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(id);
55
- const parseIdentity = (value) => {
56
- try {
57
- const identity = JSON.parse(value);
58
- return validSessionID(identity?.sessionID) && typeof identity.name === "string" && identity.name.length <= 64
59
- ? { sessionID: identity.sessionID, name: identity.name } : undefined;
60
- } catch { return undefined; }
61
- };
62
- const read = (key) => {
63
- if (Object.hasOwn(memory, key)) return memory[key];
64
- try { return (storage ?? globalThis.localStorage).getItem(key); } catch { return null; }
65
- };
66
- const write = (key, value) => {
67
- const stored = value == null ? null : String(value);
68
- try {
69
- const store = storage ?? globalThis.localStorage;
70
- if (stored == null) store.removeItem(key);
71
- else store.setItem(key, stored);
72
- delete memory[key];
73
- } catch { memory[key] = stored; }
74
- };
75
- const readSession = (key) => {
76
- try { return (sessionStore ?? globalThis.sessionStorage).getItem(key); } catch { return null; }
77
- };
78
- const writeSession = (key, value) => {
79
- try {
80
- const store = sessionStore ?? globalThis.sessionStorage;
81
- if (value == null) store.removeItem(key);
82
- else store.setItem(key, value);
83
- } catch { /* Tab-scoped state is best effort. */ }
84
- };
85
- const syncTabIdentity = () => {
86
- writeSession("chat.sessionID", browserIdentity.sessionID);
87
- writeSession("chat.name", browserIdentity.name || null);
88
- };
89
- const ensureIdentity = () => {
90
- if (browserIdentity) return browserIdentity;
91
- const priorID = readSession("chat.sessionID");
92
- let store;
93
50
  try {
94
- store = storage ?? globalThis.localStorage;
95
- const canonical = parseIdentity(store.getItem(identityKey));
96
- if (canonical) {
97
- browserIdentity = canonical;
98
- identityPersistent = true;
99
- if (priorID && priorID !== canonical.sessionID) { clearMediaCache(); void postMediaIdentity(); }
100
- syncTabIdentity();
101
- return canonical;
102
- }
103
- } catch { /* Keep this tab's identity in memory when storage is blocked. */ }
104
- browserIdentity = { sessionID: validSessionID(priorID) ? priorID : createRandomId(), name: validSessionID(priorID) ? (readSession("chat.name") || "").slice(0, 64) : "" };
105
- if (priorID && priorID !== browserIdentity.sessionID) { clearMediaCache(); void postMediaIdentity(); }
106
- syncTabIdentity();
107
- try {
108
- store ||= storage ?? globalThis.localStorage;
109
- store.setItem(identityKey, JSON.stringify(browserIdentity));
110
- const saved = parseIdentity(store.getItem(identityKey));
111
- if (saved?.sessionID === browserIdentity.sessionID) { browserIdentity = saved; identityPersistent = true; }
112
- else if (saved) identityConflict = true;
113
- } catch { /* This page keeps its in-memory identity without claiming persistence. */ }
114
- return browserIdentity;
115
- };
116
- const identityError = () => {
117
- const error = new Error(translate("identityChanged"));
118
- error.identityConflict = true;
119
- return error;
120
- };
121
- const assertIdentity = () => {
122
- ensureIdentity();
123
- if (identityConflict) throw identityError();
124
- try {
125
- const current = parseIdentity((storage ?? globalThis.localStorage).getItem(identityKey));
126
- if (current && current.sessionID !== browserIdentity.sessionID || identityPersistent && !current) {
127
- identityConflict = true;
128
- throw identityError();
129
- }
130
- if (current) identityPersistent = true;
131
- } catch (error) {
132
- if (error?.identityConflict) throw error;
133
- identityPersistent = false;
134
- }
135
- };
136
- const saveIdentity = () => {
137
- if (!identityPersistent) return;
138
- try {
139
- const store = storage ?? globalThis.localStorage;
140
- const current = parseIdentity(store.getItem(identityKey));
141
- if (current?.sessionID !== browserIdentity.sessionID) { identityConflict = true; return; }
142
- store.setItem(identityKey, JSON.stringify(browserIdentity));
143
- if (parseIdentity(store.getItem(identityKey))?.sessionID !== browserIdentity.sessionID) identityConflict = true;
144
- } catch { /* Keep the preferred name in memory when persistence is blocked. */ }
145
- };
146
- const auth = {
147
- get sessionID() {
148
- return ensureIdentity().sessionID;
149
- },
150
- get roomId() {
151
- const active = readSession("chat.roomId");
152
- if (active) return active;
153
- const legacy = read("chat.roomId");
154
- if (legacy) writeSession("chat.roomId", legacy);
155
- return legacy || "";
156
- },
157
- set roomId(value) { writeSession("chat.roomId", value || null); write("chat.roomId", null); },
158
- get name() { return ensureIdentity().name; },
159
- set name(value) { ensureIdentity(); browserIdentity.name = String(value ?? "").slice(0, 64); writeSession("chat.name", browserIdentity.name || null); saveIdentity(); },
160
- get token() { return read("chat.token") || ""; }, set token(value) { write("chat.token", value || null); },
161
- get locale() { return read("chat.locale") || "en"; }, set locale(value) { write("chat.locale", value || null); },
162
- get theme() { return read("chat.theme") || "system"; }, set theme(value) { write("chat.theme", value || null); },
163
- get customTheme() { return read("chat.customTheme") || "#22695c"; }, set customTheme(value) { write("chat.customTheme", value || null); },
164
- get windowFrame() {
165
- return read("chat.windowFrame") === "borderless" ? "borderless" : "framed";
166
- },
167
- set windowFrame(value) { write("chat.windowFrame", value === "borderless" ? "borderless" : "framed"); },
168
- get contentTransition() { return read("chat.contentTransition") === "1"; }, set contentTransition(value) { write("chat.contentTransition", value ? "1" : null); },
169
- get panelMode() {
170
- try {
171
- const value = JSON.parse(read("chat.panelMode") || "{}");
172
- return value && typeof value === "object" && !Array.isArray(value) ? value : {};
173
- } catch { return {}; }
174
- },
175
- set panelMode(value) { write("chat.panelMode", JSON.stringify(value || {})); },
176
- get pageStep() { const raw = read("chat.pageStep"); const value = Number(raw); return raw !== null && raw !== "" && Number.isFinite(value) ? Math.min(200, Math.max(20, Math.round(value))) : 90; }, set pageStep(value) { const next = Number(value); write("chat.pageStep", Number.isFinite(next) ? String(Math.min(200, Math.max(20, Math.round(next)))) : null); },
177
-
178
- get joinedRoomIds() {
179
- try {
180
- const ids = JSON.parse(readSession("chat.joinedRoomIds") || "[]");
181
- return Array.isArray(ids) ? [...new Set(ids.filter((id) => typeof id === "string"))] : [];
182
- } catch { return []; }
183
- },
184
- set joinedRoomIds(ids) { writeSession("chat.joinedRoomIds", JSON.stringify([...new Set(ids)])); },
185
- get roomNames() { try { return JSON.parse(readSession("chat.roomNames") || "{}"); } catch { return {}; } },
186
- set roomNames(value) { writeSession("chat.roomNames", JSON.stringify(value)); },
187
- get drafts() { try { return JSON.parse(readSession("chat.drafts") || "{}"); } catch { return {}; } },
188
- set drafts(value) { writeSession("chat.drafts", JSON.stringify(value)); },
189
- get replyDrafts() { try { return JSON.parse(readSession("chat.replyDrafts") || "{}"); } catch { return {}; } },
190
- set replyDrafts(value) { writeSession("chat.replyDrafts", JSON.stringify(value)); },
191
- get positions() { try { return JSON.parse(readSession("chat.positions") || "{}"); } catch { return {}; } },
192
- set positions(value) { writeSession("chat.positions", JSON.stringify(value)); },
193
- get readTs() { try { return JSON.parse(readSession("chat.readTs") || "{}"); } catch { return {}; } },
194
- set readTs(value) { writeSession("chat.readTs", JSON.stringify(value)); },
195
- get failedMessages() {
196
- try {
197
- const value = JSON.parse(readSession("chat.failedMessages") || "{}");
198
- return value && typeof value === "object" && !Array.isArray(value) ? value : {};
199
- } catch { return {}; }
200
- },
201
- set failedMessages(value) { writeSession("chat.failedMessages", JSON.stringify(value)); },
202
- };
203
- const saveToken = (value) => {
204
- const next = String(value ?? "").trim();
205
- const changed = next !== auth.token;
206
- auth.token = next;
207
- // A token change can change what the person may see, so cached images must not
208
- // survive into the new identity. An empty value is the sign-out path.
209
- if (changed) { clearMediaCache(); void postMediaIdentity(); }
210
- return auth.token;
211
- };
212
- const apiResponse = async (url, options = {}) => {
213
- assertIdentity();
214
- const headers = { ...options.headers };
215
- if (typeof options.body === "string" && !headers["Content-Type"]) headers["Content-Type"] = "application/json";
216
- if (auth.token) headers.Authorization = `Bearer ${auth.token}`;
217
- let response;
218
- try { response = await (fetcher ?? globalThis.fetch)(url, { ...options, headers }); }
219
- catch {
220
- const error = new Error(translate("networkError"));
221
- error.network = true;
222
- throw error;
223
- }
224
- assertIdentity();
225
- if (!response.ok) {
226
- const data = await response.clone().json().catch(() => ({}));
227
- assertIdentity();
228
- const error = new Error(data.error || translate("requestFailed", { status: response.status }));
229
- error.status = response.status;
230
- throw error;
51
+ globalThis.navigator?.serviceWorker?.controller?.postMessage({ type: "CLEAR_MEDIA_CACHE" });
231
52
  }
232
- return response;
233
- };
234
- const api = async (url, options) => {
235
- const response = await apiResponse(url, options), data = await response.json().catch(() => ({}));
236
- assertIdentity(); return data;
237
- };
238
- const apiBlob = async (url, options) => {
239
- const response = await apiResponse(url, options), blob = await response.blob();
240
- assertIdentity(); return blob;
241
- };
242
- return { LS: auth, saveToken, api, apiBlob };
53
+ catch { /* Cache cleanup is best effort. */ }
54
+ };
55
+ export function createAuth(storage, fetcher, translate = (key) => key, sessionStore) {
56
+ const memory = Object.create(null);
57
+ let browserIdentity, identityPersistent = false, identityConflict = false;
58
+ const identityKey = "chat.browserIdentity";
59
+ const validSessionID = (id) => typeof id === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(id);
60
+ const parseIdentity = (value) => {
61
+ try {
62
+ const identity = JSON.parse(value ?? "null");
63
+ return validSessionID(identity?.sessionID) && typeof identity.name === "string" && identity.name.length <= 64
64
+ ? { sessionID: identity.sessionID, name: identity.name } : undefined;
65
+ }
66
+ catch {
67
+ return undefined;
68
+ }
69
+ };
70
+ const read = (key) => {
71
+ if (Object.hasOwn(memory, key))
72
+ return memory[key];
73
+ try {
74
+ return (storage ?? globalThis.localStorage).getItem(key);
75
+ }
76
+ catch {
77
+ return null;
78
+ }
79
+ };
80
+ const write = (key, value) => {
81
+ const stored = value == null ? null : String(value);
82
+ try {
83
+ const store = storage ?? globalThis.localStorage;
84
+ if (stored == null)
85
+ store.removeItem(key);
86
+ else
87
+ store.setItem(key, stored);
88
+ delete memory[key];
89
+ }
90
+ catch {
91
+ memory[key] = stored;
92
+ }
93
+ };
94
+ const readSession = (key) => {
95
+ try {
96
+ return (sessionStore ?? globalThis.sessionStorage).getItem(key);
97
+ }
98
+ catch {
99
+ return null;
100
+ }
101
+ };
102
+ const writeSession = (key, value) => {
103
+ try {
104
+ const store = sessionStore ?? globalThis.sessionStorage;
105
+ if (value == null)
106
+ store.removeItem(key);
107
+ else
108
+ store.setItem(key, value);
109
+ }
110
+ catch { /* Tab-scoped state is best effort. */ }
111
+ };
112
+ const syncTabIdentity = (identity) => {
113
+ writeSession("chat.sessionID", identity.sessionID);
114
+ writeSession("chat.name", identity.name || null);
115
+ };
116
+ const ensureIdentity = () => {
117
+ if (browserIdentity)
118
+ return browserIdentity;
119
+ const priorID = readSession("chat.sessionID");
120
+ let store;
121
+ try {
122
+ store = storage ?? globalThis.localStorage;
123
+ const canonical = parseIdentity(store.getItem(identityKey));
124
+ if (canonical) {
125
+ browserIdentity = canonical;
126
+ identityPersistent = true;
127
+ if (priorID && priorID !== canonical.sessionID) {
128
+ clearMediaCache();
129
+ void postMediaIdentity();
130
+ }
131
+ syncTabIdentity(canonical);
132
+ return canonical;
133
+ }
134
+ }
135
+ catch { /* Keep this tab's identity in memory when storage is blocked. */ }
136
+ browserIdentity = { sessionID: validSessionID(priorID) ? priorID : createRandomId(), name: validSessionID(priorID) ? (readSession("chat.name") || "").slice(0, 64) : "" };
137
+ if (priorID && priorID !== browserIdentity.sessionID) {
138
+ clearMediaCache();
139
+ void postMediaIdentity();
140
+ }
141
+ syncTabIdentity(browserIdentity);
142
+ try {
143
+ store ||= storage ?? globalThis.localStorage;
144
+ store.setItem(identityKey, JSON.stringify(browserIdentity));
145
+ const saved = parseIdentity(store.getItem(identityKey));
146
+ if (saved?.sessionID === browserIdentity.sessionID) {
147
+ browserIdentity = saved;
148
+ identityPersistent = true;
149
+ }
150
+ else if (saved)
151
+ identityConflict = true;
152
+ }
153
+ catch { /* This page keeps its in-memory identity without claiming persistence. */ }
154
+ return browserIdentity;
155
+ };
156
+ const identityError = () => {
157
+ const error = new Error(translate("identityChanged"));
158
+ error.identityConflict = true;
159
+ return error;
160
+ };
161
+ const assertIdentity = () => {
162
+ const identity = ensureIdentity();
163
+ if (identityConflict)
164
+ throw identityError();
165
+ try {
166
+ const current = parseIdentity((storage ?? globalThis.localStorage).getItem(identityKey));
167
+ if (current && current.sessionID !== identity.sessionID || identityPersistent && !current) {
168
+ identityConflict = true;
169
+ throw identityError();
170
+ }
171
+ if (current)
172
+ identityPersistent = true;
173
+ }
174
+ catch (error) {
175
+ if (error instanceof Error && "identityConflict" in error && error.identityConflict)
176
+ throw error;
177
+ identityPersistent = false;
178
+ }
179
+ };
180
+ const saveIdentity = () => {
181
+ if (!identityPersistent || !browserIdentity)
182
+ return;
183
+ const identity = browserIdentity;
184
+ try {
185
+ const store = storage ?? globalThis.localStorage;
186
+ const current = parseIdentity(store.getItem(identityKey));
187
+ if (current?.sessionID !== identity.sessionID) {
188
+ identityConflict = true;
189
+ return;
190
+ }
191
+ store.setItem(identityKey, JSON.stringify(identity));
192
+ if (parseIdentity(store.getItem(identityKey))?.sessionID !== identity.sessionID)
193
+ identityConflict = true;
194
+ }
195
+ catch { /* Keep the preferred name in memory when persistence is blocked. */ }
196
+ };
197
+ const auth = {
198
+ get sessionID() {
199
+ return ensureIdentity().sessionID;
200
+ },
201
+ get roomId() {
202
+ const active = readSession("chat.roomId");
203
+ if (active)
204
+ return active;
205
+ const legacy = read("chat.roomId");
206
+ if (legacy)
207
+ writeSession("chat.roomId", legacy);
208
+ return legacy || "";
209
+ },
210
+ set roomId(value) { writeSession("chat.roomId", value || null); write("chat.roomId", null); },
211
+ get name() { return ensureIdentity().name; },
212
+ set name(value) { const identity = ensureIdentity(); identity.name = String(value ?? "").slice(0, 64); writeSession("chat.name", identity.name || null); saveIdentity(); },
213
+ get token() { return read("chat.token") || ""; }, set token(value) { write("chat.token", value || null); },
214
+ get locale() { return read("chat.locale") || "en"; }, set locale(value) { write("chat.locale", value || null); },
215
+ get theme() { return read("chat.theme") || "system"; }, set theme(value) { write("chat.theme", value || null); },
216
+ get customTheme() { return read("chat.customTheme") || "#22695c"; }, set customTheme(value) { write("chat.customTheme", value || null); },
217
+ get windowFrame() {
218
+ return read("chat.windowFrame") === "borderless" ? "borderless" : "framed";
219
+ },
220
+ set windowFrame(value) { write("chat.windowFrame", value === "borderless" ? "borderless" : "framed"); },
221
+ get contentTransition() { return read("chat.contentTransition") === "1"; }, set contentTransition(value) { write("chat.contentTransition", value ? "1" : null); },
222
+ get panelMode() {
223
+ try {
224
+ const value = JSON.parse(read("chat.panelMode") || "{}");
225
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
226
+ }
227
+ catch {
228
+ return {};
229
+ }
230
+ },
231
+ set panelMode(value) { write("chat.panelMode", JSON.stringify(value || {})); },
232
+ get pageStep() { const raw = read("chat.pageStep"); const value = Number(raw); return raw !== null && raw !== "" && Number.isFinite(value) ? Math.min(200, Math.max(20, Math.round(value))) : 90; }, set pageStep(value) { const next = Number(value); write("chat.pageStep", Number.isFinite(next) ? String(Math.min(200, Math.max(20, Math.round(next)))) : null); },
233
+ get joinedRoomIds() {
234
+ try {
235
+ const ids = JSON.parse(readSession("chat.joinedRoomIds") || "[]");
236
+ return Array.isArray(ids) ? [...new Set(ids.filter((id) => typeof id === "string"))] : [];
237
+ }
238
+ catch {
239
+ return [];
240
+ }
241
+ },
242
+ set joinedRoomIds(ids) { writeSession("chat.joinedRoomIds", JSON.stringify([...new Set(ids)])); },
243
+ get roomNames() { try {
244
+ return JSON.parse(readSession("chat.roomNames") || "{}");
245
+ }
246
+ catch {
247
+ return {};
248
+ } },
249
+ set roomNames(value) { writeSession("chat.roomNames", JSON.stringify(value)); },
250
+ get drafts() { try {
251
+ return JSON.parse(readSession("chat.drafts") || "{}");
252
+ }
253
+ catch {
254
+ return {};
255
+ } },
256
+ set drafts(value) { writeSession("chat.drafts", JSON.stringify(value)); },
257
+ get replyDrafts() { try {
258
+ return JSON.parse(readSession("chat.replyDrafts") || "{}");
259
+ }
260
+ catch {
261
+ return {};
262
+ } },
263
+ set replyDrafts(value) { writeSession("chat.replyDrafts", JSON.stringify(value)); },
264
+ get positions() { try {
265
+ return JSON.parse(readSession("chat.positions") || "{}");
266
+ }
267
+ catch {
268
+ return {};
269
+ } },
270
+ set positions(value) { writeSession("chat.positions", JSON.stringify(value)); },
271
+ get readTs() { try {
272
+ return JSON.parse(readSession("chat.readTs") || "{}");
273
+ }
274
+ catch {
275
+ return {};
276
+ } },
277
+ set readTs(value) { writeSession("chat.readTs", JSON.stringify(value)); },
278
+ get failedMessages() {
279
+ try {
280
+ const value = JSON.parse(readSession("chat.failedMessages") || "{}");
281
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
282
+ }
283
+ catch {
284
+ return {};
285
+ }
286
+ },
287
+ set failedMessages(value) { writeSession("chat.failedMessages", JSON.stringify(value)); },
288
+ };
289
+ const saveToken = (value) => {
290
+ const next = String(value ?? "").trim();
291
+ const changed = next !== auth.token;
292
+ auth.token = next;
293
+ // A token change can change what the person may see, so cached images must not
294
+ // survive into the new identity. An empty value is the sign-out path.
295
+ if (changed) {
296
+ clearMediaCache();
297
+ void postMediaIdentity();
298
+ }
299
+ return auth.token;
300
+ };
301
+ const apiResponse = async (url, options = {}) => {
302
+ assertIdentity();
303
+ const headers = { ...options.headers };
304
+ if (typeof options.body === "string" && !headers["Content-Type"])
305
+ headers["Content-Type"] = "application/json";
306
+ if (auth.token)
307
+ headers.Authorization = `Bearer ${auth.token}`;
308
+ let response;
309
+ try {
310
+ response = await (fetcher ?? globalThis.fetch)(url, { ...options, headers });
311
+ }
312
+ catch {
313
+ const error = new Error(translate("networkError"));
314
+ error.network = true;
315
+ throw error;
316
+ }
317
+ assertIdentity();
318
+ if (!response.ok) {
319
+ const data = await response.clone().json().catch(() => ({}));
320
+ assertIdentity();
321
+ const error = new Error(data.error || translate("requestFailed", { status: response.status }));
322
+ error.status = response.status;
323
+ throw error;
324
+ }
325
+ return response;
326
+ };
327
+ const api = async (url, options) => {
328
+ const response = await apiResponse(url, options), data = await response.json().catch(() => ({}));
329
+ assertIdentity();
330
+ return data;
331
+ };
332
+ const apiBlob = async (url, options) => {
333
+ const response = await apiResponse(url, options), blob = await response.blob();
334
+ assertIdentity();
335
+ return blob;
336
+ };
337
+ return { LS: auth, saveToken, api, apiBlob };
243
338
  }
244
-
245
339
  export const messages = {
246
- en: {
247
- brand: "OC Chat", documentTitle: "OC Chat",
248
- roomTitle: ({ name }) => `${name} · OC Chat`,
249
- tagline: "A lightweight chat room. Enter a room ID to join, or create a new one.",
250
- restoringSession: "Restoring your session…", retry: "Retry", roomOptions: "Options",
251
- languageLabel: "Language", roomIdLabel: "Room ID", roomIdPlaceholder: "Paste or enter a room ID",
252
- nameLabel: "Your name", namePlaceholder: "What should we call you?", joinRoom: "Join room",
253
- or: "or", newRoomNameLabel: "New room name", newRoomNamePlaceholder: "e.g. Weekend movie night",
254
- createRoom: "Create room", joinRoomTitle: "Join a room", joinRoomHint: "Someone shared a room ID with you? Paste it here.",
255
- createRoomTitle: "Create a room", createRoomHint: "Start a new room and invite people with its ID.",
256
- requireApproval: "Require approval to join", requireApprovalHint: "New members need a human administrator's approval. Agents may also be approved by the administrator agent.",
257
- joinPolicyEditHint: "New members need a human administrator's approval. Turning this off clears all pending requests.", joinPolicyOpenConfirm: "Turn off approval? All pending join requests will be cleared.",
258
- approvalRequired: "Approval required", joinRequired: "Approval required", joinPendingStatus: "Approval pending",
259
- joinPendingTitle: "Waiting for approval", joinApprovalPrompt: ({ name }) => `Request to join “${name}”? A human administrator must approve it.`, joinPendingBody: ({ name }) => `Your request to join “${name}” was sent. A human administrator must approve it before you can join.`,
260
- joinPendingHint: "You can leave this page; the request stays pending. Check the room list later.", joinPendingNotice: ({ name }) => `Request sent to join “${name}”. Waiting for a human administrator.`, joinPendingCancel: "Cancel request", joinPendingCancelError: "Could not cancel the request. Try again.",
261
- joinPendingGoneTitle: "Request not pending", joinPendingGoneBody: "It may have been denied or cleared. You can send a new request.", joinPendingAgain: "Request again",
262
- joinPendingError: "Could not check the request. Try again.", joinPendingRoomGone: "This room is gone, or you no longer have access.",
263
- joinNameTaken: "That name is already used in this room. Choose another name.",
264
- joinRequestsTitle: "Join requests", joinRequestsHint: "Agent requests can also be approved by the administrator agent.", joinRequestsEmpty: "No pending requests.",
265
- joinRequestsLoadFailed: "Could not load join requests.", joinRequestAlreadyHandled: "This request was already handled.", joinRequestApprove: "Approve", joinRequestDeny: "Deny", joinRequestAgent: "Agent", joinRequestHuman: "Human",
266
- joinRequestApproveLabel: ({ name }) => `Approve ${name}`, joinRequestDenyLabel: ({ name }) => `Deny ${name}`,
267
- joinRequestTime: ({ time }) => `Requested ${time}`, joinRequestApproved: ({ name }) => `${name} approved.`, joinRequestDenied: ({ name }) => `${name} denied.`,
268
- joinRequestActionFailed: ({ message }) => `Could not update the request: ${message}`, membersWithRequests: ({ count }) => `Members, ${count} join request${count === 1 ? "" : "s"} pending`,
269
- accessKeyTitle: "Access key", accessKeyHint: "This server asks for an access key. It stays in this browser and is sent with each request.",
270
- tokenOptional: "Access token (optional)", bearerToken: "Bearer token",
271
- tokenPlaceholder: "Enter if the server requires it", save: "Save",
272
- tokenHint: "If the server requires an access token (401), all requests will include it.",
273
- existingRooms: "Rooms", noRooms: "No rooms yet. Create one.", copyRoomId: "Copy room ID", loadingHistory: "Loading earlier messages",
274
- editRoom: "Edit room", editRoomSections: "Edit room sections", editRoomDetails: "Room details", editRoomJoining: "Joining & approval", editRoomMembers: "Members & roles", editRoomOwnership: "Ownership", roomOwnerOnlyTitle: "Owner or administrator only", roomOwnerOnlyNote: ({ owner }) => `Only the room owner or a room administrator can change these settings. This room belongs to ${owner}.`, roomNameLabel: "Room name", roomDescriptionLabel: "Description", adminAgentLabel: "Administrator agent", roomOwnerBadge: "Owner", roomAdminBadge: "Admin",
275
- adminIdsLabel: "Human administrators", adminIdsHint: "These members can edit room details, manage members, delete files, and choose a successor. The owner always has the same powers.", adminIdsEmpty: "No other members are in this room yet.", newOwnerLabel: "New owner", newOwnerHint: "Hand the room to another person who is in it. Only the owner can do this; agents cannot own a room.",
276
- successorLabel: "Successor if the owner leaves", successorNone: "Longest-present member", successorHint: "If the owner leaves, this person becomes owner. If an administrator leaves, this person takes that role. Leave empty to use the longest-present member.", ownerOnlySettingsNote: "Only the owner can change the administrator agent or hand off the room.", adminAgentHint: "The designated agent can use the admin tool to inspect this room and its history. Only the owner can change this; leave empty for none.",
277
- noAdminAgent: "None", openQuestions: ({ count }) => `${count} unanswered question${count === 1 ? "" : "s"}`,
278
- newRoom: "Create a room",
279
- copyRoomIdTitle: ({ id }) => `Click to copy the full room ID: ${id}`, copied: "Copied",
280
- members: "Members", membersCount: ({ count }) => `Members (${count})`, noMembers: "No members yet.", profileMenu: "Your profile and settings",
281
- questions: "Questions", pendingQuestions: "Pending questions", refreshQuestions: "Refresh",
282
- announcements: "Announcements", announcementName: "Name", announcementContent: "Content",
283
- reminders: "Reminders", reminderSchedule: "Schedule", reminderOnce: "One time", reminderDate: "Date and time",
284
- reminderCron: "5-field CRON expression", reminderTimezone: "Timezone override (optional)", reminderTimezoneHint: "Leave blank to use the server timezone. An IANA timezone applies to both schedule types. The server rejects one-time times skipped or repeated by daylight-saving changes.",
285
- reminderText: "Reminder text", reminderTemplateHint: "Use {{time}}, {{initiator}}, and {{room}} in your message.", reminderCreate: "Create reminder",
286
- reminderLoading: "Loading reminders…", reminderEmpty: "No reminders yet.", reminderPaused: "Paused", reminderNext: ({ time }) => `Next: ${time}`,
287
- reminderPause: "Pause", reminderResume: "Resume", reminderDelete: "Delete", reminderDeleteConfirm: "Delete this reminder?",
288
- reminderEdit: "Edit", reminderEditHeading: "Edit reminder", reminderSave: "Save changes",
289
- reminderCreated: "Reminder created.", reminderUpdated: "Reminder updated.", reminderDeleted: "Reminder deleted.",
290
- reminderInvalid: "Check the date, 5-field CRON expression, IANA timezone, and reminder text.", reminderLoadFailed: "Could not load reminders. Your draft is still here.",
291
- diagramLoading: "Rendering diagram…", diagramRenderFailed: "Diagram unavailable; showing its source.", resourceLoading: "Loading file…", resourceFailed: "This file could not be loaded.", resourceDownload: "Download", resourceMoreActions: "More actions for {name}", resourcePreview: "Preview", resourceHide: "Hide preview", docPreviewEyebrow: "Markdown preview", docPreviewFileEyebrow: "File preview", docPreviewFailed: "This document could not be loaded.", docPreviewEmpty: "This document is empty.", docPreviewTooLarge: "This file is too large to preview (over 2 MB). Download it instead.", docPreviewOfficeTooLarge: "This Office file is too large to preview (over 20 MB). Download it instead.", docPreviewFullscreen: "Full screen", docPreviewExitFullscreen: "Exit full screen", docPreviewOfficeFailed: "This Office file could not be previewed. Download it instead.", sidePaneResize: "Resize side pane", zoomImage: "Open image", imagePreviewTitle: "Image preview", imageZoomControls: "Image zoom", zoomIn: "Zoom in", zoomOut: "Zoom out", zoomReset: "Reset zoom", openDiagram: "Open diagram", diagramViewerTitle: "Diagram", diagramZoomControls: "Diagram zoom", diagramFit: "Fit", installTitle: "Install OC Chat", installBody: "Add it to your home screen for a full-screen chat.", installAction: "Install", installHow: "How to install", installNotNow: "Not now", installIosGuide: "Tap Share, then Add to Home Screen.",
292
- pwaUpdateTitle: "Update available", pwaUpdateBody: "A new version is ready. Reload now, or update the next time you open the app.", pwaUpdateNow: "Update now", pwaUpdateLater: "Later",
293
- announcementDelete: "Delete announcement",
294
- announcementNew: "New announcement", announcementEmpty: "No announcements yet.", announcementLoading: "Loading announcements…",
295
- announcementLoadFailed: "Could not load announcements. Your draft is still here.", announcementSaved: "Announcement saved.", announcementDeleted: "Announcement deleted.",
296
- announcementDuplicate: "That name already exists. Select it to edit, or choose another name.", announcementDeleteConfirm: ({ name }) => `Delete “${name}”?`, announcementCount: ({ count }) => `${count} / 5000`, announcementInvalid: "Use a name of 1–64 characters and content up to 5000 characters.",
297
- questionsLoading: "Loading questions…", questionsEmpty: "No unanswered questions.",
298
- questionsFailed: "Could not load questions. Try again.", questionsUnsupported: "Unanswered questions are unavailable on this server.", questionLabel: "Question",
299
- answerQuestion: "Reply", answerPlaceholder: "Write a reply…", sendAnswer: "Send reply", selectQuestion: "Reply to question", copyQuestion: "Copy question", questionCopied: "Question copied.", questionCopyFailed: "Could not copy question.",
300
- answerFailed: "Reply failed. Your draft is still here.", answerTooLong: "Reply must be 5,000 characters or fewer.", questionAlreadyAnswered: "This question was answered elsewhere.",
301
- adminBindingGuide: "Choose a room and an Agent in it. Send the invitation privately to finish setup.", adminRoomLabel: "Administrator room", adminDesignateAgent: "Invite Agent",
302
- settings: "Settings", adminAccess: "Administration", adminToken: "Administration token", openAdministration: "Open administration", administration: "Administration", designations: "Designations", adminRoom: "Administrator room", targetRoom: "Agent membership room", adminScopeNote: "Choose an Agent in the administrator room. Administrators can manage all rooms.", targetAgent: "Registered agent", designate: "Designate administrator", revokeDesignation: "Revoke designation", globalStatus: "Global status", adminTasks: "Tasks", taskText: "Task", dispatchTask: "Dispatch task", timers: "Timers", planName: "Timer name", createTimer: "Create timer", tokenRequired: "The server requires an access token (401).",
303
- themeLabel: "Theme", themeSystem: "System", themeLight: "Light", themeDark: "Dark", themeForest: "Forest", themeSand: "Sand", themeCustom: "Custom", themeCustomColor: "Custom theme color",
304
- windowFrameLabel: "Display mode", windowFrameHint: "Fill window uses the entire window; Window mode keeps the inset card border.",
305
- windowFrameFramed: "Window mode", windowFrameBorderless: "Fill window",
306
- chatBackgroundLabel: "Chat background", chatBackgroundHint: "Fills the browser window behind the app in this browser only. A lower opacity keeps text readable.",
307
- chatBackgroundMode: "Mode", chatBackgroundDefault: "Default", chatBackgroundColor: "Color", chatBackgroundImage: "Image",
308
- chatBackgroundOpacity: "Opacity", chatBackgroundScope: "Scope", chatBackgroundScopeRoom: "This room", chatBackgroundScopeAll: "All rooms",
309
- chatBackgroundReset: "Reset", chatBackgroundTooLarge: "Choose an image of 2 MiB or less.",
310
- chatBackgroundInvalidType: "Choose an image file.",
311
- chatBackgroundApplying: "Reading {name}…", chatBackgroundApplied: "{name} applied.",
312
- chatBackgroundImageFailed: "Could not read this image.", chatBackgroundSaveFailed: "Could not save the background in this browser.",
313
- settingsLocalHint: "Language, theme, transition, and scrolling preferences are saved in this browser.",
314
- settingsSections: "Settings sections", settingsGeneral: "General", settingsAppearance: "Appearance", settingsConnection: "Connection",
315
- settingsLanguageHint: "Applies right away and is saved in this browser.", settingsThemeHint: "Saved in this browser. System follows your device.", settingsTokenHint: "Stored only in this browser. Needed only when the server asks for it.",
316
- settingsPanelMode: "Tool windows", settingsPanelModeHint: "Choose how each room tool opens on wide screens. Narrow or short windows always use a dialog.", panelModeDialog: "Dialog", panelModePane: "Side pane",
317
- settingsIntegrations: "Integrations",
318
- integrationsHint: "Connect rooms with external platforms through uploaded plugins. Secret values stay on the server.",
319
- integrationsExternalConfig: "This integration uses an external configuration file. Edit that file, or disable it before saving managed settings.",
320
- integrationsEnable: "Enable integrations", integrationsEnableHint: "Changes apply when you save.",
321
- integrationsAccounts: "Accounts", integrationsAddAccount: "Add account", integrationsEmptyAccounts: "No accounts yet.",
322
- integrationsPlugins: "Plugins", integrationsUploadPlugin: "Upload plugin", integrationsEmptyPlugins: "No plugins uploaded yet.",
323
- integrationsRules: "Outbound rules", integrationsRulesHint: "Outbound rules forward room events to connected accounts. Use JSON or YAML; each target must use an existing account.",
324
- integrationsInboundRules: "Inbound routes", integrationsInboundHint: "Inbound routes bring external messages into a room. Each route needs a configured account and a room.",
325
- integrationsRulesFormat: "Rules format", integrationsEditorUnavailable: "The code editor could not load. Plain text editing is available.",
326
- integrationsRulesErrors: "Fix the highlighted errors before saving ({count}). {first}",
327
- integrationsSave: "Save integrations", integrationsLoading: "Loading integrations…", integrationsLoadFailed: "Could not load integrations. Try again.",
328
- integrationsPlugin: "Plugin", integrationsEnv: "Environment values", integrationsEnvKey: "Key", integrationsEnvValue: "Value",
329
- integrationsLeaveBlank: "Leave blank to keep this stored value", integrationsEnvHint: "Entering a value replaces only that variable. Blank rows keep their stored value.",
330
- integrationsAddEnv: "Add variable", integrationsClearEnv: "Clear all variables", integrationsKeepEnv: "Keep all variables",
331
- integrationsClearEnvActive: "All stored variables will be cleared when you save.", integrationsEnvInvalid: "Use unique variable names made of letters, digits, and underscores.",
332
- integrationsAccountTitle: "Integration account", integrationsAccountId: "Account ID", integrationsAccountIdHint: "Leave blank to generate", integrationsPlatform: "Platform",
333
- integrationsAccountDetails: "Account details", integrationsAdvanced: "Advanced settings", integrationsKeepStored: "Keep stored value", integrationsNotSet: "Not set",
334
- integrationsAccountRequired: "Fill required account fields: {fields}.",
335
- integrationsAccountInvalid: "Choose a plugin; the account ID can be generated automatically.", integrationsRemoveAccountConfirm: ({ id }) => `Remove account “${id}”? It is deleted after you save the integrations.`, integrationsDuplicateAccount: "An account with this ID already exists.",
336
- integrationsAccountSaved: "Account saved. Save integrations to apply it.", integrationsAccountRemoved: "Account removed. Save integrations to apply it.",
337
- integrationsLastError: "Last error", integrationsEdit: "Edit", integrationsRemove: "Remove",
338
- integrationsInvalidJson: "Rules JSON is invalid near line {line}.", integrationsInvalidRules: "Rules must be a JSON array.",
339
- integrationsFromRequired: "Rule {index}: from must use chatroom/center.", integrationsTargetRequired: "Rule {index}, target {target}: {field} is required.",
340
- integrationsTargetMissing: "Rule {index}, target {target}: account “{account}” does not exist.",
341
- integrationsNeedAccount: "Add at least one account before saving.", integrationsPluginFirst: "Upload a plugin before adding an account.",
342
- integrationsStateStarted: "Running", integrationsStateStarting: "Starting", integrationsStateStopped: "Stopped",
343
- integrationsStateError: "Error", integrationsStateUnknown: "Unknown",
344
- integrationsPluginFile: "Choose an adapter file", integrationsPluginName: "Plugin name", integrationsPluginSource: "JavaScript source",
345
- integrationsPluginHint: "A valid adapter declares its platform and account fields from the initialize handshake. Upload does not start the account or require credentials.",
346
- integrationsDownloadPlugin: "Download {name}",
347
- integrationsPluginPaste: "Paste plugin JavaScript (max 256 KiB)", integrationsUpload: "Upload plugin",
348
- integrationsUploaded: "Plugin uploaded. Choose it for an account.", integrationsSourceTooLarge: "The plugin source must be at most 256 KiB.",
349
- integrationsNameRequired: "Use a .js, .mjs, .cjs, or .ts file name.", integrationsPlatformRequired: "Use a platform identifier of 1–128 letters, digits, dots, dashes, or underscores.",
350
- integrationsSourceRequired: "Paste or choose plugin JavaScript.",
351
- integrationsEnabled: "Integrations are enabled.", integrationsDisabled: "Integrations are disabled.", integrationsEnablePending: "Save integrations to start the runtime.",
352
- integrationsSavedEnabled: "Saved. Integrations are enabled.", integrationsDisableConfirm: "Disable integrations? Saving stops the runtime; accounts and rules stay stored.", integrationsDisabledHint: "Enable integrations and save to edit accounts, plugins, and rules.", integrationsSavedDisabled: "Saved. Integrations are disabled.",
353
- contentTransition: "Room content transition", contentTransitionHint: "Slide messages in when switching rooms with Alt+Arrow. Off by default.",
354
- pageStep: "Page scroll distance", pageStepHint: "How far PageUp and PageDown move per press, as a percentage of the conversation height. Default 90%.",
355
- adminLoading: "Loading administration…", refreshAdmin: "Refresh", adminRoomBadge: "admin", chooseAdminRoom: "Choose a normal room", chooseTargetRoom: "Choose an agent room", chooseAgent: "Choose a registered agent", taskTargetRoom: "Target room", taskTargetAgent: "Target agent", createAdminRoomFirst: "Create a normal room first, then select it as the admin room.", noAgents: "No registered agents", selectAdminAgent: "Choose an admin room and registered agent.", adminDesignated: "Administrator designation is active immediately and stays until you revoke it.", revokeConfirm: "Revoke this admin designation? The normal room will remain.", updateTask: "Update task", task_pending: "Pending", task_working: "Working", task_blocked: "Blocked", task_completed: "Completed", task_cancelled: "Cancelled", nextRun: ({ time, minutes }) => `Every ${minutes} min · next ${time}`, paused: "Paused", pauseTimer: "Pause", resumeTimer: "Resume", deleteTimer: "Delete", deleteTimerConfirm: ({ name }) => `Delete timer “${name}”?`,
356
- leave: "Leave", reconnecting: "Connection lost. Retrying…", messageList: "Message list",
357
- noMessages: "No messages yet. Say something.", latestMessages: "Back to latest messages",
358
- mentionMembers: "Choose a member to mention", messagePlaceholder: "Message · Enter to send",
359
- attachments: "Attachments", addFiles: "Add files", dropFilesHere: "Drop files here to attach",
360
- attachmentVolatile: "Pasted files are recovered after reload; picked files stay in this tab.", attachmentNotPersisted: "This file is too large to save for reload. Keep this tab open until it is sent.", retryUpload: "Retry", removeFile: "Remove",
361
- uploadQueued: "Waiting to upload", uploadReady: "Ready to send", sendAsFileFailed: "Upload failed. Your text is still in the composer.", uploadPercent: ({ percent }) => `Uploading ${percent}%`,
362
- uploadFailed: ({ reason } = {}) => reason ? `Upload failed (${reason}). Retry or remove the file.` : "Upload failed. Retry or remove the file.",
363
- fileUnreadable: "This file cannot be read: it may be a temporary file from another app, or still in the cloud. Save it to disk (or take a screenshot) and attach that.",
364
- fileTooLarge: "File exceeds the server's current size limit.",
365
- send: "Send", roomMeta: ({ members, count }) => `${members} ${members === 1 ? "member" : "members"} · ${count} ${count === 1 ? "message" : "messages"}`,
366
- joinArrow: "Join →", joinDirectTitle: "Click to join directly", mentionEmpty: "No matching members",
367
- joined: "Joined", joinAction: "Join room", unreadMessages: ({ count }) => `${count} unread`,
368
- mentionHint: "↑↓ Select · Enter to confirm · Esc to close", today: "Today", yesterday: "Yesterday",
369
-
370
- shortcutsTitle: "Keyboard shortcuts", shortcutsLead: "ChatRoom shortcuts. Press {modifier} + / to open this list.",
371
- shortcutsOpen: "All shortcuts",
372
- shortcutsWriting: "Writing", shortcutsSend: "Send the message", shortcutsNewline: "Start a new line",
373
- shortcutsMention: "Choose a member to mention", shortcutsRooms: "Rooms", shortcutsSearch: "Search and commands", shortcutsOpenPalette: "Open search and commands",
374
- shortcutsSwitchRoom: "Switch to the previous or next room", shortcutsNumberRoom: "Switch to a joined room by number", shortcutsReading: "Reading",
375
- shortcutsScroll: "Scroll messages while typing", shortcutsJump: "Jump to the start or end of the conversation", shortcutsMenus: "Menus and dialogs",
376
- shortcutsClose: "Close the open menu, panel, or dialog",
377
- paletteTitle: "Search and commands", paletteSearchLabel: "Search messages",
378
- palettePlaceholder: "Search messages, or type / for commands", paletteScopeRoom: "This room", paletteScopeAll: "All rooms",
379
- paletteScopeHint: "Tab switches between this room and all joined rooms", paletteSearchMode: "Search", paletteCommandMode: "Commands",
380
- paletteSearching: "Searching…", paletteNoResults: "No messages found.", paletteNoCommands: "No matching commands.",
381
- paletteResults: ({ count }) => `${count} result${count === 1 ? "" : "s"}`, paletteCommandsHint: "Common commands",
382
- paletteHint: "↑↓ or Alt+1–9 select · Enter open · Tab scope · Esc close", paletteSearchFailed: "Search failed. Try again.",
383
- paletteLeaveRoom: "Leave room", paletteJumpLatest: "Jump to latest",
384
- filesTitle: "Files", filesEyebrow: "Room files", filesFilter: "Uploaded by", filesEveryone: "Everyone",
385
- filesUnknownUploader: "Unknown uploader", filesSummary: ({ count, size }) => `${count} file${count === 1 ? "" : "s"} · ${size}`,
386
- filesLoading: "Loading files…", filesLoadFailed: "Could not load files. Try again.", filesEmpty: "No files in this room yet.",
387
- filesEmptyFiltered: "No files from this uploader.", filesLoadMore: "Load more",
388
- filesHint: "Preview images, audio, video, Markdown, text, code, and PDF. Download any file.",
389
- filesPreviewFailed: "Could not load this preview.", filesDownloadFailed: "Could not download this file.",
390
- filesPreviewLabel: ({ name }) => `Preview ${name}`, filesDownloadLabel: ({ name }) => `Download ${name}`,
391
- filesDeleteLabel: ({ name }) => `Delete ${name}`, filesRefresh: "Refresh files",
392
- tasksTitle: "Tasks", tasksEyebrow: "Room tasks", tasksRefresh: "Refresh tasks", tasksMenuLabel: "Task actions",
393
- tasksClearCompleted: "Clear completed", tasksClearConfirm: ({ count }) => `Clear ${count} completed task${count === 1 ? "" : "s"}? This cannot be undone.`,
394
- tasksClearFailed: "Could not clear completed tasks. Try again.",
395
- tasksLoading: "Loading tasks…", tasksLoadFailed: "Could not load tasks. Try again.", tasksEmpty: "No tasks yet. Add the first one.",
396
- tasksEmptyFiltered: "No tasks with this status.", tasksCreate: "Add task", tasksTitleLabel: "Title",
397
- tasksTitlePlaceholder: "What needs doing?", tasksDescriptionLabel: "Description", tasksDescriptionPlaceholder: "Add details, links, or acceptance notes",
398
- tasksAssigneeLabel: "Assignee", tasksUnassigned: "Unassigned", tasksFilterLabel: "Show", tasksFilterAll: "All statuses",
399
- tasksDueDateLabel: "Due date", tasksDueOn: ({ date }) => `Due ${date}`, tasksOverdue: "Overdue",
400
- tasksParticipantsLabel: "Participants", tasksParticipantsMeta: ({ names }) => `Participants: ${names}`,
401
- tasksConclusionLabel: "Conclusion", tasksConclusionPlaceholder: "What was the outcome?",
402
- tasksStepsLabel: "Steps", tasksAddStep: "Add step", tasksRemoveStep: "Remove step", tasksStepPlaceholder: "Describe a step",
403
- tasksStepDoneLabel: "Step done", tasksStepsHint: "Up to 30 steps. Check the ones that are done.",
404
- tasksStepsProgress: ({ done, total }) => `${done} of ${total} step${total === 1 ? "" : "s"} done`,
405
- tasksStatusTodo: "To do", tasksStatusDoing: "Doing", tasksStatusDone: "Done",
406
- tasksSummary: ({ count }) => `${count} task${count === 1 ? "" : "s"}`, tasksCreator: ({ name }) => `Created by ${name}`, tasksUpdated: ({ time }) => `Updated ${time}`,
407
- tasksEditHeading: "Edit task", tasksEditLabel: ({ title }) => `Edit ${title}`, tasksDeleteLabel: ({ title }) => `Delete ${title}`, tasksStatusFor: ({ title }) => `Status for ${title}`,
408
- tasksInvalid: "Add a title of 1–200 characters.", tasksCreateFailed: "Could not add this task. Try again.",
409
- tasksLimitReached: "This room has reached its task limit ({limit}). Delete completed tasks before adding another.", tasksUpdateFailed: "Could not update this task. Try again.",
410
- tasksDeleteFailed: "Could not delete this task. Try again.", tasksDeleteConfirm: ({ title }) => `Delete “${title}”? This cannot be undone.`,
411
- earlierMessages: "Earlier messages omitted", messagesBetweenOmitted: "Messages between this reading point and latest are omitted.", you: "You", saved: "Saved",
412
- savedMemory: "Saved for this tab only", copyFailed: ({ id }) => `Copy failed. Copy manually: ${id}`,
413
- copyMessage: "Copy", copiedMessage: "Copied", copyMessageFailed: "Could not copy. Select and copy the message manually.", wrapCode: "Wrap code",
414
- replyMessage: "Reply", replyingTo: "Replying to", cancelReply: "Cancel reply", replyOpenOriginal: "View original message", replyOriginalUnavailable: "Original message is unavailable.", replyOriginalRecalled: "Original message was recalled.",
415
- forwardMessage: "Forward", forwardTitle: "Forward message", forwardHint: "Choose where to forward this message.",
416
- forwardConfirm: ({ target }) => `Forward this message to ${target}?`, forwardNoTargets: "No forward targets are configured for this room.",
417
- forwardUnavailable: "Forwarding is not available on this server.", forwardLoadFailed: "Could not load forward targets.",
418
- forwardFailed: ({ message }) => `Forward failed: ${message}`,
419
- recallMessage: "Recall", recallSystemMessage: "Recall this room notice", recallSystemConfirm: "Recall this room notice? Everyone will see it as recalled.", recallConfirm: "Recall this message? Everyone will see it as recalled.", recallAdminConfirm: ({ name }) => `Recall ${name}'s message? Everyone will see it as recalled.`, recallFailed: "Could not recall this message.", messageRecalled: "Message recalled", recalledBy: ({ name }) => `Recalled by ${name}`, showRecalled: "View original", hideRecalled: "Hide original", reeditMessage: "Re-edit", reeditReplaceDraft: "Replace the current draft with this message?", revealFailed: "Load failed. Retry",
420
- identityChanged: "This browser identity changed in another tab. Reload this tab before continuing.",
421
- networkError: "Network connection failed", requestFailed: ({ status }) => `Request failed (HTTP ${status})`,
422
- roomIdRequired: "Enter a room ID", nameRequired: "Enter your name", authRetry: "The server requires an access token. Enter it and try again.",
423
- networkRetry: "Unable to connect to the server. Check your network and try again.",
424
- joinFailed: ({ message }) => `Could not join: ${message}`, roomNameRequired: "Enter a room name",
425
- createFailed: ({ message }) => `Could not create the room: ${message}`,
426
- roomNotFound: "This room is gone, or you no longer have access.",
427
- sendAuth: "Send failed: an access token is required", sendNetwork: "Send failed. Your message is saved below.",
428
- sendFailed: ({ message }) => `Send failed: ${message}`,
429
- adminRoomDeleteDenied: "This room is designated for administration. Only the room owner can delete it.",
430
- failedMessages: "Messages not sent", retryFailed: "Retry", discardFailed: "Discard",
431
- roomListError: "Unable to load rooms. You can enter a room ID directly.", guest: "Guest",
432
- roomsLabel: "Rooms", refreshRooms: "Refresh rooms", identityLabel: ({ name }) => `Chatting as ${name}`,
433
- roomsMenu: "Open room list", closeRoomList: "Close room list",
434
- direct: "Direct", messagePrivately: "Message privately", removeMember: "Remove",
435
- kickConfirm: ({ name }) => `Remove ${name} from this room? They can rejoin with the room ID.`,
436
- leaveRoomConfirm: ({ name }) => `Leave “${name}”? You will leave this room; you can rejoin later with its ID.`,
437
- deleteRoom: "Delete room", deleteConfirm: ({ name }) => `Delete “${name}” and all its messages? This cannot be undone.`,
438
- allMembers: "Everyone", messageCount: ({ count }) => `${count} / 5000`,
439
- pasteAsFile: ({ count }) => `Pasted ${count} characters saved as a text file`,
440
- sendAsFile: ({ count }) => `${count} characters exceed the limit; sending as a text file`,
441
- privacyNote: "Anyone with the shared token can read direct messages and manage rooms; the server can read them too.",
442
- resourceDelete: "Delete file", resourceDeleting: "Deleting…", resourceDeleteConfirm: ({ name }) => `Delete “${name}”? This cannot be undone.`, resourceDeleted: "File deleted.", resourceDeleteFailed: "Could not delete this file.",
443
- systemJoined: ({ name }) => `${name} joined the room`, systemLeft: ({ name }) => `${name} left the room`, systemRemoved: ({ name }) => `${name} was removed from the room`,
444
- systemDesignated: ({ actor, name }) => `${actor} designated ${name} as administrator`, systemRevoked: ({ actor }) => `${actor} revoked the administrator designation`, systemRenamed: ({ actor, from, to }) => `${actor} renamed the room from "${from}" to "${to}"`, systemDescribed: ({ actor }) => `${actor} updated the room description`, systemHanded: ({ actor, name }) => `${actor} handed the room to ${name}`, systemAdminsUpdated: ({ actor }) => `${actor} updated the room administrators`, systemSuccessorNamed: ({ actor, name }) => `${actor} named ${name} as the room successor`, systemSuccessorCleared: ({ actor }) => `${actor} cleared the room successor`, systemJoinPolicy: ({ actor, policy }) => policy === "approval" ? `${actor} now requires approval to join this room` : `${actor} opened this room to join without approval`,
445
- systemForwarded: ({ target }) => `Forwarded to ${target}`, systemForwardFailed: ({ target, reason }) => `Forward to ${target} failed: ${reason}`,
446
- activity_working: "Working", activity_idle: "Foreground idle", activity_waiting: "Waiting", activity_unknown: "Status unknown", activity_offline: "Status stale",
447
- activityHint_working: "The agent reports active work.", activityHint_idle: "Foreground is idle; background work may continue.", activityHint_waiting: "The agent reports that it is waiting.", activityHint_unknown: "No activity report is available.", activityHint_offline: "The last status is stale; this does not prove the agent is offline.",
448
- receiptCount: ({ count }) => `Read by ${count}`, receiptNone: "No readers yet", receiptAllRead: "Everyone has read this message", receiptNotLoaded: "Read status not loaded", readerPanelTitle: "Message readers", close: "Close", departedMember: "left",
449
- confirmTitle: "Please confirm", cancel: "Cancel", confirmAction: "Confirm",
450
- receiptEvidence_displayed: "Shown on screen", receiptEvidence_tool: "Fetched with room tool", receiptEvidence_context: "In agent context",
451
- },
452
- "zh-CN": {
453
- brand: "OC Chat", documentTitle: "OC Chat", roomTitle: ({ name }) => `${name} · OC Chat`,
454
- tagline: "一个轻量的聊天房间。输入房间 ID 加入,或直接新建一个。", languageLabel: "语言",
455
- restoringSession: "正在恢复会话…", retry: "重试", roomOptions: "选项",
456
- roomIdLabel: "房间 ID", roomIdPlaceholder: "粘贴或输入房间 ID", nameLabel: "你的昵称",
457
- namePlaceholder: "怎么称呼你", joinRoom: "加入房间", or: "或", newRoomNameLabel: "新房间名称",
458
- newRoomNamePlaceholder: "例如:周末电影夜", createRoom: "创建新房间", tokenOptional: "访问令牌(可选)",
459
- joinRoomTitle: "加入房间", joinRoomHint: "有人把房间 ID 分享给你?粘贴到这里。",
460
- createRoomTitle: "创建房间", createRoomHint: "新建一个房间,再把房间 ID 发给别人。",
461
- requireApproval: "加入需要审核", requireApprovalHint: "新成员需经人类管理员审核;Agent 也可以由管理员 Agent 审核。",
462
- joinPolicyEditHint: "新成员需经人类管理员审核。关闭后,所有待审核申请都会被清除。", joinPolicyOpenConfirm: "关闭加入审核?所有待审核的加入申请都会被清除。",
463
- approvalRequired: "需审核加入", joinRequired: "需审核加入", joinPendingStatus: "等待审核",
464
- joinPendingTitle: "等待审核", joinApprovalPrompt: ({ name }) => `申请加入“${name}”?需要人类管理员审核通过。`, joinPendingBody: ({ name }) => `加入“${name}”的申请已发送,需人类管理员审核通过后才能进入。`,
465
- joinPendingHint: "可以离开此页面,申请会保留;稍后可在房间列表查看。", joinPendingNotice: ({ name }) => `已发送加入“${name}”的申请,正在等待人类管理员审核。`, joinPendingCancel: "取消申请", joinPendingCancelError: "取消申请失败,请重试。",
466
- joinPendingGoneTitle: "申请已不在等待", joinPendingGoneBody: "申请可能已被拒绝或清除,可以重新发送。", joinPendingAgain: "重新申请",
467
- joinPendingError: "无法检查申请状态,请重试。", joinPendingRoomGone: "房间不存在,或你已无权访问。",
468
- joinNameTaken: "这个昵称已被房间里的成员使用,请换一个。",
469
- joinRequestsTitle: "加入申请", joinRequestsHint: "Agent 的申请也可以由管理员 Agent 审核。", joinRequestsEmpty: "暂无待审核申请。",
470
- joinRequestsLoadFailed: "无法加载加入申请。", joinRequestAlreadyHandled: "这个申请已经被处理过了。", joinRequestApprove: "通过", joinRequestDeny: "拒绝", joinRequestAgent: "Agent", joinRequestHuman: "人类",
471
- joinRequestApproveLabel: ({ name }) => `通过 ${name} 的加入申请`, joinRequestDenyLabel: ({ name }) => `拒绝 ${name} 的加入申请`,
472
- joinRequestTime: ({ time }) => `申请于 ${time}`, joinRequestApproved: ({ name }) => `已通过 ${name} 的申请。`, joinRequestDenied: ({ name }) => `已拒绝 ${name} 的申请。`,
473
- joinRequestActionFailed: ({ message }) => `操作失败:${message}`, membersWithRequests: ({ count }) => `成员,${count} 个待审核加入申请`,
474
- accessKeyTitle: "访问密钥", accessKeyHint: "这个服务器需要访问密钥。密钥保存在当前浏览器里,并随每个请求发送。",
475
- bearerToken: "Bearer Token", tokenPlaceholder: "服务器要求时填写", save: "保存",
476
- tokenHint: "若服务器设置了访问令牌(401),所有请求都会带上它。", existingRooms: "房间",
477
- noRooms: "还没有房间,创建一个吧。", copyRoomId: "复制房间 ID", loadingHistory: "正在加载更早的消息",
478
- editRoom: "编辑房间", editRoomSections: "编辑房间分区", editRoomDetails: "房间信息", editRoomJoining: "加入与审核", editRoomMembers: "成员与角色", editRoomOwnership: "所有权", roomOwnerOnlyTitle: "仅房主或管理员可修改", roomOwnerOnlyNote: ({ owner }) => `只有房主或房间管理员可以修改这些设置。这个房间属于 ${owner}。`, roomNameLabel: "房间名称", roomDescriptionLabel: "描述", adminAgentLabel: "管理员 Agent", roomOwnerBadge: "房主", roomAdminBadge: "管理员",
479
- adminIdsLabel: "成员管理员", adminIdsHint: "这些成员可以修改房间信息、管理成员、删除文件并指定接任者。房主始终拥有这些权限。", adminIdsEmpty: "房间里暂无其他成员。", newOwnerLabel: "新房主", newOwnerHint: "可以把房间交给房间里的另一个人。只有房主可以操作;Agent 不能成为房主。",
480
- successorLabel: "房主离开后的接任者", successorNone: "最早加入的成员", successorHint: "房主离开后,此人接任房主;管理员离开后,此人接任管理员。留空则最早加入的成员接任房主。", ownerOnlySettingsNote: "只有房主可以更改管理员 Agent 或移交房间。", adminAgentHint: "被指定的 Agent 可用 admin 工具查看此房间及其历史。只有房主可以更改,留空表示不指定。",
481
- noAdminAgent: "不指定", openQuestions: ({ count }) => `${count} 个待回答的问题`,
482
- newRoom: "创建房间",
483
- copyRoomIdTitle: ({ id }) => `点击复制完整房间 ID:${id}`, copied: "已复制", members: "成员",
484
- membersCount: ({ count }) => `成员 ${count}`, noMembers: "暂无成员", settings: "设置", profileMenu: "个人资料和设置",
485
- questions: "提问", pendingQuestions: "待回答的问题", refreshQuestions: "刷新",
486
- announcements: "公告栏", announcementName: "名称", announcementContent: "内容",
487
- reminders: "提醒", reminderSchedule: "计划", reminderOnce: "单次", reminderDate: "日期和时间",
488
- reminderCron: "5 字段 CRON 表达式", reminderTimezone: "时区覆盖(可选)", reminderTimezoneHint: "留空则使用服务器时区。填写 IANA 时区会应用于两种计划。服务器会拒绝夏令时调整中不存在或重复的单次时间。",
489
- reminderText: "提醒内容", reminderTemplateHint: "可使用 {{time}}、{{initiator}} 和 {{room}}。", reminderCreate: "创建提醒",
490
- reminderLoading: "正在加载提醒…", reminderEmpty: "暂无提醒。", reminderPaused: "已暂停", reminderNext: ({ time }) => `下次:${time}`,
491
- reminderPause: "暂停", reminderResume: "恢复", reminderDelete: "删除", reminderDeleteConfirm: "确定删除此提醒?",
492
- reminderEdit: "编辑", reminderEditHeading: "编辑提醒", reminderSave: "保存修改",
493
- reminderCreated: "提醒已创建。", reminderUpdated: "提醒已更新。", reminderDeleted: "提醒已删除。",
494
- reminderInvalid: "请检查日期、5 字段 CRON 表达式、IANA 时区和提醒内容。", reminderLoadFailed: "无法加载提醒,草稿仍已保留。",
495
- diagramLoading: "正在渲染图表…", diagramRenderFailed: "图表无法显示,以下为源代码。", resourceLoading: "正在加载文件…", resourceFailed: "无法加载此文件。", resourceDownload: "下载", resourceMoreActions: "{name} 的更多操作", resourcePreview: "预览", resourceHide: "收起预览", docPreviewEyebrow: "Markdown 预览", docPreviewFileEyebrow: "文件预览", docPreviewFailed: "无法加载此文档。", docPreviewEmpty: "此文档为空。", docPreviewTooLarge: "文件太大,无法预览(超过 2 MB),请下载查看。", docPreviewOfficeTooLarge: "Office 文件太大,无法预览(超过 20 MB),请下载查看。", docPreviewFullscreen: "全屏", docPreviewExitFullscreen: "退出全屏", docPreviewOfficeFailed: "无法预览此 Office 文件,请下载查看。", sidePaneResize: "调整侧边栏宽度", zoomImage: "查看大图", imagePreviewTitle: "图片预览", imageZoomControls: "图片缩放", zoomIn: "放大", zoomOut: "缩小", zoomReset: "重置缩放", openDiagram: "查看图表", diagramViewerTitle: "图表", diagramZoomControls: "图表缩放", diagramFit: "适应窗口", installTitle: "安装 OC Chat", installBody: "添加到主屏幕,获得全屏聊天体验。", installAction: "安装", installHow: "如何安装", installNotNow: "暂不", installIosGuide: "点击共享按钮,然后选择“添加到主屏幕”。",
496
- pwaUpdateTitle: "有可用更新", pwaUpdateBody: "新版本已准备好。可以立即刷新,或下次打开时再升级。", pwaUpdateNow: "立即升级", pwaUpdateLater: "稍后",
497
- announcementDelete: "删除公告",
498
- announcementNew: "新建公告", announcementEmpty: "暂无公告。", announcementLoading: "正在加载公告…",
499
- announcementLoadFailed: "无法加载公告,草稿仍已保留。", announcementSaved: "公告已保存。", announcementDeleted: "公告已删除。",
500
- announcementDuplicate: "此名称已存在。请选择该公告进行编辑,或使用其他名称。", announcementDeleteConfirm: ({ name }) => `删除“${name}”?`, announcementCount: ({ count }) => `${count} / 5000`, announcementInvalid: "名称需为 1–64 个字符,内容不能超过 5000 个字符。",
501
- questionsLoading: "正在加载问题…", questionsEmpty: "没有待回答的问题。",
502
- questionsFailed: "无法加载问题,请重试。", questionsUnsupported: "此服务器不支持查看待回答问题。", questionLabel: "问题",
503
- answerQuestion: "回复", answerPlaceholder: "写下回复…", sendAnswer: "发送回复", selectQuestion: "回复此问题", copyQuestion: "复制问题", questionCopied: "问题已复制。", questionCopyFailed: "无法复制问题。",
504
- answerFailed: "回复失败,草稿仍已保留。", answerTooLong: "回复不能超过 5,000 个字符。", questionAlreadyAnswered: "此问题已由其他人回答。",
505
- adminBindingGuide: "选择管理员房间和其中的 Agent,再将邀请私下发送给该 Agent 完成设置。", adminRoomLabel: "管理员房间", adminDesignateAgent: "邀请 Agent",
506
- adminAccess: "管理", adminToken: "管理令牌", openAdministration: "打开管理面板", administration: "管理面板", designations: "管理绑定", adminRoom: "管理员房间", targetRoom: "Agent 所属房间", adminScopeNote: "请选择管理员房间内的 Agent。管理员可以管理所有房间。", adminRoomBadge: "管理", targetAgent: "已注册 Agent", designate: "指定管理员", revokeDesignation: "撤销绑定", globalStatus: "全局状态", adminTasks: "任务", taskText: "任务内容", dispatchTask: "派发任务", timers: "定时任务", planName: "定时任务名称", createTimer: "创建定时任务",
507
- adminLoading: "正在加载管理面板…", refreshAdmin: "刷新", adminRoomBadge: "管理", chooseAdminRoom: "选择普通房间", chooseTargetRoom: "选择 Agent 房间", chooseAgent: "选择已注册 Agent", taskTargetRoom: "任务目标房间", taskTargetAgent: "任务目标 Agent", createAdminRoomFirst: "请先按普通流程创建房间,再选作管理房间。", noAgents: "没有已注册的 Agent", selectAdminAgent: "请选择管理房间和已注册的 Agent。", adminDesignated: "管理员已立即生效,长期有效,直到撤销。", revokeConfirm: "撤销此管理绑定?普通房间会保留。", updateTask: "更新任务", task_pending: "待处理", task_working: "进行中", task_blocked: "受阻", task_completed: "已完成", task_cancelled: "已取消", nextRun: ({ time, minutes }) => `每 ${minutes} 分钟 · 下次 ${time}`, paused: "已暂停", pauseTimer: "暂停", resumeTimer: "恢复", deleteTimer: "删除", deleteTimerConfirm: ({ name }) => `删除定时任务“${name}”?`,
508
- tokenRequired: "服务器要求访问令牌(401)。",
509
- themeLabel: "主题", themeSystem: "跟随系统", themeLight: "浅色", themeDark: "深色", themeForest: "森林", themeSand: "沙丘", themeCustom: "自定义主题", themeCustomColor: "自定义主题颜色",
510
- windowFrameLabel: "显示模式", windowFrameHint: "内容铺满占满整个窗口;窗口模式保留内嵌卡片边框。",
511
- windowFrameFramed: "窗口模式", windowFrameBorderless: "内容铺满",
512
- chatBackgroundLabel: "聊天背景", chatBackgroundHint: "仅显示在当前浏览器,铺满应用后面的整个窗口。透明度低一些更易阅读。",
513
- chatBackgroundMode: "模式", chatBackgroundDefault: "默认", chatBackgroundColor: "颜色", chatBackgroundImage: "图片",
514
- chatBackgroundOpacity: "透明度", chatBackgroundScope: "范围", chatBackgroundScopeRoom: "当前房间", chatBackgroundScopeAll: "所有房间",
515
- chatBackgroundReset: "重置", chatBackgroundTooLarge: "请选择不超过 2 MiB 的图片。",
516
- chatBackgroundInvalidType: "请选择图片文件。",
517
- chatBackgroundApplying: "正在读取 {name}…", chatBackgroundApplied: "已应用 {name}。",
518
- chatBackgroundImageFailed: "无法读取这张图片。", chatBackgroundSaveFailed: "无法在当前浏览器保存背景。",
519
- settingsLocalHint: "语言、主题、过渡和滚动选项保存在当前浏览器中。", settingsSections: "设置分区", settingsGeneral: "通用", settingsAppearance: "外观", settingsConnection: "连接",
520
- settingsLanguageHint: "立即生效,并保存在当前浏览器中。", settingsThemeHint: "保存在当前浏览器中。跟随系统会使用设备的外观设置。", settingsTokenHint: "仅保存在当前浏览器中,仅在服务器要求时填写。",
521
- settingsPanelMode: "工具窗口", settingsPanelModeHint: "选择每个房间工具在宽屏上的打开方式。窄屏或矮窗口始终使用弹窗。", panelModeDialog: "弹窗", panelModePane: "侧边栏",
522
- settingsIntegrations: "平台集成",
523
- integrationsHint: "通过上传插件把房间连接到外部平台。密钥值只保存在服务器上。",
524
- integrationsExternalConfig: "此集成使用外部配置文件。请编辑该文件,或在保存托管设置前先停用它。",
525
- integrationsEnable: "启用集成", integrationsEnableHint: "保存后生效。",
526
- integrationsAccounts: "账号", integrationsAddAccount: "添加账号", integrationsEmptyAccounts: "还没有账号。",
527
- integrationsPlugins: "插件", integrationsUploadPlugin: "上传插件", integrationsEmptyPlugins: "还没有上传插件。",
528
- integrationsRules: "出站规则", integrationsRulesHint: "出站规则把房间事件转发到已连接的账号。可使用 JSON 或 YAML;每个目标必须使用已存在的账号。",
529
- integrationsInboundRules: "入站路由", integrationsInboundHint: "入站路由把外部消息带入房间。每条路由都需要已配置的账号和目标房间。",
530
- integrationsRulesFormat: "规则格式", integrationsEditorUnavailable: "代码编辑器无法加载,已改用纯文本编辑。",
531
- integrationsRulesErrors: "请先修复高亮的错误({count} 个)。{first}",
532
- integrationsSave: "保存集成", integrationsLoading: "正在加载集成…", integrationsLoadFailed: "无法加载集成,请重试。",
533
- integrationsPlugin: "插件", integrationsEnv: "环境变量", integrationsEnvKey: "变量名", integrationsEnvValue: "变量值",
534
- integrationsLeaveBlank: "留空以保留该变量的已存储值", integrationsEnvHint: "填写某个值只会替换该变量;留空的行保持原值。",
535
- integrationsAddEnv: "添加变量", integrationsClearEnv: "清除所有变量", integrationsKeepEnv: "保留所有变量",
536
- integrationsClearEnvActive: "保存后将清除所有已存储的变量。", integrationsEnvInvalid: "变量名只能包含字母、数字和下划线,且不能重复。",
537
- integrationsAccountTitle: "集成账号", integrationsAccountId: "账号 ID", integrationsAccountIdHint: "留空自动生成", integrationsPlatform: "平台",
538
- integrationsAccountDetails: "账号信息", integrationsAdvanced: "高级设置", integrationsKeepStored: "保留已存储值", integrationsNotSet: "未设置",
539
- integrationsAccountRequired: "请填写必填的账号字段:{fields}。",
540
- integrationsAccountInvalid: "请选择插件;账号 ID 可以留空自动生成。", integrationsRemoveAccountConfirm: ({ id }) => `确定移除账号“${id}”?保存集成配置后才会真正删除。`, integrationsDuplicateAccount: "已存在相同 ID 的账号。",
541
- integrationsAccountSaved: "账号已保存。保存集成后生效。", integrationsAccountRemoved: "账号已移除。保存集成后生效。",
542
- integrationsLastError: "最近错误", integrationsEdit: "编辑", integrationsRemove: "移除",
543
- integrationsInvalidJson: "规则 JSON 在第 {line} 行附近无效。", integrationsInvalidRules: "规则必须是 JSON 数组。",
544
- integrationsFromRequired: "第 {index} 条规则的 from 必须使用 chatroom/center。", integrationsTargetRequired: "第 {index} 条规则的目标 {target} 缺少 {field}。",
545
- integrationsTargetMissing: "第 {index} 条规则的目标 {target} 找不到账号“{account}”。",
546
- integrationsNeedAccount: "保存前请至少添加一个账号。", integrationsPluginFirst: "请先上传插件,再添加账号。",
547
- integrationsStateStarted: "运行中", integrationsStateStarting: "启动中", integrationsStateStopped: "已停止",
548
- integrationsStateError: "错误", integrationsStateUnknown: "未知",
549
- integrationsPluginFile: "选择适配器文件", integrationsPluginName: "插件文件名", integrationsPluginSource: "JavaScript 源码",
550
- integrationsPluginHint: "合法插件会在 initialize 握手中声明平台和账号字段;上传不会启动账号,也不需要凭据。",
551
- integrationsDownloadPlugin: "下载 {name}",
552
- integrationsPluginPaste: "粘贴插件 JavaScript(最大 256 KiB)", integrationsUpload: "上传插件",
553
- integrationsUploaded: "插件已上传。请为账号选择它。", integrationsSourceTooLarge: "插件源码不能超过 256 KiB。",
554
- integrationsNameRequired: "请使用 .js、.mjs、.cjs 或 .ts 文件名。", integrationsPlatformRequired: "平台标识需为 1–128 个字母、数字、点、短横线或下划线。",
555
- integrationsSourceRequired: "请粘贴或选择插件 JavaScript。",
556
- integrationsEnabled: "集成已启用。", integrationsDisabled: "集成已停用。", integrationsEnablePending: "保存集成后即可启动运行时。",
557
- integrationsSavedEnabled: "已保存,集成已启用。", integrationsDisableConfirm: "停用集成?保存后运行时会停止;账号和规则仍会保留。", integrationsDisabledHint: "启用集成并保存后,才能编辑账号、插件和规则。", integrationsSavedDisabled: "已保存,集成已停用。",
558
- contentTransition: "内容区域过渡", contentTransitionHint: "使用 Alt+方向键切换房间时,让消息内容按方向滑动。默认关闭。", pageStep: "翻页距离", pageStepHint: "每次按 PageUp 或 PageDown 滚动会话高度的百分比。默认 90%。", leave: "离开", reconnecting: "连接中断,正在重试…",
559
- messageList: "消息列表", noMessages: "还没有消息,说点什么吧。", latestMessages: "回到最新消息",
560
- mentionMembers: "选择要提及的成员", messagePlaceholder: "输入消息,Enter 发送",
561
- attachments: "附件", addFiles: "添加文件", dropFilesHere: "将文件拖到这里添加",
562
- attachmentVolatile: "粘贴的文件刷新后可恢复;文件选择器添加的文件仅在当前标签页有效。", attachmentNotPersisted: "文件过大,无法在刷新后恢复。发送完成前请保持此标签页打开。", retryUpload: "重试", removeFile: "移除",
563
- uploadQueued: "等待上传", uploadReady: "可以发送", sendAsFileFailed: "上传失败,文字仍在输入框中。", uploadPercent: ({ percent }) => `正在上传 ${percent}%`,
564
- uploadFailed: ({ reason } = {}) => reason ? `上传失败(${reason}),请重试或移除文件。` : "上传失败,请重试或移除文件。",
565
- fileUnreadable: "这个文件读不出来:它可能是其他 App 的临时文件,或者还在云端。请先保存到本地(或截图)再发送。",
566
- fileTooLarge: "文件超过服务器当前大小限制。",
567
- send: "发送", roomMeta: ({ members, count }) => `${members} 人 · ${count} 条消息`, joinArrow: "加入 →",
568
- joinDirectTitle: "点击直接加入", mentionEmpty: "没有匹配的成员", mentionHint: "↑↓ 选择 · Enter 确认 · Esc 关闭",
569
-
570
- shortcutsTitle: "键盘快捷键", shortcutsLead: "ChatRoom 快捷键。按 {modifier} + / 打开此列表。",
571
- shortcutsOpen: "全部快捷键",
572
- shortcutsWriting: "输入", shortcutsSend: "发送消息", shortcutsNewline: "换行",
573
- shortcutsMention: "选择要提及的成员", shortcutsRooms: "房间", shortcutsSearch: "搜索与命令", shortcutsOpenPalette: "打开搜索与命令面板",
574
- shortcutsSwitchRoom: "切换到上一个或下一个房间", shortcutsNumberRoom: "按编号切换到已加入的房间", shortcutsReading: "阅读",
575
- shortcutsScroll: "输入时滚动消息", shortcutsJump: "跳到会话开头或结尾", shortcutsMenus: "菜单和对话框",
576
- shortcutsClose: "关闭当前菜单、面板或对话框",
577
- paletteTitle: "搜索与命令", paletteSearchLabel: "搜索消息",
578
- palettePlaceholder: "搜索消息,输入 / 使用命令", paletteScopeRoom: "当前房间", paletteScopeAll: "全部房间",
579
- paletteScopeHint: "按 Tab 在当前房间和全部已加入房间之间切换", paletteSearchMode: "搜索", paletteCommandMode: "命令",
580
- paletteSearching: "正在搜索…", paletteNoResults: "没有找到消息。", paletteNoCommands: "没有匹配的命令。",
581
- paletteResults: ({ count }) => `${count} 条结果`, paletteCommandsHint: "常用命令",
582
- paletteHint: "↑↓ 或 Alt+1–9 选择 · Enter 打开 · Tab 切换范围 · Esc 关闭", paletteSearchFailed: "搜索失败,请重试。",
583
- paletteLeaveRoom: "离开房间", paletteJumpLatest: "跳到最新消息",
584
- filesTitle: "文件", filesEyebrow: "房间文件", filesFilter: "上传者", filesEveryone: "所有人",
585
- filesUnknownUploader: "未知上传者", filesSummary: ({ count, size }) => `${count} 个文件 · ${size}`,
586
- filesLoading: "正在加载文件…", filesLoadFailed: "无法加载文件,请重试。", filesEmpty: "这个房间还没有文件。",
587
- filesEmptyFiltered: "此上传者没有文件。", filesLoadMore: "加载更多",
588
- filesHint: "可预览图片、音频、视频、Markdown、文本、代码和 PDF,所有文件都可下载。",
589
- filesPreviewFailed: "无法加载预览。", filesDownloadFailed: "无法下载此文件。",
590
- filesPreviewLabel: ({ name }) => `预览 ${name}`, filesDownloadLabel: ({ name }) => `下载 ${name}`,
591
- filesDeleteLabel: ({ name }) => `删除 ${name}`, filesRefresh: "刷新文件",
592
- tasksTitle: "任务", tasksEyebrow: "房间任务", tasksRefresh: "刷新任务", tasksMenuLabel: "任务操作",
593
- tasksClearCompleted: "清除已完成任务", tasksClearConfirm: ({ count }) => `清除 ${count} 个已完成任务?此操作无法撤销。`,
594
- tasksClearFailed: "无法清除已完成任务,请重试。",
595
- tasksLoading: "正在加载任务…", tasksLoadFailed: "无法加载任务,请重试。", tasksEmpty: "还没有任务,添加第一个吧。",
596
- tasksEmptyFiltered: "此状态下没有任务。", tasksCreate: "添加任务", tasksTitleLabel: "标题",
597
- tasksTitlePlaceholder: "需要做什么?", tasksDescriptionLabel: "描述", tasksDescriptionPlaceholder: "补充细节、链接或完成标准",
598
- tasksAssigneeLabel: "负责人", tasksUnassigned: "未指派", tasksFilterLabel: "显示", tasksFilterAll: "全部状态",
599
- tasksDueDateLabel: "截止日期", tasksDueOn: ({ date }) => `截止 ${date}`, tasksOverdue: "已逾期",
600
- tasksParticipantsLabel: "参与人员", tasksParticipantsMeta: ({ names }) => `参与人员:${names}`,
601
- tasksConclusionLabel: "结论", tasksConclusionPlaceholder: "最终结果如何?",
602
- tasksStepsLabel: "完成步骤", tasksAddStep: "添加步骤", tasksRemoveStep: "删除步骤", tasksStepPlaceholder: "描述一个步骤",
603
- tasksStepDoneLabel: "步骤已完成", tasksStepsHint: "最多 30 个步骤,勾选已完成的步骤。",
604
- tasksStepsProgress: ({ done, total }) => `已完成 ${done}/${total} 步`,
605
- tasksStatusTodo: "待办", tasksStatusDoing: "进行中", tasksStatusDone: "已完成",
606
- tasksSummary: ({ count }) => `${count} 个任务`, tasksCreator: ({ name }) => `由 ${name} 创建`, tasksUpdated: ({ time }) => `更新于 ${time}`,
607
- tasksEditHeading: "编辑任务", tasksEditLabel: ({ title }) => `编辑 ${title}`, tasksDeleteLabel: ({ title }) => `删除 ${title}`, tasksStatusFor: ({ title }) => `${title} 的状态`,
608
- tasksInvalid: "标题需为 1–200 个字符。", tasksCreateFailed: "无法添加任务,请重试。",
609
- tasksLimitReached: "任务已达上限({limit} 个),请先删除已完成任务再添加", tasksUpdateFailed: "无法更新任务,请重试。",
610
- tasksDeleteFailed: "无法删除任务,请重试。", tasksDeleteConfirm: ({ title }) => `删除“${title}”?此操作无法撤销。`,
611
- joined: "已加入", joinAction: "加入房间", unreadMessages: ({ count }) => `${count} 条未读`,
612
- today: "今天", yesterday: "昨天", earlierMessages: "更早的消息已省略", messagesBetweenOmitted: "此阅读位置与最新消息之间的部分消息已省略。", you: "我", saved: "已保存",
613
- savedMemory: "仅保存于当前标签页", copyFailed: ({ id }) => `复制失败,请手动复制:${id}`,
614
- copyMessage: "复制", copiedMessage: "已复制", copyMessageFailed: "复制失败,请手动选择并复制消息。", wrapCode: "自动换行",
615
- replyMessage: "回复", replyingTo: "回复给", cancelReply: "取消回复", replyOpenOriginal: "查看原始消息", replyOriginalUnavailable: "原始消息不可用。", replyOriginalRecalled: "原消息已撤回。",
616
- forwardMessage: "转发", forwardTitle: "转发消息", forwardHint: "选择把这条消息转发到哪里。",
617
- forwardConfirm: ({ target }) => `把这条消息转发到 ${target}?`, forwardNoTargets: "这个房间没有配置转发目标。",
618
- forwardUnavailable: "此服务器未开启转发功能。", forwardLoadFailed: "无法加载转发目标。",
619
- forwardFailed: ({ message }) => `转发失败:${message}`,
620
- recallMessage: "撤回", recallSystemMessage: "撤回这条房间通知", recallSystemConfirm: "撤回这条房间通知?所有人都会看到“消息已撤回”。", recallConfirm: "撤回这条消息?所有人都会看到“消息已撤回”。", recallAdminConfirm: ({ name }) => `撤回 ${name} 的消息?所有人都会看到“消息已撤回”。`, recallFailed: "撤回失败,请重试。", messageRecalled: "消息已撤回", recalledBy: ({ name }) => `${name} 撤回`, showRecalled: "查看原文", hideRecalled: "收起原文", reeditMessage: "重新编辑", reeditReplaceDraft: "用这条消息替换当前草稿?", revealFailed: "加载失败,重试",
621
- identityChanged: "此浏览器身份已在另一个标签页中更改,请重新加载此标签页后继续。",
622
- networkError: "网络连接失败", requestFailed: ({ status }) => `请求失败(HTTP ${status})`,
623
- roomIdRequired: "请输入房间 ID", nameRequired: "请输入你的昵称", authRetry: "服务器要求访问令牌,请填写后重试",
624
- networkRetry: "无法连接服务器,请检查网络后重试", joinFailed: ({ message }) => `加入失败:${message}`,
625
- roomNameRequired: "请输入房间名称", createFailed: ({ message }) => `创建失败:${message}`,
626
- roomNotFound: "房间不存在,或你已被移出房间", sendAuth: "发送失败:需要访问令牌",
627
- sendNetwork: "发送失败,消息已保存在下方", sendFailed: ({ message }) => `发送失败:${message}`,
628
- adminRoomDeleteDenied: "此房间已指定管理员。只有房主可以删除此房间。",
629
- failedMessages: "未发送的消息", retryFailed: "重试", discardFailed: "删除",
630
- roomListError: "无法加载房间列表,可直接输入房间 ID 加入。", guest: "访客", roomsLabel: "房间列表",
631
- refreshRooms: "刷新房间", identityLabel: ({ name }) => `当前昵称:${name}`, roomsMenu: "打开房间列表", closeRoomList: "关闭房间列表", direct: "私聊",
632
- messagePrivately: "私聊", removeMember: "移除", kickConfirm: ({ name }) => `确定将 ${name} 移出此房间?对方仍可用房间 ID 重新加入。`,
633
- leaveRoomConfirm: ({ name }) => `离开“${name}”?你将离开这个房间,之后可以用房间 ID 重新加入。`,
634
- deleteRoom: "删除房间", deleteConfirm: ({ name }) => `删除“${name}”及全部聊天记录?此操作无法撤销。`,
635
- allMembers: "所有人", messageCount: ({ count }) => `${count} / 5000`,
636
- pasteAsFile: ({ count }) => `已把粘贴的 ${count} 个字符保存为文本文件`,
637
- sendAsFile: ({ count }) => `${count} 个字符超出上限,将作为文本文件发送`,
638
- privacyNote: "持有共享令牌的人都可以读取私聊内容和管理房间;服务器也可以读取私聊内容。", resourceDelete: "删除文件", resourceDeleting: "正在删除…", resourceDeleteConfirm: ({ name }) => `确定删除“${name}”?此操作无法撤销。`, resourceDeleted: "文件已删除。", resourceDeleteFailed: "无法删除此文件。",
639
- systemJoined: ({ name }) => `${name} 加入了房间`, systemLeft: ({ name }) => `${name} 离开了房间`, systemRemoved: ({ name }) => `${name} 被移出了房间`,
640
- systemDesignated: ({ actor, name }) => `${actor} 指定 ${name} 为管理员`, systemRevoked: ({ actor }) => `${actor} 撤销了管理员指定`, systemRenamed: ({ actor, from, to }) => `${actor} 将房间名称从“${from}”改为“${to}”`, systemDescribed: ({ actor }) => `${actor} 更新了房间描述`, systemHanded: ({ actor, name }) => `${actor} 将房间移交给了 ${name}`, systemAdminsUpdated: ({ actor }) => `${actor} 更新了房间管理员`, systemSuccessorNamed: ({ actor, name }) => `${actor} 指定 ${name} 为房间继任者`, systemSuccessorCleared: ({ actor }) => `${actor} 清除了房间继任者`, systemJoinPolicy: ({ actor, policy }) => policy === "approval" ? `${actor} 开启了加入审核,新成员需要管理员批准` : `${actor} 关闭了加入审核,新成员可以直接加入`,
641
- systemForwarded: ({ target }) => `已转发到 ${target}`, systemForwardFailed: ({ target, reason }) => `转发到 ${target} 失败:${reason}`,
642
- activity_working: "工作中", activity_idle: "前台空闲", activity_waiting: "等待中", activity_unknown: "状态未知", activity_offline: "状态已过期",
643
- activityHint_working: "Agent 正在报告工作状态。", activityHint_idle: "前台空闲;后台任务仍可能继续。", activityHint_waiting: "Agent 正在报告等待状态。", activityHint_unknown: "暂无活动状态报告。", activityHint_offline: "最近的状态已过期;这不能证明 Agent 已离线。",
644
- receiptCount: ({ count }) => `已读 ${count} 人`, receiptNone: "尚无人已读", receiptAllRead: "所有人已读", receiptNotLoaded: "尚未加载已读状态", readerPanelTitle: "消息已读情况", close: "关闭", departedMember: "已离开",
645
- confirmTitle: "请确认", cancel: "取消", confirmAction: "确认",
646
- receiptEvidence_displayed: "已显示在屏幕上", receiptEvidence_tool: "通过房间工具读取", receiptEvidence_context: "进入上下文",
647
- },
648
- ...extraLocales,
340
+ en: {
341
+ brand: "OC Chat", documentTitle: "OC Chat",
342
+ roomTitle: ({ name }) => `${name} · OC Chat`,
343
+ tagline: "A lightweight chat room. Enter a room ID to join, or create a new one.",
344
+ restoringSession: "Restoring your session…", retry: "Retry", roomOptions: "Options",
345
+ languageLabel: "Language", roomIdLabel: "Room ID", roomIdPlaceholder: "Paste or enter a room ID",
346
+ nameLabel: "Your name", namePlaceholder: "What should we call you?", joinRoom: "Join room",
347
+ or: "or", newRoomNameLabel: "New room name", newRoomNamePlaceholder: "e.g. Weekend movie night",
348
+ createRoom: "Create room", joinRoomTitle: "Join a room", joinRoomHint: "Someone shared a room ID with you? Paste it here.",
349
+ createRoomTitle: "Create a room", createRoomHint: "Start a new room and invite people with its ID.",
350
+ requireApproval: "Require approval to join", requireApprovalHint: "New members need a human administrator's approval. Agents may also be approved by the administrator agent.",
351
+ joinPolicyEditHint: "New members need a human administrator's approval. Turning this off clears all pending requests.", joinPolicyOpenConfirm: "Turn off approval? All pending join requests will be cleared.",
352
+ approvalRequired: "Approval required", joinRequired: "Approval required", joinPendingStatus: "Approval pending",
353
+ joinPendingTitle: "Waiting for approval", joinApprovalPrompt: ({ name }) => `Request to join “${name}”? A human administrator must approve it.`, joinPendingBody: ({ name }) => `Your request to join “${name}” was sent. A human administrator must approve it before you can join.`,
354
+ joinPendingHint: "You can leave this page; the request stays pending. Check the room list later.", joinPendingNotice: ({ name }) => `Request sent to join “${name}”. Waiting for a human administrator.`, joinPendingCancel: "Cancel request", joinPendingCancelError: "Could not cancel the request. Try again.",
355
+ joinPendingGoneTitle: "Request not pending", joinPendingGoneBody: "It may have been denied or cleared. You can send a new request.", joinPendingAgain: "Request again",
356
+ joinPendingError: "Could not check the request. Try again.", joinPendingRoomGone: "This room is gone, or you no longer have access.",
357
+ joinNameTaken: "That name is already used in this room. Choose another name.",
358
+ joinRequestsTitle: "Join requests", joinRequestsHint: "Agent requests can also be approved by the administrator agent.", joinRequestsEmpty: "No pending requests.",
359
+ joinRequestsLoadFailed: "Could not load join requests.", joinRequestAlreadyHandled: "This request was already handled.", joinRequestApprove: "Approve", joinRequestDeny: "Deny", joinRequestAgent: "Agent", joinRequestHuman: "Human",
360
+ joinRequestApproveLabel: ({ name }) => `Approve ${name}`, joinRequestDenyLabel: ({ name }) => `Deny ${name}`,
361
+ joinRequestTime: ({ time }) => `Requested ${time}`, joinRequestApproved: ({ name }) => `${name} approved.`, joinRequestDenied: ({ name }) => `${name} denied.`,
362
+ joinRequestActionFailed: ({ message }) => `Could not update the request: ${message}`, membersWithRequests: ({ count }) => `Members, ${count} join request${count === 1 ? "" : "s"} pending`,
363
+ accessKeyTitle: "Access key", accessKeyHint: "This server asks for an access key. It stays in this browser and is sent with each request.",
364
+ tokenOptional: "Access token (optional)", bearerToken: "Bearer token",
365
+ tokenPlaceholder: "Enter if the server requires it", save: "Save",
366
+ tokenHint: "If the server requires an access token (401), all requests will include it.",
367
+ existingRooms: "Rooms", noRooms: "No rooms yet. Create one.", copyRoomId: "Copy room ID", loadingHistory: "Loading earlier messages",
368
+ editRoom: "Edit room", editRoomSections: "Edit room sections", editRoomDetails: "Room details", editRoomJoining: "Joining & approval", editRoomMembers: "Members & roles", editRoomOwnership: "Ownership", roomOwnerOnlyTitle: "Owner or administrator only", roomOwnerOnlyNote: ({ owner }) => `Only the room owner or a room administrator can change these settings. This room belongs to ${owner}.`, roomNameLabel: "Room name", roomDescriptionLabel: "Description", adminAgentLabel: "Administrator agent", roomOwnerBadge: "Owner", roomAdminBadge: "Admin",
369
+ adminIdsLabel: "Human administrators", adminIdsHint: "These members can edit room details, manage members, delete files, and choose a successor. The owner always has the same powers.", adminIdsEmpty: "No other members are in this room yet.", newOwnerLabel: "New owner", newOwnerHint: "Hand the room to another person who is in it. Only the owner can do this; agents cannot own a room.",
370
+ successorLabel: "Successor if the owner leaves", successorNone: "Longest-present member", successorHint: "If the owner leaves, this person becomes owner. If an administrator leaves, this person takes that role. Leave empty to use the longest-present member.", ownerOnlySettingsNote: "Only the owner can change the administrator agent or hand off the room.", adminAgentHint: "The designated agent can use the admin tool to inspect this room and its history. Only the owner can change this; leave empty for none.",
371
+ noAdminAgent: "None", openQuestions: ({ count }) => `${count} unanswered question${count === 1 ? "" : "s"}`,
372
+ newRoom: "Create a room",
373
+ copyRoomIdTitle: ({ id }) => `Click to copy the full room ID: ${id}`, copied: "Copied",
374
+ members: "Members", membersCount: ({ count }) => `Members (${count})`, noMembers: "No members yet.", profileMenu: "Your profile and settings",
375
+ questions: "Questions", pendingQuestions: "Pending questions", refreshQuestions: "Refresh",
376
+ announcements: "Announcements", announcementName: "Name", announcementContent: "Content",
377
+ reminders: "Reminders", reminderSchedule: "Schedule", reminderOnce: "One time", reminderDate: "Date and time",
378
+ reminderCron: "5-field CRON expression", reminderTimezone: "Timezone override (optional)", reminderTimezoneHint: "Leave blank to use the server timezone. An IANA timezone applies to both schedule types. The server rejects one-time times skipped or repeated by daylight-saving changes.",
379
+ reminderText: "Reminder text", reminderTemplateHint: "Use {{time}}, {{initiator}}, and {{room}} in your message.", reminderCreate: "Create reminder",
380
+ reminderLoading: "Loading reminders…", reminderEmpty: "No reminders yet.", reminderPaused: "Disabled", reminderNext: ({ time }) => `Next: ${time}`,
381
+ reminderPause: "Disable", reminderResume: "Enable", reminderDelete: "Delete", reminderDeleteConfirm: "Delete this reminder?",
382
+ reminderEdit: "Edit", reminderEditHeading: "Edit reminder", reminderSave: "Save changes",
383
+ reminderCreated: "Reminder created.", reminderUpdated: "Reminder updated.", reminderDeleted: "Reminder deleted.",
384
+ reminderInvalid: "Check the date, 5-field CRON expression, IANA timezone, and reminder text.", reminderLoadFailed: "Could not load reminders. Your draft is still here.",
385
+ diagramLoading: "Rendering diagram…", diagramRenderFailed: "Diagram unavailable; showing its source.", resourceLoading: "Loading file…", resourceFailed: "This file could not be loaded.", resourceDownload: "Download", resourceMoreActions: "More actions for {name}", resourcePreview: "Preview", resourceHide: "Hide preview", docPreviewEyebrow: "Markdown preview", docPreviewFileEyebrow: "File preview", docPreviewFailed: "This document could not be loaded.", docPreviewEmpty: "This document is empty.", docPreviewTooLarge: "This file is too large to preview (over 2 MB). Download it instead.", docPreviewOfficeTooLarge: "This Office file is too large to preview (over 20 MB). Download it instead.", docPreviewFullscreen: "Full screen", docPreviewExitFullscreen: "Exit full screen", docPreviewOfficeFailed: "This Office file could not be previewed. Download it instead.", sidePaneResize: "Resize side pane", zoomImage: "Open image", imagePreviewTitle: "Image preview", imageZoomControls: "Image zoom", zoomIn: "Zoom in", zoomOut: "Zoom out", zoomReset: "Reset zoom", openDiagram: "Open diagram", diagramViewerTitle: "Diagram", diagramZoomControls: "Diagram zoom", diagramFit: "Fit", installTitle: "Install OC Chat", installBody: "Add it to your home screen for a full-screen chat.", installAction: "Install", installHow: "How to install", installNotNow: "Not now", installIosGuide: "Tap Share, then Add to Home Screen.",
386
+ pwaUpdateTitle: "Update available", pwaUpdateBody: "A new version is ready. Reload now, or update the next time you open the app.", pwaUpdateNow: "Update now", pwaUpdateLater: "Later",
387
+ pwaDownloadingTitle: "Downloading the new version…", pwaDownloadingBody: "Keep using this page; it switches only when you choose to update.",
388
+ pwaReadyPartialTitle: ({ count }) => `Update ready — ${count} items not cached`, pwaReadyPartialBody: "The app still updates. Missing items load from the network on first use.",
389
+ pwaFailedTitle: "Update failed", pwaFailedBody: "Staying on the current version. It will retry on the next check.", pwaRetry: "Retry",
390
+ announcementDelete: "Delete announcement",
391
+ announcementNew: "New announcement", announcementEmpty: "No announcements yet.", announcementLoading: "Loading announcements…",
392
+ announcementLoadFailed: "Could not load announcements. Your draft is still here.", announcementSaved: "Announcement saved.", announcementDeleted: "Announcement deleted.",
393
+ announcementDuplicate: "That name already exists. Select it to edit, or choose another name.", announcementDeleteConfirm: ({ name }) => `Delete “${name}”?`, announcementCount: ({ count }) => `${count} / 5000`, announcementInvalid: "Use a name of 1–64 characters and content up to 5000 characters.",
394
+ questionsLoading: "Loading questions…", questionsEmpty: "No unanswered questions.",
395
+ questionsFailed: "Could not load questions. Try again.", questionsUnsupported: "Unanswered questions are unavailable on this server.", questionLabel: "Question",
396
+ answerQuestion: "Reply", answerPlaceholder: "Write a reply…", sendAnswer: "Send reply", selectQuestion: "Reply to question", copyQuestion: "Copy question", questionCopied: "Question copied.", questionCopyFailed: "Could not copy question.",
397
+ answerFailed: "Reply failed. Your draft is still here.", answerTooLong: "Reply must be 5,000 characters or fewer.", questionAlreadyAnswered: "This question was answered elsewhere.",
398
+ adminBindingGuide: "Choose a room and an Agent in it. Send the invitation privately to finish setup.", adminRoomLabel: "Administrator room", adminDesignateAgent: "Invite Agent",
399
+ settings: "Settings", adminAccess: "Administration", adminToken: "Administration token", openAdministration: "Open administration", administration: "Administration", designations: "Designations", adminRoom: "Administrator room", targetRoom: "Agent membership room", adminScopeNote: "Choose an Agent in the administrator room. Administrators can manage all rooms.", targetAgent: "Registered agent", designate: "Designate administrator", revokeDesignation: "Revoke designation", globalStatus: "Global status", adminTasks: "Tasks", taskText: "Task", dispatchTask: "Dispatch task", timers: "Timers", planName: "Timer name", createTimer: "Create timer", tokenRequired: "The server requires an access token (401).",
400
+ themeLabel: "Theme", themeSystem: "System", themeLight: "Light", themeDark: "Dark", themeForest: "Forest", themeSand: "Sand", themeCustom: "Custom", themeCustomColor: "Custom theme color",
401
+ windowFrameLabel: "Display mode", windowFrameHint: "Fill window uses the entire window; Window mode keeps the inset card border.",
402
+ windowFrameFramed: "Window mode", windowFrameBorderless: "Fill window",
403
+ chatBackgroundLabel: "Chat background", chatBackgroundHint: "Fills the browser window behind the app in this browser only. A lower opacity keeps text readable.",
404
+ chatBackgroundMode: "Mode", chatBackgroundDefault: "Default", chatBackgroundColor: "Color", chatBackgroundImage: "Image",
405
+ chatBackgroundOpacity: "Opacity", chatBackgroundScope: "Scope", chatBackgroundScopeRoom: "This room", chatBackgroundScopeAll: "All rooms",
406
+ chatBackgroundReset: "Reset", chatBackgroundTooLarge: "Choose an image of 2 MiB or less.",
407
+ chatBackgroundInvalidType: "Choose an image file.",
408
+ chatBackgroundApplying: "Reading {name}…", chatBackgroundApplied: "{name} applied.",
409
+ chatBackgroundImageFailed: "Could not read this image.", chatBackgroundSaveFailed: "Could not save the background in this browser.",
410
+ settingsLocalHint: "Language, theme, transition, and scrolling preferences are saved in this browser.",
411
+ settingsSections: "Settings sections", settingsGeneral: "General", settingsAppearance: "Appearance", settingsConnection: "Connection",
412
+ settingsLanguageHint: "Applies right away and is saved in this browser.", settingsThemeHint: "Saved in this browser. System follows your device.", settingsTokenHint: "Stored only in this browser. Needed only when the server asks for it.",
413
+ settingsPanelMode: "Tool windows", settingsPanelModeHint: "Choose how each room tool opens on wide screens. Narrow or short windows always use a dialog.", panelModeDialog: "Dialog", panelModePane: "Side pane",
414
+ settingsIntegrations: "Integrations",
415
+ integrationsHint: "Connect rooms with external platforms through uploaded plugins. Secret values stay on the server.",
416
+ integrationsExternalConfig: "This integration uses an external configuration file. Edit that file, or disable it before saving managed settings.",
417
+ integrationsEnable: "Enable integrations", integrationsEnableHint: "Changes apply when you save.",
418
+ integrationsAccounts: "Accounts", integrationsAddAccount: "Add account", integrationsEmptyAccounts: "No accounts yet.",
419
+ integrationsPlugins: "Plugins", integrationsUploadPlugin: "Upload plugin", integrationsEmptyPlugins: "No plugins uploaded yet.",
420
+ integrationsRules: "Outbound rules", integrationsRulesHint: "Outbound rules forward room events to connected accounts. Use JSON or YAML; each target must use an existing account.",
421
+ integrationsInboundRules: "Inbound routes", integrationsInboundHint: "Inbound routes bring external messages into a room. Each route needs a configured account and a room.",
422
+ integrationsRulesFormat: "Rules format", integrationsEditorUnavailable: "The code editor could not load. Plain text editing is available.",
423
+ integrationsRulesErrors: "Fix the highlighted errors before saving ({count}). {first}",
424
+ integrationsSave: "Save integrations", integrationsLoading: "Loading integrations…", integrationsLoadFailed: "Could not load integrations. Try again.",
425
+ integrationsPlugin: "Plugin", integrationsEnv: "Environment values", integrationsEnvKey: "Key", integrationsEnvValue: "Value",
426
+ integrationsLeaveBlank: "Leave blank to keep this stored value", integrationsEnvHint: "Entering a value replaces only that variable. Blank rows keep their stored value.",
427
+ integrationsAddEnv: "Add variable", integrationsClearEnv: "Clear all variables", integrationsKeepEnv: "Keep all variables",
428
+ integrationsClearEnvActive: "All stored variables will be cleared when you save.", integrationsEnvInvalid: "Use unique variable names made of letters, digits, and underscores.",
429
+ integrationsAccountTitle: "Integration account", integrationsAccountId: "Account ID", integrationsAccountIdHint: "Leave blank to generate", integrationsPlatform: "Platform",
430
+ integrationsAccountDetails: "Account details", integrationsAdvanced: "Advanced settings", integrationsKeepStored: "Keep stored value", integrationsNotSet: "Not set",
431
+ integrationsAccountRequired: "Fill required account fields: {fields}.",
432
+ integrationsAccountInvalid: "Choose a plugin; the account ID can be generated automatically.", integrationsRemoveAccountConfirm: ({ id }) => `Remove account “${id}”? It is deleted after you save the integrations.`, integrationsDuplicateAccount: "An account with this ID already exists.",
433
+ integrationsAccountSaved: "Account saved. Save integrations to apply it.", integrationsAccountRemoved: "Account removed. Save integrations to apply it.",
434
+ integrationsLastError: "Last error", integrationsEdit: "Edit", integrationsRemove: "Remove",
435
+ integrationsInvalidJson: "Rules JSON is invalid near line {line}.", integrationsInvalidRules: "Rules must be a JSON array.",
436
+ integrationsFromRequired: "Rule {index}: from must use chatroom/center.", integrationsTargetRequired: "Rule {index}, target {target}: {field} is required.",
437
+ integrationsTargetMissing: "Rule {index}, target {target}: account “{account}” does not exist.",
438
+ integrationsNeedAccount: "Add at least one account before saving.", integrationsPluginFirst: "Upload a plugin before adding an account.",
439
+ integrationsStateStarted: "Running", integrationsStateStarting: "Starting", integrationsStateStopped: "Stopped",
440
+ integrationsStateError: "Error", integrationsStateUnknown: "Unknown",
441
+ integrationsPluginFile: "Choose an adapter file", integrationsPluginName: "Plugin name", integrationsPluginSource: "JavaScript source",
442
+ integrationsPluginHint: "A valid adapter declares its platform and account fields from the initialize handshake. Upload does not start the account or require credentials.",
443
+ integrationsDownloadPlugin: "Download {name}",
444
+ integrationsPluginPaste: "Paste plugin JavaScript (max 256 KiB)", integrationsUpload: "Upload plugin",
445
+ integrationsUploaded: "Plugin uploaded. Choose it for an account.", integrationsSourceTooLarge: "The plugin source must be at most 256 KiB.",
446
+ integrationsNameRequired: "Use a .js, .mjs, .cjs, or .ts file name.", integrationsPlatformRequired: "Use a platform identifier of 1–128 letters, digits, dots, dashes, or underscores.",
447
+ integrationsSourceRequired: "Paste or choose plugin JavaScript.",
448
+ integrationsEnabled: "Integrations are enabled.", integrationsDisabled: "Integrations are disabled.", integrationsEnablePending: "Save integrations to start the runtime.",
449
+ integrationsSavedEnabled: "Saved. Integrations are enabled.", integrationsDisableConfirm: "Disable integrations? Saving stops the runtime; accounts and rules stay stored.", integrationsDisabledHint: "Enable integrations and save to edit accounts, plugins, and rules.", integrationsSavedDisabled: "Saved. Integrations are disabled.",
450
+ contentTransition: "Room content transition", contentTransitionHint: "Slide messages in when switching rooms with Alt+Arrow. Off by default.",
451
+ pageStep: "Page scroll distance", pageStepHint: "How far PageUp and PageDown move per press, as a percentage of the conversation height. Default 90%.",
452
+ adminLoading: "Loading administration…", refreshAdmin: "Refresh", adminRoomBadge: "admin", chooseAdminRoom: "Choose a normal room", chooseTargetRoom: "Choose an agent room", chooseAgent: "Choose a registered agent", taskTargetRoom: "Target room", taskTargetAgent: "Target agent", createAdminRoomFirst: "Create a normal room first, then select it as the admin room.", noAgents: "No registered agents", selectAdminAgent: "Choose an admin room and registered agent.", adminDesignated: "Administrator designation is active immediately and stays until you revoke it.", revokeConfirm: "Revoke this admin designation? The normal room will remain.", updateTask: "Update task", task_pending: "Pending", task_working: "Working", task_blocked: "Blocked", task_completed: "Completed", task_cancelled: "Cancelled", nextRun: ({ time, minutes }) => `Every ${minutes} min · next ${time}`, paused: "Paused", pauseTimer: "Pause", resumeTimer: "Resume", deleteTimer: "Delete", deleteTimerConfirm: ({ name }) => `Delete timer “${name}”?`,
453
+ leave: "Leave", reconnecting: "Connection lost. Retrying…", messageList: "Message list",
454
+ noMessages: "No messages yet. Say something.", latestMessages: "Back to latest messages",
455
+ mentionMembers: "Choose a member to mention", messagePlaceholder: "Message · Enter to send",
456
+ attachments: "Attachments", addFiles: "Add files", dropFilesHere: "Drop files here to attach",
457
+ attachmentVolatile: "Pasted files are recovered after reload; picked files stay in this tab.", attachmentNotPersisted: "This file is too large to save for reload. Keep this tab open until it is sent.", retryUpload: "Retry", removeFile: "Remove",
458
+ uploadQueued: "Waiting to upload", uploadReady: "Ready to send", sendAsFileFailed: "Upload failed. Your text is still in the composer.", uploadPercent: ({ percent }) => `Uploading ${percent}%`,
459
+ uploadFailed: ({ reason } = {}) => reason ? `Upload failed (${reason}). Retry or remove the file.` : "Upload failed. Retry or remove the file.",
460
+ fileUnreadable: "This file cannot be read: it may be a temporary file from another app, or still in the cloud. Save it to disk (or take a screenshot) and attach that.",
461
+ fileTooLarge: "File exceeds the server's current size limit.",
462
+ send: "Send", roomMeta: ({ members, count }) => `${members} ${members === 1 ? "member" : "members"} · ${count} ${count === 1 ? "message" : "messages"}`,
463
+ joinArrow: "Join →", joinDirectTitle: "Click to join directly", mentionEmpty: "No matching members",
464
+ joined: "Joined", joinAction: "Join room", unreadMessages: ({ count }) => `${count} unread`,
465
+ mentionHint: "↑↓ Select · Enter to confirm · Esc to close", today: "Today", yesterday: "Yesterday",
466
+ shortcutsTitle: "Keyboard shortcuts", shortcutsLead: "ChatRoom shortcuts. Press {modifier} + / to open this list.",
467
+ shortcutsOpen: "All shortcuts",
468
+ shortcutsWriting: "Writing", shortcutsSend: "Send the message", shortcutsNewline: "Start a new line",
469
+ shortcutsMention: "Choose a member to mention", shortcutsRooms: "Rooms", shortcutsSearch: "Search and commands", shortcutsOpenPalette: "Open search and commands",
470
+ shortcutsSwitchRoom: "Switch to the previous or next room", shortcutsNumberRoom: "Switch to a joined room by number", shortcutsReading: "Reading",
471
+ shortcutsScroll: "Scroll messages while typing", shortcutsJump: "Jump to the start or end of the conversation", shortcutsMenus: "Menus and dialogs",
472
+ shortcutsClose: "Close the open menu, panel, or dialog",
473
+ paletteTitle: "Search and commands", paletteSearchLabel: "Search messages",
474
+ palettePlaceholder: "Search messages, or type / for commands", paletteScopeRoom: "This room", paletteScopeAll: "All rooms",
475
+ paletteScopeHint: "Tab switches between this room and all joined rooms", paletteSearchMode: "Search", paletteCommandMode: "Commands",
476
+ paletteSearching: "Searching…", paletteNoResults: "No messages found.", paletteNoCommands: "No matching commands.",
477
+ paletteResults: ({ count }) => `${count} result${count === 1 ? "" : "s"}`, paletteCommandsHint: "Common commands",
478
+ paletteHint: "↑↓ or Alt+1–9 select · Enter open · Tab scope · Esc close", paletteSearchFailed: "Search failed. Try again.",
479
+ paletteLeaveRoom: "Leave room", paletteJumpLatest: "Jump to latest",
480
+ filesTitle: "Files", filesEyebrow: "Room files", filesFilter: "Uploaded by", filesEveryone: "Everyone",
481
+ filesUnknownUploader: "Unknown uploader", filesSummary: ({ count, size }) => `${count} file${count === 1 ? "" : "s"} · ${size}`,
482
+ filesLoading: "Loading files…", filesLoadFailed: "Could not load files. Try again.", filesEmpty: "No files in this room yet.",
483
+ filesEmptyFiltered: "No files from this uploader.", filesLoadMore: "Load more",
484
+ filesHint: "Preview images, audio, video, Markdown, text, code, and PDF. Download any file.",
485
+ filesPreviewFailed: "Could not load this preview.", filesDownloadFailed: "Could not download this file.",
486
+ filesPreviewLabel: ({ name }) => `Preview ${name}`, filesDownloadLabel: ({ name }) => `Download ${name}`,
487
+ filesDeleteLabel: ({ name }) => `Delete ${name}`, filesRefresh: "Refresh files",
488
+ tasksTitle: "Tasks", tasksEyebrow: "Room tasks", tasksRefresh: "Refresh tasks", tasksMenuLabel: "Task actions",
489
+ tasksClearCompleted: "Clear completed", tasksClearConfirm: ({ count }) => `Clear ${count} completed task${count === 1 ? "" : "s"}? This cannot be undone.`,
490
+ tasksClearFailed: "Could not clear completed tasks. Try again.",
491
+ tasksLoading: "Loading tasks…", tasksLoadFailed: "Could not load tasks. Try again.", tasksEmpty: "No tasks yet. Add the first one.",
492
+ tasksEmptyFiltered: "No tasks with this status.", tasksCreate: "Add task", tasksTitleLabel: "Title",
493
+ tasksTitlePlaceholder: "What needs doing?", tasksDescriptionLabel: "Description", tasksDescriptionPlaceholder: "Add details, links, or acceptance notes",
494
+ tasksAssigneeLabel: "Assignee", tasksUnassigned: "Unassigned", tasksFilterLabel: "Show", tasksFilterAll: "All statuses",
495
+ tasksDueDateLabel: "Due date", tasksDueOn: ({ date }) => `Due ${date}`, tasksOverdue: "Overdue",
496
+ tasksParticipantsLabel: "Participants", tasksParticipantsMeta: ({ names }) => `Participants: ${names}`,
497
+ tasksConclusionLabel: "Conclusion", tasksConclusionPlaceholder: "What was the outcome?",
498
+ tasksStepsLabel: "Steps", tasksAddStep: "Add step", tasksRemoveStep: "Remove step", tasksStepPlaceholder: "Describe a step",
499
+ tasksStepDoneLabel: "Step done", tasksStepsHint: "Up to 30 steps. Check the ones that are done.",
500
+ tasksStepsProgress: ({ done, total }) => `${done} of ${total} step${total === 1 ? "" : "s"} done`,
501
+ tasksStatusTodo: "To do", tasksStatusDoing: "Doing", tasksStatusDone: "Done",
502
+ tasksSummary: ({ count }) => `${count} task${count === 1 ? "" : "s"}`, tasksCreator: ({ name }) => `Created by ${name}`, tasksUpdated: ({ time }) => `Updated ${time}`,
503
+ tasksEditHeading: "Edit task", tasksEditLabel: ({ title }) => `Edit ${title}`, tasksDeleteLabel: ({ title }) => `Delete ${title}`, tasksStatusFor: ({ title }) => `Status for ${title}`,
504
+ tasksInvalid: "Add a title of 1–200 characters.", tasksCreateFailed: "Could not add this task. Try again.",
505
+ tasksLimitReached: "This room has reached its task limit ({limit}). Delete completed tasks before adding another.", tasksUpdateFailed: "Could not update this task. Try again.",
506
+ tasksDeleteFailed: "Could not delete this task. Try again.", tasksDeleteConfirm: ({ title }) => `Delete “${title}”? This cannot be undone.`,
507
+ earlierMessages: "Earlier messages omitted", messagesBetweenOmitted: "Messages between this reading point and latest are omitted.", you: "You", saved: "Saved",
508
+ savedMemory: "Saved for this tab only", copyFailed: ({ id }) => `Copy failed. Copy manually: ${id}`,
509
+ copyMessage: "Copy", copiedMessage: "Copied", copyMessageFailed: "Could not copy. Select and copy the message manually.", wrapCode: "Wrap code",
510
+ replyMessage: "Reply", replyingTo: "Replying to", cancelReply: "Cancel reply", replyOpenOriginal: "View original message", replyOriginalUnavailable: "Original message is unavailable.", replyOriginalRecalled: "Original message was recalled.",
511
+ forwardMessage: "Forward", forwardTitle: "Forward message", forwardHint: "Choose where to forward this message.",
512
+ forwardConfirm: ({ target }) => `Forward this message to ${target}?`, forwardNoTargets: "No forward targets are configured for this room.",
513
+ forwardUnavailable: "Forwarding is not available on this server.", forwardLoadFailed: "Could not load forward targets.",
514
+ forwardFailed: ({ message }) => `Forward failed: ${message}`,
515
+ recallMessage: "Recall", recallSystemMessage: "Recall this room notice", recallSystemConfirm: "Recall this room notice? Everyone will see it as recalled.", recallConfirm: "Recall this message? Everyone will see it as recalled.", recallAdminConfirm: ({ name }) => `Recall ${name}'s message? Everyone will see it as recalled.`, recallFailed: "Could not recall this message.", messageRecalled: "Message recalled", recalledBy: ({ name }) => `Recalled by ${name}`, showRecalled: "View original", hideRecalled: "Hide original", reeditMessage: "Re-edit", reeditReplaceDraft: "Replace the current draft with this message?", revealFailed: "Load failed. Retry",
516
+ identityChanged: "This browser identity changed in another tab. Reload this tab before continuing.",
517
+ networkError: "Network connection failed", requestFailed: ({ status }) => `Request failed (HTTP ${status})`,
518
+ roomIdRequired: "Enter a room ID", nameRequired: "Enter your name", authRetry: "The server requires an access token. Enter it and try again.",
519
+ networkRetry: "Unable to connect to the server. Check your network and try again.",
520
+ joinFailed: ({ message }) => `Could not join: ${message}`, roomNameRequired: "Enter a room name",
521
+ createFailed: ({ message }) => `Could not create the room: ${message}`,
522
+ roomNotFound: "This room is gone, or you no longer have access.",
523
+ sendAuth: "Send failed: an access token is required", sendNetwork: "Send failed. Your message is saved below.",
524
+ sendFailed: ({ message }) => `Send failed: ${message}`,
525
+ adminRoomDeleteDenied: "This room is designated for administration. Only the room owner can delete it.",
526
+ failedMessages: "Messages not sent", retryFailed: "Retry", discardFailed: "Discard",
527
+ roomListError: "Unable to load rooms. You can enter a room ID directly.", guest: "Guest",
528
+ roomsLabel: "Rooms", refreshRooms: "Refresh rooms", identityLabel: ({ name }) => `Chatting as ${name}`,
529
+ roomsMenu: "Open room list", closeRoomList: "Close room list",
530
+ direct: "Direct", messagePrivately: "Message privately", removeMember: "Remove",
531
+ kickConfirm: ({ name }) => `Remove ${name} from this room? They can rejoin with the room ID.`,
532
+ leaveRoomConfirm: ({ name }) => `Leave “${name}”? You will leave this room; you can rejoin later with its ID.`,
533
+ deleteRoom: "Delete room", deleteConfirm: ({ name }) => `Delete “${name}” and all its messages? This cannot be undone.`,
534
+ allMembers: "Everyone", messageCount: ({ count }) => `${count} / 5000`,
535
+ pasteAsFile: ({ count }) => `Pasted ${count} characters saved as a text file`,
536
+ sendAsFile: ({ count }) => `${count} characters exceed the limit; sending as a text file`,
537
+ privacyNote: "Anyone with the shared token can read direct messages and manage rooms; the server can read them too.",
538
+ resourceDelete: "Delete file", resourceDeleting: "Deleting…", resourceDeleteConfirm: ({ name }) => `Delete “${name}”? This cannot be undone.`, resourceDeleted: "File deleted.", resourceDeleteFailed: "Could not delete this file.",
539
+ systemJoined: ({ name }) => `${name} joined the room`, systemLeft: ({ name }) => `${name} left the room`, systemRemoved: ({ name }) => `${name} was removed from the room`,
540
+ systemDesignated: ({ actor, name }) => `${actor} designated ${name} as administrator`, systemRevoked: ({ actor }) => `${actor} revoked the administrator designation`, systemRenamed: ({ actor, from, to }) => `${actor} renamed the room from "${from}" to "${to}"`, systemDescribed: ({ actor }) => `${actor} updated the room description`, systemHanded: ({ actor, name }) => `${actor} handed the room to ${name}`, systemAdminsUpdated: ({ actor }) => `${actor} updated the room administrators`, systemSuccessorNamed: ({ actor, name }) => `${actor} named ${name} as the room successor`, systemSuccessorCleared: ({ actor }) => `${actor} cleared the room successor`, systemJoinPolicy: ({ actor, policy }) => policy === "approval" ? `${actor} now requires approval to join this room` : `${actor} opened this room to join without approval`,
541
+ systemForwarded: ({ target }) => `Forwarded to ${target}`, systemForwardFailed: ({ target, reason }) => `Forward to ${target} failed: ${reason}`,
542
+ activity_working: "Working", activity_idle: "Foreground idle", activity_waiting: "Waiting", activity_unknown: "Status unknown", activity_offline: "Status stale",
543
+ activityHint_working: "The agent reports active work.", activityHint_idle: "Foreground is idle; background work may continue.", activityHint_waiting: "The agent reports that it is waiting.", activityHint_unknown: "No activity report is available.", activityHint_offline: "The last status is stale; this does not prove the agent is offline.",
544
+ receiptCount: ({ count }) => `Read by ${count}`, receiptNone: "No readers yet", receiptAllRead: "Everyone has read this message", receiptNotLoaded: "Read status not loaded", readerPanelTitle: "Message readers", close: "Close", departedMember: "left",
545
+ confirmTitle: "Please confirm", cancel: "Cancel", confirmAction: "Confirm",
546
+ receiptEvidence_displayed: "Shown on screen", receiptEvidence_tool: "Fetched with room tool", receiptEvidence_context: "In agent context",
547
+ },
548
+ "zh-CN": {
549
+ brand: "OC Chat", documentTitle: "OC Chat", roomTitle: ({ name }) => `${name} · OC Chat`,
550
+ tagline: "一个轻量的聊天房间。输入房间 ID 加入,或直接新建一个。", languageLabel: "语言",
551
+ restoringSession: "正在恢复会话…", retry: "重试", roomOptions: "选项",
552
+ roomIdLabel: "房间 ID", roomIdPlaceholder: "粘贴或输入房间 ID", nameLabel: "你的昵称",
553
+ namePlaceholder: "怎么称呼你", joinRoom: "加入房间", or: "或", newRoomNameLabel: "新房间名称",
554
+ newRoomNamePlaceholder: "例如:周末电影夜", createRoom: "创建新房间", tokenOptional: "访问令牌(可选)",
555
+ joinRoomTitle: "加入房间", joinRoomHint: "有人把房间 ID 分享给你?粘贴到这里。",
556
+ createRoomTitle: "创建房间", createRoomHint: "新建一个房间,再把房间 ID 发给别人。",
557
+ requireApproval: "加入需要审核", requireApprovalHint: "新成员需经人类管理员审核;Agent 也可以由管理员 Agent 审核。",
558
+ joinPolicyEditHint: "新成员需经人类管理员审核。关闭后,所有待审核申请都会被清除。", joinPolicyOpenConfirm: "关闭加入审核?所有待审核的加入申请都会被清除。",
559
+ approvalRequired: "需审核加入", joinRequired: "需审核加入", joinPendingStatus: "等待审核",
560
+ joinPendingTitle: "等待审核", joinApprovalPrompt: ({ name }) => `申请加入“${name}”?需要人类管理员审核通过。`, joinPendingBody: ({ name }) => `加入“${name}”的申请已发送,需人类管理员审核通过后才能进入。`,
561
+ joinPendingHint: "可以离开此页面,申请会保留;稍后可在房间列表查看。", joinPendingNotice: ({ name }) => `已发送加入“${name}”的申请,正在等待人类管理员审核。`, joinPendingCancel: "取消申请", joinPendingCancelError: "取消申请失败,请重试。",
562
+ joinPendingGoneTitle: "申请已不在等待", joinPendingGoneBody: "申请可能已被拒绝或清除,可以重新发送。", joinPendingAgain: "重新申请",
563
+ joinPendingError: "无法检查申请状态,请重试。", joinPendingRoomGone: "房间不存在,或你已无权访问。",
564
+ joinNameTaken: "这个昵称已被房间里的成员使用,请换一个。",
565
+ joinRequestsTitle: "加入申请", joinRequestsHint: "Agent 的申请也可以由管理员 Agent 审核。", joinRequestsEmpty: "暂无待审核申请。",
566
+ joinRequestsLoadFailed: "无法加载加入申请。", joinRequestAlreadyHandled: "这个申请已经被处理过了。", joinRequestApprove: "通过", joinRequestDeny: "拒绝", joinRequestAgent: "Agent", joinRequestHuman: "人类",
567
+ joinRequestApproveLabel: ({ name }) => `通过 ${name} 的加入申请`, joinRequestDenyLabel: ({ name }) => `拒绝 ${name} 的加入申请`,
568
+ joinRequestTime: ({ time }) => `申请于 ${time}`, joinRequestApproved: ({ name }) => `已通过 ${name} 的申请。`, joinRequestDenied: ({ name }) => `已拒绝 ${name} 的申请。`,
569
+ joinRequestActionFailed: ({ message }) => `操作失败:${message}`, membersWithRequests: ({ count }) => `成员,${count} 个待审核加入申请`,
570
+ accessKeyTitle: "访问密钥", accessKeyHint: "这个服务器需要访问密钥。密钥保存在当前浏览器里,并随每个请求发送。",
571
+ bearerToken: "Bearer Token", tokenPlaceholder: "服务器要求时填写", save: "保存",
572
+ tokenHint: "若服务器设置了访问令牌(401),所有请求都会带上它。", existingRooms: "房间",
573
+ noRooms: "还没有房间,创建一个吧。", copyRoomId: "复制房间 ID", loadingHistory: "正在加载更早的消息",
574
+ editRoom: "编辑房间", editRoomSections: "编辑房间分区", editRoomDetails: "房间信息", editRoomJoining: "加入与审核", editRoomMembers: "成员与角色", editRoomOwnership: "所有权", roomOwnerOnlyTitle: "仅房主或管理员可修改", roomOwnerOnlyNote: ({ owner }) => `只有房主或房间管理员可以修改这些设置。这个房间属于 ${owner}。`, roomNameLabel: "房间名称", roomDescriptionLabel: "描述", adminAgentLabel: "管理员 Agent", roomOwnerBadge: "房主", roomAdminBadge: "管理员",
575
+ adminIdsLabel: "成员管理员", adminIdsHint: "这些成员可以修改房间信息、管理成员、删除文件并指定接任者。房主始终拥有这些权限。", adminIdsEmpty: "房间里暂无其他成员。", newOwnerLabel: "新房主", newOwnerHint: "可以把房间交给房间里的另一个人。只有房主可以操作;Agent 不能成为房主。",
576
+ successorLabel: "房主离开后的接任者", successorNone: "最早加入的成员", successorHint: "房主离开后,此人接任房主;管理员离开后,此人接任管理员。留空则最早加入的成员接任房主。", ownerOnlySettingsNote: "只有房主可以更改管理员 Agent 或移交房间。", adminAgentHint: "被指定的 Agent 可用 admin 工具查看此房间及其历史。只有房主可以更改,留空表示不指定。",
577
+ noAdminAgent: "不指定", openQuestions: ({ count }) => `${count} 个待回答的问题`,
578
+ newRoom: "创建房间",
579
+ copyRoomIdTitle: ({ id }) => `点击复制完整房间 ID:${id}`, copied: "已复制", members: "成员",
580
+ membersCount: ({ count }) => `成员 ${count}`, noMembers: "暂无成员", settings: "设置", profileMenu: "个人资料和设置",
581
+ questions: "提问", pendingQuestions: "待回答的问题", refreshQuestions: "刷新",
582
+ announcements: "公告栏", announcementName: "名称", announcementContent: "内容",
583
+ reminders: "提醒", reminderSchedule: "计划", reminderOnce: "单次", reminderDate: "日期和时间",
584
+ reminderCron: "5 字段 CRON 表达式", reminderTimezone: "时区覆盖(可选)", reminderTimezoneHint: "留空则使用服务器时区。填写 IANA 时区会应用于两种计划。服务器会拒绝夏令时调整中不存在或重复的单次时间。",
585
+ reminderText: "提醒内容", reminderTemplateHint: "可使用 {{time}}、{{initiator}} 和 {{room}}。", reminderCreate: "创建提醒",
586
+ reminderLoading: "正在加载提醒…", reminderEmpty: "暂无提醒。", reminderPaused: "已禁用", reminderNext: ({ time }) => `下次:${time}`,
587
+ reminderPause: "禁用", reminderResume: "启用", reminderDelete: "删除", reminderDeleteConfirm: "确定删除此提醒?",
588
+ reminderEdit: "编辑", reminderEditHeading: "编辑提醒", reminderSave: "保存修改",
589
+ reminderCreated: "提醒已创建。", reminderUpdated: "提醒已更新。", reminderDeleted: "提醒已删除。",
590
+ reminderInvalid: "请检查日期、5 字段 CRON 表达式、IANA 时区和提醒内容。", reminderLoadFailed: "无法加载提醒,草稿仍已保留。",
591
+ diagramLoading: "正在渲染图表…", diagramRenderFailed: "图表无法显示,以下为源代码。", resourceLoading: "正在加载文件…", resourceFailed: "无法加载此文件。", resourceDownload: "下载", resourceMoreActions: "{name} 的更多操作", resourcePreview: "预览", resourceHide: "收起预览", docPreviewEyebrow: "Markdown 预览", docPreviewFileEyebrow: "文件预览", docPreviewFailed: "无法加载此文档。", docPreviewEmpty: "此文档为空。", docPreviewTooLarge: "文件太大,无法预览(超过 2 MB),请下载查看。", docPreviewOfficeTooLarge: "Office 文件太大,无法预览(超过 20 MB),请下载查看。", docPreviewFullscreen: "全屏", docPreviewExitFullscreen: "退出全屏", docPreviewOfficeFailed: "无法预览此 Office 文件,请下载查看。", sidePaneResize: "调整侧边栏宽度", zoomImage: "查看大图", imagePreviewTitle: "图片预览", imageZoomControls: "图片缩放", zoomIn: "放大", zoomOut: "缩小", zoomReset: "重置缩放", openDiagram: "查看图表", diagramViewerTitle: "图表", diagramZoomControls: "图表缩放", diagramFit: "适应窗口", installTitle: "安装 OC Chat", installBody: "添加到主屏幕,获得全屏聊天体验。", installAction: "安装", installHow: "如何安装", installNotNow: "暂不", installIosGuide: "点击共享按钮,然后选择“添加到主屏幕”。",
592
+ pwaUpdateTitle: "有可用更新", pwaUpdateBody: "新版本已准备好。可以立即刷新,或下次打开时再升级。", pwaUpdateNow: "立即升级", pwaUpdateLater: "稍后",
593
+ pwaDownloadingTitle: "正在下载新版本…", pwaDownloadingBody: "可继续使用当前页面,只有你选择升级时才会切换。",
594
+ pwaReadyPartialTitle: ({ count }) => `新版本已就绪(${count} 项未缓存)`, pwaReadyPartialBody: "仍可正常升级;缺失项会在首次使用时联网加载。",
595
+ pwaFailedTitle: "更新失败", pwaFailedBody: "继续使用当前版本,下次检查时会自动重试。", pwaRetry: "重试",
596
+ announcementDelete: "删除公告",
597
+ announcementNew: "新建公告", announcementEmpty: "暂无公告。", announcementLoading: "正在加载公告…",
598
+ announcementLoadFailed: "无法加载公告,草稿仍已保留。", announcementSaved: "公告已保存。", announcementDeleted: "公告已删除。",
599
+ announcementDuplicate: "此名称已存在。请选择该公告进行编辑,或使用其他名称。", announcementDeleteConfirm: ({ name }) => `删除“${name}”?`, announcementCount: ({ count }) => `${count} / 5000`, announcementInvalid: "名称需为 1–64 个字符,内容不能超过 5000 个字符。",
600
+ questionsLoading: "正在加载问题…", questionsEmpty: "没有待回答的问题。",
601
+ questionsFailed: "无法加载问题,请重试。", questionsUnsupported: "此服务器不支持查看待回答问题。", questionLabel: "问题",
602
+ answerQuestion: "回复", answerPlaceholder: "写下回复…", sendAnswer: "发送回复", selectQuestion: "回复此问题", copyQuestion: "复制问题", questionCopied: "问题已复制。", questionCopyFailed: "无法复制问题。",
603
+ answerFailed: "回复失败,草稿仍已保留。", answerTooLong: "回复不能超过 5,000 个字符。", questionAlreadyAnswered: "此问题已由其他人回答。",
604
+ adminBindingGuide: "选择管理员房间和其中的 Agent,再将邀请私下发送给该 Agent 完成设置。", adminRoomLabel: "管理员房间", adminDesignateAgent: "邀请 Agent",
605
+ adminAccess: "管理", adminToken: "管理令牌", openAdministration: "打开管理面板", administration: "管理面板", designations: "管理绑定", adminRoom: "管理员房间", targetRoom: "Agent 所属房间", adminScopeNote: "请选择管理员房间内的 Agent。管理员可以管理所有房间。", adminRoomBadge: "管理", targetAgent: "已注册 Agent", designate: "指定管理员", revokeDesignation: "撤销绑定", globalStatus: "全局状态", adminTasks: "任务", taskText: "任务内容", dispatchTask: "派发任务", timers: "定时任务", planName: "定时任务名称", createTimer: "创建定时任务",
606
+ adminLoading: "正在加载管理面板…", refreshAdmin: "刷新", chooseAdminRoom: "选择普通房间", chooseTargetRoom: "选择 Agent 房间", chooseAgent: "选择已注册 Agent", taskTargetRoom: "任务目标房间", taskTargetAgent: "任务目标 Agent", createAdminRoomFirst: "请先按普通流程创建房间,再选作管理房间。", noAgents: "没有已注册的 Agent", selectAdminAgent: "请选择管理房间和已注册的 Agent。", adminDesignated: "管理员已立即生效,长期有效,直到撤销。", revokeConfirm: "撤销此管理绑定?普通房间会保留。", updateTask: "更新任务", task_pending: "待处理", task_working: "进行中", task_blocked: "受阻", task_completed: "已完成", task_cancelled: "已取消", nextRun: ({ time, minutes }) => `每 ${minutes} 分钟 · 下次 ${time}`, paused: "已暂停", pauseTimer: "暂停", resumeTimer: "恢复", deleteTimer: "删除", deleteTimerConfirm: ({ name }) => `删除定时任务“${name}”?`,
607
+ tokenRequired: "服务器要求访问令牌(401)。",
608
+ themeLabel: "主题", themeSystem: "跟随系统", themeLight: "浅色", themeDark: "深色", themeForest: "森林", themeSand: "沙丘", themeCustom: "自定义主题", themeCustomColor: "自定义主题颜色",
609
+ windowFrameLabel: "显示模式", windowFrameHint: "内容铺满占满整个窗口;窗口模式保留内嵌卡片边框。",
610
+ windowFrameFramed: "窗口模式", windowFrameBorderless: "内容铺满",
611
+ chatBackgroundLabel: "聊天背景", chatBackgroundHint: "仅显示在当前浏览器,铺满应用后面的整个窗口。透明度低一些更易阅读。",
612
+ chatBackgroundMode: "模式", chatBackgroundDefault: "默认", chatBackgroundColor: "颜色", chatBackgroundImage: "图片",
613
+ chatBackgroundOpacity: "透明度", chatBackgroundScope: "范围", chatBackgroundScopeRoom: "当前房间", chatBackgroundScopeAll: "所有房间",
614
+ chatBackgroundReset: "重置", chatBackgroundTooLarge: "请选择不超过 2 MiB 的图片。",
615
+ chatBackgroundInvalidType: "请选择图片文件。",
616
+ chatBackgroundApplying: "正在读取 {name}…", chatBackgroundApplied: "已应用 {name}。",
617
+ chatBackgroundImageFailed: "无法读取这张图片。", chatBackgroundSaveFailed: "无法在当前浏览器保存背景。",
618
+ settingsLocalHint: "语言、主题、过渡和滚动选项保存在当前浏览器中。", settingsSections: "设置分区", settingsGeneral: "通用", settingsAppearance: "外观", settingsConnection: "连接",
619
+ settingsLanguageHint: "立即生效,并保存在当前浏览器中。", settingsThemeHint: "保存在当前浏览器中。跟随系统会使用设备的外观设置。", settingsTokenHint: "仅保存在当前浏览器中,仅在服务器要求时填写。",
620
+ settingsPanelMode: "工具窗口", settingsPanelModeHint: "选择每个房间工具在宽屏上的打开方式。窄屏或矮窗口始终使用弹窗。", panelModeDialog: "弹窗", panelModePane: "侧边栏",
621
+ settingsIntegrations: "平台集成",
622
+ integrationsHint: "通过上传插件把房间连接到外部平台。密钥值只保存在服务器上。",
623
+ integrationsExternalConfig: "此集成使用外部配置文件。请编辑该文件,或在保存托管设置前先停用它。",
624
+ integrationsEnable: "启用集成", integrationsEnableHint: "保存后生效。",
625
+ integrationsAccounts: "账号", integrationsAddAccount: "添加账号", integrationsEmptyAccounts: "还没有账号。",
626
+ integrationsPlugins: "插件", integrationsUploadPlugin: "上传插件", integrationsEmptyPlugins: "还没有上传插件。",
627
+ integrationsRules: "出站规则", integrationsRulesHint: "出站规则把房间事件转发到已连接的账号。可使用 JSON 或 YAML;每个目标必须使用已存在的账号。",
628
+ integrationsInboundRules: "入站路由", integrationsInboundHint: "入站路由把外部消息带入房间。每条路由都需要已配置的账号和目标房间。",
629
+ integrationsRulesFormat: "规则格式", integrationsEditorUnavailable: "代码编辑器无法加载,已改用纯文本编辑。",
630
+ integrationsRulesErrors: "请先修复高亮的错误({count} 个)。{first}",
631
+ integrationsSave: "保存集成", integrationsLoading: "正在加载集成…", integrationsLoadFailed: "无法加载集成,请重试。",
632
+ integrationsPlugin: "插件", integrationsEnv: "环境变量", integrationsEnvKey: "变量名", integrationsEnvValue: "变量值",
633
+ integrationsLeaveBlank: "留空以保留该变量的已存储值", integrationsEnvHint: "填写某个值只会替换该变量;留空的行保持原值。",
634
+ integrationsAddEnv: "添加变量", integrationsClearEnv: "清除所有变量", integrationsKeepEnv: "保留所有变量",
635
+ integrationsClearEnvActive: "保存后将清除所有已存储的变量。", integrationsEnvInvalid: "变量名只能包含字母、数字和下划线,且不能重复。",
636
+ integrationsAccountTitle: "集成账号", integrationsAccountId: "账号 ID", integrationsAccountIdHint: "留空自动生成", integrationsPlatform: "平台",
637
+ integrationsAccountDetails: "账号信息", integrationsAdvanced: "高级设置", integrationsKeepStored: "保留已存储值", integrationsNotSet: "未设置",
638
+ integrationsAccountRequired: "请填写必填的账号字段:{fields}。",
639
+ integrationsAccountInvalid: "请选择插件;账号 ID 可以留空自动生成。", integrationsRemoveAccountConfirm: ({ id }) => `确定移除账号“${id}”?保存集成配置后才会真正删除。`, integrationsDuplicateAccount: "已存在相同 ID 的账号。",
640
+ integrationsAccountSaved: "账号已保存。保存集成后生效。", integrationsAccountRemoved: "账号已移除。保存集成后生效。",
641
+ integrationsLastError: "最近错误", integrationsEdit: "编辑", integrationsRemove: "移除",
642
+ integrationsInvalidJson: "规则 JSON 在第 {line} 行附近无效。", integrationsInvalidRules: "规则必须是 JSON 数组。",
643
+ integrationsFromRequired: "第 {index} 条规则的 from 必须使用 chatroom/center。", integrationsTargetRequired: "第 {index} 条规则的目标 {target} 缺少 {field}。",
644
+ integrationsTargetMissing: "第 {index} 条规则的目标 {target} 找不到账号“{account}”。",
645
+ integrationsNeedAccount: "保存前请至少添加一个账号。", integrationsPluginFirst: "请先上传插件,再添加账号。",
646
+ integrationsStateStarted: "运行中", integrationsStateStarting: "启动中", integrationsStateStopped: "已停止",
647
+ integrationsStateError: "错误", integrationsStateUnknown: "未知",
648
+ integrationsPluginFile: "选择适配器文件", integrationsPluginName: "插件文件名", integrationsPluginSource: "JavaScript 源码",
649
+ integrationsPluginHint: "合法插件会在 initialize 握手中声明平台和账号字段;上传不会启动账号,也不需要凭据。",
650
+ integrationsDownloadPlugin: "下载 {name}",
651
+ integrationsPluginPaste: "粘贴插件 JavaScript(最大 256 KiB)", integrationsUpload: "上传插件",
652
+ integrationsUploaded: "插件已上传。请为账号选择它。", integrationsSourceTooLarge: "插件源码不能超过 256 KiB。",
653
+ integrationsNameRequired: "请使用 .js、.mjs、.cjs 或 .ts 文件名。", integrationsPlatformRequired: "平台标识需为 1–128 个字母、数字、点、短横线或下划线。",
654
+ integrationsSourceRequired: "请粘贴或选择插件 JavaScript。",
655
+ integrationsEnabled: "集成已启用。", integrationsDisabled: "集成已停用。", integrationsEnablePending: "保存集成后即可启动运行时。",
656
+ integrationsSavedEnabled: "已保存,集成已启用。", integrationsDisableConfirm: "停用集成?保存后运行时会停止;账号和规则仍会保留。", integrationsDisabledHint: "启用集成并保存后,才能编辑账号、插件和规则。", integrationsSavedDisabled: "已保存,集成已停用。",
657
+ contentTransition: "内容区域过渡", contentTransitionHint: "使用 Alt+方向键切换房间时,让消息内容按方向滑动。默认关闭。", pageStep: "翻页距离", pageStepHint: "每次按 PageUp 或 PageDown 滚动会话高度的百分比。默认 90%。", leave: "离开", reconnecting: "连接中断,正在重试…",
658
+ messageList: "消息列表", noMessages: "还没有消息,说点什么吧。", latestMessages: "回到最新消息",
659
+ mentionMembers: "选择要提及的成员", messagePlaceholder: "输入消息,Enter 发送",
660
+ attachments: "附件", addFiles: "添加文件", dropFilesHere: "将文件拖到这里添加",
661
+ attachmentVolatile: "粘贴的文件刷新后可恢复;文件选择器添加的文件仅在当前标签页有效。", attachmentNotPersisted: "文件过大,无法在刷新后恢复。发送完成前请保持此标签页打开。", retryUpload: "重试", removeFile: "移除",
662
+ uploadQueued: "等待上传", uploadReady: "可以发送", sendAsFileFailed: "上传失败,文字仍在输入框中。", uploadPercent: ({ percent }) => `正在上传 ${percent}%`,
663
+ uploadFailed: ({ reason } = {}) => reason ? `上传失败(${reason}),请重试或移除文件。` : "上传失败,请重试或移除文件。",
664
+ fileUnreadable: "这个文件读不出来:它可能是其他 App 的临时文件,或者还在云端。请先保存到本地(或截图)再发送。",
665
+ fileTooLarge: "文件超过服务器当前大小限制。",
666
+ send: "发送", roomMeta: ({ members, count }) => `${members} 人 · ${count} 条消息`, joinArrow: "加入 →",
667
+ joinDirectTitle: "点击直接加入", mentionEmpty: "没有匹配的成员", mentionHint: "↑↓ 选择 · Enter 确认 · Esc 关闭",
668
+ shortcutsTitle: "键盘快捷键", shortcutsLead: "ChatRoom 快捷键。按 {modifier} + / 打开此列表。",
669
+ shortcutsOpen: "全部快捷键",
670
+ shortcutsWriting: "输入", shortcutsSend: "发送消息", shortcutsNewline: "换行",
671
+ shortcutsMention: "选择要提及的成员", shortcutsRooms: "房间", shortcutsSearch: "搜索与命令", shortcutsOpenPalette: "打开搜索与命令面板",
672
+ shortcutsSwitchRoom: "切换到上一个或下一个房间", shortcutsNumberRoom: "按编号切换到已加入的房间", shortcutsReading: "阅读",
673
+ shortcutsScroll: "输入时滚动消息", shortcutsJump: "跳到会话开头或结尾", shortcutsMenus: "菜单和对话框",
674
+ shortcutsClose: "关闭当前菜单、面板或对话框",
675
+ paletteTitle: "搜索与命令", paletteSearchLabel: "搜索消息",
676
+ palettePlaceholder: "搜索消息,输入 / 使用命令", paletteScopeRoom: "当前房间", paletteScopeAll: "全部房间",
677
+ paletteScopeHint: "按 Tab 在当前房间和全部已加入房间之间切换", paletteSearchMode: "搜索", paletteCommandMode: "命令",
678
+ paletteSearching: "正在搜索…", paletteNoResults: "没有找到消息。", paletteNoCommands: "没有匹配的命令。",
679
+ paletteResults: ({ count }) => `${count} 条结果`, paletteCommandsHint: "常用命令",
680
+ paletteHint: "↑↓ 或 Alt+1–9 选择 · Enter 打开 · Tab 切换范围 · Esc 关闭", paletteSearchFailed: "搜索失败,请重试。",
681
+ paletteLeaveRoom: "离开房间", paletteJumpLatest: "跳到最新消息",
682
+ filesTitle: "文件", filesEyebrow: "房间文件", filesFilter: "上传者", filesEveryone: "所有人",
683
+ filesUnknownUploader: "未知上传者", filesSummary: ({ count, size }) => `${count} 个文件 · ${size}`,
684
+ filesLoading: "正在加载文件…", filesLoadFailed: "无法加载文件,请重试。", filesEmpty: "这个房间还没有文件。",
685
+ filesEmptyFiltered: "此上传者没有文件。", filesLoadMore: "加载更多",
686
+ filesHint: "可预览图片、音频、视频、Markdown、文本、代码和 PDF,所有文件都可下载。",
687
+ filesPreviewFailed: "无法加载预览。", filesDownloadFailed: "无法下载此文件。",
688
+ filesPreviewLabel: ({ name }) => `预览 ${name}`, filesDownloadLabel: ({ name }) => `下载 ${name}`,
689
+ filesDeleteLabel: ({ name }) => `删除 ${name}`, filesRefresh: "刷新文件",
690
+ tasksTitle: "任务", tasksEyebrow: "房间任务", tasksRefresh: "刷新任务", tasksMenuLabel: "任务操作",
691
+ tasksClearCompleted: "清除已完成任务", tasksClearConfirm: ({ count }) => `清除 ${count} 个已完成任务?此操作无法撤销。`,
692
+ tasksClearFailed: "无法清除已完成任务,请重试。",
693
+ tasksLoading: "正在加载任务…", tasksLoadFailed: "无法加载任务,请重试。", tasksEmpty: "还没有任务,添加第一个吧。",
694
+ tasksEmptyFiltered: "此状态下没有任务。", tasksCreate: "添加任务", tasksTitleLabel: "标题",
695
+ tasksTitlePlaceholder: "需要做什么?", tasksDescriptionLabel: "描述", tasksDescriptionPlaceholder: "补充细节、链接或完成标准",
696
+ tasksAssigneeLabel: "负责人", tasksUnassigned: "未指派", tasksFilterLabel: "显示", tasksFilterAll: "全部状态",
697
+ tasksDueDateLabel: "截止日期", tasksDueOn: ({ date }) => `截止 ${date}`, tasksOverdue: "已逾期",
698
+ tasksParticipantsLabel: "参与人员", tasksParticipantsMeta: ({ names }) => `参与人员:${names}`,
699
+ tasksConclusionLabel: "结论", tasksConclusionPlaceholder: "最终结果如何?",
700
+ tasksStepsLabel: "完成步骤", tasksAddStep: "添加步骤", tasksRemoveStep: "删除步骤", tasksStepPlaceholder: "描述一个步骤",
701
+ tasksStepDoneLabel: "步骤已完成", tasksStepsHint: "最多 30 个步骤,勾选已完成的步骤。",
702
+ tasksStepsProgress: ({ done, total }) => `已完成 ${done}/${total} 步`,
703
+ tasksStatusTodo: "待办", tasksStatusDoing: "进行中", tasksStatusDone: "已完成",
704
+ tasksSummary: ({ count }) => `${count} 个任务`, tasksCreator: ({ name }) => `由 ${name} 创建`, tasksUpdated: ({ time }) => `更新于 ${time}`,
705
+ tasksEditHeading: "编辑任务", tasksEditLabel: ({ title }) => `编辑 ${title}`, tasksDeleteLabel: ({ title }) => `删除 ${title}`, tasksStatusFor: ({ title }) => `${title} 的状态`,
706
+ tasksInvalid: "标题需为 1–200 个字符。", tasksCreateFailed: "无法添加任务,请重试。",
707
+ tasksLimitReached: "任务已达上限({limit} 个),请先删除已完成任务再添加", tasksUpdateFailed: "无法更新任务,请重试。",
708
+ tasksDeleteFailed: "无法删除任务,请重试。", tasksDeleteConfirm: ({ title }) => `删除“${title}”?此操作无法撤销。`,
709
+ joined: "已加入", joinAction: "加入房间", unreadMessages: ({ count }) => `${count} 条未读`,
710
+ today: "今天", yesterday: "昨天", earlierMessages: "更早的消息已省略", messagesBetweenOmitted: "此阅读位置与最新消息之间的部分消息已省略。", you: "我", saved: "已保存",
711
+ savedMemory: "仅保存于当前标签页", copyFailed: ({ id }) => `复制失败,请手动复制:${id}`,
712
+ copyMessage: "复制", copiedMessage: "已复制", copyMessageFailed: "复制失败,请手动选择并复制消息。", wrapCode: "自动换行",
713
+ replyMessage: "回复", replyingTo: "回复给", cancelReply: "取消回复", replyOpenOriginal: "查看原始消息", replyOriginalUnavailable: "原始消息不可用。", replyOriginalRecalled: "原消息已撤回。",
714
+ forwardMessage: "转发", forwardTitle: "转发消息", forwardHint: "选择把这条消息转发到哪里。",
715
+ forwardConfirm: ({ target }) => `把这条消息转发到 ${target}?`, forwardNoTargets: "这个房间没有配置转发目标。",
716
+ forwardUnavailable: "此服务器未开启转发功能。", forwardLoadFailed: "无法加载转发目标。",
717
+ forwardFailed: ({ message }) => `转发失败:${message}`,
718
+ recallMessage: "撤回", recallSystemMessage: "撤回这条房间通知", recallSystemConfirm: "撤回这条房间通知?所有人都会看到“消息已撤回”。", recallConfirm: "撤回这条消息?所有人都会看到“消息已撤回”。", recallAdminConfirm: ({ name }) => `撤回 ${name} 的消息?所有人都会看到“消息已撤回”。`, recallFailed: "撤回失败,请重试。", messageRecalled: "消息已撤回", recalledBy: ({ name }) => `${name} 撤回`, showRecalled: "查看原文", hideRecalled: "收起原文", reeditMessage: "重新编辑", reeditReplaceDraft: "用这条消息替换当前草稿?", revealFailed: "加载失败,重试",
719
+ identityChanged: "此浏览器身份已在另一个标签页中更改,请重新加载此标签页后继续。",
720
+ networkError: "网络连接失败", requestFailed: ({ status }) => `请求失败(HTTP ${status})`,
721
+ roomIdRequired: "请输入房间 ID", nameRequired: "请输入你的昵称", authRetry: "服务器要求访问令牌,请填写后重试",
722
+ networkRetry: "无法连接服务器,请检查网络后重试", joinFailed: ({ message }) => `加入失败:${message}`,
723
+ roomNameRequired: "请输入房间名称", createFailed: ({ message }) => `创建失败:${message}`,
724
+ roomNotFound: "房间不存在,或你已被移出房间", sendAuth: "发送失败:需要访问令牌",
725
+ sendNetwork: "发送失败,消息已保存在下方", sendFailed: ({ message }) => `发送失败:${message}`,
726
+ adminRoomDeleteDenied: "此房间已指定管理员。只有房主可以删除此房间。",
727
+ failedMessages: "未发送的消息", retryFailed: "重试", discardFailed: "删除",
728
+ roomListError: "无法加载房间列表,可直接输入房间 ID 加入。", guest: "访客", roomsLabel: "房间列表",
729
+ refreshRooms: "刷新房间", identityLabel: ({ name }) => `当前昵称:${name}`, roomsMenu: "打开房间列表", closeRoomList: "关闭房间列表", direct: "私聊",
730
+ messagePrivately: "私聊", removeMember: "移除", kickConfirm: ({ name }) => `确定将 ${name} 移出此房间?对方仍可用房间 ID 重新加入。`,
731
+ leaveRoomConfirm: ({ name }) => `离开“${name}”?你将离开这个房间,之后可以用房间 ID 重新加入。`,
732
+ deleteRoom: "删除房间", deleteConfirm: ({ name }) => `删除“${name}”及全部聊天记录?此操作无法撤销。`,
733
+ allMembers: "所有人", messageCount: ({ count }) => `${count} / 5000`,
734
+ pasteAsFile: ({ count }) => `已把粘贴的 ${count} 个字符保存为文本文件`,
735
+ sendAsFile: ({ count }) => `${count} 个字符超出上限,将作为文本文件发送`,
736
+ privacyNote: "持有共享令牌的人都可以读取私聊内容和管理房间;服务器也可以读取私聊内容。", resourceDelete: "删除文件", resourceDeleting: "正在删除…", resourceDeleteConfirm: ({ name }) => `确定删除“${name}”?此操作无法撤销。`, resourceDeleted: "文件已删除。", resourceDeleteFailed: "无法删除此文件。",
737
+ systemJoined: ({ name }) => `${name} 加入了房间`, systemLeft: ({ name }) => `${name} 离开了房间`, systemRemoved: ({ name }) => `${name} 被移出了房间`,
738
+ systemDesignated: ({ actor, name }) => `${actor} 指定 ${name} 为管理员`, systemRevoked: ({ actor }) => `${actor} 撤销了管理员指定`, systemRenamed: ({ actor, from, to }) => `${actor} 将房间名称从“${from}”改为“${to}”`, systemDescribed: ({ actor }) => `${actor} 更新了房间描述`, systemHanded: ({ actor, name }) => `${actor} 将房间移交给了 ${name}`, systemAdminsUpdated: ({ actor }) => `${actor} 更新了房间管理员`, systemSuccessorNamed: ({ actor, name }) => `${actor} 指定 ${name} 为房间继任者`, systemSuccessorCleared: ({ actor }) => `${actor} 清除了房间继任者`, systemJoinPolicy: ({ actor, policy }) => policy === "approval" ? `${actor} 开启了加入审核,新成员需要管理员批准` : `${actor} 关闭了加入审核,新成员可以直接加入`,
739
+ systemForwarded: ({ target }) => `已转发到 ${target}`, systemForwardFailed: ({ target, reason }) => `转发到 ${target} 失败:${reason}`,
740
+ activity_working: "工作中", activity_idle: "前台空闲", activity_waiting: "等待中", activity_unknown: "状态未知", activity_offline: "状态已过期",
741
+ activityHint_working: "Agent 正在报告工作状态。", activityHint_idle: "前台空闲;后台任务仍可能继续。", activityHint_waiting: "Agent 正在报告等待状态。", activityHint_unknown: "暂无活动状态报告。", activityHint_offline: "最近的状态已过期;这不能证明 Agent 已离线。",
742
+ receiptCount: ({ count }) => `已读 ${count} 人`, receiptNone: "尚无人已读", receiptAllRead: "所有人已读", receiptNotLoaded: "尚未加载已读状态", readerPanelTitle: "消息已读情况", close: "关闭", departedMember: "已离开",
743
+ confirmTitle: "请确认", cancel: "取消", confirmAction: "确认",
744
+ receiptEvidence_displayed: "已显示在屏幕上", receiptEvidence_tool: "通过房间工具读取", receiptEvidence_context: "进入上下文",
745
+ },
746
+ ...extraLocales,
649
747
  };
650
-
651
748
  // Every locale falls back to English for keys it has not translated yet.
652
749
  for (const dictionary of Object.values(messages)) {
653
- for (const key of Object.keys(messages.en)) {
654
- if (dictionary[key] === undefined) dictionary[key] = messages.en[key];
655
- }
750
+ for (const key of Object.keys(messages.en)) {
751
+ if (dictionary[key] === undefined)
752
+ dictionary[key] = messages.en[key];
753
+ }
656
754
  }
657
-
658
755
  app.t = (key, values = {}) => {
659
- const entry = messages[app.locale][key] ?? messages.en[key] ?? key;
660
- const text = typeof entry === "function" ? entry(values) : entry;
661
- return String(text).replace(/\{(\w+)\}/g, (_, name) => values[name] ?? "");
756
+ const entry = messages[app.locale][key] ?? messages.en[key] ?? key;
757
+ const text = typeof entry === "function" ? entry(values) : entry;
758
+ return String(text).replace(/\{(\w+)\}/g, (_, name) => String(values[name] ?? ""));
662
759
  };
663
760
  export const { LS, saveToken, api, apiBlob } = createAuth(undefined, undefined, (key, values) => app.t(key, values));
664
761
  app.LS = LS;
@@ -668,14 +765,16 @@ app.setToken = saveToken;
668
765
  // The service worker partitions its image cache by this hash; raw credentials never
669
766
  // leave the page. A missing controller is fine: the identity is posted on controllerchange.
670
767
  async function postMediaIdentity() {
671
- try {
672
- const controller = globalThis.navigator?.serviceWorker?.controller;
673
- const subtle = globalThis.crypto?.subtle;
674
- if (!controller || !subtle) return;
675
- const digest = await subtle.digest("SHA-256", new TextEncoder().encode(`${LS.token}\n${LS.sessionID}`));
676
- const identity = [...new Uint8Array(digest).slice(0, 8)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
677
- controller.postMessage({ type: "SET_MEDIA_IDENTITY", identity });
678
- } catch { /* Image caching stays disabled until an identity can be posted. */ }
768
+ try {
769
+ const controller = globalThis.navigator?.serviceWorker?.controller;
770
+ const subtle = globalThis.crypto?.subtle;
771
+ if (!controller || !subtle)
772
+ return;
773
+ const digest = await subtle.digest("SHA-256", new TextEncoder().encode(`${LS.token}\n${LS.sessionID}`));
774
+ const identity = [...new Uint8Array(digest).slice(0, 8)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
775
+ controller.postMessage({ type: "SET_MEDIA_IDENTITY", identity });
776
+ }
777
+ catch { /* Image caching stays disabled until an identity can be posted. */ }
679
778
  }
680
779
  app.postMediaIdentity = postMediaIdentity;
681
780
  export const SUPPORTED_LOCALES = ["en", "zh-CN", "ja", "ko", "fr", "de", "es", "it"];
@@ -688,133 +787,157 @@ app.state.lastReadTs = new Map(Object.entries(LS.readTs).map(([id, value]) => [i
688
787
  app.state.roomNames = new Map(Object.entries(LS.roomNames));
689
788
  app.state.failedMessages = new Map(Object.entries(LS.failedMessages).map(([id, items]) => [id, Array.isArray(items) ? items.filter((item) => item && typeof item.id === "string" && typeof item.text === "string") : []]));
690
789
  app.saveDraft = (roomId, text) => {
691
- app.state.drafts.set(roomId, text);
692
- LS.drafts = Object.fromEntries(app.state.drafts);
790
+ app.state.drafts.set(roomId, text);
791
+ LS.drafts = Object.fromEntries(app.state.drafts);
693
792
  };
694
793
  app.clearDraft = (roomId) => {
695
- app.state.drafts.delete(roomId);
696
- LS.drafts = Object.fromEntries(app.state.drafts);
794
+ app.state.drafts.delete(roomId);
795
+ LS.drafts = Object.fromEntries(app.state.drafts);
697
796
  };
698
797
  app.saveFailedMessages = (roomId, items) => {
699
- if (items.length) app.state.failedMessages.set(roomId, items);
700
- else app.state.failedMessages.delete(roomId);
701
- LS.failedMessages = Object.fromEntries(app.state.failedMessages);
798
+ if (items.length)
799
+ app.state.failedMessages.set(roomId, items);
800
+ else
801
+ app.state.failedMessages.delete(roomId);
802
+ LS.failedMessages = Object.fromEntries(app.state.failedMessages);
702
803
  };
703
804
  app.savePosition = (roomId, position) => {
704
- app.state.positions.set(roomId, position);
705
- LS.positions = Object.fromEntries(app.state.positions);
805
+ app.state.positions.set(roomId, position);
806
+ LS.positions = Object.fromEntries(app.state.positions);
706
807
  };
707
808
  app.saveReadTs = (roomId, timestamp) => {
708
- app.state.lastReadTs.set(roomId, timestamp);
709
- LS.readTs = Object.fromEntries(app.state.lastReadTs);
809
+ app.state.lastReadTs.set(roomId, timestamp);
810
+ LS.readTs = Object.fromEntries(app.state.lastReadTs);
710
811
  };
711
812
  app.clearPosition = (roomId) => {
712
- app.state.positions.delete(roomId);
713
- LS.positions = Object.fromEntries(app.state.positions);
714
- app.state.lastReadTs.delete(roomId);
715
- LS.readTs = Object.fromEntries(app.state.lastReadTs);
813
+ app.state.positions.delete(roomId);
814
+ LS.positions = Object.fromEntries(app.state.positions);
815
+ app.state.lastReadTs.delete(roomId);
816
+ LS.readTs = Object.fromEntries(app.state.lastReadTs);
716
817
  };
717
818
  app.saveJoinedIds = () => { LS.joinedRoomIds = [...app.state.joinedIds]; };
718
819
  app.saveRoomNames = () => { LS.roomNames = Object.fromEntries(app.state.roomNames); };
719
820
  app.setText = (element, key, values = {}) => {
720
- element.dataset.i18n = key;
721
- element._i18nValues = values;
722
- element.textContent = app.t(key, values);
821
+ element.dataset.i18n = key;
822
+ element._i18nValues = values;
823
+ element.textContent = app.t(key, values);
723
824
  };
724
825
  app.applyLocale = () => {
725
- document.documentElement.lang = app.locale;
726
- document.querySelectorAll("[data-i18n]").forEach((element) => {
727
- const text = element._flashKey
728
- ? app.t(element._flashKey)
729
- : app.t(element.dataset.i18n, element._i18nValues || {});
730
- // Controls with icons keep the graphic and swap only the text label.
731
- const label = element.querySelector(":scope > .i18n-label");
732
- if (label) label.textContent = text; else element.textContent = text;
733
- });
734
- for (const attribute of ["aria-label", "aria-placeholder", "title", "placeholder"]) {
735
- document.querySelectorAll(`[data-i18n-${attribute}]`).forEach((element) => {
736
- element.setAttribute(attribute, app.t(element.getAttribute(`data-i18n-${attribute}`), element._i18nValues || {}));
826
+ document.documentElement.lang = app.locale;
827
+ document.querySelectorAll("[data-i18n]").forEach((element) => {
828
+ const text = element._flashKey
829
+ ? app.t(element._flashKey)
830
+ : app.t(element.dataset.i18n ?? "", element._i18nValues || {});
831
+ // Controls with icons keep the graphic and swap only the text label.
832
+ const label = element.querySelector(":scope > .i18n-label");
833
+ if (label)
834
+ label.textContent = text;
835
+ else
836
+ element.textContent = text;
737
837
  });
738
- }
739
- document.querySelectorAll(".locale-select").forEach((select) => { select.value = app.locale; });
740
- app.autoGrow?.(app.$("#msgInput"));
741
- app.updateDraftCount?.();
742
- app.updateMentionList?.();
743
- app.renderFailedMessages?.();
744
- if (app.state.room) {
745
- app.renderHead();
746
- app.renderMembers();
747
- app.rerenderMessages();
748
- } else app.updateTitle();
838
+ for (const attribute of ["aria-label", "aria-placeholder", "title", "placeholder"]) {
839
+ document.querySelectorAll(`[data-i18n-${attribute}]`).forEach((element) => {
840
+ element.setAttribute(attribute, app.t(element.getAttribute(`data-i18n-${attribute}`) ?? "", element._i18nValues || {}));
841
+ });
842
+ }
843
+ document.querySelectorAll(".locale-select").forEach((select) => { select.value = app.locale; });
844
+ const msgInput = app.$("#msgInput");
845
+ if (msgInput)
846
+ app.autoGrow?.(msgInput);
847
+ app.updateDraftCount?.();
848
+ app.updateMentionList?.();
849
+ app.renderFailedMessages?.();
850
+ if (app.state.room) {
851
+ app.renderHead();
852
+ app.renderMembers();
853
+ app.rerenderMessages();
854
+ }
855
+ else
856
+ app.updateTitle();
749
857
  };
750
858
  app.setLocale = (locale) => {
751
- app.locale = messages[locale] ? locale : "en";
752
- LS.locale = app.locale;
753
- app.applyLocale();
859
+ app.locale = messages[locale] ? locale : "en";
860
+ LS.locale = app.locale;
861
+ app.applyLocale();
754
862
  };
755
-
756
863
  app.intlLocale = () => intlLocales[app.locale] || "en-US";
757
864
  app.fmtTime = (timestamp) => {
758
- const date = new Date(timestamp);
759
- return date.toDateString() === new Date().toDateString()
760
- ? `${app.t("today")} ${app.timeHM(timestamp)}`
761
- : new Intl.DateTimeFormat(app.intlLocale(), { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" }).format(date);
865
+ const date = new Date(timestamp);
866
+ return date.toDateString() === new Date().toDateString()
867
+ ? `${app.t("today")} ${app.timeHM(timestamp)}`
868
+ : new Intl.DateTimeFormat(app.intlLocale(), { month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" }).format(date);
762
869
  };
763
870
  app.timeHM = (timestamp) => new Date(timestamp).toLocaleTimeString(app.intlLocale(), { hour: "2-digit", minute: "2-digit" });
764
871
  app.dayText = (timestamp) => {
765
- const date = new Date(timestamp), now = new Date();
766
- const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
767
- const thatDay = new Date(date.getFullYear(), date.getMonth(), date.getDate());
768
- const difference = Math.round((today - thatDay) / 86400000);
769
- if (difference === 0) return app.t("today");
770
- if (difference === 1) return app.t("yesterday");
771
- return new Intl.DateTimeFormat(app.intlLocale(), { month: "short", day: "numeric" }).format(date);
872
+ const date = new Date(timestamp), now = new Date();
873
+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
874
+ const thatDay = new Date(date.getFullYear(), date.getMonth(), date.getDate());
875
+ const difference = Math.round((today - thatDay) / 86400000);
876
+ if (difference === 0)
877
+ return app.t("today");
878
+ if (difference === 1)
879
+ return app.t("yesterday");
880
+ return new Intl.DateTimeFormat(app.intlLocale(), { month: "short", day: "numeric" }).format(date);
772
881
  };
773
882
  app.flash = (button, key) => {
774
- const output = button.querySelector("[data-flash-output]");
775
- button._flashKey = key;
776
- if (output) {
777
- output._flashKey = key; output.hidden = false; output.textContent = app.t(key);
778
- button.classList.add("is-flashing");
779
- if (button.dataset.i18nAriaLabel) button.setAttribute("aria-label", app.t(key));
780
- } else button.textContent = app.t(key);
781
- setTimeout(() => {
782
- if (button._flashKey !== key) return;
783
- delete button._flashKey;
883
+ const output = button.querySelector("[data-flash-output]");
884
+ button._flashKey = key;
784
885
  if (output) {
785
- delete output._flashKey; output.hidden = true; output.textContent = app.t(output.dataset.i18n, output._i18nValues || {});
786
- button.classList.remove("is-flashing");
787
- if (button.dataset.i18nAriaLabel) button.setAttribute("aria-label", app.t(button.dataset.i18nAriaLabel));
788
- } else button.textContent = app.t(button.dataset.i18n, button._i18nValues || {});
789
- }, 1200);
886
+ output._flashKey = key;
887
+ output.hidden = false;
888
+ output.textContent = app.t(key);
889
+ button.classList.add("is-flashing");
890
+ if (button.dataset.i18nAriaLabel)
891
+ button.setAttribute("aria-label", app.t(key));
892
+ }
893
+ else
894
+ button.textContent = app.t(key);
895
+ setTimeout(() => {
896
+ if (button._flashKey !== key)
897
+ return;
898
+ delete button._flashKey;
899
+ if (output) {
900
+ delete output._flashKey;
901
+ output.hidden = true;
902
+ output.textContent = app.t(output.dataset.i18n ?? "", output._i18nValues || {});
903
+ button.classList.remove("is-flashing");
904
+ if (button.dataset.i18nAriaLabel)
905
+ button.setAttribute("aria-label", app.t(button.dataset.i18nAriaLabel));
906
+ }
907
+ else
908
+ button.textContent = app.t(button.dataset.i18n ?? "", button._i18nValues || {});
909
+ }, 1200);
790
910
  };
791
911
  app.updateTitle = () => {
792
- const title = app.state.room ? app.t("roomTitle", { name: app.state.room.name }) : app.t("documentTitle");
793
- const active = app.state.room?.id;
794
- let total = 0;
795
- for (const [id, entry] of app.state.rooms) total += id === active ? app.state.unread : entry.unreadIds.size + (entry.unreadOverflow ? 100 : 0);
796
- document.title = total ? `(${total}) ${title}` : title;
912
+ const title = app.state.room ? app.t("roomTitle", { name: app.state.room.name }) : app.t("documentTitle");
913
+ const active = app.state.room?.id;
914
+ let total = 0;
915
+ for (const [id, entry] of app.state.rooms)
916
+ total += id === active ? app.state.unread : entry.unreadIds.size + (entry.unreadOverflow ? 100 : 0);
917
+ document.title = total ? `(${total}) ${title}` : title;
797
918
  };
798
919
  app.setOnline = (online) => {
799
- app.$("#connBar").hidden = online;
800
- // A recovered connection makes the network send warning stale, but an auth
801
- // or validation error still needs the user's attention.
802
- if (online) app.hideSendError("sendNetwork");
920
+ $("#connBar").hidden = online;
921
+ // A recovered connection makes the network send warning stale, but an auth
922
+ // or validation error still needs the user's attention.
923
+ if (online)
924
+ app.hideSendError("sendNetwork");
803
925
  };
804
926
  app.showSendError = (key, values = {}) => {
805
- const node = app.$("#sendError");
806
- app.setText(node, key, values);
807
- node.dataset.errorKey = key;
808
- node.hidden = false;
927
+ const node = $("#sendError");
928
+ app.setText(node, key, values);
929
+ node.dataset.errorKey = key;
930
+ node.hidden = false;
809
931
  };
810
932
  app.hideSendError = (key) => {
811
- const node = app.$("#sendError");
812
- if (key && node.dataset.errorKey !== key) return;
813
- node.hidden = true;
814
- delete node.dataset.errorKey;
933
+ const node = $("#sendError");
934
+ if (key && node.dataset.errorKey !== key)
935
+ return;
936
+ node.hidden = true;
937
+ delete node.dataset.errorKey;
815
938
  };
816
939
  app.showJoinError = (key, values = {}) => {
817
- app.setText(app.$("#joinError"), key, values);
818
- app.$("#joinError").hidden = false;
940
+ app.setText($("#joinError"), key, values);
941
+ $("#joinError").hidden = false;
819
942
  };
820
- app.hideJoinError = () => { app.$("#joinError").hidden = true; };
943
+ app.hideJoinError = () => { $("#joinError").hidden = true; };