@vibedev-si/dsh-vibedev 0.5.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1473,11 +1473,53 @@ window.__ModuleLoader__.load({
1473
1473
  return typeof translated === "string" && translated !== key ? translated : businessZh[key];
1474
1474
  }
1475
1475
  //#endregion
1476
+ //#region src/client/AccountCenter/announcement-locales.ts
1477
+ /** The 消息 page's words. Content itself is written by whoever publishes the announcement. */
1478
+ const announcementZh = {
1479
+ centerMessages: "消息",
1480
+ centerMessagesIntro: "VibeDev 的版本更新、服务调整和账号相关通知。",
1481
+ msgFilterUnread: "未读",
1482
+ msgFilterAll: "全部",
1483
+ msgEmptyUnread: "还没有未读消息",
1484
+ msgEmptyAll: "还没有消息",
1485
+ msgEmptyHint: "新的版本更新和账号通知会出现在这里。",
1486
+ msgReading: "正在读取消息…",
1487
+ msgExpand: "展开全部",
1488
+ msgCollapse: "收起",
1489
+ msgMarkRead: "标为已读",
1490
+ msgPopupTitle: "VibeDev 公告",
1491
+ msgPopupKnow: "知道了",
1492
+ msgPopupLater: "稍后",
1493
+ msgPopupAll: "查看全部消息",
1494
+ centerMessagesCount: "消息({count})",
1495
+ msgUnreadCount: "{count} 条未读消息"
1496
+ };
1497
+ const announcementEn = {
1498
+ centerMessages: "Messages",
1499
+ centerMessagesIntro: "Version updates, service changes and account notices from VibeDev.",
1500
+ msgFilterUnread: "Unread",
1501
+ msgFilterAll: "All",
1502
+ msgEmptyUnread: "Nothing unread",
1503
+ msgEmptyAll: "No messages yet",
1504
+ msgEmptyHint: "Version updates and account notices will appear here.",
1505
+ msgReading: "Reading messages…",
1506
+ msgExpand: "Show all",
1507
+ msgCollapse: "Show less",
1508
+ msgMarkRead: "Mark as read",
1509
+ msgPopupTitle: "VibeDev announcement",
1510
+ msgPopupKnow: "Got it",
1511
+ msgPopupLater: "Later",
1512
+ msgPopupAll: "See all messages",
1513
+ centerMessagesCount: "Messages ({count})",
1514
+ msgUnreadCount: "{count} unread messages"
1515
+ };
1516
+ //#endregion
1476
1517
  //#region src/client/AccountCenter/center-locales.ts
1477
1518
  const centerZh = {
1478
1519
  ...commerceZh,
1479
1520
  ...memberZh,
1480
1521
  ...businessZh,
1522
+ ...announcementZh,
1481
1523
  centerRechargeIntro: "选择充值金额或订阅,确认费用后完成支付。",
1482
1524
  centerOrdersIntro: "查看自己的订单、支付进度和退款申请。",
1483
1525
  centerRedeemIntro: "兑换余额或订阅权益,查看兑换记录。",
@@ -1623,6 +1665,7 @@ window.__ModuleLoader__.load({
1623
1665
  ...commerceEn,
1624
1666
  ...memberEn,
1625
1667
  ...businessEn,
1668
+ ...announcementEn,
1626
1669
  centerRechargeIntro: "Choose balance credit or a subscription, review the cost and complete payment.",
1627
1670
  centerOrdersIntro: "View your orders, payment progress and refund requests.",
1628
1671
  centerRedeemIntro: "Redeem balance or subscription benefits and view history.",
@@ -1930,6 +1973,9 @@ window.__ModuleLoader__.load({
1930
1973
  spending: "花费",
1931
1974
  confirmSpending: "每次付费生成前先询问",
1932
1975
  confirmSpendingHint: "开启后,生成图片、视频、音乐或播客之前会先请你确认,并显示模型和预估金额。默认关闭。",
1976
+ imagesInContext: "把生成的图片发给模型",
1977
+ imagesInContextHint: "默认关闭:图片照样保存在工作区,但只把路径交给模型,模型要看时用 read_image 读那张图。开启后每次生成都把图片发给模型,更直接,但更费钱、也更容易让缓存失效。只是这一轮要看,用 image_generate 的 attach 参数。",
1978
+ results: "生成结果",
1933
1979
  output: "保存位置",
1934
1980
  claudeCache: "Claude 提示词缓存",
1935
1981
  claudeCacheTtl: "缓存保留时间",
@@ -2199,7 +2245,8 @@ window.__ModuleLoader__.load({
2199
2245
  "orders",
2200
2246
  "redeem",
2201
2247
  "affiliate",
2202
- "profile"
2248
+ "profile",
2249
+ "messages"
2203
2250
  ]);
2204
2251
  function normalizeAccountPage(page) {
2205
2252
  return page === "available_channels" ? "model_prices" : page;
@@ -2218,7 +2265,8 @@ window.__ModuleLoader__.load({
2218
2265
  orders: "/orders",
2219
2266
  redeem: "/redeem",
2220
2267
  affiliate: "/affiliate",
2221
- profile: "/profile"
2268
+ profile: "/profile",
2269
+ messages: "/dashboard"
2222
2270
  };
2223
2271
  function centerWebUrl(origin, page) {
2224
2272
  return `${new URL(origin).origin}${ACCOUNT_CENTER_WEB_PATHS[page]}`;
@@ -2602,6 +2650,38 @@ window.__ModuleLoader__.load({
2602
2650
  @container(max-width:900px){.vibedev-center .center-dash-analysis{grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:12px}.vibedev-center .center-dash-bottom{grid-template-columns:minmax(0,1fr) 180px;gap:12px}.vibedev-center .center-dash-primary-card{padding:14px}.vibedev-center .center-dash-primary-value{font-size:26px}.vibedev-center .center-dash-secondary-card{padding:12px}.vibedev-center .center-dash-recent-list>li{grid-template-columns:minmax(0,1fr) minmax(80px,.8fr);gap:10px}.vibedev-center .center-dash-recent-identity{grid-column:1/-1}}
2603
2651
  @container(max-width:700px){.vibedev-center .center-dash-analysis,.vibedev-center .center-dash-bottom{grid-template-columns:1fr}.vibedev-center .center-dash-primary{grid-template-columns:repeat(2,minmax(0,1fr))}.vibedev-center .center-dash-card-balance{grid-column:1/-1;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:0 16px}.vibedev-center .center-dash-card-balance .center-dash-card-heading{grid-column:1/-1}.vibedev-center .center-dash-card-balance .center-dash-primary-value{margin:6px 0 0}.vibedev-center .center-dash-card-balance .center-dash-primary-footer{border-top:0;padding:0;align-self:end;padding-bottom:4px}.vibedev-center .center-dash-secondary{grid-template-columns:repeat(2,minmax(0,1fr))}.vibedev-center .center-dash-secondary-card:nth-child(3){border-inline-start:0}.vibedev-center .center-dash-secondary-card:nth-child(n+3){border-top:1px solid var(--dsw-alias-border-l2)}.vibedev-center .center-dash-shortcut-list{grid-template-columns:repeat(2,minmax(0,1fr))}.vibedev-center .center-dash-recent-list>li{grid-template-columns:minmax(0,1fr) minmax(100px,.8fr) minmax(110px,.85fr)}.vibedev-center .center-dash-recent-identity{grid-column:auto}}
2604
2652
  @container(max-width:430px){.vibedev-center .center-dash-primary{gap:8px}.vibedev-center .center-dash-primary-card{padding:12px}.vibedev-center .center-dash-primary-value{font-size:24px;margin:10px 0 12px}.vibedev-center .center-dash-icon{width:26px;height:26px;border-radius:7px}.vibedev-center .center-dash-icon svg{width:15px;height:15px}.vibedev-center .center-dash-card-cost .center-dash-facts>div{display:grid;gap:0}.vibedev-center .center-dash-card-cost .center-dash-facts dd{text-align:left}.vibedev-center .center-dash-primary-footer{font-size:10px}.vibedev-center .center-dash-secondary-card{padding:12px}.vibedev-center .center-dash-secondary-value{font-size:18px}.vibedev-center .center-dash-secondary .center-dash-facts{font-size:10px}.vibedev-center .center-dash-token-grid{grid-template-columns:1fr;gap:16px}.vibedev-center .center-dash-recent-list>li{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.vibedev-center .center-dash-recent-identity{grid-column:1/-1}.vibedev-center .center-dash-range .center-field{min-width:105px}.vibedev-center .center-chart-toolbar{gap:8px}.vibedev-center .center-chart-plot{column-gap:6px;grid-template-columns:minmax(34px,max-content) minmax(0,1fr)}.vibedev-center .center-chart-legend{max-width:100%}.vibedev-center .center-chart-readout{display:grid;gap:2px}}
2653
+ `;
2654
+ //#endregion
2655
+ //#region src/client/AccountCenter/announcement-styles.ts
2656
+ /** Presentation for the 消息 page, scoped to the account-center container like its siblings. */
2657
+ const ANNOUNCEMENT_STYLES = `
2658
+ .vibedev-center .center-announcements{display:flex;flex-direction:column;gap:14px;max-width:960px}
2659
+ .vibedev-center .center-announcements-filters{display:flex;align-items:center;gap:8px}
2660
+ .vibedev-center .center-announcements-filter{display:inline-flex;align-items:center;gap:6px;height:26px;padding:0 10px;border:1px solid var(--center-border);border-radius:6px;background:transparent;color:var(--center-muted);font:inherit;cursor:pointer}
2661
+ .vibedev-center .center-announcements-filter:hover{border-color:var(--dsw-alias-border-l3,#d0d5dd);color:var(--dsw-alias-label-primary,#202124)}
2662
+ .vibedev-center .center-announcements-filter[aria-pressed=true]{border-color:color-mix(in srgb,var(--center-accent) 40%,var(--center-border));background:color-mix(in srgb,var(--center-accent) 8%,transparent);color:var(--center-accent)}
2663
+ .vibedev-center .center-announcements-count{font-variant-numeric:tabular-nums}
2664
+ .vibedev-center .center-announcements-list{display:flex;flex-direction:column;gap:10px;margin:0;padding:0;list-style:none}
2665
+ .vibedev-center .center-announcement{position:relative;padding:16px 18px;border:1px solid var(--center-border);border-radius:10px;background:var(--center-surface)}
2666
+ .vibedev-center .center-announcement.is-unread{border-color:color-mix(in srgb,var(--center-accent) 32%,var(--center-border))}
2667
+ .vibedev-center .center-announcement.is-unread::before{content:'';position:absolute;left:0;top:14px;bottom:14px;width:3px;border-radius:0 3px 3px 0;background:var(--center-accent)}
2668
+ .vibedev-center .center-announcement-head{display:flex;align-items:baseline;gap:8px}
2669
+ .vibedev-center .center-announcement-dot{flex:none;width:6px;height:6px;border-radius:50%;background:var(--center-accent);transform:translateY(-2px)}
2670
+ .vibedev-center .center-announcement-title{margin:0;font-size:14px;font-weight:650;line-height:1.45;color:var(--dsw-alias-label-primary,#202124)}
2671
+ .vibedev-center .center-announcement.is-read .center-announcement-title{color:var(--center-muted);font-weight:500}
2672
+ .vibedev-center .center-announcement-when{margin-left:auto;white-space:nowrap;font-size:12px;color:var(--center-muted);font-variant-numeric:tabular-nums}
2673
+ .vibedev-center .center-announcement-body{margin:8px 0 0;color:var(--center-muted);line-height:1.6}
2674
+ .vibedev-center .center-announcement.is-collapsed .center-announcement-body{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
2675
+ .vibedev-center .center-announcement-body p{margin:0 0 8px}
2676
+ .vibedev-center .center-announcement-body p:last-child{margin-bottom:0}
2677
+ .vibedev-center .center-announcement-actions{display:flex;align-items:center;gap:14px;margin-top:10px;font-size:12px}
2678
+ .vibedev-center .center-announcement-action{border:0;background:none;padding:0;font:inherit;color:var(--center-accent);cursor:pointer}
2679
+ .vibedev-center .center-announcement-action:hover{text-decoration:underline}
2680
+ .vibedev-center .center-announcement-action.is-quiet{color:var(--center-muted)}
2681
+ .vibedev-center .center-announcement-action.is-quiet:hover{color:var(--dsw-alias-label-primary,#202124)}
2682
+ .vibedev-center .center-announcements-empty{padding:36px 20px;border:1px dashed var(--dsw-alias-border-l3,#d0d5dd);border-radius:10px;text-align:center;color:var(--center-muted)}
2683
+ .vibedev-center .center-announcements-empty p{margin:0}
2684
+ .vibedev-center .center-announcements-empty p + p{margin-top:4px;font-size:12px}
2605
2685
  `;
2606
2686
  //#endregion
2607
2687
  //#region src/client/AccountCenter/subscription-ui-styles.ts
@@ -2891,7 +2971,7 @@ window.__ModuleLoader__.load({
2891
2971
  .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}
2892
2972
  .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}
2893
2973
  @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}}
2894
- ` + 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 + `
2974
+ ` + 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 + `
2895
2975
  .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}
2896
2976
  @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}}
2897
2977
  .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)}}
@@ -3535,6 +3615,371 @@ window.__ModuleLoader__.load({
3535
3615
  });
3536
3616
  }
3537
3617
  //#endregion
3618
+ //#region src/client/announcement-format.ts
3619
+ /**
3620
+ * How an announcement's plain text becomes what a person reads. The gateway
3621
+ * publishes text, not markup: one paragraph per non-empty line.
3622
+ */
3623
+ /**
3624
+ * The body's paragraphs.
3625
+ * @param content - the announcement text.
3626
+ * @returns its paragraphs.
3627
+ */
3628
+ function paragraphs(content) {
3629
+ return content.split(/\r?\n/u).map((line) => line.trim()).filter((line) => line !== "");
3630
+ }
3631
+ /**
3632
+ * When a message was published, in the runtime's own locale.
3633
+ * @param iso - the gateway's timestamp.
3634
+ * @returns the label, or an empty string when the timestamp cannot be read.
3635
+ */
3636
+ function whenLabel(iso) {
3637
+ const date = new Date(iso);
3638
+ if (Number.isNaN(date.getTime())) return "";
3639
+ return new Intl.DateTimeFormat(void 0, {
3640
+ month: "short",
3641
+ day: "numeric",
3642
+ hour: "2-digit",
3643
+ minute: "2-digit"
3644
+ }).format(date);
3645
+ }
3646
+ //#endregion
3647
+ //#region src/client/AccountCenter/AnnouncementsPage.tsx
3648
+ /** The 消息 page: what VibeDev published, unread first, and one tap to stop calling it unread. */
3649
+ /**
3650
+ * One message.
3651
+ * @param props - the message, whether it is open, and what the two actions do.
3652
+ * @returns the card.
3653
+ */
3654
+ function AnnouncementCard({ item, open, t, onToggle, onRead }) {
3655
+ const unread = item.readAt === null;
3656
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
3657
+ className: `center-announcement${unread ? " is-unread" : " is-read"}${open ? "" : " is-collapsed"}`,
3658
+ "data-announcement-id": item.id,
3659
+ children: [
3660
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3661
+ className: "center-announcement-head",
3662
+ children: [
3663
+ unread && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3664
+ className: "center-announcement-dot",
3665
+ "aria-hidden": "true"
3666
+ }),
3667
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
3668
+ className: "center-announcement-title",
3669
+ children: item.title
3670
+ }),
3671
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3672
+ className: "center-announcement-when",
3673
+ children: whenLabel(item.createdAt)
3674
+ })
3675
+ ]
3676
+ }),
3677
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3678
+ className: "center-announcement-body",
3679
+ children: paragraphs(item.content).map((line, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: line }, index))
3680
+ }),
3681
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3682
+ className: "center-announcement-actions",
3683
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3684
+ type: "button",
3685
+ className: "center-announcement-action",
3686
+ "aria-expanded": open,
3687
+ onClick: onToggle,
3688
+ children: t(open ? "msgCollapse" : "msgExpand")
3689
+ }), unread && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3690
+ type: "button",
3691
+ className: "center-announcement-action is-quiet",
3692
+ onClick: onRead,
3693
+ children: t("msgMarkRead")
3694
+ })]
3695
+ })
3696
+ ]
3697
+ });
3698
+ }
3699
+ /**
3700
+ * The page.
3701
+ * @param props - the store and the dictionary.
3702
+ * @returns the list, its filter, and the states a mailbox can be in.
3703
+ */
3704
+ function AnnouncementsPage({ store, t }) {
3705
+ const snapshot = (0, react.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
3706
+ const [filter, setFilter] = (0, react.useState)("unread");
3707
+ const [open, setOpen] = (0, react.useState)(() => /* @__PURE__ */ new Set());
3708
+ const unread = snapshot.items.filter((item) => item.readAt === null);
3709
+ const shown = filter === "unread" ? unread : snapshot.items;
3710
+ const toggle = (id) => {
3711
+ setOpen((current) => {
3712
+ const next = new Set(current);
3713
+ if (next.has(id)) next.delete(id);
3714
+ else next.add(id);
3715
+ return next;
3716
+ });
3717
+ if (snapshot.items.some((item) => item.id === id && item.readAt === null)) store.markRead(id);
3718
+ };
3719
+ if (!snapshot.loaded) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3720
+ className: "center-muted center-status",
3721
+ role: "status",
3722
+ children: t("msgReading")
3723
+ });
3724
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3725
+ className: "center-announcements",
3726
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3727
+ className: "center-announcements-filters",
3728
+ role: "group",
3729
+ "aria-label": t("centerMessages"),
3730
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
3731
+ type: "button",
3732
+ className: "center-announcements-filter",
3733
+ "aria-pressed": filter === "unread",
3734
+ onClick: () => setFilter("unread"),
3735
+ children: [
3736
+ t("msgFilterUnread"),
3737
+ " ",
3738
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3739
+ className: "center-announcements-count",
3740
+ children: unread.length
3741
+ })
3742
+ ]
3743
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3744
+ type: "button",
3745
+ className: "center-announcements-filter",
3746
+ "aria-pressed": filter === "all",
3747
+ onClick: () => setFilter("all"),
3748
+ children: t("msgFilterAll")
3749
+ })]
3750
+ }), shown.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3751
+ className: "center-announcements-empty",
3752
+ children: [
3753
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t(filter === "unread" ? "msgEmptyUnread" : "msgEmptyAll") }),
3754
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: t("msgEmptyHint") }),
3755
+ filter === "unread" && snapshot.items.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3756
+ type: "button",
3757
+ className: "center-announcement-action",
3758
+ onClick: () => setFilter("all"),
3759
+ children: t("msgFilterAll")
3760
+ })
3761
+ ]
3762
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
3763
+ className: "center-announcements-list",
3764
+ children: shown.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnnouncementCard, {
3765
+ item,
3766
+ open: open.has(item.id),
3767
+ t,
3768
+ onToggle: () => toggle(item.id),
3769
+ onRead: () => {
3770
+ store.markRead(item.id);
3771
+ }
3772
+ }, item.id))
3773
+ })]
3774
+ });
3775
+ }
3776
+ //#endregion
3777
+ //#region src/client/announcement-store.ts
3778
+ /** The page's own route. Kept beside the Host's constant, and asserted equal in the Host's test. */
3779
+ const ANNOUNCEMENTS_ROUTE = "/api/dsh-vibedev/announcements";
3780
+ /**
3781
+ * The receipt route. A Host Fetch route owns one exact pathname, so the id travels in the body
3782
+ * rather than in a `:id` segment.
3783
+ */
3784
+ const ANNOUNCEMENTS_READ_ROUTE = `${ANNOUNCEMENTS_ROUTE}/read`;
3785
+ /** Popup ids the person waved away, so 「稍后」 means later, not every launch. */
3786
+ const DISMISSED_KEY = "vibedev.announcements.dismissed";
3787
+ /** The badge is worth a refresh every few minutes; nobody needs it faster than that. */
3788
+ const POLL_MS = 3e5;
3789
+ const EMPTY = {
3790
+ available: false,
3791
+ loaded: false,
3792
+ items: [],
3793
+ unread: 0
3794
+ };
3795
+ const isUnread = (item) => item.readAt === null;
3796
+ /**
3797
+ * Read one answer of the Host route.
3798
+ * @param value - the parsed body.
3799
+ * @returns the snapshot it describes, or undefined when the body is not one.
3800
+ */
3801
+ function readSnapshot(value) {
3802
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
3803
+ const body = value;
3804
+ if (typeof body.available !== "boolean" || !Array.isArray(body.items)) return void 0;
3805
+ const items = body.items.filter((item) => {
3806
+ if (typeof item !== "object" || item === null) return false;
3807
+ const entry = item;
3808
+ return typeof entry.id === "number" && typeof entry.title === "string" && typeof entry.content === "string" && typeof entry.createdAt === "string" && (entry.readAt === null || typeof entry.readAt === "string");
3809
+ });
3810
+ return {
3811
+ available: body.available,
3812
+ loaded: true,
3813
+ items,
3814
+ unread: items.filter(isUnread).length
3815
+ };
3816
+ }
3817
+ /**
3818
+ * The mailbox.
3819
+ */
3820
+ var AnnouncementStore = class {
3821
+ options;
3822
+ snapshot = EMPTY;
3823
+ listeners = /* @__PURE__ */ new Set();
3824
+ timer;
3825
+ /** Dialogs shown in this launch, so one announcement cannot interrupt twice. */
3826
+ shown = /* @__PURE__ */ new Set();
3827
+ pending;
3828
+ constructor(options = {}) {
3829
+ this.options = options;
3830
+ }
3831
+ /** @returns the current snapshot; stable between changes, as useSyncExternalStore requires. */
3832
+ getSnapshot = () => this.snapshot;
3833
+ /**
3834
+ * @param listener - called after every change.
3835
+ * @returns unsubscribe.
3836
+ */
3837
+ subscribe = (listener) => {
3838
+ this.listeners.add(listener);
3839
+ return () => {
3840
+ this.listeners.delete(listener);
3841
+ };
3842
+ };
3843
+ /** Poll now, then every five minutes and whenever the window comes back. */
3844
+ start() {
3845
+ this.refresh();
3846
+ if (this.timer !== void 0) return;
3847
+ this.timer = setInterval(() => {
3848
+ this.refresh();
3849
+ }, POLL_MS);
3850
+ visibilityHost()?.addEventListener("visibilitychange", this.onVisible);
3851
+ }
3852
+ /** Stop polling. */
3853
+ stop() {
3854
+ if (this.timer !== void 0) clearInterval(this.timer);
3855
+ this.timer = void 0;
3856
+ visibilityHost()?.removeEventListener("visibilitychange", this.onVisible);
3857
+ }
3858
+ onVisible = () => {
3859
+ if (visibilityHost()?.visibilityState === "visible") this.refresh();
3860
+ };
3861
+ /**
3862
+ * Read the list once. Two callers in the same tick share one request.
3863
+ * @returns nothing; failures leave the last snapshot alone so a blip does not blank the page.
3864
+ */
3865
+ async refresh() {
3866
+ if (this.pending !== void 0) return this.pending;
3867
+ this.pending = (async () => {
3868
+ try {
3869
+ const response = await (this.options.fetch ?? globalThis.fetch)(ANNOUNCEMENTS_ROUTE, { headers: { accept: "application/json" } });
3870
+ if (response.status === 404 || response.status === 405) {
3871
+ this.set({
3872
+ available: false,
3873
+ loaded: true,
3874
+ items: [],
3875
+ unread: 0
3876
+ });
3877
+ return;
3878
+ }
3879
+ if (!response.ok) return;
3880
+ const next = readSnapshot(await response.json());
3881
+ if (next !== void 0) this.set(next);
3882
+ } catch {} finally {
3883
+ this.pending = void 0;
3884
+ }
3885
+ })();
3886
+ return this.pending;
3887
+ }
3888
+ /**
3889
+ * Record that a person read one message. Optimistic, and put back on a failed receipt.
3890
+ * @param id - the announcement.
3891
+ * @returns whether the gateway kept the receipt.
3892
+ */
3893
+ async markRead(id) {
3894
+ const before = this.snapshot;
3895
+ const target = before.items.find((item) => item.id === id);
3896
+ if (target === void 0 || !isUnread(target)) return true;
3897
+ const readAt = new Date(this.options.now?.() ?? Date.now()).toISOString();
3898
+ this.set({
3899
+ ...before,
3900
+ items: before.items.map((item) => item.id === id ? {
3901
+ ...item,
3902
+ readAt
3903
+ } : item),
3904
+ unread: Math.max(0, before.unread - 1)
3905
+ });
3906
+ try {
3907
+ const response = await (this.options.fetch ?? globalThis.fetch)(ANNOUNCEMENTS_READ_ROUTE, {
3908
+ method: "POST",
3909
+ headers: { "content-type": "application/json" },
3910
+ body: JSON.stringify({ id })
3911
+ });
3912
+ if (!response.ok) {
3913
+ this.set(before);
3914
+ return false;
3915
+ }
3916
+ if ((await response.json().catch(() => void 0))?.ok === false) {
3917
+ this.set(before);
3918
+ return false;
3919
+ }
3920
+ return true;
3921
+ } catch {
3922
+ this.set(before);
3923
+ return false;
3924
+ }
3925
+ }
3926
+ /**
3927
+ * The announcement that may interrupt this launch, if any.
3928
+ * @returns the message to show once, or undefined when nothing deserves a dialog.
3929
+ */
3930
+ takePopup() {
3931
+ const dismissed = this.dismissed();
3932
+ const found = this.snapshot.items.find((item) => item.notifyMode === "popup" && isUnread(item) && !this.shown.has(item.id) && !dismissed.has(item.id));
3933
+ if (found !== void 0) this.shown.add(found.id);
3934
+ return found;
3935
+ }
3936
+ /**
3937
+ * Remember that a person waved a dialog away, so it does not come back on the next launch.
3938
+ * @param id - the announcement whose dialog was dismissed.
3939
+ */
3940
+ dismissPopup(id) {
3941
+ this.shown.add(id);
3942
+ const storage = this.options.storage ?? browserStorage$1();
3943
+ if (storage === void 0) return;
3944
+ try {
3945
+ const next = [...this.dismissed(), id];
3946
+ storage.setItem(DISMISSED_KEY, JSON.stringify(next.slice(-200)));
3947
+ } catch {}
3948
+ }
3949
+ dismissed() {
3950
+ const storage = this.options.storage ?? browserStorage$1();
3951
+ if (storage === void 0) return /* @__PURE__ */ new Set();
3952
+ try {
3953
+ const raw = storage.getItem(DISMISSED_KEY);
3954
+ const parsed = raw === null ? [] : JSON.parse(raw);
3955
+ return new Set(Array.isArray(parsed) ? parsed.filter((id) => typeof id === "number") : []);
3956
+ } catch {
3957
+ return /* @__PURE__ */ new Set();
3958
+ }
3959
+ }
3960
+ set(next) {
3961
+ this.snapshot = next;
3962
+ for (const listener of this.listeners) listener();
3963
+ }
3964
+ };
3965
+ /**
3966
+ * A mailbox that is never started and never answers: what a host without announcements, a test and the preview read.
3967
+ * It is one instance, so two components that fall back to it still see one snapshot.
3968
+ */
3969
+ const NO_MAILBOX = new AnnouncementStore({ fetch: () => Promise.resolve(new Response(null, { status: 404 })) });
3970
+ /** The renderer's storage, when there is one (tests and the Host run without it). */
3971
+ function browserStorage$1() {
3972
+ try {
3973
+ return globalThis.localStorage;
3974
+ } catch {
3975
+ return;
3976
+ }
3977
+ }
3978
+ /** The renderer's document, typed here because the Host build has no DOM lib. */
3979
+ function visibilityHost() {
3980
+ return globalThis.document;
3981
+ }
3982
+ //#endregion
3538
3983
  //#region src/client/AccountCenter/center-queries.ts
3539
3984
  function usagePaths(range, filters, page, pageSize, sortBy, sortOrder) {
3540
3985
  const { granularity, ...dates } = range;
@@ -13201,12 +13646,23 @@ window.__ModuleLoader__.load({
13201
13646
  ["orders", "centerOrders"],
13202
13647
  ["redeem", "centerRedeem"],
13203
13648
  ["affiliate", "centerAffiliate"],
13204
- ["profile", "centerProfile"]
13649
+ ["profile", "centerProfile"],
13650
+ ["messages", "centerMessages"]
13205
13651
  ];
13206
13652
  function AccountCenterIcon({ size = 16 }) {
13207
13653
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconUserOutlineMedium, { size });
13208
13654
  }
13209
13655
  function PageIcon({ page }) {
13656
+ if (page === "messages") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
13657
+ viewBox: "0 0 20 20",
13658
+ width: "16",
13659
+ height: "16",
13660
+ fill: "none",
13661
+ stroke: "currentColor",
13662
+ strokeWidth: "1.5",
13663
+ "aria-hidden": "true",
13664
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5.6 8.4a4.4 4.4 0 0 1 8.8 0c0 3.2 1.2 4.4 1.2 4.4H4.4s1.2-1.2 1.2-4.4Z" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8.4 15.4a1.7 1.7 0 0 0 3.2 0" })]
13665
+ });
13210
13666
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
13211
13667
  viewBox: "0 0 20 20",
13212
13668
  width: "16",
@@ -13254,7 +13710,7 @@ window.__ModuleLoader__.load({
13254
13710
  });
13255
13711
  }
13256
13712
  /** Native pages and explicitly labeled website actions share the same identity. */
13257
- function AccountCenter({ store, t = (key) => zh[key], embedded = false }) {
13713
+ function AccountCenter({ store, announcements = NO_MAILBOX, t = (key) => zh[key], embedded = false }) {
13258
13714
  const [menuOpen, setMenuOpen] = (0, react.useState)(false);
13259
13715
  const account = (0, react.useSyncExternalStore)(store.subscribe, store.getSnapshot, store.getSnapshot);
13260
13716
  const [page, setPage] = (0, react.useState)(() => normalizeAccountPage(account.accountCenterPage?.page ?? "dashboard"));
@@ -13438,6 +13894,10 @@ window.__ModuleLoader__.load({
13438
13894
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(CenterWebContext.Provider, {
13439
13895
  value: openWeb,
13440
13896
  children: [
13897
+ page === "messages" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnnouncementsPage, {
13898
+ store: announcements,
13899
+ t
13900
+ }),
13441
13901
  page === "dashboard" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dashboard, {
13442
13902
  store,
13443
13903
  view: account.view,