@vibedev-si/dsh-vibedev 0.11.2 → 0.11.3
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 +38 -1
- package/THIRD-PARTY-NOTICES.txt +1 -1
- package/client/client.account-center.js +1029 -9
- package/client/client.js +141 -2
- package/lib/account/center-contract.d.ts +2 -0
- package/lib/account/voice-profile-routes.d.ts +33 -0
- package/lib/audio/request.d.ts +53 -3
- package/lib/audio/voice-profiles.d.ts +184 -0
- package/lib/contracts.d.ts +2 -2
- package/lib/gateway/catalog.d.ts +5 -0
- package/lib/gateway/paid-path.d.ts +11 -0
- package/lib/index.js +1271 -237
- package/lib/tools/voice-profiles.d.ts +30 -0
- package/package.json +1 -1
|
@@ -1531,6 +1531,141 @@ window.__ModuleLoader__.load({
|
|
|
1531
1531
|
msgUnreadCount: "{count} unread notifications"
|
|
1532
1532
|
};
|
|
1533
1533
|
//#endregion
|
|
1534
|
+
//#region src/client/AccountCenter/voice-profile-locales.ts
|
|
1535
|
+
/** The 「我的音色」 page's words (voice profiles for Suno voice covers). Every key has both languages. */
|
|
1536
|
+
const voiceProfileZh = {
|
|
1537
|
+
centerVoiceProfiles: "我的音色",
|
|
1538
|
+
centerVoiceProfilesIntro: "用你自己的人声创建音色,用于 Suno 音色翻唱。创建音色免费,不会生成歌曲。",
|
|
1539
|
+
voiceNewTitle: "新建音色",
|
|
1540
|
+
voiceFile: "人声音频",
|
|
1541
|
+
voiceChooseFile: "选择音频文件",
|
|
1542
|
+
voiceFileHint: "6–60 秒(建议 10–60 秒)、不超过 10 MB,支持 mp3、wav、m4a、aac、flac、ogg;尽量是干净的人声,不带伴奏。",
|
|
1543
|
+
voiceName: "音色名称",
|
|
1544
|
+
voiceNamePlaceholder: "例如:我的主唱音色",
|
|
1545
|
+
voiceCreate: "创建音色",
|
|
1546
|
+
voiceCreateAnother: "再建一个",
|
|
1547
|
+
voiceFileChosen: "{name} · {size}",
|
|
1548
|
+
voiceFileSeconds: "时长 {seconds} 秒",
|
|
1549
|
+
voiceFileSecondsUnknown: "浏览器量不到这段音频的时长,上传后由服务端测量;量不到会提示你换成标准 WAV 或 MP3。",
|
|
1550
|
+
voiceFileShortHint: "不到 10 秒也能创建,但音色还原度通常更好的是 10–60 秒。",
|
|
1551
|
+
voiceStepCheck: "本地检查",
|
|
1552
|
+
voiceStepUpload: "上传并提交",
|
|
1553
|
+
voiceStepProcess: "网关处理中",
|
|
1554
|
+
voiceStepReady: "可以使用",
|
|
1555
|
+
voiceChecking: "正在检查音频格式、大小和时长…",
|
|
1556
|
+
voiceUploading: "正在上传音频并提交,请不要关闭页面…",
|
|
1557
|
+
voiceProcessing: "音色正在创建,已等待 {seconds} 秒。通常需要几十秒,完成后会自动更新。",
|
|
1558
|
+
voiceProcessingSlow: "还在处理中(已等待 {seconds} 秒)。可以先离开,稍后回来刷新查看。",
|
|
1559
|
+
voiceReadyNotice: "音色「{title}」已可用,可在音乐生成里作为音色翻唱使用。",
|
|
1560
|
+
voiceFailedNotice: "音色创建失败:{reason}",
|
|
1561
|
+
voiceFailedUnknown: "网关没有给出原因",
|
|
1562
|
+
voiceList: "我的音色列表",
|
|
1563
|
+
voiceColName: "名称",
|
|
1564
|
+
voiceColStatus: "状态",
|
|
1565
|
+
voiceColDuration: "时长",
|
|
1566
|
+
voiceColCreated: "创建时间",
|
|
1567
|
+
voiceColActions: "操作",
|
|
1568
|
+
voiceStatusProcessing: "创建中",
|
|
1569
|
+
voiceStatusReady: "可用",
|
|
1570
|
+
voiceStatusFailed: "失败",
|
|
1571
|
+
voiceUntitled: "未命名音色",
|
|
1572
|
+
voiceSeconds: "{seconds} 秒",
|
|
1573
|
+
voiceEmpty: "还没有音色",
|
|
1574
|
+
voiceEmptyHint: "上传一段 10–60 秒的干净人声,就能创建你的第一个音色。",
|
|
1575
|
+
voiceLoading: "正在读取音色…",
|
|
1576
|
+
voiceUnsupported: "当前网关尚未开放音色管理。",
|
|
1577
|
+
voiceRefresh: "刷新",
|
|
1578
|
+
voiceDelete: "删除",
|
|
1579
|
+
voiceDeleteTitle: "删除音色「{title}」?",
|
|
1580
|
+
voiceDeleteBody: "删除后该音色将永久关闭、不可恢复,不能再用于新的音色翻唱;已生成的歌曲不受影响。",
|
|
1581
|
+
voiceDeleteConfirm: "永久删除",
|
|
1582
|
+
voiceDeleteCancel: "取消",
|
|
1583
|
+
voiceDeleting: "正在删除…",
|
|
1584
|
+
voiceDeleted: "音色已删除。",
|
|
1585
|
+
voiceFree: "创建音色免费",
|
|
1586
|
+
voiceKeepNote: "音色由网关保存,不保证永久保留;请保留好你的原始录音。",
|
|
1587
|
+
voiceErrFormat: "文件格式不支持:请选择 mp3、wav、m4a、aac、flac 或 ogg 音频。",
|
|
1588
|
+
voiceErrEmpty: "这个文件是空的。",
|
|
1589
|
+
voiceErrTooLarge: "文件超过 10 MB,请压缩或剪短后再试。",
|
|
1590
|
+
voiceErrTooShort: "音频太短:至少需要 6 秒(建议 10–60 秒)。",
|
|
1591
|
+
voiceErrTooLong: "音频太长:最多 60 秒,请剪到 10–60 秒的干净人声。",
|
|
1592
|
+
voiceErrDurationUnknown: "量不到这段音频的时长,请导出为标准 WAV 或 MP3 后重试。",
|
|
1593
|
+
voiceErrUpload: "音频上传失败,音色没有创建,请稍后重试。",
|
|
1594
|
+
voiceErrTitle: "请填写 1–80 个字的音色名称。",
|
|
1595
|
+
voiceErrRead: "读取本地文件失败,请重新选择。",
|
|
1596
|
+
voiceErrAccountChanged: "账号已切换,请刷新页面后再操作。",
|
|
1597
|
+
voiceErrorCode: "错误码 {code}",
|
|
1598
|
+
voiceRejectSimilar: "这段样本和已有录音太像,请换一段干净、独特的人声。",
|
|
1599
|
+
voiceRejectNotClean: "这不是干净的人声:请换一段只有一个人声、不带伴奏和杂音的录音。",
|
|
1600
|
+
voiceRejectOriginal: "原始原因:{reason}"
|
|
1601
|
+
};
|
|
1602
|
+
const voiceProfileEn = {
|
|
1603
|
+
centerVoiceProfiles: "My voices",
|
|
1604
|
+
centerVoiceProfilesIntro: "Create voice profiles from your own singing voice for Suno voice covers. Creating one is free and makes no song.",
|
|
1605
|
+
voiceNewTitle: "New voice",
|
|
1606
|
+
voiceFile: "Vocal recording",
|
|
1607
|
+
voiceChooseFile: "Choose an audio file",
|
|
1608
|
+
voiceFileHint: "6–60 seconds (10–60 s recommended), up to 10 MB, mp3, wav, m4a, aac, flac or ogg; clean solo vocals without accompaniment work best.",
|
|
1609
|
+
voiceName: "Voice name",
|
|
1610
|
+
voiceNamePlaceholder: "For example: My lead vocal",
|
|
1611
|
+
voiceCreate: "Create voice",
|
|
1612
|
+
voiceCreateAnother: "Create another",
|
|
1613
|
+
voiceFileChosen: "{name} · {size}",
|
|
1614
|
+
voiceFileSeconds: "{seconds} seconds long",
|
|
1615
|
+
voiceFileSecondsUnknown: "The browser could not measure this recording; it will be measured after the upload, and you will be told if it cannot be.",
|
|
1616
|
+
voiceFileShortHint: "Under 10 seconds works, but 10–60 seconds usually captures the voice better.",
|
|
1617
|
+
voiceStepCheck: "Check",
|
|
1618
|
+
voiceStepUpload: "Upload and submit",
|
|
1619
|
+
voiceStepProcess: "Processing",
|
|
1620
|
+
voiceStepReady: "Ready",
|
|
1621
|
+
voiceChecking: "Checking the format, size and length…",
|
|
1622
|
+
voiceUploading: "Uploading and submitting. Keep this page open…",
|
|
1623
|
+
voiceProcessing: "Creating the voice, {seconds} s so far. This usually takes under a minute and updates on its own.",
|
|
1624
|
+
voiceProcessingSlow: "Still processing ({seconds} s so far). You can leave and refresh later.",
|
|
1625
|
+
voiceReadyNotice: "The voice “{title}” is ready for voice covers in music generation.",
|
|
1626
|
+
voiceFailedNotice: "The voice could not be created: {reason}",
|
|
1627
|
+
voiceFailedUnknown: "the gateway gave no reason",
|
|
1628
|
+
voiceList: "My voices",
|
|
1629
|
+
voiceColName: "Name",
|
|
1630
|
+
voiceColStatus: "Status",
|
|
1631
|
+
voiceColDuration: "Length",
|
|
1632
|
+
voiceColCreated: "Created",
|
|
1633
|
+
voiceColActions: "Actions",
|
|
1634
|
+
voiceStatusProcessing: "Creating",
|
|
1635
|
+
voiceStatusReady: "Ready",
|
|
1636
|
+
voiceStatusFailed: "Failed",
|
|
1637
|
+
voiceUntitled: "Untitled voice",
|
|
1638
|
+
voiceSeconds: "{seconds} s",
|
|
1639
|
+
voiceEmpty: "No voices yet",
|
|
1640
|
+
voiceEmptyHint: "Upload 10–60 seconds of clean vocals to create your first voice.",
|
|
1641
|
+
voiceLoading: "Reading voices…",
|
|
1642
|
+
voiceUnsupported: "This gateway does not offer voice profiles yet.",
|
|
1643
|
+
voiceRefresh: "Refresh",
|
|
1644
|
+
voiceDelete: "Delete",
|
|
1645
|
+
voiceDeleteTitle: "Delete the voice “{title}”?",
|
|
1646
|
+
voiceDeleteBody: "The voice will be closed for good and cannot be restored or used for new voice covers. Songs already made with it are not affected.",
|
|
1647
|
+
voiceDeleteConfirm: "Delete permanently",
|
|
1648
|
+
voiceDeleteCancel: "Cancel",
|
|
1649
|
+
voiceDeleting: "Deleting…",
|
|
1650
|
+
voiceDeleted: "The voice was deleted.",
|
|
1651
|
+
voiceFree: "Creating a voice is free",
|
|
1652
|
+
voiceKeepNote: "Voices are kept by the gateway and are not guaranteed forever; keep your original recording.",
|
|
1653
|
+
voiceErrFormat: "Unsupported file: choose an mp3, wav, m4a, aac, flac or ogg recording.",
|
|
1654
|
+
voiceErrEmpty: "This file is empty.",
|
|
1655
|
+
voiceErrTooLarge: "The file is over 10 MB. Compress or shorten it and try again.",
|
|
1656
|
+
voiceErrTooShort: "Too short: at least 6 seconds are needed (10–60 s recommended).",
|
|
1657
|
+
voiceErrTooLong: "Too long: at most 60 seconds. Trim it to 10–60 s of clean vocals.",
|
|
1658
|
+
voiceErrDurationUnknown: "The length of this recording could not be measured. Export it as a standard WAV or MP3 and try again.",
|
|
1659
|
+
voiceErrUpload: "The upload failed and no voice was created. Try again later.",
|
|
1660
|
+
voiceErrTitle: "Enter a voice name of 1–80 characters.",
|
|
1661
|
+
voiceErrRead: "The file could not be read. Choose it again.",
|
|
1662
|
+
voiceErrAccountChanged: "The account changed. Refresh the page and try again.",
|
|
1663
|
+
voiceErrorCode: "Error code {code}",
|
|
1664
|
+
voiceRejectSimilar: "This sample is too similar to an existing recording. Use a different clean, original vocal.",
|
|
1665
|
+
voiceRejectNotClean: "This is not a clean solo vocal. Use a recording of one voice without accompaniment or background noise.",
|
|
1666
|
+
voiceRejectOriginal: "Original reason: {reason}"
|
|
1667
|
+
};
|
|
1668
|
+
//#endregion
|
|
1534
1669
|
//#region src/client/AccountCenter/center-locales.ts
|
|
1535
1670
|
const centerZh = {
|
|
1536
1671
|
centerUsagePromo: "限时特惠 −{discount}(原价 {total})",
|
|
@@ -1539,6 +1674,7 @@ window.__ModuleLoader__.load({
|
|
|
1539
1674
|
...memberZh,
|
|
1540
1675
|
...businessZh,
|
|
1541
1676
|
...announcementZh,
|
|
1677
|
+
...voiceProfileZh,
|
|
1542
1678
|
centerRechargeIntro: "选择充值金额或订阅,确认费用后完成支付。",
|
|
1543
1679
|
centerOrdersIntro: "查看自己的订单、支付进度和退款申请。",
|
|
1544
1680
|
centerRedeemIntro: "兑换余额或订阅权益,查看兑换记录。",
|
|
@@ -1687,6 +1823,7 @@ window.__ModuleLoader__.load({
|
|
|
1687
1823
|
...memberEn,
|
|
1688
1824
|
...businessEn,
|
|
1689
1825
|
...announcementEn,
|
|
1826
|
+
...voiceProfileEn,
|
|
1690
1827
|
centerRechargeIntro: "Choose balance credit or a subscription, review the cost and complete payment.",
|
|
1691
1828
|
centerOrdersIntro: "View your orders, payment progress and refund requests.",
|
|
1692
1829
|
centerRedeemIntro: "Redeem balance or subscription benefits and view history.",
|
|
@@ -2266,7 +2403,8 @@ window.__ModuleLoader__.load({
|
|
|
2266
2403
|
"redeem",
|
|
2267
2404
|
"affiliate",
|
|
2268
2405
|
"profile",
|
|
2269
|
-
"messages"
|
|
2406
|
+
"messages",
|
|
2407
|
+
"voice_profiles"
|
|
2270
2408
|
]);
|
|
2271
2409
|
function normalizeAccountPage(page) {
|
|
2272
2410
|
return page === "available_channels" ? "model_prices" : page;
|
|
@@ -2286,7 +2424,8 @@ window.__ModuleLoader__.load({
|
|
|
2286
2424
|
redeem: "/redeem",
|
|
2287
2425
|
affiliate: "/affiliate",
|
|
2288
2426
|
profile: "/profile",
|
|
2289
|
-
messages: "/dashboard"
|
|
2427
|
+
messages: "/dashboard",
|
|
2428
|
+
voice_profiles: "/dashboard"
|
|
2290
2429
|
};
|
|
2291
2430
|
function centerWebUrl(origin, page) {
|
|
2292
2431
|
return `${new URL(origin).origin}${ACCOUNT_CENTER_WEB_PATHS[page]}`;
|
|
@@ -2821,6 +2960,25 @@ window.__ModuleLoader__.load({
|
|
|
2821
2960
|
@container(max-width:560px){.member-polish{gap:14px}.member-polish .center-section{padding:17px}.member-polish-intro{align-items:flex-start;gap:10px}.member-polish-intro>p{font-size:11px}.member-polish-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.member-polish-metric{padding:14px}.member-polish-metric>strong{font-size:23px}.member-polish-metric>span{font-size:10px}.member-polish .member-polish-redeem-card{padding:20px 17px}.member-polish-code-heading{gap:10px}.member-polish-credit-types{gap:5px}.member-polish-credit-types>span{font-size:10px;padding:3px 6px}.member-polish-transfer-content{display:grid;grid-template-columns:minmax(0,1fr)}.member-polish-transfer-content>*{grid-column:auto!important;grid-row:auto!important}.member-polish-transfer-total{display:flex;justify-content:space-between;align-items:baseline;padding-block:12px;border-block:1px solid var(--member-border)}.member-polish .center-member-facts{gap:12px}.member-polish-receipt-body{gap:11px}.member-polish-receipt-footer{gap:10px}.member-polish .center-member-pagination{align-items:flex-start;flex-direction:column;gap:12px}.member-polish .center-member-pagination>.center-member-actions{width:100%;justify-content:flex-end}}
|
|
2822
2961
|
@container(max-width:380px){.member-polish .center-section{padding:14px}.member-polish .member-polish-redeem-card{padding:17px 13px}.member-polish-code-input{padding-left:8px}.member-polish-code-input>button{max-width:80px;font-size:10px;padding-inline:6px}.member-polish-gift{width:36px;height:36px;padding:8px}.member-polish-gift svg{width:20px;height:20px}.member-polish-credit-types{gap:4px}.member-polish-metric{padding:12px}.member-polish-metric>strong{font-size:21px}.member-polish-intro>button{padding-inline:8px}.member-polish-invitation-card .center-section-head{align-items:flex-start}.member-polish-invitation>code{padding:11px;font-size:11px}.member-polish-invitation>button{width:100%;justify-self:stretch}.member-polish-empty{padding:22px 12px}.member-polish .center-member-facts{grid-template-columns:1fr}}
|
|
2823
2962
|
.member-polish-subtext{display:block;margin-top:2px;font-size:10px;font-weight:400;color:var(--member-muted)}.member-polish-more{display:flex;justify-content:center;margin-top:12px}.member-polish-program{display:grid;gap:4px;padding:12px 14px;border:1px solid var(--member-border);border-radius:8px;background:var(--member-inset);font-size:12px;line-height:1.6}.member-polish-program>p{margin:0}
|
|
2963
|
+
`;
|
|
2964
|
+
//#endregion
|
|
2965
|
+
//#region src/client/AccountCenter/voice-profile-styles.ts
|
|
2966
|
+
/** 「我的音色」 styles, scoped under `.center-voices`; colors follow the DSH theme. */
|
|
2967
|
+
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)}
|
|
2824
2982
|
`;
|
|
2825
2983
|
//#endregion
|
|
2826
2984
|
//#region src/client/AccountCenter/shared.tsx
|
|
@@ -3007,7 +3165,7 @@ window.__ModuleLoader__.load({
|
|
|
3007
3165
|
.center-detail-modal{width:min(720px,100%)!important;max-height:100%;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);overflow:hidden!important;gap:16px!important}.center-detail-modal-content{min-height:0;flex:1;overflow:hidden}.center-detail-modal-content>div:first-child{flex-shrink:0}.center-detail-modal-content>div:last-child{min-height:0;overflow-y:auto;overscroll-behavior:contain;margin-top:4px;padding-bottom:8px}.center-detail-modal>div:last-child{flex-shrink:0}.center-detail-modal .center-stack{gap:20px}.center-detail-modal .center-detail-list{font-size:13px;line-height:1.6}.center-detail-modal h3{font-size:14px;margin:0 0 12px}.center-detail-modal .center-muted{line-height:1.6}
|
|
3008
3166
|
.vibedev-center{container-type:inline-size;font-size:13px;line-height:1.5}.center-stack{display:grid;gap:20px}.center-section{padding:20px;border:1px solid var(--dsw-alias-border-l2);border-radius:12px;background:var(--dsw-alias-bg-layer-2);min-width:0}.center-section-head{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;margin-bottom:16px}.center-section h2{font-size:15px;margin:0}.center-section h3{font-size:14px;margin:0 0 12px}.center-muted{color:var(--dsw-alias-label-secondary);font-size:12px}.center-warning{color:var(--dsw-alias-state-warn-primary,#b77700)}.center-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,210px),1fr));gap:12px}.center-metric{padding:16px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;min-width:0}.center-metric-value{font-size:22px;font-weight:600;margin:8px 0;overflow-wrap:anywhere}.center-metric dl,.center-detail-list{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:6px 16px;margin:0}.center-metric dt,.center-detail-list dt{color:var(--dsw-alias-label-secondary)}.center-metric dd,.center-detail-list dd{margin:0;text-align:right;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}.center-actions,.center-filters,.center-range{display:flex;flex-wrap:wrap;align-items:end;gap:12px}.center-range{gap:16px}.center-field{display:grid;gap:6px;min-width:120px;max-width:100%;flex:1}.center-field>span{font-size:12px;color:var(--dsw-alias-label-secondary)}.center-field select{font:inherit;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-1);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;min-height:34px;padding:6px 10px;max-width:100%}.center-scroll{overflow:auto;max-width:100%}.center-table{width:100%;border-collapse:collapse;font-size:12px;font-variant-numeric:tabular-nums}.center-table th,.center-table td{padding:10px 8px;text-align:left;border-bottom:1px solid var(--dsw-alias-border-l2);vertical-align:top;overflow-wrap:anywhere}.center-table th{font-weight:500;color:var(--dsw-alias-label-secondary);white-space:nowrap}.center-table button{font:inherit;color:inherit}.center-inline-button{background:transparent;border:0;padding:0;cursor:pointer;text-decoration:underline}.center-distribution{display:grid;grid-template-columns:100px minmax(0,1fr);gap:20px;align-items:start}.center-bars{display:grid;gap:10px;margin-top:8px}.center-bars progress{width:100%;accent-color:var(--dsw-alias-state-business-primary)}.center-columns{display:flex;gap:12px;flex-wrap:wrap;padding:12px 0}.center-columns label{display:flex;gap:6px;align-items:center}.center-chart{height:180px;width:100%;color:var(--dsw-alias-state-business-primary);overflow:visible}.center-chart-table{max-height:220px;margin-top:12px}.center-tabs{display:flex;gap:8px;border-bottom:1px solid var(--dsw-alias-border-l2);padding-bottom:12px}.center-tab[aria-selected=true]{font-weight:600;border-bottom:2px solid var(--dsw-alias-state-business-primary)}.center-sub-head{display:flex;flex-wrap:wrap;justify-content:space-between;gap:12px}.center-sub-head h2{margin:0;font-size:16px}.center-badge{display:inline-block;border:1px solid var(--dsw-alias-border-l2);border-radius:4px;padding:2px 6px;font-size:11px}.center-sub-window{display:grid;gap:6px;margin-top:16px}.center-sub-window progress{width:100%;accent-color:var(--dsw-alias-state-business-primary)}.center-sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.center-status{padding:8px 0;margin:0} .center-two-col{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr));gap:20px}
|
|
3009
3167
|
@container(max-width:680px){.vibedev-center-nav{display:none}.vibedev-center-picker{display:block}.center-section{padding:16px}.center-distribution{grid-template-columns:1fr}.center-distribution>svg{display:none}.center-field{min-width:120px}.center-metric-value{font-size:20px}}
|
|
3010
|
-
` + CENTER_SHELL_STYLES + SUBSCRIPTION_UI_STYLES + DASHBOARD_STYLES + USAGE_UI_STYLES + PRICE_STYLES + STATUS_STYLES + COMMERCE_STYLES + ORDERS_STYLES + MEMBER_STYLES + MEMBER_POLISH_STYLES + PROFILE_STYLES + ANNOUNCEMENT_STYLES + `
|
|
3168
|
+
` + CENTER_SHELL_STYLES + SUBSCRIPTION_UI_STYLES + DASHBOARD_STYLES + USAGE_UI_STYLES + PRICE_STYLES + STATUS_STYLES + COMMERCE_STYLES + ORDERS_STYLES + MEMBER_STYLES + MEMBER_POLISH_STYLES + PROFILE_STYLES + ANNOUNCEMENT_STYLES + VOICE_PROFILE_STYLES + `
|
|
3011
3169
|
.center-ui-v2 .center-native-nav{flex-wrap:wrap;overflow:visible;flex:1;row-gap:0}.center-ui-v2 .center-business-receipt{display:grid;gap:10px}.center-business-receipt>h2,.center-business-receipt>p{margin:0}.center-business-confirm{padding:14px;border:1px solid var(--dsw-alias-border-l2,#dce0e6);border-radius:8px;background:var(--dsw-alias-bg-layer-3,#f7f8fa)}.center-business-operation code{font-size:12px}.center-business-confirm h3{margin:0 0 8px}.center-business-confirm .center-actions{margin-top:10px}
|
|
3012
3170
|
@container(max-width:760px){.center-ui-v2 .center-native-nav{display:none}.center-ui-v2 .center-page-picker{display:block}.center-ui-v2 .center-navigation-row{padding-bottom:10px}}
|
|
3013
3171
|
.center-refresh-icon{flex:none;transform-origin:center}.center-refresh-icon[data-busy=true]{animation:center-refresh-spin .9s linear infinite}@keyframes center-refresh-spin{to{transform:rotate(360deg)}}
|
|
@@ -6071,7 +6229,7 @@ window.__ModuleLoader__.load({
|
|
|
6071
6229
|
*/
|
|
6072
6230
|
let cached;
|
|
6073
6231
|
let inflight;
|
|
6074
|
-
const record = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
6232
|
+
const record$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
6075
6233
|
const string = (value) => typeof value === "string" && value.trim() !== "" ? value : void 0;
|
|
6076
6234
|
const amount = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0 ? value : void 0;
|
|
6077
6235
|
const identifier = (value) => {
|
|
@@ -6084,7 +6242,7 @@ window.__ModuleLoader__.load({
|
|
|
6084
6242
|
* @returns the promotion, or undefined.
|
|
6085
6243
|
*/
|
|
6086
6244
|
function parsePromotion(value) {
|
|
6087
|
-
const source = record(value);
|
|
6245
|
+
const source = record$1(value);
|
|
6088
6246
|
if (source === void 0) return void 0;
|
|
6089
6247
|
const model = string(source.model);
|
|
6090
6248
|
const startsAt = string(source.starts_at);
|
|
@@ -6093,7 +6251,7 @@ window.__ModuleLoader__.load({
|
|
|
6093
6251
|
if (!Number.isFinite(Date.parse(startsAt)) || !Number.isFinite(Date.parse(endsAt))) return void 0;
|
|
6094
6252
|
const dailyCap = amount(source.daily_cap);
|
|
6095
6253
|
const tiers = Array.isArray(source.tiers) ? source.tiers.flatMap((item) => {
|
|
6096
|
-
const tier = record(item);
|
|
6254
|
+
const tier = record$1(item);
|
|
6097
6255
|
const prevSpendMin = tier === void 0 ? void 0 : amount(tier.prev_spend_min);
|
|
6098
6256
|
const discountRate = tier === void 0 ? void 0 : amount(tier.discount_rate);
|
|
6099
6257
|
return prevSpendMin === void 0 || discountRate === void 0 || discountRate <= 0 ? [] : [{
|
|
@@ -6117,8 +6275,8 @@ window.__ModuleLoader__.load({
|
|
|
6117
6275
|
* @returns the listing, or undefined.
|
|
6118
6276
|
*/
|
|
6119
6277
|
function parsePromotionListing(value) {
|
|
6120
|
-
const body = record(value);
|
|
6121
|
-
const data = record(body?.data);
|
|
6278
|
+
const body = record$1(value);
|
|
6279
|
+
const data = record$1(body?.data);
|
|
6122
6280
|
const items = data?.items;
|
|
6123
6281
|
if (!Array.isArray(items)) return void 0;
|
|
6124
6282
|
const groupId = identifier(data?.group_id);
|
|
@@ -13880,6 +14038,846 @@ window.__ModuleLoader__.load({
|
|
|
13880
14038
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProfileContent, { ...props }, props.identity);
|
|
13881
14039
|
}
|
|
13882
14040
|
//#endregion
|
|
14041
|
+
//#region src/client/AccountCenter/voice-profile-api.ts
|
|
14042
|
+
const VOICE_ROUTE = "/api/dsh-vibedev/voice-profiles";
|
|
14043
|
+
const VOICE_DELETE_ROUTE = "/api/dsh-vibedev/voice-profiles/delete";
|
|
14044
|
+
/** Mirrors the Host's limits; the Host checks again. */
|
|
14045
|
+
const VOICE_LIMITS = {
|
|
14046
|
+
maxBytes: 10485760,
|
|
14047
|
+
minSeconds: 6,
|
|
14048
|
+
maxSeconds: 60,
|
|
14049
|
+
recommendedMinSeconds: 10,
|
|
14050
|
+
extensions: [
|
|
14051
|
+
"mp3",
|
|
14052
|
+
"wav",
|
|
14053
|
+
"m4a",
|
|
14054
|
+
"aac",
|
|
14055
|
+
"flac",
|
|
14056
|
+
"ogg"
|
|
14057
|
+
],
|
|
14058
|
+
titleMax: 80
|
|
14059
|
+
};
|
|
14060
|
+
/** What the file picker offers. */
|
|
14061
|
+
const VOICE_ACCEPT = ".mp3,.wav,.m4a,.aac,.flac,.ogg,audio/mpeg,audio/wav,audio/x-wav,audio/mp4,audio/x-m4a,audio/aac,audio/flac,audio/ogg";
|
|
14062
|
+
const record = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
14063
|
+
const str = (value) => typeof value === "string" && value !== "" ? value : void 0;
|
|
14064
|
+
/** A recognised provider refusal in the page's words (format, length, a recording too like an existing one, not a clean vocal). */
|
|
14065
|
+
const REJECTION_KEYS = {
|
|
14066
|
+
similar_recording: "voiceRejectSimilar",
|
|
14067
|
+
too_short: "voiceErrTooShort",
|
|
14068
|
+
too_long: "voiceErrTooLong",
|
|
14069
|
+
format: "voiceErrFormat",
|
|
14070
|
+
not_clean_vocal: "voiceRejectNotClean"
|
|
14071
|
+
};
|
|
14072
|
+
/** One profile from a Host answer; anything without a `vp_…` id is dropped. */
|
|
14073
|
+
function readVoiceProfile(value) {
|
|
14074
|
+
const raw = record(value);
|
|
14075
|
+
const id = str(raw?.id);
|
|
14076
|
+
if (raw === void 0 || id === void 0 || !/^vp_[A-Za-z0-9_-]{1,120}$/.test(id)) return void 0;
|
|
14077
|
+
const status = raw.status === "ready" ? "ready" : raw.status === "failed" ? "failed" : "processing";
|
|
14078
|
+
const seconds = typeof raw.durationSeconds === "number" && Number.isFinite(raw.durationSeconds) ? raw.durationSeconds : void 0;
|
|
14079
|
+
return {
|
|
14080
|
+
id,
|
|
14081
|
+
status,
|
|
14082
|
+
...str(raw.title) === void 0 ? {} : { title: str(raw.title) },
|
|
14083
|
+
...str(raw.failureReason) === void 0 ? {} : { failureReason: str(raw.failureReason) },
|
|
14084
|
+
...typeof raw.failureKind === "string" && Object.hasOwn(REJECTION_KEYS, raw.failureKind) ? { failureKind: raw.failureKind } : {},
|
|
14085
|
+
...seconds === void 0 ? {} : { durationSeconds: seconds },
|
|
14086
|
+
...str(raw.createdAt) === void 0 ? {} : { createdAt: str(raw.createdAt) }
|
|
14087
|
+
};
|
|
14088
|
+
}
|
|
14089
|
+
/** The extension of a file name, lower-case. */
|
|
14090
|
+
const extension = (name) => /\.([a-z0-9]{2,5})$/i.exec(name)?.[1]?.toLowerCase();
|
|
14091
|
+
/** Rule names the Host reports, and the codes it uses, mapped to the page's words. */
|
|
14092
|
+
const CODE_KEYS = {
|
|
14093
|
+
VOICE_SAMPLE_FORMAT: "voiceErrFormat",
|
|
14094
|
+
VOICE_SAMPLE_EMPTY: "voiceErrEmpty",
|
|
14095
|
+
VOICE_SAMPLE_TOO_LARGE: "voiceErrTooLarge",
|
|
14096
|
+
VOICE_SAMPLE_TOO_SHORT: "voiceErrTooShort",
|
|
14097
|
+
VOICE_SAMPLE_TOO_LONG: "voiceErrTooLong",
|
|
14098
|
+
VOICE_SAMPLE_DURATION_UNKNOWN: "voiceErrDurationUnknown",
|
|
14099
|
+
VOICE_SAMPLE_UPLOAD_FAILED: "voiceErrUpload",
|
|
14100
|
+
VOICE_SAMPLE_URL_UNAVAILABLE: "voiceErrUpload",
|
|
14101
|
+
VOICE_TITLE_REQUIRED: "voiceErrTitle",
|
|
14102
|
+
VOICE_TITLE_INVALID: "voiceErrTitle",
|
|
14103
|
+
VOICE_TITLE_TOO_LONG: "voiceErrTitle",
|
|
14104
|
+
ACCOUNT_CHANGED: "voiceErrAccountChanged"
|
|
14105
|
+
};
|
|
14106
|
+
/** Everything else, by the error category — the account center's own words (`centerError*`). */
|
|
14107
|
+
const CATEGORY_KEYS = {
|
|
14108
|
+
authentication: "centerErrorAuth",
|
|
14109
|
+
access_restricted: "centerRestricted",
|
|
14110
|
+
rate_limited: "centerErrorRate",
|
|
14111
|
+
billing: "centerErrorQuota",
|
|
14112
|
+
invalid_input: "centerErrorInvalid",
|
|
14113
|
+
content_rejected: "centerErrorInvalid",
|
|
14114
|
+
model_unavailable: "centerErrorUnavailable",
|
|
14115
|
+
service_unavailable: "centerErrorUnavailable",
|
|
14116
|
+
submission_uncertain: "centerErrorUpstream",
|
|
14117
|
+
internal_error: "centerErrorInternal"
|
|
14118
|
+
};
|
|
14119
|
+
/**
|
|
14120
|
+
* The words for a failure answer.
|
|
14121
|
+
* @param body - the Host's `{ error: { code, category } }`, or nothing for a network failure.
|
|
14122
|
+
* @returns the dictionary key and the code to show next to it.
|
|
14123
|
+
*/
|
|
14124
|
+
function voiceFailureOf(body) {
|
|
14125
|
+
const error = record(record(body)?.error);
|
|
14126
|
+
const code = str(error?.code);
|
|
14127
|
+
const rule = str(error?.rule);
|
|
14128
|
+
return {
|
|
14129
|
+
key: (code === "VOICE_SAMPLE_REJECTED" && rule !== void 0 && Object.hasOwn(REJECTION_KEYS, rule) ? REJECTION_KEYS[rule] : void 0) ?? (code === void 0 ? void 0 : CODE_KEYS[code]) ?? CATEGORY_KEYS[str(error?.category) ?? ""] ?? (error === void 0 ? "centerErrorUnavailable" : "centerErrorInternal"),
|
|
14130
|
+
...code === void 0 ? {} : { code }
|
|
14131
|
+
};
|
|
14132
|
+
}
|
|
14133
|
+
/**
|
|
14134
|
+
* Check a chosen file before anything is read: extension and size.
|
|
14135
|
+
* @param file - the file.
|
|
14136
|
+
* @returns the failure, or undefined when it may go on.
|
|
14137
|
+
*/
|
|
14138
|
+
function checkVoiceFile(file) {
|
|
14139
|
+
const ext = extension(file.name);
|
|
14140
|
+
if (ext === void 0 || !VOICE_LIMITS.extensions.includes(ext)) return { key: "voiceErrFormat" };
|
|
14141
|
+
if (file.size === 0) return { key: "voiceErrEmpty" };
|
|
14142
|
+
if (file.size > VOICE_LIMITS.maxBytes) return { key: "voiceErrTooLarge" };
|
|
14143
|
+
}
|
|
14144
|
+
/** Check a measured length; an unmeasured one goes on (the Host measures it after the upload). */
|
|
14145
|
+
function checkVoiceSeconds(seconds) {
|
|
14146
|
+
if (seconds === void 0) return void 0;
|
|
14147
|
+
if (seconds < VOICE_LIMITS.minSeconds) return { key: "voiceErrTooShort" };
|
|
14148
|
+
if (seconds > VOICE_LIMITS.maxSeconds) return { key: "voiceErrTooLong" };
|
|
14149
|
+
}
|
|
14150
|
+
/** A title the Host takes: 1–80 characters after trimming. */
|
|
14151
|
+
function voiceTitleOk(title) {
|
|
14152
|
+
const value = title.replace(/\s+/g, " ").trim();
|
|
14153
|
+
return value !== "" && [...value].length <= VOICE_LIMITS.titleMax;
|
|
14154
|
+
}
|
|
14155
|
+
/**
|
|
14156
|
+
* The length of an audio file as the browser's own decoder reads it (metadata only).
|
|
14157
|
+
* @param file - the file.
|
|
14158
|
+
* @param timeoutMs - give up after this long.
|
|
14159
|
+
* @returns seconds, or undefined when the browser cannot tell.
|
|
14160
|
+
*/
|
|
14161
|
+
function measureVoiceFile(file, timeoutMs = 1e4) {
|
|
14162
|
+
if (typeof document === "undefined" || typeof URL === "undefined" || typeof URL.createObjectURL !== "function") return Promise.resolve(void 0);
|
|
14163
|
+
return new Promise((resolve) => {
|
|
14164
|
+
const audio = document.createElement("audio");
|
|
14165
|
+
const url = URL.createObjectURL(file);
|
|
14166
|
+
let done = false;
|
|
14167
|
+
const finish = (value) => {
|
|
14168
|
+
if (done) return;
|
|
14169
|
+
done = true;
|
|
14170
|
+
clearTimeout(timer);
|
|
14171
|
+
audio.removeAttribute("src");
|
|
14172
|
+
URL.revokeObjectURL(url);
|
|
14173
|
+
resolve(value);
|
|
14174
|
+
};
|
|
14175
|
+
const timer = setTimeout(() => finish(void 0), timeoutMs);
|
|
14176
|
+
audio.preload = "metadata";
|
|
14177
|
+
audio.onloadedmetadata = () => finish(Number.isFinite(audio.duration) && audio.duration > 0 ? audio.duration : void 0);
|
|
14178
|
+
audio.onerror = () => finish(void 0);
|
|
14179
|
+
audio.src = url;
|
|
14180
|
+
});
|
|
14181
|
+
}
|
|
14182
|
+
/** A file's bytes as base64, for the Host route. */
|
|
14183
|
+
function fileBase64(file) {
|
|
14184
|
+
return new Promise((resolve, reject) => {
|
|
14185
|
+
const reader = new FileReader();
|
|
14186
|
+
reader.onerror = () => reject(reader.error ?? /* @__PURE__ */ new Error("read failed"));
|
|
14187
|
+
reader.onload = () => {
|
|
14188
|
+
const value = typeof reader.result === "string" ? reader.result : "";
|
|
14189
|
+
const comma = value.indexOf(",");
|
|
14190
|
+
if (comma < 0) reject(/* @__PURE__ */ new Error("read failed"));
|
|
14191
|
+
else resolve(value.slice(comma + 1));
|
|
14192
|
+
};
|
|
14193
|
+
reader.readAsDataURL(file);
|
|
14194
|
+
});
|
|
14195
|
+
}
|
|
14196
|
+
/**
|
|
14197
|
+
* When to read the list again while a voice is being created: 2 s, 3 s, 5 s, then every 8 s, for at most 5 minutes.
|
|
14198
|
+
* @param round - how many reads were made since the wait began.
|
|
14199
|
+
* @param elapsedMs - how long the wait has run.
|
|
14200
|
+
* @returns the delay, or undefined to stop (the page then offers 刷新).
|
|
14201
|
+
*/
|
|
14202
|
+
function voicePollDelay(round, elapsedMs) {
|
|
14203
|
+
if (elapsedMs >= 3e5) return void 0;
|
|
14204
|
+
return [
|
|
14205
|
+
2e3,
|
|
14206
|
+
3e3,
|
|
14207
|
+
5e3
|
|
14208
|
+
][round] ?? 8e3;
|
|
14209
|
+
}
|
|
14210
|
+
/** The signed-in user the page shows, from the account center's identity (`[origin, source, userId]`). */
|
|
14211
|
+
function expectedUserOf(identity) {
|
|
14212
|
+
try {
|
|
14213
|
+
const parts = JSON.parse(identity);
|
|
14214
|
+
return Array.isArray(parts) && typeof parts[2] === "string" && parts[2] !== "" ? parts[2] : void 0;
|
|
14215
|
+
} catch {
|
|
14216
|
+
return;
|
|
14217
|
+
}
|
|
14218
|
+
}
|
|
14219
|
+
const fetcherOf = (fetcher) => fetcher ?? ((input, init) => fetch(input, init));
|
|
14220
|
+
async function bodyOf(response) {
|
|
14221
|
+
try {
|
|
14222
|
+
return await response.json();
|
|
14223
|
+
} catch {
|
|
14224
|
+
return;
|
|
14225
|
+
}
|
|
14226
|
+
}
|
|
14227
|
+
/** Read the list. */
|
|
14228
|
+
async function listVoices(identity, signal, fetcher) {
|
|
14229
|
+
const user = expectedUserOf(identity);
|
|
14230
|
+
try {
|
|
14231
|
+
const response = await fetcherOf(fetcher)(VOICE_ROUTE, {
|
|
14232
|
+
...signal === void 0 ? {} : { signal },
|
|
14233
|
+
headers: user === void 0 ? {} : { "X-VibeDev-Expected-User": user }
|
|
14234
|
+
});
|
|
14235
|
+
const body = record(await bodyOf(response));
|
|
14236
|
+
if (response.status === 404 || response.status === 405 || body?.unsupported === true) return { kind: "unsupported" };
|
|
14237
|
+
if (!response.ok) return {
|
|
14238
|
+
kind: "failed",
|
|
14239
|
+
failure: voiceFailureOf(body)
|
|
14240
|
+
};
|
|
14241
|
+
const items = record(body?.data)?.items;
|
|
14242
|
+
return {
|
|
14243
|
+
kind: "ready",
|
|
14244
|
+
items: Array.isArray(items) ? items.map(readVoiceProfile).filter((item) => item !== void 0) : []
|
|
14245
|
+
};
|
|
14246
|
+
} catch (error) {
|
|
14247
|
+
if (signal?.aborted === true) throw error;
|
|
14248
|
+
return {
|
|
14249
|
+
kind: "failed",
|
|
14250
|
+
failure: voiceFailureOf(void 0)
|
|
14251
|
+
};
|
|
14252
|
+
}
|
|
14253
|
+
}
|
|
14254
|
+
async function post(route, payload, read, fetcher) {
|
|
14255
|
+
try {
|
|
14256
|
+
const response = await fetcherOf(fetcher)(route, {
|
|
14257
|
+
method: "POST",
|
|
14258
|
+
headers: { "content-type": "application/json" },
|
|
14259
|
+
body: JSON.stringify(payload)
|
|
14260
|
+
});
|
|
14261
|
+
const body = await bodyOf(response);
|
|
14262
|
+
if (!response.ok) return {
|
|
14263
|
+
ok: false,
|
|
14264
|
+
failure: voiceFailureOf(body)
|
|
14265
|
+
};
|
|
14266
|
+
const value = read(record(body)?.data);
|
|
14267
|
+
return value === void 0 ? {
|
|
14268
|
+
ok: false,
|
|
14269
|
+
failure: { key: "centerErrorInternal" }
|
|
14270
|
+
} : {
|
|
14271
|
+
ok: true,
|
|
14272
|
+
value
|
|
14273
|
+
};
|
|
14274
|
+
} catch {
|
|
14275
|
+
return {
|
|
14276
|
+
ok: false,
|
|
14277
|
+
failure: voiceFailureOf(void 0)
|
|
14278
|
+
};
|
|
14279
|
+
}
|
|
14280
|
+
}
|
|
14281
|
+
/** Upload and create one voice. */
|
|
14282
|
+
function createVoice(identity, input, fetcher) {
|
|
14283
|
+
return post(VOICE_ROUTE, {
|
|
14284
|
+
...input,
|
|
14285
|
+
expected_user_id: expectedUserOf(identity) ?? ""
|
|
14286
|
+
}, readVoiceProfile, fetcher);
|
|
14287
|
+
}
|
|
14288
|
+
/** Delete one voice for good. */
|
|
14289
|
+
function deleteVoice(identity, id, fetcher) {
|
|
14290
|
+
return post(VOICE_DELETE_ROUTE, {
|
|
14291
|
+
id,
|
|
14292
|
+
expected_user_id: expectedUserOf(identity) ?? ""
|
|
14293
|
+
}, (data) => str(record(data)?.id), fetcher);
|
|
14294
|
+
}
|
|
14295
|
+
//#endregion
|
|
14296
|
+
//#region src/client/AccountCenter/VoiceProfilesPage.tsx
|
|
14297
|
+
/**
|
|
14298
|
+
* 「我的音色」: the user's voice profiles for Suno voice covers — list (name, status with the failure reason, length,
|
|
14299
|
+
* creation time, delete), a new voice (choose a recording → checked here → uploaded → named → created → the list is
|
|
14300
|
+
* read again until it is ready), and deletion behind a confirmation that says it is permanent.
|
|
14301
|
+
*/
|
|
14302
|
+
const seconds = (value) => (Math.round(value * 10) / 10).toFixed(1).replace(/\.0$/, "");
|
|
14303
|
+
const megabytes = (bytes) => `${(bytes / 1048576).toFixed(bytes < 1048576 ? 2 : 1)} MB`;
|
|
14304
|
+
/** A failure in the page's words, with the code when there is one. */
|
|
14305
|
+
function FailureText({ failure, t }) {
|
|
14306
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [t(failure.key), failure.code === void 0 ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
14307
|
+
className: "center-muted",
|
|
14308
|
+
children: [" · ", fill$1(t("voiceErrorCode"), { code: failure.code })]
|
|
14309
|
+
})] });
|
|
14310
|
+
}
|
|
14311
|
+
/** Why a voice failed: a recognised refusal in plain words (the provider's reason after it), else the reason as it came. */
|
|
14312
|
+
function failureText(profile, t) {
|
|
14313
|
+
if (profile.failureKind !== void 0) {
|
|
14314
|
+
const plain = t(REJECTION_KEYS[profile.failureKind]);
|
|
14315
|
+
return profile.failureReason === void 0 ? plain : `${plain} ${fill$1(t("voiceRejectOriginal"), { reason: profile.failureReason })}`;
|
|
14316
|
+
}
|
|
14317
|
+
return profile.failureReason ?? t("voiceFailedUnknown");
|
|
14318
|
+
}
|
|
14319
|
+
/** 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);
|
|
14327
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
|
|
14328
|
+
className: "center-voices-steps",
|
|
14329
|
+
"aria-label": t("voiceNewTitle"),
|
|
14330
|
+
children: [
|
|
14331
|
+
"voiceStepCheck",
|
|
14332
|
+
"voiceStepUpload",
|
|
14333
|
+
"voiceStepProcess",
|
|
14334
|
+
"voiceStepReady"
|
|
14335
|
+
].map((label, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
14336
|
+
"data-state": index < at || phase === "ready" ? "done" : index === at ? "active" : "pending",
|
|
14337
|
+
"aria-current": index === at && phase !== "ready" ? "step" : void 0,
|
|
14338
|
+
children: [
|
|
14339
|
+
index + 1,
|
|
14340
|
+
". ",
|
|
14341
|
+
t(label)
|
|
14342
|
+
]
|
|
14343
|
+
}, label))
|
|
14344
|
+
});
|
|
14345
|
+
}
|
|
14346
|
+
/** One row's status, with the failure reason under a failed one. */
|
|
14347
|
+
function VoiceStatus({ profile, t }) {
|
|
14348
|
+
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", {
|
|
14350
|
+
className: "center-voices-status",
|
|
14351
|
+
"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
|
+
})] });
|
|
14357
|
+
}
|
|
14358
|
+
/** The list: empty, or a table. */
|
|
14359
|
+
function VoiceTable({ items, t, busy, onDelete }) {
|
|
14360
|
+
if (items.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14361
|
+
className: "center-voices-empty",
|
|
14362
|
+
"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
|
+
})]
|
|
14367
|
+
});
|
|
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")
|
|
14390
|
+
}),
|
|
14391
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
14392
|
+
scope: "col",
|
|
14393
|
+
children: t("voiceColCreated")
|
|
14394
|
+
}),
|
|
14395
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
|
|
14396
|
+
scope: "col",
|
|
14397
|
+
children: t("voiceColActions")
|
|
14398
|
+
})
|
|
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
|
+
]
|
|
14425
|
+
})
|
|
14426
|
+
});
|
|
14427
|
+
}
|
|
14428
|
+
/** The confirmation in front of a deletion. */
|
|
14429
|
+
function VoiceDeleteConfirm({ profile, t, busy, onConfirm, onCancel }) {
|
|
14430
|
+
const titleId = (0, react.useId)();
|
|
14431
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14432
|
+
className: "center-voices-confirm",
|
|
14433
|
+
role: "alertdialog",
|
|
14434
|
+
"aria-labelledby": titleId,
|
|
14435
|
+
"data-voice-confirm": profile.id,
|
|
14436
|
+
children: [
|
|
14437
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
14438
|
+
id: titleId,
|
|
14439
|
+
children: fill$1(t("voiceDeleteTitle"), { title: profile.title ?? t("voiceUntitled") })
|
|
14440
|
+
}),
|
|
14441
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("voiceDeleteBody") }),
|
|
14442
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14443
|
+
className: "center-actions",
|
|
14444
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
14445
|
+
type: "button",
|
|
14446
|
+
variant: "primary",
|
|
14447
|
+
disabled: busy,
|
|
14448
|
+
"data-voice-confirm-delete": true,
|
|
14449
|
+
onClick: onConfirm,
|
|
14450
|
+
children: busy ? t("voiceDeleting") : t("voiceDeleteConfirm")
|
|
14451
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
14452
|
+
type: "button",
|
|
14453
|
+
variant: "outline",
|
|
14454
|
+
disabled: busy,
|
|
14455
|
+
onClick: onCancel,
|
|
14456
|
+
children: t("voiceDeleteCancel")
|
|
14457
|
+
})]
|
|
14458
|
+
})
|
|
14459
|
+
]
|
|
14460
|
+
});
|
|
14461
|
+
}
|
|
14462
|
+
function VoiceProfilesContent({ identity, refresh, t }) {
|
|
14463
|
+
const reportActivity = (0, react.useContext)(CenterReadActivityContext);
|
|
14464
|
+
const [items, setItems] = (0, react.useState)();
|
|
14465
|
+
const [listState, setListState] = (0, react.useState)("loading");
|
|
14466
|
+
const [listFailure, setListFailure] = (0, react.useState)();
|
|
14467
|
+
const [reload, setReload] = (0, react.useState)(0);
|
|
14468
|
+
const poll = (0, react.useRef)({
|
|
14469
|
+
round: 0,
|
|
14470
|
+
since: 0
|
|
14471
|
+
});
|
|
14472
|
+
const [pollStopped, setPollStopped] = (0, react.useState)(false);
|
|
14473
|
+
const [file, setFile] = (0, react.useState)();
|
|
14474
|
+
const [fileSeconds, setFileSeconds] = (0, react.useState)();
|
|
14475
|
+
const [fileFailure, setFileFailure] = (0, react.useState)();
|
|
14476
|
+
const [title, setTitle] = (0, react.useState)("");
|
|
14477
|
+
const [titleInvalid, setTitleInvalid] = (0, react.useState)(false);
|
|
14478
|
+
const [phase, setPhase] = (0, react.useState)("idle");
|
|
14479
|
+
const [createFailure, setCreateFailure] = (0, react.useState)();
|
|
14480
|
+
const [created, setCreated] = (0, react.useState)();
|
|
14481
|
+
const [startedAt, setStartedAt] = (0, react.useState)(0);
|
|
14482
|
+
const [now, setNow] = (0, react.useState)(() => Date.now());
|
|
14483
|
+
const [formKey, setFormKey] = (0, react.useState)(0);
|
|
14484
|
+
const [confirming, setConfirming] = (0, react.useState)();
|
|
14485
|
+
const [deleting, setDeleting] = (0, react.useState)(false);
|
|
14486
|
+
const [deleteFailure, setDeleteFailure] = (0, react.useState)();
|
|
14487
|
+
const [deleted, setDeleted] = (0, react.useState)(false);
|
|
14488
|
+
const fileId = (0, react.useId)(), titleId = (0, react.useId)();
|
|
14489
|
+
(0, react.useEffect)(() => {
|
|
14490
|
+
const controller = new AbortController(), token = Symbol("voice-profiles");
|
|
14491
|
+
reportActivity(token, true);
|
|
14492
|
+
listVoices(identity, controller.signal).then((result) => {
|
|
14493
|
+
if (controller.signal.aborted) return;
|
|
14494
|
+
if (result.kind === "ready") {
|
|
14495
|
+
setItems(result.items);
|
|
14496
|
+
setListState("ready");
|
|
14497
|
+
setListFailure(void 0);
|
|
14498
|
+
} else if (result.kind === "unsupported") setListState("unsupported");
|
|
14499
|
+
else {
|
|
14500
|
+
setListState("failed");
|
|
14501
|
+
setListFailure(result.failure);
|
|
14502
|
+
}
|
|
14503
|
+
}).catch(() => void 0).finally(() => reportActivity(token, false));
|
|
14504
|
+
return () => {
|
|
14505
|
+
controller.abort();
|
|
14506
|
+
reportActivity(token, false);
|
|
14507
|
+
};
|
|
14508
|
+
}, [
|
|
14509
|
+
identity,
|
|
14510
|
+
refresh,
|
|
14511
|
+
reload,
|
|
14512
|
+
reportActivity
|
|
14513
|
+
]);
|
|
14514
|
+
const processing = items?.some((item) => item.status === "processing") === true || phase === "processing";
|
|
14515
|
+
(0, react.useEffect)(() => {
|
|
14516
|
+
if (!processing) {
|
|
14517
|
+
poll.current = {
|
|
14518
|
+
round: 0,
|
|
14519
|
+
since: 0
|
|
14520
|
+
};
|
|
14521
|
+
setPollStopped(false);
|
|
14522
|
+
return;
|
|
14523
|
+
}
|
|
14524
|
+
if (poll.current.since === 0) poll.current.since = Date.now();
|
|
14525
|
+
const wait = voicePollDelay(poll.current.round, Date.now() - poll.current.since);
|
|
14526
|
+
if (wait === void 0) {
|
|
14527
|
+
setPollStopped(true);
|
|
14528
|
+
return;
|
|
14529
|
+
}
|
|
14530
|
+
const timer = setTimeout(() => {
|
|
14531
|
+
poll.current.round++;
|
|
14532
|
+
setReload((value) => value + 1);
|
|
14533
|
+
}, wait);
|
|
14534
|
+
return () => clearTimeout(timer);
|
|
14535
|
+
}, [processing, items]);
|
|
14536
|
+
(0, react.useEffect)(() => {
|
|
14537
|
+
if (phase !== "processing") return;
|
|
14538
|
+
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
14539
|
+
return () => clearInterval(timer);
|
|
14540
|
+
}, [phase]);
|
|
14541
|
+
(0, react.useEffect)(() => {
|
|
14542
|
+
if (created === void 0 || phase !== "processing") return;
|
|
14543
|
+
const found = items?.find((item) => item.id === created.id);
|
|
14544
|
+
if (found === void 0 || found.status === "processing") return;
|
|
14545
|
+
setCreated(found);
|
|
14546
|
+
setPhase(found.status === "ready" ? "ready" : "failed");
|
|
14547
|
+
}, [
|
|
14548
|
+
items,
|
|
14549
|
+
created,
|
|
14550
|
+
phase
|
|
14551
|
+
]);
|
|
14552
|
+
const busy = phase === "checking" || phase === "uploading";
|
|
14553
|
+
const chooseFile = (event) => {
|
|
14554
|
+
const chosen = event.target.files?.[0];
|
|
14555
|
+
setFile(chosen);
|
|
14556
|
+
setFileFailure(void 0);
|
|
14557
|
+
setFileSeconds(void 0);
|
|
14558
|
+
setCreateFailure(void 0);
|
|
14559
|
+
if (phase === "failed" || phase === "ready") {
|
|
14560
|
+
setPhase("idle");
|
|
14561
|
+
setCreated(void 0);
|
|
14562
|
+
}
|
|
14563
|
+
if (chosen === void 0) return;
|
|
14564
|
+
const failure = checkVoiceFile(chosen);
|
|
14565
|
+
if (failure !== void 0) {
|
|
14566
|
+
setFileFailure(failure);
|
|
14567
|
+
return;
|
|
14568
|
+
}
|
|
14569
|
+
setFileSeconds("measuring");
|
|
14570
|
+
measureVoiceFile(chosen).then((measured) => {
|
|
14571
|
+
setFileSeconds(measured ?? "unknown");
|
|
14572
|
+
const tooLong = checkVoiceSeconds(measured);
|
|
14573
|
+
if (tooLong !== void 0) setFileFailure(tooLong);
|
|
14574
|
+
});
|
|
14575
|
+
};
|
|
14576
|
+
const submit = async (event) => {
|
|
14577
|
+
event.preventDefault();
|
|
14578
|
+
if (busy || phase === "processing" || file === void 0) return;
|
|
14579
|
+
setCreateFailure(void 0);
|
|
14580
|
+
setCreated(void 0);
|
|
14581
|
+
setPhase("checking");
|
|
14582
|
+
const failure = checkVoiceFile(file) ?? checkVoiceSeconds(typeof fileSeconds === "number" ? fileSeconds : void 0);
|
|
14583
|
+
if (failure !== void 0) {
|
|
14584
|
+
setFileFailure(failure);
|
|
14585
|
+
setPhase("idle");
|
|
14586
|
+
return;
|
|
14587
|
+
}
|
|
14588
|
+
if (!voiceTitleOk(title)) {
|
|
14589
|
+
setTitleInvalid(true);
|
|
14590
|
+
setPhase("idle");
|
|
14591
|
+
return;
|
|
14592
|
+
}
|
|
14593
|
+
setPhase("uploading");
|
|
14594
|
+
let data;
|
|
14595
|
+
try {
|
|
14596
|
+
data = await fileBase64(file);
|
|
14597
|
+
} catch {
|
|
14598
|
+
setCreateFailure({ key: "voiceErrRead" });
|
|
14599
|
+
setPhase("failed");
|
|
14600
|
+
return;
|
|
14601
|
+
}
|
|
14602
|
+
const result = await createVoice(identity, {
|
|
14603
|
+
title: title.trim(),
|
|
14604
|
+
filename: file.name,
|
|
14605
|
+
data
|
|
14606
|
+
});
|
|
14607
|
+
if (!result.ok) {
|
|
14608
|
+
setCreateFailure(result.failure);
|
|
14609
|
+
setPhase("failed");
|
|
14610
|
+
return;
|
|
14611
|
+
}
|
|
14612
|
+
const profile = result.value;
|
|
14613
|
+
setCreated(profile);
|
|
14614
|
+
setItems((current) => [profile, ...(current ?? []).filter((item) => item.id !== profile.id)]);
|
|
14615
|
+
if (profile.status === "ready") setPhase("ready");
|
|
14616
|
+
else if (profile.status === "failed") setPhase("failed");
|
|
14617
|
+
else {
|
|
14618
|
+
setStartedAt(Date.now());
|
|
14619
|
+
setNow(Date.now());
|
|
14620
|
+
setPhase("processing");
|
|
14621
|
+
}
|
|
14622
|
+
};
|
|
14623
|
+
const another = () => {
|
|
14624
|
+
setFile(void 0);
|
|
14625
|
+
setFileSeconds(void 0);
|
|
14626
|
+
setFileFailure(void 0);
|
|
14627
|
+
setTitle("");
|
|
14628
|
+
setTitleInvalid(false);
|
|
14629
|
+
setPhase("idle");
|
|
14630
|
+
setCreated(void 0);
|
|
14631
|
+
setCreateFailure(void 0);
|
|
14632
|
+
setFormKey((value) => value + 1);
|
|
14633
|
+
};
|
|
14634
|
+
const confirmDelete = async () => {
|
|
14635
|
+
if (confirming === void 0 || deleting) return;
|
|
14636
|
+
setDeleting(true);
|
|
14637
|
+
setDeleteFailure(void 0);
|
|
14638
|
+
const result = await deleteVoice(identity, confirming.id);
|
|
14639
|
+
setDeleting(false);
|
|
14640
|
+
if (!result.ok) {
|
|
14641
|
+
setDeleteFailure(result.failure);
|
|
14642
|
+
return;
|
|
14643
|
+
}
|
|
14644
|
+
setItems((current) => (current ?? []).filter((item) => item.id !== confirming.id));
|
|
14645
|
+
setConfirming(void 0);
|
|
14646
|
+
setDeleted(true);
|
|
14647
|
+
setReload((value) => value + 1);
|
|
14648
|
+
};
|
|
14649
|
+
const waited = Math.max(0, Math.round((now - startedAt) / 1e3));
|
|
14650
|
+
const short = typeof fileSeconds === "number" && fileSeconds >= VOICE_LIMITS.minSeconds && fileSeconds < VOICE_LIMITS.recommendedMinSeconds;
|
|
14651
|
+
if (listState === "unsupported") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
14652
|
+
className: "center-voices",
|
|
14653
|
+
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")
|
|
14659
|
+
})
|
|
14660
|
+
})
|
|
14661
|
+
});
|
|
14662
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14663
|
+
className: "center-voices",
|
|
14664
|
+
"data-voice-page": true,
|
|
14665
|
+
children: [
|
|
14666
|
+
/* @__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
|
+
})]
|
|
14682
|
+
}),
|
|
14683
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Section, {
|
|
14684
|
+
title: t("voiceNewTitle"),
|
|
14685
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
14686
|
+
className: "center-voices-form",
|
|
14687
|
+
onSubmit: (event) => {
|
|
14688
|
+
submit(event);
|
|
14689
|
+
},
|
|
14690
|
+
"data-voice-form": true,
|
|
14691
|
+
children: [
|
|
14692
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14693
|
+
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", {
|
|
14700
|
+
id: fileId,
|
|
14701
|
+
type: "file",
|
|
14702
|
+
accept: VOICE_ACCEPT,
|
|
14703
|
+
"aria-label": t("voiceChooseFile"),
|
|
14704
|
+
disabled: busy || phase === "processing",
|
|
14705
|
+
onChange: chooseFile
|
|
14706
|
+
})
|
|
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) }) })]
|
|
14720
|
+
}),
|
|
14721
|
+
fileSeconds === "unknown" && fileFailure === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14722
|
+
className: "center-muted",
|
|
14723
|
+
role: "status",
|
|
14724
|
+
children: t("voiceFileSecondsUnknown")
|
|
14725
|
+
}),
|
|
14726
|
+
short && fileFailure === void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14727
|
+
className: "center-muted",
|
|
14728
|
+
children: t("voiceFileShortHint")
|
|
14729
|
+
}),
|
|
14730
|
+
fileFailure !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14731
|
+
className: "center-warning",
|
|
14732
|
+
role: "alert",
|
|
14733
|
+
"data-voice-file-error": true,
|
|
14734
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailureText, {
|
|
14735
|
+
failure: fileFailure,
|
|
14736
|
+
t
|
|
14737
|
+
})
|
|
14738
|
+
}),
|
|
14739
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14740
|
+
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
|
+
})]
|
|
14756
|
+
}),
|
|
14757
|
+
titleInvalid && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14758
|
+
className: "center-warning",
|
|
14759
|
+
role: "alert",
|
|
14760
|
+
children: t("voiceErrTitle")
|
|
14761
|
+
}),
|
|
14762
|
+
phase !== "idle" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceSteps, {
|
|
14763
|
+
phase,
|
|
14764
|
+
t
|
|
14765
|
+
}),
|
|
14766
|
+
(busy || phase === "processing") && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
14767
|
+
role: "status",
|
|
14768
|
+
"aria-live": "polite",
|
|
14769
|
+
"data-voice-progress": true,
|
|
14770
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
14771
|
+
className: "center-voices-progress",
|
|
14772
|
+
"aria-hidden": "true",
|
|
14773
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {})
|
|
14774
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14775
|
+
className: "center-muted",
|
|
14776
|
+
children: phase === "checking" ? t("voiceChecking") : phase === "uploading" ? t("voiceUploading") : fill$1(t(pollStopped ? "voiceProcessingSlow" : "voiceProcessing"), { seconds: waited })
|
|
14777
|
+
})]
|
|
14778
|
+
}),
|
|
14779
|
+
phase === "ready" && created !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14780
|
+
className: "center-voices-notice",
|
|
14781
|
+
"data-tone": "success",
|
|
14782
|
+
role: "status",
|
|
14783
|
+
children: fill$1(t("voiceReadyNotice"), { title: created.title ?? title })
|
|
14784
|
+
}),
|
|
14785
|
+
phase === "failed" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14786
|
+
className: "center-warning",
|
|
14787
|
+
role: "alert",
|
|
14788
|
+
"data-voice-create-error": true,
|
|
14789
|
+
children: createFailure !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailureText, {
|
|
14790
|
+
failure: createFailure,
|
|
14791
|
+
t
|
|
14792
|
+
}) : fill$1(t("voiceFailedNotice"), { reason: created === void 0 ? t("voiceFailedUnknown") : failureText(created, t) })
|
|
14793
|
+
}),
|
|
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, {
|
|
14797
|
+
type: "button",
|
|
14798
|
+
variant: "outline",
|
|
14799
|
+
onClick: another,
|
|
14800
|
+
children: t("voiceCreateAnother")
|
|
14801
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
|
|
14802
|
+
type: "submit",
|
|
14803
|
+
variant: "primary",
|
|
14804
|
+
"data-voice-create": true,
|
|
14805
|
+
disabled: busy || phase === "processing" || file === void 0 || fileFailure !== void 0 || fileSeconds === "measuring" || title.trim() === "",
|
|
14806
|
+
children: t("voiceCreate")
|
|
14807
|
+
})
|
|
14808
|
+
}),
|
|
14809
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14810
|
+
className: "center-muted",
|
|
14811
|
+
children: t("voiceKeepNote")
|
|
14812
|
+
})
|
|
14813
|
+
]
|
|
14814
|
+
}, formKey)
|
|
14815
|
+
}),
|
|
14816
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Section, {
|
|
14817
|
+
title: t("voiceList"),
|
|
14818
|
+
children: [
|
|
14819
|
+
deleted && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14820
|
+
className: "center-voices-notice",
|
|
14821
|
+
"data-tone": "success",
|
|
14822
|
+
role: "status",
|
|
14823
|
+
children: t("voiceDeleted")
|
|
14824
|
+
}),
|
|
14825
|
+
confirming !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceDeleteConfirm, {
|
|
14826
|
+
profile: confirming,
|
|
14827
|
+
t,
|
|
14828
|
+
busy: deleting,
|
|
14829
|
+
onConfirm: () => {
|
|
14830
|
+
confirmDelete();
|
|
14831
|
+
},
|
|
14832
|
+
onCancel: () => {
|
|
14833
|
+
setConfirming(void 0);
|
|
14834
|
+
setDeleteFailure(void 0);
|
|
14835
|
+
}
|
|
14836
|
+
}),
|
|
14837
|
+
deleteFailure !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
14838
|
+
className: "center-warning",
|
|
14839
|
+
role: "alert",
|
|
14840
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailureText, {
|
|
14841
|
+
failure: deleteFailure,
|
|
14842
|
+
t
|
|
14843
|
+
})
|
|
14844
|
+
}),
|
|
14845
|
+
listState === "failed" && listFailure !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
14846
|
+
className: "center-warning",
|
|
14847
|
+
role: "alert",
|
|
14848
|
+
"data-voice-list-error": true,
|
|
14849
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FailureText, {
|
|
14850
|
+
failure: listFailure,
|
|
14851
|
+
t
|
|
14852
|
+
}), items !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
14853
|
+
className: "center-muted",
|
|
14854
|
+
children: [" · ", t("centerStale")]
|
|
14855
|
+
}) : null]
|
|
14856
|
+
}),
|
|
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, {
|
|
14862
|
+
items,
|
|
14863
|
+
t,
|
|
14864
|
+
busy: deleting,
|
|
14865
|
+
onDelete: (profile) => {
|
|
14866
|
+
setDeleted(false);
|
|
14867
|
+
setDeleteFailure(void 0);
|
|
14868
|
+
setConfirming(profile);
|
|
14869
|
+
}
|
|
14870
|
+
})
|
|
14871
|
+
]
|
|
14872
|
+
})
|
|
14873
|
+
]
|
|
14874
|
+
});
|
|
14875
|
+
}
|
|
14876
|
+
/** The page; a different account starts it afresh. */
|
|
14877
|
+
function VoiceProfilesPage(props) {
|
|
14878
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceProfilesContent, { ...props }, props.identity);
|
|
14879
|
+
}
|
|
14880
|
+
//#endregion
|
|
13883
14881
|
//#region src/client/AccountCenter.tsx
|
|
13884
14882
|
const ACCOUNT_CENTER_PANEL = "vibedev-account-center";
|
|
13885
14883
|
const PAGES = [
|
|
@@ -13893,12 +14891,29 @@ window.__ModuleLoader__.load({
|
|
|
13893
14891
|
["redeem", "centerRedeem"],
|
|
13894
14892
|
["affiliate", "centerAffiliate"],
|
|
13895
14893
|
["profile", "centerProfile"],
|
|
14894
|
+
["voice_profiles", "centerVoiceProfiles"],
|
|
13896
14895
|
["messages", "centerMessages"]
|
|
13897
14896
|
];
|
|
13898
14897
|
function AccountCenterIcon({ size = 16 }) {
|
|
13899
14898
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconUserOutlineMedium, { size });
|
|
13900
14899
|
}
|
|
13901
14900
|
function PageIcon({ page }) {
|
|
14901
|
+
if (page === "voice_profiles") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
14902
|
+
viewBox: "0 0 20 20",
|
|
14903
|
+
width: "16",
|
|
14904
|
+
height: "16",
|
|
14905
|
+
fill: "none",
|
|
14906
|
+
stroke: "currentColor",
|
|
14907
|
+
strokeWidth: "1.5",
|
|
14908
|
+
"aria-hidden": "true",
|
|
14909
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
14910
|
+
x: "7.5",
|
|
14911
|
+
y: "2.5",
|
|
14912
|
+
width: "5",
|
|
14913
|
+
height: "9",
|
|
14914
|
+
rx: "2.5"
|
|
14915
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4.5 9.5a5.5 5.5 0 0 0 11 0M10 15v2.5" })]
|
|
14916
|
+
});
|
|
13902
14917
|
if (page === "messages") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
13903
14918
|
viewBox: "0 0 20 20",
|
|
13904
14919
|
width: "16",
|
|
@@ -14006,7 +15021,7 @@ window.__ModuleLoader__.load({
|
|
|
14006
15021
|
setRefresh((value) => value + 1);
|
|
14007
15022
|
Promise.allSettled([store.refresh(true), store.refreshSubscriptions(true)]).finally(() => setRefreshing(false));
|
|
14008
15023
|
};
|
|
14009
|
-
const intro = page === "dashboard" ? "centerDashboardIntro" : page === "usage" ? "centerUsageIntro" : page === "subscriptions" ? "centerSubscriptionsIntro" : page === "channel_status" ? "centerMonitorIntro" : page === "model_prices" ? "centerModelPricesIntro" : page === "recharge" ? "centerRechargeIntro" : page === "orders" ? "centerOrdersIntro" : page === "redeem" ? "centerRedeemIntro" : page === "affiliate" ? "centerAffiliateIntro" : page === "profile" ? "centerProfileIntro" : page === "messages" ? "centerMessagesIntro" : "centerWebsiteHint";
|
|
15024
|
+
const intro = page === "dashboard" ? "centerDashboardIntro" : page === "usage" ? "centerUsageIntro" : page === "subscriptions" ? "centerSubscriptionsIntro" : page === "channel_status" ? "centerMonitorIntro" : page === "model_prices" ? "centerModelPricesIntro" : page === "recharge" ? "centerRechargeIntro" : page === "orders" ? "centerOrdersIntro" : page === "redeem" ? "centerRedeemIntro" : page === "affiliate" ? "centerAffiliateIntro" : page === "profile" ? "centerProfileIntro" : page === "messages" ? "centerMessagesIntro" : page === "voice_profiles" ? "centerVoiceProfilesIntro" : "centerWebsiteHint";
|
|
14010
15025
|
const accountUpdated = () => {
|
|
14011
15026
|
store.refresh(true);
|
|
14012
15027
|
store.refreshSubscriptions(true);
|
|
@@ -14144,6 +15159,11 @@ window.__ModuleLoader__.load({
|
|
|
14144
15159
|
store: announcements,
|
|
14145
15160
|
t
|
|
14146
15161
|
}),
|
|
15162
|
+
page === "voice_profiles" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VoiceProfilesPage, {
|
|
15163
|
+
identity,
|
|
15164
|
+
refresh,
|
|
15165
|
+
t
|
|
15166
|
+
}, identity),
|
|
14147
15167
|
page === "dashboard" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dashboard, {
|
|
14148
15168
|
store,
|
|
14149
15169
|
view: account.view,
|