@vibedev-si/dsh-vibedev 0.11.3 → 0.11.6

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.
@@ -1597,7 +1597,24 @@ window.__ModuleLoader__.load({
1597
1597
  voiceErrorCode: "错误码 {code}",
1598
1598
  voiceRejectSimilar: "这段样本和已有录音太像,请换一段干净、独特的人声。",
1599
1599
  voiceRejectNotClean: "这不是干净的人声:请换一段只有一个人声、不带伴奏和杂音的录音。",
1600
- voiceRejectOriginal: "原始原因:{reason}"
1600
+ voiceRejectOriginal: "原始原因:{reason}",
1601
+ voiceDropTitle: "点击或拖入音频文件",
1602
+ voiceFileAdvice: "建议 10–60 秒、只有一个人声的干净录音,不带伴奏和杂音。",
1603
+ voiceDropActive: "松开即可添加",
1604
+ voiceDropFormats: "mp3 · wav · m4a · aac · flac · ogg,6–60 秒,不超过 10 MB",
1605
+ voiceChangeFile: "重新选择",
1606
+ voiceMeasuring: "正在测量时长…",
1607
+ voicePickFile: "选择音频文件",
1608
+ voiceNameHint: "最多 {max} 个字,只用来在列表里区分音色。",
1609
+ voiceNeedFile: "请先选择一个音频文件",
1610
+ voiceNeedName: "请填写音色名称",
1611
+ voiceListCount: "共 {count} 个",
1612
+ voiceLoadFailed: "音色列表没有读到",
1613
+ voiceUnsupportedTitle: "暂未开放音色管理",
1614
+ voiceRetry: "重试",
1615
+ voiceWaitingGateway: "网关处理中,已等待 {seconds} 秒。较长的样本可能需要 1–3 分钟,请不要关闭页面。",
1616
+ voiceConfirming: "网关没有及时回复,音色可能已经创建,正在确认(已等待 {seconds} 秒)…",
1617
+ voiceUnconfirmed: "网关处理超时。可能已在网关侧创建,请稍后刷新列表确认;若列表没有,再重试。"
1601
1618
  };
1602
1619
  const voiceProfileEn = {
1603
1620
  centerVoiceProfiles: "My voices",
@@ -1663,7 +1680,24 @@ window.__ModuleLoader__.load({
1663
1680
  voiceErrorCode: "Error code {code}",
1664
1681
  voiceRejectSimilar: "This sample is too similar to an existing recording. Use a different clean, original vocal.",
1665
1682
  voiceRejectNotClean: "This is not a clean solo vocal. Use a recording of one voice without accompaniment or background noise.",
1666
- voiceRejectOriginal: "Original reason: {reason}"
1683
+ voiceRejectOriginal: "Original reason: {reason}",
1684
+ voiceDropTitle: "Click or drop an audio file here",
1685
+ voiceFileAdvice: "A clean recording of one voice, 10–60 s, without accompaniment or background noise, works best.",
1686
+ voiceDropActive: "Release to add it",
1687
+ voiceDropFormats: "mp3 · wav · m4a · aac · flac · ogg, 6–60 s, up to 10 MB",
1688
+ voiceChangeFile: "Choose another",
1689
+ voiceMeasuring: "Measuring length…",
1690
+ voicePickFile: "Choose an audio file",
1691
+ voiceNameHint: "Up to {max} characters, only to tell your voices apart.",
1692
+ voiceNeedFile: "Choose an audio file first",
1693
+ voiceNeedName: "Enter a name for the voice",
1694
+ voiceListCount: "{count} in total",
1695
+ voiceLoadFailed: "The voice list could not be read",
1696
+ voiceUnsupportedTitle: "Voice profiles are not available yet",
1697
+ voiceRetry: "Try again",
1698
+ voiceWaitingGateway: "The gateway is processing, {seconds} s so far. A longer sample can take 1–3 minutes; keep this page open.",
1699
+ voiceConfirming: "The gateway did not answer in time. The voice may already exist; checking ({seconds} s so far)…",
1700
+ voiceUnconfirmed: "The gateway timed out. The voice may have been created there: refresh the list in a little while to check, and try again only if it is not there."
1667
1701
  };
1668
1702
  //#endregion
1669
1703
  //#region src/client/AccountCenter/center-locales.ts
@@ -2963,22 +2997,39 @@ window.__ModuleLoader__.load({
2963
2997
  `;
2964
2998
  //#endregion
2965
2999
  //#region src/client/AccountCenter/voice-profile-styles.ts
2966
- /** 「我的音色」 styles, scoped under `.center-voices`; colors follow the DSH theme. */
3000
+ /**
3001
+ * 「我的音色」 styles, scoped under `.center-voices`. The page sits inside `.member-polish` (the 兑换 page's shell), so
3002
+ * it takes that shell's width, section padding and `--member-*` tokens (surface, inset, border, muted, accent) and its
3003
+ * dashed empty state (`.member-polish-empty`); every other color is a DSH theme token with the same fallbacks the
3004
+ * other account-center pages use, so light and dark themes both come from the host.
3005
+ */
2967
3006
  const VOICE_PROFILE_STYLES = `
2968
- .center-voices{display:grid;gap:20px}.center-voices .center-voices-intro{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
2969
- .center-voices-free{display:inline-flex;align-items:center;gap:6px;padding:2px 10px;border-radius:999px;font-size:11px;background:var(--dsw-alias-bg-layer-3,#f2f4f7);color:var(--dsw-alias-label-secondary)}
2970
- .center-voices-form{display:grid;gap:14px}.center-voices-file{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.center-voices-file input[type=file]{font:inherit;font-size:12px;max-width:100%}
2971
- .center-voices-facts{display:flex;gap:12px;flex-wrap:wrap;font-size:12px;color:var(--dsw-alias-label-secondary)}
2972
- .center-voices-steps{display:flex;gap:8px;flex-wrap:wrap;margin:0;padding:0;list-style:none;font-size:12px}.center-voices-steps li{display:flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;border:1px solid var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary)}
2973
- .center-voices-steps li[data-state=active]{color:var(--dsw-alias-label-primary);border-color:currentColor;font-weight:600}.center-voices-steps li[data-state=done]{color:var(--dsw-alias-state-success-primary,#16a34a)}
2974
- .center-voices-progress{height:4px;border-radius:2px;background:var(--dsw-alias-border-l2);overflow:hidden}.center-voices-progress>span{display:block;height:100%;width:40%;background:var(--dsw-alias-label-primary);animation:center-voices-bar 1.4s ease-in-out infinite}
2975
- @keyframes center-voices-bar{0%{transform:translateX(-100%)}100%{transform:translateX(250%)}}@media(prefers-reduced-motion:reduce){.center-voices-progress>span{animation:none;width:100%;opacity:.4}}
2976
- .center-voices-status{display:inline-flex;align-items:center;gap:6px;font-size:12px}.center-voices-status::before{content:"";width:7px;height:7px;border-radius:50%;background:currentColor}
2977
- .center-voices-status[data-status=ready]{color:var(--dsw-alias-state-success-primary,#16a34a)}.center-voices-status[data-status=failed]{color:var(--dsw-alias-state-error-primary,#dc2626)}.center-voices-status[data-status=processing]{color:var(--dsw-alias-state-warn-primary,#b77700)}
2978
- .center-voices-reason{display:block;margin-top:4px;font-size:11px;color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}
2979
- .center-voices-empty{display:grid;justify-items:center;gap:6px;padding:28px 12px;text-align:center}.center-voices-empty p{margin:0}
2980
- .center-voices-confirm{padding:14px;border:1px solid var(--dsw-alias-state-error-primary,#dc2626);border-radius:8px;background:var(--dsw-alias-bg-layer-3,#f7f8fa)}.center-voices-confirm h3{margin:0 0 8px;font-size:14px}.center-voices-confirm p{margin:0 0 10px}
2981
- .center-voices-notice{margin:0;font-size:12px}.center-voices-notice[data-tone=success]{color:var(--dsw-alias-state-success-primary,#16a34a)}
3007
+ .member-polish.center-voices{max-width:880px;--voice-success:var(--dsw-alias-state-success-primary,#15803d);--voice-danger:var(--dsw-alias-state-error-primary,#c0392b);--voice-warn:var(--dsw-alias-state-warn-primary,#b77700)}
3008
+ .center-voices-intro>p{display:flex;flex-wrap:wrap;align-items:center;gap:8px;font-size:12px}.center-voices-free{display:inline-flex;align-items:center;padding:2px 9px;border-radius:999px;font-size:11px;font-weight:500;color:var(--member-accent);background:color-mix(in srgb,var(--member-accent) 9%,transparent)}
3009
+ .center-voices-form{display:grid;gap:18px;max-width:560px;min-width:0}.center-voices-form .center-field{display:grid;gap:8px;min-width:0;flex:none}.center-voices-form .center-field>label{font-size:12px;font-weight:500;color:var(--dsw-alias-label-primary,#202124)}
3010
+ .center-voices-hint{display:block;margin:0;font-size:11px;line-height:1.6;color:var(--member-muted)}
3011
+ .center-voices-drop{display:grid;justify-items:center;gap:6px;width:100%;padding:26px 16px;border:1.5px dashed var(--member-border);border-radius:10px;background:var(--member-inset);color:inherit;font:inherit;text-align:center;cursor:pointer;transition:border-color .15s,background-color .15s}.center-voices-drop strong{font-size:13px;font-weight:600}.center-voices-drop .center-muted{font-size:11px}
3012
+ .center-voices-drop:hover:not(:disabled),.center-voices-drop[data-over]{border-color:var(--member-accent);background:color-mix(in srgb,var(--member-accent) 6%,var(--member-surface))}.center-voices-drop:disabled{cursor:not-allowed;opacity:.55}
3013
+ .center-voices-drop-icon,.center-voices-avatar{display:inline-flex;align-items:center;justify-content:center;flex:none;border-radius:10px;color:var(--member-accent);background:color-mix(in srgb,var(--member-accent) 9%,var(--member-surface))}.center-voices-drop-icon{width:40px;height:40px}.center-voices-avatar{width:36px;height:36px;border-radius:9px}.center-voices-avatar svg{width:18px;height:18px}
3014
+ .center-voices-file-chip{display:flex;align-items:center;gap:12px;min-width:0;padding:10px 10px 10px 12px;border:1px solid var(--member-border);border-radius:10px;background:var(--member-inset)}.center-voices-file-chip[data-over]{border-color:var(--member-accent)}.center-voices-file-chip>button{flex:none}
3015
+ .center-voices-row-main{display:grid;gap:3px;flex:1;min-width:0}.center-voices-row-main strong{font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.center-voices-row-meta{font-size:11px;color:var(--member-muted);font-variant-numeric:tabular-nums}
3016
+ .center-voices-submit{display:grid;justify-items:start;gap:6px}.center-voices-submit>button{min-height:38px;padding-inline:20px;font-weight:600}
3017
+ .center-voices-steps{display:flex;gap:8px;flex-wrap:wrap;margin:0;padding:0;list-style:none;font-size:11px}.center-voices-steps li{display:flex;align-items:center;gap:6px;padding:3px 10px;border-radius:999px;border:1px solid var(--member-border);color:var(--member-muted)}
3018
+ .center-voices-steps li[data-state=active]{color:var(--member-accent);border-color:var(--member-accent);font-weight:600}.center-voices-steps li[data-state=done]{color:var(--voice-success);border-color:color-mix(in srgb,var(--voice-success) 40%,transparent)}
3019
+ .center-voices-progress-box{display:grid;gap:8px}.center-voices-progress-box p{font-size:12px}.center-voices-progress{height:4px;border-radius:2px;background:var(--member-border);overflow:hidden}.center-voices-progress>span{display:block;height:100%;width:40%;background:var(--member-accent);animation:center-voices-bar 1.4s ease-in-out infinite}
3020
+ @keyframes center-voices-bar{0%{transform:translateX(-100%)}100%{transform:translateX(250%)}}@keyframes center-voices-spin{to{transform:rotate(360deg)}}@keyframes center-voices-pulse{50%{opacity:.45}}
3021
+ .center-voices-notice{margin:0;padding:10px 12px;border-radius:8px;font-size:12px;line-height:1.6}.center-voices-notice[data-tone=success]{color:var(--voice-success);background:color-mix(in srgb,var(--voice-success) 9%,transparent)}.center-voices-notice[data-tone=warn]{color:var(--voice-warn);background:color-mix(in srgb,var(--voice-warn) 10%,transparent)}.center-voices-notice[data-tone=danger]{color:var(--voice-danger);background:color-mix(in srgb,var(--voice-danger) 8%,transparent)}
3022
+ .center-voices-count{font-size:11px;color:var(--member-muted)}
3023
+ .center-voices-list{display:grid;margin:0;padding:0;list-style:none}.center-voices-row{display:flex;align-items:center;gap:12px;min-width:0;padding:12px 2px;border-bottom:1px solid var(--member-border)}.center-voices-row:last-child{border-bottom:0}.center-voices-row-title{display:flex;align-items:center;gap:8px;min-width:0}
3024
+ .center-voices-status{display:inline-flex;align-items:center;gap:5px;flex:none;padding:1px 8px;border-radius:999px;font-size:11px;font-weight:500;line-height:18px}
3025
+ .center-voices-status[data-status=ready]{color:var(--voice-success);background:color-mix(in srgb,var(--voice-success) 11%,transparent)}.center-voices-status[data-status=processing]{color:var(--member-accent);background:color-mix(in srgb,var(--member-accent) 11%,transparent)}.center-voices-status[data-status=failed]{color:var(--voice-danger);background:color-mix(in srgb,var(--voice-danger) 10%,transparent)}
3026
+ .center-voices-spinner{width:9px;height:9px;border:1.5px solid currentColor;border-right-color:transparent;border-radius:50%;animation:center-voices-spin .8s linear infinite}
3027
+ .center-voices-reason{font-size:11px;line-height:1.55;color:var(--voice-danger);overflow-wrap:anywhere}
3028
+ .center-voices .center-voices-delete{flex:none;color:var(--member-muted)}.center-voices-row:hover .center-voices-delete:not(:disabled),.center-voices .center-voices-delete:focus-visible{color:var(--voice-danger)}.center-voices .center-voices-delete:hover:not(:disabled){background:color-mix(in srgb,var(--voice-danger) 8%,transparent)}
3029
+ .member-polish-empty.center-voices-empty{width:100%;max-width:440px;margin:6px auto;padding:28px 20px}.center-voices-empty>strong{font-size:13px;font-weight:600}.center-voices-empty>span{color:var(--member-accent);opacity:1}.center-voices-empty[data-tone=warn]>span{color:var(--voice-warn)}.center-voices-empty>p{max-width:340px}
3030
+ .center-voices-skeleton{display:grid}.center-voices-skeleton-row{display:flex;align-items:center;gap:12px;padding:12px 2px;border-bottom:1px solid var(--member-border)}.center-voices-skeleton-row:last-of-type{border-bottom:0}.center-voices-skeleton-row>span{width:36px;height:36px;flex:none;border-radius:9px;background:var(--dsw-alias-bg-layer-3,#f2f4f7);animation:center-voices-pulse 1.4s ease-in-out infinite}.center-voices-skeleton-row>div{display:grid;gap:7px;flex:1}.center-voices-skeleton-row i{display:block;height:9px;border-radius:5px;background:var(--dsw-alias-bg-layer-3,#f2f4f7);animation:center-voices-pulse 1.4s ease-in-out infinite}.center-voices-skeleton-row i:first-child{width:38%}.center-voices-skeleton-row i:last-child{width:22%}
3031
+ .center-voices-confirm{display:grid;gap:8px;margin-bottom:12px;padding:14px;border:1px solid color-mix(in srgb,var(--voice-danger) 45%,transparent);border-radius:10px;background:color-mix(in srgb,var(--voice-danger) 5%,var(--member-surface))}.center-voices-confirm h3{margin:0;font-size:13px}.center-voices-confirm p{margin:0;font-size:12px}
3032
+ @container(max-width:560px){.center-voices-row{flex-wrap:wrap}.center-voices-row-main{flex-basis:calc(100% - 48px)}.center-voices .center-voices-delete{margin-left:48px;padding-inline:6px}.center-voices-drop{padding:20px 12px}.center-voices-submit>button{width:100%}.center-voices-submit{justify-items:stretch}}
2982
3033
  `;
2983
3034
  //#endregion
2984
3035
  //#region src/client/AccountCenter/shared.tsx
@@ -14101,7 +14152,8 @@ window.__ModuleLoader__.load({
14101
14152
  VOICE_TITLE_REQUIRED: "voiceErrTitle",
14102
14153
  VOICE_TITLE_INVALID: "voiceErrTitle",
14103
14154
  VOICE_TITLE_TOO_LONG: "voiceErrTitle",
14104
- ACCOUNT_CHANGED: "voiceErrAccountChanged"
14155
+ ACCOUNT_CHANGED: "voiceErrAccountChanged",
14156
+ VOICE_PROFILE_UNCONFIRMED: "voiceUnconfirmed"
14105
14157
  };
14106
14158
  /** Everything else, by the error category — the account center's own words (`centerError*`). */
14107
14159
  const CATEGORY_KEYS = {
@@ -14207,6 +14259,27 @@ window.__ModuleLoader__.load({
14207
14259
  5e3
14208
14260
  ][round] ?? 8e3;
14209
14261
  }
14262
+ /**
14263
+ * Which of the four steps (0 check, 1 upload and submit, 2 processing, 3 ready) a creation is at.
14264
+ * @param phase - the page's phase.
14265
+ * @param waitedSeconds - how long the creation has run.
14266
+ */
14267
+ function voiceStepOf(phase, waitedSeconds) {
14268
+ if (phase === "checking") return 0;
14269
+ if (phase === "uploading") return waitedSeconds >= 15 ? 2 : 1;
14270
+ if (phase === "confirming" || phase === "processing") return 2;
14271
+ return phase === "ready" ? 3 : -1;
14272
+ }
14273
+ /**
14274
+ * The voice a creation without an answer made: one listed now that was not listed before, under the same title first.
14275
+ * @param items - the list now.
14276
+ * @param before - the ids listed before the creation.
14277
+ * @param title - the title it was created under.
14278
+ */
14279
+ function findConfirmedVoice(items, before, title) {
14280
+ const fresh = items.filter((item) => !before.has(item.id));
14281
+ return fresh.find((item) => item.title === title) ?? fresh[0];
14282
+ }
14210
14283
  /** The signed-in user the page shows, from the account center's identity (`[origin, source, userId]`). */
14211
14284
  function expectedUserOf(identity) {
14212
14285
  try {
@@ -14317,13 +14390,8 @@ window.__ModuleLoader__.load({
14317
14390
  return profile.failureReason ?? t("voiceFailedUnknown");
14318
14391
  }
14319
14392
  /** The four steps of a creation and where it stands. */
14320
- function VoiceSteps({ phase, t }) {
14321
- const at = phase === "failed" || phase === "idle" ? -1 : [
14322
- "checking",
14323
- "uploading",
14324
- "processing",
14325
- "ready"
14326
- ].indexOf(phase);
14393
+ function VoiceSteps({ phase, waited = 0, t }) {
14394
+ const at = phase === "failed" || phase === "idle" ? -1 : voiceStepOf(phase, waited);
14327
14395
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
14328
14396
  className: "center-voices-steps",
14329
14397
  "aria-label": t("voiceNewTitle"),
@@ -14343,88 +14411,258 @@ window.__ModuleLoader__.load({
14343
14411
  }, label))
14344
14412
  });
14345
14413
  }
14346
- /** One row's status, with the failure reason under a failed one. */
14414
+ /** Line icons in the account center's style (1.5 stroke, currentColor). */
14415
+ const ICON = {
14416
+ width: 20,
14417
+ height: 20,
14418
+ viewBox: "0 0 24 24",
14419
+ fill: "none",
14420
+ stroke: "currentColor",
14421
+ strokeWidth: 1.5,
14422
+ strokeLinecap: "round",
14423
+ strokeLinejoin: "round",
14424
+ "aria-hidden": true
14425
+ };
14426
+ function MicIcon() {
14427
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
14428
+ ...ICON,
14429
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
14430
+ x: "9",
14431
+ y: "3",
14432
+ width: "6",
14433
+ height: "11",
14434
+ rx: "3"
14435
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21M8.5 21h7" })]
14436
+ });
14437
+ }
14438
+ function UploadIcon() {
14439
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
14440
+ ...ICON,
14441
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 16V4M7 9l5-5 5 5M4 16v2.5A1.5 1.5 0 0 0 5.5 20h13a1.5 1.5 0 0 0 1.5-1.5V16" })
14442
+ });
14443
+ }
14444
+ function WaveIcon() {
14445
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
14446
+ ...ICON,
14447
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4 10v4M8 7v10M12 4v16M16 8v8M20 11v2" })
14448
+ });
14449
+ }
14450
+ function AlertIcon() {
14451
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
14452
+ ...ICON,
14453
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 4 2.8 19.5h18.4L12 4ZM12 10v4.5M12 17.2v.3" })
14454
+ });
14455
+ }
14456
+ function RefreshIcon() {
14457
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
14458
+ width: "14",
14459
+ height: "14",
14460
+ viewBox: "0 0 20 20",
14461
+ fill: "none",
14462
+ stroke: "currentColor",
14463
+ strokeWidth: "1.5",
14464
+ "aria-hidden": "true",
14465
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M16 8a6 6 0 1 0-1 7M16 3v5h-5" })
14466
+ });
14467
+ }
14468
+ /** One row's status as a pill (ready green, creating blue with a spinner, failed red), with the failure reason under a failed one. */
14347
14469
  function VoiceStatus({ profile, t }) {
14348
14470
  const label = profile.status === "ready" ? "voiceStatusReady" : profile.status === "failed" ? "voiceStatusFailed" : "voiceStatusProcessing";
14349
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
14471
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
14350
14472
  className: "center-voices-status",
14351
14473
  "data-status": profile.status,
14352
- children: t(label)
14353
- }), profile.status === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
14354
- className: "center-voices-reason",
14355
- children: failureText(profile, t)
14356
- })] });
14474
+ children: [profile.status === "processing" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
14475
+ className: "center-voices-spinner",
14476
+ "aria-hidden": "true"
14477
+ }), t(label)]
14478
+ });
14357
14479
  }
14358
- /** The list: empty, or a table. */
14359
- function VoiceTable({ items, t, busy, onDelete }) {
14480
+ /** The list as rows: icon, name and status, 「时长 · 创建时间」, and delete on the right. */
14481
+ function VoiceTable({ items, t, busy, onDelete, onPick }) {
14360
14482
  if (items.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14361
- className: "center-voices-empty",
14483
+ className: "member-polish-empty center-voices-empty",
14362
14484
  "data-voice-empty": true,
14363
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("voiceEmpty") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14364
- className: "center-muted",
14365
- children: t("voiceEmptyHint")
14366
- })]
14485
+ children: [
14486
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MicIcon, {}) }),
14487
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t("voiceEmpty") }),
14488
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14489
+ className: "center-muted",
14490
+ children: t("voiceEmptyHint")
14491
+ }),
14492
+ onPick !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
14493
+ type: "button",
14494
+ variant: "primary",
14495
+ size: "sm",
14496
+ "data-voice-empty-pick": true,
14497
+ onClick: onPick,
14498
+ children: t("voicePickFile")
14499
+ })
14500
+ ]
14367
14501
  });
14368
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
14369
- className: "center-scroll",
14370
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
14371
- className: "center-table",
14372
- "data-voice-table": true,
14373
- children: [
14374
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("caption", {
14375
- className: "center-sr-only",
14376
- children: t("voiceList")
14377
- }),
14378
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
14379
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
14380
- scope: "col",
14381
- children: t("voiceColName")
14382
- }),
14383
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
14384
- scope: "col",
14385
- children: t("voiceColStatus")
14386
- }),
14387
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
14388
- scope: "col",
14389
- children: t("voiceColDuration")
14502
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
14503
+ className: "center-voices-list",
14504
+ "aria-label": t("voiceList"),
14505
+ "data-voice-table": true,
14506
+ children: items.map((profile) => {
14507
+ const facts = [profile.durationSeconds === void 0 ? void 0 : fill$1(t("voiceSeconds"), { seconds: seconds(profile.durationSeconds) }), profile.createdAt === void 0 ? void 0 : dateTime(profile.createdAt, t)].filter((item) => item !== void 0);
14508
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
14509
+ className: "center-voices-row",
14510
+ "data-voice-id": profile.id,
14511
+ "data-status": profile.status,
14512
+ children: [
14513
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
14514
+ className: "center-voices-avatar",
14515
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MicIcon, {})
14390
14516
  }),
14391
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
14392
- scope: "col",
14393
- children: t("voiceColCreated")
14517
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14518
+ className: "center-voices-row-main",
14519
+ children: [
14520
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14521
+ className: "center-voices-row-title",
14522
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: profile.title ?? t("voiceUntitled") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceStatus, {
14523
+ profile,
14524
+ t
14525
+ })]
14526
+ }),
14527
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
14528
+ className: "center-voices-row-meta",
14529
+ children: facts.length === 0 ? "—" : facts.join(" · ")
14530
+ }),
14531
+ profile.status === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
14532
+ className: "center-voices-reason",
14533
+ children: failureText(profile, t)
14534
+ })
14535
+ ]
14394
14536
  }),
14395
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
14396
- scope: "col",
14397
- children: t("voiceColActions")
14537
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
14538
+ type: "button",
14539
+ variant: "ghost",
14540
+ size: "sm",
14541
+ className: "center-voices-delete",
14542
+ disabled: busy,
14543
+ "data-voice-delete": profile.id,
14544
+ "aria-label": `${t("voiceDelete")} ${profile.title ?? t("voiceUntitled")}`,
14545
+ onClick: () => onDelete(profile),
14546
+ children: t("voiceDelete")
14398
14547
  })
14399
- ] }) }),
14400
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", { children: items.map((profile) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", {
14401
- "data-voice-id": profile.id,
14402
- children: [
14403
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
14404
- scope: "row",
14405
- children: profile.title ?? t("voiceUntitled")
14406
- }),
14407
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceStatus, {
14408
- profile,
14409
- t
14410
- }) }),
14411
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: profile.durationSeconds === void 0 ? "—" : fill$1(t("voiceSeconds"), { seconds: seconds(profile.durationSeconds) }) }),
14412
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: dateTime(profile.createdAt, t) }),
14413
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
14414
- type: "button",
14415
- variant: "ghost",
14416
- size: "sm",
14417
- disabled: busy,
14418
- "data-voice-delete": profile.id,
14419
- onClick: () => onDelete(profile),
14420
- children: t("voiceDelete")
14421
- }) })
14422
- ]
14423
- }, profile.id)) })
14424
- ]
14548
+ ]
14549
+ }, profile.id);
14425
14550
  })
14426
14551
  });
14427
14552
  }
14553
+ /** A loading, failed or unsupported list, as a placeholder of the list's own shape rather than one line of text. */
14554
+ function VoicePlaceholder({ kind, t, failure, onRetry }) {
14555
+ if (kind === "loading") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14556
+ className: "center-voices-skeleton",
14557
+ role: "status",
14558
+ "aria-label": t("voiceLoading"),
14559
+ "data-voice-loading": true,
14560
+ children: [[
14561
+ 0,
14562
+ 1,
14563
+ 2
14564
+ ].map((index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14565
+ className: "center-voices-skeleton-row",
14566
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("i", {})] })]
14567
+ }, index)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
14568
+ className: "center-sr-only",
14569
+ children: t("voiceLoading")
14570
+ })]
14571
+ });
14572
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14573
+ className: "member-polish-empty center-voices-empty",
14574
+ "data-tone": kind === "failed" ? "warn" : void 0,
14575
+ role: kind === "failed" ? "alert" : "status",
14576
+ "data-voice-placeholder": kind,
14577
+ children: [
14578
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: kind === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertIcon, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WaveIcon, {}) }),
14579
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t(kind === "failed" ? "voiceLoadFailed" : "voiceUnsupportedTitle") }),
14580
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14581
+ className: "center-muted",
14582
+ children: kind === "failed" && failure !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailureText, {
14583
+ failure,
14584
+ t
14585
+ }) : t("voiceUnsupported")
14586
+ }),
14587
+ kind === "failed" && onRetry !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
14588
+ type: "button",
14589
+ variant: "outline",
14590
+ size: "sm",
14591
+ onClick: onRetry,
14592
+ children: t("voiceRetry")
14593
+ })
14594
+ ]
14595
+ });
14596
+ }
14597
+ /** The recording picker: a dashed drop area until a file is chosen, then a pill with its name, length and size. */
14598
+ function VoiceDropzone({ file, fileSeconds, disabled, t, onPick, onChoose }) {
14599
+ const [over, setOver] = (0, react.useState)(false);
14600
+ const drop = {
14601
+ onDragOver: (event) => {
14602
+ if (disabled) return;
14603
+ event.preventDefault();
14604
+ setOver(true);
14605
+ },
14606
+ onDragLeave: () => setOver(false),
14607
+ onDrop: (event) => {
14608
+ event.preventDefault();
14609
+ setOver(false);
14610
+ if (!disabled) onChoose(event.dataTransfer.files[0]);
14611
+ }
14612
+ };
14613
+ if (file === void 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
14614
+ type: "button",
14615
+ className: "center-voices-drop",
14616
+ "data-over": over || void 0,
14617
+ disabled,
14618
+ onClick: onPick,
14619
+ "data-voice-drop": true,
14620
+ ...drop,
14621
+ children: [
14622
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
14623
+ className: "center-voices-drop-icon",
14624
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UploadIcon, {})
14625
+ }),
14626
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: t(over ? "voiceDropActive" : "voiceDropTitle") }),
14627
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
14628
+ className: "center-muted",
14629
+ children: t("voiceDropFormats")
14630
+ })
14631
+ ]
14632
+ });
14633
+ const facts = [typeof fileSeconds === "number" ? fill$1(t("voiceSeconds"), { seconds: seconds(fileSeconds) }) : fileSeconds === "measuring" ? t("voiceMeasuring") : void 0, megabytes(file.size)].filter((item) => item !== void 0);
14634
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14635
+ className: "center-voices-file-chip",
14636
+ "data-over": over || void 0,
14637
+ "data-voice-file": true,
14638
+ ...drop,
14639
+ children: [
14640
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
14641
+ className: "center-voices-avatar",
14642
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WaveIcon, {})
14643
+ }),
14644
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14645
+ className: "center-voices-row-main",
14646
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", {
14647
+ title: file.name,
14648
+ children: file.name
14649
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
14650
+ className: "center-voices-row-meta",
14651
+ children: facts.join(" · ")
14652
+ })]
14653
+ }),
14654
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
14655
+ type: "button",
14656
+ variant: "ghost",
14657
+ size: "sm",
14658
+ disabled,
14659
+ onClick: onPick,
14660
+ "data-voice-repick": true,
14661
+ children: t("voiceChangeFile")
14662
+ })
14663
+ ]
14664
+ });
14665
+ }
14428
14666
  /** The confirmation in front of a deletion. */
14429
14667
  function VoiceDeleteConfirm({ profile, t, busy, onConfirm, onCancel }) {
14430
14668
  const titleId = (0, react.useId)();
@@ -14479,6 +14717,8 @@ window.__ModuleLoader__.load({
14479
14717
  const [createFailure, setCreateFailure] = (0, react.useState)();
14480
14718
  const [created, setCreated] = (0, react.useState)();
14481
14719
  const [startedAt, setStartedAt] = (0, react.useState)(0);
14720
+ /** The ids listed before the last creation, to recognise the new one when the creation ended without an answer. */
14721
+ const [beforeIds, setBeforeIds] = (0, react.useState)(() => /* @__PURE__ */ new Set());
14482
14722
  const [now, setNow] = (0, react.useState)(() => Date.now());
14483
14723
  const [formKey, setFormKey] = (0, react.useState)(0);
14484
14724
  const [confirming, setConfirming] = (0, react.useState)();
@@ -14511,7 +14751,7 @@ window.__ModuleLoader__.load({
14511
14751
  reload,
14512
14752
  reportActivity
14513
14753
  ]);
14514
- const processing = items?.some((item) => item.status === "processing") === true || phase === "processing";
14754
+ const processing = items?.some((item) => item.status === "processing") === true || phase === "processing" || phase === "confirming";
14515
14755
  (0, react.useEffect)(() => {
14516
14756
  if (!processing) {
14517
14757
  poll.current = {
@@ -14534,10 +14774,23 @@ window.__ModuleLoader__.load({
14534
14774
  return () => clearTimeout(timer);
14535
14775
  }, [processing, items]);
14536
14776
  (0, react.useEffect)(() => {
14537
- if (phase !== "processing") return;
14777
+ if (phase !== "processing" && phase !== "uploading" && phase !== "confirming") return;
14538
14778
  const timer = setInterval(() => setNow(Date.now()), 1e3);
14539
14779
  return () => clearInterval(timer);
14540
14780
  }, [phase]);
14781
+ (0, react.useEffect)(() => {
14782
+ if (phase !== "confirming") return;
14783
+ const found = findConfirmedVoice(items ?? [], beforeIds, title.trim());
14784
+ if (found === void 0) return;
14785
+ setCreated(found);
14786
+ setCreateFailure(void 0);
14787
+ setPhase(found.status === "ready" ? "ready" : found.status === "failed" ? "failed" : "processing");
14788
+ }, [
14789
+ items,
14790
+ phase,
14791
+ beforeIds,
14792
+ title
14793
+ ]);
14541
14794
  (0, react.useEffect)(() => {
14542
14795
  if (created === void 0 || phase !== "processing") return;
14543
14796
  const found = items?.find((item) => item.id === created.id);
@@ -14550,8 +14803,17 @@ window.__ModuleLoader__.load({
14550
14803
  phase
14551
14804
  ]);
14552
14805
  const busy = phase === "checking" || phase === "uploading";
14553
- const chooseFile = (event) => {
14554
- const chosen = event.target.files?.[0];
14806
+ /** Still confirming a creation without an answer (until the list reads stop, when retrying is offered). */
14807
+ const confirmingNow = phase === "confirming" && !pollStopped;
14808
+ const fileInput = (0, react.useRef)(null);
14809
+ /** Open the system picker (the drop area, 重新选择 and the empty list's button all lead here). */
14810
+ const pickFile = () => {
14811
+ fileInput.current?.focus();
14812
+ fileInput.current?.click();
14813
+ };
14814
+ const chooseFile = (chosen) => {
14815
+ if (chosen === void 0) return;
14816
+ if (fileInput.current !== null) fileInput.current.value = "";
14555
14817
  setFile(chosen);
14556
14818
  setFileFailure(void 0);
14557
14819
  setFileSeconds(void 0);
@@ -14575,7 +14837,7 @@ window.__ModuleLoader__.load({
14575
14837
  };
14576
14838
  const submit = async (event) => {
14577
14839
  event.preventDefault();
14578
- if (busy || phase === "processing" || file === void 0) return;
14840
+ if (busy || confirmingNow || phase === "processing" || file === void 0) return;
14579
14841
  setCreateFailure(void 0);
14580
14842
  setCreated(void 0);
14581
14843
  setPhase("checking");
@@ -14590,6 +14852,9 @@ window.__ModuleLoader__.load({
14590
14852
  setPhase("idle");
14591
14853
  return;
14592
14854
  }
14855
+ setBeforeIds(new Set((items ?? []).map((item) => item.id)));
14856
+ setStartedAt(Date.now());
14857
+ setNow(Date.now());
14593
14858
  setPhase("uploading");
14594
14859
  let data;
14595
14860
  try {
@@ -14606,7 +14871,15 @@ window.__ModuleLoader__.load({
14606
14871
  });
14607
14872
  if (!result.ok) {
14608
14873
  setCreateFailure(result.failure);
14609
- setPhase("failed");
14874
+ if (result.failure.code === "VOICE_PROFILE_UNCONFIRMED" || result.failure.code === "GATEWAY_TIMEOUT") {
14875
+ setPollStopped(false);
14876
+ poll.current = {
14877
+ round: 0,
14878
+ since: 0
14879
+ };
14880
+ setPhase("confirming");
14881
+ setReload((value) => value + 1);
14882
+ } else setPhase("failed");
14610
14883
  return;
14611
14884
  }
14612
14885
  const profile = result.value;
@@ -14614,11 +14887,7 @@ window.__ModuleLoader__.load({
14614
14887
  setItems((current) => [profile, ...(current ?? []).filter((item) => item.id !== profile.id)]);
14615
14888
  if (profile.status === "ready") setPhase("ready");
14616
14889
  else if (profile.status === "failed") setPhase("failed");
14617
- else {
14618
- setStartedAt(Date.now());
14619
- setNow(Date.now());
14620
- setPhase("processing");
14621
- }
14890
+ else setPhase("processing");
14622
14891
  };
14623
14892
  const another = () => {
14624
14893
  setFile(void 0);
@@ -14648,39 +14917,50 @@ window.__ModuleLoader__.load({
14648
14917
  };
14649
14918
  const waited = Math.max(0, Math.round((now - startedAt) / 1e3));
14650
14919
  const short = typeof fileSeconds === "number" && fileSeconds >= VOICE_LIMITS.minSeconds && fileSeconds < VOICE_LIMITS.recommendedMinSeconds;
14920
+ const locked = busy || confirmingNow || phase === "processing";
14921
+ /** Why 创建音色 cannot be pressed yet, shown under it (and as its tooltip). */
14922
+ const blockedReason = locked ? void 0 : file === void 0 ? t("voiceNeedFile") : title.trim() === "" ? t("voiceNeedName") : void 0;
14923
+ const refreshList = () => {
14924
+ setDeleted(false);
14925
+ setReload((value) => value + 1);
14926
+ };
14927
+ const refreshButton = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
14928
+ type: "button",
14929
+ variant: "outline",
14930
+ size: "sm",
14931
+ disabled: listState === "loading" && items === void 0,
14932
+ onClick: refreshList,
14933
+ "data-voice-refresh": true,
14934
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RefreshIcon, {}),
14935
+ children: t("voiceRefresh")
14936
+ });
14651
14937
  if (listState === "unsupported") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
14652
- className: "center-voices",
14938
+ className: "member-polish center-voices",
14939
+ "data-voice-page": true,
14653
14940
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
14654
- className: "center-section center-empty-state",
14655
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14656
- className: "center-muted",
14657
- role: "status",
14658
- children: t("voiceUnsupported")
14941
+ className: "center-section",
14942
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoicePlaceholder, {
14943
+ kind: "unsupported",
14944
+ t
14659
14945
  })
14660
14946
  })
14661
14947
  });
14662
14948
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14663
- className: "center-voices",
14949
+ className: "member-polish center-voices",
14664
14950
  "data-voice-page": true,
14665
14951
  children: [
14666
14952
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14667
- className: "center-voices-intro",
14668
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
14669
- className: "center-voices-free",
14670
- children: t("voiceFree")
14671
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
14672
- type: "button",
14673
- variant: "outline",
14674
- size: "sm",
14675
- disabled: listState === "loading" && items === void 0,
14676
- onClick: () => {
14677
- setDeleted(false);
14678
- setReload((value) => value + 1);
14679
- },
14680
- children: t("voiceRefresh")
14681
- })]
14953
+ className: "member-polish-intro center-voices-intro",
14954
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
14955
+ className: "center-muted",
14956
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
14957
+ className: "center-voices-free",
14958
+ children: t("voiceFree")
14959
+ }), t("voiceKeepNote")]
14960
+ }), refreshButton]
14682
14961
  }),
14683
14962
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Section, {
14963
+ className: "center-voices-card",
14684
14964
  title: t("voiceNewTitle"),
14685
14965
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
14686
14966
  className: "center-voices-form",
@@ -14691,40 +14971,44 @@ window.__ModuleLoader__.load({
14691
14971
  children: [
14692
14972
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14693
14973
  className: "center-field",
14694
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
14695
- htmlFor: fileId,
14696
- children: t("voiceFile")
14697
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
14698
- className: "center-voices-file",
14699
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
14974
+ children: [
14975
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
14976
+ htmlFor: fileId,
14977
+ children: t("voiceFile")
14978
+ }),
14979
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
14980
+ ref: fileInput,
14700
14981
  id: fileId,
14982
+ className: "center-sr-only",
14701
14983
  type: "file",
14702
14984
  accept: VOICE_ACCEPT,
14703
14985
  "aria-label": t("voiceChooseFile"),
14704
- disabled: busy || phase === "processing",
14705
- onChange: chooseFile
14986
+ disabled: locked,
14987
+ tabIndex: -1,
14988
+ onChange: (event) => chooseFile(event.target.files?.[0])
14989
+ }),
14990
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceDropzone, {
14991
+ ...file === void 0 ? {} : { file },
14992
+ ...fileSeconds === void 0 ? {} : { fileSeconds },
14993
+ disabled: locked,
14994
+ t,
14995
+ onPick: pickFile,
14996
+ onChoose: chooseFile
14997
+ }),
14998
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
14999
+ className: "center-voices-hint",
15000
+ title: t("voiceFileHint"),
15001
+ children: t("voiceFileAdvice")
14706
15002
  })
14707
- })]
14708
- }),
14709
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14710
- className: "center-muted",
14711
- children: t("voiceFileHint")
14712
- }),
14713
- file !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14714
- className: "center-voices-facts",
14715
- "data-voice-file": true,
14716
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: fill$1(t("voiceFileChosen"), {
14717
- name: file.name,
14718
- size: megabytes(file.size)
14719
- }) }), typeof fileSeconds === "number" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: fill$1(t("voiceFileSeconds"), { seconds: seconds(fileSeconds) }) })]
15003
+ ]
14720
15004
  }),
14721
15005
  fileSeconds === "unknown" && fileFailure === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14722
- className: "center-muted",
15006
+ className: "center-voices-hint",
14723
15007
  role: "status",
14724
15008
  children: t("voiceFileSecondsUnknown")
14725
15009
  }),
14726
15010
  short && fileFailure === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14727
- className: "center-muted",
15011
+ className: "center-voices-hint",
14728
15012
  children: t("voiceFileShortHint")
14729
15013
  }),
14730
15014
  fileFailure !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
@@ -14738,21 +15022,28 @@ window.__ModuleLoader__.load({
14738
15022
  }),
14739
15023
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
14740
15024
  className: "center-field",
14741
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
14742
- htmlFor: titleId,
14743
- children: t("voiceName")
14744
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
14745
- id: titleId,
14746
- value: title,
14747
- maxLength: VOICE_LIMITS.titleMax,
14748
- placeholder: t("voiceNamePlaceholder"),
14749
- disabled: busy || phase === "processing",
14750
- "aria-invalid": titleInvalid,
14751
- onChange: (event) => {
14752
- setTitle(event.target.value);
14753
- setTitleInvalid(false);
14754
- }
14755
- })]
15025
+ children: [
15026
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
15027
+ htmlFor: titleId,
15028
+ children: t("voiceName")
15029
+ }),
15030
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Input, {
15031
+ id: titleId,
15032
+ value: title,
15033
+ maxLength: VOICE_LIMITS.titleMax,
15034
+ placeholder: t("voiceNamePlaceholder"),
15035
+ disabled: locked,
15036
+ "aria-invalid": titleInvalid,
15037
+ onChange: (event) => {
15038
+ setTitle(event.target.value);
15039
+ setTitleInvalid(false);
15040
+ }
15041
+ }),
15042
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
15043
+ className: "center-voices-hint",
15044
+ children: fill$1(t("voiceNameHint"), { max: VOICE_LIMITS.titleMax })
15045
+ })
15046
+ ]
14756
15047
  }),
14757
15048
  titleInvalid && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14758
15049
  className: "center-warning",
@@ -14761,9 +15052,11 @@ window.__ModuleLoader__.load({
14761
15052
  }),
14762
15053
  phase !== "idle" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceSteps, {
14763
15054
  phase,
15055
+ waited,
14764
15056
  t
14765
15057
  }),
14766
- (busy || phase === "processing") && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
15058
+ (busy || confirmingNow || phase === "processing") && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
15059
+ className: "center-voices-progress-box",
14767
15060
  role: "status",
14768
15061
  "aria-live": "polite",
14769
15062
  "data-voice-progress": true,
@@ -14773,9 +15066,16 @@ window.__ModuleLoader__.load({
14773
15066
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {})
14774
15067
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14775
15068
  className: "center-muted",
14776
- children: phase === "checking" ? t("voiceChecking") : phase === "uploading" ? t("voiceUploading") : fill$1(t(pollStopped ? "voiceProcessingSlow" : "voiceProcessing"), { seconds: waited })
15069
+ children: phase === "checking" ? t("voiceChecking") : phase === "uploading" ? voiceStepOf("uploading", waited) >= 2 ? fill$1(t("voiceWaitingGateway"), { seconds: waited }) : t("voiceUploading") : phase === "confirming" ? fill$1(t("voiceConfirming"), { seconds: waited }) : fill$1(t(pollStopped ? "voiceProcessingSlow" : "voiceProcessing"), { seconds: waited })
14777
15070
  })]
14778
15071
  }),
15072
+ phase === "confirming" && pollStopped && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
15073
+ className: "center-voices-notice",
15074
+ "data-tone": "warn",
15075
+ role: "status",
15076
+ "data-voice-unconfirmed": true,
15077
+ children: t("voiceUnconfirmed")
15078
+ }),
14779
15079
  phase === "ready" && created !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14780
15080
  className: "center-voices-notice",
14781
15081
  "data-tone": "success",
@@ -14783,7 +15083,8 @@ window.__ModuleLoader__.load({
14783
15083
  children: fill$1(t("voiceReadyNotice"), { title: created.title ?? title })
14784
15084
  }),
14785
15085
  phase === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14786
- className: "center-warning",
15086
+ className: "center-voices-notice",
15087
+ "data-tone": "danger",
14787
15088
  role: "alert",
14788
15089
  "data-voice-create-error": true,
14789
15090
  children: createFailure !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailureText, {
@@ -14791,9 +15092,9 @@ window.__ModuleLoader__.load({
14791
15092
  t
14792
15093
  }) : fill$1(t("voiceFailedNotice"), { reason: created === void 0 ? t("voiceFailedUnknown") : failureText(created, t) })
14793
15094
  }),
14794
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
14795
- className: "center-actions",
14796
- children: phase === "ready" || phase === "failed" && createFailure === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
15095
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
15096
+ className: "center-voices-submit",
15097
+ children: [phase === "ready" || phase === "failed" && createFailure === void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
14797
15098
  type: "button",
14798
15099
  variant: "outline",
14799
15100
  onClick: another,
@@ -14802,19 +15103,25 @@ window.__ModuleLoader__.load({
14802
15103
  type: "submit",
14803
15104
  variant: "primary",
14804
15105
  "data-voice-create": true,
14805
- disabled: busy || phase === "processing" || file === void 0 || fileFailure !== void 0 || fileSeconds === "measuring" || title.trim() === "",
15106
+ title: blockedReason,
15107
+ disabled: locked || file === void 0 || fileFailure !== void 0 || fileSeconds === "measuring" || title.trim() === "",
14806
15108
  children: t("voiceCreate")
14807
- })
14808
- }),
14809
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14810
- className: "center-muted",
14811
- children: t("voiceKeepNote")
15109
+ }), blockedReason !== void 0 && phase !== "ready" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
15110
+ className: "center-voices-hint",
15111
+ "data-voice-blocked": true,
15112
+ children: blockedReason
15113
+ })]
14812
15114
  })
14813
15115
  ]
14814
15116
  }, formKey)
14815
15117
  }),
14816
15118
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
15119
+ className: "center-voices-card",
14817
15120
  title: t("voiceList"),
15121
+ action: items !== void 0 && items.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
15122
+ className: "center-voices-count",
15123
+ children: fill$1(t("voiceListCount"), { count: items.length })
15124
+ }) : void 0,
14818
15125
  children: [
14819
15126
  deleted && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14820
15127
  className: "center-voices-notice",
@@ -14842,31 +15149,36 @@ window.__ModuleLoader__.load({
14842
15149
  t
14843
15150
  })
14844
15151
  }),
14845
- listState === "failed" && listFailure !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
15152
+ listState === "failed" && listFailure !== void 0 && items !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
14846
15153
  className: "center-warning",
14847
15154
  role: "alert",
14848
15155
  "data-voice-list-error": true,
14849
15156
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailureText, {
14850
15157
  failure: listFailure,
14851
15158
  t
14852
- }), items !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
15159
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
14853
15160
  className: "center-muted",
14854
15161
  children: [" · ", t("centerStale")]
14855
- }) : null]
15162
+ })]
14856
15163
  }),
14857
- items === void 0 ? listState === "loading" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
14858
- className: "center-muted",
14859
- role: "status",
14860
- children: t("voiceLoading")
14861
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceTable, {
15164
+ items !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceTable, {
14862
15165
  items,
14863
15166
  t,
14864
15167
  busy: deleting,
15168
+ onPick: pickFile,
14865
15169
  onDelete: (profile) => {
14866
15170
  setDeleted(false);
14867
15171
  setDeleteFailure(void 0);
14868
15172
  setConfirming(profile);
14869
15173
  }
15174
+ }) : listState === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoicePlaceholder, {
15175
+ kind: "failed",
15176
+ t,
15177
+ ...listFailure === void 0 ? {} : { failure: listFailure },
15178
+ onRetry: refreshList
15179
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoicePlaceholder, {
15180
+ kind: "loading",
15181
+ t
14870
15182
  })
14871
15183
  ]
14872
15184
  })