dsh-timeband 1.3.8 → 1.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # DSH TimeBand
2
2
 
3
- **v1.3.8(待发布)** 按用户要求恢复 npm 包名 `dsh-timeband`,客户端加载、插件注册和更新安装校验同步使用原名。旧包的删除和名称重新发布尚未完成;当前可安装版本见下方说明。支持 DeepSeek Harness 0.2.1-rc.3。保留 v1.3.4 的资源优化:关闭详情后释放面板内容,秒级刷新只影响倒计时区域,时间轴按分钟更新。提示音播放后暂停音频处理,关闭提醒时释放音频上下文;重新开启后可以再次播放。保留手动版本检查、日历自动更新、应用内提醒、系统通知反馈和轻柔提示音,没有新增运行时 npm 依赖。
3
+ **v1.3.10** 适配 DeepSeek Harness 0.2.2-rc.1,修复宿主升级后因旧版兼容声明而拒绝加载的问题。测试依赖同步到宿主使用的 Cordis 4.1.0。npm 包名自 v1.3.8 起恢复为 `dsh-timeband`,scoped 包 `@a961282799/dsh-timeband` 不再更新。保留 v1.3.4 的资源优化:关闭详情后释放面板内容,秒级刷新只影响倒计时区域,时间轴按分钟更新。提示音播放后暂停音频处理,关闭提醒时释放音频上下文;重新开启后可以再次播放。保留手动版本检查、日历自动更新、应用内提醒、系统通知反馈和轻柔提示音,没有新增运行时 npm 依赖。
4
4
 
5
5
  三轮本地对照中,测试页面的 JavaScript 堆占用减少约 0.07~0.15 MB,主线程耗时降低约 11%~19%。这是 Chrome 宿主模拟页的结果,不代表 Harness 整个进程的内存或 CPU 降幅,详见[资源优化记录](https://github.com/a961282799-crypto/dsh-timeband/blob/main/docs/performance.md)。
6
6
 
@@ -50,36 +50,32 @@ DeepSeek Harness 桌面端头像右侧的峰谷时段插件。状态、切换倒
50
50
 
51
51
  ## 安装
52
52
 
53
- 恢复原名的 `dsh-timeband@1.3.8` 尚未发布。npm 整包删除后 24 小时内不能以同名发布新版本;旧包删除及重新发布以 npm 实际结果为准。以下 npm 和 GitHub 命令对应已经发布的 scoped 包 v1.3.7,不能据此认为原名已迁移完成。
53
+ 已针对 **DeepSeek Harness 0.2.2-rc.1** 验证。2026-11-04 核对四个宿主测试依赖与 npm 发布的宿主版本一致,Cordis 同步至 4.1.0。版本声明只覆盖此版本,宿主升级后应重新验证并更新 peer 范围。
54
54
 
55
- 已针对 **DeepSeek Harness 0.2.1-rc.3** 验证。2026-10-24 核对四个宿主测试依赖与随附桌面 CLI 版本一致,Cordis 同步至 4.0.5。版本声明只覆盖此版本,宿主升级后应重新验证并更新 peer 范围。
56
-
57
- 新版 **v1.3.7** 使用 [npm 包 @a961282799/dsh-timeband](https://www.npmjs.com/package/@a961282799/dsh-timeband) 安装。从托盘完全退出 Harness 后执行:
55
+ 使用 [npm 包 dsh-timeband](https://www.npmjs.com/package/dsh-timeband) 安装。从托盘完全退出 Harness 后执行:
58
56
 
59
57
  ```powershell
60
- dsh plugin --profile desktop add @a961282799/dsh-timeband@1.3.7
58
+ dsh plugin --profile desktop add dsh-timeband@1.3.10
61
59
  ```
62
60
 
63
- 如果已安装旧包 `dsh-timeband`,请先执行 `dsh plugin --profile desktop remove dsh-timeband`,再安装新包,避免同一插件加载两次。原有日历和提醒设置使用相同的保存位置。旧版不会自动更换包名,需要按上述步骤迁移。
64
-
65
- 也可从 [GitHub Releases](https://github.com/a961282799-crypto/dsh-timeband/releases/tag/v1.3.7) 下载预构建安装包 `a961282799-dsh-timeband-1.3.7.tgz`。不需要安装开发依赖或自行编译。
61
+ 如果之前装过 scoped 包 `@a961282799/dsh-timeband`,请先执行 `dsh plugin --profile desktop remove @a961282799/dsh-timeband`,再安装 `dsh-timeband`,避免同一插件加载两次。原有日历和提醒设置使用相同的保存位置。
66
62
 
67
- 从托盘完全退出 Harness,在下载目录执行:
63
+ 也可从 [GitHub Releases](https://github.com/a961282799-crypto/dsh-timeband/releases/tag/v1.3.10) 下载预构建安装包 `dsh-timeband-1.3.10.tgz`。不需要安装开发依赖或自行编译。从托盘完全退出 Harness,在下载目录执行:
68
64
 
69
65
  ```powershell
70
- dsh plugin --profile desktop add ./a961282799-dsh-timeband-1.3.7.tgz
66
+ dsh plugin --profile desktop add ./dsh-timeband-1.3.10.tgz
71
67
  ```
72
68
 
73
69
  如果 `dsh` 不在 PATH,使用桌面端安装目录中随附的命令,例如:
74
70
 
75
71
  ```powershell
76
- & 'C:\path\to\DeepSeek Harness\resources\runtime\cli\bin\dsh.cmd' plugin --profile desktop add ./a961282799-dsh-timeband-1.3.7.tgz
72
+ & 'C:\path\to\DeepSeek Harness\resources\runtime\cli\bin\dsh.cmd' plugin --profile desktop add dsh-timeband@1.3.10
77
73
  ```
78
74
 
79
75
  安装后重新打开 Harness,侧栏底部即可看到插件。卸载:
80
76
 
81
77
  ```powershell
82
- dsh plugin --profile desktop remove @a961282799/dsh-timeband
78
+ dsh plugin --profile desktop remove dsh-timeband
83
79
  ```
84
80
 
85
81
  ### 从源码打包
@@ -146,7 +142,7 @@ TypeScript 7 + React 18(宿主共享实例)+ Cordis 官方插槽生命周期
146
142
 
147
143
  `src/schedule.ts` 是纯时间逻辑及按时段复用的日程读取器;`calendar.ts` 校验并合并日历,`calendar-feed.ts` 将公告数据转换为计费假期,`calendar-store.ts` 负责本地持久化与窗口同步,`calendar-updater.ts` 负责到期检查、限量下载、每日重试和卸载取消;`clock.ts` 是单一可订阅时钟,隐藏时暂停,唤醒时重读系统时间;`reminder-store.ts` 管理提醒偏好与用户触发的授权,`reminders.ts` 在开启时保留一个截止时间计时器,重新核对日历、墙钟和发送记录;`reminder-delivery.ts` 保留应用内提醒并监测系统通知回执,`reminder-sound.ts` 合成提示音并管理播放与清理;`client.ts` 持有注册、字典及清理;`view.tsx` 接收宿主注入的状态、时钟和翻译函数。`cordis.patch.yml` 与 `dsh.bundle` 负责安装后进入宿主配置。
148
144
 
149
- 接口依据:[官方 Client Slots](https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/slots)、npm 发布的 `0.2.1-rc.3` 类型与 SlotRegistry,以及本机同版本桌面的兼容检查函数。头像旁布局保留结构匹配保护,不承诺未测试版本兼容。
145
+ 接口依据:[官方 Client Slots](https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/slots)、npm 发布的 `0.2.2-rc.1` 类型与 SlotRegistry,以及本机同版本桌面的兼容检查函数。头像旁布局保留结构匹配保护,不承诺未测试版本兼容。
150
146
 
151
147
  ## 开发与验证
152
148
 
package/dist/client.js CHANGED
@@ -1,5 +1,5 @@
1
1
  window.__ModuleLoader__.load({id:"dsh-timeband",factory:function(require){var module={exports:{}};var exports=module.exports;
2
- "use strict";var Y=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var Fe=Object.prototype.hasOwnProperty;var Ke=(e,n)=>{for(var t in n)Y(e,t,{get:n[t],enumerable:!0})},qe=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of Be(n))!Fe.call(e,a)&&a!==t&&Y(e,a,{get:()=>n[a],enumerable:!(r=ze(n,a))||r.enumerable});return e};var Ve=e=>qe(Y({},"__esModule",{value:!0}),e);var vt={};Ke(vt,{apply:()=>yt,inject:()=>gt});module.exports=Ve(vt);function ce(){let e=Date.now(),n=new Set,t=()=>{e=Date.now();for(let r of n)r()};return{getSnapshot:()=>e,subscribe(r){return n.add(r),()=>{n.delete(r)}},start(){let r,a=()=>{clearInterval(r),r=void 0,t(),document.visibilityState!=="hidden"&&(r=setInterval(t,1e3))};return document.addEventListener("visibilitychange",a),window.addEventListener("focus",a),window.addEventListener("pageshow",a),a(),()=>{clearInterval(r),document.removeEventListener("visibilitychange",a),window.removeEventListener("focus",a),window.removeEventListener("pageshow",a)}}}}var ue={schemaVersion:1,years:[2026],verifiedOn:"2026-09-30",source:"https://www.lufengshi.gov.cn/swlfsjj/gkmlpt/content/1/1199/mpost_1199727.html",holidays:[["2026-01-01","2026-01-03"],["2026-02-15","2026-02-23"],["2026-04-04","2026-04-06"],["2026-05-01","2026-05-05"],["2026-06-19","2026-06-21"],["2026-09-25","2026-09-27"],["2026-10-01","2026-10-07"]]};var Ge="https://raw.githubusercontent.com/NateScarlet/holiday-cn/master/",F=64*1024;function pe(e){if(!Number.isInteger(e)||e<2e3||e>9998)throw new C("invalid");return`${Ge}${e}.json`}var C=class extends Error{kind;constructor(n){super(n),this.kind=n}};function M(e){if(typeof e!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let n=new Date(`${e}T00:00:00Z`);return Number.isFinite(n.getTime())&&n.toISOString().slice(0,10)===e}function O(e){try{if(new TextEncoder().encode(e).length>F)throw new Error;let n=JSON.parse(e);if(!n||typeof n!="object")throw new Error;let t=n;if(t.schemaVersion!==1||!Array.isArray(t.years)||!t.years.length||t.years.length>20)throw new Error;let r=t.years;if(r.some((s,i)=>!Number.isInteger(s)||s<2e3||s>9998||i>0&&s<=r[i-1]))throw new Error;if(!M(t.verifiedOn)||typeof t.source!="string")throw new Error;let a=new URL(t.source);if(a.protocol!=="https:"||a.username||a.password||!(a.hostname==="gov.cn"||a.hostname.endsWith(".gov.cn")))throw new Error;if(!Array.isArray(t.holidays)||t.holidays.length>400)throw new Error;let o=[];for(let s of t.holidays){if(!Array.isArray(s)||s.length!==2)throw new Error;let[i,m]=s;if(!M(i)||!M(m)||i>m||i.slice(0,4)!==m.slice(0,4)||!r.includes(Number(i.slice(0,4))))throw new Error;if(o.length&&i<=o.at(-1)[1])throw new Error;o.push([i,m])}if(r.some(s=>!o.some(([i])=>Number(i.slice(0,4))===s)))throw new Error;return{schemaVersion:1,years:[...r],verifiedOn:t.verifiedOn,source:a.href,holidays:o}}catch{throw new C("invalid")}}var D=O(JSON.stringify(ue));function K(e,n){let t=n.verifiedOn>=e.verifiedOn,r=[...new Set([...e.years,...n.years])].sort((o,s)=>o-s),a=r.flatMap(o=>(n.years.includes(o)&&(t||!e.years.includes(o))?n:e).holidays.filter(([i])=>Number(i.slice(0,4))===o));return{...t?n:e,years:r,holidays:a}}var G="dsh-timeband/calendar/v1";function me(e=()=>window.localStorage){let n=new Set,t=()=>{try{let s=e().getItem(G);return s===null?{data:D,issue:null}:{data:K(D,O(s)),issue:null}}catch(s){return{data:D,issue:s instanceof C?s.kind:"storage"}}},r={...t(),update:"idle"},a=s=>{r=s;for(let i of n)i()},o=()=>{let s=t();s.issue===r.issue&&JSON.stringify(s.data)===JSON.stringify(r.data)||a({...s,update:r.update})};return{getSnapshot:()=>r,subscribe(s){return n.add(s),()=>{n.delete(s)}},refresh:o,save(s){let i=K(K(r.data,t().data),O(JSON.stringify(s)));try{e().setItem(G,JSON.stringify(i))}catch{throw new C("storage")}a({data:i,issue:null,update:"idle"})},setUpdateStatus(s,i=r.issue){(r.update!==s||r.issue!==i)&&a({...r,update:s,issue:i})},start(){let s=i=>{(i.key===G||i.key===null)&&o()};return window.addEventListener("storage",s),window.addEventListener("focus",o),()=>{window.removeEventListener("storage",s),window.removeEventListener("focus",o)}}}}function fe(e){let n=[];for(let t of[...new Set(e)].sort()){let r=n.at(-1);r&&Date.parse(`${t}T00:00:00Z`)-Date.parse(`${r[1]}T00:00:00Z`)===864e5?r[1]=t:n.push([t,t])}return n}function be(e,n,t,r){try{let a=JSON.parse(e);if(!a||typeof a!="object")throw new Error;let o=a;if(o.year!==n||!Array.isArray(o.papers)||!Array.isArray(o.days))throw new Error;if(o.papers.length===0&&o.days.length===0)return null;if(!o.papers.length||o.papers.length>20||!o.days.length||o.days.length>400)throw new Error;for(let p of o.papers){if(typeof p!="string")throw new Error;let l=new URL(p);if(l.protocol!=="https:"||l.username||l.password||!(l.hostname==="gov.cn"||l.hostname.endsWith(".gov.cn")))throw new Error}let s=[],i=[],m=new Set;for(let p of o.days){if(!p||typeof p!="object")throw new Error;let l=p;if(!M(l.date)||typeof l.isOffDay!="boolean"||typeof l.name!="string"||!l.name.trim()||m.has(l.date))throw new Error;if(l.date<`${n-1}-12-01`||l.date>`${n}-12-31`)throw new Error;m.add(l.date),l.isOffDay&&(l.date.startsWith(`${n}-`)?s:i).push(l.date)}if(!s.length)throw new Error;let f=[n],c=fe(s);if(i.length&&r.years.includes(n-1)){let p=r.holidays.filter(([w])=>w.startsWith(`${n-1}-`)),l=[...i];for(let[w,g]of p)for(let v=Date.parse(`${w}T00:00:00Z`);v<=Date.parse(`${g}T00:00:00Z`);v+=864e5)l.push(new Date(v).toISOString().slice(0,10));f.unshift(n-1),c.unshift(...fe(l))}return O(JSON.stringify({schemaVersion:1,years:f,verifiedOn:t,source:o.papers[0],holidays:c}))}catch{throw new C("invalid")}}var he="https://api-docs.deepseek.com/quick_start/pricing/",T=36e5,j=24*T,Je=8*T,J=[0,9,12,14,18,24];function A(e,n=D){if(!Number.isFinite(e)||!Number.isFinite(new Date(e).getTime()))throw new RangeError("Invalid timestamp");let t=new Date(e+Je),r=t.toISOString().slice(0,10),a=Date.parse(`${r}T00:00:00+08:00`),o=n.holidays.some(([f,c])=>r>=f&&r<=c),s=t.getUTCDay()===0||t.getUTCDay()===6,i=n.years.includes(t.getUTCFullYear());return{key:r,midnight:a,kind:o?"holiday":s?"weekend":i?"weekday":"unverified",covered:i,hour:(e-a)/T}}function We(e,n=D){let{kind:t}=A(e,n);if(t==="holiday"||t==="weekend")return[{start:0,end:24,band:"offpeak"}];let r=t==="unverified"?"unknown":"peak";return[{start:0,end:9,band:"offpeak"},{start:9,end:12,band:r},{start:12,end:14,band:"offpeak"},{start:14,end:18,band:r},{start:18,end:24,band:"offpeak"}]}function W(e,n=D){let{hour:t,kind:r}=A(e,n);return r==="holiday"||r==="weekend"||t<9||t>=12&&t<14||t>=18?"offpeak":r==="unverified"?"unknown":"peak"}function Z(e,n=D){let t=W(e,n),{midnight:r}=A(e,n);for(let a=0;a<370;a++)for(let o of J){let s=r+a*j+o*T;if(s<=e)continue;let i=W(s,n);if(i!==t)return{at:s,band:i}}return null}function X(e,n=D){let t=A(e,n),r=Number(t.key.slice(0,4));if(!t.covered)return{expiresOn:null,notice:"uncovered"};for(;n.years.includes(r+1);)r++;let a=`${r}-12-31`,o=Date.parse(`${r+1}-01-01T00:00:00+08:00`);return{expiresOn:a,notice:o-t.midnight<=30*j?"expiresSoon":null}}function q(){let e,n=0,t=0,r;return(a,o=D)=>{if(!Number.isFinite(a))throw new RangeError("Invalid timestamp");if(r&&e===o&&a>=n&&a<t)return r;let{hour:s,...i}=A(a,o),m=i.kind==="holiday"||i.kind==="weekend",f=m?0:J.findLast(p=>p<=s),c=m?24:J.find(p=>p>s);return n=i.midnight+f*T,t=i.midnight+c*T,e=o,r={day:i,band:W(a,o),next:Z(a,o),segments:We(a,o),coverage:X(a,o)},r}}function ge(e){let n=Math.max(0,Math.ceil(e/1e3)),t=Math.floor(n/86400),r=Math.floor(n/3600)%24,a=Math.floor(n/60)%60,o=[];return t>0&&o.push({value:t,unit:"days"}),n>=3600&&o.push({value:r,unit:"hours"}),n>=60&&o.push({value:a,unit:"minutes"}),{major:o,seconds:n%60}}var ye="dsh-timeband/calendar-check/v1",ve=j,Ze=1e4;async function Xe(e){if(Number(e.headers.get("content-length"))>F||!e.body)throw new C("invalid");let n=e.body.getReader(),t=new TextDecoder("utf-8",{fatal:!0}),r=0,a="";try{for(;;){let{done:o,value:s}=await n.read();if(o)break;if(r+=s.byteLength,r>F)throw new C("invalid");a+=t.decode(s,{stream:!0})}return a+t.decode()}finally{n.releaseLock()}}function we(e){let n=e.now??(()=>Date.now()),t=e.fetch??((u,y)=>fetch(u,y)),r=e.getStorage??(()=>window.localStorage),a=e.synchronize??(u=>typeof navigator<"u"&&navigator.locks?navigator.locks.request("dsh-timeband-calendar-update",u):u()),o=!1,s=!1,i=0,m,f,c,p=0,l=e.store.getSnapshot().data,w=()=>{let u=e.store.getSnapshot().data,y=n(),k=A(y,u),E=X(y,u);return k.covered?E.notice==="expiresSoon"?Number(E.expiresOn.slice(0,4))+1:null:Number(k.key.slice(0,4))},g=()=>{try{let u=JSON.parse(r().getItem(ye)??"null");if(u&&Number.isInteger(u.year)&&Number.isFinite(u.at)&&(u.status==="waiting"||u.status==="failed"))return u}catch{}return c},v=u=>{c=u;try{r().setItem(ye,JSON.stringify(u))}catch{}},b=async(u=!1)=>{if(!o||s)return;s=!0;let y=i;try{await a(async()=>{if(!o||y!==i)return;e.store.refresh();let k=w();if(k===null){e.store.setUpdateStatus("idle");return}let E=g();if(E?.year===k&&n()>=E.at&&n()-E.at<ve&&!(u&&E.status==="failed")){p=Math.min(p,E.at+ve),e.store.setUpdateStatus(E.status);return}e.store.setUpdateStatus("checking");let R=new AbortController;m=R;let U=setTimeout(()=>R.abort(),Ze);f=U;let P="failed";try{let I=await t(pe(k),{signal:R.signal,credentials:"omit",referrerPolicy:"no-referrer",cache:"no-cache",redirect:"error"});if(!o||y!==i||R.signal.aborted)return;if(I.status===404)P="waiting";else{if(!I.ok)throw new Error("Calendar request failed");let N=be(await Xe(I),k,A(n()).key,e.store.getSnapshot().data);if(!o||y!==i||R.signal.aborted)return;if(N===null)P="waiting";else{e.store.save(N);return}}}catch(I){if(!o||y!==i)return;I instanceof C&&I.kind==="storage"&&e.store.setUpdateStatus("failed","storage")}finally{clearTimeout(U),R.abort(),m===R&&(m=void 0),f===U&&(f=void 0)}!o||y!==i||(v({year:k,at:n(),status:P}),e.store.setUpdateStatus(P))})}catch{if(o&&y===i){let k=w();k!==null&&v({year:k,at:n(),status:"failed"}),e.store.setUpdateStatus("failed")}}finally{y===i&&(s=!1)}},h=()=>{let u=n(),y=e.store.getSnapshot().data;(y!==l||u<p-T||u>=p)&&(l=y,p=Math.min(u+T,A(u,y).midnight+j),b())};return{start(){o=!0,i++,s=!1,p=0;let u=window,y=[e.clock.subscribe(h),e.store.subscribe(h)],k=()=>{p=n()+T,b(!0)};u.addEventListener("online",k);let E=setInterval(h,T);return h(),()=>{o=!1,i++,s=!1,m?.abort(),clearTimeout(f),f=void 0,clearInterval(E),y.forEach(R=>R()),u.removeEventListener("online",k),e.store.getSnapshot().update==="checking"&&e.store.setUpdateStatus("idle")}}}}var H="dsh-timeband/reminders/v1",Qe={read:()=>typeof Notification=="function"?Notification.permission:"unsupported",request:()=>Notification.requestPermission()};function xe(e=()=>window.localStorage,n=Qe){let t=new Set,r=()=>{try{if(e().getItem(H)!=="true")return{enabled:!1,busy:!1,issue:null};let i=n.read();return i==="granted"?{enabled:!0,busy:!1,issue:null}:{enabled:!1,busy:!1,issue:i==="unsupported"?"unsupported":"denied"}}catch{return{enabled:!1,busy:!1,issue:"storage"}}},a=r(),o=0,s=i=>{if(!(i.enabled===a.enabled&&i.busy===a.busy&&i.issue===a.issue)){a=i;for(let m of t)m()}};return{getSnapshot:()=>a,subscribe(i){return t.add(i),()=>{t.delete(i)}},async setEnabled(i){let m=++o;if(!i){s({enabled:!1,busy:!1,issue:null});try{e().removeItem(H)}catch{s({enabled:!1,busy:!1,issue:"storage"})}return}s({enabled:!1,busy:!0,issue:null});let f;try{f=n.read(),f==="default"&&(f=await n.request())}catch{m===o&&s({enabled:!1,busy:!1,issue:"denied"});return}if(m===o){if(f!=="granted"){s({enabled:!1,busy:!1,issue:f==="unsupported"?"unsupported":"denied"});return}try{e().setItem(H,"true"),s({enabled:!0,busy:!1,issue:null})}catch{m===o&&s({enabled:!1,busy:!1,issue:"storage"})}}},fail(i){o++;try{e().removeItem(H)}catch{i="storage"}s({enabled:!1,busy:!1,issue:i})},start(){let i=()=>{a.busy||s(r())},m=f=>{(f.key===H||f.key===null)&&(o++,s(r()))};return window.addEventListener("storage",m),window.addEventListener("focus",i),window.addEventListener("pageshow",i),()=>{o++,window.removeEventListener("storage",m),window.removeEventListener("focus",i),window.removeEventListener("pageshow",i)}}}}var Q=5*6e4,z="dsh-timeband/reminder-sent/v1",et="dsh-timeband/peak-reminder";function tt(e){return typeof navigator<"u"&&navigator.locks?navigator.locks.request(et,e):Promise.resolve().then(e)}function ke(e){let n=q(),t=e.now??Date.now,r=e.getStorage??(()=>window.localStorage),a=e.synchronize??tt,o,s=null,i,m=null,f=null,c=!1,p=0,l=()=>{clearTimeout(i),i=void 0,m=null},w=b=>{let h=e.calendarStore.getSnapshot().data,u=n(b,h);if(u!==o){o=u;let y=u.band==="unknown"?null:u.next;y?.band==="offpeak"&&(y=Z(y.at,h)),s=y?.band==="peak"?y.at:null}return s},g=(b,h)=>{m!==b&&(l(),m=b,i=setTimeout(()=>{i=void 0,m=null,v()},Math.max(1,Math.min(2147483647,b-h))))},v=()=>{if(!c||!e.reminderStore.getSnapshot().enabled){l(),f=null;return}let b=t(),h=w(b);if(h===null){l(),f=null;return}if(b<h-Q){f=null,g(h-Q,b);return}if(g(h,b),f===h)return;f=h;let u=p;a(()=>{if(!c||p!==u||!e.reminderStore.getSnapshot().enabled)return;let y=t();if(y<h-Q||y>=h||w(y)!==h)return;let k;try{if(k=r().getItem(z),k!==null&&Number.isSafeInteger(Number(k))&&Number(k)>=h)return;r().setItem(z,String(h))}catch{e.reminderStore.fail("storage");return}let E=()=>{if(c){try{r().getItem(z)===String(h)&&(k===null?r().removeItem(z):r().setItem(z,k))}catch{}e.reminderStore.fail("delivery")}};try{e.notify(h,()=>{a(E).catch(()=>{c&&e.reminderStore.fail("delivery")})})}catch{E()}}).catch(()=>{c&&p===u&&e.reminderStore.fail("delivery")})};return{start(){c=!0,f=null;let b=()=>{p++,f=null,v()},h=[e.clock.subscribe(v),e.calendarStore.subscribe(b),e.reminderStore.subscribe(b)];return v(),()=>{c=!1,p++,l(),h.forEach(u=>u())}}}}function Se(e=()=>new AudioContext){let n,t=!1,r=0,a,o,s=!1,i,m=()=>((!n||n.state==="closed")&&(n=e()),n),f=()=>{r++,a?.(),a=void 0,o?.(),o=void 0},c=(g=n)=>{if(!(!g||g!==n||o||g.state==="closed"))try{g.suspend().catch(()=>{})}catch{}},p=()=>{f(),c()},l=()=>{f();let g=n;n=void 0,s=!1,i=void 0;try{g&&g.state!=="closed"&&g.close().catch(()=>{})}catch{}},w=(g,v)=>new Promise(b=>{let h=!1,u=E=>{h||(h=!0,clearTimeout(k),a===y&&(a=void 0),b(E))},y=()=>u(!1),k=setTimeout(()=>u(!1),1e3);a=y;try{g.resume().then(()=>{let E=!t&&n===g&&v===r;if(h||!E){E&&!o&&c(g),u(!1);return}s=g.state==="running",u(s)},()=>u(!1))}catch{u(!1)}});return{prime(){if(t)return Promise.resolve(!1);if(s)return Promise.resolve(!0);if(i)return i;try{let g=m(),v=r,b=w(g,v).then(h=>(v===r&&c(g),i===b&&(i=void 0),h));return i=b,b}catch{return Promise.resolve(!1)}},async play(){if(t)return!1;f();let g=r;try{let v=m();if(!await w(v,g)||t||g!==r||v.state!=="running")return!1;let b=v.createOscillator(),h=v.createGain(),u=v.currentTime+.01;b.type="sine",b.frequency.setValueAtTime(880,u),b.frequency.setValueAtTime(660,u+.26),h.gain.setValueAtTime(0,u),h.gain.linearRampToValueAtTime(.075,u+.015),h.gain.exponentialRampToValueAtTime(1e-4,u+.24),h.gain.setValueAtTime(0,u+.25),h.gain.linearRampToValueAtTime(.065,u+.275),h.gain.exponentialRampToValueAtTime(1e-4,u+.53),h.gain.linearRampToValueAtTime(0,u+.55),b.connect(h),h.connect(v.destination);let y=()=>{b.onended=null;try{b.stop()}catch{}b.disconnect(),h.disconnect()};return o=y,b.onended=()=>{y(),g===r&&(o=void 0,c(v))},b.start(u),b.stop(u+.56),!0}catch{return g===r&&p(),!1}},stop:p,release:l,dispose(){t=!0,l()}}}var nt=5e3;function Ee(e=(t,r)=>new Notification(t,r),n=Se()){let t=new Set,r=null,a=0,o=!1,s,i,m=p=>{r=p;for(let l of t)l()},f=()=>{if(clearTimeout(i),i=void 0,!!s){s.onshow=s.onerror=s.onclose=s.onclick=null;try{s.close()}catch{}s=void 0}},c=()=>{f(),n.stop(),r&&m(null)};return{getSnapshot:()=>r,subscribe(p){return t.add(p),()=>{t.delete(p)}},primeSound:()=>n.prime(),releaseSound(){c(),n.release()},show(p,l,w){if(o)return;f();let g=++a;m({id:g,title:p,body:l,delivery:"pending",sound:"pending"}),n.play().then(b=>{!o&&r?.id===g&&m({...r,sound:b?"played":"unavailable"})});let v=b=>{o||r?.id!==g||m({...r,delivery:b})};try{s=e(`DSH TimeBand \xB7 ${p}`,{body:l,tag:w,silent:!0}),s.onshow=()=>{clearTimeout(i),i=void 0,v("accepted")},s.onerror=()=>{f(),v("unavailable")},s.onclose=()=>{f(),r?.id===g&&r.delivery==="pending"&&v("unconfirmed")},s.onclick=()=>{window.focus(),c()},i=setTimeout(()=>{i=void 0,v("unconfirmed")},nt)}catch{f(),v("unavailable")}},dismiss:c,dispose(){o=!0,c(),n.dispose()}}}var Re={name:"dsh-timeband",version:"1.3.8",description:"\u5934\u50CF\u65C1\u7684 DeepSeek \u5CF0\u8C37\u65F6\u6BB5\u4E0E\u4ECA\u65E5\u65F6\u95F4\u8F74",type:"module",license:"MIT",publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},repository:{type:"git",url:"git+https://github.com/a961282799-crypto/dsh-timeband.git"},homepage:"https://github.com/a961282799-crypto/dsh-timeband#readme",bugs:{url:"https://github.com/a961282799-crypto/dsh-timeband/issues"},main:"./dist/index.js",exports:{".":"./dist/index.js","./client":"./dist/client.js","./package.json":"./package.json"},files:["dist/index.js","dist/client.js","calendars","cordis.patch.yml","README.md","LICENSE"],keywords:["dsh-plugin","deepseek-harness","timeline"],engines:{node:">=22"},dsh:{bundle:{patch:"./cordis.patch.yml"},client:{platform:"web",inject:["@deepseek-ai/dsh-api-remotes","@deepseek-ai/dsh-client-ui-renderer","@deepseek-ai/dsh-client-ui-sidebar","@deepseek-ai/dsh-client-locale"]}},peerDependencies:{"@deepseek-ai/dsh":"0.2.1-rc.3"},peerDependenciesMeta:{"@deepseek-ai/dsh":{optional:!0}},scripts:{build:"node scripts/build.mjs",typecheck:"tsc --noEmit",test:"node --experimental-strip-types --test tests/*.test.ts tests/*.test.mjs","test:browser":"playwright test",preview:"node scripts/preview.mjs",screenshots:"node scripts/screenshots.mjs",compatibility:"node scripts/check-compatibility.mjs next",check:"npm run typecheck && npm run build && npm test && npm run test:browser",prepack:"npm run typecheck && npm run build"},devDependencies:{"@deepseek-ai/cordis":"4.0.5","@deepseek-ai/dsh-client-locale":"0.2.1-rc.3","@deepseek-ai/dsh-client-ui-renderer":"0.2.1-rc.3","@deepseek-ai/dsh-client-ui-sidebar":"0.2.1-rc.3","@deepseek-ai/dsh-client-ui-slots":"0.2.1-rc.3","@playwright/test":"1.63.0","@types/node":"^24.0.0","@types/react":"~18.3.1","@types/react-dom":"~18.3.0",esbuild:"0.28.2",react:"18.3.1","react-dom":"18.3.1",typescript:"7.0.2"}};var Ne=Re.name,De=Ne.replace(/^@/,"").replace("/","-"),at="https://api.github.com/repos/a961282799-crypto/dsh-timeband/releases/latest",Ce="https://github.com/a961282799-crypto/dsh-timeband/releases",it=1e4,Te=64*1024;function ee(e){return typeof e!="string"||!/^(0|[1-9]\d{0,5})\.(0|[1-9]\d{0,5})\.(0|[1-9]\d{0,5})$/.test(e)?null:e.split(".").map(Number)}function te(e,n){let t=ee(e),r=ee(n);if(!t||!r)return!1;for(let a=0;a<3;a++)if(t[a]!==r[a])return t[a]>r[a];return!1}function ot(e){if(!ee(e))return null;let n=`v${e}`;return{version:String(e),url:`${Ce}/tag/${n}`,download:`${Ce}/download/${n}/${De}-${e}.tgz`}}function st(e){if(!e||typeof e!="object")throw new Error("Invalid release");let n=e,t=ot(typeof n.tag_name=="string"?n.tag_name.slice(1):null);if(!t||n.tag_name!==`v${t.version}`||n.draft!==!1||n.prerelease!==!1||n.html_url!==t.url||!Array.isArray(n.assets)||!n.assets.some(r=>r?.name===`${De}-${t.version}.tgz`&&r.state==="uploaded"&&r.browser_download_url===t.download))throw new Error("Invalid release");return t}async function dt(e){if(!e.ok||Number(e.headers.get("content-length"))>Te)throw new Error("Release check failed");let n=await e.text();if(new TextEncoder().encode(n).length>Te)throw new Error("Release too large");return st(JSON.parse(n))}function Ie(e){let n=e.fetch??((c,p)=>fetch(c,p)),t=new Set,r={latest:null,check:"idle",install:"idle"},a=!0,o,s,i,m=c=>{r={...r,...c};for(let p of t)p()},f=async()=>{if(!a||o||i)return;let c=new AbortController;o=c,m({check:"checking"}),s=setTimeout(()=>c.abort(),it);try{let p=await n(at,{signal:c.signal,credentials:"omit",referrerPolicy:"no-referrer",cache:"no-cache",redirect:"error"}),l=await dt(p);if(!a)return;if(c.signal.aborted)throw new Error("Release check timed out");m({latest:l,check:"current"})}catch{a&&m({check:"failed"})}finally{clearTimeout(s),s=void 0,o=void 0,c.abort()}};return{version:e.version,getSnapshot:()=>r,subscribe(c){return t.add(c),()=>{t.delete(c)}},canInstall:()=>!!e.manager(),check:f,async install(){let c=r.latest,p=e.manager();if(!a||!c||!te(c.version,e.version)||!p||o||i||["restart","applied","unknown"].includes(r.install))return;let l=crypto.randomUUID();i={manager:p,id:l},m({install:"installing"});try{let w=await p.installBundle(c.download,{requestId:l});if(!w.ok){let v=await p.waitForInstall(l);if(!v.ok||v.value===null){a&&m({install:"unknown"});return}w={ok:!0,value:v.value}}if(!a)return;let g=w.value;g.application==="failed"?m({install:g.error?.code==="incompatible-version"?"incompatible":"failed"}):["restart-required","applied"].includes(g.application)&&g.bundle===Ne?m({install:g.application==="applied"?"applied":"restart"}):m({install:"unknown"})}catch{a&&m({install:"unknown"})}finally{i=void 0}},dispose(){a=!1,o?.abort(),clearTimeout(s),s=void 0,i&&(i.manager.cancelInstall(i.id).catch(()=>{}),i=void 0)}}}var Ae="1.3.8";var x=require("react"),ne=require("react-dom");var d=require("react/jsx-runtime"),ct=new Intl.DateTimeFormat("zh-CN",{timeZone:"Asia/Shanghai",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),ut=new Intl.DateTimeFormat("en-GB",{timeZone:"Asia/Shanghai",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),pt={denied:"reminderDenied",unsupported:"reminderUnsupported",storage:"reminderStorageError",delivery:"reminderDeliveryError"},Pe={pending:"reminderSending",accepted:"reminderAccepted",unconfirmed:"reminderUnconfirmed",unavailable:"reminderFallback"},mt=(0,x.memo)(function({delivery:n,t}){let r=(0,x.useSyncExternalStore)(n.subscribe,n.getSnapshot),a=(0,x.useRef)(null);return(0,x.useEffect)(()=>{r?a.current?.showPopover():a.current?.hidePopover()},[r?.id]),r?(0,ne.createPortal)((0,d.jsx)("div",{ref:a,popover:"manual",className:"dtb-reminder-banner dtb-theme",role:"status","aria-live":"polite",children:r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"dtb-header",children:[(0,d.jsx)("strong",{children:r.title}),(0,d.jsx)("button",{type:"button",className:"dtb-close","aria-label":t("dismissReminder"),onClick:n.dismiss,children:"\xD7"})]}),(0,d.jsx)("p",{children:r.body}),(0,d.jsx)("p",{className:"dtb-note dtb-delivery-status",children:t(Pe[r.delivery])}),r.sound==="unavailable"&&(0,d.jsx)("p",{className:"dtb-note dtb-sound-feedback",children:t("reminderSoundError")})]})}),document.body):null}),Ue=(0,x.memo)(function({segments:n,hour:t,small:r=!1}){return(0,d.jsxs)("div",{className:`dtb-track${r?" dtb-track-small":""}`,"aria-hidden":"true",children:[n.map(a=>(0,d.jsx)("span",{className:`dtb-segment dtb-${a.band}`,style:{left:`${a.start/24*100}%`,width:`${(a.end-a.start)/24*100}%`}},a.start)),(0,d.jsx)("span",{className:"dtb-cursor",style:{left:`${t/24*100}%`}})]})});function Le(e,n,t){let r=n===null?null:ge(n-e),a=r?.major.map(s=>`${s.value}${t(s.unit)}`).join("")??"",o=r?`${r.seconds}${t("seconds")}`:"\u2014";return{text:`${a}${o}`,view:(0,d.jsxs)("span",{className:"dtb-countdown",children:[(0,d.jsx)("span",{className:"dtb-count-main",children:a||o}),a&&(0,d.jsx)("small",{className:"dtb-count-seconds",children:o})]})}}function ft({useClock:e,t:n,until:t,nextLabel:r}){let a=e(i=>i),{text:o,view:s}=Le(a,t,n);return(0,d.jsxs)("div",{className:"dtb-next",children:[(0,d.jsx)("span",{children:n(r)}),(0,d.jsx)("strong",{"aria-label":`${n(r)} ${o}`,children:s})]})}function bt({wide:e,useClock:n,t,until:r,nextLabel:a,band:o,segments:s,hour:i,trigger:m,id:f,open:c}){let p=n(g=>e?g:Math.floor(g/6e4)*6e4),{text:l,view:w}=Le(p,r,t);return(0,d.jsxs)("button",{type:"button",className:"dtb-chip",ref:m,popovertarget:f,popovertargetaction:"toggle","aria-label":`${t("open")} \xB7 ${t(o)} \xB7 ${t(a)} ${l}`,"aria-expanded":c,"aria-haspopup":"dialog","aria-controls":f,title:`${t(o)} \xB7 ${t(a)} ${l}`,children:[(0,d.jsxs)("span",{className:"dtb-chip-top",children:[(0,d.jsx)("span",{className:`dtb-dot dtb-${o}`}),e&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"dtb-chip-label",children:t(o)}),(0,d.jsx)("span",{className:"dtb-chip-count",children:w})]})]}),e?(0,d.jsx)(Ue,{segments:s,hour:i,small:!0}):(0,d.jsx)("svg",{viewBox:"0 0 24 24",className:"dtb-rail-icon","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M3 17 8 7l5 10 4-7 4 7"})})]})}function $e({wide:e,useClock:n,t,calendarStore:r,reminderStore:a,reminderDelivery:o,testReminder:s,pluginUpdates:i}){let m=n(S=>Math.floor(S/6e4)*6e4),f=(0,x.useSyncExternalStore)(r.subscribe,r.getSnapshot),c=(0,x.useSyncExternalStore)(a.subscribe,a.getSnapshot),p=(0,x.useSyncExternalStore)(o.subscribe,o.getSnapshot),l=(0,x.useSyncExternalStore)(i.subscribe,i.getSnapshot),w=l.latest&&te(l.latest.version,i.version),g=l.install==="restart"?"updateRestart":l.install==="applied"?"updateApplied":l.install==="unknown"?"updateUnknown":l.install==="failed"?"updateFailed":l.install==="incompatible"?"updateIncompatible":null,v=(0,x.useMemo)(()=>q(),[]),{day:b,band:h,next:u,segments:y}=v(m,f.data),k=(m-b.midnight)/T,E=u!==null&&u.band!=="unknown"&&h!=="unknown",[R,U]=(0,x.useState)(!1),P=(0,x.useRef)(!1),I=(0,x.useRef)(null),N=(0,x.useRef)(null),L=(0,x.useRef)(null),re=(0,x.useRef)(null),B=(0,x.useId)(),ae=E?u.at:null,ie=E?u.band==="peak"?"nextPeak":"nextOffpeak":"nextUnknown",oe=(0,x.useMemo)(()=>E&&u?ct.format(u.at):"",[E,u]),se=ut.format(m),de=f.issue==="storage"?"calendarStorageError":f.update==="checking"?"calendarChecking":f.update==="waiting"?"calendarWaiting":f.update==="failed"?"calendarUpdateFailed":null;(0,x.useEffect)(()=>{let S=N.current;if(!S)return;let $=()=>{I.current&&(P.current=I.current.open)},_=()=>U(S.matches(":popover-open"));return S.addEventListener("beforetoggle",$),S.addEventListener("toggle",_),()=>{S.removeEventListener("beforetoggle",$),S.removeEventListener("toggle",_)}},[]),(0,x.useLayoutEffect)(()=>{if(!R)return;let S=()=>{if(!N.current||!L.current)return;let _=L.current.getBoundingClientRect(),V=N.current.getBoundingClientRect(),je=Math.max(12,Math.min(_.left,window.innerWidth-V.width-12)),He=Math.max(12,Math.min(_.top-V.height-12,window.innerHeight-V.height-12));N.current.style.left=`${je}px`,N.current.style.top=`${He}px`};S(),re.current?.focus({preventScroll:!0});let $=new ResizeObserver(S);return N.current&&$.observe(N.current),L.current&&$.observe(L.current),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{$.disconnect(),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[R,e]);let le=()=>{N.current?.hidePopover(),U(!1),L.current?.focus({preventScroll:!0})};return(0,d.jsxs)("div",{className:"dtb-root dtb-theme","data-wide":e,"data-band":h,children:[(0,d.jsx)(mt,{delivery:o,t}),(0,d.jsx)(bt,{wide:e,useClock:n,t,until:ae,nextLabel:ie,band:h,segments:y,hour:k,trigger:L,id:B,open:R}),(0,ne.createPortal)((0,d.jsx)("div",{ref:N,id:B,popover:"auto",role:"dialog","aria-labelledby":`${B}-title`,className:"dtb-card dtb-theme","data-band":h,onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),le())},children:R&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("header",{className:"dtb-header",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"dtb-eyebrow",children:"DEEPSEEK / TIMEBAND"}),(0,d.jsx)("h2",{id:`${B}-title`,children:t("title")})]}),(0,d.jsx)("button",{type:"button",className:"dtb-close",ref:re,"aria-label":t("close"),onClick:le,children:"\xD7"})]}),(0,d.jsxs)("div",{className:"dtb-status",children:[(0,d.jsx)("span",{className:`dtb-dot dtb-${h}`}),(0,d.jsx)("strong",{children:t(h)})]}),(0,d.jsx)(ft,{useClock:n,t,until:ae,nextLabel:ie}),(0,d.jsxs)("div",{className:"dtb-date",children:[(0,d.jsx)("span",{children:t("zone")}),(0,d.jsx)("span",{children:oe&&(0,d.jsxs)(d.Fragment,{children:[t("nextSwitch")," ",oe]})})]}),(0,d.jsxs)("div",{className:"dtb-axis",role:"img","aria-label":`${t("timeline")}\uFF1A${y.map(S=>`${S.start}:00\u2013${S.end}:00 ${t(S.band)}`).join("\uFF1B")}\u3002${t("now")} ${se}`,children:[(0,d.jsxs)("div",{className:"dtb-now",style:{left:`${Math.min(91,Math.max(9,k/24*100))}%`},children:[t("now")," ",se]}),(0,d.jsx)(Ue,{segments:y,hour:k}),(0,d.jsxs)("div",{className:"dtb-ticks",children:[(0,d.jsx)("span",{children:"00"}),(0,d.jsx)("span",{children:"06"}),(0,d.jsx)("span",{children:"12"}),(0,d.jsx)("span",{children:"18"}),(0,d.jsx)("span",{children:"24"})]})]}),(0,d.jsxs)("div",{className:"dtb-day-kind",children:[b.key," ",(0,d.jsx)("span",{children:"\xB7"})," ",t(b.kind)]}),y.length>1&&(0,d.jsxs)("div",{className:"dtb-periods",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("span",{children:[(0,d.jsx)("i",{className:`dtb-dot dtb-${b.covered?"peak":"unknown"}`}),t(b.covered?"peak":"unknown")]}),(0,d.jsx)("b",{children:"09:00\u201312:00 \xB7 14:00\u201318:00"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("span",{children:[(0,d.jsx)("i",{className:"dtb-dot dtb-offpeak"}),t("offpeak")]}),(0,d.jsx)("b",{children:t("rest")})]})]}),!b.covered&&(0,d.jsx)("p",{className:"dtb-note",children:t("unknownNote")}),de&&(0,d.jsx)("p",{className:"dtb-note dtb-calendar-notice",role:"status",children:t(de)}),(0,d.jsxs)("details",{className:"dtb-details",ref:I,open:P.current,children:[(0,d.jsx)("summary",{children:t("details")}),(0,d.jsx)("p",{className:"dtb-note",children:t("note")}),(0,d.jsxs)("div",{className:"dtb-reminder-settings",children:[(0,d.jsxs)("label",{className:"dtb-reminder-toggle",children:[(0,d.jsx)("span",{children:t("reminder")}),(0,d.jsx)("input",{type:"checkbox",role:"switch",checked:c.enabled,disabled:c.busy,onChange:S=>{S.currentTarget.checked&&o.primeSound(),a.setEnabled(S.currentTarget.checked)}})]}),c.enabled&&(0,d.jsx)("button",{type:"button",className:"dtb-button",onClick:s,children:t("reminderTest")}),(0,d.jsx)("p",{className:"dtb-note",children:t("reminderHint")}),p&&(0,d.jsx)("p",{className:"dtb-note dtb-test-feedback",role:"status",children:t(Pe[p.delivery])}),p?.sound==="unavailable"&&(0,d.jsx)("p",{className:"dtb-note dtb-sound-feedback",role:"status",children:t("reminderSoundError")}),c.issue&&(0,d.jsx)("p",{className:"dtb-note dtb-reminder-feedback",role:"status",children:t(pt[c.issue])})]}),(0,d.jsxs)("div",{className:"dtb-version-row",children:[(0,d.jsxs)("span",{children:["v",i.version]}),(0,d.jsx)("button",{type:"button",className:"dtb-button",disabled:l.check==="checking"||l.install==="installing",onClick:()=>{i.check()},children:t(l.check==="checking"?"updateChecking":"updateCheck")})]}),w&&(0,d.jsxs)("div",{className:"dtb-update-notice",role:"status",children:[(0,d.jsxs)("span",{children:[t("updateAvailable")," ",(0,d.jsxs)("b",{children:["v",l.latest.version]})]}),i.canInstall()?(0,d.jsx)("button",{type:"button",className:"dtb-button",disabled:l.check==="checking"||["installing","restart","applied","unknown"].includes(l.install),onClick:()=>{i.install()},children:t(l.install==="installing"?"updateInstalling":"updateInstall")}):(0,d.jsxs)("a",{href:l.latest.download,target:"_blank",rel:"noreferrer",children:[t("updateDownload")," \u2197"]}),(0,d.jsxs)("a",{href:l.latest.url,target:"_blank",rel:"noreferrer",children:[t("updateNotes")," \u2197"]}),g&&(0,d.jsx)("p",{className:"dtb-note",children:t(g)})]}),l.check==="failed"&&(0,d.jsx)("p",{className:"dtb-note",children:t("updateCheckFailed")}),l.check==="current"&&!w&&(0,d.jsx)("p",{className:"dtb-note",children:t("updateCurrent")}),(0,d.jsxs)("footer",{className:"dtb-footer",children:[(0,d.jsxs)("a",{href:f.data.source,target:"_blank",rel:"noreferrer",children:[t("calendarSource")," \u2197"]}),(0,d.jsxs)("a",{href:he,target:"_blank",rel:"noreferrer",children:[t("rule")," \u2197"]})]})]})]})}),document.body)]})}var Oe={title:"\u4ECA\u65E5\u65F6\u6BB5",zone:"\u5317\u4EAC\u65F6\u95F4 \xB7 UTC+8",peak:"\u5CF0\u65F6\u6BB5",offpeak:"\u8C37\u65F6\u6BB5",unknown:"\u5F85\u6838\u5B9E",nextPeak:"\u8DDD\u79BB\u5CF0\u65F6\u6BB5",nextOffpeak:"\u8DDD\u79BB\u8C37\u65F6\u6BB5",nextUnknown:"\u540E\u7EED\u65E5\u5386\u5F85\u66F4\u65B0",weekday:"\u5468\u4E00\u81F3\u5468\u4E94",weekend:"\u5468\u672B \xB7 \u5168\u5929\u8C37\u65F6\u6BB5",holiday:"\u516C\u5171\u5047\u671F \xB7 \u5168\u5929\u8C37\u65F6\u6BB5",unverified:"\u672C\u5E74\u5EA6\u8282\u5047\u65E5\u65E5\u5386\u5F85\u66F4\u65B0",allDay:"\u5168\u5929",rest:"\u5176\u4F59\u65F6\u6BB5",now:"\u73B0\u5728",nextSwitch:"\u4E0B\u6B21\u5207\u6362\uFF1A",close:"\u5173\u95ED\u65F6\u95F4\u8F74",open:"\u67E5\u770B\u5CF0\u8C37\u65F6\u95F4\u8F74",rule:"DeepSeek \u5B98\u65B9\u65F6\u6BB5\u89C4\u5219",details:"\u89C4\u5219\u4E0E\u63D0\u9192",note:"\u5468\u672B\uFF08\u542B\u8C03\u4F11\u4E0A\u73ED\u65E5\uFF09\u53CA\u516C\u5171\u5047\u671F\u5168\u5929\u4E3A\u8C37\u65F6\u6BB5\u3002",reminder:"\u5CF0\u65F6\u6BB5\u524D 5 \u5206\u949F\u63D0\u9192",reminderHint:"\u9ED8\u8BA4\u5173\u95ED\u3002\u5F00\u542F\u65F6\u7533\u8BF7\u901A\u77E5\u6388\u6743\uFF1B\u5E94\u7528\u8FD0\u884C\u65F6\u63D0\u9192\uFF0C\u5E76\u64AD\u653E\u8F7B\u67D4\u63D0\u793A\u97F3\u3002",reminderSoundError:"\u63D0\u793A\u97F3\u672A\u80FD\u64AD\u653E\uFF0C\u53EF\u70B9\u51FB\u300C\u6D4B\u8BD5\u63D0\u9192\u300D\u91CD\u8BD5\u3002",reminderDenied:"\u672A\u83B7\u5F97\u901A\u77E5\u6388\u6743\uFF0C\u8BF7\u5141\u8BB8\u6B64\u5E94\u7528\u7684\u901A\u77E5\u540E\u518D\u5F00\u542F\u3002",reminderUnsupported:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u7CFB\u7EDF\u901A\u77E5\u3002",reminderStorageError:"\u63D0\u9192\u8BBE\u7F6E\u65E0\u6CD5\u4FDD\u5B58\uFF0C\u8BF7\u68C0\u67E5\u672C\u5730\u5B58\u50A8\u6743\u9650\u3002",reminderDeliveryError:"\u63D0\u9192\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7CFB\u7EDF\u901A\u77E5\u8BBE\u7F6E\u540E\u91CD\u65B0\u5F00\u542F\u3002",reminderTitle:"\u5373\u5C06\u8FDB\u5165\u5CF0\u65F6\u6BB5",reminderBody:"\u5317\u4EAC\u65F6\u95F4 {time} \u5F00\u59CB\u5CF0\u65F6\u6BB5\u3002",reminderTest:"\u6D4B\u8BD5\u63D0\u9192",reminderTestTitle:"\u6D4B\u8BD5\u63D0\u9192",reminderTestBody:"\u8FD9\u662F\u4E00\u6761\u6D4B\u8BD5\u63D0\u9192\u3002\u6B63\u5F0F\u63D0\u9192\u4F1A\u5728\u5CF0\u65F6\u6BB5\u5F00\u59CB\u524D 5 \u5206\u949F\u53D1\u51FA\u3002",reminderSending:"\u5E94\u7528\u5185\u63D0\u9192\u5DF2\u663E\u793A\uFF0C\u6B63\u5728\u53D1\u9001\u7CFB\u7EDF\u901A\u77E5\u2026",reminderAccepted:"\u7CFB\u7EDF\u5DF2\u63A5\u6536\u901A\u77E5\u3002\u6CA1\u6709\u6A2A\u5E45\u65F6\uFF0C\u53EF\u67E5\u770B\u901A\u77E5\u4E2D\u5FC3\u6216\u68C0\u67E5\u52FF\u6270\u6A21\u5F0F\u3002",reminderUnconfirmed:"\u7CFB\u7EDF\u672A\u786E\u8BA4\u901A\u77E5\u663E\u793A\uFF0C\u5E94\u7528\u5185\u63D0\u9192\u5DF2\u4FDD\u7559\u3002",reminderFallback:"\u7CFB\u7EDF\u901A\u77E5\u53D1\u9001\u5931\u8D25\uFF0C\u5E94\u7528\u5185\u63D0\u9192\u5DF2\u4FDD\u7559\u3002\u8BF7\u68C0\u67E5\u7CFB\u7EDF\u901A\u77E5\u8BBE\u7F6E\u3002",dismissReminder:"\u5173\u95ED\u63D0\u9192",updateAvailable:"\u6709\u65B0\u7248\u672C",updateCheck:"\u68C0\u67E5\u66F4\u65B0",updateChecking:"\u6B63\u5728\u68C0\u67E5\u2026",updateInstall:"\u66F4\u65B0",updateInstalling:"\u6B63\u5728\u66F4\u65B0\u2026",updateDownload:"\u4E0B\u8F7D\u65B0\u7248",updateNotes:"\u66F4\u65B0\u8BF4\u660E",updateRestart:"\u65B0\u7248\u5DF2\u5B89\u88C5\uFF0C\u5B8C\u5168\u9000\u51FA\u5E76\u91CD\u65B0\u6253\u5F00 Harness \u540E\u751F\u6548\u3002",updateApplied:"Harness \u5DF2\u786E\u8BA4\u5E94\u7528\u66F4\u65B0\u3002",updateUnknown:"\u66F4\u65B0\u7ED3\u679C\u5C1A\u672A\u786E\u8BA4\uFF0C\u8BF7\u5728 Harness\u300C\u63D2\u4EF6\u300D\u9875\u9762\u6838\u5BF9\u540E\u91CD\u542F\u3002",updateFailed:"\u66F4\u65B0\u672A\u6210\u529F\uFF0C\u5F53\u524D\u7248\u672C\u7EE7\u7EED\u4F7F\u7528\u3002\u53EF\u7A0D\u540E\u91CD\u8BD5\u6216\u4ECE\u53D1\u5E03\u9875\u4E0B\u8F7D\u3002",updateIncompatible:"\u65B0\u7248\u4E0E\u5F53\u524D Harness \u4E0D\u517C\u5BB9\uFF0C\u8BF7\u67E5\u770B\u66F4\u65B0\u8BF4\u660E\u3002",updateCheckFailed:"\u6682\u65F6\u65E0\u6CD5\u68C0\u67E5\u65B0\u7248\uFF0C\u8BF7\u7A0D\u540E\u70B9\u51FB\u91CD\u8BD5\u3002\u5F53\u524D\u63D2\u4EF6\u6B63\u5E38\u4F7F\u7528\u3002",updateCurrent:"\u6682\u65E0\u9700\u8981\u5B89\u88C5\u7684\u65B0\u7248\u3002",calendarSource:"\u5047\u671F\u516C\u544A\u6765\u6E90",calendarChecking:"\u6B63\u5728\u81EA\u52A8\u66F4\u65B0\u8282\u5047\u65E5\u65E5\u5386\u2026",calendarWaiting:"\u65B0\u5E74\u5EA6\u65E5\u5386\u5C1A\u672A\u53D1\u5E03\uFF0C\u5C06\u6BCF\u5929\u81EA\u52A8\u68C0\u67E5\u3002",calendarUpdateFailed:"\u65E5\u5386\u66F4\u65B0\u6682\u672A\u6210\u529F\uFF0C\u4FDD\u7559\u5DF2\u6709\u6570\u636E\u5E76\u81EA\u52A8\u91CD\u8BD5\u3002",calendarStorageError:"\u65E5\u5386\u6682\u65F6\u65E0\u6CD5\u4FDD\u5B58\uFF0C\u7EE7\u7EED\u4F7F\u7528\u5DF2\u6709\u6570\u636E\u5E76\u81EA\u52A8\u91CD\u8BD5\u3002",unknownNote:"\u7F3A\u5C11\u672C\u5E74\u5EA6\u5047\u671F\u6570\u636E\uFF0C\u5DE5\u4F5C\u65E5\u5CF0\u65F6\u6BB5\u6682\u4E0D\u4F5C\u786E\u5B9A\u5224\u65AD\u3002",timeline:"\u5317\u4EAC\u65F6\u95F4 24 \u5C0F\u65F6\u65F6\u95F4\u8F74",days:"\u5929",hours:"\u5C0F\u65F6",minutes:"\u5206\u949F",seconds:"\u79D2"},_e={title:"Today\u2019s schedule",zone:"Beijing time \xB7 UTC+8",peak:"Peak",offpeak:"Off-peak",unknown:"Unverified",nextPeak:"Until peak hours",nextOffpeak:"Until off-peak",nextUnknown:"Calendar update needed",weekday:"Monday\u2013Friday",weekend:"Weekend \xB7 off-peak all day",holiday:"Public holiday \xB7 off-peak all day",unverified:"Holiday calendar needs an update",allDay:"All day",rest:"All other hours",now:"Now",nextSwitch:"Next change:",close:"Close timeline",open:"View peak hours timeline",rule:"DeepSeek official schedule",details:"Rules and reminders",note:"Weekends (including makeup workdays) and public holidays are off-peak all day.",reminder:"Remind 5 minutes before peak",reminderHint:"Off by default. Enabling requests notification permission. Reminds with a gentle chime while the app is running.",reminderSoundError:"The chime could not play. Send a test notification to retry.",reminderDenied:"Notification permission was not granted. Allow this app\u2019s notifications, then enable reminders again.",reminderUnsupported:"System notifications are unavailable in this environment.",reminderStorageError:"Reminder settings could not be saved. Check local storage permissions.",reminderDeliveryError:"The reminder could not be delivered. Check system notification settings, then enable it again.",reminderTitle:"Peak hours start soon",reminderBody:"Peak hours start at {time} (Beijing time).",reminderTest:"Send test notification",reminderTestTitle:"Test reminder",reminderTestBody:"This is a test reminder. Peak reminders arrive 5 minutes before peak hours start.",reminderSending:"In-app reminder displayed. Sending system notification\u2026",reminderAccepted:"The system accepted the notification. If no banner appears, check Notification Center or Do Not Disturb.",reminderUnconfirmed:"System display was not confirmed. The in-app reminder remains available.",reminderFallback:"System notification failed. The in-app reminder remains available. Check system notification settings.",dismissReminder:"Dismiss reminder",updateAvailable:"Update available",updateCheck:"Check for updates",updateChecking:"Checking\u2026",updateInstall:"Update",updateInstalling:"Updating\u2026",updateDownload:"Download update",updateNotes:"Release notes",updateRestart:"Update installed. Fully quit and reopen Harness to apply it.",updateApplied:"Harness confirmed that the update was applied.",updateUnknown:"Update outcome is unconfirmed. Check Harness Plugins before restarting.",updateFailed:"Update failed. Keep using this version and retry or download from GitHub later.",updateIncompatible:"This release is incompatible with your Harness. Read its release notes.",updateCheckFailed:"Could not check for updates. Click to retry later; the plugin keeps working.",updateCurrent:"No newer release needs to be installed.",calendarSource:"Holiday notice source",calendarChecking:"Updating the holiday calendar automatically\u2026",calendarWaiting:"The new annual calendar is not published yet. Checking daily.",calendarUpdateFailed:"Calendar update failed. Keeping existing data and retrying automatically.",calendarStorageError:"Calendar could not be saved. Keeping existing data and retrying automatically.",unknownNote:"Holiday data for this year is unavailable; weekday peak periods are unverified.",timeline:"24-hour timeline in Beijing time",days:"d",hours:"h",minutes:"min",seconds:"s"};var Me=`.dtb-theme {
2
+ "use strict";var Y=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var Fe=Object.prototype.hasOwnProperty;var Ke=(e,n)=>{for(var t in n)Y(e,t,{get:n[t],enumerable:!0})},qe=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of Be(n))!Fe.call(e,a)&&a!==t&&Y(e,a,{get:()=>n[a],enumerable:!(r=ze(n,a))||r.enumerable});return e};var Ve=e=>qe(Y({},"__esModule",{value:!0}),e);var vt={};Ke(vt,{apply:()=>yt,inject:()=>gt});module.exports=Ve(vt);function ce(){let e=Date.now(),n=new Set,t=()=>{e=Date.now();for(let r of n)r()};return{getSnapshot:()=>e,subscribe(r){return n.add(r),()=>{n.delete(r)}},start(){let r,a=()=>{clearInterval(r),r=void 0,t(),document.visibilityState!=="hidden"&&(r=setInterval(t,1e3))};return document.addEventListener("visibilitychange",a),window.addEventListener("focus",a),window.addEventListener("pageshow",a),a(),()=>{clearInterval(r),document.removeEventListener("visibilitychange",a),window.removeEventListener("focus",a),window.removeEventListener("pageshow",a)}}}}var ue={schemaVersion:1,years:[2026],verifiedOn:"2026-09-30",source:"https://www.lufengshi.gov.cn/swlfsjj/gkmlpt/content/1/1199/mpost_1199727.html",holidays:[["2026-01-01","2026-01-03"],["2026-02-15","2026-02-23"],["2026-04-04","2026-04-06"],["2026-05-01","2026-05-05"],["2026-06-19","2026-06-21"],["2026-09-25","2026-09-27"],["2026-10-01","2026-10-07"]]};var Ge="https://raw.githubusercontent.com/NateScarlet/holiday-cn/master/",F=64*1024;function pe(e){if(!Number.isInteger(e)||e<2e3||e>9998)throw new C("invalid");return`${Ge}${e}.json`}var C=class extends Error{kind;constructor(n){super(n),this.kind=n}};function M(e){if(typeof e!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let n=new Date(`${e}T00:00:00Z`);return Number.isFinite(n.getTime())&&n.toISOString().slice(0,10)===e}function O(e){try{if(new TextEncoder().encode(e).length>F)throw new Error;let n=JSON.parse(e);if(!n||typeof n!="object")throw new Error;let t=n;if(t.schemaVersion!==1||!Array.isArray(t.years)||!t.years.length||t.years.length>20)throw new Error;let r=t.years;if(r.some((s,i)=>!Number.isInteger(s)||s<2e3||s>9998||i>0&&s<=r[i-1]))throw new Error;if(!M(t.verifiedOn)||typeof t.source!="string")throw new Error;let a=new URL(t.source);if(a.protocol!=="https:"||a.username||a.password||!(a.hostname==="gov.cn"||a.hostname.endsWith(".gov.cn")))throw new Error;if(!Array.isArray(t.holidays)||t.holidays.length>400)throw new Error;let o=[];for(let s of t.holidays){if(!Array.isArray(s)||s.length!==2)throw new Error;let[i,m]=s;if(!M(i)||!M(m)||i>m||i.slice(0,4)!==m.slice(0,4)||!r.includes(Number(i.slice(0,4))))throw new Error;if(o.length&&i<=o.at(-1)[1])throw new Error;o.push([i,m])}if(r.some(s=>!o.some(([i])=>Number(i.slice(0,4))===s)))throw new Error;return{schemaVersion:1,years:[...r],verifiedOn:t.verifiedOn,source:a.href,holidays:o}}catch{throw new C("invalid")}}var D=O(JSON.stringify(ue));function K(e,n){let t=n.verifiedOn>=e.verifiedOn,r=[...new Set([...e.years,...n.years])].sort((o,s)=>o-s),a=r.flatMap(o=>(n.years.includes(o)&&(t||!e.years.includes(o))?n:e).holidays.filter(([i])=>Number(i.slice(0,4))===o));return{...t?n:e,years:r,holidays:a}}var G="dsh-timeband/calendar/v1";function me(e=()=>window.localStorage){let n=new Set,t=()=>{try{let s=e().getItem(G);return s===null?{data:D,issue:null}:{data:K(D,O(s)),issue:null}}catch(s){return{data:D,issue:s instanceof C?s.kind:"storage"}}},r={...t(),update:"idle"},a=s=>{r=s;for(let i of n)i()},o=()=>{let s=t();s.issue===r.issue&&JSON.stringify(s.data)===JSON.stringify(r.data)||a({...s,update:r.update})};return{getSnapshot:()=>r,subscribe(s){return n.add(s),()=>{n.delete(s)}},refresh:o,save(s){let i=K(K(r.data,t().data),O(JSON.stringify(s)));try{e().setItem(G,JSON.stringify(i))}catch{throw new C("storage")}a({data:i,issue:null,update:"idle"})},setUpdateStatus(s,i=r.issue){(r.update!==s||r.issue!==i)&&a({...r,update:s,issue:i})},start(){let s=i=>{(i.key===G||i.key===null)&&o()};return window.addEventListener("storage",s),window.addEventListener("focus",o),()=>{window.removeEventListener("storage",s),window.removeEventListener("focus",o)}}}}function fe(e){let n=[];for(let t of[...new Set(e)].sort()){let r=n.at(-1);r&&Date.parse(`${t}T00:00:00Z`)-Date.parse(`${r[1]}T00:00:00Z`)===864e5?r[1]=t:n.push([t,t])}return n}function be(e,n,t,r){try{let a=JSON.parse(e);if(!a||typeof a!="object")throw new Error;let o=a;if(o.year!==n||!Array.isArray(o.papers)||!Array.isArray(o.days))throw new Error;if(o.papers.length===0&&o.days.length===0)return null;if(!o.papers.length||o.papers.length>20||!o.days.length||o.days.length>400)throw new Error;for(let p of o.papers){if(typeof p!="string")throw new Error;let l=new URL(p);if(l.protocol!=="https:"||l.username||l.password||!(l.hostname==="gov.cn"||l.hostname.endsWith(".gov.cn")))throw new Error}let s=[],i=[],m=new Set;for(let p of o.days){if(!p||typeof p!="object")throw new Error;let l=p;if(!M(l.date)||typeof l.isOffDay!="boolean"||typeof l.name!="string"||!l.name.trim()||m.has(l.date))throw new Error;if(l.date<`${n-1}-12-01`||l.date>`${n}-12-31`)throw new Error;m.add(l.date),l.isOffDay&&(l.date.startsWith(`${n}-`)?s:i).push(l.date)}if(!s.length)throw new Error;let f=[n],c=fe(s);if(i.length&&r.years.includes(n-1)){let p=r.holidays.filter(([w])=>w.startsWith(`${n-1}-`)),l=[...i];for(let[w,g]of p)for(let v=Date.parse(`${w}T00:00:00Z`);v<=Date.parse(`${g}T00:00:00Z`);v+=864e5)l.push(new Date(v).toISOString().slice(0,10));f.unshift(n-1),c.unshift(...fe(l))}return O(JSON.stringify({schemaVersion:1,years:f,verifiedOn:t,source:o.papers[0],holidays:c}))}catch{throw new C("invalid")}}var he="https://api-docs.deepseek.com/quick_start/pricing/",T=36e5,j=24*T,Je=8*T,J=[0,9,12,14,18,24];function A(e,n=D){if(!Number.isFinite(e)||!Number.isFinite(new Date(e).getTime()))throw new RangeError("Invalid timestamp");let t=new Date(e+Je),r=t.toISOString().slice(0,10),a=Date.parse(`${r}T00:00:00+08:00`),o=n.holidays.some(([f,c])=>r>=f&&r<=c),s=t.getUTCDay()===0||t.getUTCDay()===6,i=n.years.includes(t.getUTCFullYear());return{key:r,midnight:a,kind:o?"holiday":s?"weekend":i?"weekday":"unverified",covered:i,hour:(e-a)/T}}function We(e,n=D){let{kind:t}=A(e,n);if(t==="holiday"||t==="weekend")return[{start:0,end:24,band:"offpeak"}];let r=t==="unverified"?"unknown":"peak";return[{start:0,end:9,band:"offpeak"},{start:9,end:12,band:r},{start:12,end:14,band:"offpeak"},{start:14,end:18,band:r},{start:18,end:24,band:"offpeak"}]}function W(e,n=D){let{hour:t,kind:r}=A(e,n);return r==="holiday"||r==="weekend"||t<9||t>=12&&t<14||t>=18?"offpeak":r==="unverified"?"unknown":"peak"}function Z(e,n=D){let t=W(e,n),{midnight:r}=A(e,n);for(let a=0;a<370;a++)for(let o of J){let s=r+a*j+o*T;if(s<=e)continue;let i=W(s,n);if(i!==t)return{at:s,band:i}}return null}function X(e,n=D){let t=A(e,n),r=Number(t.key.slice(0,4));if(!t.covered)return{expiresOn:null,notice:"uncovered"};for(;n.years.includes(r+1);)r++;let a=`${r}-12-31`,o=Date.parse(`${r+1}-01-01T00:00:00+08:00`);return{expiresOn:a,notice:o-t.midnight<=30*j?"expiresSoon":null}}function q(){let e,n=0,t=0,r;return(a,o=D)=>{if(!Number.isFinite(a))throw new RangeError("Invalid timestamp");if(r&&e===o&&a>=n&&a<t)return r;let{hour:s,...i}=A(a,o),m=i.kind==="holiday"||i.kind==="weekend",f=m?0:J.findLast(p=>p<=s),c=m?24:J.find(p=>p>s);return n=i.midnight+f*T,t=i.midnight+c*T,e=o,r={day:i,band:W(a,o),next:Z(a,o),segments:We(a,o),coverage:X(a,o)},r}}function ge(e){let n=Math.max(0,Math.ceil(e/1e3)),t=Math.floor(n/86400),r=Math.floor(n/3600)%24,a=Math.floor(n/60)%60,o=[];return t>0&&o.push({value:t,unit:"days"}),n>=3600&&o.push({value:r,unit:"hours"}),n>=60&&o.push({value:a,unit:"minutes"}),{major:o,seconds:n%60}}var ye="dsh-timeband/calendar-check/v1",ve=j,Ze=1e4;async function Xe(e){if(Number(e.headers.get("content-length"))>F||!e.body)throw new C("invalid");let n=e.body.getReader(),t=new TextDecoder("utf-8",{fatal:!0}),r=0,a="";try{for(;;){let{done:o,value:s}=await n.read();if(o)break;if(r+=s.byteLength,r>F)throw new C("invalid");a+=t.decode(s,{stream:!0})}return a+t.decode()}finally{n.releaseLock()}}function we(e){let n=e.now??(()=>Date.now()),t=e.fetch??((u,y)=>fetch(u,y)),r=e.getStorage??(()=>window.localStorage),a=e.synchronize??(u=>typeof navigator<"u"&&navigator.locks?navigator.locks.request("dsh-timeband-calendar-update",u):u()),o=!1,s=!1,i=0,m,f,c,p=0,l=e.store.getSnapshot().data,w=()=>{let u=e.store.getSnapshot().data,y=n(),k=A(y,u),E=X(y,u);return k.covered?E.notice==="expiresSoon"?Number(E.expiresOn.slice(0,4))+1:null:Number(k.key.slice(0,4))},g=()=>{try{let u=JSON.parse(r().getItem(ye)??"null");if(u&&Number.isInteger(u.year)&&Number.isFinite(u.at)&&(u.status==="waiting"||u.status==="failed"))return u}catch{}return c},v=u=>{c=u;try{r().setItem(ye,JSON.stringify(u))}catch{}},b=async(u=!1)=>{if(!o||s)return;s=!0;let y=i;try{await a(async()=>{if(!o||y!==i)return;e.store.refresh();let k=w();if(k===null){e.store.setUpdateStatus("idle");return}let E=g();if(E?.year===k&&n()>=E.at&&n()-E.at<ve&&!(u&&E.status==="failed")){p=Math.min(p,E.at+ve),e.store.setUpdateStatus(E.status);return}e.store.setUpdateStatus("checking");let R=new AbortController;m=R;let U=setTimeout(()=>R.abort(),Ze);f=U;let P="failed";try{let I=await t(pe(k),{signal:R.signal,credentials:"omit",referrerPolicy:"no-referrer",cache:"no-cache",redirect:"error"});if(!o||y!==i||R.signal.aborted)return;if(I.status===404)P="waiting";else{if(!I.ok)throw new Error("Calendar request failed");let N=be(await Xe(I),k,A(n()).key,e.store.getSnapshot().data);if(!o||y!==i||R.signal.aborted)return;if(N===null)P="waiting";else{e.store.save(N);return}}}catch(I){if(!o||y!==i)return;I instanceof C&&I.kind==="storage"&&e.store.setUpdateStatus("failed","storage")}finally{clearTimeout(U),R.abort(),m===R&&(m=void 0),f===U&&(f=void 0)}!o||y!==i||(v({year:k,at:n(),status:P}),e.store.setUpdateStatus(P))})}catch{if(o&&y===i){let k=w();k!==null&&v({year:k,at:n(),status:"failed"}),e.store.setUpdateStatus("failed")}}finally{y===i&&(s=!1)}},h=()=>{let u=n(),y=e.store.getSnapshot().data;(y!==l||u<p-T||u>=p)&&(l=y,p=Math.min(u+T,A(u,y).midnight+j),b())};return{start(){o=!0,i++,s=!1,p=0;let u=window,y=[e.clock.subscribe(h),e.store.subscribe(h)],k=()=>{p=n()+T,b(!0)};u.addEventListener("online",k);let E=setInterval(h,T);return h(),()=>{o=!1,i++,s=!1,m?.abort(),clearTimeout(f),f=void 0,clearInterval(E),y.forEach(R=>R()),u.removeEventListener("online",k),e.store.getSnapshot().update==="checking"&&e.store.setUpdateStatus("idle")}}}}var H="dsh-timeband/reminders/v1",Qe={read:()=>typeof Notification=="function"?Notification.permission:"unsupported",request:()=>Notification.requestPermission()};function xe(e=()=>window.localStorage,n=Qe){let t=new Set,r=()=>{try{if(e().getItem(H)!=="true")return{enabled:!1,busy:!1,issue:null};let i=n.read();return i==="granted"?{enabled:!0,busy:!1,issue:null}:{enabled:!1,busy:!1,issue:i==="unsupported"?"unsupported":"denied"}}catch{return{enabled:!1,busy:!1,issue:"storage"}}},a=r(),o=0,s=i=>{if(!(i.enabled===a.enabled&&i.busy===a.busy&&i.issue===a.issue)){a=i;for(let m of t)m()}};return{getSnapshot:()=>a,subscribe(i){return t.add(i),()=>{t.delete(i)}},async setEnabled(i){let m=++o;if(!i){s({enabled:!1,busy:!1,issue:null});try{e().removeItem(H)}catch{s({enabled:!1,busy:!1,issue:"storage"})}return}s({enabled:!1,busy:!0,issue:null});let f;try{f=n.read(),f==="default"&&(f=await n.request())}catch{m===o&&s({enabled:!1,busy:!1,issue:"denied"});return}if(m===o){if(f!=="granted"){s({enabled:!1,busy:!1,issue:f==="unsupported"?"unsupported":"denied"});return}try{e().setItem(H,"true"),s({enabled:!0,busy:!1,issue:null})}catch{m===o&&s({enabled:!1,busy:!1,issue:"storage"})}}},fail(i){o++;try{e().removeItem(H)}catch{i="storage"}s({enabled:!1,busy:!1,issue:i})},start(){let i=()=>{a.busy||s(r())},m=f=>{(f.key===H||f.key===null)&&(o++,s(r()))};return window.addEventListener("storage",m),window.addEventListener("focus",i),window.addEventListener("pageshow",i),()=>{o++,window.removeEventListener("storage",m),window.removeEventListener("focus",i),window.removeEventListener("pageshow",i)}}}}var Q=5*6e4,z="dsh-timeband/reminder-sent/v1",et="dsh-timeband/peak-reminder";function tt(e){return typeof navigator<"u"&&navigator.locks?navigator.locks.request(et,e):Promise.resolve().then(e)}function ke(e){let n=q(),t=e.now??Date.now,r=e.getStorage??(()=>window.localStorage),a=e.synchronize??tt,o,s=null,i,m=null,f=null,c=!1,p=0,l=()=>{clearTimeout(i),i=void 0,m=null},w=b=>{let h=e.calendarStore.getSnapshot().data,u=n(b,h);if(u!==o){o=u;let y=u.band==="unknown"?null:u.next;y?.band==="offpeak"&&(y=Z(y.at,h)),s=y?.band==="peak"?y.at:null}return s},g=(b,h)=>{m!==b&&(l(),m=b,i=setTimeout(()=>{i=void 0,m=null,v()},Math.max(1,Math.min(2147483647,b-h))))},v=()=>{if(!c||!e.reminderStore.getSnapshot().enabled){l(),f=null;return}let b=t(),h=w(b);if(h===null){l(),f=null;return}if(b<h-Q){f=null,g(h-Q,b);return}if(g(h,b),f===h)return;f=h;let u=p;a(()=>{if(!c||p!==u||!e.reminderStore.getSnapshot().enabled)return;let y=t();if(y<h-Q||y>=h||w(y)!==h)return;let k;try{if(k=r().getItem(z),k!==null&&Number.isSafeInteger(Number(k))&&Number(k)>=h)return;r().setItem(z,String(h))}catch{e.reminderStore.fail("storage");return}let E=()=>{if(c){try{r().getItem(z)===String(h)&&(k===null?r().removeItem(z):r().setItem(z,k))}catch{}e.reminderStore.fail("delivery")}};try{e.notify(h,()=>{a(E).catch(()=>{c&&e.reminderStore.fail("delivery")})})}catch{E()}}).catch(()=>{c&&p===u&&e.reminderStore.fail("delivery")})};return{start(){c=!0,f=null;let b=()=>{p++,f=null,v()},h=[e.clock.subscribe(v),e.calendarStore.subscribe(b),e.reminderStore.subscribe(b)];return v(),()=>{c=!1,p++,l(),h.forEach(u=>u())}}}}function Se(e=()=>new AudioContext){let n,t=!1,r=0,a,o,s=!1,i,m=()=>((!n||n.state==="closed")&&(n=e()),n),f=()=>{r++,a?.(),a=void 0,o?.(),o=void 0},c=(g=n)=>{if(!(!g||g!==n||o||g.state==="closed"))try{g.suspend().catch(()=>{})}catch{}},p=()=>{f(),c()},l=()=>{f();let g=n;n=void 0,s=!1,i=void 0;try{g&&g.state!=="closed"&&g.close().catch(()=>{})}catch{}},w=(g,v)=>new Promise(b=>{let h=!1,u=E=>{h||(h=!0,clearTimeout(k),a===y&&(a=void 0),b(E))},y=()=>u(!1),k=setTimeout(()=>u(!1),1e3);a=y;try{g.resume().then(()=>{let E=!t&&n===g&&v===r;if(h||!E){E&&!o&&c(g),u(!1);return}s=g.state==="running",u(s)},()=>u(!1))}catch{u(!1)}});return{prime(){if(t)return Promise.resolve(!1);if(s)return Promise.resolve(!0);if(i)return i;try{let g=m(),v=r,b=w(g,v).then(h=>(v===r&&c(g),i===b&&(i=void 0),h));return i=b,b}catch{return Promise.resolve(!1)}},async play(){if(t)return!1;f();let g=r;try{let v=m();if(!await w(v,g)||t||g!==r||v.state!=="running")return!1;let b=v.createOscillator(),h=v.createGain(),u=v.currentTime+.01;b.type="sine",b.frequency.setValueAtTime(880,u),b.frequency.setValueAtTime(660,u+.26),h.gain.setValueAtTime(0,u),h.gain.linearRampToValueAtTime(.075,u+.015),h.gain.exponentialRampToValueAtTime(1e-4,u+.24),h.gain.setValueAtTime(0,u+.25),h.gain.linearRampToValueAtTime(.065,u+.275),h.gain.exponentialRampToValueAtTime(1e-4,u+.53),h.gain.linearRampToValueAtTime(0,u+.55),b.connect(h),h.connect(v.destination);let y=()=>{b.onended=null;try{b.stop()}catch{}b.disconnect(),h.disconnect()};return o=y,b.onended=()=>{y(),g===r&&(o=void 0,c(v))},b.start(u),b.stop(u+.56),!0}catch{return g===r&&p(),!1}},stop:p,release:l,dispose(){t=!0,l()}}}var nt=5e3;function Ee(e=(t,r)=>new Notification(t,r),n=Se()){let t=new Set,r=null,a=0,o=!1,s,i,m=p=>{r=p;for(let l of t)l()},f=()=>{if(clearTimeout(i),i=void 0,!!s){s.onshow=s.onerror=s.onclose=s.onclick=null;try{s.close()}catch{}s=void 0}},c=()=>{f(),n.stop(),r&&m(null)};return{getSnapshot:()=>r,subscribe(p){return t.add(p),()=>{t.delete(p)}},primeSound:()=>n.prime(),releaseSound(){c(),n.release()},show(p,l,w){if(o)return;f();let g=++a;m({id:g,title:p,body:l,delivery:"pending",sound:"pending"}),n.play().then(b=>{!o&&r?.id===g&&m({...r,sound:b?"played":"unavailable"})});let v=b=>{o||r?.id!==g||m({...r,delivery:b})};try{s=e(`DSH TimeBand \xB7 ${p}`,{body:l,tag:w,silent:!0}),s.onshow=()=>{clearTimeout(i),i=void 0,v("accepted")},s.onerror=()=>{f(),v("unavailable")},s.onclose=()=>{f(),r?.id===g&&r.delivery==="pending"&&v("unconfirmed")},s.onclick=()=>{window.focus(),c()},i=setTimeout(()=>{i=void 0,v("unconfirmed")},nt)}catch{f(),v("unavailable")}},dismiss:c,dispose(){o=!0,c(),n.dispose()}}}var Re={name:"dsh-timeband",version:"1.3.10",description:"\u5934\u50CF\u65C1\u7684 DeepSeek \u5CF0\u8C37\u65F6\u6BB5\u4E0E\u4ECA\u65E5\u65F6\u95F4\u8F74",type:"module",license:"MIT",publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},repository:{type:"git",url:"git+https://github.com/a961282799-crypto/dsh-timeband.git"},homepage:"https://github.com/a961282799-crypto/dsh-timeband#readme",bugs:{url:"https://github.com/a961282799-crypto/dsh-timeband/issues"},main:"./dist/index.js",exports:{".":"./dist/index.js","./client":"./dist/client.js","./package.json":"./package.json"},files:["dist/index.js","dist/client.js","calendars","cordis.patch.yml","README.md","LICENSE"],keywords:["dsh-plugin","deepseek-harness","timeline"],engines:{node:">=22"},dsh:{bundle:{patch:"./cordis.patch.yml"},client:{platform:"web",inject:["@deepseek-ai/dsh-api-remotes","@deepseek-ai/dsh-client-ui-renderer","@deepseek-ai/dsh-client-ui-sidebar","@deepseek-ai/dsh-client-locale"]}},peerDependencies:{"@deepseek-ai/dsh":"0.2.2-rc.1"},peerDependenciesMeta:{"@deepseek-ai/dsh":{optional:!0}},scripts:{build:"node scripts/build.mjs",typecheck:"tsc --noEmit",test:"node --experimental-strip-types --test tests/*.test.ts tests/*.test.mjs","test:browser":"playwright test",preview:"node scripts/preview.mjs",screenshots:"node scripts/screenshots.mjs",compatibility:"node scripts/check-compatibility.mjs next",check:"npm run typecheck && npm run build && npm test && npm run test:browser",prepack:"npm run typecheck && npm run build"},devDependencies:{"@deepseek-ai/cordis":"4.1.0","@deepseek-ai/dsh-client-locale":"0.2.2-rc.1","@deepseek-ai/dsh-client-ui-renderer":"0.2.2-rc.1","@deepseek-ai/dsh-client-ui-sidebar":"0.2.2-rc.1","@deepseek-ai/dsh-client-ui-slots":"0.2.2-rc.1","@playwright/test":"1.63.0","@types/node":"^24.0.0","@types/react":"~18.3.1","@types/react-dom":"~18.3.0",esbuild:"0.28.2",react:"18.3.1","react-dom":"18.3.1",typescript:"7.0.2"}};var Ne=Re.name,De=Ne.replace(/^@/,"").replace("/","-"),at="https://api.github.com/repos/a961282799-crypto/dsh-timeband/releases/latest",Ce="https://github.com/a961282799-crypto/dsh-timeband/releases",it=1e4,Te=64*1024;function ee(e){return typeof e!="string"||!/^(0|[1-9]\d{0,5})\.(0|[1-9]\d{0,5})\.(0|[1-9]\d{0,5})$/.test(e)?null:e.split(".").map(Number)}function te(e,n){let t=ee(e),r=ee(n);if(!t||!r)return!1;for(let a=0;a<3;a++)if(t[a]!==r[a])return t[a]>r[a];return!1}function ot(e){if(!ee(e))return null;let n=`v${e}`;return{version:String(e),url:`${Ce}/tag/${n}`,download:`${Ce}/download/${n}/${De}-${e}.tgz`}}function st(e){if(!e||typeof e!="object")throw new Error("Invalid release");let n=e,t=ot(typeof n.tag_name=="string"?n.tag_name.slice(1):null);if(!t||n.tag_name!==`v${t.version}`||n.draft!==!1||n.prerelease!==!1||n.html_url!==t.url||!Array.isArray(n.assets)||!n.assets.some(r=>r?.name===`${De}-${t.version}.tgz`&&r.state==="uploaded"&&r.browser_download_url===t.download))throw new Error("Invalid release");return t}async function dt(e){if(!e.ok||Number(e.headers.get("content-length"))>Te)throw new Error("Release check failed");let n=await e.text();if(new TextEncoder().encode(n).length>Te)throw new Error("Release too large");return st(JSON.parse(n))}function Ie(e){let n=e.fetch??((c,p)=>fetch(c,p)),t=new Set,r={latest:null,check:"idle",install:"idle"},a=!0,o,s,i,m=c=>{r={...r,...c};for(let p of t)p()},f=async()=>{if(!a||o||i)return;let c=new AbortController;o=c,m({check:"checking"}),s=setTimeout(()=>c.abort(),it);try{let p=await n(at,{signal:c.signal,credentials:"omit",referrerPolicy:"no-referrer",cache:"no-cache",redirect:"error"}),l=await dt(p);if(!a)return;if(c.signal.aborted)throw new Error("Release check timed out");m({latest:l,check:"current"})}catch{a&&m({check:"failed"})}finally{clearTimeout(s),s=void 0,o=void 0,c.abort()}};return{version:e.version,getSnapshot:()=>r,subscribe(c){return t.add(c),()=>{t.delete(c)}},canInstall:()=>!!e.manager(),check:f,async install(){let c=r.latest,p=e.manager();if(!a||!c||!te(c.version,e.version)||!p||o||i||["restart","applied","unknown"].includes(r.install))return;let l=crypto.randomUUID();i={manager:p,id:l},m({install:"installing"});try{let w=await p.installBundle(c.download,{requestId:l});if(!w.ok){let v=await p.waitForInstall(l);if(!v.ok||v.value===null){a&&m({install:"unknown"});return}w={ok:!0,value:v.value}}if(!a)return;let g=w.value;g.application==="failed"?m({install:g.error?.code==="incompatible-version"?"incompatible":"failed"}):["restart-required","applied"].includes(g.application)&&g.bundle===Ne?m({install:g.application==="applied"?"applied":"restart"}):m({install:"unknown"})}catch{a&&m({install:"unknown"})}finally{i=void 0}},dispose(){a=!1,o?.abort(),clearTimeout(s),s=void 0,i&&(i.manager.cancelInstall(i.id).catch(()=>{}),i=void 0)}}}var Ae="1.3.10";var x=require("react"),ne=require("react-dom");var d=require("react/jsx-runtime"),ct=new Intl.DateTimeFormat("zh-CN",{timeZone:"Asia/Shanghai",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),ut=new Intl.DateTimeFormat("en-GB",{timeZone:"Asia/Shanghai",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),pt={denied:"reminderDenied",unsupported:"reminderUnsupported",storage:"reminderStorageError",delivery:"reminderDeliveryError"},Pe={pending:"reminderSending",accepted:"reminderAccepted",unconfirmed:"reminderUnconfirmed",unavailable:"reminderFallback"},mt=(0,x.memo)(function({delivery:n,t}){let r=(0,x.useSyncExternalStore)(n.subscribe,n.getSnapshot),a=(0,x.useRef)(null);return(0,x.useEffect)(()=>{r?a.current?.showPopover():a.current?.hidePopover()},[r?.id]),r?(0,ne.createPortal)((0,d.jsx)("div",{ref:a,popover:"manual",className:"dtb-reminder-banner dtb-theme",role:"status","aria-live":"polite",children:r&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"dtb-header",children:[(0,d.jsx)("strong",{children:r.title}),(0,d.jsx)("button",{type:"button",className:"dtb-close","aria-label":t("dismissReminder"),onClick:n.dismiss,children:"\xD7"})]}),(0,d.jsx)("p",{children:r.body}),(0,d.jsx)("p",{className:"dtb-note dtb-delivery-status",children:t(Pe[r.delivery])}),r.sound==="unavailable"&&(0,d.jsx)("p",{className:"dtb-note dtb-sound-feedback",children:t("reminderSoundError")})]})}),document.body):null}),Ue=(0,x.memo)(function({segments:n,hour:t,small:r=!1}){return(0,d.jsxs)("div",{className:`dtb-track${r?" dtb-track-small":""}`,"aria-hidden":"true",children:[n.map(a=>(0,d.jsx)("span",{className:`dtb-segment dtb-${a.band}`,style:{left:`${a.start/24*100}%`,width:`${(a.end-a.start)/24*100}%`}},a.start)),(0,d.jsx)("span",{className:"dtb-cursor",style:{left:`${t/24*100}%`}})]})});function Le(e,n,t){let r=n===null?null:ge(n-e),a=r?.major.map(s=>`${s.value}${t(s.unit)}`).join("")??"",o=r?`${r.seconds}${t("seconds")}`:"\u2014";return{text:`${a}${o}`,view:(0,d.jsxs)("span",{className:"dtb-countdown",children:[(0,d.jsx)("span",{className:"dtb-count-main",children:a||o}),a&&(0,d.jsx)("small",{className:"dtb-count-seconds",children:o})]})}}function ft({useClock:e,t:n,until:t,nextLabel:r}){let a=e(i=>i),{text:o,view:s}=Le(a,t,n);return(0,d.jsxs)("div",{className:"dtb-next",children:[(0,d.jsx)("span",{children:n(r)}),(0,d.jsx)("strong",{"aria-label":`${n(r)} ${o}`,children:s})]})}function bt({wide:e,useClock:n,t,until:r,nextLabel:a,band:o,segments:s,hour:i,trigger:m,id:f,open:c}){let p=n(g=>e?g:Math.floor(g/6e4)*6e4),{text:l,view:w}=Le(p,r,t);return(0,d.jsxs)("button",{type:"button",className:"dtb-chip",ref:m,popovertarget:f,popovertargetaction:"toggle","aria-label":`${t("open")} \xB7 ${t(o)} \xB7 ${t(a)} ${l}`,"aria-expanded":c,"aria-haspopup":"dialog","aria-controls":f,title:`${t(o)} \xB7 ${t(a)} ${l}`,children:[(0,d.jsxs)("span",{className:"dtb-chip-top",children:[(0,d.jsx)("span",{className:`dtb-dot dtb-${o}`}),e&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"dtb-chip-label",children:t(o)}),(0,d.jsx)("span",{className:"dtb-chip-count",children:w})]})]}),e?(0,d.jsx)(Ue,{segments:s,hour:i,small:!0}):(0,d.jsx)("svg",{viewBox:"0 0 24 24",className:"dtb-rail-icon","aria-hidden":"true",children:(0,d.jsx)("path",{d:"M3 17 8 7l5 10 4-7 4 7"})})]})}function $e({wide:e,useClock:n,t,calendarStore:r,reminderStore:a,reminderDelivery:o,testReminder:s,pluginUpdates:i}){let m=n(S=>Math.floor(S/6e4)*6e4),f=(0,x.useSyncExternalStore)(r.subscribe,r.getSnapshot),c=(0,x.useSyncExternalStore)(a.subscribe,a.getSnapshot),p=(0,x.useSyncExternalStore)(o.subscribe,o.getSnapshot),l=(0,x.useSyncExternalStore)(i.subscribe,i.getSnapshot),w=l.latest&&te(l.latest.version,i.version),g=l.install==="restart"?"updateRestart":l.install==="applied"?"updateApplied":l.install==="unknown"?"updateUnknown":l.install==="failed"?"updateFailed":l.install==="incompatible"?"updateIncompatible":null,v=(0,x.useMemo)(()=>q(),[]),{day:b,band:h,next:u,segments:y}=v(m,f.data),k=(m-b.midnight)/T,E=u!==null&&u.band!=="unknown"&&h!=="unknown",[R,U]=(0,x.useState)(!1),P=(0,x.useRef)(!1),I=(0,x.useRef)(null),N=(0,x.useRef)(null),L=(0,x.useRef)(null),re=(0,x.useRef)(null),B=(0,x.useId)(),ae=E?u.at:null,ie=E?u.band==="peak"?"nextPeak":"nextOffpeak":"nextUnknown",oe=(0,x.useMemo)(()=>E&&u?ct.format(u.at):"",[E,u]),se=ut.format(m),de=f.issue==="storage"?"calendarStorageError":f.update==="checking"?"calendarChecking":f.update==="waiting"?"calendarWaiting":f.update==="failed"?"calendarUpdateFailed":null;(0,x.useEffect)(()=>{let S=N.current;if(!S)return;let $=()=>{I.current&&(P.current=I.current.open)},_=()=>U(S.matches(":popover-open"));return S.addEventListener("beforetoggle",$),S.addEventListener("toggle",_),()=>{S.removeEventListener("beforetoggle",$),S.removeEventListener("toggle",_)}},[]),(0,x.useLayoutEffect)(()=>{if(!R)return;let S=()=>{if(!N.current||!L.current)return;let _=L.current.getBoundingClientRect(),V=N.current.getBoundingClientRect(),je=Math.max(12,Math.min(_.left,window.innerWidth-V.width-12)),He=Math.max(12,Math.min(_.top-V.height-12,window.innerHeight-V.height-12));N.current.style.left=`${je}px`,N.current.style.top=`${He}px`};S(),re.current?.focus({preventScroll:!0});let $=new ResizeObserver(S);return N.current&&$.observe(N.current),L.current&&$.observe(L.current),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),()=>{$.disconnect(),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[R,e]);let le=()=>{N.current?.hidePopover(),U(!1),L.current?.focus({preventScroll:!0})};return(0,d.jsxs)("div",{className:"dtb-root dtb-theme","data-wide":e,"data-band":h,children:[(0,d.jsx)(mt,{delivery:o,t}),(0,d.jsx)(bt,{wide:e,useClock:n,t,until:ae,nextLabel:ie,band:h,segments:y,hour:k,trigger:L,id:B,open:R}),(0,ne.createPortal)((0,d.jsx)("div",{ref:N,id:B,popover:"auto",role:"dialog","aria-labelledby":`${B}-title`,className:"dtb-card dtb-theme","data-band":h,onKeyDown:S=>{S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),le())},children:R&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("header",{className:"dtb-header",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{className:"dtb-eyebrow",children:"DEEPSEEK / TIMEBAND"}),(0,d.jsx)("h2",{id:`${B}-title`,children:t("title")})]}),(0,d.jsx)("button",{type:"button",className:"dtb-close",ref:re,"aria-label":t("close"),onClick:le,children:"\xD7"})]}),(0,d.jsxs)("div",{className:"dtb-status",children:[(0,d.jsx)("span",{className:`dtb-dot dtb-${h}`}),(0,d.jsx)("strong",{children:t(h)})]}),(0,d.jsx)(ft,{useClock:n,t,until:ae,nextLabel:ie}),(0,d.jsxs)("div",{className:"dtb-date",children:[(0,d.jsx)("span",{children:t("zone")}),(0,d.jsx)("span",{children:oe&&(0,d.jsxs)(d.Fragment,{children:[t("nextSwitch")," ",oe]})})]}),(0,d.jsxs)("div",{className:"dtb-axis",role:"img","aria-label":`${t("timeline")}\uFF1A${y.map(S=>`${S.start}:00\u2013${S.end}:00 ${t(S.band)}`).join("\uFF1B")}\u3002${t("now")} ${se}`,children:[(0,d.jsxs)("div",{className:"dtb-now",style:{left:`${Math.min(91,Math.max(9,k/24*100))}%`},children:[t("now")," ",se]}),(0,d.jsx)(Ue,{segments:y,hour:k}),(0,d.jsxs)("div",{className:"dtb-ticks",children:[(0,d.jsx)("span",{children:"00"}),(0,d.jsx)("span",{children:"06"}),(0,d.jsx)("span",{children:"12"}),(0,d.jsx)("span",{children:"18"}),(0,d.jsx)("span",{children:"24"})]})]}),(0,d.jsxs)("div",{className:"dtb-day-kind",children:[b.key," ",(0,d.jsx)("span",{children:"\xB7"})," ",t(b.kind)]}),y.length>1&&(0,d.jsxs)("div",{className:"dtb-periods",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("span",{children:[(0,d.jsx)("i",{className:`dtb-dot dtb-${b.covered?"peak":"unknown"}`}),t(b.covered?"peak":"unknown")]}),(0,d.jsx)("b",{children:"09:00\u201312:00 \xB7 14:00\u201318:00"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("span",{children:[(0,d.jsx)("i",{className:"dtb-dot dtb-offpeak"}),t("offpeak")]}),(0,d.jsx)("b",{children:t("rest")})]})]}),!b.covered&&(0,d.jsx)("p",{className:"dtb-note",children:t("unknownNote")}),de&&(0,d.jsx)("p",{className:"dtb-note dtb-calendar-notice",role:"status",children:t(de)}),(0,d.jsxs)("details",{className:"dtb-details",ref:I,open:P.current,children:[(0,d.jsx)("summary",{children:t("details")}),(0,d.jsx)("p",{className:"dtb-note",children:t("note")}),(0,d.jsxs)("div",{className:"dtb-reminder-settings",children:[(0,d.jsxs)("label",{className:"dtb-reminder-toggle",children:[(0,d.jsx)("span",{children:t("reminder")}),(0,d.jsx)("input",{type:"checkbox",role:"switch",checked:c.enabled,disabled:c.busy,onChange:S=>{S.currentTarget.checked&&o.primeSound(),a.setEnabled(S.currentTarget.checked)}})]}),c.enabled&&(0,d.jsx)("button",{type:"button",className:"dtb-button",onClick:s,children:t("reminderTest")}),(0,d.jsx)("p",{className:"dtb-note",children:t("reminderHint")}),p&&(0,d.jsx)("p",{className:"dtb-note dtb-test-feedback",role:"status",children:t(Pe[p.delivery])}),p?.sound==="unavailable"&&(0,d.jsx)("p",{className:"dtb-note dtb-sound-feedback",role:"status",children:t("reminderSoundError")}),c.issue&&(0,d.jsx)("p",{className:"dtb-note dtb-reminder-feedback",role:"status",children:t(pt[c.issue])})]}),(0,d.jsxs)("div",{className:"dtb-version-row",children:[(0,d.jsxs)("span",{children:["v",i.version]}),(0,d.jsx)("button",{type:"button",className:"dtb-button",disabled:l.check==="checking"||l.install==="installing",onClick:()=>{i.check()},children:t(l.check==="checking"?"updateChecking":"updateCheck")})]}),w&&(0,d.jsxs)("div",{className:"dtb-update-notice",role:"status",children:[(0,d.jsxs)("span",{children:[t("updateAvailable")," ",(0,d.jsxs)("b",{children:["v",l.latest.version]})]}),i.canInstall()?(0,d.jsx)("button",{type:"button",className:"dtb-button",disabled:l.check==="checking"||["installing","restart","applied","unknown"].includes(l.install),onClick:()=>{i.install()},children:t(l.install==="installing"?"updateInstalling":"updateInstall")}):(0,d.jsxs)("a",{href:l.latest.download,target:"_blank",rel:"noreferrer",children:[t("updateDownload")," \u2197"]}),(0,d.jsxs)("a",{href:l.latest.url,target:"_blank",rel:"noreferrer",children:[t("updateNotes")," \u2197"]}),g&&(0,d.jsx)("p",{className:"dtb-note",children:t(g)})]}),l.check==="failed"&&(0,d.jsx)("p",{className:"dtb-note",children:t("updateCheckFailed")}),l.check==="current"&&!w&&(0,d.jsx)("p",{className:"dtb-note",children:t("updateCurrent")}),(0,d.jsxs)("footer",{className:"dtb-footer",children:[(0,d.jsxs)("a",{href:f.data.source,target:"_blank",rel:"noreferrer",children:[t("calendarSource")," \u2197"]}),(0,d.jsxs)("a",{href:he,target:"_blank",rel:"noreferrer",children:[t("rule")," \u2197"]})]})]})]})}),document.body)]})}var Oe={title:"\u4ECA\u65E5\u65F6\u6BB5",zone:"\u5317\u4EAC\u65F6\u95F4 \xB7 UTC+8",peak:"\u5CF0\u65F6\u6BB5",offpeak:"\u8C37\u65F6\u6BB5",unknown:"\u5F85\u6838\u5B9E",nextPeak:"\u8DDD\u79BB\u5CF0\u65F6\u6BB5",nextOffpeak:"\u8DDD\u79BB\u8C37\u65F6\u6BB5",nextUnknown:"\u540E\u7EED\u65E5\u5386\u5F85\u66F4\u65B0",weekday:"\u5468\u4E00\u81F3\u5468\u4E94",weekend:"\u5468\u672B \xB7 \u5168\u5929\u8C37\u65F6\u6BB5",holiday:"\u516C\u5171\u5047\u671F \xB7 \u5168\u5929\u8C37\u65F6\u6BB5",unverified:"\u672C\u5E74\u5EA6\u8282\u5047\u65E5\u65E5\u5386\u5F85\u66F4\u65B0",allDay:"\u5168\u5929",rest:"\u5176\u4F59\u65F6\u6BB5",now:"\u73B0\u5728",nextSwitch:"\u4E0B\u6B21\u5207\u6362\uFF1A",close:"\u5173\u95ED\u65F6\u95F4\u8F74",open:"\u67E5\u770B\u5CF0\u8C37\u65F6\u95F4\u8F74",rule:"DeepSeek \u5B98\u65B9\u65F6\u6BB5\u89C4\u5219",details:"\u89C4\u5219\u4E0E\u63D0\u9192",note:"\u5468\u672B\uFF08\u542B\u8C03\u4F11\u4E0A\u73ED\u65E5\uFF09\u53CA\u516C\u5171\u5047\u671F\u5168\u5929\u4E3A\u8C37\u65F6\u6BB5\u3002",reminder:"\u5CF0\u65F6\u6BB5\u524D 5 \u5206\u949F\u63D0\u9192",reminderHint:"\u9ED8\u8BA4\u5173\u95ED\u3002\u5F00\u542F\u65F6\u7533\u8BF7\u901A\u77E5\u6388\u6743\uFF1B\u5E94\u7528\u8FD0\u884C\u65F6\u63D0\u9192\uFF0C\u5E76\u64AD\u653E\u8F7B\u67D4\u63D0\u793A\u97F3\u3002",reminderSoundError:"\u63D0\u793A\u97F3\u672A\u80FD\u64AD\u653E\uFF0C\u53EF\u70B9\u51FB\u300C\u6D4B\u8BD5\u63D0\u9192\u300D\u91CD\u8BD5\u3002",reminderDenied:"\u672A\u83B7\u5F97\u901A\u77E5\u6388\u6743\uFF0C\u8BF7\u5141\u8BB8\u6B64\u5E94\u7528\u7684\u901A\u77E5\u540E\u518D\u5F00\u542F\u3002",reminderUnsupported:"\u5F53\u524D\u73AF\u5883\u4E0D\u652F\u6301\u7CFB\u7EDF\u901A\u77E5\u3002",reminderStorageError:"\u63D0\u9192\u8BBE\u7F6E\u65E0\u6CD5\u4FDD\u5B58\uFF0C\u8BF7\u68C0\u67E5\u672C\u5730\u5B58\u50A8\u6743\u9650\u3002",reminderDeliveryError:"\u63D0\u9192\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7CFB\u7EDF\u901A\u77E5\u8BBE\u7F6E\u540E\u91CD\u65B0\u5F00\u542F\u3002",reminderTitle:"\u5373\u5C06\u8FDB\u5165\u5CF0\u65F6\u6BB5",reminderBody:"\u5317\u4EAC\u65F6\u95F4 {time} \u5F00\u59CB\u5CF0\u65F6\u6BB5\u3002",reminderTest:"\u6D4B\u8BD5\u63D0\u9192",reminderTestTitle:"\u6D4B\u8BD5\u63D0\u9192",reminderTestBody:"\u8FD9\u662F\u4E00\u6761\u6D4B\u8BD5\u63D0\u9192\u3002\u6B63\u5F0F\u63D0\u9192\u4F1A\u5728\u5CF0\u65F6\u6BB5\u5F00\u59CB\u524D 5 \u5206\u949F\u53D1\u51FA\u3002",reminderSending:"\u5E94\u7528\u5185\u63D0\u9192\u5DF2\u663E\u793A\uFF0C\u6B63\u5728\u53D1\u9001\u7CFB\u7EDF\u901A\u77E5\u2026",reminderAccepted:"\u7CFB\u7EDF\u5DF2\u63A5\u6536\u901A\u77E5\u3002\u6CA1\u6709\u6A2A\u5E45\u65F6\uFF0C\u53EF\u67E5\u770B\u901A\u77E5\u4E2D\u5FC3\u6216\u68C0\u67E5\u52FF\u6270\u6A21\u5F0F\u3002",reminderUnconfirmed:"\u7CFB\u7EDF\u672A\u786E\u8BA4\u901A\u77E5\u663E\u793A\uFF0C\u5E94\u7528\u5185\u63D0\u9192\u5DF2\u4FDD\u7559\u3002",reminderFallback:"\u7CFB\u7EDF\u901A\u77E5\u53D1\u9001\u5931\u8D25\uFF0C\u5E94\u7528\u5185\u63D0\u9192\u5DF2\u4FDD\u7559\u3002\u8BF7\u68C0\u67E5\u7CFB\u7EDF\u901A\u77E5\u8BBE\u7F6E\u3002",dismissReminder:"\u5173\u95ED\u63D0\u9192",updateAvailable:"\u6709\u65B0\u7248\u672C",updateCheck:"\u68C0\u67E5\u66F4\u65B0",updateChecking:"\u6B63\u5728\u68C0\u67E5\u2026",updateInstall:"\u66F4\u65B0",updateInstalling:"\u6B63\u5728\u66F4\u65B0\u2026",updateDownload:"\u4E0B\u8F7D\u65B0\u7248",updateNotes:"\u66F4\u65B0\u8BF4\u660E",updateRestart:"\u65B0\u7248\u5DF2\u5B89\u88C5\uFF0C\u5B8C\u5168\u9000\u51FA\u5E76\u91CD\u65B0\u6253\u5F00 Harness \u540E\u751F\u6548\u3002",updateApplied:"Harness \u5DF2\u786E\u8BA4\u5E94\u7528\u66F4\u65B0\u3002",updateUnknown:"\u66F4\u65B0\u7ED3\u679C\u5C1A\u672A\u786E\u8BA4\uFF0C\u8BF7\u5728 Harness\u300C\u63D2\u4EF6\u300D\u9875\u9762\u6838\u5BF9\u540E\u91CD\u542F\u3002",updateFailed:"\u66F4\u65B0\u672A\u6210\u529F\uFF0C\u5F53\u524D\u7248\u672C\u7EE7\u7EED\u4F7F\u7528\u3002\u53EF\u7A0D\u540E\u91CD\u8BD5\u6216\u4ECE\u53D1\u5E03\u9875\u4E0B\u8F7D\u3002",updateIncompatible:"\u65B0\u7248\u4E0E\u5F53\u524D Harness \u4E0D\u517C\u5BB9\uFF0C\u8BF7\u67E5\u770B\u66F4\u65B0\u8BF4\u660E\u3002",updateCheckFailed:"\u6682\u65F6\u65E0\u6CD5\u68C0\u67E5\u65B0\u7248\uFF0C\u8BF7\u7A0D\u540E\u70B9\u51FB\u91CD\u8BD5\u3002\u5F53\u524D\u63D2\u4EF6\u6B63\u5E38\u4F7F\u7528\u3002",updateCurrent:"\u6682\u65E0\u9700\u8981\u5B89\u88C5\u7684\u65B0\u7248\u3002",calendarSource:"\u5047\u671F\u516C\u544A\u6765\u6E90",calendarChecking:"\u6B63\u5728\u81EA\u52A8\u66F4\u65B0\u8282\u5047\u65E5\u65E5\u5386\u2026",calendarWaiting:"\u65B0\u5E74\u5EA6\u65E5\u5386\u5C1A\u672A\u53D1\u5E03\uFF0C\u5C06\u6BCF\u5929\u81EA\u52A8\u68C0\u67E5\u3002",calendarUpdateFailed:"\u65E5\u5386\u66F4\u65B0\u6682\u672A\u6210\u529F\uFF0C\u4FDD\u7559\u5DF2\u6709\u6570\u636E\u5E76\u81EA\u52A8\u91CD\u8BD5\u3002",calendarStorageError:"\u65E5\u5386\u6682\u65F6\u65E0\u6CD5\u4FDD\u5B58\uFF0C\u7EE7\u7EED\u4F7F\u7528\u5DF2\u6709\u6570\u636E\u5E76\u81EA\u52A8\u91CD\u8BD5\u3002",unknownNote:"\u7F3A\u5C11\u672C\u5E74\u5EA6\u5047\u671F\u6570\u636E\uFF0C\u5DE5\u4F5C\u65E5\u5CF0\u65F6\u6BB5\u6682\u4E0D\u4F5C\u786E\u5B9A\u5224\u65AD\u3002",timeline:"\u5317\u4EAC\u65F6\u95F4 24 \u5C0F\u65F6\u65F6\u95F4\u8F74",days:"\u5929",hours:"\u5C0F\u65F6",minutes:"\u5206\u949F",seconds:"\u79D2"},_e={title:"Today\u2019s schedule",zone:"Beijing time \xB7 UTC+8",peak:"Peak",offpeak:"Off-peak",unknown:"Unverified",nextPeak:"Until peak hours",nextOffpeak:"Until off-peak",nextUnknown:"Calendar update needed",weekday:"Monday\u2013Friday",weekend:"Weekend \xB7 off-peak all day",holiday:"Public holiday \xB7 off-peak all day",unverified:"Holiday calendar needs an update",allDay:"All day",rest:"All other hours",now:"Now",nextSwitch:"Next change:",close:"Close timeline",open:"View peak hours timeline",rule:"DeepSeek official schedule",details:"Rules and reminders",note:"Weekends (including makeup workdays) and public holidays are off-peak all day.",reminder:"Remind 5 minutes before peak",reminderHint:"Off by default. Enabling requests notification permission. Reminds with a gentle chime while the app is running.",reminderSoundError:"The chime could not play. Send a test notification to retry.",reminderDenied:"Notification permission was not granted. Allow this app\u2019s notifications, then enable reminders again.",reminderUnsupported:"System notifications are unavailable in this environment.",reminderStorageError:"Reminder settings could not be saved. Check local storage permissions.",reminderDeliveryError:"The reminder could not be delivered. Check system notification settings, then enable it again.",reminderTitle:"Peak hours start soon",reminderBody:"Peak hours start at {time} (Beijing time).",reminderTest:"Send test notification",reminderTestTitle:"Test reminder",reminderTestBody:"This is a test reminder. Peak reminders arrive 5 minutes before peak hours start.",reminderSending:"In-app reminder displayed. Sending system notification\u2026",reminderAccepted:"The system accepted the notification. If no banner appears, check Notification Center or Do Not Disturb.",reminderUnconfirmed:"System display was not confirmed. The in-app reminder remains available.",reminderFallback:"System notification failed. The in-app reminder remains available. Check system notification settings.",dismissReminder:"Dismiss reminder",updateAvailable:"Update available",updateCheck:"Check for updates",updateChecking:"Checking\u2026",updateInstall:"Update",updateInstalling:"Updating\u2026",updateDownload:"Download update",updateNotes:"Release notes",updateRestart:"Update installed. Fully quit and reopen Harness to apply it.",updateApplied:"Harness confirmed that the update was applied.",updateUnknown:"Update outcome is unconfirmed. Check Harness Plugins before restarting.",updateFailed:"Update failed. Keep using this version and retry or download from GitHub later.",updateIncompatible:"This release is incompatible with your Harness. Read its release notes.",updateCheckFailed:"Could not check for updates. Click to retry later; the plugin keeps working.",updateCurrent:"No newer release needs to be installed.",calendarSource:"Holiday notice source",calendarChecking:"Updating the holiday calendar automatically\u2026",calendarWaiting:"The new annual calendar is not published yet. Checking daily.",calendarUpdateFailed:"Calendar update failed. Keeping existing data and retrying automatically.",calendarStorageError:"Calendar could not be saved. Keeping existing data and retrying automatically.",unknownNote:"Holiday data for this year is unavailable; weekday peak periods are unverified.",timeline:"24-hour timeline in Beijing time",days:"d",hours:"h",minutes:"min",seconds:"s"};var Me=`.dtb-theme {
3
3
  --dtb-bg: var(--dsw-alias-bg-base, #fff);
4
4
  --dtb-text: var(--dsw-alias-label-primary, #252925);
5
5
  --dtb-muted: var(--dsw-alias-label-tertiary, #798079);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-timeband",
3
- "version": "1.3.8",
3
+ "version": "1.3.10",
4
4
  "description": "头像旁的 DeepSeek 峰谷时段与今日时间轴",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -53,7 +53,7 @@
53
53
  }
54
54
  },
55
55
  "peerDependencies": {
56
- "@deepseek-ai/dsh": "0.2.1-rc.3"
56
+ "@deepseek-ai/dsh": "0.2.2-rc.1"
57
57
  },
58
58
  "peerDependenciesMeta": {
59
59
  "@deepseek-ai/dsh": {
@@ -72,11 +72,11 @@
72
72
  "prepack": "npm run typecheck && npm run build"
73
73
  },
74
74
  "devDependencies": {
75
- "@deepseek-ai/cordis": "4.0.5",
76
- "@deepseek-ai/dsh-client-locale": "0.2.1-rc.3",
77
- "@deepseek-ai/dsh-client-ui-renderer": "0.2.1-rc.3",
78
- "@deepseek-ai/dsh-client-ui-sidebar": "0.2.1-rc.3",
79
- "@deepseek-ai/dsh-client-ui-slots": "0.2.1-rc.3",
75
+ "@deepseek-ai/cordis": "4.1.0",
76
+ "@deepseek-ai/dsh-client-locale": "0.2.2-rc.1",
77
+ "@deepseek-ai/dsh-client-ui-renderer": "0.2.2-rc.1",
78
+ "@deepseek-ai/dsh-client-ui-sidebar": "0.2.2-rc.1",
79
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.2-rc.1",
80
80
  "@playwright/test": "1.63.0",
81
81
  "@types/node": "^24.0.0",
82
82
  "@types/react": "~18.3.1",