dsh-neartoken 0.11.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
  |---|---|
16
16
  | **登录** | 设置页 → `POST /neartoken/authorize` → 站点 `POST /api/dsh/device/authorize` 拿到确认码 → 用户在自己浏览器里批准 → 插件按 `interval` 轮询 `POST /api/dsh/device/token`(`authorization_pending` / `slow_down` 退避 +2s / `access_denied` / `expired_token` / `granted`)→ 把站点铸造的 key 写进 credentials 的 `NEARTOKEN_API_KEY` |
17
17
  | **目录** | `GET /api/pricing`(TTL 缓存)→ 按 (分组, 模型) 展开成 `"<组>::<模型>"` → 可见性过滤 → `listModels` 交给 DSH |
18
- | **出字** | `stream()` → 按模型选协议 → 站点 `/v1/messages`、`/v1beta/models/*:streamGenerateContent`、`/v1/responses`、`/v1/chat/completions`。`body.model` 是裸模型名,`x-neartoken-group` 头带分组的 `#<id>` |
18
+ | **出字** | `stream()` → 按模型选协议 → 站点 `/v1/messages`、`/v1beta/models/*:streamGenerateContent`、`/v1/responses`、`/v1/chat/completions`。`body.model` 是裸模型名,`x-neartoken-group` 头带分组的 `#<id>`,每个请求另带**会话亲和键**(`prompt_cache_key` / `metadata.user_id`,见已知限制) |
19
19
  | **画图** | 工具 `generate_image` → 站点 `/v1/images/generations`(声明了 `image-generation` 的模型)或 `/v1/chat/completions`(gemini 系)→ 取回 bytes → 存进 attachment → 结果里带图 |
20
20
 
21
21
  一条实现约束:provider 只有在凭据存在时才挂载,且 `credentials` 服务可能晚于本插件就绪,所以启动时先同步一次、再用 `ctx.inject` 同步一次。
@@ -24,13 +24,14 @@
24
24
  |---|---|
25
25
  | `src/index.ts` | 配置 schema、按凭据现状挂载 provider、装配其余模块 |
26
26
  | `src/host/account.ts` | RFC 8628 形状的设备授权:发起、按 interval 轮询、把 key 写进 credentials |
27
- | `src/host/routes.ts` | 设置页调用的同源路由(状态 / 授权 / 取消 / 断开 / 模型白名单) |
27
+ | `src/host/routes.ts` | 设置页调用的同源路由(状态 / 余额立即刷新 / 授权 / 取消 / 断开 / 模型白名单 / 生图设置) |
28
28
  | `src/host/whitelist.ts` | 白名单读写在插件自身 Config 的 `enabledModels`(volatile),存 profile patch |
29
29
  | `src/host/pricing.ts` | 拉 `/api/pricing`,展开成 `"<组>::<模型>"` 路由,过滤出能聊的模型 |
30
- | `src/host/model-caps.ts` | 一个模型能不能聊、上下文窗口多大、可选的推理等级 |
30
+ | `src/host/model-caps.ts` | 一个模型能不能聊、上下文窗口多大、可选的推理等级(只读站点声明,不存模型表) |
31
31
  | `src/host/adapter.ts` | 目录、元数据、按模型选协议并流式解析 |
32
32
  | `src/host/*-wire.ts` | 四条上游协议各自的请求体与 SSE 解析 |
33
33
  | `src/host/protocol-router.ts` | 按模型选上游协议(claude / gemini / gpt / 其余) |
34
+ | `src/host/session-key.ts` | 从 `GenerateOptions.sessionId` 取会话亲和键,四条 wire 用它让站点把会话粘在同一渠道 |
34
35
  | `src/host/provider-mount.ts` | 路由挂载、撤下、白名单变更时 `replace()` 重播 |
35
36
  | `src/host/images.ts` | 生图:挑通道、发请求、两种响应都读成 bytes |
36
37
  | `src/host/image-tool.ts` | `generate_image` 工具:选模型/分组、把图写进 attachment |
@@ -68,7 +69,7 @@
68
69
  | `imageTimeoutMs` | `300000` | 单次生图的预算(毫秒);工具调用截止时间 = 它 + 30 秒,见下文「超时」 |
69
70
  | `imageGeneration` | `{ enabled: false, models: {} }` | 生图开关与「模型 → 分组」映射;volatile,设置页写 |
70
71
 
71
- `modelOverrides` 是「站点没声明、目录还没收录」时的兜底手段,改完重启即生效,**不需要发新版本**:
72
+ `modelOverrides` 是「站点没声明清楚」时的逐条修正手段,改完重启即生效,**不需要发新版本**:
72
73
 
73
74
  ```yaml
74
75
  - id: dsh-neartoken
@@ -85,31 +86,28 @@
85
86
  站点 `/api/pricing` 会列出它知道的所有模型,插件只提供会响应聊天请求的那部分:
86
87
 
87
88
  1. **站点自己声明的 `supported_endpoint_types` 优先**:含 `openai` / `openai-response` / `anthropic` / `gemini` 任一即可见。这是站点上新增模型当天就能出现在选择器里的原因 —— 不需要等插件发版。
88
- 2. 无论站点声明什么,`-c` 后缀与媒体名(image / tts / transcribe / asr)都不提供 —— 定价接口把这些路由也挂在 `openai` 这个 surface 下,只看声明会把生图和语音模型塞进聊天选择器。
89
- 3. **站点没声明时**回退到名字规则:pi-ai 目录里没有的名字不提供。
89
+ 2. 无论站点声明什么,`-c` 后缀与媒体名都不提供 —— 名单是 `image` / `tts` / `transcribe` / `asr` / `embedding` / `lyria` / `midjourney` / `nano-banana` / `veo` / `imagen` / `dall-e` / `sd*`。**这是名字约定,不是能力元数据,也是当前唯一可用的判据**:定价接口把生图、embedding、音乐、视频模型同样挂在 `openai` / `gemini` 这个 surface 下(它们确实走那条路径),所以 `supported_endpoint_types` 分不出「聊天模型」和「共用该 surface 的媒体模型」。站点若将来能发布模型用途字段,这条约定就可以删。
90
+ 3. **站点没声明时**(老部署)按名字规则放行:插件不再持有模型白名单,所以宁可多列一个也不能让整份目录消失。
90
91
 
91
92
  ## 容量与推理等级
92
93
 
94
+ **模型 metadata 的单一真源是站点。** 插件不内置任何模型表:上下文窗口、最大输出、输入模态、推理档位全部读 `/api/pricing`,站点没声明就是没有(走配置兜底或干脆不提供),不再由插件猜。这样一台站点的容量对**所有客户端一致生效**,插件不需要跟着站点上新模型发版 —— 也因此不存在「插件里的表与站点打架」这种情况。
95
+
96
+ 站点侧在 New API 管理后台按模型维护这四项,`/api/pricing` 以 `context_window` / `max_tokens` / `input_modalities` / `reasoning_levels` 发布。维护步骤见 new-api 仓库 `AGENTS.md` 的「模型能力清单」一节。
97
+
93
98
  上下文窗口(`contextWindow`)决定两件事:对话里的占用率显示,以及自动压缩的阈值。**它缺失时自动压缩会直接放弃**(compaction 后端拒绝为无界模型计算摘要预算),所以插件永远会给出一个值。优先级:
94
99
 
95
100
  | 优先级 | 来源 | 维护方式 |
96
101
  |---|---|---|
97
- | 1 | `modelOverrides` | 改 profile 配置,重启 |
98
- | 2 | 站点 `/api/pricing` 的 `context_window` | 在 New API 管理后台维护,见下 |
99
- | 3 | pi-ai 生成表(`src/host/model-caps.generated.ts`) | `pnpm run gen:model-caps` |
100
- | 4 | `defaultContextWindow` | 改 profile 配置 |
101
-
102
- **推荐在站点侧维护**:New API 管理后台可以给每个模型填上下文窗口与最大输出,`/api/pricing` 会把它们作为 `context_window` / `max_tokens` 发出来。这样一台站点的容量对**所有客户端一致生效**,插件不需要跟着站点上新模型发版。维护步骤见 new-api 仓库 `AGENTS.md` 的「模型容量清单」一节。
103
-
104
- 最大输出(`max_tokens`)只在**站点或配置明确给出**时才写进请求;生成表里的 `maxTokens` 是厂商口径,站点可能把同一个名字路由到上限更低的渠道,照发会把「回答被截断」换成「请求被拒」,所以不用它。不给出该字段时由上游默认值决定。
105
-
106
- 输入模态(`text` / `image`)走同一条优先级链:`modelOverrides.*.input` > 站点 `/api/pricing` 的 `input_modalities` > 厂商文档核对表 > pi-ai 目录 > `['text']`。**未知模型一律声明为纯文本**,因为 harness 把「没有声明」当成「没有权限」:只有声明了 `image` 的模型才允许 `read_image` 和携带图片的请求,否则图片会在发出前被拦下。
102
+ | 1 | `modelOverrides.*.contextWindow` | 改 profile 配置,重启 |
103
+ | 2 | 站点 `/api/pricing` 的 `context_window` | 在 New API 管理后台维护 |
104
+ | 3 | `defaultContextWindow` | 改 profile 配置 |
107
105
 
108
- 站点侧同样能声明模态(New API 后台「Input modalities」两个复选框),所以一个刚上架的多模态模型只要后台勾一下就能用图,不必等插件发版。目录里有 729 个多模态模型作为开箱默认。
106
+ 最大输出(`max_tokens`)只在**站点或配置明确给出**时才写进请求。站点可能把同一个名字路由到上限更低的渠道,照抄厂商口径会把「回答被截断」换成「请求被拒」。不给出该字段时由上游默认值决定。
109
107
 
110
- 推理等级目前仍只来自插件内置表(站点不报),新模型带档位时需要发版或在 `modelOverrides.*.reasoning` 里写明。
108
+ 输入模态(`text` / `image`)优先级:`modelOverrides.*.input` > 站点 `input_modalities` > `['text']`。**站点没声明的模型一律当纯文本**,因为 harness 把「没有声明」当成「没有权限」:只有声明了 `image` 的模型才允许 `read_image` 和携带图片的请求,否则图片会在发出前被拦下。所以后台忘了勾 `image` 的模型,症状是「贴图被拦」而不是「报错」。
111
109
 
112
- 推理等级来自 `@earendil-works/pi-ai` 的模型目录(DSH 的 `llm-pi-ai` 用的同一份数据)。插件不在运行时依赖它:`scripts/gen-model-caps.mjs` 把目录生成成 `src/host/model-caps.generated.ts`(1101 个 chat 模型、486 个带推理档位、1101 个带上下文窗口),升级依赖后跑 `pnpm run gen:model-caps` 重建。同一模型 id 在不同 provider 下可能给出不同档位(网关常只列两档,厂商列六档),生成时取**最完整**的那份;上下文窗口取**最小**的那份。
110
+ 推理档位(`minimal` / `low` / `medium` / `high` / `xhigh` / `max`)优先级:`modelOverrides.*.reasoning` > 站点 `reasoning_levels` > 无档位。**站点没声明就没有档位选择器** —— 与其发一个上游不认的档位换来 400,不如不提供。
113
111
 
114
112
  ## 图像生成(`generate_image`)
115
113
 
@@ -189,15 +187,16 @@ Gemini 系走原生 surface 而不是 openai 兼容层:同模型同提示词
189
187
 
190
188
  - 四套 wire(chat / anthropic / genai / responses)各自解析 SSE;**用户消息里的图片按各协议原样发送** —— chat 用 `image_url` part、anthropic 用 `source.base64`、genai 用 `inlineData`、responses 用 `input_image`。字节由 `attachments.readImage` 在请求前内联;没有 attachments 服务或读不出来会**让请求失败**,不再静默降级成纯文本(曾经就是这样:贴的截图模型根本收不到)。文件块(非图片附件)仍不发;`/model` 弹窗仍是内置平铺列表;箭头键盘导航未接。
191
189
  - 四套 wire 的 SSE 解析都有「帧样本 → 期望 chunk 序列」回归测试(`src/host/wire-parse.spec.ts`),帧样本取自生产网关的真实响应。网关在内容帧上发 `"usage": null`,只有末帧带真值:任何一处把 `usage` 当对象直接读都会让整条流中途崩掉(曾导致 claude 模型全不可用)。
190
+ - **每个请求都带会话亲和键**:chat 与 responses 发 `prompt_cache_key`,anthropic 发 `metadata.user_id`,取值都是 DSH 的 `GenerateOptions.sessionId`。站点就是靠这个值挑上游渠道的(New API 的「codex cli trace」规则:`^gpt-.*$` + `/v1/responses`,键取自 body 的 `prompt_cache_key`,取不到就把整条规则跳过),而提示词缓存按**上游账号**存 —— 不带键时每个请求随机换账号,缓存永远不中。实测同一 6k 前缀:不带键连发 4 次 `cached_tokens` 全 0;带键后第 2 次起 5888/6011 ≈ 98%。`/v1/chat/completions` 上目前没有对应规则,chat 线即使带键也只是偶发命中,要彻底解决需要站点加一条匹配该路径的亲和规则;anthropic 线的 `metadata.user_id` 同理(规则只作用于 `/v1/messages`,这一条已经匹配)。
192
191
  - 推理等级按各协议自己的词汇发送:**anthropic 发 `thinking.type=adaptive` + `output_config.effort`**(不能再用 `thinking.type=enabled` + `budget_tokens`:Claude 5 代直接 400 `requires adaptive thinking`,而 adaptive 在老代际上同样可用,所以统一用它;`minimal` 收敛成 `low`);genai 发 `thinkingConfig` 且带 `includeThoughts`(不带你拿不到思维链);chat 与 responses 发 `reasoning_effort` / `reasoning.effort`。
193
192
  - **Gemini 4 换成 `thinkingLevel`**:这一代不再接受 token 预算(发 budget 会 400 `Use thinking level instead`),按 `gemini-<主版本>` ≥ 4 自动切换字段,等级名用 `low` / `medium` / `high` / `max`。
194
193
  - 思考历史**不回传**:harness 的 reasoning 块没有 signature 槽位,anthropic 的 `signature_delta` 与 gemini 的 `thoughtSignature` 都被丢弃。当前网关的转换层本身也会丢弃 thinking 块,所以多轮不会因此报错;接真正的 Anthropic / Gemini 直连渠道时这一条会变成硬限制。
195
194
  - 文本与思维块由**第一个非空 delta** 打开,思维块为空时不产生空块;工具调用块在 `content_block_start` 打开,因为 id 与函数名只在那里出现。
196
195
  - anthropic 线不硬编码 `max_tokens`:只在调用方给了上限、或开了 thinking 需要余量时才发。给死值会截断长回答。
197
196
  - `-c` 后缀是站点自己的约定(带该后缀的模型工具调用不可靠):站点声明了端点类型时插件按声明提供,声明里没有它就不会出现;没有声明时按名字隐藏它的无后缀孪生之外的变体。
198
- - 站点上新、pi-ai 目录还没收录的模型:只要站点声明了端点类型就会提供,容量走 `defaultContextWindow`,推理等级为空(除非在 `modelOverrides` 里写明)。
197
+ - 站点上新但还没在后台填能力的模型:只要声明了端点类型就会提供,容量走 `defaultContextWindow`,模态按纯文本、没有推理档位(除非在 `modelOverrides` 里写明)。这不是 bug,是「站点是唯一真源」的直接后果——补能力请去后台填,不必等插件发版。
199
198
  - pricing 加载失败时沿用上一次成功的结果,从未成功过则目录为空(失败不写缓存,下次调用会重试)。
200
- - 账号卡片不自动刷新:数字只来自授权那一刻 grant 里的 `user`(站点的 dashboard 接口认浏览器会话,不认本插件持有的 relay key),落盘到 profile 下的 `neartoken-account.json`,重启后从文件恢复。之后余额变化不会反映,需要重新连接一次。
199
+ - 账号卡片的钱是**两次读**拼接的:授权那一刻 grant 里的 `user` 给出身份事实,余额/已用/代金券则来自站点 `/api/dsh/device/wallet`——Host 每 5 分钟读一次,页面在余额旁另有**立即刷新**按钮(`POST /neartoken/refresh`,读完后把同一份状态回给页面),所以不必重连也能看到新数字。落盘到 profile 下的 `neartoken-account.json` 只作重启回退。站点若没有该端点或读不到,卡片保留上一次的数字、不会清空。代金券为空时卡片给一句去「邀请计划」(站点 `/wallet` 页)领免费代金券的提示。
201
200
  - 白名单按裸模型名过滤:勾掉某模型会把它的所有分组一起隐藏;某个正在使用的模型被勾掉后,会话里已选中的 id 仍在,但选择器里不再列出它。
202
201
  - 白名单写入走 DSH 的 Settings:profile 里该行只保留 volatile 字段,所以别把 `baseURL` 等非 volatile 字段写进**同一个 profile 行**(会在此后第一次保存白名单时被 Settings 的 strip 规则清掉)。
203
202
  - 生图一次一张;`size` 对 images 通道只是建议,上游常忽略(实测不传 size 时 gpt-image-2.5-flare 出 1536x1024)。
@@ -211,6 +210,5 @@ pnpm install
211
210
  pnpm run typecheck
212
211
  pnpm run test # vitest:account / pricing / adapter / model-caps / groups / whitelist / routes / config / wire-parse / images / image-settings / image-tool
213
212
  pnpm run typecheck # 两个 face 分别检查(host 与 client 的 ctx.sessions 声明互相冲突,不能同 program)
214
- pnpm run gen:model-caps # 升级 @earendil-works/pi-ai 后重建能力表
215
213
  pnpm run build # lib/index.js (host) + lib/client.js (client) + lib/types
216
214
  ```
package/lib/client.js CHANGED
@@ -23,6 +23,12 @@ window.__ModuleLoader__.load({
23
23
  */
24
24
  /** State read by the settings page before it draws, and while it waits. */
25
25
  const STATUS_PATH = "/neartoken/status";
26
+ /**
27
+ * Re-read the wallet right now, then answer with the same state `STATUS_PATH`
28
+ * reads. The Host already refreshes on its own cadence; this is the page asking
29
+ * for that read early, and the answer carries the fresh numbers.
30
+ */
31
+ const REFRESH_PATH = "/neartoken/refresh";
26
32
  /** Start a device authorization (the Host then polls the site). */
27
33
  const AUTHORIZE_PATH = "/neartoken/authorize";
28
34
  /** Abandon the authorization in progress. */
@@ -72,6 +78,9 @@ window.__ModuleLoader__.load({
72
78
  async status() {
73
79
  return await jsonOf(await fetcher(STATUS_PATH, { headers: { accept: "application/json" } }));
74
80
  },
81
+ async refreshAccount() {
82
+ return await post(REFRESH_PATH);
83
+ },
75
84
  async begin() {
76
85
  return await post(AUTHORIZE_PATH);
77
86
  },
@@ -333,23 +342,23 @@ window.__ModuleLoader__.load({
333
342
  document.head.appendChild(tag);
334
343
  }
335
344
  var group_tags_module_css_default = {
336
- "toneRose": "FotuUq_toneRose",
337
345
  "toneCyan": "FotuUq_toneCyan",
338
- "toneTeal": "FotuUq_toneTeal",
346
+ "toneRose": "FotuUq_toneRose",
347
+ "tonePink": "FotuUq_tonePink",
348
+ "ratioChip": "FotuUq_ratioChip",
339
349
  "toneLime": "FotuUq_toneLime",
340
- "toneFuchsia": "FotuUq_toneFuchsia",
341
- "ratioPricey": "FotuUq_ratioPricey",
350
+ "ratioCheap": "FotuUq_ratioCheap",
351
+ "toneOrange": "FotuUq_toneOrange",
342
352
  "toneEmerald": "FotuUq_toneEmerald",
353
+ "ratioBase": "FotuUq_ratioBase",
354
+ "toneAmber": "FotuUq_toneAmber",
355
+ "toneTeal": "FotuUq_toneTeal",
343
356
  "tag": "FotuUq_tag",
344
- "toneOrange": "FotuUq_toneOrange",
357
+ "toneSky": "FotuUq_toneSky",
345
358
  "toneIndigo": "FotuUq_toneIndigo",
346
- "toneAmber": "FotuUq_toneAmber",
359
+ "ratioPricey": "FotuUq_ratioPricey",
347
360
  "toneViolet": "FotuUq_toneViolet",
348
- "toneSky": "FotuUq_toneSky",
349
- "tonePink": "FotuUq_tonePink",
350
- "ratioCheap": "FotuUq_ratioCheap",
351
- "ratioBase": "FotuUq_ratioBase",
352
- "ratioChip": "FotuUq_ratioChip"
361
+ "toneFuchsia": "FotuUq_toneFuchsia"
353
362
  };
354
363
  //#endregion
355
364
  //#region src/client/group-tags.tsx
@@ -404,39 +413,39 @@ window.__ModuleLoader__.load({
404
413
  document.head.appendChild(tag);
405
414
  }
406
415
  var ModelGroupSelect_module_css_default = {
407
- "check": "_2pt-bW_check",
408
- "optionActive": "_2pt-bW_optionActive",
409
- "cellLabel": "_2pt-bW_cellLabel",
410
- "root": "_2pt-bW_root",
411
- "retry": "_2pt-bW_retry",
412
- "groupName": "_2pt-bW_groupName",
413
- "triggerIcon": "_2pt-bW_triggerIcon",
414
- "toast": "_2pt-bW_toast",
415
- "warning": "_2pt-bW_warning",
416
- "selected": "_2pt-bW_selected",
417
- "optionCopy": "_2pt-bW_optionCopy",
418
416
  "option": "_2pt-bW_option",
419
- "error": "_2pt-bW_error",
420
- "cellValue": "_2pt-bW_cellValue",
417
+ "selected": "_2pt-bW_selected",
421
418
  "trigger": "_2pt-bW_trigger",
419
+ "searchClear": "_2pt-bW_searchClear",
420
+ "warning": "_2pt-bW_warning",
421
+ "optionCopy": "_2pt-bW_optionCopy",
422
422
  "menu": "_2pt-bW_menu",
423
- "cellChevron": "_2pt-bW_cellChevron",
423
+ "optionActive": "_2pt-bW_optionActive",
424
+ "cellLabel": "_2pt-bW_cellLabel",
425
+ "error": "_2pt-bW_error",
424
426
  "optionTrailing": "_2pt-bW_optionTrailing",
425
- "searchRow": "_2pt-bW_searchRow",
426
- "chevron": "_2pt-bW_chevron",
427
+ "cellValue": "_2pt-bW_cellValue",
428
+ "groups": "_2pt-bW_groups",
429
+ "root": "_2pt-bW_root",
430
+ "triggerIcon": "_2pt-bW_triggerIcon",
431
+ "groupOptionLabel": "_2pt-bW_groupOptionLabel",
427
432
  "triggerLabel": "_2pt-bW_triggerLabel",
428
- "status": "_2pt-bW_status",
429
- "empty": "_2pt-bW_empty",
430
433
  "triggerEffort": "_2pt-bW_triggerEffort",
431
- "groupOptionLabel": "_2pt-bW_groupOptionLabel",
432
- "modelOption": "_2pt-bW_modelOption",
433
- "cell": "_2pt-bW_cell",
434
- "modelName": "_2pt-bW_modelName",
435
- "groups": "_2pt-bW_groups",
436
434
  "groupInline": "_2pt-bW_groupInline",
435
+ "empty": "_2pt-bW_empty",
436
+ "searchRow": "_2pt-bW_searchRow",
437
+ "groupName": "_2pt-bW_groupName",
438
+ "modelOption": "_2pt-bW_modelOption",
439
+ "chevron": "_2pt-bW_chevron",
440
+ "status": "_2pt-bW_status",
441
+ "retry": "_2pt-bW_retry",
437
442
  "search": "_2pt-bW_search",
443
+ "modelName": "_2pt-bW_modelName",
438
444
  "variantCount": "_2pt-bW_variantCount",
439
- "searchClear": "_2pt-bW_searchClear"
445
+ "check": "_2pt-bW_check",
446
+ "cell": "_2pt-bW_cell",
447
+ "cellChevron": "_2pt-bW_cellChevron",
448
+ "toast": "_2pt-bW_toast"
440
449
  };
441
450
  //#endregion
442
451
  //#region src/client/ModelGroupSelect.tsx
@@ -992,7 +1001,7 @@ window.__ModuleLoader__.load({
992
1001
  }
993
1002
  //#endregion
994
1003
  //#region \0dsh-css:D:\Projects\deepseek-harness\dsh-neartoken\src\client\NearTokenSection.module.css.mjs
995
- const css = "._02HI2q_section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:12px;display:flex}._02HI2q_title{margin:0;font-size:16px;font-weight:500;line-height:24px}._02HI2q_intro{color:var(--dsw-alias-label-tertiary);margin:0;font-size:14px;line-height:22px}._02HI2q_card{border:.5px solid var(--dsw-alias-settings-card-stroke);background:var(--dsw-alias-settings-card-fill);border-radius:var(--dsw-radius-xl);flex-direction:column;gap:12px;padding:14px 16px;display:flex}._02HI2q_cardHead{align-items:baseline;gap:10px;display:flex}._02HI2q_name{font-size:15px;font-weight:500;line-height:22px}._02HI2q_handle{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}._02HI2q_badge{background:var(--dsw-alias-button-elevated-fill);color:var(--dsw-alias-label-secondary);border-radius:999px;margin-left:auto;padding:2px 8px;font-size:12px;line-height:18px}._02HI2q_badgeOn{color:var(--dsw-alias-state-success-primary)}._02HI2q_facts{border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover);grid-template-columns:repeat(auto-fit,minmax(132px,1fr));gap:14px 18px;margin:0;padding:12px 14px;display:grid}._02HI2q_fact{flex-direction:column;gap:2px;display:flex}._02HI2q_factLabel{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}._02HI2q_factValue{font-variant-numeric:tabular-nums;letter-spacing:-.01em;color:var(--dsw-alias-label-primary);font-size:15px;font-weight:500;line-height:22px}._02HI2q_voucherFact{grid-column:1/-1}._02HI2q_voucherList{flex-direction:column;gap:2px;margin:0;display:flex}._02HI2q_voucherRow{justify-content:space-between;align-items:baseline;gap:10px;font-size:13px;line-height:20px;display:flex}._02HI2q_voucherGroup{color:var(--dsw-alias-label-secondary);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}._02HI2q_voucherAmount{color:var(--dsw-alias-state-success-primary);font-variant-numeric:tabular-nums;white-space:nowrap;font-weight:500}._02HI2q_form{flex-direction:column;gap:10px;display:flex}._02HI2q_label{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}._02HI2q_codeRow{align-items:center;gap:10px;display:flex}._02HI2q_code{font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);letter-spacing:.08em;border-radius:var(--dsw-radius-md);background:var(--dsw-alias-button-elevated-fill);color:var(--dsw-alias-label-primary);user-select:all;padding:4px 12px;font-size:18px;line-height:26px}._02HI2q_linkRow{flex-direction:column;gap:4px;display:flex}._02HI2q_linkLine{align-items:flex-start;gap:8px;display:flex}._02HI2q_link{min-width:0;font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);word-break:break-all;color:var(--dsw-alias-label-secondary);user-select:all;flex:auto;font-size:12px;line-height:18px}._02HI2q_actions{align-items:center;gap:10px;display:flex}._02HI2q_button{border-radius:var(--dsw-radius-md);border:.5px solid var(--dsw-alias-settings-card-stroke);background:var(--dsw-alias-button-elevated-fill);height:32px;color:var(--dsw-alias-label-primary);cursor:pointer;padding:0 14px;font-size:14px}._02HI2q_buttonPrimary{background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-inverted);border-color:#0000}._02HI2q_button:disabled{opacity:.55;cursor:default}._02HI2q_notice{color:var(--dsw-alias-state-warn-label);margin:0;font-size:12px;line-height:18px}._02HI2q_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}._02HI2q_search{border-radius:var(--dsw-radius-md);border:.5px solid var(--dsw-alias-settings-card-stroke);background:var(--dsw-alias-button-elevated-fill);height:32px;color:var(--dsw-alias-label-primary);padding:0 10px;font-size:14px}._02HI2q_search::placeholder{color:var(--dsw-alias-label-dimmed)}._02HI2q_toolbar{flex-wrap:wrap;align-items:center;gap:8px;display:flex}._02HI2q_autosave{color:var(--dsw-alias-label-tertiary);margin-left:auto;font-size:12px;line-height:18px}._02HI2q_list{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-md);flex-direction:column;max-height:320px;padding:4px;display:flex;overflow-y:auto}._02HI2q_row{border-radius:var(--dsw-radius-sm);cursor:pointer;align-items:baseline;gap:8px;padding:4px 6px;font-size:13px;line-height:20px;display:flex}._02HI2q_row:hover{background:var(--dsw-alias-interactive-bg-hover)}._02HI2q_row input{accent-color:var(--dsw-alias-button-primary-fill);align-self:center}._02HI2q_rowName{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--dsw-alias-label-primary);flex:auto;overflow:hidden}._02HI2q_rowMeta{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;white-space:nowrap;flex:none;align-items:baseline;gap:8px;font-size:12px;display:flex}._02HI2q_rowRatio{color:var(--dsw-alias-label-secondary)}._02HI2q_tip{z-index:40;border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-settings-card-fill);pointer-events:none;flex-direction:column;gap:2px;width:280px;max-height:240px;padding:8px 10px;font-size:12px;line-height:18px;display:flex;position:fixed;overflow-y:auto;box-shadow:0 8px 24px #00000024}._02HI2q_tipTitle{color:var(--dsw-alias-label-tertiary)}._02HI2q_tipRow{justify-content:space-between;align-items:baseline;gap:10px;display:flex}._02HI2q_tipGroup{min-width:0;color:var(--dsw-alias-label-primary);align-items:center;gap:4px;display:flex;overflow:hidden}._02HI2q_tipGroupName{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}._02HI2q_select{border:1px solid var(--dsw-color-border-subtle,#0000001f);max-width:60%;color:inherit;font:inherit;background:0 0;border-radius:6px;margin-left:auto;padding:2px 6px;font-size:12px}._02HI2q_select:disabled{opacity:.5}._02HI2q_cardToggle{width:100%;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;align-items:center;gap:8px;padding:0;display:flex}._02HI2q_cardToggle:hover ._02HI2q_name{color:var(--dsw-alias-label-primary)}._02HI2q_count{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);align-items:center;gap:8px;margin-left:auto;font-size:12px;line-height:18px;display:inline-flex}._02HI2q_countDot{background:var(--dsw-alias-label-dimmed);border-radius:50%;width:3px;height:3px}._02HI2q_countPicked{color:var(--dsw-alias-label-secondary)}._02HI2q_chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .12s}._02HI2q_chevronOpen{transform:rotate(180deg)}";
1004
+ const css = "._02HI2q_section{max-width:720px;color:var(--dsw-alias-label-primary);flex-direction:column;gap:12px;display:flex}._02HI2q_title{margin:0;font-size:16px;font-weight:500;line-height:24px}._02HI2q_intro{color:var(--dsw-alias-label-tertiary);margin:0;font-size:14px;line-height:22px}._02HI2q_card{border:.5px solid var(--dsw-alias-settings-card-stroke);background:var(--dsw-alias-settings-card-fill);border-radius:var(--dsw-radius-xl);flex-direction:column;gap:12px;padding:14px 16px;display:flex}._02HI2q_cardHead{align-items:baseline;gap:10px;display:flex}._02HI2q_name{font-size:15px;font-weight:500;line-height:22px}._02HI2q_handle{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}._02HI2q_badge{background:var(--dsw-alias-button-elevated-fill);color:var(--dsw-alias-label-secondary);border-radius:999px;margin-left:auto;padding:2px 8px;font-size:12px;line-height:18px}._02HI2q_badgeOn{color:var(--dsw-alias-state-success-primary)}._02HI2q_facts{border-radius:var(--dsw-radius-md);background:var(--dsw-alias-interactive-bg-hover);grid-template-columns:repeat(auto-fit,minmax(132px,1fr));gap:14px 18px;margin:0;padding:12px 14px;display:grid}._02HI2q_fact{flex-direction:column;gap:2px;display:flex}._02HI2q_factLabel{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}._02HI2q_factValue{font-variant-numeric:tabular-nums;letter-spacing:-.01em;color:var(--dsw-alias-label-primary);font-size:15px;font-weight:500;line-height:22px}._02HI2q_valueRow{align-items:center;gap:6px;display:flex}._02HI2q_refresh{border-radius:var(--dsw-radius-sm);width:22px;height:22px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;padding:0;display:inline-flex}._02HI2q_refresh:hover:not(:disabled){background:var(--dsw-alias-button-elevated-fill);color:var(--dsw-alias-label-primary)}._02HI2q_refresh:disabled{opacity:.55;cursor:default}._02HI2q_voucherFact{grid-column:1/-1}._02HI2q_voucherList{flex-direction:column;gap:2px;margin:0;display:flex}._02HI2q_voucherRow{justify-content:space-between;align-items:baseline;gap:10px;font-size:13px;line-height:20px;display:flex}._02HI2q_voucherGroup{color:var(--dsw-alias-label-secondary);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}._02HI2q_voucherAmount{color:var(--dsw-alias-state-success-primary);font-variant-numeric:tabular-nums;white-space:nowrap;font-weight:500}._02HI2q_voucherEmpty{color:var(--dsw-alias-label-tertiary);margin:0;font-size:13px;line-height:20px}._02HI2q_invite{color:var(--dsw-alias-label-primary);text-underline-offset:2px;text-decoration:underline}._02HI2q_form{flex-direction:column;gap:10px;display:flex}._02HI2q_label{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px}._02HI2q_codeRow{align-items:center;gap:10px;display:flex}._02HI2q_code{font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);letter-spacing:.08em;border-radius:var(--dsw-radius-md);background:var(--dsw-alias-button-elevated-fill);color:var(--dsw-alias-label-primary);user-select:all;padding:4px 12px;font-size:18px;line-height:26px}._02HI2q_linkRow{flex-direction:column;gap:4px;display:flex}._02HI2q_linkLine{align-items:flex-start;gap:8px;display:flex}._02HI2q_link{min-width:0;font-family:var(--dsw-font-mono,ui-monospace, SFMono-Regular, Menlo, monospace);word-break:break-all;color:var(--dsw-alias-label-secondary);user-select:all;flex:auto;font-size:12px;line-height:18px}._02HI2q_actions{align-items:center;gap:10px;display:flex}._02HI2q_button{border-radius:var(--dsw-radius-md);border:.5px solid var(--dsw-alias-settings-card-stroke);background:var(--dsw-alias-button-elevated-fill);height:32px;color:var(--dsw-alias-label-primary);cursor:pointer;padding:0 14px;font-size:14px}._02HI2q_buttonPrimary{background:var(--dsw-alias-button-primary-fill);color:var(--dsw-alias-label-primary-inverted);border-color:#0000}._02HI2q_button:disabled{opacity:.55;cursor:default}._02HI2q_notice{color:var(--dsw-alias-state-warn-label);margin:0;font-size:12px;line-height:18px}._02HI2q_hint{color:var(--dsw-alias-label-tertiary);margin:0;font-size:12px;line-height:18px}._02HI2q_search{border-radius:var(--dsw-radius-md);border:.5px solid var(--dsw-alias-settings-card-stroke);background:var(--dsw-alias-button-elevated-fill);height:32px;color:var(--dsw-alias-label-primary);padding:0 10px;font-size:14px}._02HI2q_search::placeholder{color:var(--dsw-alias-label-dimmed)}._02HI2q_toolbar{flex-wrap:wrap;align-items:center;gap:8px;display:flex}._02HI2q_autosave{color:var(--dsw-alias-label-tertiary);margin-left:auto;font-size:12px;line-height:18px}._02HI2q_list{border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-md);flex-direction:column;max-height:320px;padding:4px;display:flex;overflow-y:auto}._02HI2q_row{border-radius:var(--dsw-radius-sm);cursor:pointer;align-items:baseline;gap:8px;padding:4px 6px;font-size:13px;line-height:20px;display:flex}._02HI2q_row:hover{background:var(--dsw-alias-interactive-bg-hover)}._02HI2q_row input{accent-color:var(--dsw-alias-button-primary-fill);align-self:center}._02HI2q_rowName{text-overflow:ellipsis;white-space:nowrap;min-width:0;color:var(--dsw-alias-label-primary);flex:auto;overflow:hidden}._02HI2q_rowMeta{color:var(--dsw-alias-label-tertiary);font-variant-numeric:tabular-nums;white-space:nowrap;flex:none;align-items:baseline;gap:8px;font-size:12px;display:flex}._02HI2q_rowRatio{color:var(--dsw-alias-label-secondary)}._02HI2q_tip{z-index:40;border:.5px solid var(--dsw-alias-settings-card-stroke);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-settings-card-fill);pointer-events:none;flex-direction:column;gap:2px;width:280px;max-height:240px;padding:8px 10px;font-size:12px;line-height:18px;display:flex;position:fixed;overflow-y:auto;box-shadow:0 8px 24px #00000024}._02HI2q_tipTitle{color:var(--dsw-alias-label-tertiary)}._02HI2q_tipRow{justify-content:space-between;align-items:baseline;gap:10px;display:flex}._02HI2q_tipGroup{min-width:0;color:var(--dsw-alias-label-primary);align-items:center;gap:4px;display:flex;overflow:hidden}._02HI2q_tipGroupName{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}._02HI2q_select{border:1px solid var(--dsw-color-border-subtle,#0000001f);max-width:60%;color:inherit;font:inherit;background:0 0;border-radius:6px;margin-left:auto;padding:2px 6px;font-size:12px}._02HI2q_select:disabled{opacity:.5}._02HI2q_cardToggle{width:100%;color:inherit;font:inherit;text-align:left;cursor:pointer;background:0 0;border:0;align-items:center;gap:8px;padding:0;display:flex}._02HI2q_cardToggle:hover ._02HI2q_name{color:var(--dsw-alias-label-primary)}._02HI2q_count{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-tertiary);align-items:center;gap:8px;margin-left:auto;font-size:12px;line-height:18px;display:inline-flex}._02HI2q_countDot{background:var(--dsw-alias-label-dimmed);border-radius:50%;width:3px;height:3px}._02HI2q_countPicked{color:var(--dsw-alias-label-secondary)}._02HI2q_chevron{color:var(--dsw-alias-label-tertiary);flex:none;transition:transform .12s}._02HI2q_chevronOpen{transform:rotate(180deg)}";
996
1005
  const tagId = "dsh-neartoken/NearTokenSection.module.css";
997
1006
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
998
1007
  const tag = document.createElement("style");
@@ -1002,56 +1011,60 @@ window.__ModuleLoader__.load({
1002
1011
  document.head.appendChild(tag);
1003
1012
  }
1004
1013
  var NearTokenSection_module_css_default = {
1005
- "autosave": "_02HI2q_autosave",
1006
- "card": "_02HI2q_card",
1014
+ "tip": "_02HI2q_tip",
1015
+ "search": "_02HI2q_search",
1016
+ "linkLine": "_02HI2q_linkLine",
1017
+ "buttonPrimary": "_02HI2q_buttonPrimary",
1018
+ "select": "_02HI2q_select",
1019
+ "voucherFact": "_02HI2q_voucherFact",
1020
+ "linkRow": "_02HI2q_linkRow",
1007
1021
  "cardHead": "_02HI2q_cardHead",
1022
+ "voucherList": "_02HI2q_voucherList",
1023
+ "section": "_02HI2q_section",
1024
+ "valueRow": "_02HI2q_valueRow",
1025
+ "badge": "_02HI2q_badge",
1026
+ "tipTitle": "_02HI2q_tipTitle",
1027
+ "voucherRow": "_02HI2q_voucherRow",
1028
+ "name": "_02HI2q_name",
1008
1029
  "handle": "_02HI2q_handle",
1009
- "toolbar": "_02HI2q_toolbar",
1010
- "tipGroupName": "_02HI2q_tipGroupName",
1011
- "count": "_02HI2q_count",
1012
- "select": "_02HI2q_select",
1030
+ "factLabel": "_02HI2q_factLabel",
1013
1031
  "voucherAmount": "_02HI2q_voucherAmount",
1014
- "rowName": "_02HI2q_rowName",
1015
- "intro": "_02HI2q_intro",
1016
- "name": "_02HI2q_name",
1017
- "rowMeta": "_02HI2q_rowMeta",
1018
- "countDot": "_02HI2q_countDot",
1019
- "factValue": "_02HI2q_factValue",
1020
- "codeRow": "_02HI2q_codeRow",
1032
+ "notice": "_02HI2q_notice",
1033
+ "countPicked": "_02HI2q_countPicked",
1034
+ "chevron": "_02HI2q_chevron",
1035
+ "hint": "_02HI2q_hint",
1036
+ "tipRow": "_02HI2q_tipRow",
1037
+ "label": "_02HI2q_label",
1038
+ "invite": "_02HI2q_invite",
1021
1039
  "link": "_02HI2q_link",
1022
- "linkRow": "_02HI2q_linkRow",
1023
- "voucherList": "_02HI2q_voucherList",
1024
1040
  "actions": "_02HI2q_actions",
1025
- "row": "_02HI2q_row",
1041
+ "cardToggle": "_02HI2q_cardToggle",
1026
1042
  "chevronOpen": "_02HI2q_chevronOpen",
1043
+ "refresh": "_02HI2q_refresh",
1027
1044
  "code": "_02HI2q_code",
1028
- "title": "_02HI2q_title",
1045
+ "intro": "_02HI2q_intro",
1029
1046
  "fact": "_02HI2q_fact",
1030
- "list": "_02HI2q_list",
1031
- "facts": "_02HI2q_facts",
1032
- "buttonPrimary": "_02HI2q_buttonPrimary",
1033
- "voucherFact": "_02HI2q_voucherFact",
1034
- "search": "_02HI2q_search",
1035
- "rowRatio": "_02HI2q_rowRatio",
1036
- "hint": "_02HI2q_hint",
1037
- "form": "_02HI2q_form",
1038
- "badgeOn": "_02HI2q_badgeOn",
1039
- "factLabel": "_02HI2q_factLabel",
1047
+ "factValue": "_02HI2q_factValue",
1040
1048
  "voucherGroup": "_02HI2q_voucherGroup",
1041
- "notice": "_02HI2q_notice",
1042
- "label": "_02HI2q_label",
1043
- "tip": "_02HI2q_tip",
1044
- "badge": "_02HI2q_badge",
1045
- "tipTitle": "_02HI2q_tipTitle",
1046
- "section": "_02HI2q_section",
1047
- "tipRow": "_02HI2q_tipRow",
1048
- "tipGroup": "_02HI2q_tipGroup",
1049
- "chevron": "_02HI2q_chevron",
1050
- "countPicked": "_02HI2q_countPicked",
1051
- "linkLine": "_02HI2q_linkLine",
1049
+ "voucherEmpty": "_02HI2q_voucherEmpty",
1052
1050
  "button": "_02HI2q_button",
1053
- "cardToggle": "_02HI2q_cardToggle",
1054
- "voucherRow": "_02HI2q_voucherRow"
1051
+ "toolbar": "_02HI2q_toolbar",
1052
+ "autosave": "_02HI2q_autosave",
1053
+ "rowName": "_02HI2q_rowName",
1054
+ "rowRatio": "_02HI2q_rowRatio",
1055
+ "card": "_02HI2q_card",
1056
+ "row": "_02HI2q_row",
1057
+ "tipGroup": "_02HI2q_tipGroup",
1058
+ "badgeOn": "_02HI2q_badgeOn",
1059
+ "codeRow": "_02HI2q_codeRow",
1060
+ "title": "_02HI2q_title",
1061
+ "facts": "_02HI2q_facts",
1062
+ "count": "_02HI2q_count",
1063
+ "list": "_02HI2q_list",
1064
+ "tipGroupName": "_02HI2q_tipGroupName",
1065
+ "countDot": "_02HI2q_countDot",
1066
+ "form": "_02HI2q_form",
1067
+ "rowMeta": "_02HI2q_rowMeta"
1055
1068
  };
1056
1069
  //#endregion
1057
1070
  //#region src/client/NearTokenSection.tsx
@@ -1083,6 +1096,11 @@ window.__ModuleLoader__.load({
1083
1096
  function NearTokenSection({ api, t }) {
1084
1097
  const [status, setStatus] = (0, react.useState)(void 0);
1085
1098
  const [busy, setBusy] = (0, react.useState)(false);
1099
+ /**
1100
+ * Whether the card's money facts are being re-read right now. Kept apart from
1101
+ * `busy`: a balance read must not disable the buttons beside it.
1102
+ */
1103
+ const [walletBusy, setWalletBusy] = (0, react.useState)(false);
1086
1104
  const [error, setError] = (0, react.useState)(void 0);
1087
1105
  /** Whether the confirmation address was just copied to the clipboard. */
1088
1106
  const [copied, setCopied] = (0, react.useState)(false);
@@ -1196,8 +1214,26 @@ window.__ModuleLoader__.load({
1196
1214
  await refresh();
1197
1215
  });
1198
1216
  };
1217
+ /**
1218
+ * Ask the Host to re-read the wallet now, and publish the state it answers
1219
+ * with: the same read the Host runs on its own cadence, taken early.
1220
+ */
1221
+ const refreshWallet = () => {
1222
+ (async () => {
1223
+ setWalletBusy(true);
1224
+ setError(void 0);
1225
+ try {
1226
+ setStatus(await api.refreshAccount());
1227
+ } catch (failure) {
1228
+ setError(t("account.failed", { message: messageOf(failure) }));
1229
+ } finally {
1230
+ setWalletBusy(false);
1231
+ }
1232
+ })();
1233
+ };
1199
1234
  const account = status?.account;
1200
1235
  const pending = status?.pending;
1236
+ const [vouchersBefore = "", vouchersAfter = ""] = t("account.vouchersEmpty").split("{link}");
1201
1237
  const minutes = pending === void 0 ? 0 : Math.max(1, Math.round((pending.expiresAt - Date.now()) / 6e4));
1202
1238
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1203
1239
  className: NearTokenSection_module_css_default.section,
@@ -1247,9 +1283,17 @@ window.__ModuleLoader__.load({
1247
1283
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
1248
1284
  className: NearTokenSection_module_css_default.factLabel,
1249
1285
  children: t("account.balance")
1250
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", {
1251
- className: NearTokenSection_module_css_default.factValue,
1252
- children: account?.balance ?? "—"
1286
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dd", {
1287
+ className: `${NearTokenSection_module_css_default.factValue} ${NearTokenSection_module_css_default.valueRow}`,
1288
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: account?.balance ?? "—" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1289
+ type: "button",
1290
+ className: NearTokenSection_module_css_default.refresh,
1291
+ disabled: walletBusy,
1292
+ onClick: refreshWallet,
1293
+ title: walletBusy ? t("account.refreshing") : t("account.refresh"),
1294
+ "aria-label": walletBusy ? t("account.refreshing") : t("account.refresh"),
1295
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineRegular, { size: 13 })
1296
+ })]
1253
1297
  })]
1254
1298
  }),
1255
1299
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -1290,6 +1334,25 @@ window.__ModuleLoader__.load({
1290
1334
  })]
1291
1335
  }, `${voucher.groupId}:${voucher.group}`))
1292
1336
  })]
1337
+ }) : account !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1338
+ className: `${NearTokenSection_module_css_default.fact} ${NearTokenSection_module_css_default.voucherFact}`,
1339
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
1340
+ className: NearTokenSection_module_css_default.factLabel,
1341
+ children: t("account.vouchers")
1342
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dd", {
1343
+ className: NearTokenSection_module_css_default.voucherEmpty,
1344
+ children: [
1345
+ vouchersBefore,
1346
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
1347
+ className: NearTokenSection_module_css_default.invite,
1348
+ href: `${status.baseURL}/wallet`,
1349
+ target: "_blank",
1350
+ rel: "noreferrer",
1351
+ children: t("account.vouchersInvite")
1352
+ }),
1353
+ vouchersAfter
1354
+ ]
1355
+ })]
1293
1356
  }) : null
1294
1357
  ]
1295
1358
  }),
@@ -1999,6 +2062,10 @@ window.__ModuleLoader__.load({
1999
2062
  "account.balance": "剩余额度",
2000
2063
  "account.used": "已用额度",
2001
2064
  "account.vouchers": "代金券",
2065
+ "account.vouchersEmpty": "你还没有代金券,你可以通过{link}获得免费代金券",
2066
+ "account.vouchersInvite": "邀请计划",
2067
+ "account.refresh": "刷新余额",
2068
+ "account.refreshing": "正在刷新…",
2002
2069
  "account.token": "API 令牌",
2003
2070
  "account.signOut": "断开连接",
2004
2071
  "account.signingOut": "正在断开…",
@@ -2090,6 +2157,10 @@ window.__ModuleLoader__.load({
2090
2157
  "account.balance": "Balance",
2091
2158
  "account.used": "Used",
2092
2159
  "account.vouchers": "Vouchers",
2160
+ "account.vouchersEmpty": "You have no vouchers yet. Get free vouchers through the {link}.",
2161
+ "account.vouchersInvite": "referral program",
2162
+ "account.refresh": "Refresh balance",
2163
+ "account.refreshing": "Refreshing…",
2093
2164
  "account.token": "API token",
2094
2165
  "account.signOut": "Disconnect",
2095
2166
  "account.signingOut": "Disconnecting…",