@deepseek-ai/dsh-client-ui-account-notifications 0.0.0-stage → 0.2.2-rc.2
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/LICENSE +21 -0
- package/README.i18n.yaml +31 -0
- package/README.md +56 -2
- package/README.zh.md +57 -0
- package/lib/client.js +3 -0
- package/lib/client.js.map +1 -0
- package/lib/index.js +21 -0
- package/lib/types/client/AccountNotifications.d.ts +40 -0
- package/lib/types/client/AccountNotifications.d.ts.map +1 -0
- package/lib/types/client/AccountNotifications.js.map +1 -0
- package/lib/types/client/index.d.ts +8 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/index.js.map +1 -0
- package/lib/types/client/locales.d.ts +35 -0
- package/lib/types/client/locales.d.ts.map +1 -0
- package/lib/types/client/locales.js.map +1 -0
- package/lib/types/client/notice-transition.d.ts +7 -0
- package/lib/types/client/notice-transition.d.ts.map +1 -0
- package/lib/types/client/notice-transition.js.map +1 -0
- package/lib/types/client/notification-controller.d.ts +81 -0
- package/lib/types/client/notification-controller.d.ts.map +1 -0
- package/lib/types/client/notification-controller.js.map +1 -0
- package/lib/types/config.d.ts +16 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/index.d.ts +7 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js.map +1 -0
- package/locale/de.json +5 -0
- package/locale/en.json +5 -0
- package/locale/es.json +5 -0
- package/locale/fr.json +5 -0
- package/locale/ja.json +5 -0
- package/locale/pt.json +5 -0
- package/locale/ru.json +5 -0
- package/locale/zh.json +5 -0
- package/package.json +71 -3
- package/src/client/AccountNotifications.module.css +14 -0
- package/src/client/AccountNotifications.tsx +175 -0
- package/src/client/index.ts +68 -0
- package/src/client/locales.ts +18 -0
- package/src/client/notice-transition.ts +34 -0
- package/src/client/notification-controller.ts +248 -0
- package/src/config.ts +14 -0
- package/src/css-modules.d.ts +6 -0
- package/src/index.ts +12 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.i18n.yaml
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
|
|
2
|
+
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
|
|
3
|
+
# After editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/client/ui-account-notifications/README.md
|
|
5
|
+
/:
|
|
6
|
+
en: 46ed0081fc307e5d
|
|
7
|
+
zh: d9ed06af27b3cb29
|
|
8
|
+
/deepseek-ai-dsh-client-ui-account-notifications:
|
|
9
|
+
en: c8d24427c7fcd3aa
|
|
10
|
+
zh: 5c0cf16f36ae6165
|
|
11
|
+
/deepseek-ai-dsh-client-ui-account-notifications/summary:
|
|
12
|
+
en: 46cf31a87b0b765c
|
|
13
|
+
zh: 04f6b33570b046f7
|
|
14
|
+
/deepseek-ai-dsh-client-ui-account-notifications/table-of-contents:
|
|
15
|
+
en: af856ba79fe31b8e
|
|
16
|
+
zh: c9b0188689359236
|
|
17
|
+
/deepseek-ai-dsh-client-ui-account-notifications/use-this-package:
|
|
18
|
+
en: c466836df88d4ae1
|
|
19
|
+
zh: 036e859139daa51d
|
|
20
|
+
/deepseek-ai-dsh-client-ui-account-notifications/model-experience:
|
|
21
|
+
en: 5fed5504300020e6
|
|
22
|
+
zh: efd8e7c32b699e7e
|
|
23
|
+
/deepseek-ai-dsh-client-ui-account-notifications/model-experience/kv-cache-effect:
|
|
24
|
+
en: ca3015e252db0114
|
|
25
|
+
zh: fb634b5b32d09f37
|
|
26
|
+
/deepseek-ai-dsh-client-ui-account-notifications/known-limitations-and-deferred-work:
|
|
27
|
+
en: 0d59eea475321fd0
|
|
28
|
+
zh: 1cf67a196e76b832
|
|
29
|
+
/deepseek-ai-dsh-client-ui-account-notifications/known-limitations-and-deferred-work/dev-note:
|
|
30
|
+
en: 64006edb418180b1
|
|
31
|
+
zh: 12f7d7ab2cbccd43
|
package/README.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: "Display account notifications and refresh their localized content."
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
# @deepseek-ai/dsh-client-ui-account-notifications
|
|
7
|
+
|
|
8
|
+
English | [中文](README.zh.md)
|
|
9
|
+
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
Show server-authored account notifications beside the account menu. Displayed cards survive later list omissions and refresh their content when the interface language changes.
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Use this package](#use-this-package)
|
|
17
|
+
- [Model Experience](#model-experience)
|
|
18
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
19
|
+
|
|
20
|
+
<a id="use-this-package"></a>
|
|
21
|
+
## Use this package
|
|
22
|
+
|
|
23
|
+
The Web bundle includes this plugin with [account settings](../ui-settings-account/README.md). It contributes to `settings.launcher.notifications`; the account menu supplies visibility and the action that opens Account settings. The notification plugin owns cards, polling, localized content, and interaction reports.
|
|
24
|
+
|
|
25
|
+
Startup with a stored account, sign-in, and each Settings entry start a new polling cycle with an immediate request. `notificationPollIntervalMs` on the `ui-account-notifications` row supplies the initial delay, defaulting to 600,000 ms. A successful list response replaces it with `next_poll_after` seconds, including empty lists. The delay starts after the request settles; failures retain the latest delay, and restarting restores the configured initial value. Polling continues in the background.
|
|
26
|
+
|
|
27
|
+
Account settings owns the sole account stream and exposes its current state and lifecycle events through `accountUi` and `account-ui/change`. Login-progress updates retain cards and polling. Credential replacement, disconnection, access revocation, sign-out, and plugin disposal clear cards, stop polling, and discard late replies. Notification requests do not wait for profile or avatar data. Notification state is not stored in the browser.
|
|
28
|
+
|
|
29
|
+
Cards render inside the sidebar above the account launcher and below menus and dialogs without taking focus. Their width follows the expanded launcher up to 280px, leaving 10px on the left and at least 10px on the right. Collapsing the sidebar hides the cards; expanding it restores them without another display report. Closing a card promotes the next with a 250ms position and scale transition, disabled by reduced-motion preferences.
|
|
30
|
+
|
|
31
|
+
Notifications wait for Desktop and model-credential onboarding to finish. Only the foreground card is interactive and reports `displayed`, once per mount after a painted frame while it intersects the viewport and the sidebar and document are visible. The Settings overlay does not exclude that frame. A displayed foreground card remains until close or expiry even when a later list omits it; waiting cards follow server order.
|
|
32
|
+
|
|
33
|
+
Each card uses the server's plain-text title, body, and ordered primary or secondary buttons. Every non-dismiss action reports `cta_clicked` with the notification ID, executes immediately, and retains the card; the account action opens Account settings. Closing through the close button or a dismiss action reports only `dismissed` as the card is removed, before the next card moves into place. Closing before the first painted frame does not report `displayed`. Expiry and account cleanup do not report dismissal. Click reports contain no action ID or target.
|
|
34
|
+
|
|
35
|
+
Each interaction is reported once without waiting or retrying; either boolean acknowledgement completes that attempt. A failed report logs a diagnostic without an account UI error or undoing the interaction. The server owns consumption: a later list may offer a closed card again. List failures keep the current cards.
|
|
36
|
+
|
|
37
|
+
Switching language requests current cards through the content endpoint, including consumed cards, without another list query or display report. Content updates preserve card identity, order, and focus. Failed reads retain the previous text and log a diagnostic; replies for an older language, signed-out account, or closed card cannot restore stale content.
|
|
38
|
+
|
|
39
|
+
<a id="model-experience"></a>
|
|
40
|
+
## Model Experience
|
|
41
|
+
|
|
42
|
+
None, as notifications remain client presentation data and never enter model requests or Session logs.
|
|
43
|
+
|
|
44
|
+
#### KV Cache effect
|
|
45
|
+
|
|
46
|
+
No model request prefix changes.
|
|
47
|
+
|
|
48
|
+
## Known Limitations and Deferred Work
|
|
49
|
+
|
|
50
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
51
|
+
|
|
52
|
+
- Cards retain the existing expiry and foreground-retention behavior. Server copy is plain text; supported actions dismiss the card or open Account settings. Network failures keep current cards and resume on the next poll.
|
|
53
|
+
|
|
54
|
+
<a id="dev-note"></a>
|
|
55
|
+
### Dev Note
|
|
56
|
+
|
|
57
|
+
The package tests cover lifecycle ownership; the Web notification scenario checks the assembled account menu.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "展示账号通知并刷新本地化内容。"
|
|
3
|
+
kind: "package-reference"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @deepseek-ai/dsh-client-ui-account-notifications
|
|
7
|
+
|
|
8
|
+
[English](README.md) | 中文
|
|
9
|
+
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
在账号菜单旁展示服务端提供的账号通知。已展示卡片不会因后续列表省略而消失,并在界面语言切换时刷新内容。
|
|
13
|
+
|
|
14
|
+
## 目录
|
|
15
|
+
|
|
16
|
+
- [使用此包](#use-this-package)
|
|
17
|
+
- [模型体验](#model-experience)
|
|
18
|
+
- [已知限制与待办](#known-limitations-and-deferred-work)
|
|
19
|
+
|
|
20
|
+
<a id="use-this-package"></a>
|
|
21
|
+
## 使用此包
|
|
22
|
+
|
|
23
|
+
Web 组合将本插件与[账号设置](../ui-settings-account/README.zh.md)一同加载。本插件向 `settings.launcher.notifications` 注册内容;账号菜单提供可见性和打开账号设置的操作。通知插件负责卡片、轮询、本地化内容和交互上报。
|
|
24
|
+
|
|
25
|
+
带有已存账号的启动、登录及每次进入设置页都会启动新一轮轮询,并立即请求。`ui-account-notifications` 行中的 `notificationPollIntervalMs` 提供初始间隔,默认 600,000 ms。成功的列表响应通过 `next_poll_after` 秒替换间隔,空列表也相同。从请求结束时开始计时;失败沿用最近间隔,重启轮询恢复配置的初始值。轮询在后台继续。
|
|
26
|
+
|
|
27
|
+
账号设置拥有唯一的账号流,通过 `accountUi` 和 `account-ui/change` 提供当前状态及生命周期事件。登录进度更新沿用卡片和轮询。凭据替换、断连、权限撤销、退出登录和插件卸载会清空卡片、停止轮询并丢弃迟到响应。通知请求不等待资料或头像。通知状态不写入浏览器存储。
|
|
28
|
+
|
|
29
|
+
卡片在侧栏内部、账号入口上方渲染,位于菜单和对话框之下,不抢占焦点。宽度跟随展开的账号入口,最大为 280px,左侧留 10px、右侧至少留 10px。收起侧栏会隐藏卡片;展开后恢复卡片,不重复上报展示。关闭卡片后,下一张通过 250ms 的位置和缩放过渡补位;偏好减少动态效果时禁用过渡。
|
|
30
|
+
|
|
31
|
+
通知等待 Desktop 和模型凭据引导完成。只有前排卡片可交互并上报 `displayed`:卡片与视口相交、侧栏和文档可见并完成一帧绘制后,同一次挂载只上报一次。设置蒙层不排除该帧。已展示的前排卡片保留至关闭或过期,即使后续列表不再返回它;待展示卡片遵循服务端顺序。
|
|
32
|
+
|
|
33
|
+
每张卡片使用服务端纯文本标题、正文和有序的主要或次要按钮。所有非 dismiss 操作都携带通知 ID 上报 `cta_clicked`,立即执行并保留卡片;账号操作会打开账号设置。通过关闭按钮或 dismiss 操作关闭时,在移除卡片、下一张开始补位前只上报 `dismissed`。首帧绘制前关闭不会补报 `displayed`。过期和账号清理不上报关闭。点击上报不携带 action ID 或 target。
|
|
34
|
+
|
|
35
|
+
每次交互只上报一次,不等待、不重试;任一布尔确认结果都会结束本次尝试。上报失败会记录诊断日志,不在账号界面报错,也不撤销交互。消费状态由服务端决定:后续列表可能再次返回已关闭的卡片。列表失败保留当前卡片。
|
|
36
|
+
|
|
37
|
+
切换语言通过内容接口请求当前卡片,支持已消费通知,不重新查询列表或上报展示。内容更新保留卡片身份、顺序和焦点。读取失败保留原文并记录诊断日志;旧语言、已退登账号或已关闭卡片的响应不会恢复过时内容。
|
|
38
|
+
|
|
39
|
+
<a id="model-experience"></a>
|
|
40
|
+
## 模型体验
|
|
41
|
+
|
|
42
|
+
无,通知属于客户端展示数据,不进入模型请求或 Session 日志。
|
|
43
|
+
|
|
44
|
+
#### KV 缓存影响
|
|
45
|
+
|
|
46
|
+
模型请求前缀不变。
|
|
47
|
+
|
|
48
|
+
## 已知限制与待办
|
|
49
|
+
|
|
50
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
51
|
+
|
|
52
|
+
- 卡片保留现有的过期与前排保留行为。服务端文案使用纯文本;支持的操作为关闭卡片或打开账号设置。网络失败保留当前卡片,并在下次轮询时继续。
|
|
53
|
+
|
|
54
|
+
<a id="dev-note"></a>
|
|
55
|
+
### 开发备注
|
|
56
|
+
|
|
57
|
+
包内测试覆盖生命周期所有权;Web 通知场景验证组合后的账号菜单。
|
package/lib/client.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
window.__ModuleLoader__.load({id:`@deepseek-ai/dsh-client-ui-account-notifications`,factory:require=>{var module={exports:{}};var exports=module.exports;Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let react_jsx_runtime=require("react/jsx-runtime");let react=require("react");let _deepseek_ai_dsh_client_ui_primitives=require("@deepseek-ai/dsh-client-ui-primitives");let react_dom=require("react-dom");function isNullable(value){return value===null||value===void 0}function isPlainObject(data){return data&&typeof data===`object`&&!Array.isArray(data)}function filterKeys(object,filter){return Object.fromEntries(Object.entries(object).filter(([key,value])=>filter(key,value)))}function mapValues(object,transform){return Object.fromEntries(Object.entries(object).map(([key,value])=>[key,transform(value,key)]))}function pick(source,keys,forced){if(!keys)return{...source};const result={};for(const key of keys)if(forced||source[key]!==void 0)result[key]=source[key];return result}const write=Symbol.for(`cosmokit.volatile.write`);function snapshot(value,ancestors=new Set){if(typeof value===`function`)throw new TypeError(`volatile config cannot contain functions`);if(value===null||typeof value!==`object`)return value;if(ancestors.has(value))throw new TypeError(`volatile config cannot contain cycles`);ancestors.add(value);try{if(Array.isArray(value))return Object.freeze(value.map(item=>snapshot(item,ancestors)));if(Object.getPrototypeOf(value)!==Object.prototype&&Object.getPrototypeOf(value)!==null)throw new TypeError(`volatile config objects must be plain objects or arrays`);return Object.freeze(Object.fromEntries(Object.entries(value).map(([key,item])=>[key,snapshot(item,ancestors)])))}finally{ancestors.delete(value)}}function createVolatile(value){let current=snapshot(value);return Object.freeze({get:()=>current,[write]:value=>{current=value}})}function isVolatile(value){return typeof value===`object`&&value!==null&&write in value}function is(type,value){if(arguments.length===1)return value=>is(type,value);return type in globalThis&&value instanceof globalThis[type]||Object.prototype.toString.call(value).slice(8,-1)===type}function isArrayBufferLike(value){return is(`ArrayBuffer`,value)||is(`SharedArrayBuffer`,value)}function isArrayBufferSource(value){return isArrayBufferLike(value)||ArrayBuffer.isView(value)}let Binary;(function(_Binary){_Binary.is=isArrayBufferLike;_Binary.isSource=isArrayBufferSource;function fromSource(source){if(ArrayBuffer.isView(source))return source.buffer.slice(source.byteOffset,source.byteOffset+source.byteLength);else return source}_Binary.fromSource=fromSource;function toBase64(source){source=fromSource(source);if(typeof Buffer!==`undefined`)return Buffer.from(source).toString(`base64`);let binary=``;const bytes=new Uint8Array(source);for(let i=0;i<bytes.byteLength;i++)binary+=String.fromCharCode(bytes[i]);return btoa(binary)}_Binary.toBase64=toBase64;function fromBase64(source){if(typeof Buffer!==`undefined`)return fromSource(Buffer.from(source,`base64`));return Uint8Array.from(atob(source),c=>c.charCodeAt(0))}_Binary.fromBase64=fromBase64;function toHex(source){source=fromSource(source);if(typeof Buffer!==`undefined`)return Buffer.from(source).toString(`hex`);return Array.from(new Uint8Array(source),byte=>byte.toString(16).padStart(2,`0`)).join(``)}_Binary.toHex=toHex;function fromHex(source){if(typeof Buffer!==`undefined`)return fromSource(Buffer.from(source,`hex`));const hex=source.length%2===0?source:source.slice(0,source.length-1);const buffer=[];for(let i=0;i<hex.length;i+=2)buffer.push(parseInt(`${hex[i]}${hex[i+1]}`,16));return Uint8Array.from(buffer).buffer}_Binary.fromHex=fromHex})(Binary||(Binary={}));const base64ToArrayBuffer=Binary.fromBase64;const arrayBufferToBase64=Binary.toBase64;const hexToArrayBuffer=Binary.fromHex;const arrayBufferToHex=Binary.toHex;function clone(source,refs=new Map){if(!source||typeof source!==`object`)return source;if(is(`Date`,source))return new Date(source.valueOf());if(is(`RegExp`,source))return new RegExp(source.source,source.flags);if(isArrayBufferLike(source))return source.slice(0);if(ArrayBuffer.isView(source))return source.buffer.slice(source.byteOffset,source.byteOffset+source.byteLength);const cached=refs.get(source);if(cached)return cached;if(Array.isArray(source)){const result=[];refs.set(source,result);source.forEach((value,index)=>{result[index]=Reflect.apply(clone,null,[value,refs])});return result}const result=Object.create(Object.getPrototypeOf(source));refs.set(source,result);for(const key of Reflect.ownKeys(source)){const descriptor={...Reflect.getOwnPropertyDescriptor(source,key)};if(`value`in descriptor)descriptor.value=Reflect.apply(clone,null,[descriptor.value,refs]);Reflect.defineProperty(result,key,descriptor)}return result}function deepEqual(a,b,strict){const ancestors=new Set;function compare(a,b){if(a===b)return true;if(isVolatile(a)||isVolatile(b))return isVolatile(a)&&isVolatile(b);if(!strict&&isNullable(a)&&isNullable(b))return true;if(typeof a!==typeof b||typeof a!==`object`||!a||!b)return false;if(ancestors.has(a))return false;function check(test,then){return test(a)?test(b)?then(a,b):false:test(b)?false:void 0}ancestors.add(a);try{return check(Array.isArray,(a,b)=>{if(a.length!==b.length)return false;for(let index=0;index<a.length;index++)if(!compare(a[index],b[index]))return false;return true})??check(is(`Date`),(a,b)=>a.valueOf()===b.valueOf())??check(is(`URL`),(a,b)=>a.href===b.href)??check(is(`RegExp`),(a,b)=>a.source===b.source&&a.flags===b.flags)??check(isArrayBufferLike,(a,b)=>{if(a.byteLength!==b.byteLength)return false;const viewA=new Uint8Array(a);const viewB=new Uint8Array(b);for(let i=0;i<viewA.length;i++)if(viewA[i]!==viewB[i])return false;return true})??((!strict||[a,b].every(value=>Object.getPrototypeOf(value)===Object.prototype||Object.getPrototypeOf(value)===null))&&Object.keys({...a,...b}).every(key=>compare(a[key],b[key])))}finally{ancestors.delete(a)}}return compare(a,b)}let Time;(function(_Time){_Time.millisecond=1;const second=_Time.second=1e3;const minute=_Time.minute=second*60;const hour=_Time.hour=minute*60;const day=_Time.day=hour*24;const week=_Time.week=day*7;let timezoneOffset=new Date().getTimezoneOffset();function setTimezoneOffset(offset){timezoneOffset=offset}_Time.setTimezoneOffset=setTimezoneOffset;function getTimezoneOffset(){return timezoneOffset}_Time.getTimezoneOffset=getTimezoneOffset;function getDateNumber(date=new Date,offset){if(typeof date===`number`)date=new Date(date);if(offset===void 0)offset=timezoneOffset;return Math.floor((date.valueOf()/minute-offset)/1440)}_Time.getDateNumber=getDateNumber;function fromDateNumber(value,offset){const date=new Date(value*day);if(offset===void 0)offset=timezoneOffset;return new Date(+date+offset*minute)}_Time.fromDateNumber=fromDateNumber;const numeric=/\d+(?:\.\d+)?/.source;const timeRegExp=new RegExp(`^${[`w(?:eek(?:s)?)?`,`d(?:ay(?:s)?)?`,`h(?:our(?:s)?)?`,`m(?:in(?:ute)?(?:s)?)?`,`s(?:ec(?:ond)?(?:s)?)?`].map(unit=>`(${numeric}${unit})?`).join(``)}$`);function parseTime(source){const capture=timeRegExp.exec(source);if(!capture)return 0;return(parseFloat(capture[1])*week||0)+(parseFloat(capture[2])*day||0)+(parseFloat(capture[3])*hour||0)+(parseFloat(capture[4])*minute||0)+(parseFloat(capture[5])*second||0)}_Time.parseTime=parseTime;function parseDate(date){const parsed=parseTime(date);if(parsed)date=Date.now()+parsed;else if(/^\d{1,2}(:\d{1,2}){1,2}$/.test(date))date=`${new Date().toLocaleDateString()}-${date}`;else if(/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(date))date=`${new Date().getFullYear()}-${date}`;return date?new Date(date):new Date}_Time.parseDate=parseDate;function format(ms){const abs=Math.abs(ms);if(abs>=day-hour/2)return Math.round(ms/day)+`d`;else if(abs>=hour-minute/2)return Math.round(ms/hour)+`h`;else if(abs>=minute-second/2)return Math.round(ms/minute)+`m`;else if(abs>=second)return Math.round(ms/second)+`s`;return ms+`ms`}_Time.format=format;function toDigits(source,length=2){return source.toString().padStart(length,`0`)}_Time.toDigits=toDigits;function template(template,time=new Date){return template.replace(`yyyy`,time.getFullYear().toString()).replace(`yy`,time.getFullYear().toString().slice(2)).replace(`MM`,toDigits(time.getMonth()+1)).replace(`dd`,toDigits(time.getDate())).replace(`hh`,toDigits(time.getHours())).replace(`mm`,toDigits(time.getMinutes())).replace(`ss`,toDigits(time.getSeconds())).replace(`SSS`,toDigits(time.getMilliseconds(),3))}_Time.template=template})(Time||(Time={}));const kSchema=Symbol.for(`schemastery`);const kValidationError=Symbol.for(`ValidationError`);globalThis.__schemastery_index__??=0;globalThis.__schemastery_refs__=void 0;var ValidationError=class extends TypeError{options;name=`ValidationError`;constructor(message,options){let prefix=`$`;for(const segment of options.path||[])if(typeof segment===`string`)prefix+=`.`+segment;else if(typeof segment===`number`)prefix+=`[`+segment+`]`;else if(typeof segment===`symbol`)prefix+=`[Symbol(${segment.toString()})]`;if(prefix.startsWith(`.`))prefix=prefix.slice(1);super((prefix===`$`?``:`${prefix} `)+message);this.options=options}static is(error){return!!error?.[kValidationError]}};Object.defineProperty(ValidationError.prototype,kValidationError,{value:true});const Schema=function(options){const schema=function(data,options={}){return Schema.resolve(data,schema,options)[0]};if(options.refs){const refs=mapValues(options.refs,options=>new Schema(options));const getRef=uid=>refs[uid];for(const key in refs){const options=refs[key];options.sKey=getRef(options.sKey);options.inner=getRef(options.inner);options.list=options.list&&options.list.map(getRef);options.dict=options.dict&&mapValues(options.dict,getRef)}return refs[options.uid]}Object.assign(schema,options);if(typeof schema.callback===`string`)try{schema.callback=new Function(`return `+schema.callback)()}catch{}Object.defineProperty(schema,"uid",{value:globalThis.__schemastery_index__++});Object.setPrototypeOf(schema,Schema.prototype);schema.meta||={};schema.toString=schema.toString.bind(schema);return schema};Schema.prototype=Object.create(Function.prototype);Schema.prototype[kSchema]=true;Object.defineProperty(Schema.prototype,"~standard",{get(){return{version:1,vendor:`schemastery`,validate:value=>{try{return{value:Schema.resolve(value,this,{})[0]}}catch(error){if(ValidationError.is(error))return{issues:[{message:error.message,path:error.options.path}]};throw error}}}}});Schema.ValidationError=ValidationError;Schema.prototype.toJSON=function toJSON(){if(globalThis.__schemastery_refs__){globalThis.__schemastery_refs__[this.uid]??=JSON.parse(JSON.stringify({...this}));return this.uid}globalThis.__schemastery_refs__={[this.uid]:{...this}};globalThis.__schemastery_refs__[this.uid]=JSON.parse(JSON.stringify({...this}));const result={uid:this.uid,refs:globalThis.__schemastery_refs__};globalThis.__schemastery_refs__=void 0;return result};Schema.prototype.set=function set(key,value){this.dict[key]=value;return this};Schema.prototype.push=function push(value){this.list.push(value);return this};function mergeDesc(original,messages){const result=typeof original===`string`?{"":original}:{...original};for(const locale in messages){const value=messages[locale];if(value?.$description||value?.$desc)result[locale]=value.$description||value.$desc;else if(typeof value===`string`)result[locale]=value}return result}function getInner(value){return value?.$value??value?.$inner}function extractKeys(data){return filterKeys(data??{},key=>!key.startsWith(`$`))}Schema.prototype.i18n=function i18n(messages){const schema=Schema(this);const desc=mergeDesc(schema.meta.description,messages);if(Object.keys(desc).length)schema.meta.description=desc;if(schema.dict)schema.dict=mapValues(schema.dict,(inner,key)=>{return inner.i18n(mapValues(messages,data=>getInner(data)?.[key]??data?.[key]))});if(schema.list)schema.list=schema.list.map((inner,index)=>{return inner.i18n(mapValues(messages,(data={})=>{if(Array.isArray(getInner(data)))return getInner(data)[index];if(Array.isArray(data))return data[index];return extractKeys(data)}))});if(schema.inner)schema.inner=schema.inner.i18n(mapValues(messages,data=>{if(getInner(data))return getInner(data);return extractKeys(data)}));if(schema.sKey)schema.sKey=schema.sKey.i18n(mapValues(messages,data=>data?.$key));return schema};Schema.prototype.extra=function extra(key,value){const schema=Schema(this);schema.meta={...schema.meta,[key]:value};return schema};for(const key of[`required`,`disabled`,`collapse`,`hidden`,`loose`])Object.assign(Schema.prototype,{[key](value=true){const schema=Schema(this);schema.meta={...schema.meta,[key]:value};return schema}});Schema.prototype.deprecated=function deprecated(){const schema=Schema(this);schema.meta.badges||=[];schema.meta.badges.push({text:`deprecated`,type:`danger`});return schema};Schema.prototype.experimental=function experimental(){const schema=Schema(this);schema.meta.badges||=[];schema.meta.badges.push({text:`experimental`,type:`warning`});return schema};Schema.prototype.pattern=function pattern(regexp){const schema=Schema(this);const pattern=pick(regexp,[`source`,`flags`]);schema.meta={...schema.meta,pattern};return schema};Schema.prototype.simplify=function simplify(value){if(isVolatile(value))value=value.get();if(deepEqual(value,this.meta.default,this.type===`dict`))return null;if(isNullable(value))return value;if(this.type===`object`||this.type===`dict`){const result={};for(const key in value){const item=(this.type===`object`?this.dict[key]:this.inner)?.simplify(value[key]);if(this.type===`dict`||!isNullable(item))result[key]=item}if(deepEqual(result,this.meta.default,this.type===`dict`))return null;return result}else if(this.type===`array`||this.type===`tuple`){const result=[];value.forEach((value,index)=>{const schema=this.type===`array`?this.inner:this.list[index];const item=schema?schema.simplify(value):value;result.push(item)});return result}else if(this.type===`intersect`){const result={};for(const item of this.list)Object.assign(result,item.simplify(value));return result}else if(this.type===`union`)for(const schema of this.list)try{Schema.resolve(value,schema,{});return schema.simplify(value)}catch{}return value};Schema.prototype.toString=function toString(inline){return formatters[this.type]?.(this,inline)??`Schema<${this.type}>`};Schema.prototype.role=function role(role,extra){const schema=Schema(this);schema.meta={...schema.meta,role,extra};return schema};for(const key of[`default`,`link`,`comment`,`description`,`max`,`min`,`step`])Object.assign(Schema.prototype,{[key](value){const schema=Schema(this);schema.meta={...schema.meta,[key]:value};return schema}});Schema.prototype.volatile=function volatile(){if(this.meta.volatile)throw new TypeError(`volatile schema is already wrapped`);return this.extra(`volatile`,true)};const resolvers={};const checkedVolatile=Symbol(`checked-volatile-schema`);function validateVolatileSchema(schema,path=[],blocked=false,seen=new Map){const states=seen.get(schema)??new Set;if(states.has(blocked))return;states.add(blocked);seen.set(schema,states);if(schema.meta?.volatile&&blocked)throw new ValidationError(`volatile fields require a fixed object path without an enclosing volatile field`,{path});const nested=blocked||!!schema.meta?.volatile;if(schema.dict)for(const[key,child]of Object.entries(schema.dict))validateVolatileSchema(child,[...path,key],nested,seen);if(schema.sKey)validateVolatileSchema(schema.sKey,[...path,`<key>`],true,seen);if(schema.inner&&(schema.type!==`lazy`||schema.inner[kSchema]))validateVolatileSchema(schema.inner,[...path,`*`],true,seen);if(schema.list)for(let index=0;index<schema.list.length;index++)validateVolatileSchema(schema.list[index],[...path,String(index)],true,seen)}Schema.extend=function extend(type,resolve){resolvers[type]=resolve};Schema.resolve=function resolve(data,schema,options={},strict=false){if(!schema)return[data];if(!options[checkedVolatile]){validateVolatileSchema(schema,options.path);options={...options,[checkedVolatile]:true}}if(schema.meta?.volatile){const inner=Schema(schema);inner.meta={...schema.meta,volatile:false};const[value,adapted]=Schema.resolve(data,inner,options,strict);try{return[createVolatile(value),adapted]}catch(error){throw new ValidationError(error instanceof Error?error.message:String(error),options)}}if(options.ignore?.(data,schema))return[data];if(isNullable(data)&&schema.type!==`lazy`){if(schema.meta.required)throw new ValidationError(`missing required value`,options);let current=schema;let fallback=schema.meta.default;while(current?.type===`intersect`&&isNullable(fallback)){current=current.list[0];fallback=current?.meta.default}if(isNullable(fallback))return[data];data=clone(fallback)}const callback=resolvers[schema.type];if(!callback)throw new ValidationError(`unsupported type "${schema.type}"`,options);try{return callback(data,schema,options,strict)}catch(error){if(!schema.meta.loose)throw error;return[schema.meta.default]}};Schema.from=function from(source){if(isNullable(source))return Schema.any();else if([`string`,`number`,`boolean`].includes(typeof source))return Schema.const(source).required();else if(source[kSchema])return source;else if(typeof source===`function`)switch(source){case String:return Schema.string().required();case Number:return Schema.number().required();case Boolean:return Schema.boolean().required();case Function:return Schema.function().required();default:return Schema.is(source).required()}else throw new TypeError(`cannot infer schema from ${source}`)};Schema.lazy=function lazy(builder){const toJSON=()=>{if(!schema.inner[kSchema]){schema.inner=schema.builder();schema.inner.meta={...schema.meta,...schema.inner.meta}}return schema.inner.toJSON()};const schema=new Schema({type:`lazy`,builder,inner:{toJSON}});return schema};Schema.natural=function natural(){return Schema.number().step(1).min(0)};Schema.percent=function percent(){return Schema.number().step(.01).min(0).max(1).role(`slider`)};Schema.date=function date(){return Schema.union([Schema.is(Date),Schema.transform(Schema.string().role(`datetime`),(value,options)=>{const date=new Date(value);if(isNaN(+date))throw new ValidationError(`invalid date "${value}"`,options);return date},true)])};Schema.regExp=function regExp(flag=``){return Schema.union([Schema.is(RegExp),Schema.transform(Schema.string().role(`regexp`,{flag}),(value,options)=>{try{return new RegExp(value,flag)}catch(e){throw new ValidationError(e.message,options)}},true)])};Schema.arrayBuffer=function arrayBuffer(encoding){return Schema.union([Schema.is(ArrayBuffer),Schema.is(SharedArrayBuffer),Schema.transform(Schema.any(),(value,options)=>{if(Binary.isSource(value))return Binary.fromSource(value);throw new ValidationError(`expected ArrayBufferSource but got ${value}`,options)},true),...encoding?[Schema.transform(Schema.string(),(value,options)=>{try{return encoding===`base64`?Binary.fromBase64(value):Binary.fromHex(value)}catch(e){throw new ValidationError(e.message,options)}},true)]:[]])};Schema.extend(`lazy`,(data,schema,options,strict)=>{if(!schema.inner[kSchema]){schema.inner=schema.builder();schema.inner.meta={...schema.meta,...schema.inner.meta};validateVolatileSchema(schema.inner,options.path,true)}return Schema.resolve(data,schema.inner,options,strict)});Schema.extend(`any`,data=>{return[data]});Schema.extend(`never`,(data,_,options)=>{throw new ValidationError(`expected nullable but got ${data}`,options)});Schema.extend(`const`,(data,{value},options)=>{if(deepEqual(data,value))return[value];throw new ValidationError(`expected ${value} but got ${data}`,options)});function checkWithinRange(data,meta,description,options,skipMin=false){const{max=Infinity,min=-Infinity}=meta;if(data>max)throw new ValidationError(`expected ${description} <= ${max} but got ${data}`,options);if(data<min&&!skipMin)throw new ValidationError(`expected ${description} >= ${min} but got ${data}`,options)}Schema.extend(`string`,(data,{meta},options)=>{if(typeof data!==`string`)throw new ValidationError(`expected string but got ${data}`,options);if(meta.pattern){const regexp=new RegExp(meta.pattern.source,meta.pattern.flags);if(!regexp.test(data))throw new ValidationError(`expect string to match regexp ${regexp}`,options)}checkWithinRange(data.length,meta,`string length`,options);return[data]});function decimalShift(data,digits){const str=data.toString();if(str.includes(`e`))return data*Math.pow(10,digits);const index=str.indexOf(`.`);if(index===-1)return data*Math.pow(10,digits);const frac=str.slice(index+1);const integer=str.slice(0,index);if(frac.length<=digits)return+(integer+frac.padEnd(digits,`0`));return+(integer+frac.slice(0,digits)+`.`+frac.slice(digits))}function isMultipleOf(data,min,step){step=Math.abs(step);if(!/^\d+\.\d+$/.test(step.toString()))return(data-min)%step===0;const index=step.toString().indexOf(`.`);const digits=step.toString().slice(index+1).length;return Math.abs(decimalShift(data,digits)-decimalShift(min,digits))%decimalShift(step,digits)===0}Schema.extend(`number`,(data,{meta},options)=>{if(typeof data!==`number`)throw new ValidationError(`expected number but got ${data}`,options);checkWithinRange(data,meta,`number`,options);const{step}=meta;if(step&&!isMultipleOf(data,meta.min??0,step))throw new ValidationError(`expected number multiple of ${step} but got ${data}`,options);return[data]});Schema.extend(`boolean`,(data,_,options)=>{if(typeof data===`boolean`)return[data];throw new ValidationError(`expected boolean but got ${data}`,options)});Schema.extend(`bitset`,(data,{bits,meta},options)=>{let value=0,keys=[];if(typeof data===`number`){value=data;for(const key in bits)if(data&bits[key])keys.push(key)}else if(Array.isArray(data)){keys=data;for(const key of keys){if(typeof key!==`string`)throw new ValidationError(`expected string but got ${key}`,options);if(key in bits)value|=bits[key]}}else throw new ValidationError(`expected number or array but got ${data}`,options);if(value===meta.default)return[value];return[value,keys]});Schema.extend(`function`,(data,_,options)=>{if(typeof data===`function`)return[data];throw new ValidationError(`expected function but got ${data}`,options)});Schema.extend(`is`,(data,{constructor},options)=>{if(typeof constructor===`function`){if(data instanceof constructor)return[data];throw new ValidationError(`expected ${constructor.name} but got ${data}`,options)}else{if(isNullable(data))throw new ValidationError(`expected ${constructor} but got ${data}`,options);let prototype=Object.getPrototypeOf(data);while(prototype){if(prototype.constructor?.name===constructor)return[data];prototype=Object.getPrototypeOf(prototype)}throw new ValidationError(`expected ${constructor} but got ${data}`,options)}});function property(data,key,schema,options){try{const[value,adapted]=Schema.resolve(data[key],schema,{...options,path:[...options.path||[],key]});if(adapted!==void 0)data[key]=adapted;return value}catch(e){if(!options?.autofix)throw e;delete data[key];return schema.meta.volatile?createVolatile(schema.meta.default):schema.meta.default}}Schema.extend(`array`,(data,{inner,meta},options)=>{if(!Array.isArray(data))throw new ValidationError(`expected array but got ${data}`,options);checkWithinRange(data.length,meta,`array length`,options,!isNullable(inner.meta.default));return[data.map((_,index)=>property(data,index,inner,options))]});Schema.extend(`dict`,(data,{inner,sKey},options,strict)=>{if(!isPlainObject(data))throw new ValidationError(`expected object but got ${data}`,options);const result={};for(const key in data){let rKey;try{rKey=Schema.resolve(key,sKey,options)[0]}catch(error){if(strict)continue;throw error}result[rKey]=property(data,key,inner,options);data[rKey]=data[key];if(key!==rKey)delete data[key]}return[result]});Schema.extend(`tuple`,(data,{list},options,strict)=>{if(!Array.isArray(data))throw new ValidationError(`expected array but got ${data}`,options);const result=list.map((inner,index)=>property(data,index,inner,options));if(strict)return[result];result.push(...data.slice(list.length));return[result]});function merge(result,data){for(const key in data){if(key in result)continue;result[key]=data[key]}}Schema.extend(`object`,(data,{dict},options,strict)=>{if(!isPlainObject(data))throw new ValidationError(`expected object but got ${data}`,options);const result={};for(const key in dict){const value=property(data,key,dict[key],options);if(!isNullable(value)||key in data)result[key]=value}if(!strict)merge(result,data);return[result]});Schema.extend(`union`,(data,{list,toString},options,strict)=>{const messages=[];for(const inner of list)try{return Schema.resolve(data,inner,options,strict)}catch(error){messages.push(error)}throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`,options)});Schema.extend(`intersect`,(data,{list,toString},options,strict)=>{if(!list.length)return[data];let result;for(const inner of list){const value=Schema.resolve(data,inner,options,true)[0];if(isNullable(value))continue;if(isNullable(result))result=value;else if(typeof result!==typeof value)throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`,options);else if(typeof value===`object`)merge(result??={},value);else if(result!==value)throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`,options)}if(!strict&&isPlainObject(data))merge(result,data);return[result]});Schema.extend(`transform`,(data,{inner,callback,preserve},options)=>{const[result,adapted=data]=Schema.resolve(data,inner,options,true);if(preserve)return[callback(result)];else return[callback(result),callback(adapted)]});const formatters={};function defineMethod(name,keys,format){formatters[name]=format;Object.assign(Schema,{[name](...args){const schema=new Schema({type:name});keys.forEach((key,index)=>{switch(key){case`sKey`:schema.sKey=args[index]??Schema.string();break;case`inner`:schema.inner=Schema.from(args[index]);break;case`list`:schema.list=args[index].map(Schema.from);break;case`dict`:schema.dict=mapValues(args[index],Schema.from);break;case`bits`:schema.bits={};for(const key in args[index]){if(typeof args[index][key]!==`number`)continue;schema.bits[key]=args[index][key]}break;case`callback`:{const callback=schema.callback=args[index];callback[`toJSON`]||=()=>callback.toString();break}case`constructor`:{const constructor=schema.constructor=args[index];if(typeof constructor===`function`)constructor[`toJSON`]||=()=>constructor[`name`];break}default:schema[key]=args[index]}});if(name===`object`||name===`dict`)schema.meta.default={};else if(name===`array`||name===`tuple`)schema.meta.default=[];else if(name===`bitset`)schema.meta.default=0;return schema}})}defineMethod(`is`,[`constructor`],({constructor})=>{if(typeof constructor===`function`)return constructor.name;else return constructor});defineMethod(`any`,[],()=>`any`);defineMethod(`never`,[],()=>`never`);defineMethod(`const`,[`value`],({value})=>typeof value===`string`?JSON.stringify(value):value);defineMethod(`string`,[],()=>`string`);defineMethod(`number`,[],()=>`number`);defineMethod(`boolean`,[],()=>`boolean`);defineMethod(`bitset`,[`bits`],()=>`bitset`);defineMethod(`function`,[],()=>`function`);defineMethod(`array`,[`inner`],({inner})=>`${inner.toString(true)}[]`);defineMethod(`dict`,[`inner`,`sKey`],({inner,sKey})=>`{ [key: ${sKey.toString()}]: ${inner.toString()} }`);defineMethod(`tuple`,[`list`],({list})=>`[${list.map(inner=>inner.toString()).join(`, `)}]`);defineMethod(`object`,[`dict`],({dict})=>{if(Object.keys(dict).length===0)return`{}`;return`{ ${Object.entries(dict).map(([key,inner])=>{return`${key}${inner.meta.required?``:`?`}: ${inner.toString()}`}).join(`, `)} }`});defineMethod(`union`,[`list`],({list},inline)=>{const result=list.map(({toString:format})=>format()).join(` | `);return inline?`(${result})`:result});defineMethod(`intersect`,[`list`],({list})=>{return`${list.map(inner=>inner.toString(true)).join(` & `)}`});defineMethod(`transform`,[`inner`,`callback`,`preserve`],({inner},isInner)=>inner.toString(isInner));const Config=Schema.object({notificationPollIntervalMs:Schema.natural().min(1).max(2147483647).default(6e5)});const NOTIFICATIONS_CONFIG_GLOBAL=`__DSH_ACCOUNT_NOTIFICATIONS_CONFIG__`;const css=`.JZqiVa_stack{isolation:isolate;width:100%;max-width:280px;position:relative}.JZqiVa_card{box-sizing:border-box;background:var(--dsw-specific-input-major);width:100%;box-shadow:var(--dsw-elevation-panel);color:var(--dsw-alias-label-secondary);z-index:calc(0 - var(--notice-depth));transform:translateY(calc(-4px * var(--notice-depth))) scaleX(var(--notice-scale));transform-origin:top;border:0;border-radius:16px;padding:20px;font-size:14px;line-height:22px;transition:transform .25s ease-out;position:relative}.JZqiVa_card[data-front=false]{pointer-events:none;height:100%;position:absolute;inset:0;overflow:hidden}@media (prefers-reduced-motion:reduce){.JZqiVa_card{transition:none}}.JZqiVa_copy{overflow-wrap:anywhere;flex-direction:column;gap:2px;display:flex}.JZqiVa_copy p{white-space:pre-wrap;margin:0}.JZqiVa_actions{flex-wrap:wrap;gap:8px;margin-top:12px;display:flex}.JZqiVa_action{white-space:normal;overflow-wrap:anywhere;max-width:100%;height:auto;min-height:28px}.JZqiVa_title{align-items:flex-start;gap:2px;font-weight:500;line-height:20px;display:flex}.JZqiVa_icon{width:14px;height:14px;color:var(--dsw-alias-brand-primary-new-colorprimary-new-color);flex:none;margin-top:1px;display:flex}.JZqiVa_close{width:18px;height:18px;color:var(--dsw-alias-label-caption);cursor:pointer;background:0 0;border:0;justify-content:center;align-items:center;padding:4px;display:flex;position:absolute;top:6px;right:6px}.JZqiVa_close:focus-visible{outline:2px solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px;border-radius:4px}`;const tagId=`@deepseek-ai/dsh-client-ui-account-notifications/AccountNotifications.module.css`;if(typeof document!==`undefined`&&document.querySelector(`style[data-plugin-css=`+JSON.stringify(tagId)+`]`)===null){const tag=document.createElement(`style`);tag.dataset.plugin=`@deepseek-ai/dsh-client-ui-account-notifications`;tag.dataset.pluginCss=tagId;tag.textContent=css;document.head.appendChild(tag)}var AccountNotifications_module_css_default={"action":`JZqiVa_action`,"actions":`JZqiVa_actions`,"card":`JZqiVa_card`,"close":`JZqiVa_close`,"copy":`JZqiVa_copy`,"icon":`JZqiVa_icon`,"stack":`JZqiVa_stack`,"title":`JZqiVa_title`};function dismissNotice(card,dismiss){if(typeof card.animate!==`function`||getComputedStyle(card).transitionDuration===`0s`){dismiss();return}const before=[...card.parentElement.querySelectorAll(`aside`)].map(element=>({element,rect:element.getBoundingClientRect()}));for(const{element}of before){for(const animation of element.getAnimations())animation.cancel();element.style.transition=`none`}(0,react_dom.flushSync)(dismiss);for(const{element,rect}of before){if(!element.isConnected)continue;const transform=getComputedStyle(element).transform;element.style.transform=`none`;const next=element.getBoundingClientRect();element.style.transform=``;element.animate([{transform:`translate(${rect.x+rect.width/2-next.x-next.width/2}px, ${rect.y-next.y}px) scale(${rect.width/next.width}, ${rect.height/next.height})`},{transform}],{duration:250,easing:`ease-out`});element.style.transition=``}}function AccountNotifications({active,openAccount,useNotices,shown,ctaClicked,dismiss,t}){const notices=useNotices(value=>value);return active&&(0,react_jsx_runtime.jsx)(AccountNoticeStack,{notices,closeLabel:t(`close`),onOpenAccount:openAccount,onShown:shown,onCtaClicked:ctaClicked,onDismiss:dismiss})}function assertNever(_value){throw new Error(`unsupported account notification target`)}function live(displayUntil){if(displayUntil===null)return true;const expires=Date.parse(displayUntil);return Number.isNaN(expires)||expires>Date.now()}function afterPaint(run){if(typeof requestAnimationFrame!==`function`){const timer=setTimeout(run,0);return()=>{clearTimeout(timer)}}let cancelled=false;let timer;const frame=requestAnimationFrame(()=>{timer=setTimeout(()=>{if(!cancelled)run()},0)});return()=>{cancelled=true;cancelAnimationFrame(frame);if(timer!==void 0)clearTimeout(timer)}}function AccountNoticeStack({notices,closeLabel,onShown,onCtaClicked,onDismiss,onOpenAccount}){const liveNotices=notices.filter(notice=>live(notice.displayUntil));return(0,react_jsx_runtime.jsx)(`div`,{className:AccountNotifications_module_css_default.stack,children:liveNotices.map((notice,depth)=>(0,react_jsx_runtime.jsx)(NoticeCard,{notice,depth,closeLabel,onShown,onCtaClicked,onDismiss,onOpenAccount},notice.id))})}function NoticeCard({notice,depth,closeLabel,onShown,onCtaClicked,onDismiss,onOpenAccount}){const foreground=depth===0;const card=(0,react.useRef)(null);const reported=(0,react.useRef)(false);const actionSlots=new Map;(0,react.useEffect)(()=>{if(!foreground||reported.current||!live(notice.displayUntil))return;const element=card.current;if(element===null)return;let intersecting=false;let cancel;const visible=()=>intersecting&&document.visibilityState!==`hidden`&&!element.closest(`[hidden], [inert]`);const attempt=()=>{if(reported.current||cancel!==void 0||!live(notice.displayUntil))return;if(!visible())return;cancel=afterPaint(()=>{cancel=void 0;if(reported.current||!visible()||!live(notice.displayUntil))return;reported.current=true;onShown(notice.id)})};const observer=new IntersectionObserver(entries=>{for(const entry of entries){intersecting=entry.isIntersecting;attempt()}});observer.observe(element);document.addEventListener(`visibilitychange`,attempt);return()=>{observer.disconnect();document.removeEventListener(`visibilitychange`,attempt);cancel?.()}},[foreground,notice.id,notice.displayUntil,onShown]);return(0,react_jsx_runtime.jsxs)(`aside`,{ref:card,className:AccountNotifications_module_css_default.card,"data-front":foreground,"aria-hidden":!foreground,style:{"--notice-depth":depth,"--notice-scale":Math.pow(252/260,depth)},children:[(0,react_jsx_runtime.jsxs)(`div`,{role:`status`,className:AccountNotifications_module_css_default.copy,children:[(0,react_jsx_runtime.jsxs)(`div`,{className:AccountNotifications_module_css_default.title,children:[(0,react_jsx_runtime.jsx)(`span`,{className:AccountNotifications_module_css_default.icon,"aria-hidden":`true`,children:(0,react_jsx_runtime.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 14 14`,fill:`none`,children:[(0,react_jsx_runtime.jsx)(`path`,{d:`M3.6355 6.93969C3.6355 4.8398 5.33779 3.1375 7.43768 3.1375C9.53757 3.1375 11.23987 4.8398 11.23987 6.93968V11.363H3.6355V6.93969Z`,fill:`currentColor`,fillOpacity:`0.2`,stroke:`currentColor`,strokeWidth:`0.875`}),(0,react_jsx_runtime.jsx)(`path`,{d:`M1.641 11.3645H12.36M5.053 13.3095H8.9479M7.4375 4.27422V2.70137912`,stroke:`currentColor`,strokeWidth:`0.875`})]})}),(0,react_jsx_runtime.jsx)(`span`,{children:notice.title})]}),(0,react_jsx_runtime.jsx)(`p`,{children:notice.body})]}),notice.actions.length>0&&(0,react_jsx_runtime.jsx)(`div`,{className:AccountNotifications_module_css_default.actions,children:notice.actions.map(action=>{const target=JSON.stringify(action.target);const occurrence=actionSlots.get(target)??0;actionSlots.set(target,occurrence+1);return(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button,{size:`sm`,className:AccountNotifications_module_css_default.action,variant:action.style===`primary`?`primary`:`outline`,tabIndex:foreground?void 0:-1,onClick:event=>{if(action.target.type!==`dismiss`)onCtaClicked(notice.id);switch(action.target.type){case`app_route`:onOpenAccount();break;case`dismiss`:dismissNotice(event.currentTarget.closest(`aside`),()=>{onDismiss(notice.id)});break;default:assertNever(action.target)}},children:action.label},`${target}:${occurrence}`)})}),(0,react_jsx_runtime.jsx)(`button`,{type:`button`,tabIndex:foreground?void 0:-1,className:AccountNotifications_module_css_default.close,"aria-label":closeLabel,onClick:event=>{dismissNotice(event.currentTarget.parentElement,()=>{onDismiss(notice.id)})},children:(0,react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular,{size:10})})]})}function expired(displayUntil,at){if(displayUntil===null)return false;const expires=Date.parse(displayUntil);return!Number.isNaN(expires)&&expires<=at}function createNotificationController(options){let scope;let locale=options.locale;let contentGeneration=0;let current=[];let poll;const reported=new Set;const setCurrent=notices=>{if(notices.length===current.length&¬ices.every((notice,index)=>{return JSON.stringify(notice)===JSON.stringify(current[index])}))return;const retained=new Set(notices.map(notice=>notice.id));for(const id of reported)if(!retained.has(id))reported.delete(id);current=notices;options.publish(notices)};const apply=(batch,preserveCopy)=>{const notifications=batch.notifications.map(notice=>{const previous=preserveCopy?current.find(value=>value.id===notice.id):void 0;return previous===void 0?notice:{...notice,title:previous.title,body:previous.body,actions:previous.actions}});const foreground=current[0];const retained=foreground!==void 0&&reported.has(foreground.id)?notifications.find(notice=>notice.id===foreground.id)??foreground:void 0;const at=Date.now();const candidates=notifications.filter(notice=>!expired(notice.displayUntil,at));setCurrent(retained!==void 0&&!expired(retained.displayUntil,at)?[retained,...candidates.filter(notice=>notice.id!==retained.id)]:candidates)};async function refreshContent(){const scopeAtCall=scope;if(scopeAtCall===void 0||current.length===0)return;const generation=++contentGeneration;const requestedLocale=locale;const responses=await Promise.allSettled(current.map(async notice=>options.readContent(notice.id,requestedLocale)));if(scope!==scopeAtCall||generation!==contentGeneration)return;if(responses.some(response=>response.status===`rejected`))console.error(`[deepseek-account] notification content read failed`);const updates=responses.flatMap(response=>response.status===`fulfilled`&&response.value!==null?[response.value]:[]);setCurrent(current.map(notice=>{const update=updates.find(value=>value.id===notice.id);return update==null?notice:{...notice,title:update.title,body:update.body,actions:update.actions}}))}async function runRead(pollAtRead){const requestedLocale=locale;let batch;try{batch=await options.read(requestedLocale)}catch(_error){if(poll!==pollAtRead)return;console.error(`[deepseek-account] notification read failed; retaining cards and retrying on the next poll`);batch=null}if(poll!==pollAtRead)return;if(batch!==null){pollAtRead.intervalMs=batch.nextPollAfterSeconds*1e3;apply(batch,requestedLocale!==locale);if(requestedLocale!==locale)await refreshContent()}if(poll!==pollAtRead)return;pollAtRead.timer=setTimeout(()=>{runRead(pollAtRead)},pollAtRead.intervalMs)}const stopPolling=()=>{if(poll?.timer!==void 0)clearTimeout(poll.timer);poll=void 0};const restartPolling=()=>{stopPolling();poll={intervalMs:options.pollIntervalMs};return runRead(poll)};const report=async(id,event)=>{const scopeAtReport=scope;if(scopeAtReport===void 0||current[0]?.id!==id||event===`displayed`&&reported.has(id))return;if(event===`displayed`)reported.add(id);try{await options.reportEvent(id,event)}catch(_error){if(scope===scopeAtReport)console.error(`[deepseek-account] notification event report failed; keeping local state without retry`,{event})}};const endLifecycle=()=>{if(scope===void 0)return;stopPolling();scope=void 0;contentGeneration++;reported.clear();setCurrent([])};return{begin(){scope??={};restartPolling()},end:endLifecycle,refresh(){if(scope===void 0)return Promise.resolve();return restartPolling()},async setLocale(value){if(value===locale)return;locale=value;contentGeneration++;await refreshContent()},shown(id){setCurrent(current.filter(notice=>!expired(notice.displayUntil,Date.now())));if(current[0]?.id!==id)return;report(id,`displayed`)},ctaClicked(id){setCurrent(current.filter(notice=>!expired(notice.displayUntil,Date.now())));if(current[0]?.id!==id)return;report(id,`cta_clicked`)},dismiss(id){setCurrent(current.filter(notice=>!expired(notice.displayUntil,Date.now())));if(current[0]?.id!==id)return;report(id,`dismissed`);setCurrent(current.slice(1).filter(notice=>!expired(notice.displayUntil,Date.now())))}}}const en={close:`Close`};const zh={close:`关闭`};const ja={close:`閉じる`};const es={close:`Cerrar`};const fr={close:`Fermer`};const de={close:`Schließen`};const ru={close:`Закрыть`};const pt={close:`Fechar`};const inject=[`slots`,`locale`,`remote`,`remote.account`,`accountUi`];function apply(ctx){const config=Config(globalThis[`__DSH_ACCOUNT_NOTIFICATIONS_CONFIG__`]??{});ctx.effect(()=>ctx.locale.register(`account.notifications`,{en,zh,ja,es,fr,de,ru,pt}),`notifications: dictionaries`);let snapshot=[];const listeners=new Set;const controller=createNotificationController({locale:ctx.locale.getSnapshot().active,pollIntervalMs:config.notificationPollIntervalMs,read:async locale=>{const result=await ctx.remote.account.getNotifications(ctx.accountUi.clientMetadata(locale));if(!result.ok)throw new Error(`account notification read failed`);return result.value},readContent:async(id,locale)=>{const result=await ctx.remote.account.getNotificationContent(id,ctx.accountUi.clientMetadata(locale));if(!result.ok)throw new Error(`account notification content read failed`);return result.value},reportEvent:async(id,event)=>{const result=await ctx.remote.account.reportNotificationEvent(id,event,ctx.accountUi.clientMetadata(ctx.locale.getSnapshot().active));if(!result.ok)throw new Error(`account notification event report failed`);return result.value},publish:notices=>{snapshot=notices;for(const listener of listeners)listener()}});const update=(state,reset)=>{const signedIn=state.view?.status===`credential-stored`&&!state.failed;if(reset||!signedIn)controller.end();if(signedIn&&reset)controller.begin()};ctx.effect(()=>()=>{controller.end()},`notifications: account lifetime`);ctx.on(`account-ui/change`,update);ctx.on(`account-ui/refresh`,()=>controller.refresh());ctx.on(`locale/change`,state=>{controller.setLocale(state.active)});update(ctx.accountUi.getSnapshot(),true);const injected={hooks:{notices:{getSnapshot:()=>snapshot,subscribe:listener=>{listeners.add(listener);return()=>{listeners.delete(listener)}}}},shown:id=>{controller.shown(id)},ctaClicked:id=>{controller.ctaClicked(id)},dismiss:id=>{controller.dismiss(id)}};ctx.slots.inject(`settings.launcher.notifications`,()=>ctx.slots.register({name:`settings.launcher.notifications`,locale:`account.notifications`,inject:()=>injected},AccountNotifications))}exports.apply=apply;exports.inject=inject;return module.exports}});
|
|
3
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":["valueMap"],"sources":["../../../../vendor/cosmokit/src/misc.ts","../../../../vendor/cosmokit/src/volatile.ts","../../../../vendor/cosmokit/src/types.ts","../../../../vendor/cosmokit/src/time.ts","../../../../vendor/schemastery/src/index.ts","../../../packages/client/ui-account-notifications/src/config.ts","../../../packages/client/ui-account-notifications/src/client/notice-transition.ts","../../../packages/client/ui-account-notifications/src/client/AccountNotifications.tsx","../../../packages/client/ui-account-notifications/src/client/notification-controller.ts","../../../packages/client/ui-account-notifications/src/client/locales.ts","../../../packages/client/ui-account-notifications/src/client/index.ts"],"sourcesContent":["/** String/symbol keyed dictionary type. */\nexport type Dict<T = any, K extends string | symbol = string> = { [key in K]: T }\n/** Safely read `T[K]`, returning `never` when `K` is not a key of `T`. */\nexport type Get<T extends {}, K> = K extends keyof T ? T[K] : never\n/** Conditional extraction helper with a configurable return type. */\nexport type Extract<S, T, U = S> = S extends T ? U : never\n/** Accept a value or an array, unless the value is already an array type. */\nexport type MaybeArray<T> = [T] extends [unknown[]] ? T : T | T[]\n/** Wrap a value in `Promise`, preserving the resolved type of existing promises. */\nexport type Promisify<T> = Promise<T extends Promise<infer S> ? S : T>\n/** Accept a value or promise unless the value type is already promise-like. */\nexport type Awaitable<T> = [T] extends [Promise<unknown>] ? T : T | Promise<T>\n/** Convert a union type to an intersection type. */\nexport type Intersect<U> = (U extends any ? (arg: U) => void : never) extends ((arg: infer I) => void) ? I : never\n\n/** No-op callback returning `undefined` at runtime and `any` at type level. */\nexport function noop(): any {}\n\n/** Return true when a value is `null` or `undefined`. */\nexport function isNullable(value: any): value is null | undefined | void {\n return value === null || value === undefined\n}\n\n/** Return true when a value is neither `null` nor `undefined`. */\nexport function isNonNullable<T>(value: T): value is NonNullable<T> {\n return !isNullable(value)\n}\n\n/** Return true for non-array object values. */\nexport function isPlainObject(data: any) {\n return data && typeof data === 'object' && !Array.isArray(data)\n}\n\n/** Filter object entries with a key type guard. */\nexport function filterKeys<T, K extends string, U extends K>(object: Dict<T, K>, filter: (key: K, value: T) => key is U): Dict<T, U>\n/** Filter object entries with a boolean predicate. */\nexport function filterKeys<T, K extends string>(object: Dict<T, K>, filter: (key: K, value: T) => boolean): Dict<T, K>\n/** Filter object entries and return a new object. */\nexport function filterKeys(object: {}, filter: (key: string, value: any) => boolean) {\n return Object.fromEntries(Object.entries(object).filter(([key, value]) => filter(key, value)))\n}\n\n/** Map object values while preserving the original key set. */\nexport function mapValues<U, T, K extends string>(object: Dict<T, K>, transform: (value: T, key: K) => U) {\n return Object.fromEntries(Object.entries(object).map(([key, value]) => [key, (transform as any)(value, key)])) as Dict<U, K>\n}\n\n/** Alias for `mapValues`. */\nexport { mapValues as valueMap }\n\n/** Pick selected keys from an object, optionally including `undefined` values. */\nexport function pick<T extends object, K extends keyof T>(source: T, keys?: Iterable<K>, forced?: boolean) {\n if (!keys) return { ...source }\n const result = {} as Pick<T, K>\n for (const key of keys) {\n if (forced || source[key] !== undefined) result[key] = source[key]\n }\n return result\n}\n\n/** Omit selected keys from a shallow object copy. */\nexport function omit<T, K extends keyof T>(source: T, keys?: Iterable<K>) {\n if (!keys) return { ...source }\n const result = { ...source } as Omit<T, K>\n for (const key of keys) {\n Reflect.deleteProperty(result, key)\n }\n return result\n}\n\n/** Define a non-enumerable writable property with a typed key. */\nexport function defineProperty<T, K extends keyof T>(object: T, key: K, value: T[K]): T\n/** Define a non-enumerable writable property with an arbitrary key. */\nexport function defineProperty<T, K extends keyof any>(object: T, key: K, value: any): T\n/** Define a non-enumerable writable property and return the object. */\nexport function defineProperty<T, K extends keyof any>(object: T, key: K, value: any) {\n return Object.defineProperty(object, key, { writable: true, value, enumerable: false })\n}\n","/** Shared config references used by schema validators and plugin runtimes. */\n\nconst write = Symbol.for('cosmokit.volatile.write')\n\n/** Recursively readonly data returned by a volatile config reference. */\nexport type VolatileSnapshot<T> = T extends object ? { readonly [K in keyof T]: VolatileSnapshot<T[K]> } : T\n\n/** A stable reference; keep the reference, or capture its value for one operation only. */\nexport interface Volatile<T> {\n /** @returns the current immutable snapshot, including undefined for an absent value. */\n get(): VolatileSnapshot<T>\n}\n\ninterface WritableVolatile extends Volatile<unknown> {\n [write](value: unknown): void\n}\n\nfunction snapshot(value: unknown, ancestors = new Set<object>()): unknown {\n if (typeof value === 'function') throw new TypeError('volatile config cannot contain functions')\n if (value === null || typeof value !== 'object') return value\n if (ancestors.has(value)) throw new TypeError('volatile config cannot contain cycles')\n ancestors.add(value)\n try {\n if (Array.isArray(value)) return Object.freeze(value.map(item => snapshot(item, ancestors)))\n if (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) {\n throw new TypeError('volatile config objects must be plain objects or arrays')\n }\n return Object.freeze(Object.fromEntries(Object.entries(value).map(([key, item]) => [key, snapshot(item, ancestors)])))\n } finally {\n ancestors.delete(value)\n }\n}\n\n/**\n * Create a detached reference containing an immutable copy of the supplied data.\n * @param value - validated config data; class instances and functions are unsupported.\n * @returns a reference whose value is updated only by its owning runtime.\n */\nexport function createVolatile<T>(value: T): Volatile<T> {\n let current = snapshot(value)\n return Object.freeze({\n get: () => current,\n [write]: (value: unknown) => { current = value },\n }) as Volatile<T>\n}\n\n/**\n * Identify references across ESM/CJS copies of the shared library.\n * @param value - a parsed config value.\n * @returns whether the value implements the shared reference protocol.\n */\nexport function isVolatile(value: unknown): value is Volatile<unknown> {\n return typeof value === 'object' && value !== null && write in value\n}\n\n/**\n * Collect config references without descending into their snapshots or opaque objects.\n * @internal\n * @param value - parsed config; cyclic ordinary fields are visited once per path.\n * @returns references and their object-key paths, including an empty path for a root reference.\n */\nexport function volatileEntries(value: unknown): { path: string[]; ref: Volatile<unknown> }[] {\n const ancestors = new Set<object>()\n function visit(value: unknown, path: string[]): { path: string[]; ref: Volatile<unknown> }[] {\n if (isVolatile(value)) return [{ path, ref: value }]\n if (!value || typeof value !== 'object' || ancestors.has(value)) return []\n if (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return []\n ancestors.add(value)\n try {\n return Object.entries(value).flatMap(([key, child]) => visit(child, [...path, key]))\n } finally {\n ancestors.delete(value)\n }\n }\n return visit(value, [])\n}\n\n/**\n * Commit an already validated immutable snapshot from another reference.\n * @internal\n * @param target - the owning plugin's stable reference.\n * @param source - a newly parsed candidate reference.\n */\nexport function updateVolatile(target: Volatile<unknown>, source: Volatile<unknown>): void {\n ;(target as WritableVolatile)[write](source.get())\n}\n","import { isNullable } from './misc.ts'\nimport { isVolatile } from './volatile.ts'\n\ntype GlobalConstructorNames = keyof {\n [K in keyof typeof globalThis as typeof globalThis[K] extends abstract new (...args: any) => any ? K : never]: K\n}\n\n/** Create a predicate for a global constructor name. */\nexport function is<K extends GlobalConstructorNames>(type: K): (value: any) => value is InstanceType<typeof globalThis[K]>\n/** Test whether a value matches a global constructor name. */\nexport function is<K extends GlobalConstructorNames>(type: K, value: any): value is InstanceType<typeof globalThis[K]>\n/** Test values using `instanceof` with a `toStringTag` fallback. */\nexport function is<K extends GlobalConstructorNames>(type: K, value?: any): any {\n if (arguments.length === 1) return (value: any) => is(type, value)\n return type in globalThis && value instanceof (globalThis[type] as any)\n || Object.prototype.toString.call(value).slice(8, -1) === type\n}\n\nfunction isArrayBufferLike(value: any): value is ArrayBufferLike {\n return is('ArrayBuffer', value) || is('SharedArrayBuffer', value)\n}\n\nfunction isArrayBufferSource(value: any): value is Binary.Source {\n return isArrayBufferLike(value) || ArrayBuffer.isView(value)\n}\n\n/** Binary source detection and base64/hex conversion helpers. */\nexport namespace Binary {\n export type Source<T extends ArrayBufferLike = ArrayBufferLike> = T | ArrayBufferView<T>\n\n export const is = isArrayBufferLike\n export const isSource = isArrayBufferSource\n\n export function fromSource<T extends ArrayBufferLike>(source: Source<T>): T {\n if (ArrayBuffer.isView(source)) {\n // https://stackoverflow.com/questions/8609289/convert-a-binary-nodejs-buffer-to-javascript-arraybuffer#answer-31394257\n return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength) as T\n } else {\n return source\n }\n }\n\n export function toBase64(source: Source) {\n source = fromSource(source)\n if (typeof Buffer !== 'undefined') {\n return Buffer.from(source).toString('base64')\n }\n let binary = ''\n const bytes = new Uint8Array(source)\n for (let i = 0; i < bytes.byteLength; i++) {\n binary += String.fromCharCode(bytes[i])\n }\n return btoa(binary)\n }\n\n export function fromBase64(source: string) {\n if (typeof Buffer !== 'undefined') return fromSource(Buffer.from(source, 'base64'))\n return Uint8Array.from(atob(source), c => c.charCodeAt(0))\n }\n\n export function toHex(source: Source) {\n source = fromSource(source)\n if (typeof Buffer !== 'undefined') return Buffer.from(source).toString('hex')\n return Array.from(new Uint8Array(source), byte => byte.toString(16).padStart(2, '0')).join('')\n }\n\n export function fromHex(source: string) {\n if (typeof Buffer !== 'undefined') return fromSource(Buffer.from(source, 'hex'))\n const hex = source.length % 2 === 0 ? source : source.slice(0, source.length - 1)\n const buffer: number[] = []\n for (let i = 0; i < hex.length; i += 2) {\n buffer.push(parseInt(`${hex[i]}${hex[i + 1]}`, 16))\n }\n return Uint8Array.from(buffer).buffer\n }\n}\n\n/** Decode a base64 string into binary data. */\nexport const base64ToArrayBuffer = Binary.fromBase64\n/** Encode binary data as base64. */\nexport const arrayBufferToBase64 = Binary.toBase64\n/** Decode a hex string into binary data. */\nexport const hexToArrayBuffer = Binary.fromHex\n/** Encode binary data as hex. */\nexport const arrayBufferToHex = Binary.toHex\n\n/** Deep-clone common JavaScript values while preserving prototypes. */\nexport function clone<T>(source: T): T\n/** Deep-clone common JavaScript values while preserving prototypes and cycles. */\nexport function clone(source: any, refs = new Map<any, any>()) {\n if (!source || typeof source !== 'object') return source\n if (is('Date', source)) return new Date(source.valueOf())\n if (is('RegExp', source)) return new RegExp(source.source, source.flags)\n if (isArrayBufferLike(source)) return source.slice(0)\n if (ArrayBuffer.isView(source)) return source.buffer.slice(source.byteOffset, source.byteOffset + source.byteLength)\n const cached = refs.get(source)\n if (cached) return cached\n if (Array.isArray(source)) {\n const result: any[] = []\n refs.set(source, result)\n source.forEach((value, index) => {\n result[index] = Reflect.apply(clone, null, [value, refs])\n })\n return result\n }\n const result = Object.create(Object.getPrototypeOf(source))\n refs.set(source, result)\n for (const key of Reflect.ownKeys(source)) {\n const descriptor = { ...Reflect.getOwnPropertyDescriptor(source, key) }\n if ('value' in descriptor) {\n descriptor.value = Reflect.apply(clone, null, [descriptor.value, refs])\n }\n Reflect.defineProperty(result, key, descriptor)\n }\n return result\n}\n\n/**\n * Compare values recursively, treating two volatile references as equal regardless of value.\n * Strict comparison distinguishes null/undefined, treats opaque objects by identity,\n * compares URLs by normalized href, treats array holes as undefined, and considers distinct cyclic structures unequal.\n * @param a - first value.\n * @param b - second value.\n * @param strict - whether to require strict data equality outside volatile references.\n * @returns whether the values compare equal.\n */\nexport function deepEqual(a: any, b: any, strict?: boolean): boolean {\n const ancestors = new Set<object>()\n function compare(a: any, b: any): boolean {\n if (a === b) return true\n if (isVolatile(a) || isVolatile(b)) return isVolatile(a) && isVolatile(b)\n if (!strict && isNullable(a) && isNullable(b)) return true\n if (typeof a !== typeof b || typeof a !== 'object' || !a || !b) return false\n if (ancestors.has(a)) return false\n\n function check<T>(test: (x: any) => x is T, then: (a: T, b: T) => boolean) {\n return test(a) ? test(b) ? then(a, b) : false : test(b) ? false : undefined\n }\n\n ancestors.add(a)\n try {\n return check(Array.isArray, (a, b) => {\n if (a.length !== b.length) return false\n for (let index = 0; index < a.length; index++) {\n if (!compare(a[index], b[index])) return false\n }\n return true\n })\n ?? check(is('Date'), (a, b) => a.valueOf() === b.valueOf())\n ?? check(is('URL'), (a, b) => a.href === b.href)\n ?? check(is('RegExp'), (a, b) => a.source === b.source && a.flags === b.flags)\n ?? check(isArrayBufferLike, (a, b) => {\n if (a.byteLength !== b.byteLength) return false\n const viewA = new Uint8Array(a)\n const viewB = new Uint8Array(b)\n for (let i = 0; i < viewA.length; i++) {\n if (viewA[i] !== viewB[i]) return false\n }\n return true\n })\n ?? ((!strict || [a, b].every(value => Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null))\n && Object.keys({ ...a, ...b }).every(key => compare(a[key], b[key])))\n } finally {\n ancestors.delete(a)\n }\n }\n return compare(a, b)\n}\n","/** Time constants plus parsing and formatting helpers. */\nexport namespace Time {\n export const millisecond = 1\n export const second = 1000\n export const minute = second * 60\n export const hour = minute * 60\n export const day = hour * 24\n export const week = day * 7\n\n let timezoneOffset = new Date().getTimezoneOffset()\n\n export function setTimezoneOffset(offset: number) {\n timezoneOffset = offset\n }\n\n export function getTimezoneOffset() {\n return timezoneOffset\n }\n\n export function getDateNumber(date: number | Date = new Date(), offset?: number) {\n if (typeof date === 'number') date = new Date(date)\n if (offset === undefined) offset = timezoneOffset\n return Math.floor((date.valueOf() / minute - offset) / 1440)\n }\n\n export function fromDateNumber(value: number, offset?: number) {\n const date = new Date(value * day)\n if (offset === undefined) offset = timezoneOffset\n return new Date(+date + offset * minute)\n }\n\n const numeric = /\\d+(?:\\.\\d+)?/.source\n const timeRegExp = new RegExp(`^${[\n 'w(?:eek(?:s)?)?',\n 'd(?:ay(?:s)?)?',\n 'h(?:our(?:s)?)?',\n 'm(?:in(?:ute)?(?:s)?)?',\n 's(?:ec(?:ond)?(?:s)?)?',\n ].map(unit => `(${numeric}${unit})?`).join('')}$`)\n\n export function parseTime(source: string) {\n const capture = timeRegExp.exec(source)\n if (!capture) return 0\n return (parseFloat(capture[1]) * week || 0)\n + (parseFloat(capture[2]) * day || 0)\n + (parseFloat(capture[3]) * hour || 0)\n + (parseFloat(capture[4]) * minute || 0)\n + (parseFloat(capture[5]) * second || 0)\n }\n\n export function parseDate(date: string) {\n const parsed = parseTime(date)\n if (parsed) {\n date = Date.now() + parsed as any\n } else if (/^\\d{1,2}(:\\d{1,2}){1,2}$/.test(date)) {\n date = `${new Date().toLocaleDateString()}-${date}`\n } else if (/^\\d{1,2}-\\d{1,2}-\\d{1,2}(:\\d{1,2}){1,2}$/.test(date)) {\n date = `${new Date().getFullYear()}-${date}`\n }\n return date ? new Date(date) : new Date()\n }\n\n export function format(ms: number) {\n const abs = Math.abs(ms)\n if (abs >= day - hour / 2) {\n return Math.round(ms / day) + 'd'\n } else if (abs >= hour - minute / 2) {\n return Math.round(ms / hour) + 'h'\n } else if (abs >= minute - second / 2) {\n return Math.round(ms / minute) + 'm'\n } else if (abs >= second) {\n return Math.round(ms / second) + 's'\n }\n return ms + 'ms'\n }\n\n export function toDigits(source: number, length = 2) {\n return source.toString().padStart(length, '0')\n }\n\n export function template(template: string, time = new Date()) {\n return template\n .replace('yyyy', time.getFullYear().toString())\n .replace('yy', time.getFullYear().toString().slice(2))\n .replace('MM', toDigits(time.getMonth() + 1))\n .replace('dd', toDigits(time.getDate()))\n .replace('hh', toDigits(time.getHours()))\n .replace('mm', toDigits(time.getMinutes()))\n .replace('ss', toDigits(time.getSeconds()))\n .replace('SSS', toDigits(time.getMilliseconds(), 3))\n }\n}\n","import { Binary, clone, deepEqual, filterKeys, isNullable, isPlainObject, pick, valueMap, type Dict } from '@deepseek-ai/cosmokit'\nimport { createVolatile, isVolatile, type Volatile } from '@deepseek-ai/cosmokit'\nimport type { StandardSchemaV1 } from '@standard-schema/spec'\n\nconst kSchema = Symbol.for('schemastery')\nconst kValidationError = Symbol.for('ValidationError')\n\ndeclare global {\n namespace Schemastery {\n /** Convert primitive constructors, constants, and existing schemas into a schema type. */\n export type From<X> =\n | X extends string | number | boolean ? Schema<X>\n : X extends Schema<any, any, SchemaMode> ? X\n : X extends typeof String ? Schema<string>\n : X extends typeof Number ? Schema<number>\n : X extends typeof Boolean ? Schema<boolean>\n : X extends typeof Function ? Schema<Function, (...args: any[]) => any>\n : X extends Constructor<infer S> ? Schema<S>\n : never\n\n type TypeS1<X> = X extends Schema<infer S, infer _T, infer _M> ? S : never\n type Inverse<X> = X extends Schema<infer _S, infer T, infer M> ? (arg: SchemaOutput<T, M>) => void : never\n\n /** Input type accepted by a schema-like value. */\n export type TypeS<X> = TypeS1<From<X>>\n /** Output type returned by a schema-like value after validation. */\n export type TypeT<X> = ReturnType<From<X>>\n /** Resolver callback used by custom schema types registered with `Schema.extend()`. */\n export type Resolve = (data: any, schema: Schema, options: Options, strict?: boolean) => [any, any?]\n\n /** Input type accepted by one schema in an intersection. */\n export type IntersectS<X> = From<X> extends Schema<infer S, infer _T, infer _M> ? S : never\n /** Output type returned by one schema in an intersection. */\n export type IntersectT<X> = Inverse<From<X>> extends ((arg: infer T) => void) ? T : never\n\n type TupleS<X extends readonly any[]> = X extends readonly [infer L, ...infer R] ? [TypeS<L>?, ...TupleS<R>] : any[]\n type TupleT<X extends readonly any[]> = X extends readonly [infer L, ...infer R] ? [TypeT<L>?, ...TupleT<R>] : any[]\n type ObjectS<X extends Dict> = { [K in keyof X]?: TypeS<X[K]> | null } & Dict\n type ObjectT<X extends Dict> = { [K in keyof X]: TypeT<X[K]> } & Dict\n type Constructor<T = any> = new (...args: any[]) => T\n\n /** Static constructor and factory methods exposed by the default `Schema` export. */\n export interface Static {\n <T = any>(options: Partial<Schema<T>>): Schema<T>\n new <T = any>(options: Partial<Schema<T>>): Schema<T>\n prototype: Schema\n /** Validate a value against a schema node and return `[output, adaptedInput?]`. */\n resolve: Resolve\n /** Infer a schema from a primitive value, constructor, or existing schema. */\n from<X = any>(source?: X): From<X>\n /** Register a resolver for a custom schema `type`. */\n extend(type: string, resolve: Resolve): void\n /** Accept any value without validation. */\n any<T = any>(): Schema<T>\n /** Accept only nullable input. */\n never(): Schema<never>\n /** Accept exactly one constant value. */\n const<const T>(value: T): Schema<T>\n /** Accept strings, with optional metadata constraints added by instance methods. */\n string(): Schema<string>\n /** Accept numbers, with optional range and step constraints. */\n number(): Schema<number>\n /** Accept non-negative integer numbers. */\n natural(): Schema<number>\n /** Accept a number between 0 and 1 and mark it as a slider. */\n percent(): Schema<number>\n /** Accept booleans. */\n boolean(): Schema<boolean>\n /** Accept `Date` instances or parse datetime strings into `Date` objects. */\n date(): Schema<string | Date, Date>\n /** Accept `RegExp` instances or parse strings into regular expressions. */\n regExp(flag?: string): Schema<string | RegExp, RegExp>\n /** Accept binary sources and normalize them to `ArrayBufferLike`. */\n arrayBuffer(): Schema<Binary.Source, ArrayBufferLike>\n arrayBuffer(encoding: 'hex' | 'base64'): Schema<Binary.Source | string, ArrayBufferLike>\n /** Accept a numeric bitset or string keys and normalize to a number. */\n bitset<K extends string>(bits: Partial<Record<K, number>>): Schema<number | readonly K[], number>\n /** Accept functions. */\n function(): Schema<Function, (...args: any[]) => any>\n /** Accept instances of a constructor or objects whose constructor name matches. */\n is(constructor: string): Schema\n is<T>(constructor: Constructor<T>): Schema<T>\n /** Accept arrays whose elements match `inner`. */\n array<X>(inner: X): Schema<TypeS<X>[], TypeT<X>[]>\n /** Accept plain objects with values matching `inner` and optional key schema. */\n dict<X, Y extends Schema<any, string> = Schema<string>>(inner: X, sKey?: Y): Schema<Dict<TypeS<X>, TypeS<Y>>, Dict<TypeT<X>, TypeT<Y>>>\n /** Accept tuple arrays where each index matches the corresponding schema. */\n tuple<const X extends readonly any[]>(list: X): Schema<TupleS<X>, TupleT<X>>\n /** Accept plain objects; infer fields from the dictionary, not the enclosing schema's output type. */\n object<X extends Dict>(dict: X): Schema<ObjectS<NoInfer<X>>, ObjectT<NoInfer<X>>>\n /** Accept values matching at least one schema in `list`. */\n union<const X>(list: readonly X[]): Schema<TypeS<X>, TypeT<X>>\n /** Accept values matching every schema in `list`, merging object outputs. */\n intersect<const X>(list: readonly X[]): Schema<IntersectS<X>, IntersectT<X>>\n /** Validate with `inner`, then convert the result with `callback`. */\n transform<X, T>(inner: X, callback: (value: TypeS<X>, options: Schemastery.Options) => T, preserve?: boolean): Schema<TypeS<X>, T>\n /** Defer construction of a recursive schema until validation or serialization. */\n lazy<X extends Schema<any, any, SchemaMode>>(callback: () => X): X\n ValidationError: typeof ValidationError\n }\n\n /** Runtime validation options shared by all schema calls. */\n interface Options {\n /** Remove invalid object properties instead of throwing when possible. */\n autofix?: boolean\n /** Skip validation for selected values and schema nodes. */\n ignore?(data: any, schema: Schema): boolean\n /** Path used to format nested validation errors. */\n path?: (keyof any)[]\n }\n\n /** UI and validation metadata attached by schema builder methods. */\n export interface Meta<T = any> {\n default?: T extends {} ? Partial<T> : T\n required?: boolean\n /** Parse this node as a stable config reference; its type and UI metadata remain unchanged. */\n volatile?: boolean\n disabled?: boolean\n collapse?: boolean\n badges?: { text: string; type: string }[]\n hidden?: boolean\n loose?: boolean\n role?: string\n extra?: any\n link?: string\n description?: string | Dict<string>\n comment?: string\n pattern?: { source: string; flags?: string }\n max?: number\n min?: number\n step?: number\n }\n }\n\n /** Callable schema instance that validates input and returns normalized output. */\n interface Schemastery<S = any, T = S, Mode extends SchemaMode = 'plain'> {\n (data?: S | null, options?: Schemastery.Options): SchemaOutput<T, Mode>\n new (data?: S | null, options?: Schemastery.Options): SchemaOutput<T, Mode>\n [kSchema]: true\n uid: number\n meta: Schemastery.Meta<T>\n type: string\n sKey?: Schema\n inner?: Schema\n list?: Schema[]\n dict?: Dict<Schema>\n bits?: Dict<number>\n callback?: Function\n constructor?: string | Function\n builder?: Function\n value?: T\n refs?: Dict<Schema>\n preserve?: boolean\n '~standard': StandardSchemaV1.Props // <S, T>\n /** Format this schema as a compact TypeScript-like type string. */\n toString(inline?: boolean): string\n /** Serialize this schema, preserving shared and recursive references. */\n toJSON(): Schema<S, T, Mode>\n /** Mark nullable input as invalid unless a default supplies a fallback. */\n required<R extends boolean = true>(value?: R): Schema<S, T, SetRequired<Mode, R>>\n /**\n * Parse this config field as a stable reference containing immutable data.\n * @returns a schema whose output supports get(), including when the field is absent.\n */\n volatile(): Schema<NoInfer<S>, NoInfer<T>, Mode extends 'defined' | 'volatile-defined' ? 'volatile-defined' : 'volatile'>\n /** Hide this schema node from UI renderers. */\n hidden(value?: boolean): Schema<S, T, Mode>\n /** Return the default value instead of throwing when validation fails. */\n loose(value?: boolean): Schema<S, T, Mode>\n /** Attach a renderer role and optional role-specific metadata. */\n role(text: string, extra?: any): Schema<S, T, Mode>\n /** Attach an external documentation link. */\n link(link: string): Schema<S, T, Mode>\n /** Set the fallback value used for nullable input. */\n default(value: T | NoInfer<Partial<S>>): Schema<S, T, SetRequired<Mode, true>>\n /** Attach an auxiliary comment for documentation or form UIs. */\n comment(text: string): Schema<S, T, Mode>\n /** Attach a localized or plain description for documentation or form UIs. */\n description(text: string): Schema<S, T, Mode>\n /** Mark this schema node as disabled for form UIs. */\n disabled(value?: boolean): Schema<S, T, Mode>\n /** Request collapsed rendering for nested form UIs. */\n collapse(value?: boolean): Schema<S, T, Mode>\n /** Add a deprecated badge to this schema node. */\n deprecated(): Schema<S, T, Mode>\n /** Add an experimental badge to this schema node. */\n experimental(): Schema<S, T, Mode>\n /** Require strings to match a regular expression. */\n pattern(regexp: RegExp): Schema<S, T, Mode>\n /** Set an inclusive maximum for numbers or collection lengths. */\n max(value: number): Schema<S, T, Mode>\n /** Set an inclusive minimum for numbers or collection lengths. */\n min(value: number): Schema<S, T, Mode>\n /** Set the numeric increment constraint. */\n step(value: number): Schema<S, T, Mode>\n /** Add or replace an object property schema. */\n set(key: string, value: Schema): Schema<S, T, Mode>\n /** Append a tuple, union, or intersection member schema. */\n push(value: Schema): Schema<S, T, Mode>\n /** Remove values equal to schema defaults from normalized output. */\n simplify(value?: any): any\n /** Return a schema clone with descriptions merged from locale messages. */\n i18n(messages: Dict): Schema<S, T, Mode>\n /** Attach arbitrary metadata consumed by form renderers and downstream tools. */\n extra<K extends keyof Schemastery.Meta>(key: K, value: Schemastery.Meta[K]): Schema<S, T, Mode>\n }\n}\n\ndeclare namespace globalThis {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n export let __schemastery_index__: number\n export let __schemastery_refs__: Record<number, Schema> | undefined\n}\n\nglobalThis.__schemastery_index__ ??= 0\nglobalThis.__schemastery_refs__ = undefined\n\nclass ValidationError extends TypeError {\n name = 'ValidationError'\n\n constructor(message: string, public options: Schemastery.Options) {\n let prefix = '$'\n for (const segment of options.path || []) {\n if (typeof segment === 'string') {\n prefix += '.' + segment\n } else if (typeof segment === 'number') {\n prefix += '[' + segment + ']'\n } else if (typeof segment === 'symbol') {\n prefix += `[Symbol(${segment.toString()})]`\n }\n }\n if (prefix.startsWith('.')) prefix = prefix.slice(1)\n super((prefix === '$' ? '' : `${prefix} `) + message)\n }\n\n static is(error: any): error is ValidationError {\n return !!error?.[kValidationError]\n }\n}\n\nObject.defineProperty(ValidationError.prototype, kValidationError, {\n value: true,\n})\n\ntype SchemaMode = 'plain' | 'defined' | 'volatile' | 'volatile-defined'\ntype SchemaOutput<T, M extends SchemaMode> = M extends 'volatile' ? Volatile<T | undefined>\n : M extends 'volatile-defined' ? Volatile<T> : T\ntype SetRequired<M extends SchemaMode, R extends boolean> = M extends 'volatile' | 'volatile-defined'\n ? R extends true ? 'volatile-defined' : 'volatile'\n : R extends true ? 'defined' : 'plain'\n\ntype Schema<S = any, T = S, Mode extends SchemaMode = 'plain'> = Schemastery<S, T, Mode>\n\nconst Schema = function (options: Schema) {\n const schema = function (data: any, options: Schemastery.Options = {}) {\n return Schema.resolve(data, schema, options)[0]\n } as Schema\n\n if (options.refs) {\n const refs = valueMap(options.refs, options => new Schema(options))\n const getRef = (uid: any) => refs[uid]!\n for (const key in refs) {\n const options = refs[key]!\n options.sKey = getRef(options.sKey)\n options.inner = getRef(options.inner)\n options.list = options.list && options.list.map(getRef)\n options.dict = options.dict && valueMap(options.dict, getRef)\n }\n return refs[options.uid!]\n }\n\n Object.assign(schema, options)\n if (typeof schema.callback === 'string') {\n try {\n // eslint-disable-next-line no-new-func\n schema.callback = new Function('return ' + schema.callback)()\n } catch {}\n }\n Object.defineProperty(schema, 'uid', { value: globalThis.__schemastery_index__++ })\n Object.setPrototypeOf(schema, Schema.prototype)\n schema.meta ||= {}\n schema.toString = schema.toString.bind(schema)\n return schema\n} as Schemastery.Static\n\nSchema.prototype = Object.create(Function.prototype)\n\nSchema.prototype[kSchema] = true\n\nObject.defineProperty(Schema.prototype, '~standard', {\n get(this: Schema) {\n return {\n version: 1,\n vendor: 'schemastery',\n validate: (value: unknown) => {\n try {\n return { value: Schema.resolve(value, this, {})[0] }\n } catch (error) {\n if (ValidationError.is(error)) {\n return { issues: [{ message: error.message, path: error.options.path }] }\n }\n throw error\n }\n },\n }\n },\n})\n\nSchema.ValidationError = ValidationError\n\nSchema.prototype.toJSON = function toJSON() {\n if (globalThis.__schemastery_refs__) {\n globalThis.__schemastery_refs__[this.uid] ??= JSON.parse(JSON.stringify({ ...this }))\n return this.uid as any\n }\n\n globalThis.__schemastery_refs__ = { [this.uid]: { ...this } as Schema }\n globalThis.__schemastery_refs__[this.uid] = JSON.parse(JSON.stringify({ ...this }))\n const result = { uid: this.uid, refs: globalThis.__schemastery_refs__ }\n globalThis.__schemastery_refs__ = undefined\n return result\n}\n\nSchema.prototype.set = function set(key, value) {\n this.dict![key] = value\n return this\n}\n\nSchema.prototype.push = function push(value) {\n this.list!.push(value)\n return this\n}\n\nfunction mergeDesc(original: undefined | string | Dict<string>, messages: Dict) {\n const result: Dict<string> = typeof original === 'string' ? { '': original } : { ...original }\n for (const locale in messages) {\n const value = messages[locale]\n if (value?.$description || value?.$desc) {\n result[locale] = value.$description || value.$desc\n } else if (typeof value === 'string') {\n result[locale] = value\n }\n }\n return result\n}\n\nfunction getInner(value: any) {\n return value?.$value ?? value?.$inner\n}\n\nfunction extractKeys(data: any) {\n return filterKeys(data ?? {}, key => !key.startsWith('$'))\n}\n\nSchema.prototype.i18n = function i18n(messages) {\n const schema = Schema(this)\n const desc = mergeDesc(schema.meta.description, messages)\n if (Object.keys(desc).length) schema.meta.description = desc\n if (schema.dict) {\n schema.dict = valueMap(schema.dict, (inner, key) => {\n return inner.i18n(valueMap(messages, (data) => getInner(data)?.[key] ?? data?.[key]))\n })\n }\n if (schema.list) {\n schema.list = schema.list!.map((inner, index) => {\n return inner.i18n(valueMap(messages, (data = {}) => {\n if (Array.isArray(getInner(data))) return getInner(data)[index]\n if (Array.isArray(data)) return data[index]\n return extractKeys(data)\n }))\n })\n }\n if (schema.inner) {\n schema.inner = schema.inner.i18n(valueMap(messages, (data) => {\n if (getInner(data)) return getInner(data)\n return extractKeys(data)\n }))\n }\n if (schema.sKey) {\n schema.sKey = schema.sKey.i18n(valueMap(messages, (data) => data?.$key))\n }\n return schema\n}\n\nSchema.prototype.extra = function extra(key, value) {\n const schema = Schema(this)\n schema.meta = { ...schema.meta, [key]: value }\n return schema\n}\n\nfor (const key of ['required', 'disabled', 'collapse', 'hidden', 'loose']) {\n Object.assign(Schema.prototype, {\n [key](this: Schema, value = true) {\n const schema = Schema(this)\n schema.meta = { ...schema.meta, [key]: value }\n return schema\n },\n })\n}\n\nSchema.prototype.deprecated = function deprecated() {\n const schema = Schema(this)\n schema.meta.badges ||= []\n schema.meta.badges.push({ text: 'deprecated', type: 'danger' })\n return schema\n}\n\nSchema.prototype.experimental = function experimental() {\n const schema = Schema(this)\n schema.meta.badges ||= []\n schema.meta.badges.push({ text: 'experimental', type: 'warning' })\n return schema\n}\n\nSchema.prototype.pattern = function pattern(regexp) {\n const schema = Schema(this)\n const pattern = pick(regexp, ['source', 'flags'])\n schema.meta = { ...schema.meta, pattern }\n return schema\n}\n\nSchema.prototype.simplify = function simplify(this: Schema, value) {\n if (isVolatile(value)) value = value.get()\n if (deepEqual(value, this.meta.default, this.type === 'dict')) return null\n if (isNullable(value)) return value\n if (this.type === 'object' || this.type === 'dict') {\n const result: Dict = {}\n for (const key in value) {\n const schema = this.type === 'object' ? this.dict![key] : this.inner\n const item = schema?.simplify(value[key])\n if (this.type === 'dict' || !isNullable(item)) result[key] = item\n }\n if (deepEqual(result, this.meta.default, this.type === 'dict')) return null\n return result\n } else if (this.type === 'array' || this.type === 'tuple') {\n const result: any[] = []\n ;(value as any[]).forEach((value, index) => {\n const schema = this.type === 'array' ? this.inner : this.list![index]\n const item = schema ? schema.simplify(value) : value\n result.push(item)\n })\n return result\n } else if (this.type === 'intersect') {\n const result: Dict = {}\n for (const item of this.list!) {\n Object.assign(result, item.simplify(value))\n }\n return result\n } else if (this.type === 'union') {\n for (const schema of this.list!) {\n try {\n Schema.resolve(value, schema, {})\n return schema.simplify(value)\n } catch {}\n }\n }\n return value\n}\n\nSchema.prototype.toString = function toString(inline?: boolean) {\n return formatters[this.type]?.(this, inline) ?? `Schema<${this.type}>`\n}\n\nSchema.prototype.role = function role(role, extra) {\n const schema = Schema(this)\n schema.meta = { ...schema.meta, role, extra }\n return schema\n}\n\nfor (const key of ['default', 'link', 'comment', 'description', 'max', 'min', 'step']) {\n Object.assign(Schema.prototype, {\n [key](this: Schema, value: any) {\n const schema = Schema(this)\n schema.meta = { ...schema.meta, [key]: value }\n return schema\n },\n })\n}\n\nSchema.prototype.volatile = function volatile() {\n if (this.meta.volatile) throw new TypeError('volatile schema is already wrapped')\n return this.extra('volatile', true)\n}\n\nconst resolvers: Dict<Schemastery.Resolve> = {}\nconst checkedVolatile = Symbol('checked-volatile-schema')\n\nfunction validateVolatileSchema(schema: Schema, path: (keyof any)[] = [], blocked = false, seen = new Map<Schema, Set<boolean>>()) {\n const states = seen.get(schema) ?? new Set<boolean>()\n if (states.has(blocked)) return\n states.add(blocked)\n seen.set(schema, states)\n if (schema.meta?.volatile && blocked) {\n throw new ValidationError('volatile fields require a fixed object path without an enclosing volatile field', { path })\n }\n const nested = blocked || !!schema.meta?.volatile\n if (schema.dict) {\n for (const [key, child] of Object.entries(schema.dict)) validateVolatileSchema(child, [...path, key], nested, seen)\n }\n if (schema.sKey) validateVolatileSchema(schema.sKey, [...path, '<key>'], true, seen)\n if (schema.inner && (schema.type !== 'lazy' || schema.inner[kSchema])) {\n validateVolatileSchema(schema.inner, [...path, '*'], true, seen)\n }\n if (schema.list) {\n for (let index = 0; index < schema.list.length; index++) {\n validateVolatileSchema(schema.list[index]!, [...path, String(index)], true, seen)\n }\n }\n}\n\nSchema.extend = function extend(type, resolve) {\n resolvers[type] = resolve\n}\n\nSchema.resolve = function resolve(data, schema, options = {}, strict = false) {\n if (!schema) return [data]\n if (!(options as Schemastery.Options & { [checkedVolatile]?: boolean })[checkedVolatile]) {\n validateVolatileSchema(schema, options.path)\n options = { ...options, [checkedVolatile]: true } as Schemastery.Options\n }\n if (schema.meta?.volatile) {\n const inner = Schema(schema)\n inner.meta = { ...schema.meta, volatile: false }\n const [value, adapted] = Schema.resolve(data, inner, options, strict)\n try {\n return [createVolatile(value), adapted]\n } catch (error) {\n throw new ValidationError(error instanceof Error ? error.message : String(error), options)\n }\n }\n if (options.ignore?.(data, schema)) return [data]\n\n if (isNullable(data) && schema.type !== 'lazy') {\n if (schema.meta.required) throw new ValidationError(`missing required value`, options)\n let current = schema\n let fallback = schema.meta.default\n while (current?.type === 'intersect' && isNullable(fallback)) {\n current = current.list![0]\n fallback = current?.meta.default\n }\n if (isNullable(fallback)) return [data]\n data = clone(fallback)\n }\n\n const callback = resolvers[schema.type]\n if (!callback) throw new ValidationError(`unsupported type \"${schema.type}\"`, options)\n\n try {\n return callback(data, schema, options, strict)\n } catch (error) {\n if (!schema.meta.loose) throw error\n return [schema.meta.default]\n }\n}\n\nSchema.from = function from(source: any) {\n if (isNullable(source)) {\n return Schema.any()\n } else if (['string', 'number', 'boolean'].includes(typeof source)) {\n return Schema.const(source).required()\n } else if (source[kSchema]) {\n return source\n } else if (typeof source === 'function') {\n switch (source) {\n case String: return Schema.string().required()\n case Number: return Schema.number().required()\n case Boolean: return Schema.boolean().required()\n case Function: return Schema.function().required()\n default: return Schema.is(source).required()\n }\n } else {\n throw new TypeError(`cannot infer schema from ${source}`)\n }\n}\n\nSchema.lazy = function lazy(builder) {\n const toJSON = () => {\n if (!schema.inner![kSchema]) {\n schema.inner = schema.builder!()\n schema.inner!.meta = { ...schema.meta, ...schema.inner!.meta }\n }\n return schema.inner!.toJSON()\n }\n const schema = new Schema({ type: 'lazy', builder, inner: { toJSON } as any })\n return schema as any\n}\n\nSchema.natural = function natural() {\n return Schema.number().step(1).min(0)\n}\n\nSchema.percent = function percent() {\n return Schema.number().step(0.01).min(0).max(1).role('slider')\n}\n\nSchema.date = function date() {\n return Schema.union([\n Schema.is(Date),\n Schema.transform(Schema.string().role('datetime'), (value, options) => {\n const date = new Date(value)\n if (isNaN(+date)) throw new ValidationError(`invalid date \"${value}\"`, options)\n return date\n }, true),\n ])\n}\n\nSchema.regExp = function regExp(flag = '') {\n return Schema.union([\n Schema.is(RegExp),\n Schema.transform(Schema.string().role('regexp', { flag }), (value, options) => {\n try {\n return new RegExp(value, flag)\n } catch (e: any) {\n throw new ValidationError(e.message, options)\n }\n }, true),\n ])\n}\n\nSchema.arrayBuffer = function arrayBuffer(encoding?: 'hex' | 'base64'): any {\n return Schema.union([\n Schema.is(ArrayBuffer),\n Schema.is(SharedArrayBuffer),\n Schema.transform(Schema.any<ArrayBufferView>(), (value, options) => {\n if (Binary.isSource(value)) return Binary.fromSource(value)\n throw new ValidationError(`expected ArrayBufferSource but got ${value}`, options)\n }, true),\n ...encoding ? [Schema.transform(Schema.string(), (value, options) => {\n try {\n return encoding === 'base64'\n ? Binary.fromBase64(value)\n : Binary.fromHex(value)\n } catch (e: any) {\n throw new ValidationError(e.message, options)\n }\n }, true)] as const : [],\n ])\n}\n\nSchema.extend('lazy', (data, schema, options, strict) => {\n if (!schema.inner![kSchema]) {\n schema.inner = schema.builder!()\n schema.inner!.meta = { ...schema.meta, ...schema.inner!.meta }\n validateVolatileSchema(schema.inner!, options.path, true)\n }\n return Schema.resolve(data, schema.inner!, options, strict)\n})\n\nSchema.extend('any', (data) => {\n return [data]\n})\n\nSchema.extend('never', (data, _, options) => {\n throw new ValidationError(`expected nullable but got ${data}`, options)\n})\n\nSchema.extend('const', (data, { value }, options) => {\n if (deepEqual(data, value)) return [value]\n throw new ValidationError(`expected ${value} but got ${data}`, options)\n})\n\nfunction checkWithinRange(data: number, meta: Schemastery.Meta<any>, description: string, options: Schemastery.Options, skipMin = false) {\n const { max = Infinity, min = -Infinity } = meta\n if (data > max) throw new ValidationError(`expected ${description} <= ${max} but got ${data}`, options)\n if (data < min && !skipMin) throw new ValidationError(`expected ${description} >= ${min} but got ${data}`, options)\n}\n\nSchema.extend('string', (data, { meta }, options) => {\n if (typeof data !== 'string') throw new ValidationError(`expected string but got ${data}`, options)\n if (meta.pattern) {\n const regexp = new RegExp(meta.pattern.source, meta.pattern.flags)\n if (!regexp.test(data)) throw new ValidationError(`expect string to match regexp ${regexp}`, options)\n }\n checkWithinRange(data.length, meta, 'string length', options)\n return [data]\n})\n\nfunction decimalShift(data: number, digits: number) {\n const str = data.toString()\n if (str.includes('e')) return data * Math.pow(10, digits)\n const index = str.indexOf('.')\n if (index === -1) return data * Math.pow(10, digits)\n const frac = str.slice(index + 1)\n const integer = str.slice(0, index)\n if (frac.length <= digits) return +(integer + frac.padEnd(digits, '0'))\n return +(integer + frac.slice(0, digits) + '.' + frac.slice(digits))\n}\n\nfunction isMultipleOf(data: number, min: number, step: number) {\n step = Math.abs(step)\n if (!/^\\d+\\.\\d+$/.test(step.toString())) {\n return (data - min) % step === 0\n }\n const index = step.toString().indexOf('.')\n const digits = step.toString().slice(index + 1).length\n return Math.abs(decimalShift(data, digits) - decimalShift(min, digits)) % decimalShift(step, digits) === 0\n}\n\nSchema.extend('number', (data, { meta }, options) => {\n if (typeof data !== 'number') throw new ValidationError(`expected number but got ${data}`, options)\n checkWithinRange(data, meta, 'number', options)\n const { step } = meta\n if (step && !isMultipleOf(data, meta.min ?? 0, step)) {\n throw new ValidationError(`expected number multiple of ${step} but got ${data}`, options)\n }\n return [data]\n})\n\nSchema.extend('boolean', (data, _, options) => {\n if (typeof data === 'boolean') return [data]\n throw new ValidationError(`expected boolean but got ${data}`, options)\n})\n\nSchema.extend('bitset', (data, { bits, meta }, options) => {\n let value = 0, keys: string[] = []\n if (typeof data === 'number') {\n value = data\n for (const key in bits!) {\n if (data & bits![key]!) {\n keys.push(key)\n }\n }\n } else if (Array.isArray(data)) {\n keys = data\n for (const key of keys) {\n if (typeof key !== 'string') throw new ValidationError(`expected string but got ${key}`, options)\n if (key in bits!) value |= bits![key]!\n }\n } else {\n throw new ValidationError(`expected number or array but got ${data}`, options)\n }\n if (value === meta.default) return [value]\n return [value, keys]\n})\n\nSchema.extend('function', (data, _, options) => {\n if (typeof data === 'function') return [data]\n throw new ValidationError(`expected function but got ${data}`, options)\n})\n\nSchema.extend('is', (data, { constructor }, options) => {\n if (typeof constructor === 'function') {\n if (data instanceof constructor) return [data]\n throw new ValidationError(`expected ${constructor.name} but got ${data}`, options)\n } else {\n if (isNullable(data)) {\n throw new ValidationError(`expected ${constructor} but got ${data}`, options)\n }\n let prototype = Object.getPrototypeOf(data)\n while (prototype) {\n if (prototype.constructor?.name === constructor) return [data]\n prototype = Object.getPrototypeOf(prototype)\n }\n throw new ValidationError(`expected ${constructor} but got ${data}`, options)\n }\n})\n\nfunction property(data: any, key: keyof any, schema: Schema, options: Schemastery.Options) {\n try {\n const [value, adapted] = Schema.resolve(data[key], schema, {\n ...options,\n path: [...options.path || [], key],\n })\n if (adapted !== undefined) data[key] = adapted\n return value\n } catch (e) {\n if (!options?.autofix) throw e\n delete data[key]\n return schema.meta.volatile ? createVolatile(schema.meta.default) : schema.meta.default\n }\n}\n\nSchema.extend('array', (data, { inner, meta }, options) => {\n if (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options)\n checkWithinRange(data.length, meta, 'array length', options, !isNullable(inner!.meta.default))\n return [data.map((_, index) => property(data, index, inner!, options))]\n})\n\nSchema.extend('dict', (data, { inner, sKey }, options, strict) => {\n if (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options)\n const result: any = {}\n for (const key in data) {\n let rKey: string\n try {\n rKey = Schema.resolve(key, sKey!, options)[0]\n } catch (error) {\n if (strict) continue\n throw error\n }\n result[rKey] = property(data, key, inner!, options)\n data[rKey] = data[key]\n if (key !== rKey) delete data[key]\n }\n return [result]\n})\n\nSchema.extend('tuple', (data, { list }, options, strict) => {\n if (!Array.isArray(data)) throw new ValidationError(`expected array but got ${data}`, options)\n const result = list!.map((inner, index) => property(data, index, inner, options))\n if (strict) return [result]\n result.push(...data.slice(list!.length))\n return [result]\n})\n\nfunction merge(result: any, data: any) {\n for (const key in data) {\n if (key in result) continue\n result[key] = data[key]\n }\n}\n\nSchema.extend('object', (data, { dict }, options, strict) => {\n if (!isPlainObject(data)) throw new ValidationError(`expected object but got ${data}`, options)\n const result: any = {}\n for (const key in dict) {\n const value = property(data, key, dict![key]!, options)\n if (!isNullable(value) || key in data) {\n result[key] = value\n }\n }\n if (!strict) merge(result, data)\n return [result]\n})\n\nSchema.extend('union', (data, { list, toString }, options, strict) => {\n const messages: any[] = []\n for (const inner of list!) {\n try {\n return Schema.resolve(data, inner, options, strict)\n } catch (error) {\n messages.push(error)\n }\n }\n throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options)\n})\n\nSchema.extend('intersect', (data, { list, toString }, options, strict) => {\n if (!list!.length) return [data]\n let result\n for (const inner of list!) {\n const value: any = Schema.resolve(data, inner, options, true)[0]\n if (isNullable(value)) continue\n if (isNullable(result)) {\n result = value\n } else if (typeof result !== typeof value) {\n throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options)\n } else if (typeof value === 'object') {\n merge(result ??= {}, value)\n } else if (result !== value) {\n throw new ValidationError(`expected ${toString()} but got ${JSON.stringify(data)}`, options)\n }\n }\n if (!strict && isPlainObject(data)) merge(result, data)\n return [result]\n})\n\nSchema.extend('transform', (data, { inner, callback, preserve }, options) => {\n const [result, adapted = data] = Schema.resolve(data, inner!, options, true)\n if (preserve) {\n return [callback!(result)]\n // } else if (isPlainObject(data)) {\n // const temp: any = {}\n // for (const key in result) {\n // if (!(key in data)) continue\n // temp[key] = data[key]\n // delete data[key]\n // }\n // Object.assign(data, callback!(temp))\n // return [callback!(result)]\n } else {\n return [callback!(result), callback!(adapted)]\n }\n})\n\ntype Formatter = (schema: Schema, inline?: boolean) => string\nconst formatters: Dict<Formatter> = {}\n\nfunction defineMethod(name: string, keys: (keyof Schema)[], format: Formatter) {\n formatters[name] = format\n Object.assign(Schema, {\n [name](...args: any[]) {\n const schema = new Schema({ type: name } as Schema)\n keys.forEach((key, index) => {\n switch (key) {\n case 'sKey': schema.sKey = args[index] ?? Schema.string(); break\n case 'inner': schema.inner = Schema.from(args[index]); break\n case 'list': schema.list = args[index].map(Schema.from); break\n case 'dict': schema.dict = valueMap(args[index], Schema.from); break\n case 'bits': {\n schema.bits = {}\n for (const key in args[index]) {\n if (typeof args[index][key] !== 'number') continue\n schema.bits[key] = args[index][key]\n }\n break\n }\n case 'callback': {\n const callback = schema.callback = args[index]\n ;callback['toJSON'] ||= () => callback.toString()\n break\n }\n case 'constructor': {\n const constructor = schema.constructor = args[index]\n if (typeof constructor === 'function') {\n ;constructor['toJSON'] ||= () => constructor['name']\n }\n break\n }\n default: schema[key] = args[index] as never\n }\n })\n if (name === 'object' || name === 'dict') {\n schema.meta.default = {}\n } else if (name === 'array' || name === 'tuple') {\n schema.meta.default = []\n } else if (name === 'bitset') {\n schema.meta.default = 0\n }\n return schema\n },\n })\n}\n\ndefineMethod('is', ['constructor'], ({ constructor }) => {\n if (typeof constructor === 'function') {\n return constructor.name\n } else {\n return constructor!\n }\n})\n\ndefineMethod('any', [], () => 'any')\ndefineMethod('never', [], () => 'never')\ndefineMethod('const', ['value'], ({ value }) => typeof value === 'string' ? JSON.stringify(value) : value)\ndefineMethod('string', [], () => 'string')\ndefineMethod('number', [], () => 'number')\ndefineMethod('boolean', [], () => 'boolean')\ndefineMethod('bitset', ['bits'], () => 'bitset')\ndefineMethod('function', [], () => 'function')\ndefineMethod('array', ['inner'], ({ inner }) => `${inner!.toString(true)}[]`)\ndefineMethod('dict', ['inner', 'sKey'], ({ inner, sKey }) => `{ [key: ${sKey!.toString()}]: ${inner!.toString()} }`)\ndefineMethod('tuple', ['list'], ({ list }) => `[${list!.map((inner) => inner.toString()).join(', ')}]`)\n\ndefineMethod('object', ['dict'], ({ dict }) => {\n if (Object.keys(dict!).length === 0) return '{}'\n return `{ ${Object.entries(dict!).map(([key, inner]) => {\n return `${key}${inner!.meta.required ? '' : '?'}: ${inner!.toString()}`\n }).join(', ')} }`\n})\n\ndefineMethod('union', ['list'], ({ list }, inline) => {\n const result = list!.map(({ toString: format }) => format()).join(' | ')\n return inline ? `(${result})` : result\n})\n\ndefineMethod('intersect', ['list'], ({ list }) => {\n return `${list!.map((inner) => inner.toString(true)).join(' & ')}`\n})\n\ndefineMethod('transform', ['inner', 'callback', 'preserve'], ({ inner }, isInner) => inner!.toString(isInner))\n\nexport default Schema\n","/** Public polling configuration shared by the notification Host and Client halves. */\nimport Schema from '@deepseek-ai/schemastery'\n\n/** Initial polling interval before the server supplies its next delay. */\nexport interface Config {\n /** Initial query delay in milliseconds, replaced by each successful server response. */\n notificationPollIntervalMs: number\n}\n/** Validate notification polling configuration. */\nexport const Config = Schema.object({\n notificationPollIntervalMs: Schema.natural().min(1).max(2_147_483_647).default(600_000),\n})\n/** Bootstrap key for public notification configuration. */\nexport const NOTIFICATIONS_CONFIG_GLOBAL = '__DSH_ACCOUNT_NOTIFICATIONS_CONFIG__'\n","/** Animate a notification promotion across the old and new card dimensions. */\nimport { flushSync } from 'react-dom'\n\n/**\n * Close a card and animate surviving siblings from their currently displayed rectangles.\n * @param card - mounted foreground card whose direct parent owns the stack.\n * @param dismiss - synchronous notification-store update for the close gesture.\n */\nexport function dismissNotice(card: HTMLElement, dismiss: () => void): void {\n if (typeof card.animate !== 'function' || getComputedStyle(card).transitionDuration === '0s') {\n dismiss()\n return\n }\n const stack = card.parentElement as HTMLElement\n const before = [...stack.querySelectorAll<HTMLElement>('aside')]\n .map(element => ({ element, rect: element.getBoundingClientRect() }))\n for (const { element } of before) {\n for (const animation of element.getAnimations()) animation.cancel()\n element.style.transition = 'none'\n }\n flushSync(dismiss)\n for (const { element, rect } of before) {\n if (!element.isConnected) continue\n const transform = getComputedStyle(element).transform\n element.style.transform = 'none'\n const next = element.getBoundingClientRect()\n element.style.transform = ''\n element.animate([\n { transform: `translate(${rect.x + rect.width / 2 - next.x - next.width / 2}px, ${rect.y - next.y}px) scale(${rect.width / next.width}, ${rect.height / next.height})` },\n { transform },\n ], { duration: 250, easing: 'ease-out' })\n element.style.transition = ''\n }\n}\n","/** Notification extension rendered inside the sidebar account menu. */\nimport { useEffect, useRef, type CSSProperties } from 'react'\nimport { Button, IconCloseOutlineRegular } from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { HostObservable, InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots'\nimport type {} from '@deepseek-ai/dsh-client-ui-settings-account/client'\nimport type { AccountNotice } from './notification-controller.ts'\nimport type { NotificationKey } from './locales.ts'\nimport css from './AccountNotifications.module.css'\nimport { dismissNotice } from './notice-transition.ts'\n\n/** Notification view and interactions supplied by the notification plugin. */\nexport interface AccountNotificationsInjected {\n hooks: { notices: HostObservable<readonly AccountNotice[]> }\n /** @param id - notification that completed a displayed frame. */\n shown: (id: AccountNotice['id']) => void\n /** @param id - foreground notification whose non-dismiss action was clicked. */\n ctaClicked: (id: AccountNotice['id']) => void\n /** @param id - notification explicitly closed by the user. */\n dismiss: (id: AccountNotice['id']) => void\n}\n\n/** Notification component props derived from its parent-owned slot. */\nexport type AccountNotificationsProps = PropsRuntime<'settings.launcher.notifications'>\n & InjectFace<AccountNotificationsInjected> & PropsLocale<'account.notifications'>\n\n/** @param props - account-menu availability and notification content. @returns the anchored notification stack. */\nexport function AccountNotifications({ active, openAccount, useNotices, shown, ctaClicked, dismiss, t }: AccountNotificationsProps) {\n const notices = useNotices(value => value)\n return active && <AccountNoticeStack notices={notices} closeLabel={t('close')}\n onOpenAccount={openAccount} onShown={shown} onCtaClicked={ctaClicked} onDismiss={dismiss} />\n}\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap { 'account.notifications': NotificationKey }\n}\n\n/* v8 ignore next 3 -- closed-union defaults only defend future source widening */\nfunction assertNever(_value: never): never {\n throw new Error('unsupported account notification target')\n}\n\n/** @param displayUntil - server display deadline. @returns whether the notification remains eligible for display. */\nfunction live(displayUntil: string | null): boolean {\n if (displayUntil === null) return true\n const expires = Date.parse(displayUntil)\n // An unparsable timestamp is not evidence of expiry, so the notice still shows.\n return Number.isNaN(expires) || expires > Date.now()\n}\n\n/**\n * @param run - callback to invoke once one presented frame has passed.\n * @returns a canceller for a card that unmounts or hides first.\n */\nfunction afterPaint(run: () => void): () => void {\n if (typeof requestAnimationFrame !== 'function') {\n // Without a frame clock, the following task is the best available paint boundary.\n const timer = setTimeout(run, 0)\n return () => { clearTimeout(timer) }\n }\n let cancelled = false\n let timer: ReturnType<typeof setTimeout> | undefined\n const frame = requestAnimationFrame(() => {\n // The frame callback runs before its paint; the following task runs after it.\n timer = setTimeout(() => {\n if (!cancelled) run()\n }, 0)\n })\n return () => {\n cancelled = true\n cancelAnimationFrame(frame)\n if (timer !== undefined) clearTimeout(timer)\n }\n}\n\n/** @param props - server-ordered notices, localized fallback copy, and display callbacks.\n * @returns a non-modal stack whose foreground card alone can report display or be closed.\n */\nexport function AccountNoticeStack({ notices, closeLabel, onShown, onCtaClicked, onDismiss, onOpenAccount }: {\n notices: readonly AccountNotice[]\n closeLabel: string\n /** Open the account settings route while retaining the notification. */\n onOpenAccount: () => void\n /** Called after the foreground card has passed a visible presented frame. */\n onShown: (id: AccountNotice['id']) => void\n /** Called when the user clicks any non-dismiss action on the foreground card. */\n onCtaClicked: (id: AccountNotice['id']) => void\n /** Called when the user closes the foreground card. */\n onDismiss: (id: AccountNotice['id']) => void\n}) {\n const liveNotices = notices.filter(notice => live(notice.displayUntil))\n return <div className={css.stack}>\n {liveNotices.map((notice, depth) => <NoticeCard key={notice.id} notice={notice} depth={depth}\n closeLabel={closeLabel}\n onShown={onShown} onCtaClicked={onCtaClicked} onDismiss={onDismiss} onOpenAccount={onOpenAccount} />)}\n </div>\n}\n\n/** One stable card node remains mounted as the cards before it are dismissed. */\nfunction NoticeCard({ notice, depth, closeLabel, onShown, onCtaClicked, onDismiss, onOpenAccount }: {\n notice: AccountNotice\n depth: number\n closeLabel: string\n onOpenAccount: () => void\n onShown: (id: AccountNotice['id']) => void\n onCtaClicked: (id: AccountNotice['id']) => void\n onDismiss: (id: AccountNotice['id']) => void\n}) {\n const foreground = depth === 0\n const card = useRef<HTMLElement>(null)\n const reported = useRef(false)\n const actionSlots = new Map<string, number>()\n useEffect(() => {\n if (!foreground || reported.current || !live(notice.displayUntil)) return\n const element = card.current\n /* v8 ignore next -- React attaches the card ref before running this effect. */\n if (element === null) return\n let intersecting = false\n let cancel: (() => void) | undefined\n const visible = () => intersecting && document.visibilityState !== 'hidden' && !element.closest('[hidden], [inert]')\n const attempt = () => {\n if (reported.current || cancel !== undefined || !live(notice.displayUntil)) return\n if (!visible()) return\n cancel = afterPaint(() => {\n cancel = undefined\n if (reported.current || !visible() || !live(notice.displayUntil)) return\n reported.current = true\n onShown(notice.id)\n })\n }\n const observer = new IntersectionObserver((entries) => {\n for (const entry of entries) {\n intersecting = entry.isIntersecting\n attempt()\n }\n })\n observer.observe(element)\n document.addEventListener('visibilitychange', attempt)\n return () => {\n observer.disconnect()\n document.removeEventListener('visibilitychange', attempt)\n cancel?.()\n }\n }, [foreground, notice.id, notice.displayUntil, onShown])\n return <aside ref={card} className={css.card} data-front={foreground} aria-hidden={!foreground}\n style={{ '--notice-depth': depth, '--notice-scale': Math.pow(252 / 260, depth) } as CSSProperties}>\n <div role=\"status\" className={css.copy}>\n <div className={css.title}><span className={css.icon} aria-hidden=\"true\">\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\">\n <path d=\"M3.6355 6.93969C3.6355 4.8398 5.33779 3.1375 7.43768 3.1375C9.53757 3.1375 11.23987 4.8398 11.23987 6.93968V11.363H3.6355V6.93969Z\" fill=\"currentColor\" fillOpacity=\"0.2\" stroke=\"currentColor\" strokeWidth=\"0.875\" />\n <path d=\"M1.641 11.3645H12.36M5.053 13.3095H8.9479M7.4375 4.27422V2.70137912\" stroke=\"currentColor\" strokeWidth=\"0.875\" />\n </svg>\n </span><span>{notice.title}</span></div>\n <p>{notice.body}</p>\n </div>\n {notice.actions.length > 0 && <div className={css.actions}>\n {notice.actions.map((action) => {\n const target = JSON.stringify(action.target)\n const occurrence = actionSlots.get(target) ?? 0\n actionSlots.set(target, occurrence + 1)\n return <Button key={`${target}:${occurrence}`} size=\"sm\" className={css.action}\n variant={action.style === 'primary' ? 'primary' : 'outline'} tabIndex={foreground ? undefined : -1}\n onClick={(event) => {\n if (action.target.type !== 'dismiss') onCtaClicked(notice.id)\n switch (action.target.type) {\n case 'app_route': onOpenAccount(); break\n case 'dismiss': dismissNotice(event.currentTarget.closest('aside') as HTMLElement, () => { onDismiss(notice.id) }); break\n /* v8 ignore next -- the Host validates both supported target variants */\n default: assertNever(action.target)\n }\n }}>{action.label}</Button>\n })}\n </div>}\n <button type=\"button\" tabIndex={foreground ? undefined : -1} className={css.close} aria-label={closeLabel} onClick={(event) => { dismissNotice(event.currentTarget.parentElement as HTMLElement, () => { onDismiss(notice.id) }) }}><IconCloseOutlineRegular size={10} /></button>\n </aside>\n}\n","/**\n * Lifecycle of account notifications: one foreground card in a stack, one read result in\n * force at a time, and independent display, action-click, and dismissal reports. Account activation\n * and Settings entry replace the polling cycle with an immediate read. Each read\n * settles before the next delay begins; the server owns unconsumed notifications.\n *\n * A displayed event is sent once the foreground card reports a presented frame: the card has\n * a position, the document is visible, and it painted one frame. The card measures\n * no cover, so a card painted under the open Settings overlay reports like any\n * other. Business-action clicks report without waiting or closing the card.\n * Explicit dismissal sends only a dismissed event.\n * Expiry and account cleanup do not report dismissal.\n *\n * One lifecycle covers one signed-in session. Login-progress updates retain the\n * card and active poll. Credential and connection changes end\n * that lifecycle before another begins. Signing out and unloading also clear\n * the cards; a later sign-in shows whatever the server offers.\n * @module @deepseek-ai/dsh-client-ui-account-notifications/src/client/notification-controller\n */\nimport type {\n AccountNotification, AccountNotificationBatch, AccountNotificationEvent, AccountNotificationId,\n} from '@deepseek-ai/dsh-deepseek-account/types'\n\n/** Notification content currently available to the sidebar presentation. */\nexport type AccountNotice = AccountNotification\n\n/** Collaborators and polling interval of one account notification lifecycle. */\nexport interface NotificationControllerOptions {\n /** Initial delay for each poll, retained until the server provides a new one. */\n readonly pollIntervalMs: number\n /** UI language in effect when the controller starts. */\n readonly locale: string\n /** Read the signed-in account's unconsumed notifications. @returns the batch, or null when no account is signed in. */\n read: (locale: string) => Promise<AccountNotificationBatch | null>\n /**\n * Query localized content for an existing card without changing consumption.\n * @param id - notification requested by stable identity.\n * @param locale - language captured for this request.\n * @returns content, or null when the account changed; failures reject.\n */\n readContent: (id: AccountNotificationId, locale: string) => Promise<AccountNotification | null>\n /**\n * Report one notification interaction.\n * @param id - notification the user interacted with.\n * @param event - displayed frame, business-action click, or explicit dismissal.\n * @returns false when the account changed or signed out; a protocol failure rejects.\n */\n reportEvent: (id: AccountNotificationId, event: AccountNotificationEvent) => Promise<boolean>\n /** @param notices - notices in front-to-back order; empty when none are shown. */\n publish: (notices: readonly AccountNotice[]) => void\n}\n\n/** Commands the account plugin issues to the account notification lifecycle. */\nexport interface NotificationController {\n /**\n * Start the signed-in lifecycle and restart polling with an immediate read.\n * Re-entry retains cards; the caller ends the lifecycle on credential or connection changes.\n */\n begin(): void\n /** Stop the lifecycle, drop the displayed notice, and ignore late event failures. */\n end(): void\n /**\n * Restart polling with an immediate read, retaining cards.\n * @returns after the immediate read settles, without waiting for later polls.\n */\n refresh(): Promise<void>\n /**\n * Refresh current cards in a new UI language, retaining order and consumption.\n * @param locale - active UI language; an unchanged value issues no request.\n * @returns after content requests settle; failures retain the previous content.\n */\n setLocale(locale: string): Promise<void>\n /** @param id - notice whose card passed a presented frame while visible. */\n shown(id: AccountNotificationId): void\n /** @param id - foreground notice whose non-dismiss action was clicked; reports without removing the card. */\n ctaClicked(id: AccountNotificationId): void\n /** @param id - foreground notice the user explicitly closed; reports only a dismissed event. */\n dismiss(id: AccountNotificationId): void\n}\n\n/** One replaceable query cycle; an obsolete request cannot publish or schedule another read. */\ninterface NotificationPoll {\n intervalMs: number\n timer?: ReturnType<typeof setTimeout>\n}\n\n/**\n * @param displayUntil - server expiration timestamp.\n * @param at - milliseconds since epoch.\n * @returns whether the notification can no longer be shown.\n */\nfunction expired(displayUntil: string | null, at: number): boolean {\n if (displayUntil === null) return false\n const expires = Date.parse(displayUntil)\n // An unparsable timestamp is not evidence of expiry, so the notice still shows.\n return !Number.isNaN(expires) && expires <= at\n}\n\n/**\n * Own the read, display, and interaction reporting lifecycle of account notifications.\n * @param options - collaborators and timings.\n * @returns the controller the account plugin drives from account and settings state.\n */\nexport function createNotificationController(options: NotificationControllerOptions): NotificationController {\n let scope: object | undefined\n let locale = options.locale\n let contentGeneration = 0\n /** Notice currently published to the sidebar, including the expiration checked at display time. */\n let current: readonly AccountNotice[] = []\n let poll: NotificationPoll | undefined\n /** Notifications the card on screen already reported, so one mount cannot report display twice. */\n const reported = new Set<AccountNotificationId>()\n const setCurrent = (notices: readonly AccountNotice[]): void => {\n if (notices.length === current.length && notices.every((notice, index) => {\n return JSON.stringify(notice) === JSON.stringify(current[index])\n })) return\n const retained = new Set(notices.map(notice => notice.id))\n for (const id of reported) if (!retained.has(id)) reported.delete(id)\n current = notices\n options.publish(notices)\n }\n /**\n * Keep a presented foreground card until dismissal or expiration, refreshing\n * its copy when offered again; other live candidates follow in server order.\n */\n const apply = (batch: AccountNotificationBatch, preserveCopy: boolean): void => {\n const notifications = batch.notifications.map((notice) => {\n const previous = preserveCopy ? current.find(value => value.id === notice.id) : undefined\n return previous === undefined ? notice : { ...notice, title: previous.title, body: previous.body, actions: previous.actions }\n })\n const foreground = current[0]\n const retained = foreground !== undefined && reported.has(foreground.id)\n ? notifications.find(notice => notice.id === foreground.id) ?? foreground\n : undefined\n const at = Date.now()\n const candidates = notifications.filter(notice => !expired(notice.displayUntil, at))\n setCurrent(retained !== undefined && !expired(retained.displayUntil, at)\n ? [retained, ...candidates.filter(notice => notice.id !== retained.id)]\n : candidates)\n }\n\n /** Refresh only cards that still belong to this account and language when the replies settle. */\n async function refreshContent(): Promise<void> {\n const scopeAtCall = scope\n if (scopeAtCall === undefined || current.length === 0) return\n const generation = ++contentGeneration\n const requestedLocale = locale\n const responses = await Promise.allSettled(current.map(async notice => options.readContent(notice.id, requestedLocale)))\n if (scope !== scopeAtCall || generation !== contentGeneration) return\n if (responses.some(response => response.status === 'rejected')) console.error('[deepseek-account] notification content read failed')\n const updates = responses.flatMap(response => response.status === 'fulfilled' && response.value !== null ? [response.value] : [])\n setCurrent(current.map((notice) => {\n const update = updates.find(value => value.id === notice.id)\n return update == null ? notice : { ...notice, title: update.title, body: update.body, actions: update.actions }\n }))\n }\n\n /**\n * Read once for the active poll, retaining cards on failure. Replacement and\n * sign-out discard late replies and prevent another read from being scheduled.\n * @param pollAtRead - query cycle that owns this read.\n * @returns after this read settles.\n */\n async function runRead(pollAtRead: NotificationPoll): Promise<void> {\n const requestedLocale = locale\n let batch: AccountNotificationBatch | null\n try { batch = await options.read(requestedLocale) }\n catch (_error) {\n if (poll !== pollAtRead) return\n console.error('[deepseek-account] notification read failed; retaining cards and retrying on the next poll')\n batch = null\n }\n if (poll !== pollAtRead) return\n if (batch !== null) {\n pollAtRead.intervalMs = batch.nextPollAfterSeconds * 1_000\n apply(batch, requestedLocale !== locale)\n if (requestedLocale !== locale) await refreshContent()\n }\n if (poll !== pollAtRead) return\n pollAtRead.timer = setTimeout(() => { void runRead(pollAtRead) }, pollAtRead.intervalMs)\n }\n\n const stopPolling = (): void => {\n if (poll?.timer !== undefined) clearTimeout(poll.timer)\n poll = undefined\n }\n const restartPolling = (): Promise<void> => {\n stopPolling()\n poll = { intervalMs: options.pollIntervalMs }\n return runRead(poll)\n }\n\n /** Attempt each interaction once without changing the card on failure. */\n const report = async (id: AccountNotificationId, event: AccountNotificationEvent): Promise<void> => {\n const scopeAtReport = scope\n if (scopeAtReport === undefined || current[0]?.id !== id || (event === 'displayed' && reported.has(id))) return\n if (event === 'displayed') reported.add(id)\n try { await options.reportEvent(id, event) }\n catch (_error) {\n if (scope === scopeAtReport) {\n console.error('[deepseek-account] notification event report failed; keeping local state without retry', { event })\n }\n }\n }\n\n const endLifecycle = (): void => {\n if (scope === undefined) return\n stopPolling()\n scope = undefined\n contentGeneration++\n reported.clear()\n setCurrent([])\n }\n\n return {\n begin() {\n scope ??= {}\n void restartPolling()\n },\n end: endLifecycle,\n refresh(): Promise<void> {\n if (scope === undefined) return Promise.resolve()\n return restartPolling()\n },\n async setLocale(value) {\n if (value === locale) return\n locale = value\n contentGeneration++\n await refreshContent()\n },\n shown(id) {\n setCurrent(current.filter(notice => !expired(notice.displayUntil, Date.now())))\n if (current[0]?.id !== id) return\n void report(id, 'displayed')\n },\n ctaClicked(id) {\n setCurrent(current.filter(notice => !expired(notice.displayUntil, Date.now())))\n if (current[0]?.id !== id) return\n void report(id, 'cta_clicked')\n },\n dismiss(id) {\n setCurrent(current.filter(notice => !expired(notice.displayUntil, Date.now())))\n if (current[0]?.id !== id) return\n void report(id, 'dismissed')\n setCurrent(current.slice(1).filter(notice => !expired(notice.displayUntil, Date.now())))\n },\n }\n}\n","/** Close-control copy owned by account notifications; notification content is server-localized. */\nexport const en = { close: 'Close' }\n/** Chinese notification controls. */\nexport const zh = { close: '关闭' }\n/** Japanese notification controls. */\nexport const ja = { close: '閉じる' }\n/** Spanish notification controls. */\nexport const es = { close: 'Cerrar' }\n/** French notification controls. */\nexport const fr = { close: 'Fermer' }\n/** German notification controls. */\nexport const de = { close: 'Schließen' }\n/** Russian notification controls. */\nexport const ru = { close: 'Закрыть' }\n/** Portuguese notification controls. */\nexport const pt = { close: 'Fechar' }\n/** Localized notification control keys. */\nexport type NotificationKey = keyof typeof en\n","/** Account notifications driven by the existing account UI stream. */\nimport type { Context } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-api-remotes/client'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\nimport type { AccountUiState } from '@deepseek-ai/dsh-client-ui-settings-account/client'\nimport { Config, NOTIFICATIONS_CONFIG_GLOBAL } from '../config.ts'\nimport { AccountNotifications, type AccountNotificationsInjected } from './AccountNotifications.tsx'\nimport { createNotificationController, type AccountNotice } from './notification-controller.ts'\nimport { en, zh, ja, es, fr, de, ru, pt } from './locales.ts'\nexport type { AccountNotificationsInjected, AccountNotificationsProps } from './AccountNotifications.tsx'\n\n/** Services used for notification lifecycle and presentation. */\nexport const inject = ['slots', 'locale', 'remote', 'remote.account', 'accountUi']\n\n/** @param ctx - client plugin context sharing the account owner's existing state stream. */\nexport function apply(ctx: Context): void {\n const page = globalThis as Partial<Record<typeof NOTIFICATIONS_CONFIG_GLOBAL, unknown>>\n const config = Config(page[NOTIFICATIONS_CONFIG_GLOBAL] ?? {})\n ctx.effect(() => ctx.locale.register('account.notifications', { en, zh, ja, es, fr, de, ru, pt }), 'notifications: dictionaries')\n let snapshot: readonly AccountNotice[] = []\n const listeners = new Set<() => void>()\n const controller = createNotificationController({\n locale: ctx.locale.getSnapshot().active,\n pollIntervalMs: config.notificationPollIntervalMs,\n read: async (locale) => {\n const result = await ctx.remote.account.getNotifications(ctx.accountUi.clientMetadata(locale))\n if (!result.ok) throw new Error('account notification read failed')\n return result.value\n },\n readContent: async (id, locale) => {\n const result = await ctx.remote.account.getNotificationContent(id, ctx.accountUi.clientMetadata(locale))\n if (!result.ok) throw new Error('account notification content read failed')\n return result.value\n },\n reportEvent: async (id, event) => {\n const result = await ctx.remote.account.reportNotificationEvent(id, event,\n ctx.accountUi.clientMetadata(ctx.locale.getSnapshot().active))\n if (!result.ok) throw new Error('account notification event report failed')\n return result.value\n },\n publish: (notices) => { snapshot = notices; for (const listener of listeners) listener() },\n })\n const update = (state: AccountUiState, reset: boolean): void => {\n const signedIn = state.view?.status === 'credential-stored' && !state.failed\n if (reset || !signedIn) controller.end()\n if (signedIn && reset) controller.begin()\n }\n ctx.effect(() => () => { controller.end() }, 'notifications: account lifetime')\n ctx.on('account-ui/change', update)\n ctx.on('account-ui/refresh', () => controller.refresh())\n ctx.on('locale/change', (state) => { void controller.setLocale(state.active) })\n update(ctx.accountUi.getSnapshot(), true)\n const state = {\n getSnapshot: () => snapshot,\n subscribe: (listener: () => void) => { listeners.add(listener); return () => { listeners.delete(listener) } },\n }\n const injected: AccountNotificationsInjected = {\n hooks: { notices: state },\n shown: (id) => { controller.shown(id) },\n ctaClicked: (id) => { controller.ctaClicked(id) },\n dismiss: (id) => { controller.dismiss(id) },\n }\n ctx.slots.inject('settings.launcher.notifications', () => ctx.slots.register({\n name: 'settings.launcher.notifications', locale: 'account.notifications',\n inject: () => injected,\n }, AccountNotifications))\n}\n"],"mappings":";waAmBA,SAAgB,WAAW,MAA8C,CACvE,OAAO,QAAU,MAAQ,QAAU,IAAA,EACrC,CAQA,SAAgB,cAAc,KAAW,CACvC,OAAO,MAAQ,OAAO,OAAS,UAAY,CAAC,MAAM,QAAQ,IAAI,CAChE,CAOA,SAAgB,WAAW,OAAY,OAA8C,CACnF,OAAO,OAAO,YAAY,OAAO,QAAQ,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAK,SAAW,OAAO,IAAK,KAAK,CAAC,CAAC,CAC/F,CAGA,SAAgB,UAAkC,OAAoB,UAAoC,CACxG,OAAO,OAAO,YAAY,OAAO,QAAQ,MAAM,CAAC,CAAC,KAAK,CAAC,IAAK,SAAW,CAAC,IAAM,UAAkB,MAAO,GAA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,CAAG,EAC1F,EACD,MAAM,QAAU,MAAuB,QAAwB,CAC7D,MAAM,SAAW,MAAM,MAAM,SAAW,qBAAuB,CAAC,MAAM,OACtE,GAAI,OAAS,CAAC,SAAU,WAAW,IAAG,EACtC,GAAI,UAAY,MAAO,WAAW,MAAK,CACzC,EACA,IAAI,eAAkB,CAAG,WAAW,IAAG,CAAG,EAAG,iCAAiC,EAC9E,IAAI,GAAG,oBAAqB,MAAM,EAClC,IAAI,GAAG,yBAA4B,WAAW,QAAO,CAAE,EACvD,IAAI,GAAG,gBAAkB,OAAS,CAAG,WAAgB,UAAU,MAAM,MAAM,CAAE,CAAC,EAC9E,OAAO,IAAI,UAAU,YAAW,EAAI,IAAI,EAKxC,MAAM,SAAyC,CAC7C,MAAO,CAAE,QAAS,CAJlB,gBAAmB,SACnB,UAAY,UAAwB,CAAG,UAAU,IAAI,QAAQ,EAAG,UAAY,CAAG,UAAU,OAAO,QAAQ,CAAE,CAAE,CAG1F,CAAK,EACvB,MAAQ,IAAM,CAAG,WAAW,MAAM,EAAE,CAAE,EACtC,WAAa,IAAM,CAAG,WAAW,WAAW,EAAE,CAAE,EAChD,QAAU,IAAM,CAAG,WAAW,QAAQ,EAAE,CAAE,GAE5C,IAAI,MAAM,OAAO,sCAAyC,IAAI,MAAM,SAAS,CAC3E,KAAM,kCAAmC,OAAQ,wBACjD,WAAc,UACb,oBAAoB,CAAC,CAC1B"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Schema from "@deepseek-ai/schemastery";
|
|
2
|
+
//#region lib/types/config.js
|
|
3
|
+
/** Public polling configuration shared by the notification Host and Client halves. */
|
|
4
|
+
/** Validate notification polling configuration. */
|
|
5
|
+
const Config = Schema.object({ notificationPollIntervalMs: Schema.natural().min(1).max(2147483647).default(6e5) });
|
|
6
|
+
/** Bootstrap key for public notification configuration. */
|
|
7
|
+
const NOTIFICATIONS_CONFIG_GLOBAL = "__DSH_ACCOUNT_NOTIFICATIONS_CONFIG__";
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region lib/types/index.js
|
|
10
|
+
/** @param ctx - Host page bootstrap collector. @param config - validated notification configuration. */
|
|
11
|
+
function apply(ctx, config) {
|
|
12
|
+
ctx.on("webserver/index-inject", (table) => {
|
|
13
|
+
table.push({
|
|
14
|
+
kind: "global",
|
|
15
|
+
name: NOTIFICATIONS_CONFIG_GLOBAL,
|
|
16
|
+
value: config
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Config, apply };
|