dsh-xdpool 3.0.2 → 3.0.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.
package/lib/client.js CHANGED
@@ -41,6 +41,9 @@ window.__ModuleLoader__.load({
41
41
  //#region src/status-paths.ts
42
42
  const POOL_STATUS_PATH = "/plugins/dsh-xdpool/status";
43
43
  const POOL_CATALOG_REFRESH_PATH = "/plugins/dsh-xdpool/models/refresh";
44
+ const POOL_CHECKIN_PATH = "/plugins/dsh-xdpool/checkin";
45
+ const POOL_ACCOUNT_IGNORE_PATH = "/plugins/dsh-xdpool/accounts/ignored";
46
+ const POOL_AUTOMATION_RUN_PATH = "/plugins/dsh-xdpool/automation/run";
44
47
  const POOL_UPDATE_CHECK_PATH = "/plugins/dsh-xdpool/update";
45
48
  const POOL_MARVIS_SESSION_PATH = "/plugins/dsh-xdpool/marvis/session";
46
49
  const POOL_MARVIS_LOGIN_PATH = "/plugins/dsh-xdpool/marvis/login";
@@ -75,7 +78,9 @@ window.__ModuleLoader__.load({
75
78
  const POOL_AUTOCLAW_CN_SESSION_PATH = "/plugins/dsh-xdpool/autoclaw-cn/session";
76
79
  const POOL_AUTOCLAW_CN_WALLET_PATH = "/plugins/dsh-xdpool/autoclaw-cn/wallet";
77
80
  const POOL_UPDATE_INSTALL_PATH = "/plugins/dsh-xdpool/update/install";
81
+ const POOL_CREDIT_RESERVE_PATH = "/plugins/dsh-xdpool/accounts/credit-reserve";
78
82
  const POOL_CREDITS_SPEND_PATH = "/plugins/dsh-xdpool/credits/spend";
83
+ const POOL_ACCOUNT_PREFER_PATH = "/plugins/dsh-xdpool/accounts/preferred";
79
84
  const POOL_AGGREGATE_PATH = "/plugins/dsh-xdpool/aggregate";
80
85
  const POOL_AGGREGATE_SAVE_PATH = "/plugins/dsh-xdpool/aggregate/save";
81
86
  const POOL_AGGREGATE_TEST_PATH = "/plugins/dsh-xdpool/aggregate/test";
@@ -135,7 +140,7 @@ window.__ModuleLoader__.load({
135
140
  const POOL_NAV_ICON_MASK_URL = `data:image/svg+xml;utf8,${encodeURIComponent(POOL_NAV_ICON_SVG)}`;
136
141
  //#endregion
137
142
  //#region src/version.ts
138
- const POOL_VERSION = "3.0.2";
143
+ const POOL_VERSION = "3.0.4";
139
144
  function compareVersions(left, right) {
140
145
  const parse = (value) => {
141
146
  const [core, ...rest] = value.trim().replace(/^v/u, "").split("-");
@@ -929,6 +934,18 @@ window.__ModuleLoader__.load({
929
934
  select,
930
935
  tabs
931
936
  ]);
937
+ const closeHostDialog = (0, react.useCallback)(() => {
938
+ if (typeof document === "undefined") return;
939
+ const candidate = document.querySelector("[role=\"dialog\"]")?.querySelector("[aria-label*=\"lose\" i], [aria-label*=\"关闭\"], [aria-label*=\"ismiss\" i], [data-dismiss]");
940
+ if (candidate !== void 0 && candidate !== null) {
941
+ candidate.click();
942
+ return;
943
+ }
944
+ window.dispatchEvent(new KeyboardEvent("keydown", {
945
+ key: "Escape",
946
+ bubbles: true
947
+ }));
948
+ }, []);
932
949
  return (0, react_jsx_runtime.jsxs)("div", {
933
950
  ref: appRef,
934
951
  className: wide ? "app app-wide" : "app",
@@ -991,6 +1008,23 @@ window.__ModuleLoader__.load({
991
1008
  })
992
1009
  ]
993
1010
  }),
1011
+ (0, react_jsx_runtime.jsx)("button", {
1012
+ type: "button",
1013
+ className: "app-close",
1014
+ "data-testid": "xdpool-close",
1015
+ title: t?.("shell.close") ?? "关闭",
1016
+ "aria-label": t?.("shell.close") ?? "关闭",
1017
+ onClick: closeHostDialog,
1018
+ children: (0, react_jsx_runtime.jsx)("svg", {
1019
+ viewBox: "0 0 24 24",
1020
+ fill: "none",
1021
+ stroke: "currentColor",
1022
+ strokeWidth: "1.8",
1023
+ strokeLinecap: "round",
1024
+ "aria-hidden": "true",
1025
+ children: (0, react_jsx_runtime.jsx)("path", { d: "M6 6l12 12M18 6L6 18" })
1026
+ })
1027
+ }),
994
1028
  pop !== "update" ? null : (0, react_jsx_runtime.jsxs)("div", {
995
1029
  ref: popRef,
996
1030
  className: "pop",
@@ -9634,6 +9668,20 @@ window.__ModuleLoader__.load({
9634
9668
  let poolSnapshot;
9635
9669
  const COUNTS_STORE_KEY = "dsh-xdpool.channel-counts.v1";
9636
9670
  const DOUBAO_SKIP_KEY = "dsh-xdpool.doubao-skipped-models.v1";
9671
+ const DOUBAO_HIDE_ALL_KEY = "dsh-xdpool.doubao-hide-all.v1";
9672
+ function readDoubaoHideAll() {
9673
+ try {
9674
+ return globalThis.localStorage?.getItem(DOUBAO_HIDE_ALL_KEY) === "true";
9675
+ } catch {
9676
+ return false;
9677
+ }
9678
+ }
9679
+ function saveDoubaoHideAll(hidden) {
9680
+ try {
9681
+ if (hidden) globalThis.localStorage?.setItem(DOUBAO_HIDE_ALL_KEY, "true");
9682
+ else globalThis.localStorage?.removeItem(DOUBAO_HIDE_ALL_KEY);
9683
+ } catch {}
9684
+ }
9637
9685
  function readDoubaoSkipped() {
9638
9686
  try {
9639
9687
  const raw = globalThis.localStorage?.getItem(DOUBAO_SKIP_KEY);
@@ -9655,16 +9703,20 @@ window.__ModuleLoader__.load({
9655
9703
  let lastMirroredDoubaoDisabled;
9656
9704
  async function mirrorDoubaoDisabled() {
9657
9705
  const skipped = readDoubaoSkipped();
9658
- if (skipped === void 0) return;
9659
- const ids = [...skipped];
9660
- const fingerprint = JSON.stringify([...ids].sort());
9706
+ const hideAll = readDoubaoHideAll();
9707
+ if (skipped === void 0 && !hideAll) return;
9708
+ const ids = [...skipped ?? []];
9709
+ const fingerprint = JSON.stringify([[...ids].sort(), hideAll]);
9661
9710
  if (fingerprint === lastMirroredDoubaoDisabled) return;
9662
9711
  try {
9663
9712
  if (!(await fetch("/plugins/dsh-xdpool/doubao/models", {
9664
9713
  method: "POST",
9665
9714
  headers: { "content-type": "application/json" },
9666
9715
  credentials: "same-origin",
9667
- body: JSON.stringify({ disabledModelIds: ids })
9716
+ body: JSON.stringify({
9717
+ disabledModelIds: ids,
9718
+ hideAll
9719
+ })
9668
9720
  })).ok) return;
9669
9721
  lastMirroredDoubaoDisabled = fingerprint;
9670
9722
  } catch {}
@@ -10162,7 +10214,7 @@ window.__ModuleLoader__.load({
10162
10214
  return "签到失败";
10163
10215
  }
10164
10216
  }
10165
- function ChannelPoolSection({ t, active, onAddAccount, autoClaim, autoClaimBusy, onAutoClaim, banner }) {
10217
+ function ChannelPoolSection({ t, active, onAddAccount, autoClaim, autoClaimBusy, onAutoClaim, autoClaimRunning, onAutoClaimRun, banner }) {
10166
10218
  const [ownActive, setOwnActive] = (0, react.useState)("");
10167
10219
  const [loginState, setLoginState] = (0, react.useState)(void 0);
10168
10220
  const loginAbort = (0, react.useRef)(void 0);
@@ -10484,6 +10536,7 @@ window.__ModuleLoader__.load({
10484
10536
  try {
10485
10537
  if (provider === "doubao") {
10486
10538
  await saveDoubaoSkipped(modelId, !on);
10539
+ saveDoubaoHideAll(false);
10487
10540
  await mirrorDoubaoDisabled();
10488
10541
  } else {
10489
10542
  const envelope = await callPack("model.setDisabled", {
@@ -10540,6 +10593,7 @@ window.__ModuleLoader__.load({
10540
10593
  if (provider === "doubao") {
10541
10594
  const skipped = on ? [] : entry.models.map((model) => model.id);
10542
10595
  globalThis.localStorage?.setItem(DOUBAO_SKIP_KEY, JSON.stringify(skipped));
10596
+ saveDoubaoHideAll(!on);
10543
10597
  await mirrorDoubaoDisabled();
10544
10598
  } else await callPack("model.setAllDisabled", {
10545
10599
  provider,
@@ -11451,17 +11505,30 @@ window.__ModuleLoader__.load({
11451
11505
  }),
11452
11506
  (0, react_jsx_runtime.jsxs)("div", {
11453
11507
  className: "policy-v",
11454
- children: [(0, react_jsx_runtime.jsx)("button", {
11455
- type: "button",
11456
- role: "switch",
11457
- className: "sw",
11458
- "aria-checked": autoClaim === true,
11459
- "aria-label": t?.("channelpool.autoClaim") ?? "积分自动化",
11460
- disabled: autoClaimBusy === true,
11461
- onClick: () => {
11462
- onAutoClaim?.(autoClaim !== true);
11463
- }
11464
- }), (0, react_jsx_runtime.jsx)("span", { children: `${t?.("channelpool.claimedToday") ?? "今日已领"} ${String(claimedToday)}/${String(enabledAccounts.length)}` })]
11508
+ children: [
11509
+ (0, react_jsx_runtime.jsx)("button", {
11510
+ type: "button",
11511
+ role: "switch",
11512
+ className: "sw",
11513
+ "aria-checked": autoClaim === true,
11514
+ "aria-label": t?.("channelpool.autoClaim") ?? "积分自动化",
11515
+ disabled: autoClaimBusy === true,
11516
+ onClick: () => {
11517
+ onAutoClaim?.(autoClaim !== true);
11518
+ }
11519
+ }),
11520
+ (0, react_jsx_runtime.jsx)("span", { children: `${t?.("channelpool.claimedToday") ?? "今日已领"} ${String(claimedToday)}/${String(enabledAccounts.length)}` }),
11521
+ (0, react_jsx_runtime.jsx)("button", {
11522
+ type: "button",
11523
+ className: "tiny",
11524
+ disabled: autoClaimRunning === true,
11525
+ title: t?.("channelpool.autoClaimRunHint") ?? "立刻跑一轮领取,不用等到预定时间",
11526
+ onClick: () => {
11527
+ onAutoClaimRun?.();
11528
+ },
11529
+ children: autoClaimRunning === true ? t?.("channelpool.autoClaimRunning") ?? "领取中…" : t?.("channelpool.autoClaimRun") ?? "立即执行"
11530
+ })
11531
+ ]
11465
11532
  }),
11466
11533
  (0, react_jsx_runtime.jsx)("span", {
11467
11534
  className: "policy-hint",
@@ -12117,11 +12184,31 @@ window.__ModuleLoader__.load({
12117
12184
  if (mounted.current) setError(zh$2(cause instanceof Error ? cause.message : void 0, "读取登录通道失败"));
12118
12185
  }
12119
12186
  }, []);
12187
+ const loadPoolAccounts = (0, react.useCallback)(async () => {
12188
+ return (await Promise.all([["buddy", "/plugins/dsh-xdpool/status?region=cn"], ["workbuddy", "/plugins/dsh-xdpool/status?region=global"]].map(async ([provider, route]) => {
12189
+ try {
12190
+ const response = await fetch(route, {
12191
+ credentials: "same-origin",
12192
+ headers: { accept: "application/json" }
12193
+ });
12194
+ if (!response.ok) return [];
12195
+ const body = await response.json().catch(() => void 0);
12196
+ return (Array.isArray(body?.accounts) ? body.accounts : []).filter((row) => typeof row.id === "string" && row.id !== "").map((row) => ({
12197
+ id: row.id,
12198
+ provider,
12199
+ nickname: typeof row.nickname === "string" && row.nickname !== "" ? row.nickname : typeof row.label === "string" && row.label !== "" ? row.label : row.id,
12200
+ enabled: true
12201
+ }));
12202
+ } catch {
12203
+ return [];
12204
+ }
12205
+ }))).flat();
12206
+ }, []);
12120
12207
  const loadConnected = (0, react.useCallback)(async () => {
12121
12208
  const roster = await fetchChannels();
12122
12209
  const statuses = providerStatusesFrom(await callPack("provider.status", { providers: roster.map((channel) => channel.id) }));
12123
12210
  const connectedIds = roster.map((channel) => channel.id).filter((id) => (statuses.get(id)?.accountsTotal ?? 0) > 0);
12124
- const accounts = (await Promise.all(connectedIds.map((id) => callPack("account.list", { provider: id })))).flatMap(accountsFrom);
12211
+ const accounts = [...(await Promise.all(connectedIds.map((id) => callPack("account.list", { provider: id })))).flatMap(accountsFrom), ...await loadPoolAccounts()];
12125
12212
  if (mounted.current) setConnected(accounts);
12126
12213
  return accounts;
12127
12214
  }, []);
@@ -15113,6 +15200,27 @@ window.__ModuleLoader__.load({
15113
15200
  })
15114
15201
  });
15115
15202
  //#endregion
15203
+ //#region src/siblings.ts
15204
+ function paidSiblingOf(model, models) {
15205
+ let best;
15206
+ for (const candidate of models) {
15207
+ if (candidate.id === model.id) continue;
15208
+ if (candidate.name !== model.name) continue;
15209
+ const multiplier = candidate.multiplier;
15210
+ if (multiplier === void 0 || multiplier <= 0) continue;
15211
+ if (best === void 0 || multiplier < best.multiplier) best = {
15212
+ id: candidate.id,
15213
+ name: candidate.name,
15214
+ multiplier
15215
+ };
15216
+ }
15217
+ return best;
15218
+ }
15219
+ function paidAlternativeFor(model, models) {
15220
+ if (model.multiplier !== 0) return void 0;
15221
+ return paidSiblingOf(model, models);
15222
+ }
15223
+ //#endregion
15116
15224
  //#region src/client/backup-crypto.ts
15117
15225
  const ENCRYPTED_FORMAT = "dsh-xdpool/backup-encrypted";
15118
15226
  const ITERATIONS = 31e4;
@@ -15940,10 +16048,54 @@ window.__ModuleLoader__.load({
15940
16048
  //#endregion
15941
16049
  //#region src/client/PoolCard.tsx
15942
16050
  const POLL_INTERVAL_MS = 3e4;
16051
+ function formatNumber(value) {
16052
+ if (value === void 0) return "–";
16053
+ return new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(value);
16054
+ }
16055
+ function formatTime(value) {
16056
+ return new Intl.DateTimeFormat(void 0, {
16057
+ month: "2-digit",
16058
+ day: "2-digit",
16059
+ hour: "2-digit",
16060
+ minute: "2-digit"
16061
+ }).format(new Date(value));
16062
+ }
16063
+ function formatDateTime(value) {
16064
+ if (value === void 0) return "";
16065
+ const ms = Date.parse(value);
16066
+ if (Number.isNaN(ms)) return value;
16067
+ return new Intl.DateTimeFormat(void 0, {
16068
+ month: "2-digit",
16069
+ day: "2-digit",
16070
+ hour: "2-digit",
16071
+ minute: "2-digit"
16072
+ }).format(new Date(ms));
16073
+ }
16074
+ const AUTOMATION_POLL_MS = 2e3;
16075
+ const AUTOMATION_POLL_ATTEMPTS = 90;
15943
16076
  function hoursOrDefault(configured, fallback) {
15944
16077
  return configured !== void 0 && configured.length > 0 ? [...configured] : [...fallback];
15945
16078
  }
15946
16079
  const REGION_CARDS = ["cn", "global"];
16080
+ function formatExpiry(ms) {
16081
+ if (ms === void 0 || !Number.isFinite(ms)) return "";
16082
+ return new Intl.DateTimeFormat(void 0, {
16083
+ month: "2-digit",
16084
+ day: "2-digit",
16085
+ hour: "2-digit",
16086
+ minute: "2-digit",
16087
+ hour12: false
16088
+ }).format(new Date(ms));
16089
+ }
16090
+ function daysUntil(ms) {
16091
+ if (ms === void 0 || !Number.isFinite(ms)) return void 0;
16092
+ return Math.max(0, Math.floor((ms - Date.now()) / 864e5));
16093
+ }
16094
+ function isExpiringSoon(pack) {
16095
+ if (pack.monthly === true) return false;
16096
+ const days = daysUntil(pack.expiresAtMs);
16097
+ return days !== void 0 && days <= 3;
16098
+ }
15947
16099
  function PoolCard({ t, settingsScope }) {
15948
16100
  const settingsWritable = settingsScope?.getSnapshot().writable === true;
15949
16101
  const [sidebarRow, setSidebarRowState] = (0, react.useState)(() => readSidebarRow(settingsScope));
@@ -16133,7 +16285,96 @@ window.__ModuleLoader__.load({
16133
16285
  controller.abort();
16134
16286
  };
16135
16287
  }, [refreshUsage]);
16288
+ const claimCheckin = async (region, accountId) => {
16289
+ setCheckinBusyId(accountId);
16290
+ setFlash(void 0);
16291
+ try {
16292
+ const response = await fetch(POOL_CHECKIN_PATH, {
16293
+ method: "POST",
16294
+ headers: {
16295
+ accept: "application/json",
16296
+ "content-type": "application/json"
16297
+ },
16298
+ credentials: "same-origin",
16299
+ body: JSON.stringify({ accountId })
16300
+ });
16301
+ const body = await response.json().catch(() => void 0);
16302
+ if (!response.ok) throw new Error(body?.error ?? `HTTP ${response.status}`);
16303
+ await refresh(region);
16304
+ const credit = body?.claim?.credit ?? 0;
16305
+ if (mounted.current) setFlash(t?.("row.checkinClaimedReward", { credit: formatNumber(credit) }) ?? `Claimed +${formatNumber(credit)} credits`);
16306
+ } catch (cause) {
16307
+ if (mounted.current) setError(cause instanceof Error ? cause.message : String(cause));
16308
+ } finally {
16309
+ if (mounted.current) setCheckinBusyId(void 0);
16310
+ }
16311
+ };
16136
16312
  const statusOf = (region) => statusByRegion[region];
16313
+ const toggleAccountDisabled = async (region, accountId, disabled) => {
16314
+ const write = settingsScope?.set;
16315
+ if (write === void 0) {
16316
+ setError(t?.("row.modelsSaveError", { message: "settings scope is read-only" }) ?? "settings scope is read-only");
16317
+ return;
16318
+ }
16319
+ setAccountBusyId(accountId);
16320
+ setFlash(void 0);
16321
+ try {
16322
+ const current = (statusOf(region)?.accounts ?? []).filter((account) => account.disabled === true).map((account) => account.id);
16323
+ const next = disabled ? current.includes(accountId) ? current : [...current, accountId] : current.filter((id) => id !== accountId);
16324
+ await write.call(settingsScope, "disabledAccountIds", next);
16325
+ await refresh(region);
16326
+ } catch (cause) {
16327
+ const message = cause instanceof Error ? cause.message : String(cause);
16328
+ if (mounted.current) setError(t?.("row.accountToggleError", { message }) ?? "Could not switch the account: " + message);
16329
+ } finally {
16330
+ if (mounted.current) setAccountBusyId(void 0);
16331
+ }
16332
+ };
16333
+ const setAccountIgnored = async (region, accountId, ignored) => {
16334
+ setAccountBusyId(accountId);
16335
+ setFlash(void 0);
16336
+ try {
16337
+ const response = await fetch(POOL_ACCOUNT_IGNORE_PATH, {
16338
+ method: "POST",
16339
+ headers: { "Content-Type": "application/json" },
16340
+ body: JSON.stringify({
16341
+ accountId,
16342
+ ignored
16343
+ })
16344
+ });
16345
+ if (!response.ok) {
16346
+ const detail = await response.json().catch(() => ({}));
16347
+ throw new Error(detail.error ?? `HTTP ${response.status}`);
16348
+ }
16349
+ await refresh(region);
16350
+ } catch (cause) {
16351
+ const message = cause instanceof Error ? cause.message : String(cause);
16352
+ if (mounted.current) setError(t?.("row.accountIgnoreError", { message }) ?? "Could not change the ignore list: " + message);
16353
+ } finally {
16354
+ if (mounted.current) setAccountBusyId(void 0);
16355
+ }
16356
+ };
16357
+ const setPreferredAccount = async (region, accountId) => {
16358
+ setAccountBusyId(accountId ?? "none");
16359
+ setFlash(void 0);
16360
+ try {
16361
+ const response = await fetch(POOL_ACCOUNT_PREFER_PATH, {
16362
+ method: "POST",
16363
+ headers: { "Content-Type": "application/json" },
16364
+ body: JSON.stringify({ accountId })
16365
+ });
16366
+ if (!response.ok) {
16367
+ const detail = await response.json().catch(() => ({}));
16368
+ throw new Error(detail.error ?? `HTTP ${response.status}`);
16369
+ }
16370
+ await Promise.all(REGION_CARDS.map((other) => refresh(other)));
16371
+ } catch (cause) {
16372
+ const message = cause instanceof Error ? cause.message : String(cause);
16373
+ if (mounted.current) setError(t?.("row.accountPreferError", { message }) ?? "Could not set the preferred account: " + message);
16374
+ } finally {
16375
+ if (mounted.current) setAccountBusyId(void 0);
16376
+ }
16377
+ };
16137
16378
  const setSidebarRow = async (next) => {
16138
16379
  const write = settingsScope?.set;
16139
16380
  if (write === void 0) {
@@ -16180,6 +16421,73 @@ window.__ModuleLoader__.load({
16180
16421
  if (mounted.current) setAutomationBusyRegion(void 0);
16181
16422
  }
16182
16423
  };
16424
+ const runAutomationJob = async (region) => {
16425
+ setAutomationRun("all");
16426
+ setAutomationRunRegion(region);
16427
+ setFlash(void 0);
16428
+ try {
16429
+ const response = await fetch(POOL_AUTOMATION_RUN_PATH, {
16430
+ method: "POST",
16431
+ headers: {
16432
+ "accept": "application/json",
16433
+ "content-type": "application/json"
16434
+ },
16435
+ credentials: "same-origin",
16436
+ body: JSON.stringify({ job: "all" })
16437
+ });
16438
+ const body = await response.json();
16439
+ if (!response.ok) throw new Error(body.error ?? `HTTP ${response.status}`);
16440
+ if (body.started === false) {
16441
+ if (mounted.current) setFlash(t?.("row.autoAlreadyRunning") ?? "A run is already in progress");
16442
+ }
16443
+ let settled = false;
16444
+ for (let attempt = 0; attempt < AUTOMATION_POLL_ATTEMPTS; attempt += 1) {
16445
+ await new Promise((resolve) => setTimeout(resolve, AUTOMATION_POLL_MS));
16446
+ if (!mounted.current) return;
16447
+ if ((await refresh(region))?.automation?.runInProgress === false) {
16448
+ settled = true;
16449
+ break;
16450
+ }
16451
+ }
16452
+ await refresh(region);
16453
+ if (mounted.current) setFlash(settled ? t?.("row.autoRunDone") ?? "Automation pass finished" : t?.("row.autoRunTimeout") ?? "Still running; check back in a moment");
16454
+ } catch (cause) {
16455
+ if (mounted.current) setError(cause instanceof Error ? cause.message : String(cause));
16456
+ } finally {
16457
+ if (mounted.current) {
16458
+ setAutomationRun(void 0);
16459
+ setAutomationRunRegion(void 0);
16460
+ }
16461
+ }
16462
+ };
16463
+ const saveCreditReserve = async (region, accountId, reserve) => {
16464
+ setReserveBusy(accountId);
16465
+ setFlash(void 0);
16466
+ try {
16467
+ const response = await fetch(POOL_CREDIT_RESERVE_PATH, {
16468
+ method: "POST",
16469
+ headers: {
16470
+ "accept": "application/json",
16471
+ "content-type": "application/json"
16472
+ },
16473
+ credentials: "same-origin",
16474
+ body: JSON.stringify({
16475
+ accountId,
16476
+ reserve
16477
+ })
16478
+ });
16479
+ const body = await response.json();
16480
+ if (!response.ok) throw new Error(body.error ?? `HTTP ${response.status}`);
16481
+ await refresh(region);
16482
+ if (mounted.current) setFlash(reserve > 0 ? t?.("row.reserveSaved", { credits: reserve }) ?? `Keeping ${reserve} credits` : t?.("row.reserveCleared") ?? "Reserve cleared");
16483
+ return true;
16484
+ } catch (cause) {
16485
+ if (mounted.current) setError(cause instanceof Error ? cause.message : String(cause));
16486
+ return false;
16487
+ } finally {
16488
+ if (mounted.current) setReserveBusy(void 0);
16489
+ }
16490
+ };
16183
16491
  t?.("row.title");
16184
16492
  t?.("row.desc");
16185
16493
  return (0, react_jsx_runtime.jsx)(PoolShell, {
@@ -16217,10 +16525,48 @@ window.__ModuleLoader__.load({
16217
16525
  children: page === "aggregate" ? (0, react_jsx_runtime.jsx)(AggregatePage, { t }) : page === "channels" ? (0, react_jsx_runtime.jsx)(ChannelsPage, { t }) : page === "ledger" ? (0, react_jsx_runtime.jsx)(LedgerPage, {
16218
16526
  t,
16219
16527
  usage
16220
- }) : page === "routing" ? (0, react_jsx_runtime.jsx)(RoutingPage, { t }) : page === "gateway" ? (0, react_jsx_runtime.jsx)(GatewayPage, { t }) : page === "backup" ? (0, react_jsx_runtime.jsx)(BackupPanel, { t }) : (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: (0, react_jsx_runtime.jsx)("div", {
16528
+ }) : page === "routing" ? (0, react_jsx_runtime.jsx)(RoutingPage, { t }) : page === "gateway" ? (0, react_jsx_runtime.jsx)(GatewayPage, { t }) : page === "backup" ? (0, react_jsx_runtime.jsx)(BackupPanel, { t }) : (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: (0, react_jsx_runtime.jsxs)("div", {
16221
16529
  className: "dsm-xdpool-regions dsm-xdpool-region-grid",
16222
16530
  style: { display: "contents" },
16223
- children: (0, react_jsx_runtime.jsx)(ChannelPoolSection, {
16531
+ children: [["cn", "global"].map((region) => {
16532
+ const here = statusOf(region);
16533
+ const rows = here?.accounts ?? [];
16534
+ if (rows.length === 0) return null;
16535
+ return (0, react_jsx_runtime.jsxs)("section", {
16536
+ className: "sec dsm-xdpool-accounts",
16537
+ children: [(0, react_jsx_runtime.jsx)("div", {
16538
+ className: "sec-head",
16539
+ children: (0, react_jsx_runtime.jsxs)("span", {
16540
+ className: "sec-title",
16541
+ children: [region === "cn" ? t?.("row.tabCn") ?? "CN" : t?.("row.tabGlobal") ?? "Global", ` · ${String(rows.length)}`]
16542
+ })
16543
+ }), (0, react_jsx_runtime.jsx)("div", {
16544
+ className: "accts",
16545
+ children: rows.map((account) => (0, react_jsx_runtime.jsx)(AccountBlock, {
16546
+ account,
16547
+ models: here?.models ?? [],
16548
+ t,
16549
+ ...checkinBusyId === void 0 ? {} : { checkinBusyId },
16550
+ onClaimCheckin: (id) => {
16551
+ claimCheckin(region, id);
16552
+ },
16553
+ ...accountBusyId === void 0 ? {} : { accountBusyId },
16554
+ onToggleDisabled: (id, disabled) => {
16555
+ toggleAccountDisabled(region, id, disabled);
16556
+ },
16557
+ onIgnoreAccount: (id) => {
16558
+ setAccountIgnored(region, id, true);
16559
+ },
16560
+ onPreferAccount: (id) => {
16561
+ setPreferredAccount(region, id);
16562
+ },
16563
+ onSaveCreditReserve: (id, reserve) => saveCreditReserve(region, id, reserve),
16564
+ ...reserveBusy === void 0 ? {} : { reserveBusyId: reserveBusy },
16565
+ serving: here?.activeAccountId === account.id
16566
+ }, account.id))
16567
+ })]
16568
+ }, region);
16569
+ }), (0, react_jsx_runtime.jsx)(ChannelPoolSection, {
16224
16570
  t,
16225
16571
  active: selectedChannel,
16226
16572
  onAddAccount: () => {
@@ -16231,6 +16577,10 @@ window.__ModuleLoader__.load({
16231
16577
  onAutoClaim: (on) => {
16232
16578
  setAutomationEnabled("cn", on);
16233
16579
  },
16580
+ autoClaimRunning: automationRun !== void 0,
16581
+ onAutoClaimRun: () => {
16582
+ runAutomationJob("cn");
16583
+ },
16234
16584
  banner: flash === void 0 && error === void 0 ? void 0 : (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [flash === void 0 ? null : (0, react_jsx_runtime.jsx)("p", {
16235
16585
  className: "note",
16236
16586
  children: flash
@@ -16238,10 +16588,350 @@ window.__ModuleLoader__.load({
16238
16588
  className: "hint",
16239
16589
  children: t?.("row.error", { message: error }) ?? `Pool status unavailable: ${error}`
16240
16590
  })] })
16241
- })
16591
+ })]
16242
16592
  }) })
16243
16593
  });
16244
16594
  }
16595
+ function AccountBlock({ account, models, t, checkinBusyId, onClaimCheckin, accountBusyId, onToggleDisabled, onIgnoreAccount, onPreferAccount, onSaveCreditReserve, reserveBusyId, serving }) {
16596
+ const isDisabled = account.disabled === true;
16597
+ const isPreferred = account.preferred === true;
16598
+ const isCooling = account.cooling === true;
16599
+ const isDead = account.credentialDead === true;
16600
+ const cooldownUntil = account.cooldownUntil !== void 0 ? Date.parse(account.cooldownUntil) : void 0;
16601
+ const modelCooldowns = account.modelCooldowns ?? [];
16602
+ const tag = isDead ? {
16603
+ text: t?.("row.credentialDeadTag") ?? "Sign-in rejected",
16604
+ cls: "pill"
16605
+ } : isCooling ? {
16606
+ text: t?.("row.cooling") ?? "Cooling",
16607
+ cls: "pill"
16608
+ } : null;
16609
+ return (0, react_jsx_runtime.jsxs)("div", {
16610
+ className: isDisabled ? "is-off" : "ch",
16611
+ "data-serving": serving === true ? "true" : void 0,
16612
+ children: [(0, react_jsx_runtime.jsxs)("div", {
16613
+ className: "ch-head",
16614
+ children: [
16615
+ (0, react_jsx_runtime.jsx)("span", {
16616
+ className: "ch-title",
16617
+ children: account.label
16618
+ }),
16619
+ serving === true ? (0, react_jsx_runtime.jsxs)("span", {
16620
+ className: "acct-head",
16621
+ children: [(0, react_jsx_runtime.jsx)("span", { className: "acct-dot" }), (0, react_jsx_runtime.jsx)("span", {
16622
+ className: "acct-name",
16623
+ children: t?.("row.currentAccount") ?? "In use now"
16624
+ })]
16625
+ }) : null,
16626
+ tag === null ? null : (0, react_jsx_runtime.jsx)("span", {
16627
+ className: tag.cls,
16628
+ children: tag.text
16629
+ }),
16630
+ (0, react_jsx_runtime.jsxs)("button", {
16631
+ type: "button",
16632
+ className: isPreferred ? "is-on" : "tiny",
16633
+ "aria-pressed": isPreferred,
16634
+ title: isPreferred ? t?.("row.accountPreferClearHint") ?? "Stop preferring this account; the distribution strategy decides again" : t?.("row.accountPreferHint") ?? "Try this account first while it stays healthy",
16635
+ disabled: accountBusyId === account.id || accountBusyId === "none",
16636
+ onClick: () => {
16637
+ onPreferAccount(isPreferred ? null : account.id);
16638
+ },
16639
+ children: [(0, react_jsx_runtime.jsx)("span", {
16640
+ className: "tiny",
16641
+ "aria-hidden": "true",
16642
+ children: "★"
16643
+ }), isPreferred ? t?.("row.accountPreferOn") ?? "Preferred" : t?.("row.accountPrefer") ?? "Prefer"]
16644
+ }),
16645
+ (0, react_jsx_runtime.jsxs)("button", {
16646
+ type: "button",
16647
+ role: "switch",
16648
+ "aria-checked": !isDisabled,
16649
+ className: isDisabled ? "sw" : "is-on",
16650
+ title: t?.("row.accountToggleHint") ?? "Enable this account (uncheck to keep it out of the pool)",
16651
+ disabled: accountBusyId === account.id,
16652
+ onClick: () => {
16653
+ onToggleDisabled(account.id, !isDisabled);
16654
+ },
16655
+ children: [(0, react_jsx_runtime.jsx)("span", { className: "acct-dot" }), isDisabled ? t?.("row.accountOff") ?? "Disabled" : t?.("row.accountInRotation") ?? "Enabled"]
16656
+ }),
16657
+ (0, react_jsx_runtime.jsx)("button", {
16658
+ type: "button",
16659
+ className: "ch-count",
16660
+ title: t?.("row.accountIgnoreHint") ?? "Remove this account from the pool for good",
16661
+ disabled: accountBusyId === account.id,
16662
+ onClick: () => {
16663
+ onIgnoreAccount(account.id);
16664
+ },
16665
+ children: t?.("row.accountIgnore") ?? "Remove"
16666
+ })
16667
+ ]
16668
+ }), (0, react_jsx_runtime.jsxs)("div", {
16669
+ className: "ch-titles",
16670
+ children: [
16671
+ (0, react_jsx_runtime.jsxs)("div", {
16672
+ className: "ch-titles",
16673
+ children: [
16674
+ account.expiresAt !== void 0 ? (0, react_jsx_runtime.jsx)("span", {
16675
+ className: "ch-org",
16676
+ children: t?.("row.tokenExpiry", { time: formatDateTime(account.expiresAt) }) ?? `token ${formatDateTime(account.expiresAt)}`
16677
+ }) : null,
16678
+ isCooling && cooldownUntil !== void 0 && !Number.isNaN(cooldownUntil) ? (0, react_jsx_runtime.jsxs)("span", {
16679
+ className: "ch-org",
16680
+ children: [
16681
+ t?.("row.cooldownUntil", { time: formatTime(cooldownUntil) }) ?? `until ${formatTime(cooldownUntil)}`,
16682
+ " · ",
16683
+ t?.("row.cooldownHits", { hits: account.rateLimitHits ?? 0 }) ?? `${account.rateLimitHits ?? 0} hit(s)`
16684
+ ]
16685
+ }) : null,
16686
+ isDead ? (0, react_jsx_runtime.jsx)("span", {
16687
+ className: "ch-org",
16688
+ children: t?.("row.credentialDeadHint") ?? "Sign in again in the WorkBuddy desktop app to restore it"
16689
+ }) : null,
16690
+ modelCooldowns.length > 0 ? (0, react_jsx_runtime.jsx)("div", {
16691
+ className: "ch-note",
16692
+ children: modelCooldowns.map((mc) => {
16693
+ const coolingModel = models.find((model) => model.id === mc.modelId);
16694
+ const twin = coolingModel === void 0 ? void 0 : paidAlternativeFor(coolingModel, models);
16695
+ return (0, react_jsx_runtime.jsxs)("span", {
16696
+ className: "badge",
16697
+ children: [t?.("row.modelCooling", {
16698
+ model: mc.modelId,
16699
+ time: formatDateTime(mc.until)
16700
+ }) ?? `${mc.modelId} cooling to ${formatDateTime(mc.until)}`, twin === void 0 ? null : (0, react_jsx_runtime.jsx)("span", {
16701
+ className: "badge",
16702
+ title: t?.("row.paidTwinHint") ?? "Same model, paid row",
16703
+ children: t?.("row.rateLimitedPaidTwin", {
16704
+ id: twin.id,
16705
+ rate: twin.multiplier.toFixed(2)
16706
+ }) ?? `→ ${twin.id} (${twin.multiplier.toFixed(2)}x) still works`
16707
+ })]
16708
+ }, mc.modelId);
16709
+ })
16710
+ }) : null
16711
+ ]
16712
+ }),
16713
+ (0, react_jsx_runtime.jsx)(AccountStats, {
16714
+ account,
16715
+ t,
16716
+ checkinBusy: checkinBusyId === account.id,
16717
+ onClaim: onClaimCheckin
16718
+ }),
16719
+ (0, react_jsx_runtime.jsx)(CreditReserveRow, {
16720
+ account,
16721
+ t,
16722
+ busy: reserveBusyId === account.id,
16723
+ onSave: onSaveCreditReserve
16724
+ }),
16725
+ account.automationToday === void 0 ? null : (0, react_jsx_runtime.jsxs)("div", {
16726
+ className: "fact",
16727
+ children: [(0, react_jsx_runtime.jsx)("span", {
16728
+ className: "td-name",
16729
+ children: t?.("row.autoEarned") ?? "Automation today"
16730
+ }), (0, react_jsx_runtime.jsxs)("span", {
16731
+ className: "facts",
16732
+ children: [
16733
+ account.automationToday.credit > 0 ? (0, react_jsx_runtime.jsx)("span", {
16734
+ className: "fact",
16735
+ children: t?.("row.autoFromTasks", {
16736
+ credit: account.automationToday.credit,
16737
+ energy: account.automationToday.energy,
16738
+ count: account.automationToday.claimed
16739
+ }) ?? `Tasks +${account.automationToday.credit}`
16740
+ }) : null,
16741
+ account.automationToday.checkinCredit > 0 ? (0, react_jsx_runtime.jsx)("span", {
16742
+ className: "fact",
16743
+ children: t?.("row.autoFromCheckin", { credit: account.automationToday.checkinCredit }) ?? `Check-in +${account.automationToday.checkinCredit}`
16744
+ }) : null,
16745
+ account.automationToday.bonusCredit > 0 ? (0, react_jsx_runtime.jsx)("span", {
16746
+ className: "fact",
16747
+ children: t?.("row.autoFromBonus", { credit: account.automationToday.bonusCredit }) ?? `Streak +${account.automationToday.bonusCredit}`
16748
+ }) : null,
16749
+ account.automationToday.travelCredit > 0 ? (0, react_jsx_runtime.jsx)("span", {
16750
+ className: "fact",
16751
+ children: t?.("row.autoFromTravel", { credit: account.automationToday.travelCredit }) ?? `Buddy +${account.automationToday.travelCredit}`
16752
+ }) : null,
16753
+ account.automationToday.compensationCredit > 0 ? (0, react_jsx_runtime.jsx)("span", {
16754
+ className: "fact",
16755
+ children: t?.("row.autoFromCompensation", { credit: account.automationToday.compensationCredit }) ?? `Compensation +${account.automationToday.compensationCredit}`
16756
+ }) : null
16757
+ ]
16758
+ })]
16759
+ })
16760
+ ]
16761
+ })]
16762
+ });
16763
+ }
16764
+ function CreditReserveRow({ account, t, busy, onSave }) {
16765
+ const saved = account.creditReserve ?? 0;
16766
+ const [draft, setDraft] = (0, react.useState)(String(saved));
16767
+ const [settled, setSettled] = (0, react.useState)(saved);
16768
+ const [note, setNote] = (0, react.useState)(void 0);
16769
+ (0, react.useEffect)(() => {
16770
+ setSettled(saved);
16771
+ setDraft((current) => current === String(saved) ? current : String(saved));
16772
+ }, [saved]);
16773
+ const parsed = Number.parseInt(draft, 10);
16774
+ const next = Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : 0;
16775
+ const dirty = next !== settled;
16776
+ const commit = async () => {
16777
+ if (busy || !dirty) return;
16778
+ setNote(void 0);
16779
+ if (await onSave(account.id, next)) {
16780
+ setSettled(next);
16781
+ setDraft(String(next));
16782
+ setNote("saved");
16783
+ } else setNote("failed");
16784
+ };
16785
+ return (0, react_jsx_runtime.jsxs)("div", {
16786
+ className: "row",
16787
+ children: [
16788
+ (0, react_jsx_runtime.jsx)("span", {
16789
+ className: "field",
16790
+ children: t?.("row.reserveTitle") ?? "Keep at least"
16791
+ }),
16792
+ (0, react_jsx_runtime.jsx)("input", {
16793
+ type: "number",
16794
+ min: 0,
16795
+ step: 1,
16796
+ value: draft,
16797
+ disabled: busy,
16798
+ className: "input",
16799
+ "aria-label": t?.("row.reserveTitle") ?? "Keep at least",
16800
+ onChange: (event) => {
16801
+ setDraft(event.target.value);
16802
+ setNote(void 0);
16803
+ },
16804
+ onKeyDown: (event) => {
16805
+ if (event.key === "Enter") commit();
16806
+ }
16807
+ }),
16808
+ (0, react_jsx_runtime.jsx)("span", {
16809
+ className: "kpi-u",
16810
+ children: t?.("row.reserveUnit") ?? "credits"
16811
+ }),
16812
+ (0, react_jsx_runtime.jsx)("button", {
16813
+ type: "button",
16814
+ className: "tiny",
16815
+ disabled: busy || !dirty,
16816
+ onClick: () => {
16817
+ commit();
16818
+ },
16819
+ children: busy ? t?.("row.reserveSaving") ?? "Saving…" : t?.("row.reserveSave") ?? "Save"
16820
+ }),
16821
+ note === "saved" ? (0, react_jsx_runtime.jsx)("span", {
16822
+ className: "hint",
16823
+ children: next > 0 ? t?.("row.reserveSaved", { credits: next }) ?? `Keeping ${next} credits` : t?.("row.reserveCleared") ?? "Reserve cleared"
16824
+ }) : null,
16825
+ note === "failed" ? (0, react_jsx_runtime.jsx)("span", {
16826
+ className: "hint",
16827
+ children: t?.("row.reserveFailed") ?? "Not saved — try again"
16828
+ }) : null,
16829
+ account.reserved === true ? (0, react_jsx_runtime.jsx)("span", {
16830
+ className: "pill",
16831
+ children: t?.("row.reserveHolding") ?? "Reserved: skipped"
16832
+ }) : null
16833
+ ]
16834
+ });
16835
+ }
16836
+ function AccountStats({ account, t, checkinBusy, onClaim }) {
16837
+ const credits = account.credits;
16838
+ const checkin = account.checkin;
16839
+ const hasCredits = credits !== void 0 || account.creditsError !== void 0;
16840
+ const hasCheckin = checkin !== void 0 || account.checkinError !== void 0;
16841
+ if (!hasCredits && !hasCheckin) return null;
16842
+ const packages = (credits?.packages ?? []).filter((p) => (p.size ?? 0) > 0).slice(0, 6);
16843
+ return (0, react_jsx_runtime.jsxs)("div", {
16844
+ className: "kpis",
16845
+ children: [
16846
+ (0, react_jsx_runtime.jsxs)("span", {
16847
+ className: "sec kpi-v",
16848
+ children: [(0, react_jsx_runtime.jsx)("span", {
16849
+ className: "sec-title",
16850
+ children: t?.("row.creditsTotal") ?? "Total"
16851
+ }), (0, react_jsx_runtime.jsx)("span", {
16852
+ className: "kpi-v",
16853
+ children: formatNumber(credits?.total)
16854
+ })]
16855
+ }),
16856
+ hasCheckin ? (0, react_jsx_runtime.jsx)("div", {
16857
+ className: "sec",
16858
+ children: account.checkinError !== void 0 ? (0, react_jsx_runtime.jsx)("span", {
16859
+ className: "hint",
16860
+ title: account.checkinError,
16861
+ children: t?.("row.checkinUnavailable") ?? "check-in unavailable"
16862
+ }) : checkin === void 0 ? null : (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
16863
+ (0, react_jsx_runtime.jsxs)("div", {
16864
+ className: "hint",
16865
+ children: [(0, react_jsx_runtime.jsx)("span", {
16866
+ className: "pill",
16867
+ children: t?.("row.checkinStreak", { days: checkin.streakDays }) ?? `${checkin.streakDays}-day streak`
16868
+ }), checkin.dailyCredit > 0 ? (0, react_jsx_runtime.jsx)("span", {
16869
+ className: "fact",
16870
+ children: t?.("row.checkinDaily", { credit: formatNumber(checkin.dailyCredit) }) ?? `+${formatNumber(checkin.dailyCredit)}/day`
16871
+ }) : null]
16872
+ }),
16873
+ checkin.isStreakDay && checkin.streakBonusCredit > 0 ? (0, react_jsx_runtime.jsx)("span", {
16874
+ className: "fact",
16875
+ children: t?.("row.checkinStreakBonus", {
16876
+ days: formatNumber(checkin.nextStreakDay),
16877
+ credit: formatNumber(checkin.streakBonusCredit)
16878
+ }) ?? `bonus +${formatNumber(checkin.streakBonusCredit)}`
16879
+ }) : null,
16880
+ (0, react_jsx_runtime.jsx)("button", {
16881
+ type: "button",
16882
+ className: "tiny",
16883
+ disabled: !checkin.active || checkin.todayCheckedIn || checkinBusy,
16884
+ onClick: () => {
16885
+ onClaim(account.id);
16886
+ },
16887
+ children: !checkin.active ? t?.("row.checkinInactive") ?? "Unavailable" : checkin.todayCheckedIn ? t?.("row.checkinClaimed") ?? "Checked in" : checkinBusy ? t?.("row.checkinClaiming") ?? "Checking in…" : t?.("row.checkinClaim") ?? "Check in"
16888
+ })
16889
+ ] })
16890
+ }) : null,
16891
+ hasCredits ? (0, react_jsx_runtime.jsxs)("ul", {
16892
+ className: "facts sec",
16893
+ children: [account.creditsError !== void 0 ? (0, react_jsx_runtime.jsx)("li", { children: (0, react_jsx_runtime.jsx)("span", {
16894
+ className: `hint${account.credentialDead === true ? " is-bad" : ""}`,
16895
+ title: account.creditsError,
16896
+ children: account.credentialDead === true ? t?.("row.credentialDead") ?? "Sign-in rejected" : t?.("row.creditsError") ?? "credits unavailable"
16897
+ }) }) : packages.length === 0 ? (0, react_jsx_runtime.jsx)("li", {
16898
+ className: "hint",
16899
+ children: "–"
16900
+ }) : packages.map((pack, index) => {
16901
+ const expiry = formatExpiry(pack.expiresAtMs);
16902
+ const refresh = formatExpiry(pack.cycleRefreshMs);
16903
+ const soon = isExpiringSoon(pack);
16904
+ const when = pack.monthly === true ? refresh === "" ? null : t?.("row.creditsRefreshAt", { time: refresh }) ?? `Refreshes ${refresh}` : expiry === "" ? null : t?.("row.creditsExpiresAt", { time: expiry }) ?? `Expires ${expiry}`;
16905
+ return (0, react_jsx_runtime.jsxs)("li", { children: [
16906
+ (0, react_jsx_runtime.jsx)("span", {
16907
+ className: "td-name",
16908
+ children: pack.packageName
16909
+ }),
16910
+ (0, react_jsx_runtime.jsx)("span", {
16911
+ className: "td-num",
16912
+ children: t?.("row.creditsPackage", {
16913
+ remain: formatNumber(pack.remain),
16914
+ size: formatNumber(pack.size)
16915
+ }) ?? `${formatNumber(pack.remain)} / ${formatNumber(pack.size)}`
16916
+ }),
16917
+ when === null ? null : (0, react_jsx_runtime.jsx)("span", {
16918
+ className: `hint${soon ? " hint" : ""}`,
16919
+ title: t?.("row.creditsExpiresSoonTitle") ?? "Expiring within 3 days",
16920
+ children: when
16921
+ })
16922
+ ] }, `${pack.packageName}-${String(index)}`);
16923
+ }), credits?.expiringSoon !== void 0 && credits.expiringSoon > 0 ? (0, react_jsx_runtime.jsxs)("li", {
16924
+ className: "hint",
16925
+ children: [
16926
+ t?.("row.creditsSoon") ?? "Expiring in 3 days",
16927
+ " ",
16928
+ formatNumber(credits.expiringSoon)
16929
+ ]
16930
+ }) : null]
16931
+ }) : null
16932
+ ]
16933
+ });
16934
+ }
16245
16935
  //#endregion
16246
16936
  //#region src/client/CreditDot.tsx
16247
16937
  const POLL_MS = 45e3;
@@ -19272,6 +19962,26 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
19272
19962
  .app[data-w="phone"] .sec-actions{margin-left:0;width:100%}
19273
19963
  .app[data-w="phone"] .vendors{grid-template-columns:minmax(0,1fr)}
19274
19964
  .app[data-w="phone"] .kpis .kpi:last-child:nth-child(odd){grid-column:1 / -1}
19965
+ /* ============================================================
19966
+ 插件自己加的:右上角关闭
19967
+ ------------------------------------------------------------
19968
+ 不属于设计稿。设置对话框撑满整个插件页面,宿主的关闭按钮在它自己的
19969
+ 标题栏里、位置随宿主管;这里给一个就地入口,点击的落点见 shell.tsx
19970
+ 的 closeHostDialog。样式跟随设计变量,两套主题都不用另写。
19971
+ ============================================================ */
19972
+ .app-close{
19973
+ position:absolute;top:8px;right:8px;z-index:70;
19974
+ width:28px;height:28px;display:grid;place-items:center;
19975
+ border:1px solid var(--line-2);border-radius:var(--r-sm);
19976
+ background:color-mix(in oklch, var(--surface) 88%, transparent);
19977
+ color:var(--muted);cursor:pointer;
19978
+ transition:color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
19979
+ }
19980
+ .app-close svg{width:14px;height:14px}
19981
+ .app-close:hover{color:var(--text);background:var(--surface-2);border-color:var(--line-3)}
19982
+ .app-close:active{transform:translateY(1px)}
19983
+ .app[data-w="phone"] .app-close{top:6px;right:6px;width:24px;height:24px}
19984
+
19275
19985
  `;
19276
19986
  //#endregion
19277
19987
  //#region src/client/credit-dot-css.ts
@@ -19891,6 +20601,7 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
19891
20601
  "chan.ownedElsewhereRow": "Sign in on the “Our Free Model” page",
19892
20602
  "chan.empty": "No channel is connected yet.",
19893
20603
  "shell.brand": "XD Pool",
20604
+ "shell.close": "Close",
19894
20605
  "shell.themeLight": "Eye-care green",
19895
20606
  "shell.themeDark": "Dark",
19896
20607
  "shell.themeToLight": "Switch to the eye-care green (light) theme",
@@ -20160,6 +20871,9 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
20160
20871
  "channelpool.usageMode": "Account usage",
20161
20872
  "channelpool.autoClaim": "Credit automation",
20162
20873
  "channelpool.autoClaimHint": "When on, daily credits are collected in the background.",
20874
+ "channelpool.autoClaimRun": "Run now",
20875
+ "channelpool.autoClaimRunning": "Running…",
20876
+ "channelpool.autoClaimRunHint": "Run one collection pass now instead of waiting for the scheduled hour",
20163
20877
  "channelpool.modePrefer": "Priority",
20164
20878
  "channelpool.modePreferHint": "Priority: always use the first account until it is rate-limited.",
20165
20879
  "channelpool.modeRoundRobin": "Round robin",
@@ -20611,6 +21325,7 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
20611
21325
  "chan.ownedElsewhereRow": "在「我们的免费模型」里登录",
20612
21326
  "chan.empty": "还没有任何渠道连上来。",
20613
21327
  "shell.brand": "XD Pool",
21328
+ "shell.close": "关闭",
20614
21329
  "shell.themeLight": "护眼绿",
20615
21330
  "shell.themeDark": "暗色",
20616
21331
  "shell.themeToLight": "切换到护眼绿(亮色)主题",
@@ -20921,6 +21636,9 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
20921
21636
  "channelpool.usageMode": "账号使用方式",
20922
21637
  "channelpool.autoClaim": "积分自动化",
20923
21638
  "channelpool.autoClaimHint": "开着就会在后台领每天的积分,不用手动点。",
21639
+ "channelpool.autoClaimRun": "立即执行",
21640
+ "channelpool.autoClaimRunning": "领取中…",
21641
+ "channelpool.autoClaimRunHint": "马上跑一轮领取,不用等到预定时间",
20924
21642
  "channelpool.modePrefer": "优先",
20925
21643
  "channelpool.modePreferHint": "优先:总用排在前面的账号,它限流了才换下一个。",
20926
21644
  "channelpool.modeRoundRobin": "轮换",