bnpanel-fpqd 0.4.1 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -22,6 +22,8 @@
22
22
  --bn-bad:#c23b2e; --bn-bad-soft:rgba(194,59,46,.10);
23
23
  --bn-shadow:0 1px 2px rgba(0,0,0,.04),0 12px 36px rgba(0,0,0,.06);
24
24
  --bn-shadow-hover:0 2px 4px rgba(0,0,0,.05),0 16px 40px rgba(0,0,0,.12);
25
+ --bn-solid:#111111; --bn-on-solid:#d4f07a;
26
+ --bn-toast-bg:#161616; --bn-toast-fg:#f4f1ea;
25
27
  --bn-r:16px; --bn-r-sm:10px;
26
28
  --bn-font:'Plus Jakarta Sans',ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"PingFang SC","Microsoft YaHei",sans-serif;
27
29
  --bn-mono:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
@@ -37,15 +39,17 @@
37
39
  --bn-bad:#ff7a6b; --bn-bad-soft:rgba(255,122,107,.14);
38
40
  --bn-shadow:0 1px 2px rgba(0,0,0,.4),0 10px 30px rgba(0,0,0,.35);
39
41
  --bn-shadow-hover:0 2px 6px rgba(0,0,0,.45),0 18px 44px rgba(0,0,0,.45);
42
+ --bn-solid:#d4f07a; --bn-on-solid:#141414;
43
+ --bn-toast-bg:#34302c; --bn-toast-fg:#f6f3ec;
40
44
  }
41
45
  }
42
- .bn-root{display:grid;grid-template-columns:minmax(0,208px) minmax(0,1fr);height:100%;min-height:520px;width:100%;max-width:100%;min-width:0;overflow:hidden;background:var(--bn-bg);color:var(--bn-ink);font:13px/1.55 var(--bn-font);-webkit-font-smoothing:antialiased}
46
+ .bn-root{position:relative;display:grid;grid-template-columns:minmax(0,208px) minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;height:100%;min-height:520px;width:100%;max-width:100%;min-width:0;overflow:hidden;background:var(--bn-bg);color:var(--bn-ink);font:13px/1.55 var(--bn-font);-webkit-font-smoothing:antialiased}
43
47
  .bn-root *{box-sizing:border-box}
44
- .bn-rail{display:flex;flex-direction:column;gap:2px;min-height:0;overflow:auto;padding:16px 10px;border-right:1px solid var(--bn-line);background:var(--bn-surface-2)}
48
+ .bn-rail{grid-column:1;grid-row:1 / span 2;display:flex;flex-direction:column;gap:2px;min-height:0;overflow:auto;padding:16px 10px;border-right:1px solid var(--bn-line);background:var(--bn-surface-2)}
45
49
  .bn-logo{display:flex;align-items:center;gap:9px;padding:2px 8px 16px;font-weight:680;letter-spacing:-.01em}
46
50
  .bn-logo .dot{width:22px;height:22px;border-radius:7px;background:var(--bn-ink);box-shadow:inset 0 0 0 2.5px var(--bn-accent),0 2px 8px rgba(0,0,0,.18);overflow:hidden}
47
51
  .bn-logo .dot img{width:100%;height:100%;object-fit:cover;display:block}
48
- .bn-tile img{width:100%;height:100%;object-fit:cover;display:block;border-radius:inherit}
52
+ .bn-tile img,.bn-dd-ico img{width:100%;height:100%;object-fit:cover;display:block;border-radius:0;transform:scale(1.08)}
49
53
  .bn-nav{display:flex;flex-direction:column;gap:2px}
50
54
  .bn-nav button{display:flex;align-items:center;gap:9px;width:100%;border:0;background:transparent;color:var(--bn-muted);padding:8px 10px;border-radius:8px;cursor:pointer;font:inherit;text-align:left;transition:background .12s,color .12s}
51
55
  .bn-nav button:hover{background:var(--bn-line);color:var(--bn-ink-2)}
@@ -86,9 +90,16 @@
86
90
  .bn-wx{display:flex;align-items:center;justify-content:space-between;gap:12px;border:1px solid var(--bn-line);border-radius:12px;padding:10px 10px 10px 12px;text-align:left;background:var(--bn-surface-2)}
87
91
  .bn-wx .label{font-size:11px;color:var(--bn-muted)}
88
92
  .bn-wx code{display:block;margin-top:2px;font-family:var(--bn-mono);font-size:14px;color:var(--bn-ink);letter-spacing:.01em}
89
- .bn-wx .bn-btn{height:30px;padding:0 12px;background:var(--bn-ink);color:var(--bn-accent);border-color:var(--bn-ink)}
93
+ .bn-wx .bn-btn{height:30px;padding:0 12px;background:var(--bn-solid);color:var(--bn-on-solid);border-color:var(--bn-solid)}
90
94
  .bn-manual{display:flex;align-items:center;justify-content:center;width:100%;margin-top:14px;height:36px;text-decoration:none;box-sizing:border-box}
91
- .bn-main{overflow:auto;overflow-x:hidden;padding:22px 26px 40px;min-width:0;max-width:100%}
95
+ .bn-main{grid-column:2;grid-row:1;overflow:auto;overflow-x:hidden;padding:22px 26px 40px;min-width:0;max-width:100%}
96
+ .bn-foot-note{grid-column:2;grid-row:2;margin:0;padding:8px 86px 12px 26px;display:flex;flex-direction:column;gap:3px;color:var(--bn-faint);font-size:12px;line-height:1.65;pointer-events:none;background:var(--bn-bg)}
97
+ .bn-cs{position:absolute;z-index:5;right:18px;bottom:16px;width:46px;height:46px;padding:0;border:0;border-radius:50%;display:grid;place-items:center;cursor:pointer;background:#111;color:#d4f07a;box-shadow:0 10px 24px rgba(0,0,0,.18),inset 0 0 0 2px #d4f07a}
98
+ .bn-cs svg{animation:bn-cs-breathe 2.2s ease-in-out infinite}
99
+ .bn-cs:hover{transform:translateY(-1px)}
100
+ .bn-cs.on{box-shadow:0 10px 24px rgba(0,0,0,.18),inset 0 0 0 2px #d4f07a,0 0 0 4px rgba(212,240,122,.28)}
101
+ @keyframes bn-cs-breathe{0%,100%{transform:scale(1)}50%{transform:scale(1.14)}}
102
+ @media (prefers-reduced-motion:reduce){.bn-cs svg{animation:none}}
92
103
  .bn-head{display:flex;align-items:flex-start;gap:12px;margin-bottom:20px}
93
104
  .bn-h1{font-size:19px;font-weight:680;letter-spacing:-.015em;margin:0}
94
105
  .bn-sub{color:var(--bn-muted);font-size:12px;margin-top:3px}
@@ -96,7 +107,7 @@
96
107
  .bn-btn{display:inline-flex;align-items:center;gap:6px;flex:0 0 auto;white-space:nowrap;border:1px solid var(--bn-line-strong);background:var(--bn-surface);color:var(--bn-ink);border-radius:8px;padding:6px 11px;font:inherit;font-size:12px;cursor:pointer;transition:transform .08s,box-shadow .12s,background .12s,opacity .12s}
97
108
  .bn-btn:hover{box-shadow:var(--bn-shadow)}
98
109
  .bn-btn:active{transform:translateY(1px)}
99
- .bn-btn.primary{background:var(--bn-ink);color:var(--bn-accent);border-color:var(--bn-ink)}
110
+ .bn-btn.primary{background:var(--bn-solid);color:var(--bn-on-solid);border-color:var(--bn-solid)}
100
111
  .bn-btn.ghost{border-color:transparent;background:transparent;color:var(--bn-muted)}
101
112
  .bn-btn.ghost:hover{background:var(--bn-line);color:var(--bn-ink)}
102
113
  .bn-btn.danger{color:var(--bn-bad);border-color:var(--bn-bad);background:transparent}
@@ -108,6 +119,98 @@
108
119
  .bn-chip.dim{background:var(--bn-line);color:var(--bn-muted)}
109
120
  .bn-chip .pulse{width:5px;height:5px;border-radius:50%;background:currentColor}
110
121
  .bn-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,280px),1fr));gap:14px;width:100%;min-width:0}
122
+ .bn-seg{display:inline-flex;align-items:center;padding:2px;border-radius:999px;background:var(--bn-bg);border:1px solid var(--bn-line)}
123
+ .bn-seg button,.bn-seg span{border:0;background:transparent;color:var(--bn-muted);border-radius:999px;padding:4px 10px;font:inherit;font-size:12px;font-weight:650;line-height:1.4}
124
+ .bn-seg button{cursor:pointer}
125
+ .bn-seg button:hover{color:var(--bn-ink)}
126
+ .bn-seg .on{background:#111;color:#d4f07a}
127
+ .bn-player-bar .bn-btn.play,.bn-reel-meta .bn-btn.play{background:#d4f07a;color:#111;border-color:#d4f07a;font-weight:700}
128
+ .bn-reels{margin:0 0 16px}
129
+ .bn-reels-head{display:flex;align-items:baseline;gap:8px;margin:0 0 8px}
130
+ .bn-reels-head b{font-weight:700}
131
+ .bn-reels-head span{color:var(--bn-muted);font-size:12px}
132
+ .bn-reels-row{display:flex;gap:12px;overflow:auto;padding-bottom:4px}
133
+ .bn-reel{flex:none;width:clamp(150px,calc(240px * var(--ar,1.777)),440px)}
134
+ .bn-reel video{display:block;width:100%;height:240px;object-fit:contain;background:#111;border-radius:16px;cursor:pointer}
135
+ .bn-reel-meta{display:flex;align-items:center;gap:8px;margin-top:8px}
136
+ .bn-reel-meta strong{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:650}
137
+ /* 顶层弹层:DSH 窗口按钮在宿主层,插件内部 z-index 盖不住。popover 升到文档顶层后再画全屏。 */
138
+ .bn-player-back{position:fixed;inset:0;z-index:2147483000;background:rgba(10,10,10,.62);display:grid;place-items:center;padding:calc(28px + env(titlebar-area-height, 0px)) 28px 28px;width:auto;height:auto;max-width:none;max-height:none;margin:0;border:0;overflow:visible;color:inherit}
139
+ @supports selector(:popover-open){
140
+ .bn-layer[popover]:not(:popover-open){display:none}
141
+ .bn-player-back[popover]:popover-open{display:grid}
142
+ }
143
+ .bn-player{width:min(92vw,calc((90vh - 64px) * var(--ar,1.777)));max-height:90vh;background:#111;border-radius:16px;overflow:hidden;display:flex;flex-direction:column;box-shadow:var(--bn-shadow-hover)}
144
+ .bn-player video{display:block;width:100%;height:auto;max-height:calc(90vh - 64px);aspect-ratio:var(--ar,1.777);object-fit:contain;background:#000}
145
+ .bn-player-bar{display:flex;align-items:center;gap:10px;padding:10px 14px;color:#f4f1ea;background:#111;flex:none}
146
+ .bn-player-bar strong{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:700}
147
+ .bn-player-count{flex:none;color:rgba(244,241,234,.55);font-size:12px;font-variant-numeric:tabular-nums}
148
+ .bn-player-bar .bn-btn{background:#1c1c1c;color:#f4f1ea;border-color:#333}
149
+ .bn-player-bar .bn-btn.ghost{background:transparent;color:#f4f1ea;border-color:transparent}
150
+ .bn-player.has-script video{max-height:calc(90vh - 196px)}
151
+ .bn-player-dock{flex:none;display:flex;flex-direction:column;gap:10px;padding:14px 16px 12px;background:#111;color:#f4f1ea}
152
+ .bn-player-top{display:flex;align-items:center;gap:12px;min-width:0}
153
+ .bn-player-top strong{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:700;letter-spacing:-.01em}
154
+ .bn-player-dock .bn-player-count{color:rgba(244,241,234,.48)}
155
+ .bn-player-quote{margin:0;padding:10px 12px;border-radius:10px;background:#1c1c1c;color:rgba(244,241,234,.9);font-size:13px;line-height:1.55;max-height:4.65em;overflow:auto;white-space:pre-wrap}
156
+ .bn-player-quote.quiet{color:rgba(244,241,234,.62)}
157
+ .bn-player-quote.lock{color:#d4f07a;background:rgba(212,240,122,.08);box-shadow:inset 0 0 0 1px rgba(212,240,122,.32)}
158
+ .bn-player-foot{display:flex;align-items:center;gap:8px;min-width:0}
159
+ .bn-player-nav{display:flex;gap:6px;flex:none}
160
+ .bn-player-actions{display:flex;gap:8px;align-items:center;margin-left:auto}
161
+ .bn-player-dock .bn-btn{height:30px;padding:0 12px;background:#1c1c1c;color:#f4f1ea;border-color:#2c2c2c}
162
+ .bn-player-dock .bn-btn.play{background:#d4f07a;color:#111;border-color:#d4f07a;font-weight:700}
163
+ .bn-player-dock .bn-btn.ghost{background:transparent;border-color:transparent;color:rgba(244,241,234,.72);padding:0 4px}
164
+ .bn-market-back{position:fixed;inset:0;z-index:2147483000;background:rgba(10,10,10,.46);display:grid;place-items:center;padding:calc(28px + env(titlebar-area-height, 0px)) 28px 28px;width:auto;height:auto;max-width:none;max-height:none;margin:0;border:0;overflow:visible;color:inherit}
165
+ @supports selector(:popover-open){
166
+ .bn-market-back[popover]:popover-open{display:grid}
167
+ }
168
+ .bn-market{width:min(1080px,calc(100vw - 48px));max-height:min(820px,calc(100vh - 64px));display:flex;flex-direction:column;overflow:hidden;background:var(--bn-bg);color:var(--bn-ink);border:1px solid var(--bn-line);border-radius:22px;box-shadow:var(--bn-shadow-hover)}
169
+ .bn-market-head{position:relative;flex:none;padding:22px 24px 16px;border-bottom:1px solid var(--bn-line);background:radial-gradient(560px 180px at 100% 0%,rgba(212,240,122,.55),transparent 72%),var(--bn-surface)}
170
+ .bn-market-kicker{font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:var(--bn-muted);font-weight:650}
171
+ .bn-market-head h2{margin:4px 70px 0 0;font-size:22px;line-height:1.2;letter-spacing:-.03em;font-weight:680}
172
+ .bn-market-head p{margin:6px 70px 0 0;color:var(--bn-muted);font-size:12.5px}
173
+ .bn-market-x{position:absolute;top:16px;right:16px;width:32px;height:32px;border:0;border-radius:10px;background:transparent;color:var(--bn-muted);font-size:20px;line-height:1;cursor:pointer}
174
+ .bn-market-x:hover{background:var(--bn-line);color:var(--bn-ink)}
175
+ .bn-market-filters{display:flex;flex-wrap:wrap;gap:6px;margin-top:14px}
176
+ .bn-market-filters button{border:1px solid var(--bn-line);background:var(--bn-surface);color:var(--bn-muted);border-radius:999px;padding:5px 12px;font:inherit;font-size:12px;font-weight:650;cursor:pointer}
177
+ .bn-market-filters button:hover{color:var(--bn-ink);border-color:var(--bn-line-strong)}
178
+ .bn-market-filters button.on{background:#111;color:#d4f07a;border-color:#111}
179
+ .bn-market-body{min-height:0;max-height:min(640px,calc(100vh - 230px));overflow:auto;padding:18px 22px 24px}
180
+ .bn-market-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:14px}
181
+ .bn-case{display:flex;flex-direction:column;width:100%;padding:0;overflow:hidden;text-align:left;color:inherit;font:inherit;cursor:pointer;background:var(--bn-surface);border:1px solid var(--bn-line);border-radius:16px;box-shadow:var(--bn-shadow)}
182
+ .bn-case:hover{box-shadow:var(--bn-shadow-hover);border-color:var(--bn-line-strong)}
183
+ .bn-case-cover{position:relative;aspect-ratio:16/9;background:#141414}
184
+ .bn-case-cover img{width:100%;height:100%;object-fit:cover;display:block}
185
+ .bn-case-fallback{width:100%;height:100%;display:grid;place-items:center;background:radial-gradient(120px 80px at 80% 20%,rgba(212,240,122,.45),transparent 70%),#141414;color:#d4f07a;font-weight:700;letter-spacing:.08em;font-size:13px}
186
+ .bn-case-play{position:absolute;right:10px;bottom:10px;width:34px;height:34px;border-radius:999px;display:grid;place-items:center;background:#d4f07a;color:#111;box-shadow:0 6px 16px rgba(0,0,0,.28)}
187
+ .bn-case-lock{position:absolute;left:10px;top:10px;padding:3px 8px;border-radius:999px;background:rgba(17,17,17,.78);color:#d4f07a;font-size:11px;font-weight:700;letter-spacing:.04em}
188
+ .bn-case-body{padding:12px 12px 14px}
189
+ .bn-case-title{font-weight:680;font-size:14px;letter-spacing:-.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
190
+ .bn-case-blurb{margin-top:4px;color:var(--bn-muted);font-size:12px;line-height:1.45;min-height:2.9em;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
191
+ .bn-case-meta{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
192
+ .bn-case-meta span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--bn-muted);background:var(--bn-line);border-radius:999px;padding:2px 8px}
193
+ @media (prefers-color-scheme:dark){
194
+ .bn-market-head{background:radial-gradient(560px 180px at 100% 0%,rgba(212,240,122,.16),transparent 72%),var(--bn-surface)}
195
+ .bn-case-fallback{background:radial-gradient(120px 80px at 80% 20%,rgba(212,240,122,.2),transparent 70%),#111}
196
+ }
197
+ .bn-docs-back{position:fixed;inset:0;z-index:2147483000;background:rgba(10,10,10,.28);width:auto;height:auto;max-width:none;max-height:none;margin:0;border:0;padding:0;overflow:visible;color:inherit}
198
+ @supports selector(:popover-open){
199
+ .bn-docs-back[popover]:popover-open{display:block}
200
+ }
201
+ .bn-docs{position:absolute;top:env(titlebar-area-height, 0px);right:0;bottom:0;width:min(560px,100%);background:var(--bn-surface);color:var(--bn-ink);border-left:1px solid var(--bn-line);box-shadow:var(--bn-shadow-hover);display:flex;flex-direction:column}
202
+ .bn-docs-bar{display:flex;align-items:center;gap:8px;padding:12px 14px;border-bottom:1px solid var(--bn-line);flex:none}
203
+ .bn-docs-bar strong{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
204
+ .bn-docs-bar a.bn-btn{text-decoration:none}
205
+ .bn-docs-tabs{display:flex;gap:6px;overflow:auto;padding:8px 14px;border-bottom:1px solid var(--bn-line);flex:none}
206
+ .bn-docs-tabs button{border:1px solid var(--bn-line);background:transparent;color:var(--bn-ink);border-radius:99px;padding:4px 10px;font:inherit;font-size:12px;cursor:pointer;white-space:nowrap}
207
+ .bn-docs-tabs button.on{background:#111;color:#d4f07a;border-color:#111}
208
+ .bn-docs-frame{position:relative;flex:1;min-height:0;display:flex}
209
+ .bn-docs iframe{flex:1;width:100%;min-height:0;border:0;background:#fff}
210
+ .bn-docs-miss{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:28px;text-align:center;color:var(--bn-muted);background:var(--bn-surface)}
211
+ .bn-docs-miss .bn-btn{text-decoration:none;background:#d4f07a;color:#111;border-color:#d4f07a;font-weight:700}
212
+ .bn-tutor-list{display:flex;flex-direction:column;gap:8px;margin-top:8px}
213
+ .bn-tutor-item{display:flex;justify-content:space-between;gap:10px;align-items:center;padding:10px 0;border-top:1px solid var(--bn-line)}
111
214
  .bn-card{position:relative;min-width:0;max-width:100%;overflow:hidden;background:var(--bn-surface);border:1px solid var(--bn-line);border-radius:var(--bn-r);padding:16px;box-shadow:var(--bn-shadow);transition:box-shadow .16s,border-color .16s}
112
215
  .bn-grid .bn-card{background:radial-gradient(480px 220px at 100% 0%,rgba(212,240,122,.48),rgba(212,240,122,0) 70%),var(--bn-surface)}
113
216
  .bn-card:hover{box-shadow:var(--bn-shadow-hover);border-color:var(--bn-line-strong)}
@@ -116,7 +219,7 @@
116
219
  .bn-un{height:22px;padding:0 8px;border-radius:999px;border:1px solid var(--bn-line);background:color-mix(in srgb,var(--bn-surface) 82%,transparent);color:var(--bn-muted);font:inherit;font-size:11px;line-height:1;cursor:pointer}
117
220
  .bn-un:hover{color:var(--bn-bad);border-color:transparent;background:var(--bn-bad-soft)}
118
221
  .bn-un:disabled{opacity:.42;cursor:not-allowed}
119
- .bn-tile{width:40px;height:40px;border-radius:11px;display:grid;place-items:center;font-weight:700;font-size:15px;color:var(--bn-accent);background:var(--bn-ink);flex:0 0 auto}
222
+ .bn-tile{width:40px;height:40px;border-radius:12px;overflow:hidden;display:grid;place-items:center;font-weight:700;font-size:15px;color:var(--bn-accent);background:#111;flex:0 0 auto;line-height:0}
120
223
  .bn-name{font-weight:640;font-size:14px;letter-spacing:-.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
121
224
  .bn-meta{color:var(--bn-muted);font-size:11.5px;margin-top:1px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
122
225
  .bn-card .status{position:absolute;top:14px;right:14px;z-index:1;display:flex;align-items:center;gap:6px;max-width:none}
@@ -163,8 +266,8 @@
163
266
  .bn-dd-item.on .bn-dd-hint{color:var(--bn-muted)}
164
267
  .bn-dd-check{flex:0 0 auto;color:var(--bn-ink);margin-left:auto}
165
268
  .bn-dd-hint + .bn-dd-check{margin-left:0}
166
- .bn-dd-ico{width:22px;height:22px;min-width:22px;max-width:22px;min-height:22px;max-height:22px;border-radius:6px;overflow:hidden;flex:0 0 22px;background:var(--bn-ink);color:var(--bn-accent);display:grid;place-items:center;font-size:11px;font-weight:700}
167
- .bn-dd-ico img{width:22px;height:22px;max-width:22px;max-height:22px;object-fit:cover;display:block}
269
+ .bn-dd-ico{width:22px;height:22px;min-width:22px;max-width:22px;min-height:22px;max-height:22px;border-radius:6px;overflow:hidden;flex:0 0 22px;background:#111;color:var(--bn-accent);display:grid;place-items:center;font-size:11px;font-weight:700;line-height:0}
270
+ .bn-dd-ico img{width:22px;height:22px;max-width:22px;max-height:22px}
168
271
  .bn-dd-item.rich{align-items:center;padding:8px 9px}
169
272
  .bn-dd-copy{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
170
273
  .bn-dd-item.rich .bn-dd-item-label{flex:none;font-weight:600}
@@ -177,8 +280,93 @@
177
280
  .bn-lic .status .bn-btn{height:26px;padding:0 8px;font-size:12px}
178
281
  .bn-lic .bn-desc{min-height:0;margin-top:10px}
179
282
  .bn-activate{display:flex;gap:10px;align-items:center;margin-top:16px;flex-wrap:nowrap}
283
+ .bn-activate.batch{flex-wrap:wrap;align-items:flex-start}
284
+ .bn-activate textarea.bn-input{flex:1 1 280px;width:auto;min-width:220px;max-width:none;min-height:78px;height:auto;padding:8px 10px;resize:vertical;font-family:var(--bn-mono);font-size:12px;line-height:1.65}
285
+ .bn-activate .bn-activate-out{flex:1 1 100%;display:flex;flex-direction:column;gap:4px;margin-top:2px;font-size:12px}
286
+ .bn-activate .bn-activate-out .row{display:flex;align-items:center;gap:8px;min-width:0}
287
+ .bn-upgrade{display:flex;flex-direction:column;align-items:flex-start;gap:10px;padding:22px;border:1px solid var(--bn-line);border-radius:var(--bn-r-sm);background:radial-gradient(320px 140px at 100% 0%,var(--bn-accent-soft),transparent 70%),var(--bn-surface-2)}
288
+ .bn-upgrade h3{margin:0;font-size:15px}
289
+ .bn-upgrade p{margin:0;color:var(--bn-muted);font-size:12.5px;line-height:1.65;max-width:58ch}
290
+ .bn-diagnose-card{display:flex;flex-direction:column;gap:6px}
291
+ .bn-diagnose-card .bn-desc{margin:0}
292
+ /* 账号增长工作台:号脉、对标、选题与复诊共用本机会话和档案 */
293
+ .bn-growth-tabs{display:flex;width:fit-content;max-width:100%;margin-bottom:16px;overflow:auto}
294
+ .bn-growth-tabs button{white-space:nowrap}
295
+ .bn-growth-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 14px}
296
+ .bn-growth-form .bn-field{margin:0;min-width:0}
297
+ .bn-growth-form .full{grid-column:1 / -1}
298
+ .bn-growth-form textarea.bn-input{min-height:78px;resize:vertical;line-height:1.6}
299
+ .bn-growth-source{display:flex;align-items:center;gap:10px;margin-top:12px;padding:10px 12px;border:1px solid var(--bn-line);border-radius:10px;background:var(--bn-accent-soft);color:var(--bn-ink-2);font-size:12px}
300
+ .bn-growth-source span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
301
+ .bn-growth-compare{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:12px}
302
+ .bn-growth-compare>div{min-width:0;padding:12px;border:1px solid var(--bn-line);border-radius:12px;background:var(--bn-surface-2)}
303
+ .bn-growth-compare b{display:block;margin-bottom:4px;font-size:12px}
304
+ .bn-growth-compare span{display:block;color:var(--bn-muted);font-size:11.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
305
+ @media (max-width:720px){.bn-growth-form,.bn-growth-compare{grid-template-columns:1fr}.bn-growth-form .full{grid-column:auto}}
306
+ .bn-diag-hero{position:relative;overflow:hidden;border-radius:var(--bn-r);padding:22px 24px;margin-bottom:16px;display:flex;gap:20px;align-items:flex-start;justify-content:space-between;background:radial-gradient(420px 180px at 100% 0%,rgba(212,240,122,.22),transparent 70%),linear-gradient(140deg,#101010 0%,#1d1d1a 55%,#2f3a17 100%);color:#f4f1ea}
307
+ .bn-diag-hero:after{content:'';position:absolute;right:-40px;bottom:-80px;width:240px;height:240px;border-radius:50%;background:radial-gradient(circle,rgba(212,240,122,.16),transparent 65%);pointer-events:none}
308
+ .bn-diag-kicker{font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:#d4f07a;font-weight:700}
309
+ .bn-diag-hero h2{margin:6px 0 0;font-size:20px;line-height:1.35;letter-spacing:-.02em;font-weight:700;max-width:30em}
310
+ .bn-diag-hero p{margin:7px 0 0;font-size:12.5px;line-height:1.65;color:rgba(244,241,234,.72);max-width:52em}
311
+ .bn-diag-values{display:flex;flex-wrap:wrap;gap:6px;margin-top:14px}
312
+ .bn-diag-values span{display:inline-flex;align-items:center;gap:6px;border:1px solid rgba(212,240,122,.3);background:rgba(212,240,122,.1);color:#e8f7b8;border-radius:999px;padding:4px 10px;font-size:11px;font-weight:600}
313
+ .bn-diag-values b{font-weight:800;color:#d4f07a}
314
+ .bn-diag-hero-side{flex:none;display:flex;flex-direction:column;gap:6px;align-items:flex-end;position:relative;z-index:1}
315
+ .bn-diag-hero-side .bn-chip{border-color:rgba(212,240,122,.4);color:#d4f07a;background:rgba(212,240,122,.12)}
316
+ .bn-diag-work{padding:20px 22px}
317
+ .bn-diag-block-head{display:flex;align-items:baseline;gap:10px;margin-bottom:12px;flex-wrap:wrap}
318
+ .bn-diag-block-head h2{margin:0;font-size:15px}
319
+ .bn-diag-block-head span{font-size:11.5px;color:var(--bn-faint)}
320
+ .bn-drop{border:1.5px dashed var(--bn-line-strong);border-radius:14px;padding:26px 18px;text-align:center;cursor:pointer;background:var(--bn-surface-2);transition:border-color .15s,background .15s,transform .15s}
321
+ .bn-drop:hover,.bn-drop.hot{border-color:var(--bn-accent-deep);background:var(--bn-accent-soft);transform:translateY(-1px)}
322
+ .bn-drop-ico{width:46px;height:46px;border-radius:13px;margin:0 auto 10px;display:grid;place-items:center;background:var(--bn-ink);color:var(--bn-accent);font-size:22px;line-height:1;box-shadow:inset 0 0 0 2px var(--bn-accent)}
323
+ .bn-drop b{display:block;font-size:13.5px}
324
+ .bn-drop small{display:block;margin-top:4px;font-size:11.5px;color:var(--bn-muted);line-height:1.55}
325
+ .bn-media-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:10px;margin-top:12px}
326
+ .bn-media{position:relative;border:1px solid var(--bn-line);border-radius:12px;overflow:hidden;background:var(--bn-surface)}
327
+ .bn-media img,.bn-media video{display:block;width:100%;height:82px;object-fit:cover;background:var(--bn-line)}
328
+ .bn-media-ph{display:grid;place-items:center;height:82px;background:linear-gradient(135deg,var(--bn-line),var(--bn-surface-2));color:var(--bn-muted);font-size:11.5px}
329
+ .bn-media-info{padding:7px 9px;display:flex;align-items:center;gap:6px}
330
+ .bn-media-name{min-width:0;flex:1;font-size:11.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
331
+ .bn-media-size{font-size:10.5px;color:var(--bn-faint);flex:none}
332
+ .bn-media-x{position:absolute;top:6px;right:6px;width:22px;height:22px;border:0;border-radius:50%;background:rgba(0,0,0,.55);color:#fff;font-size:13px;line-height:1;cursor:pointer;display:grid;place-items:center}
333
+ .bn-media-x:hover{background:var(--bn-bad)}
334
+ .bn-diag-label{margin:14px 0 6px;font-size:11.5px;color:var(--bn-muted);font-weight:600}
335
+ .bn-diag-text{width:100%;height:auto;min-height:84px;resize:vertical;font-family:var(--bn-font);line-height:1.65}
336
+ .bn-diag-cta{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:16px;padding-top:14px;border-top:1px solid var(--bn-line)}
337
+ .bn-diag-cta .bn-btn.primary{height:38px;padding:0 20px;border-radius:10px;font-size:13px;font-weight:650}
338
+ .bn-diag-cta small{font-size:11px;color:var(--bn-faint);line-height:1.5}
339
+ .bn-diag-status{display:inline-flex;align-items:center;gap:6px;border-radius:999px;padding:3px 9px;font-size:11px;background:var(--bn-surface-2);border:1px solid var(--bn-line);color:var(--bn-muted)}
340
+ .bn-diag-status:before{content:'';width:6px;height:6px;border-radius:50%;background:var(--bn-faint)}
341
+ .bn-diag-status.live{color:var(--bn-warn);border-color:var(--bn-warn);background:var(--bn-warn-soft)}
342
+ .bn-diag-status.live:before{background:var(--bn-warn);animation:bn-pulse 1.2s infinite}
343
+ .bn-diag-status.ok{color:var(--bn-ok);border-color:var(--bn-ok);background:var(--bn-ok-soft)}
344
+ .bn-diag-status.ok:before{background:var(--bn-ok)}
345
+ @keyframes bn-pulse{0%,100%{opacity:1}50%{opacity:.3}}
346
+ .bn-archive{display:grid;grid-template-columns:repeat(auto-fill,minmax(236px,1fr));gap:10px}
347
+ .bn-archive-item{position:relative;border:1px solid var(--bn-line);border-radius:12px;padding:12px 12px 10px;background:var(--bn-surface);cursor:pointer;transition:box-shadow .15s,border-color .15s,transform .1s}
348
+ .bn-archive-item:hover{box-shadow:var(--bn-shadow);border-color:var(--bn-line-strong);transform:translateY(-1px)}
349
+ .bn-archive-top{display:flex;align-items:center;justify-content:space-between;gap:8px}
350
+ .bn-archive-kind{font-size:10.5px;color:var(--bn-faint);letter-spacing:.04em}
351
+ .bn-archive-title{margin-top:6px;font-size:13px;font-weight:650;line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
352
+ .bn-archive-meta{margin-top:5px;font-size:11px;color:var(--bn-muted);display:flex;gap:6px;align-items:center;min-width:0}
353
+ .bn-archive-del{position:absolute;right:8px;bottom:8px;opacity:0;transition:opacity .15s}
354
+ .bn-archive-item:hover .bn-archive-del{opacity:1}
355
+ .bn-empty{padding:26px 18px;text-align:center;border:1px dashed var(--bn-line-strong);border-radius:12px;color:var(--bn-faint);font-size:12px;line-height:1.7;white-space:pre-line}
356
+ .bn-diag-upsell{display:flex;gap:24px;align-items:center;justify-content:space-between;flex-wrap:wrap;padding:24px;border-radius:var(--bn-r);border:1px solid var(--bn-line);background:radial-gradient(320px 160px at 0% 0%,var(--bn-accent-soft),transparent 70%),var(--bn-surface);box-shadow:var(--bn-shadow)}
357
+ .bn-diag-upsell h2{margin:0;font-size:18px;letter-spacing:-.01em}
358
+ .bn-diag-upsell p{margin:6px 0 0;font-size:12.5px;color:var(--bn-muted);line-height:1.65;max-width:46em}
359
+ .bn-diag-upsell ul{margin:12px 0 0;padding:0;list-style:none;display:flex;flex-wrap:wrap;gap:8px}
360
+ .bn-diag-upsell li{font-size:11.5px;color:var(--bn-ink-2);background:var(--bn-surface-2);border:1px solid var(--bn-line);border-radius:999px;padding:4px 10px}
361
+ .bn-diag-upsell li:before{content:'✓';color:var(--bn-ok);margin-right:5px;font-weight:700}
362
+ @media (max-width:720px){
363
+ .bn-diag-hero{flex-direction:column;gap:12px;padding:18px}
364
+ .bn-diag-hero h2{font-size:18px}
365
+ .bn-diag-hero-side{align-items:flex-start}
366
+ .bn-diag-work{padding:16px}
367
+ }
180
368
  .bn-activate .bn-dd{flex:0 1 280px;width:280px;min-width:180px;max-width:320px;height:36px}
181
- .bn-activate .bn-input{flex:1 1 220px;width:auto;min-width:160px;max-width:none;height:36px}
369
+ .bn-activate .bn-input:not(textarea){flex:1 1 220px;width:auto;min-width:160px;max-width:none;height:36px}
182
370
  .bn-activate .bn-dd-trigger,.bn-activate .bn-btn{height:36px;max-height:36px;overflow:hidden}
183
371
  @media (max-width:720px){
184
372
  .bn-activate{flex-wrap:wrap}
@@ -201,7 +389,7 @@
201
389
  .bn-progress i{display:block;height:100%;background:var(--bn-accent);border-radius:3px;transition:width .3s ease}
202
390
  .bn-task.done .bn-progress i{background:var(--bn-ok)}
203
391
  .bn-task.failed .bn-progress i{background:var(--bn-bad)}
204
- .bn-toast{position:fixed;left:50%;bottom:22px;transform:translateX(-50%);background:var(--bn-ink);color:var(--bn-accent);padding:9px 14px;border-radius:10px;font-size:12.5px;box-shadow:var(--bn-shadow-hover);z-index:50}
392
+ .bn-toast{position:fixed;left:50%;bottom:22px;transform:translateX(-50%);background:var(--bn-toast-bg);color:var(--bn-toast-fg);border:1px solid var(--bn-line-strong);padding:9px 14px;border-radius:10px;font-size:12.5px;box-shadow:var(--bn-shadow-hover);z-index:50}
205
393
  .bn-toast.bad{background:var(--bn-bad);color:#fff}
206
394
  .bn-modal-back{position:fixed;inset:0;background:rgba(10,10,10,.42);display:grid;place-items:center;z-index:40;padding:20px}
207
395
  .bn-modal{width:min(460px,100%);background:var(--bn-surface);border-radius:16px;border:1px solid var(--bn-line);box-shadow:var(--bn-shadow-hover);padding:20px}
@@ -240,6 +428,8 @@
240
428
  external: 'M14 3h7v7M10 14 21 3M21 14v7H3V3h7',
241
429
  key: 'M21 2l-2 2m-7.6 7.6a5 5 0 11-7 7 5 5 0 017-7zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3-3.5 3.5z',
242
430
  chat: 'M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z',
431
+ book: 'M6 3h9l5 5v13H6zM15 3v5h5M9 13h6M9 17h6',
432
+ lock: 'M7 10V7a5 5 0 0110 0v3M5 10h14v10H5z',
243
433
  };
244
434
  return { tag: 'svg', props: { width: s, height: s, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 1.7, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true }, children: [{ tag: 'path', props: { d: paths[name] || paths.grid }, children: [] }] };
245
435
  }
@@ -255,9 +445,20 @@
255
445
  }
256
446
  }
257
447
 
448
+ function docOpenLabel(url) {
449
+ try {
450
+ const host = new URL(String(url || '')).hostname;
451
+ if (/feishu|larkoffice|larksuite/i.test(host)) return '在飞书打开';
452
+ } catch {
453
+ /* 非法地址走下面的文案 */
454
+ }
455
+ return '在新窗口打开';
456
+ }
457
+
258
458
  function createPanel(React, ReactDOM, dshNav) {
259
459
  const h = React.createElement;
260
- const { useState, useEffect, useRef, useCallback } = React;
460
+ const { useState, useEffect, useLayoutEffect, useRef, useCallback } = React;
461
+ const useIsoLayout = useLayoutEffect || useEffect;
261
462
  const revealCreationSession = dshNav && typeof dshNav.revealCreationSession === 'function'
262
463
  ? dshNav.revealCreationSession
263
464
  : null;
@@ -273,6 +474,7 @@
273
474
  if (!res.ok) {
274
475
  const err = new Error((data && data.error) || res.statusText);
275
476
  if (data && data.code) err.code = data.code;
477
+ if (data && data.promptText) err.promptText = data.promptText;
276
478
  throw err;
277
479
  }
278
480
  return data;
@@ -456,17 +658,9 @@
456
658
  h('div', { className: 'bn-facts' },
457
659
  h('span', { className: 'bn-fact' }, '安装于 ' + timeAgo(agent.installedAt)),
458
660
  needRt
459
- ? h('span', { className: 'bn-fact', style: { color: 'var(--bn-warn)' } }, '缺少引擎依赖 ' + missingReq.join(', '))
661
+ ? h('span', { className: 'bn-fact', style: { color: 'var(--bn-warn)' } }, '运行环境还没准备好')
460
662
  : needOptionalRt
461
- ? (() => {
462
- const optional = missingAll.filter((s) => !/-npm$/i.test(String(s).split('@')[0] || ''));
463
- const label = (optional.length ? optional : missingAll).join(', ');
464
- return h('span', {
465
- className: 'bn-fact',
466
- style: { color: 'var(--bn-muted)' },
467
- title: 'ffmpeg/chromium 等需管理后台「运行时」上传后才能本地安装;未上传时可忽略,不影响 Studio 开造',
468
- }, '可选组件未就绪: ' + label);
469
- })()
663
+ ? h('span', { className: 'bn-fact', style: { color: 'var(--bn-muted)' } }, '部分功能还没准备好,不影响开始创作')
470
664
  : null,
471
665
  ),
472
666
  taskActive ? h('div', { className: 'bn-card-progress' },
@@ -478,9 +672,7 @@
478
672
  ? h('button', {
479
673
  className: 'bn-btn' + (needRt ? ' primary' : ''),
480
674
  disabled: taskActive || busy,
481
- title: needRt
482
- ? '必需: ' + missingReq.join(', ')
483
- : '可选组件未上传到商店时会跳过(ffmpeg/chromium)',
675
+ title: needRt ? '先准备好运行环境再开始创作' : '补齐后可以使用更多功能',
484
676
  onClick: () => onAction('runtime-missing', agent.id),
485
677
  }, h(Icon, { name: 'download' }), taskActive && task.kind === 'runtime' ? '安装中…' : (needRt ? '装环境' : '补环境'))
486
678
  : null,
@@ -521,7 +713,7 @@
521
713
  h('div', { className: 'bn-meta', style: { overflowWrap: 'anywhere' } },
522
714
  task.status === 'running' ? '进行中 · ' + task.progress + '%' + (task.message ? ' · ' + task.message : '')
523
715
  : task.status === 'done'
524
- ? ('完成' + (task.message ? ' · ' + task.message : '') + (task.artifact ? ' · ' + task.artifact : ''))
716
+ ? ('完成' + (task.message && task.message !== '完成' ? ' · ' + task.message : ''))
525
717
  : task.status === 'failed' ? ('失败' + (task.error ? ' · ' + task.error : ''))
526
718
  : task.status),
527
719
  ),
@@ -539,15 +731,74 @@
539
731
  const confirmLock = useRef(false);
540
732
  const [keyInput, setKeyInput] = useState('');
541
733
  const [productInput, setProductInput] = useState('biutalk');
734
+ const [activateResult, setActivateResult] = useState(null);
542
735
  const [lookupEmail, setLookupEmail] = useState('');
543
736
  const [lookupResult, setLookupResult] = useState(null);
737
+ const [diagText, setDiagText] = useState('');
738
+ const [diagSnap, setDiagSnap] = useState(null);
739
+ const [diagMedia, setDiagMedia] = useState([]);
740
+ const [diagUploading, setDiagUploading] = useState(false);
741
+ const [diagHot, setDiagHot] = useState(false);
742
+ const [diagAnalysis, setDiagAnalysis] = useState('');
743
+ const [diagSession, setDiagSession] = useState('');
744
+ const [diagProject, setDiagProject] = useState('');
745
+ const [diagPrompt, setDiagPrompt] = useState('');
746
+ const [diagBusy, setDiagBusy] = useState('');
747
+ const [diagErr, setDiagErr] = useState('');
748
+ const [diagReports, setDiagReports] = useState([]);
749
+ const diagFileRef = useRef(null);
750
+ const researchFileRef = useRef(null);
751
+ const [diagView, setDiagView] = useState('diagnose');
752
+ const [growth, setGrowth] = useState(() => ({
753
+ research: {
754
+ input: { accounts: '', links: '', positioning: '', notes: '' },
755
+ media: [], reports: [], analysis: '', sessionId: '', projectPath: '', promptText: '', recordId: '',
756
+ busy: '', error: '', uploading: false, hot: false,
757
+ },
758
+ planner: {
759
+ input: {
760
+ diagnosisId: null, positioning: '', frequency: '3', notes: '',
761
+ startDate: new Date(Date.now() - new Date().getTimezoneOffset() * 60000).toISOString().slice(0, 10),
762
+ },
763
+ media: [], reports: [], analysis: '', sessionId: '', projectPath: '', promptText: '', recordId: '',
764
+ busy: '', error: '', uploading: false, hot: false,
765
+ },
766
+ followup: {
767
+ input: { baselineId: null, currentId: null, notes: '' },
768
+ media: [], reports: [], analysis: '', sessionId: '', projectPath: '', promptText: '', recordId: '',
769
+ busy: '', error: '', uploading: false, hot: false,
770
+ },
771
+ }));
772
+ const growthPatch = (kind, patch) => setGrowth((current) => ({
773
+ ...current,
774
+ [kind]: { ...current[kind], ...(typeof patch === 'function' ? patch(current[kind]) : patch) },
775
+ }));
776
+ const growthInput = (kind, key, value) => setGrowth((current) => ({
777
+ ...current,
778
+ [kind]: { ...current[kind], input: { ...current[kind].input, [key]: value } },
779
+ }));
544
780
  const [studioAgentId, setStudioAgentId] = useState(null);
545
781
  const [pendingPerm, setPendingPerm] = useState(null);
546
782
  const [contactOpen, setContactOpen] = useState(false);
547
783
  const [campIdx, setCampIdx] = useState(0);
784
+ const [reelIdx, setReelIdx] = useState(0);
785
+ const [marketOpen, setMarketOpen] = useState(false);
786
+ const [marketFilter, setMarketFilter] = useState('all');
787
+ const [unlocked, setUnlocked] = useState({});
788
+ const [promptBusy, setPromptBusy] = useState('');
789
+ const [promptError, setPromptError] = useState({});
790
+ const [caseSeed, setCaseSeed] = useState(null);
791
+ const [seedNonce, setSeedNonce] = useState(0);
792
+ const [player, setPlayer] = useState(null);
793
+ const [playerRatio, setPlayerRatio] = useState(16 / 9);
794
+ const [docsOpen, setDocsOpen] = useState(false);
795
+ const [docId, setDocId] = useState('');
796
+ const [docBlocked, setDocBlocked] = useState(false);
797
+ const [studioQuery, setStudioQuery] = useState('');
548
798
  const [contact, setContact] = useState(null);
549
799
  const [contactStatus, setContactStatus] = useState('');
550
800
  const [contactError, setContactError] = useState('');
801
+ const [checkNote, setCheckNote] = useState('');
551
802
 
552
803
  const refresh = useCallback(async () => {
553
804
  try {
@@ -565,13 +816,133 @@
565
816
  const timer = setInterval(() => setCampIdx((index) => index + 1), 5000);
566
817
  return () => clearInterval(timer);
567
818
  }, [campaignCount]);
568
- useEffect(() => { if (!toast) return; const t = setTimeout(() => setToast(null), toast.bad ? 12000 : 3200); return () => clearTimeout(t); }, [toast]);
819
+ useEffect(() => { if (!toast) return undefined; const t = setTimeout(() => setToast(null), toast.bad ? 12000 : 3200); return () => clearTimeout(t); }, [toast]);
820
+ useEffect(() => {
821
+ if (tab !== 'diagnose') return undefined;
822
+ let alive = true;
823
+ api('/diagnose/reports')
824
+ .then((data) => {
825
+ if (!alive) return;
826
+ const rows = Array.isArray(data.reports) ? data.reports : [];
827
+ setDiagReports(rows);
828
+ })
829
+ .catch(() => { /* 存档读不到不影响抓取 */ });
830
+ return () => { alive = false; };
831
+ }, [tab]);
832
+ useEffect(() => {
833
+ const completed = diagReports.filter((row) => String(row.analysis || '').trim());
834
+ const valid = (id) => completed.some((row) => row.id === id);
835
+ setGrowth((current) => {
836
+ const plannerId = current.planner.input.diagnosisId;
837
+ const baselineId = current.followup.input.baselineId;
838
+ const currentId = current.followup.input.currentId;
839
+ const nextPlanner = plannerId === null ? (completed[0]?.id || null) : (valid(plannerId) ? plannerId : '');
840
+ const nextBaseline = baselineId === null ? (completed[1]?.id || null) : (valid(baselineId) ? baselineId : '');
841
+ const nextCurrent = currentId === null ? (completed[0]?.id || null) : (valid(currentId) ? currentId : '');
842
+ if (nextPlanner === plannerId && nextBaseline === baselineId && nextCurrent === currentId) return current;
843
+ return {
844
+ ...current,
845
+ planner: { ...current.planner, input: { ...current.planner.input, diagnosisId: nextPlanner } },
846
+ followup: {
847
+ ...current.followup,
848
+ input: { ...current.followup.input, baselineId: nextBaseline, currentId: nextCurrent },
849
+ },
850
+ };
851
+ });
852
+ }, [diagReports]);
853
+ useEffect(() => {
854
+ if (tab !== 'diagnose' || diagView === 'diagnose') return undefined;
855
+ const kind = diagView;
856
+ let alive = true;
857
+ api('/growth/reports?kind=' + encodeURIComponent(kind))
858
+ .then((data) => {
859
+ if (alive) growthPatch(kind, { reports: Array.isArray(data.reports) ? data.reports : [] });
860
+ })
861
+ .catch((error) => { if (alive) growthPatch(kind, { error: error.message || '读取本地档案失败' }); });
862
+ return () => { alive = false; };
863
+ }, [tab, diagView]);
864
+ // 分析回填:模型把结论写到会话目录 report.md,面板按 sessionId 取回。
865
+ useEffect(() => {
866
+ if (tab !== 'diagnose' || !diagSession || diagAnalysis) return undefined;
867
+ let alive = true;
868
+ const tick = async () => {
869
+ try {
870
+ const data = await api('/diagnose/session-report?sessionId=' + encodeURIComponent(diagSession));
871
+ if (!alive || !data.report || !data.report.analysis) return;
872
+ setDiagAnalysis(String(data.report.analysis));
873
+ setDiagReports((rows) => rows.map((row) => (row.id === data.report.id ? data.report : row)));
874
+ setToast({ text: '分析已回填到面板' });
875
+ } catch {
876
+ /* 还没写完,下一轮再取 */
877
+ }
878
+ };
879
+ const timer = setInterval(tick, 5000);
880
+ tick();
881
+ return () => { alive = false; clearInterval(timer); };
882
+ }, [tab, diagSession, diagAnalysis]);
883
+ useEffect(() => {
884
+ if (tab !== 'diagnose' || diagView === 'diagnose') return undefined;
885
+ const kind = diagView;
886
+ const current = growth[kind];
887
+ if (!current.sessionId || current.analysis) return undefined;
888
+ let alive = true;
889
+ const tick = async () => {
890
+ try {
891
+ const data = await api('/growth/session-report?sessionId=' + encodeURIComponent(current.sessionId));
892
+ if (!alive || !data.report || !String(data.report.analysis || '').trim()) return;
893
+ setGrowth((all) => {
894
+ const item = all[kind];
895
+ return {
896
+ ...all,
897
+ [kind]: {
898
+ ...item,
899
+ analysis: String(data.report.analysis || ''),
900
+ recordId: String(data.report.id || item.recordId || ''),
901
+ reports: [data.report, ...item.reports.filter((row) => row.id !== data.report.id)].slice(0, 60),
902
+ },
903
+ };
904
+ });
905
+ setToast({ text: '结果已回填到面板' });
906
+ } catch {
907
+ /* 模型尚未写完,下一轮继续读取本机 report.md */
908
+ }
909
+ };
910
+ const timer = setInterval(tick, 5000);
911
+ tick();
912
+ return () => { alive = false; clearInterval(timer); };
913
+ }, [tab, diagView, growth[diagView]?.sessionId, growth[diagView]?.analysis]);
569
914
  useEffect(() => {
570
915
  if (!contactOpen) return;
571
916
  const onKey = (ev) => { if (ev.key === 'Escape') setContactOpen(false); };
572
917
  window.addEventListener('keydown', onKey);
573
918
  return () => window.removeEventListener('keydown', onKey);
574
919
  }, [contactOpen]);
920
+ useEffect(() => {
921
+ if (!docsOpen) return undefined;
922
+ const onKey = (ev) => { if (ev.key === 'Escape') setDocsOpen(false); };
923
+ window.addEventListener('keydown', onKey);
924
+ return () => window.removeEventListener('keydown', onKey);
925
+ }, [docsOpen]);
926
+ const caseOpen = !!player;
927
+ useIsoLayout(() => {
928
+ const opened = [];
929
+ document.querySelectorAll('.bn-layer').forEach((node) => {
930
+ if (typeof node.showPopover !== 'function') return;
931
+ try {
932
+ if (!node.matches(':popover-open')) node.showPopover();
933
+ opened.push(node);
934
+ } catch (err) {
935
+ node.removeAttribute('popover');
936
+ }
937
+ });
938
+ return () => {
939
+ opened.forEach((node) => {
940
+ try {
941
+ if (node.isConnected && node.matches(':popover-open')) node.hidePopover();
942
+ } catch (err) { /* 节点已经卸下 */ }
943
+ });
944
+ };
945
+ }, [docsOpen, caseOpen, marketOpen]);
575
946
 
576
947
  const openContact = async () => {
577
948
  setContactOpen(true);
@@ -655,8 +1026,12 @@
655
1026
 
656
1027
  const act = async (fn, okText) => {
657
1028
  setBusy(true);
658
- try { await fn(); await refresh(); if (okText) setToast({ text: okText }); }
659
- catch (err) { setToast({ text: err.message, bad: true }); }
1029
+ try {
1030
+ const result = await fn();
1031
+ await refresh();
1032
+ const text = okText || (typeof result === 'string' ? result : '');
1033
+ if (text) setToast({ text });
1034
+ } catch (err) { setToast({ text: err.message, bad: true }); }
660
1035
  finally { setBusy(false); }
661
1036
  };
662
1037
 
@@ -680,7 +1055,520 @@
680
1055
  throw new Error('任务超时,请到「任务」查看');
681
1056
  };
682
1057
 
683
- const openStudio = async (id) => {
1058
+ /** 一行一个:优先按「产品 KEY」拆;只有 KEY 时用下拉里选的产品。 */
1059
+ const parseKeys = (text) => String(text || '')
1060
+ .split(/\r?\n/)
1061
+ .map((line) => line.trim())
1062
+ .filter(Boolean)
1063
+ .map((line) => {
1064
+ const pair = line.match(/^([A-Za-z][A-Za-z0-9._-]*)\s+(\S+)$/);
1065
+ if (pair) return { line, product: pair[1].toLowerCase(), key: pair[2].toUpperCase() };
1066
+ return { line, product: productInput, key: line.toUpperCase() };
1067
+ });
1068
+
1069
+ const activateKeys = () => act(async () => {
1070
+ const rows = parseKeys(keyInput);
1071
+ if (!rows.length) throw new Error('请先粘贴激活码');
1072
+ const ok = [];
1073
+ const failed = [];
1074
+ for (const row of rows) {
1075
+ try {
1076
+ await api('/activate', { method: 'POST', body: { key: row.key, product: row.product } });
1077
+ ok.push(row.product);
1078
+ } catch (err) {
1079
+ failed.push({ ...row, error: err.message });
1080
+ }
1081
+ }
1082
+ setActivateResult({ ok, failed });
1083
+ setKeyInput(failed.map((row) => row.line).join('\n'));
1084
+ if (!failed.length) return ok.length > 1 ? '已激活 ' + ok.length + ' 个产品' : '已激活 ' + ok[0];
1085
+ if (!ok.length) throw new Error(failed[0].error);
1086
+ return '成功 ' + ok.length + ' 个,失败 ' + failed.length + ' 个(失败行已保留)';
1087
+ });
1088
+
1089
+ const uploadDiagFiles = async (source, target = 'diagnose') => {
1090
+ const input = source && source.target ? source.target : null;
1091
+ const files = Array.from((input ? input.files : source) || []);
1092
+ if (input) input.value = '';
1093
+ if (!files.length) return;
1094
+ const setUploading = (value) => target === 'research' ? growthPatch('research', { uploading: value }) : setDiagUploading(value);
1095
+ const setUploadError = (value) => target === 'research' ? growthPatch('research', { error: value }) : setDiagErr(value);
1096
+ setUploading(true);
1097
+ setUploadError('');
1098
+ const added = [];
1099
+ for (const file of files) {
1100
+ const video = file.type.indexOf('video/') === 0 || /\.(mp4|mov|m4v|webm|avi|mkv)$/i.test(file.name);
1101
+ const image = file.type.indexOf('image/') === 0 || /\.(jpe?g|png|webp|gif|bmp|heic)$/i.test(file.name);
1102
+ if (!video && !image) {
1103
+ setUploadError('只支持图片或视频:' + file.name);
1104
+ continue;
1105
+ }
1106
+ if (file.size > 300 * 1024 * 1024) {
1107
+ setUploadError(file.name + ' 超过 300MB');
1108
+ continue;
1109
+ }
1110
+ try {
1111
+ const res = await fetch(BASE + '/diagnose/upload?name=' + encodeURIComponent(file.name), {
1112
+ method: 'POST',
1113
+ headers: { 'content-type': file.type || 'application/octet-stream' },
1114
+ body: file,
1115
+ });
1116
+ const data = await res.json().catch(() => ({}));
1117
+ if (!res.ok) throw new Error(data.error || '上传失败');
1118
+ added.push({ ...data.media, previewUrl: image ? URL.createObjectURL(file) : '' });
1119
+ } catch (err) {
1120
+ setUploadError(err.message || ('上传失败:' + file.name));
1121
+ }
1122
+ }
1123
+ if (added.length) {
1124
+ if (target === 'research') {
1125
+ growthPatch('research', (current) => ({ media: [...current.media, ...added].slice(0, 12) }));
1126
+ } else {
1127
+ setDiagMedia((rows) => [...rows, ...added].slice(0, 12));
1128
+ setDiagSnap((prev) => prev || {
1129
+ title: added[0].name,
1130
+ kind: 'upload',
1131
+ media: added.map((item) => item.name),
1132
+ });
1133
+ }
1134
+ }
1135
+ setUploading(false);
1136
+ };
1137
+
1138
+ const removeDiagMedia = (id) => setDiagMedia((rows) => rows.filter((row) => row.id !== id));
1139
+
1140
+ const openDiagSession = () => {
1141
+ if (!diagSession) return;
1142
+ if (!revealCreationSession) {
1143
+ setToast({ text: '请到 DSH 会话列表里找「账号体检」', bad: true });
1144
+ return;
1145
+ }
1146
+ try {
1147
+ revealCreationSession(diagSession);
1148
+ } catch {
1149
+ setToast({ text: '暂时切不过去,请到会话列表里找', bad: true });
1150
+ }
1151
+ };
1152
+
1153
+ const runDiagSession = async () => {
1154
+ if (!diagSnap && !diagMedia.length) {
1155
+ setDiagErr('请先上传后台截图或视频');
1156
+ return;
1157
+ }
1158
+ setDiagBusy('session');
1159
+ setDiagErr('');
1160
+ try {
1161
+ const data = await api('/diagnose/session', {
1162
+ method: 'POST',
1163
+ body: {
1164
+ snapshot: diagSnap || undefined,
1165
+ media: diagMedia.map(({ id, name, kind, size }) => ({ id, name, kind, size })),
1166
+ },
1167
+ });
1168
+ const snapshot = diagSnap || {
1169
+ title: (diagMedia[0] && diagMedia[0].name) || '未命名体检',
1170
+ kind: 'upload',
1171
+ media: diagMedia.map((item) => item.name),
1172
+ };
1173
+ if (!diagSnap) setDiagSnap(snapshot);
1174
+ setDiagSession(String(data.sessionId || ''));
1175
+ setDiagProject(String(data.projectPath || ''));
1176
+ setDiagPrompt(String(data.promptText || ''));
1177
+ // 先存档再切会话:切走后面板可能重挂载,快照和 sessionId 不能只留在内存里。
1178
+ let archived = false;
1179
+ try {
1180
+ const saved = await api('/diagnose/reports', {
1181
+ method: 'POST',
1182
+ body: {
1183
+ snapshot,
1184
+ analysis: diagAnalysis,
1185
+ sessionId: data.sessionId,
1186
+ projectPath: data.projectPath,
1187
+ media: data.media || diagMedia,
1188
+ },
1189
+ });
1190
+ if (saved.report) {
1191
+ setDiagReports((rows) => [saved.report, ...rows].slice(0, 50));
1192
+ archived = true;
1193
+ }
1194
+ } catch {
1195
+ /* 存档失败不影响分析会话语义 */
1196
+ }
1197
+ // 旧分析已入档,清空以允许新一轮 report.md 回填。
1198
+ if (archived) setDiagAnalysis('');
1199
+ if (data.sessionId) {
1200
+ try {
1201
+ if (revealCreationSession) revealCreationSession(data.sessionId);
1202
+ } catch {
1203
+ /* 会话已建好,切不过去也能从列表进入 */
1204
+ }
1205
+ }
1206
+ setToast({ text: '已开分析会话;结果写成 report.md 后会自动回填,也可以手动粘贴' });
1207
+ } catch (err) {
1208
+ if (err.promptText) setDiagPrompt(String(err.promptText));
1209
+ setDiagErr(err.message || '开不了 DSH 会话');
1210
+ } finally {
1211
+ setDiagBusy('');
1212
+ }
1213
+ };
1214
+
1215
+ const saveDiagnose = async () => {
1216
+ if (!diagSnap && !diagMedia.length) return;
1217
+ try {
1218
+ const data = await api('/diagnose/reports', {
1219
+ method: 'POST',
1220
+ body: {
1221
+ snapshot: diagSnap || { title: (diagMedia[0] && diagMedia[0].name) || '未命名体检', kind: 'upload' },
1222
+ analysis: diagAnalysis,
1223
+ sessionId: diagSession,
1224
+ projectPath: diagProject,
1225
+ media: diagMedia,
1226
+ },
1227
+ });
1228
+ if (data.report) setDiagReports((rows) => [data.report, ...rows].slice(0, 50));
1229
+ setToast({ text: '报告已保存到本机' });
1230
+ } catch (err) {
1231
+ setToast({ text: err.message || '保存失败', bad: true });
1232
+ }
1233
+ };
1234
+
1235
+ const openDiagReport = (report) => {
1236
+ if (!report || !report.snapshot) return;
1237
+ setDiagSnap(report.snapshot);
1238
+ setDiagMedia((Array.isArray(report.media) ? report.media : []).map((item) => ({
1239
+ ...item,
1240
+ previewUrl: item.kind === 'image' ? BASE + '/diagnose/media/' + item.id : '',
1241
+ })));
1242
+ setDiagAnalysis(String(report.analysis || ''));
1243
+ setDiagSession(String(report.sessionId || ''));
1244
+ setDiagProject(String(report.projectPath || ''));
1245
+ setDiagPrompt('');
1246
+ setDiagErr('');
1247
+ setDiagText('');
1248
+ };
1249
+
1250
+ const removeDiagReport = (report) => setConfirm({
1251
+ title: '删除这份诊断?',
1252
+ hint: report.title || '已保存的诊断报告',
1253
+ confirmLabel: '删除',
1254
+ run: () => act(async () => {
1255
+ await api('/diagnose/reports/delete', { method: 'POST', body: { id: report.id } });
1256
+ setDiagReports((rows) => rows.filter((row) => row.id !== report.id));
1257
+ }, '已删除'),
1258
+ });
1259
+
1260
+ const growthLabels = { research: '对标调研', planner: '选题规划', followup: '复诊对比' };
1261
+ const growthLinks = (kind, input) => kind === 'planner'
1262
+ ? { diagnosisId: input.diagnosisId || '' }
1263
+ : kind === 'followup'
1264
+ ? { baselineId: input.baselineId || '', currentId: input.currentId || '' }
1265
+ : {};
1266
+
1267
+ const runGrowthSession = async (kind) => {
1268
+ const current = growth[kind];
1269
+ const input = current.input;
1270
+ let validation = '';
1271
+ if (kind === 'research' && !String(input.accounts || '').trim()) validation = '请先填写至少一个对标账号名';
1272
+ if (kind === 'planner' && !input.diagnosisId && !String(input.positioning || '').trim()) validation = '请选择号脉报告,或填写账号定位';
1273
+ if (kind === 'followup' && (!input.baselineId || !input.currentId)) validation = '请选择基线号脉和本次号脉';
1274
+ if (kind === 'followup' && input.baselineId && input.baselineId === input.currentId) validation = '复诊需要选择两份不同的号脉报告';
1275
+ if (validation) {
1276
+ growthPatch(kind, { error: validation });
1277
+ return;
1278
+ }
1279
+ growthPatch(kind, { busy: 'session', error: '' });
1280
+ try {
1281
+ const data = await api('/growth/session', {
1282
+ method: 'POST',
1283
+ body: {
1284
+ kind,
1285
+ input,
1286
+ media: kind === 'research' ? current.media.map(({ id, name, kind: mediaKind, size }) => ({ id, name, kind: mediaKind, size })) : [],
1287
+ },
1288
+ });
1289
+ setGrowth((all) => {
1290
+ const item = all[kind];
1291
+ const record = data.record || null;
1292
+ return {
1293
+ ...all,
1294
+ [kind]: {
1295
+ ...item,
1296
+ sessionId: String(data.sessionId || ''),
1297
+ projectPath: String(data.projectPath || ''),
1298
+ promptText: String(data.promptText || ''),
1299
+ recordId: String(record?.id || ''),
1300
+ analysis: '',
1301
+ reports: record ? [record, ...item.reports.filter((row) => row.id !== record.id)].slice(0, 60) : item.reports,
1302
+ },
1303
+ };
1304
+ });
1305
+ if (data.sessionId && revealCreationSession) {
1306
+ try { revealCreationSession(data.sessionId); } catch { /* 可从 DSH 会话列表进入 */ }
1307
+ }
1308
+ setToast({ text: '已开' + growthLabels[kind] + '会话;report.md 写好后会自动回填' });
1309
+ } catch (error) {
1310
+ growthPatch(kind, {
1311
+ error: error.message || '开不了 DSH 会话',
1312
+ promptText: String(error.promptText || current.promptText || ''),
1313
+ });
1314
+ } finally {
1315
+ growthPatch(kind, { busy: '' });
1316
+ }
1317
+ };
1318
+
1319
+ const saveGrowth = async (kind) => {
1320
+ const current = growth[kind];
1321
+ if (!String(current.analysis || '').trim()) return;
1322
+ try {
1323
+ const data = await api('/growth/reports', {
1324
+ method: 'POST',
1325
+ body: {
1326
+ kind,
1327
+ id: current.recordId || undefined,
1328
+ input: current.input,
1329
+ analysis: current.analysis,
1330
+ sessionId: current.sessionId,
1331
+ projectPath: current.projectPath,
1332
+ media: current.media.map(({ id, name, kind: mediaKind, size }) => ({ id, name, kind: mediaKind, size })),
1333
+ links: growthLinks(kind, current.input),
1334
+ },
1335
+ });
1336
+ if (data.report) {
1337
+ setGrowth((all) => {
1338
+ const item = all[kind];
1339
+ return {
1340
+ ...all,
1341
+ [kind]: {
1342
+ ...item,
1343
+ recordId: String(data.report.id || ''),
1344
+ reports: [data.report, ...item.reports.filter((row) => row.id !== data.report.id)].slice(0, 60),
1345
+ },
1346
+ };
1347
+ });
1348
+ }
1349
+ setToast({ text: growthLabels[kind] + '已保存到本机' });
1350
+ } catch (error) {
1351
+ growthPatch(kind, { error: error.message || '保存失败' });
1352
+ }
1353
+ };
1354
+
1355
+ const openGrowthRecord = (kind, report) => {
1356
+ if (!report) return;
1357
+ growthPatch(kind, (current) => ({
1358
+ input: { ...current.input, ...(report.input || {}) },
1359
+ analysis: String(report.analysis || ''),
1360
+ sessionId: String(report.sessionId || ''),
1361
+ projectPath: String(report.projectPath || ''),
1362
+ recordId: String(report.id || ''),
1363
+ promptText: '',
1364
+ error: '',
1365
+ media: (Array.isArray(report.media) ? report.media : []).map((item) => ({
1366
+ ...item,
1367
+ previewUrl: item.kind === 'image' ? BASE + '/diagnose/media/' + item.id : '',
1368
+ })),
1369
+ }));
1370
+ };
1371
+
1372
+ const removeGrowthRecord = (kind, report) => setConfirm({
1373
+ title: '删除这份' + growthLabels[kind] + '?',
1374
+ hint: report.title || '已保存的本机报告',
1375
+ confirmLabel: '删除',
1376
+ run: () => act(async () => {
1377
+ await api('/growth/reports/delete', { method: 'POST', body: { kind, id: report.id } });
1378
+ setGrowth((all) => {
1379
+ const item = all[kind];
1380
+ const opened = item.recordId === report.id;
1381
+ return {
1382
+ ...all,
1383
+ [kind]: {
1384
+ ...item,
1385
+ reports: item.reports.filter((row) => row.id !== report.id),
1386
+ ...(opened ? { recordId: '', sessionId: '', projectPath: '', analysis: '', promptText: '' } : {}),
1387
+ },
1388
+ };
1389
+ });
1390
+ }, '已删除'),
1391
+ });
1392
+
1393
+ const openGrowthConversation = (kind) => {
1394
+ const sessionId = growth[kind].sessionId;
1395
+ if (!sessionId) return;
1396
+ if (!revealCreationSession) {
1397
+ setToast({ text: '请到 DSH 会话列表里找「' + growthLabels[kind] + '」', bad: true });
1398
+ return;
1399
+ }
1400
+ try { revealCreationSession(sessionId); }
1401
+ catch { setToast({ text: '暂时切不过去,请到会话列表里找', bad: true }); }
1402
+ };
1403
+
1404
+ const planFromDiagnosis = (report) => {
1405
+ if (!report || !String(report.analysis || '').trim()) return;
1406
+ growthInput('planner', 'diagnosisId', report.id);
1407
+ setDiagView('planner');
1408
+ };
1409
+
1410
+ const followupFromDiagnosis = (report) => {
1411
+ if (!report || !String(report.analysis || '').trim()) return;
1412
+ setGrowth((all) => {
1413
+ const other = diagReports.find((row) => row.id !== report.id && String(row.analysis || '').trim());
1414
+ const previousBaseline = all.followup.input.baselineId;
1415
+ const baselineId = previousBaseline && previousBaseline !== report.id
1416
+ ? previousBaseline
1417
+ : (other?.id || '');
1418
+ return {
1419
+ ...all,
1420
+ followup: {
1421
+ ...all.followup,
1422
+ input: { ...all.followup.input, baselineId, currentId: report.id },
1423
+ },
1424
+ };
1425
+ });
1426
+ setDiagView('followup');
1427
+ };
1428
+
1429
+ const closePlayer = () => {
1430
+ if (document.fullscreenElement && document.exitFullscreen) document.exitFullscreen().catch(() => {});
1431
+ setPlayer(null);
1432
+ };
1433
+
1434
+ const closeMarket = () => {
1435
+ setMarketOpen(false);
1436
+ closePlayer();
1437
+ };
1438
+
1439
+ const primePrompt = (item) => {
1440
+ if (!promptsOn || !item || item.access !== 'licensed' || !holdsProduct(item.agent)) return;
1441
+ if (Object.prototype.hasOwnProperty.call(unlocked, item.id) || promptBusy === item.id) return;
1442
+ setPromptBusy(item.id);
1443
+ setPromptError((cur) => {
1444
+ const next = { ...cur };
1445
+ delete next[item.id];
1446
+ return next;
1447
+ });
1448
+ api('/showcase/prompt', { method: 'POST', body: { id: item.id } })
1449
+ .then((got) => {
1450
+ setUnlocked((cur) => ({ ...cur, [item.id]: String((got && got.prompt) || '') }));
1451
+ })
1452
+ .catch((err) => {
1453
+ setPromptError((cur) => ({ ...cur, [item.id]: err.message || '暂时无法获取提示词' }));
1454
+ })
1455
+ .finally(() => setPromptBusy((cur) => (cur === item.id ? '' : cur)));
1456
+ };
1457
+
1458
+ const openPlayer = (item) => {
1459
+ if (!item || !item.videoUrl) return;
1460
+ setPlayerRatio(16 / 9);
1461
+ setPlayer(item);
1462
+ primePrompt(item);
1463
+ };
1464
+
1465
+ const promptsOn = !!(state && state.showcase && state.showcase.promptsEnabled);
1466
+ const AGENT_ORDER = ['biureel', 'biuremtion', 'biuvibe', 'biuart', 'biutalk'];
1467
+ const AGENT_FALLBACK = { biureel: 'BiuReel', biuremtion: 'BiuRemo', biuvibe: 'BiuVibe', biuart: 'BiuArt', biutalk: 'BiuTalk' };
1468
+ const agentName = (slug) => {
1469
+ const hit = ((state && state.store) || []).find((item) => item.slug === slug);
1470
+ if (hit && hit.name) return hit.name;
1471
+ return AGENT_FALLBACK[slug] || slug || '这个 Agent';
1472
+ };
1473
+ const holdsProduct = (slug) => {
1474
+ const row = ((state && state.licenses) || []).find((item) => item.product === slug);
1475
+ return !!(row && row.status && row.status.canExport);
1476
+ };
1477
+ const caseRows = () => ((state && state.showcase && state.showcase.cases) || []);
1478
+ const playerRows = () => {
1479
+ const rows = caseRows();
1480
+ if (!promptsOn || marketFilter === 'all') return rows;
1481
+ return rows.filter((row) => row.agent === marketFilter);
1482
+ };
1483
+
1484
+ const movePlayer = (delta) => {
1485
+ const rows = playerRows();
1486
+ if (!player || rows.length < 2) return;
1487
+ const at = rows.findIndex((row) => row.id === player.id);
1488
+ const nextAt = (((at < 0 ? 0 : at) + delta) % rows.length + rows.length) % rows.length;
1489
+ setPlayerRatio(16 / 9);
1490
+ setPlayer(rows[nextAt]);
1491
+ setReelIdx(nextAt);
1492
+ primePrompt(rows[nextAt]);
1493
+ };
1494
+
1495
+ useEffect(() => {
1496
+ if (!player) return undefined;
1497
+ const onKey = (ev) => {
1498
+ if (ev.key === 'Escape') closePlayer();
1499
+ if (ev.key !== 'ArrowLeft' && ev.key !== 'ArrowRight') return;
1500
+ if (ev.target && ev.target.tagName === 'VIDEO') return;
1501
+ ev.preventDefault();
1502
+ movePlayer(ev.key === 'ArrowLeft' ? -1 : 1);
1503
+ };
1504
+ window.addEventListener('keydown', onKey);
1505
+ return () => window.removeEventListener('keydown', onKey);
1506
+ }, [player, state, marketFilter]);
1507
+
1508
+ useEffect(() => {
1509
+ if (!marketOpen || player) return undefined;
1510
+ const onKey = (ev) => { if (ev.key === 'Escape') closeMarket(); };
1511
+ window.addEventListener('keydown', onKey);
1512
+ return () => window.removeEventListener('keydown', onKey);
1513
+ }, [marketOpen, player]);
1514
+
1515
+ const goActivate = (slug) => {
1516
+ closeMarket();
1517
+ setProductInput(slug || 'biutalk');
1518
+ setTab('account');
1519
+ setToast({ text: '请激活「' + agentName(slug) + '」后查看提示词并做同款' });
1520
+ };
1521
+
1522
+ const copyPrompt = async (text) => {
1523
+ const value = String(text || '').trim();
1524
+ if (!value) return;
1525
+ try {
1526
+ await navigator.clipboard.writeText(value);
1527
+ setToast({ text: '提示词已复制' });
1528
+ } catch {
1529
+ setToast({ text: '复制失败,请手动选择提示词', bad: true });
1530
+ }
1531
+ };
1532
+
1533
+ const shootLike = async (item) => {
1534
+ const slug = item && item.agent;
1535
+ if (!slug) return;
1536
+ if (promptsOn && item.access === 'licensed' && !holdsProduct(slug)) {
1537
+ goActivate(slug);
1538
+ return;
1539
+ }
1540
+ const hit = (state.store || []).find((s) => s.slug === slug);
1541
+ const installed = (state.agents || []).find((a) => a.id === slug || a.product === slug) || (hit && hit.agent);
1542
+ if (!installed) {
1543
+ setToast({ text: '请先安装对应 Agent,再使用同款开拍', bad: true });
1544
+ return;
1545
+ }
1546
+ let prompt = '';
1547
+ if (promptsOn && item.access === 'licensed') {
1548
+ try {
1549
+ const got = await api('/showcase/prompt', { method: 'POST', body: { id: item.id } });
1550
+ prompt = String((got && got.prompt) || '');
1551
+ setUnlocked((cur) => ({ ...cur, [item.id]: prompt }));
1552
+ } catch (err) {
1553
+ setToast({ text: err.message || '暂时无法获取提示词', bad: true });
1554
+ return;
1555
+ }
1556
+ } else if (promptsOn) {
1557
+ prompt = item.prompt || '';
1558
+ }
1559
+ const nonce = seedNonce + 1;
1560
+ setSeedNonce(nonce);
1561
+ const parts = [];
1562
+ if (item.style) parts.push('style=' + encodeURIComponent(item.style));
1563
+ if (item.id) parts.push('case=' + encodeURIComponent(item.id));
1564
+ parts.push('seed=' + nonce);
1565
+ closeMarket();
1566
+ return openStudio(installed.id, parts.join('&'), prompt ? { id: item.id, prompt, style: item.style || '' } : null);
1567
+ };
1568
+
1569
+ const openStudio = async (id, query, seed) => {
1570
+ setStudioQuery(query || '');
1571
+ setCaseSeed(seed || null);
684
1572
  const agent = (state.agents || []).find((a) => a.id === id);
685
1573
  if (agent && agent.needsPermissionAck && !agent.permissionsAck) {
686
1574
  setPendingPerm(agent);
@@ -703,7 +1591,7 @@
703
1591
  setPendingPerm(agent || { id });
704
1592
  setModal('permissions');
705
1593
  } else if (err.message && err.message.indexOf('未授权') >= 0) {
706
- setProductInput(id === 'biureel' ? 'biureel' : 'biutalk');
1594
+ setProductInput(id || 'biutalk');
707
1595
  setTab('account');
708
1596
  setToast({ text: err.message, bad: true });
709
1597
  } else {
@@ -799,19 +1687,335 @@
799
1687
  const hit = (state.store || []).find((item) => item.slug === studioAgent.product || item.slug === studioAgent.id);
800
1688
  return hit && hit.description ? String(hit.description).trim() : '';
801
1689
  })();
802
- const campaigns = state.campaigns || [];
1690
+ const docs = state.docs || [];
1691
+ const doc = docs.find((item) => item.id === docId) || docs[0] || null;
1692
+ const openDocs = () => { setDocBlocked(false); setDocsOpen(true); };
1693
+ const licenseOn = !!(state.license && (state.license.state === 'active' || state.license.state === 'grace'));
1694
+ const member = state.member || null;
1695
+ const memberOn = !!(member && member.active);
1696
+ const memberCampaign = (state.campaigns || []).find(
1697
+ (c) => c.kind !== 'link' && /会员|年费|年卡|member|vip/i.test(String(c.name || '') + ' ' + String(c.slug || '')),
1698
+ );
1699
+ const memberHref = state.buyUrl
1700
+ ? state.buyUrl + (memberCampaign ? (String(state.buyUrl).indexOf('?') >= 0 ? '&' : '?') + 'c=' + encodeURIComponent(memberCampaign.slug) : '')
1701
+ : '';
1702
+ const diagKindLabel = (kind) => kind === 'profile' ? '账号主页' : kind === 'note' ? '图文' : kind === 'text' ? '文案' : kind === 'upload' ? '上传素材' : '视频';
1703
+ const fmtCount = (value) => {
1704
+ if (value == null) return '';
1705
+ if (value >= 10000) return (Math.round(value / 1000) / 10) + 'w';
1706
+ return String(value);
1707
+ };
1708
+ const diagSize = (bytes) => {
1709
+ const size = Number(bytes) || 0;
1710
+ if (size >= 1024 * 1024) return (Math.round(size / 1024 / 102.4) / 10) + 'MB';
1711
+ if (size >= 1024) return Math.round(size / 1024) + 'KB';
1712
+ return size ? size + 'B' : '';
1713
+ };
1714
+ const diagReady = !!(diagMedia.length || diagSnap);
1715
+ const openManual = () => {
1716
+ if (!docs.length) {
1717
+ setToast({ text: '还没有手册', bad: true });
1718
+ return;
1719
+ }
1720
+ openDocs();
1721
+ };
1722
+ const openCases = () => {
1723
+ const cases = (state.showcase && state.showcase.cases) || [];
1724
+ if (!cases.length) {
1725
+ setToast({ text: '还没有案例', bad: true });
1726
+ return;
1727
+ }
1728
+ if (!promptsOn) {
1729
+ const at = ((reelIdx % cases.length) + cases.length) % cases.length;
1730
+ openPlayer(cases[at]);
1731
+ return;
1732
+ }
1733
+ setMarketFilter('all');
1734
+ setMarketOpen(true);
1735
+ };
1736
+ const topSeg = h('div', { className: 'bn-seg' },
1737
+ h('span', { className: 'on', title: (state.license && state.license.reason) || '' }, licenseOn ? '已授权' : '未授权'),
1738
+ h('button', { type: 'button', onClick: openManual }, '手册'),
1739
+ h('button', { type: 'button', onClick: openCases }, '案例'),
1740
+ );
1741
+ const campaigns = state.license && state.license.canExport ? [] : (state.campaigns || []);
803
1742
  const camp = campaigns.length ? campaigns[((campIdx % campaigns.length) + campaigns.length) % campaigns.length] : null;
804
1743
  const campIcons = { spark: '✨', gift: '🎁', rocket: '🚀', crown: '👑', star: '⭐', bolt: '⚡', box: '📦', heart: '💛', fire: '🔥', gem: '💎', party: '🎉', tag: '🏷️' };
805
- const campHref = camp && state.buyUrl
806
- ? state.buyUrl + (String(state.buyUrl).indexOf('?') >= 0 ? '&' : '?') + 'c=' + encodeURIComponent(camp.slug)
1744
+ const campHref = camp
1745
+ ? camp.kind === 'link'
1746
+ ? String(camp.linkUrl || '')
1747
+ : state.buyUrl
1748
+ ? state.buyUrl + (String(state.buyUrl).indexOf('?') >= 0 ? '&' : '?') + 'c=' + encodeURIComponent(camp.slug)
1749
+ : ''
807
1750
  : '';
808
1751
 
1752
+ const completedDiagReports = diagReports.filter((report) => String(report.analysis || '').trim());
1753
+ const growthHeroCopy = {
1754
+ research: {
1755
+ title: '拆透对标,只迁移你能用的结构',
1756
+ desc: '拆解公开信息与真实作品,分清事实和推断,提炼五维内容公式,并明确哪些能借鉴、哪些不能照搬。',
1757
+ values: ['公开事实', '五维公式', '迁移边界', '下周动作'],
1758
+ },
1759
+ planner: {
1760
+ title: '让号脉结论直接变成下周选题',
1761
+ desc: '自动带入选定号脉报告,把诊断结论和真实素材转成日期、钩子、形式、公式卡与检查点都齐全的内容计划。',
1762
+ values: ['自动衔接号脉', '真实素材', '逐条公式卡', '指标检查点'],
1763
+ },
1764
+ followup: {
1765
+ title: '用两次真实号脉,看清改变是否发生',
1766
+ desc: '选择基线和本次号脉,只对同口径指标计算变化,验收此前 30 天目标,再决定处方的保留、停止与新增。',
1767
+ values: ['同口径对照', '变化量', '目标验收', '下阶段处方'],
1768
+ },
1769
+ };
1770
+ const growthHero = (kind) => {
1771
+ const copy = growthHeroCopy[kind];
1772
+ return h('section', { className: 'bn-diag-hero' },
1773
+ h('div', { style: { minWidth: 0 } },
1774
+ h('div', { className: 'bn-diag-kicker' }, memberOn ? '年会员 · ' + growthLabels[kind] : '年会员专属'),
1775
+ h('h2', null, copy.title),
1776
+ h('p', null, copy.desc + ' 素材与报告只存在本机。'),
1777
+ h('div', { className: 'bn-diag-values' }, copy.values.map((value, index) =>
1778
+ h('span', { key: value }, h('b', null, String(index + 1).padStart(2, '0')), value))),
1779
+ ),
1780
+ h('div', { className: 'bn-diag-hero-side' }, memberOn
1781
+ ? h('span', { className: 'bn-chip ok' }, member.daysLeft ? '剩余 ' + member.daysLeft + ' 天' : '已开通')
1782
+ : h('span', { className: 'bn-chip dim' }, '未开通')),
1783
+ );
1784
+ };
1785
+
1786
+ const growthMedia = (kind) => {
1787
+ const current = growth[kind];
1788
+ if (!current.media.length) return null;
1789
+ return h('div', { className: 'bn-media-grid' }, current.media.map((item) => h('div', { key: item.id, className: 'bn-media' },
1790
+ item.previewUrl ? h('img', { src: item.previewUrl, alt: '' }) : h('div', { className: 'bn-media-ph' }, item.kind === 'video' ? '▶ 视频' : '图片'),
1791
+ h('div', { className: 'bn-media-info' },
1792
+ h('span', { className: 'bn-media-name', title: item.name }, item.name),
1793
+ h('span', { className: 'bn-media-size' }, diagSize(item.size)),
1794
+ ),
1795
+ h('button', {
1796
+ className: 'bn-media-x', title: '移除',
1797
+ onClick: (event) => {
1798
+ event.stopPropagation();
1799
+ growthPatch(kind, (itemState) => ({ media: itemState.media.filter((row) => row.id !== item.id) }));
1800
+ },
1801
+ }, '×'),
1802
+ )));
1803
+ };
1804
+
1805
+ const growthResult = (kind) => {
1806
+ const current = growth[kind];
1807
+ if (!current.sessionId && !current.analysis && !current.promptText) return null;
1808
+ return h('section', { className: 'bn-panel' },
1809
+ h('div', { className: 'bn-sec-head' },
1810
+ h('h2', null, growthLabels[kind] + '报告'),
1811
+ h('div', { className: 'bn-sec-actions' },
1812
+ h('span', { className: 'bn-diag-status ' + (current.analysis ? 'ok' : current.sessionId ? 'live' : '') },
1813
+ current.analysis ? '已回填' : current.sessionId ? '分析中' : '手动模式'),
1814
+ ),
1815
+ ),
1816
+ h('textarea', {
1817
+ className: 'bn-input bn-diag-text', rows: 10,
1818
+ placeholder: '分析完成后自动回填;也可以把结果粘贴到这里保存',
1819
+ value: current.analysis,
1820
+ onChange: (event) => growthPatch(kind, { analysis: event.target.value }),
1821
+ }),
1822
+ h('div', { className: 'bn-diag-cta' },
1823
+ h('button', { className: 'bn-btn primary', disabled: !String(current.analysis || '').trim(), onClick: () => saveGrowth(kind) }, '保存到档案'),
1824
+ current.promptText ? h('button', { className: 'bn-btn', onClick: () => copyPrompt(current.promptText) }, '复制提示词') : null,
1825
+ current.sessionId ? h('button', { className: 'bn-btn ghost', onClick: () => openGrowthConversation(kind) }, '回到分析会话') : null,
1826
+ h('small', null, '报告仅保存在本机;切换档案不会上传素材或内容。'),
1827
+ ),
1828
+ );
1829
+ };
1830
+
1831
+ const growthArchive = (kind) => {
1832
+ const reports = growth[kind].reports;
1833
+ return h('section', { className: 'bn-panel' },
1834
+ h('div', { className: 'bn-sec-head' },
1835
+ h('h2', null, growthLabels[kind] + '档案'),
1836
+ h('div', { className: 'bn-sec-actions' }, h('span', { className: 'bn-chip dim' }, String(reports.length))),
1837
+ ),
1838
+ reports.length ? h('div', { className: 'bn-archive' }, reports.map((report) => h('article', {
1839
+ key: report.id, className: 'bn-archive-item', onClick: () => openGrowthRecord(kind, report),
1840
+ },
1841
+ h('div', { className: 'bn-archive-top' },
1842
+ h('span', { className: 'bn-archive-kind' }, report.analysis ? '已完成' : report.sessionId ? '待回填' : '手动存档'),
1843
+ h('span', { className: 'bn-archive-kind' }, timeAgo(report.createdAt)),
1844
+ ),
1845
+ h('div', { className: 'bn-archive-title' }, report.title || growthLabels[kind]),
1846
+ h('div', { className: 'bn-archive-meta' }, h('span', null, '本机档案 · 点击回看')),
1847
+ h('button', {
1848
+ className: 'bn-btn ghost bn-archive-del',
1849
+ onClick: (event) => { event.stopPropagation(); removeGrowthRecord(kind, report); },
1850
+ }, '删除'),
1851
+ ))) : h('div', { className: 'bn-empty' }, '还没有' + growthLabels[kind] + '档案。\n完成一次分析后会存在本机。'),
1852
+ );
1853
+ };
1854
+
1855
+ const researchWorkspace = () => {
1856
+ const current = growth.research;
1857
+ const input = current.input;
1858
+ return h('div', null,
1859
+ growthHero('research'),
1860
+ h('input', {
1861
+ ref: researchFileRef, type: 'file', accept: 'image/*,video/*', multiple: true, style: { display: 'none' },
1862
+ onChange: (event) => uploadDiagFiles(event, 'research'),
1863
+ }),
1864
+ h('section', { className: 'bn-panel bn-diag-work' },
1865
+ h('div', { className: 'bn-diag-block-head' }, h('h2', null, '确定调研对象'), h('span', null, '账号名必填,主页与高播放作品截图越完整,拆解越可靠')),
1866
+ h('div', { className: 'bn-growth-form' },
1867
+ h('div', { className: 'bn-field' }, h('label', null, '对标账号名(必填)'), h('input', {
1868
+ className: 'bn-input', value: input.accounts, placeholder: '多个账号用逗号分隔',
1869
+ onChange: (event) => growthInput('research', 'accounts', event.target.value),
1870
+ })),
1871
+ h('div', { className: 'bn-field' }, h('label', null, '主页链接(可选)'), h('input', {
1872
+ className: 'bn-input', value: input.links, placeholder: '粘贴抖音主页或公开报道链接',
1873
+ onChange: (event) => growthInput('research', 'links', event.target.value),
1874
+ })),
1875
+ h('div', { className: 'bn-field full' }, h('label', null, '你的定位与现有资源(可选,影响可迁移判断)'), h('textarea', {
1876
+ className: 'bn-input', value: input.positioning, placeholder: '例如:给实体店主讲短视频获客;自己一个人拍摄,有真实门店和客户问题',
1877
+ onChange: (event) => growthInput('research', 'positioning', event.target.value),
1878
+ })),
1879
+ ),
1880
+ h('div', {
1881
+ className: 'bn-drop' + (current.hot ? ' hot' : ''), style: { marginTop: 12 },
1882
+ onClick: () => { if (!current.uploading && researchFileRef.current) researchFileRef.current.click(); },
1883
+ onDragOver: (event) => { event.preventDefault(); growthPatch('research', { hot: true }); },
1884
+ onDragLeave: () => growthPatch('research', { hot: false }),
1885
+ onDrop: (event) => {
1886
+ event.preventDefault(); growthPatch('research', { hot: false });
1887
+ uploadDiagFiles(event.dataTransfer && event.dataTransfer.files, 'research');
1888
+ },
1889
+ },
1890
+ h('div', { className: 'bn-drop-ico' }, '+'),
1891
+ h('b', null, current.uploading ? '正在写入本机…' : '补充主页 / 作品截图或视频'),
1892
+ h('small', null, '建议包含 3–5 条代表作品的标题、发布时间与可见表现;模型会自行读取素材'),
1893
+ ),
1894
+ growthMedia('research'),
1895
+ h('div', { className: 'bn-diag-label' }, '调研重点(可选)'),
1896
+ h('textarea', {
1897
+ className: 'bn-input bn-diag-text', rows: 3, value: input.notes,
1898
+ placeholder: '例如:重点看开头钩子和选题来源,不要建议需要团队才能做的形式',
1899
+ onChange: (event) => growthInput('research', 'notes', event.target.value),
1900
+ }),
1901
+ current.error ? h('div', { className: 'bn-chip bad', style: { marginTop: 10 } }, current.error) : null,
1902
+ h('div', { className: 'bn-diag-cta' },
1903
+ h('button', { className: 'bn-btn primary', disabled: !String(input.accounts || '').trim() || !!current.busy || current.uploading, onClick: () => runGrowthSession('research') }, current.busy ? '正在开调研会话…' : '开始对标调研'),
1904
+ h('small', null, '使用你自己的 DSH 模型;没有联网工具时会明确标未核实,不会假装检索。'),
1905
+ ),
1906
+ ),
1907
+ growthResult('research'),
1908
+ growthArchive('research'),
1909
+ );
1910
+ };
1911
+
1912
+ const plannerWorkspace = () => {
1913
+ const current = growth.planner;
1914
+ const input = current.input;
1915
+ const selected = completedDiagReports.find((report) => report.id === input.diagnosisId) || null;
1916
+ return h('div', null,
1917
+ growthHero('planner'),
1918
+ h('section', { className: 'bn-panel bn-diag-work' },
1919
+ h('div', { className: 'bn-diag-block-head' }, h('h2', null, '衔接号脉与真实排期'), h('span', null, '默认选用最新已完成号脉,也可以切换或不用报告')),
1920
+ h('div', { className: 'bn-growth-form' },
1921
+ h('div', { className: 'bn-field full' }, h('label', null, '带入的号脉报告'), h('select', {
1922
+ className: 'bn-select', value: input.diagnosisId || '',
1923
+ onChange: (event) => growthInput('planner', 'diagnosisId', event.target.value),
1924
+ },
1925
+ h('option', { value: '' }, completedDiagReports.length ? '不使用号脉报告(需填写定位)' : '暂无已完成号脉报告'),
1926
+ completedDiagReports.map((report) => h('option', { key: report.id, value: report.id }, (report.title || '未命名号脉') + ' · ' + timeAgo(report.createdAt))),
1927
+ )),
1928
+ selected ? h('div', { className: 'bn-growth-source full' },
1929
+ h('span', null, '已自动衔接:' + (selected.title || '未命名号脉')),
1930
+ h('button', { className: 'bn-btn ghost', onClick: () => { openDiagReport(selected); setDiagView('diagnose'); } }, '查看原报告'),
1931
+ ) : null,
1932
+ h('div', { className: 'bn-field full' }, h('label', null, '账号定位(留空时仅从号脉报告提取)'), h('input', {
1933
+ className: 'bn-input', value: input.positioning, placeholder: '给谁看、讲什么、凭什么信你;报告无法确认时会列入待补,不会编造',
1934
+ onChange: (event) => growthInput('planner', 'positioning', event.target.value),
1935
+ })),
1936
+ h('div', { className: 'bn-field' }, h('label', null, '开始日期'), h('input', {
1937
+ className: 'bn-input', type: 'date', value: input.startDate,
1938
+ onChange: (event) => growthInput('planner', 'startDate', event.target.value),
1939
+ })),
1940
+ h('div', { className: 'bn-field' }, h('label', null, '每周发布上限(条)'), h('input', {
1941
+ className: 'bn-input', type: 'number', min: 1, max: 14, value: input.frequency,
1942
+ onChange: (event) => growthInput('planner', 'frequency', event.target.value),
1943
+ })),
1944
+ h('div', { className: 'bn-field full' }, h('label', null, '真实素材与排期约束'), h('textarea', {
1945
+ className: 'bn-input', value: input.notes,
1946
+ placeholder: '列出近期真实在做的事、可拍事件、产品/项目、可拍时间;每条选题都必须能追溯到这些素材或号脉证据',
1947
+ onChange: (event) => growthInput('planner', 'notes', event.target.value),
1948
+ })),
1949
+ ),
1950
+ current.error ? h('div', { className: 'bn-chip bad', style: { marginTop: 10 } }, current.error) : null,
1951
+ h('div', { className: 'bn-diag-cta' },
1952
+ h('button', {
1953
+ className: 'bn-btn primary', disabled: !!current.busy || (!input.diagnosisId && !String(input.positioning || '').trim()),
1954
+ onClick: () => runGrowthSession('planner'),
1955
+ }, current.busy ? '正在开规划会话…' : '生成选题计划'),
1956
+ h('small', null, selected ? '规划会话会读取这份号脉全文,并把诊断结论落实到选题设计逻辑。' : '不使用号脉时,账号定位必填。'),
1957
+ ),
1958
+ ),
1959
+ growthResult('planner'),
1960
+ growthArchive('planner'),
1961
+ );
1962
+ };
1963
+
1964
+ const followupWorkspace = () => {
1965
+ const current = growth.followup;
1966
+ const input = current.input;
1967
+ const baseline = completedDiagReports.find((report) => report.id === input.baselineId) || null;
1968
+ const currentReport = completedDiagReports.find((report) => report.id === input.currentId) || null;
1969
+ const selector = (key, placeholder) => h('select', {
1970
+ className: 'bn-select', value: input[key] || '', onChange: (event) => growthInput('followup', key, event.target.value),
1971
+ },
1972
+ h('option', { value: '' }, placeholder),
1973
+ completedDiagReports.map((report) => h('option', { key: report.id, value: report.id }, (report.title || '未命名号脉') + ' · ' + timeAgo(report.createdAt))),
1974
+ );
1975
+ return h('div', null,
1976
+ growthHero('followup'),
1977
+ h('section', { className: 'bn-panel bn-diag-work' },
1978
+ h('div', { className: 'bn-diag-block-head' }, h('h2', null, '选择两次号脉'), h('span', null, '只对照两份报告里真实存在且口径一致的指标')),
1979
+ completedDiagReports.length < 2
1980
+ ? h('div', { className: 'bn-empty' }, '至少需要两份已回填的号脉报告。\n先完成新一轮号脉,再回来复诊。')
1981
+ : h('div', null,
1982
+ h('div', { className: 'bn-growth-form' },
1983
+ h('div', { className: 'bn-field' }, h('label', null, '基线号脉(此前)'), selector('baselineId', '选择基线号脉')),
1984
+ h('div', { className: 'bn-field' }, h('label', null, '本次号脉(最近)'), selector('currentId', '选择本次号脉')),
1985
+ ),
1986
+ h('div', { className: 'bn-growth-compare' },
1987
+ h('div', null, h('b', null, '基线'), h('span', null, baseline ? baseline.title : '尚未选择')),
1988
+ h('div', null, h('b', null, '本次'), h('span', null, currentReport ? currentReport.title : '尚未选择')),
1989
+ ),
1990
+ h('div', { className: 'bn-diag-label' }, '本次复诊重点(可选)'),
1991
+ h('textarea', {
1992
+ className: 'bn-input bn-diag-text', rows: 3, value: input.notes,
1993
+ placeholder: '例如:重点验收更新频率和中位播放,说明上一轮哪条处方该继续',
1994
+ onChange: (event) => growthInput('followup', 'notes', event.target.value),
1995
+ }),
1996
+ ),
1997
+ current.error ? h('div', { className: 'bn-chip bad', style: { marginTop: 10 } }, current.error) : null,
1998
+ h('div', { className: 'bn-diag-cta' },
1999
+ h('button', {
2000
+ className: 'bn-btn primary',
2001
+ disabled: completedDiagReports.length < 2 || !!current.busy || !input.baselineId || !input.currentId || input.baselineId === input.currentId,
2002
+ onClick: () => runGrowthSession('followup'),
2003
+ }, current.busy ? '正在开复诊会话…' : '开始复诊对比'),
2004
+ input.baselineId && input.baselineId === input.currentId ? h('small', null, '两份报告不能相同。') : h('small', null, '缺失或口径不一致的指标会明确标注,不做虚假计算。'),
2005
+ ),
2006
+ ),
2007
+ growthResult('followup'),
2008
+ growthArchive('followup'),
2009
+ );
2010
+ };
2011
+
809
2012
  return h('div', { className: 'bn-root' },
810
2013
  h('aside', { className: 'bn-rail' },
811
2014
  h('div', { className: 'bn-logo' }, h('span', { className: 'dot' }, h('img', { src: BASE + '/icons/app.svg', alt: '' })), BRAND),
812
2015
  h('nav', { className: 'bn-nav' },
813
2016
  h('button', { className: tab === 'agents' ? 'on' : '', onClick: () => setTab('agents') }, h(Icon, { name: 'grid' }), 'Agents', h('span', { className: 'count' }, String(agents.length))),
814
2017
  h('button', { className: tab === 'studio' ? 'on' : '', onClick: () => studioAgentId && setTab('studio'), disabled: !studioAgentId }, h(Icon, { name: 'external' }), 'Studio'),
2018
+ h('button', { className: tab === 'diagnose' ? 'on' : '', onClick: () => setTab('diagnose') }, h(Icon, { name: memberOn ? 'bolt' : 'lock' }), '号脉', memberOn ? null : h('span', { className: 'count' }, '会员')),
815
2019
  h('button', { className: tab === 'tasks' ? 'on' : '', onClick: () => setTab('tasks') }, h(Icon, { name: 'list' }), '任务', h('span', { className: 'count' }, String(tasks.filter((t) => t.status === 'running').length || ''))),
816
2020
  h('button', { className: tab === 'account' ? 'on' : '', onClick: () => setTab('account') }, h(Icon, { name: 'key' }), '我的授权', h('span', { className: 'count' }, String(licenses.length || ''))),
817
2021
  h('button', { className: tab === 'settings' ? 'on' : '', onClick: () => setTab('settings') }, h(Icon, { name: 'gear' }), '设置'),
@@ -827,8 +2031,8 @@
827
2031
  h('div', { className: 'bn-campaign-name' }, camp.name),
828
2032
  h('div', { className: 'bn-campaign-desc' }, camp.description || ''),
829
2033
  h('div', { className: 'bn-campaign-foot' },
830
- h('div', { className: 'bn-campaign-price' }, '¥' + camp.price),
831
- campHref ? h('a', { className: 'bn-campaign-go', href: campHref, target: '_blank', rel: 'noreferrer' }, '去看详情') : null,
2034
+ h('div', { className: 'bn-campaign-price' }, camp.kind === 'link' ? '活动' : '¥' + camp.price),
2035
+ campHref ? h('a', { className: 'bn-campaign-go', href: campHref, target: '_blank', rel: 'noreferrer' }, camp.kind === 'link' ? '去看看' : '去看详情') : null,
832
2036
  ),
833
2037
  ),
834
2038
  campaigns.length > 1 ? h('div', { className: 'bn-campaign-dots' },
@@ -847,12 +2051,10 @@
847
2051
  h('main', { className: 'bn-main' },
848
2052
  tab !== 'studio' ? h('div', { className: 'bn-head' },
849
2053
  h('div', null,
850
- h('h1', { className: 'bn-h1' }, tab === 'agents' ? 'Agents' : tab === 'tasks' ? '任务' : tab === 'account' ? '我的授权' : '设置'),
851
- h('div', { className: 'bn-sub' }, tab === 'agents' ? '从商店一键安装,授权后可完整使用' : tab === 'tasks' ? '安装与创作进度' : tab === 'account' ? '激活码与购买' : '偏好设置'),
852
- ),
853
- h('div', { className: 'bn-head-actions' },
854
- h(LicenseChip, { license: state.license }),
2054
+ h('h1', { className: 'bn-h1' }, tab === 'agents' ? '今天就出片' : tab === 'diagnose' ? (diagView === 'diagnose' ? '号脉' : growthLabels[diagView]) : tab === 'tasks' ? '任务' : tab === 'account' ? '我的授权' : '设置'),
2055
+ h('div', { className: 'bn-sub' }, tab === 'agents' ? '看一条成片,选一个 Agent。模板里已经写好提示词,改一句就能开拍。' : tab === 'diagnose' ? '年会员专属 · 号脉、对标、选题与复诊 · 素材与报告只存在本机' : tab === 'tasks' ? '安装与创作进度' : tab === 'account' ? '激活码与购买' : '偏好设置'),
855
2056
  ),
2057
+ h('div', { className: 'bn-head-actions' }, topSeg),
856
2058
  ) : null,
857
2059
 
858
2060
  state.panel && state.panel.updateAvailable && tab !== 'studio' ? h('div', { className: 'bn-banner' },
@@ -892,7 +2094,8 @@
892
2094
  : null,
893
2095
 
894
2096
  tab === 'agents' ? (
895
- store.length
2097
+ h('div', null,
2098
+ store.length
896
2099
  ? h('div', { className: 'bn-grid' }, store.map((item) => {
897
2100
  const task = tasks.find((t) =>
898
2101
  (t.agentId === item.slug || t.agentId === (item.agent && item.agent.id))
@@ -902,8 +2105,9 @@
902
2105
  : h('div', { className: 'bn-empty' },
903
2106
  h('div', { className: 'art' }, h(Icon, { name: 'grid', size: 30 })),
904
2107
  h('h3', null, '商店暂无 Agent'),
905
- h('p', null, state.storeError || '请到「设置」填写授权服务地址(如 https://dsh.biunow.cn),并确认管理后台已发布产品。'),
906
- )
2108
+ h('p', null, state.storeError || '暂时没有可安装的内容,请检查网络后再打开。'),
2109
+ ),
2110
+ )
907
2111
  ) : null,
908
2112
 
909
2113
  tab === 'studio' ? (
@@ -915,8 +2119,9 @@
915
2119
  h('div', { className: 'title' }, studioAgent.name + ' Studio'),
916
2120
  studioBlurb ? h('div', { className: 'meta', title: studioBlurb }, studioBlurb) : null,
917
2121
  ),
918
- h('div', { style: { marginLeft: 'auto', display: 'flex', gap: 8 } },
919
- h('button', { className: 'bn-btn', onClick: () => openStudio(studioAgent.id) }, h(Icon, { name: 'refresh' }), '刷新'),
2122
+ h('div', { style: { marginLeft: 'auto', display: 'flex', gap: 8, alignItems: 'center' } },
2123
+ topSeg,
2124
+ h('button', { className: 'bn-btn', onClick: () => openStudio(studioAgent.id, studioQuery) }, h(Icon, { name: 'refresh' }), '刷新'),
920
2125
  (() => {
921
2126
  const studioBusy = (state.tasks || []).some(
922
2127
  (t) => t.agentId === studioAgent.id && (t.status === 'running' || t.status === 'queued'),
@@ -930,7 +2135,30 @@
930
2135
  })(),
931
2136
  ),
932
2137
  ),
933
- h('iframe', { title: studioAgent.name, src: studioAgent.studioUrl, allow: 'clipboard-read; clipboard-write' }),
2138
+ h('iframe', {
2139
+ key: studioAgent.id + (studioQuery ? '?' + studioQuery : ''),
2140
+ title: studioAgent.name,
2141
+ src: studioAgent.studioUrl + (studioQuery ? (String(studioAgent.studioUrl).indexOf('?') >= 0 ? '&' : '?') + studioQuery : ''),
2142
+ allow: 'clipboard-read; clipboard-write; fullscreen',
2143
+ onLoad: (event) => {
2144
+ const frame = event.target;
2145
+ const seed = caseSeed;
2146
+ if (!seed || !seed.prompt || !frame.contentWindow) return;
2147
+ const send = () => {
2148
+ try {
2149
+ frame.contentWindow.postMessage({
2150
+ type: 'bn-case-prompt',
2151
+ prompt: seed.prompt,
2152
+ style: seed.style || '',
2153
+ caseId: seed.id || '',
2154
+ }, '*');
2155
+ } catch { /* Studio 还没挂上 */ }
2156
+ };
2157
+ send();
2158
+ window.setTimeout(send, 500);
2159
+ window.setTimeout(send, 1500);
2160
+ },
2161
+ }),
934
2162
  )
935
2163
  : h('div', { className: 'bn-empty' },
936
2164
  h('h3', null, '尚未打开 Studio'),
@@ -938,6 +2166,184 @@
938
2166
  )
939
2167
  ) : null,
940
2168
 
2169
+ tab === 'diagnose' ? h('div', null,
2170
+ h('div', { className: 'bn-seg bn-growth-tabs' },
2171
+ h('button', { type: 'button', className: diagView === 'diagnose' ? 'on' : '', onClick: () => setDiagView('diagnose') }, '号脉'),
2172
+ h('button', { type: 'button', className: diagView === 'research' ? 'on' : '', onClick: () => setDiagView('research') }, '对标调研'),
2173
+ h('button', { type: 'button', className: diagView === 'planner' ? 'on' : '', onClick: () => setDiagView('planner') }, '选题规划'),
2174
+ h('button', { type: 'button', className: diagView === 'followup' ? 'on' : '', onClick: () => setDiagView('followup') }, '复诊对比'),
2175
+ ),
2176
+ diagView !== 'diagnose' ? (memberOn
2177
+ ? diagView === 'research' ? researchWorkspace() : diagView === 'planner' ? plannerWorkspace() : followupWorkspace()
2178
+ : h('section', { className: 'bn-diag-upsell' },
2179
+ h('div', { style: { minWidth: 0 } },
2180
+ h('h2', null, growthLabels[diagView] + '是年会员能力'),
2181
+ h('p', null, '与号脉共用本机档案和 DSH 会话,不增加平台服务器模型成本;开通后可使用完整账号增长工作流。'),
2182
+ ),
2183
+ memberHref
2184
+ ? h('a', { className: 'bn-btn primary', href: memberHref, target: '_blank', rel: 'noreferrer' }, '开通年会员')
2185
+ : h('div', { className: 'bn-sub' }, '暂时打不开购买页,请到「我的授权」重试。'),
2186
+ )) : null,
2187
+ diagView === 'diagnose' ? h('div', null,
2188
+ h('section', { className: 'bn-diag-hero' },
2189
+ h('div', { style: { minWidth: 0 } },
2190
+ h('div', { className: 'bn-diag-kicker' }, memberOn ? '年会员 · 账号体检' : '年会员专属'),
2191
+ h('h2', null, '看清账号瓶颈,拿到 30 天改法'),
2192
+ h('p', null, '上传抖音后台截图,从真实作品数据建立基线,完成四维诊断,给出带方法论出处的优化处方和验收指标。素材与报告只存在本机。'),
2193
+ h('div', { className: 'bn-diag-values' },
2194
+ h('span', null, h('b', null, '01'), '数据基线'),
2195
+ h('span', null, h('b', null, '02'), '四维诊断'),
2196
+ h('span', null, h('b', null, '03'), '溯源处方'),
2197
+ h('span', null, h('b', null, '04'), '30 天指标'),
2198
+ ),
2199
+ ),
2200
+ h('div', { className: 'bn-diag-hero-side' },
2201
+ memberOn
2202
+ ? h('span', { className: 'bn-chip ok' }, member.daysLeft ? '剩余 ' + member.daysLeft + ' 天' : '已开通')
2203
+ : h('span', { className: 'bn-chip dim' }, '未开通'),
2204
+ ),
2205
+ ),
2206
+ memberOn
2207
+ ? h('div', null,
2208
+ h('input', {
2209
+ ref: diagFileRef,
2210
+ type: 'file',
2211
+ accept: 'image/*,video/*',
2212
+ multiple: true,
2213
+ style: { display: 'none' },
2214
+ onChange: uploadDiagFiles,
2215
+ }),
2216
+ h('section', { className: 'bn-panel bn-diag-work' },
2217
+ h('div', { className: 'bn-diag-block-head' },
2218
+ h('h2', null, '输入账号素材'),
2219
+ h('span', null, '后台截图为主,视频与补充说明可选'),
2220
+ ),
2221
+ h('div', {
2222
+ className: 'bn-drop' + (diagHot ? ' hot' : ''),
2223
+ onClick: () => { if (!diagUploading) diagFileRef.current && diagFileRef.current.click(); },
2224
+ onDragOver: (e) => { e.preventDefault(); setDiagHot(true); },
2225
+ onDragLeave: () => setDiagHot(false),
2226
+ onDrop: (e) => {
2227
+ e.preventDefault();
2228
+ setDiagHot(false);
2229
+ uploadDiagFiles(e.dataTransfer && e.dataTransfer.files);
2230
+ },
2231
+ },
2232
+ h('div', { className: 'bn-drop-ico' }, '+'),
2233
+ h('b', null, diagUploading ? '正在写入本机…' : '拖入或点击上传后台截图 / 视频'),
2234
+ h('small', null, '建议提供至少 5 条作品的标题、播放量与发布时间;视频由 DSH 模型自己抽帧'),
2235
+ ),
2236
+ diagMedia.length ? h('div', { className: 'bn-media-grid' },
2237
+ diagMedia.map((item) => h('div', { key: item.id, className: 'bn-media' },
2238
+ item.previewUrl
2239
+ ? h('img', { src: item.previewUrl, alt: '' })
2240
+ : h('div', { className: 'bn-media-ph' }, item.kind === 'video' ? '▶ 视频' : '图片'),
2241
+ h('div', { className: 'bn-media-info' },
2242
+ h('span', { className: 'bn-media-name', title: item.name }, item.name),
2243
+ h('span', { className: 'bn-media-size' }, diagSize(item.size)),
2244
+ ),
2245
+ h('button', {
2246
+ className: 'bn-media-x',
2247
+ title: '移除',
2248
+ onClick: (e) => { e.stopPropagation(); removeDiagMedia(item.id); },
2249
+ }, '×'),
2250
+ )),
2251
+ ) : null,
2252
+ h('div', { className: 'bn-diag-label' }, '补充说明(可选)'),
2253
+ h('textarea', {
2254
+ className: 'bn-input bn-diag-text',
2255
+ rows: 3,
2256
+ placeholder: '粘贴作品数据 / 文案,或说明重点想诊断什么,例如:播放量长期低于 500,问题在哪里',
2257
+ value: diagText,
2258
+ onChange: (e) => setDiagText(e.target.value),
2259
+ }),
2260
+ diagErr ? h('div', { className: 'bn-chip bad', style: { marginTop: 10 } }, diagErr) : null,
2261
+ h('div', { className: 'bn-diag-cta' },
2262
+ h('button', {
2263
+ className: 'bn-btn primary',
2264
+ disabled: !diagReady || !!diagBusy || diagUploading,
2265
+ onClick: runDiagSession,
2266
+ }, diagBusy === 'session' ? '正在开分析会话…' : '开始账号体检'),
2267
+ h('small', null, diagSession
2268
+ ? '诊断在 DSH 会话里进行,写成 report.md 后会自动回填。'
2269
+ : '会在 DSH 新开「账号体检」会话,用你自己的模型分析。'),
2270
+ diagSession ? h('button', { className: 'bn-btn ghost', onClick: openDiagSession }, '回到分析会话') : null,
2271
+ ),
2272
+ ),
2273
+ diagSession || diagAnalysis ? h('section', { className: 'bn-panel' },
2274
+ h('div', { className: 'bn-sec-head' },
2275
+ h('h2', null, '账号体检报告'),
2276
+ h('div', { className: 'bn-sec-actions' },
2277
+ h('span', { className: 'bn-diag-status ' + (diagAnalysis ? 'ok' : 'live') }, diagAnalysis ? '已回填' : '分析中'),
2278
+ ),
2279
+ ),
2280
+ h('textarea', {
2281
+ className: 'bn-input bn-diag-text',
2282
+ rows: 8,
2283
+ placeholder: '分析完成后会自动回填;模型没写文件时,也可以把结果粘贴到这里',
2284
+ value: diagAnalysis,
2285
+ onChange: (e) => setDiagAnalysis(e.target.value),
2286
+ }),
2287
+ h('div', { className: 'bn-diag-cta' },
2288
+ h('button', { className: 'bn-btn primary', disabled: !diagAnalysis.trim(), onClick: saveDiagnose }, '保存到档案'),
2289
+ diagPrompt ? h('button', { className: 'bn-btn', onClick: () => copyPrompt(diagPrompt) }, '复制提示词') : null,
2290
+ h('small', null, '报告只保存在本机,可在下方档案里随时回看。'),
2291
+ ),
2292
+ ) : null,
2293
+ h('section', { className: 'bn-panel' },
2294
+ h('div', { className: 'bn-sec-head' },
2295
+ h('h2', null, '体检档案'),
2296
+ h('div', { className: 'bn-sec-actions' },
2297
+ h('span', { className: 'bn-chip dim' }, String(diagReports.length)),
2298
+ ),
2299
+ ),
2300
+ diagReports.length
2301
+ ? h('div', { className: 'bn-archive' },
2302
+ diagReports.map((report) => h('article', {
2303
+ key: report.id,
2304
+ className: 'bn-archive-item',
2305
+ onClick: () => openDiagReport(report),
2306
+ },
2307
+ h('div', { className: 'bn-archive-top' },
2308
+ h('span', { className: 'bn-archive-kind' }, report.analysis ? '已分析' : report.sessionId ? '待回填' : '待分析'),
2309
+ h('span', { className: 'bn-archive-kind' }, timeAgo(report.createdAt)),
2310
+ ),
2311
+ h('div', { className: 'bn-archive-title' }, report.title || '未命名体检'),
2312
+ h('div', { className: 'bn-archive-meta' },
2313
+ h('span', { style: { minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } },
2314
+ [report.snapshot && report.snapshot.author, report.snapshot && diagKindLabel(report.snapshot.kind)].filter(Boolean).join(' · ') || '本机存档',
2315
+ ),
2316
+ ),
2317
+ report.analysis ? h('div', { className: 'bn-card-actions', style: { marginTop: 8, paddingTop: 8, paddingRight: 34 } },
2318
+ h('button', { className: 'bn-btn', onClick: (event) => { event.stopPropagation(); planFromDiagnosis(report); } }, '做选题'),
2319
+ h('button', { className: 'bn-btn ghost', onClick: (event) => { event.stopPropagation(); followupFromDiagnosis(report); } }, '去复诊'),
2320
+ ) : null,
2321
+ h('button', {
2322
+ className: 'bn-btn ghost bn-archive-del',
2323
+ onClick: (e) => { e.stopPropagation(); removeDiagReport(report); },
2324
+ }, '删除'),
2325
+ )),
2326
+ )
2327
+ : h('div', { className: 'bn-empty' }, '还没有体检档案。\n完成一次诊断后会存在本机,方便回看和对比。'),
2328
+ ),
2329
+ )
2330
+ : h('section', { className: 'bn-diag-upsell' },
2331
+ h('div', { style: { minWidth: 0 } },
2332
+ h('h2', null, '账号体检是年会员能力'),
2333
+ h('p', null, '从后台真实数据定位账号瓶颈,交付带出处处方和 30 天验收指标;报告存在本机,同时获得全部 Agent 的一年授权。'),
2334
+ h('ul', null,
2335
+ h('li', null, '四维定位真实瓶颈'),
2336
+ h('li', null, '处方可溯源、可执行'),
2337
+ h('li', null, '30 天指标可验收'),
2338
+ ),
2339
+ ),
2340
+ memberHref
2341
+ ? h('a', { className: 'bn-btn primary', href: memberHref, target: '_blank', rel: 'noreferrer' }, '开通年会员')
2342
+ : h('div', { className: 'bn-sub' }, '暂时打不开购买页,请到「我的授权」重试。'),
2343
+ ),
2344
+ ) : null,
2345
+ ) : null,
2346
+
941
2347
  tab === 'tasks' ? h('section', { className: 'bn-panel' },
942
2348
  h('h2', null, '最近任务'),
943
2349
  tasks.length ? tasks.slice(0, 20).map((t) => h(TaskRow, { key: t.id, task: t })) : h('div', { className: 'bn-sub' }, '暂无任务'),
@@ -990,8 +2396,10 @@
990
2396
  );
991
2397
  }),
992
2398
  )
993
- : h('div', { className: 'bn-sub' }, '尚未激活正式授权。安装后自带 1 次试用;购买后激活码会发到邮箱。'),
994
- h('div', { className: 'bn-activate' },
2399
+ : h('div', { className: 'bn-sub' }, Number(state.trialRuns) > 0
2400
+ ? '尚未激活正式授权。安装后每个 Agent 可试用 ' + state.trialRuns + ' 次;购买后激活码会发到邮箱。'
2401
+ : '尚未激活正式授权。购买后激活码会发到邮箱。'),
2402
+ h('div', { className: 'bn-activate batch' },
995
2403
  h(BnDropdown, {
996
2404
  value: productInput,
997
2405
  onChange: (v) => setProductInput(v),
@@ -1013,12 +2421,31 @@
1013
2421
  if (!opts.length) {
1014
2422
  push('biutalk', 'BiuTalk', '商店未连通时的兜底', 'icon://biutalk');
1015
2423
  push('biureel', 'BiuReel', '商店未连通时的兜底', 'icon://biureel');
2424
+ push('biuvibe', 'BiuVibe', '商店未连通时的兜底', 'icon://biuvibe');
2425
+ push('biuart', 'BiuArt', '商店未连通时的兜底', 'icon://biuart');
1016
2426
  }
1017
2427
  return opts;
1018
2428
  })(),
1019
2429
  }),
1020
- h('input', { className: 'bn-input', placeholder: '粘贴激活码 DSHP-…', value: keyInput, onChange: (e) => setKeyInput(e.target.value) }),
1021
- h('button', { className: 'bn-btn primary', disabled: busy, onClick: () => act(async () => { await api('/activate', { method: 'POST', body: { key: keyInput.trim(), product: productInput } }); setKeyInput(''); }, '已激活 ' + productInput) }, '激活'),
2430
+ h('textarea', {
2431
+ className: 'bn-input',
2432
+ rows: 3,
2433
+ placeholder: '每行一个:产品 KEY\n也可以只粘 KEY,用左侧产品激活',
2434
+ value: keyInput,
2435
+ onChange: (e) => setKeyInput(e.target.value),
2436
+ }),
2437
+ h('button', { className: 'bn-btn primary', disabled: busy || !keyInput.trim(), onClick: activateKeys }, '激活'),
2438
+ activateResult ? h('div', { className: 'bn-activate-out' },
2439
+ activateResult.ok.map((p) => h('div', { key: 'ok:' + p, className: 'row' },
2440
+ h('span', { className: 'bn-chip ok' }, '成功'),
2441
+ h('span', null, p),
2442
+ )),
2443
+ activateResult.failed.map((f) => h('div', { key: 'bad:' + f.line, className: 'row' },
2444
+ h('span', { className: 'bn-chip bad' }, '失败'),
2445
+ h('span', { className: 'bn-mono', style: { minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, f.product + ' ' + f.key),
2446
+ h('span', { className: 'bn-sub', style: { margin: 0 } }, f.error),
2447
+ )),
2448
+ ) : null,
1022
2449
  ),
1023
2450
  ),
1024
2451
  h('section', { className: 'bn-panel' },
@@ -1049,81 +2476,6 @@
1049
2476
  ) : null,
1050
2477
 
1051
2478
  tab === 'settings' ? h('div', null,
1052
- h('section', { className: 'bn-panel' },
1053
- h('h2', null, '面板版本'),
1054
- h('p', { className: 'bn-sub', style: { marginBottom: 8 } },
1055
- '当前 bnpanel v' + ((state.panel && state.panel.version) || '?')
1056
- + (state.panel && state.panel.latest
1057
- ? (state.panel.updateAvailable
1058
- ? ' · 可更新至 v' + state.panel.latest
1059
- : ' · 已是最新(npm v' + state.panel.latest + ')')
1060
- : '')
1061
- + (state.panel && state.panel.error ? ' · 检查失败:' + state.panel.error : ''),
1062
- ),
1063
- h('div', { className: 'bn-form' },
1064
- h('input', {
1065
- className: 'bn-input',
1066
- style: { flex: 1, minWidth: 220 },
1067
- placeholder: 'https://registry.npmmirror.com',
1068
- defaultValue: (state.settings && state.settings.panelNpmRegistry) || 'https://registry.npmmirror.com',
1069
- key: 'panel-reg-' + ((state.settings && state.settings.panelNpmRegistry) || ''),
1070
- id: 'bn-panel-registry',
1071
- }),
1072
- h('button', {
1073
- className: 'bn-btn',
1074
- disabled: busy,
1075
- onClick: () => act(async () => {
1076
- const el = document.getElementById('bn-panel-registry');
1077
- const url = String((el && el.value) || '').trim().replace(/\/$/, '');
1078
- if (!url) throw new Error('请填写 npm registry');
1079
- if (!/^https?:\/\//i.test(url)) throw new Error('地址需以 http:// 或 https:// 开头');
1080
- await api('/settings', { method: 'POST', body: { patch: { panelNpmRegistry: url } } });
1081
- }, '检查源已保存'),
1082
- }, '保存源'),
1083
- h('button', {
1084
- className: 'bn-btn primary',
1085
- disabled: busy,
1086
- onClick: () => act(async () => {
1087
- const res = await api('/panel/check-update', { method: 'POST' });
1088
- const p = res && res.panel;
1089
- if (!p) return '已检查';
1090
- if (p.error) throw new Error(p.error);
1091
- if (p.updateAvailable) return '发现面板 v' + p.latest + ',请到 DSH 更新 bnpanel 后重启';
1092
- return '面板已是最新 v' + (p.latest || p.current);
1093
- }),
1094
- }, h(Icon, { name: 'refresh' }), '检查面板更新'),
1095
- ),
1096
- h('p', { className: 'bn-sub', style: { marginTop: 8 } },
1097
- (state.panel && state.panel.installHint)
1098
- || '安装/更新:DSH → 添加插件 → 包名 bnpanel(建议中国大陆镜像)',
1099
- ),
1100
- ),
1101
- h('section', { className: 'bn-panel' },
1102
- h('h2', null, '授权服务'),
1103
- h('div', { className: 'bn-sub', style: { marginBottom: 8 } }, '商店与激活都连这个地址。线上请填 https://dsh.biunow.cn'),
1104
- h('div', { className: 'bn-form' },
1105
- h('input', {
1106
- className: 'bn-input',
1107
- style: { flex: 1, minWidth: 220 },
1108
- placeholder: 'https://dsh.biunow.cn',
1109
- defaultValue: state.licenseBaseUrl || '',
1110
- key: 'lic-url-' + (state.licenseBaseUrl || ''),
1111
- id: 'bn-license-url',
1112
- }),
1113
- h('button', {
1114
- className: 'bn-btn primary',
1115
- disabled: busy,
1116
- onClick: () => act(async () => {
1117
- const el = document.getElementById('bn-license-url');
1118
- const url = String((el && el.value) || '').trim().replace(/\/$/, '');
1119
- if (!url) throw new Error('请填写授权服务地址');
1120
- if (!/^https?:\/\//i.test(url)) throw new Error('地址需以 http:// 或 https:// 开头');
1121
- await api('/settings', { method: 'POST', body: { patch: { licenseBaseUrl: url } } });
1122
- }, '授权服务已保存'),
1123
- }, '保存'),
1124
- ),
1125
- h('p', { className: 'bn-sub', style: { marginTop: 8 } }, '当前:' + (state.licenseBaseUrl || '未设置')),
1126
- ),
1127
2479
  h('section', { className: 'bn-panel' },
1128
2480
  h('h2', null, '偏好'),
1129
2481
  h('label', { style: { display: 'flex', gap: 6, alignItems: 'center', marginTop: 4, fontSize: 13, color: 'var(--bn-muted)' } },
@@ -1134,9 +2486,64 @@
1134
2486
  h('input', { type: 'checkbox', checked: !(state.settings && state.settings.autoKickoffInDsh === false), onChange: (e) => act(async () => { await api('/settings', { method: 'POST', body: { patch: { autoKickoffInDsh: e.target.checked } } }); }, '已保存') }),
1135
2487
  'Studio 立项后自动进入创作(接通 DSH 对话,等同导入 Agent 丢需求)',
1136
2488
  ),
1137
- h('label', { style: { display: 'flex', gap: 6, alignItems: 'center', marginTop: 10, fontSize: 13, color: 'var(--bn-muted)' } },
1138
- h('input', { type: 'checkbox', checked: !!(state.settings && state.settings.telemetry), onChange: (e) => act(async () => { await api('/settings', { method: 'POST', body: { patch: { telemetry: e.target.checked } } }); }, '已保存') }),
1139
- '匿名安装统计(仅上报已装 Agent 与版本,不含文件内容)',
2489
+ h('div', { style: { marginTop: 14 } },
2490
+ h('div', { className: 'bn-sub', style: { fontSize: 12, marginBottom: 4 } }, '数据目录(Agent 的成片、日志、临时文件都放这里;修改后会自动重启 Agent)'),
2491
+ h('div', { style: { display: 'flex', gap: 6, alignItems: 'center' } },
2492
+ h('input', {
2493
+ type: 'text',
2494
+ id: 'bn-workspace-root-input',
2495
+ key: 'ws-root:' + (state.settings && state.settings.workspaceRoot ? state.settings.workspaceRoot : ''),
2496
+ placeholder: '留空则默认放系统目录',
2497
+ defaultValue: state.settings && state.settings.workspaceRoot ? state.settings.workspaceRoot : '',
2498
+ style: {
2499
+ flex: 1, minWidth: 0, padding: '6px 10px',
2500
+ border: '1px solid var(--bn-line, #ddd)', borderRadius: 6,
2501
+ fontSize: 13, background: '#fff', outline: 'none',
2502
+ },
2503
+ }),
2504
+ h('button', {
2505
+ type: 'button', className: 'bn-btn',
2506
+ style: { background: 'transparent', border: '1px solid var(--bn-line, #ddd)' },
2507
+ onClick: () => {
2508
+ void act(async () => {
2509
+ const r = await api('/pick-dir', { method: 'POST' });
2510
+ if (r && r.dir) {
2511
+ const el = document.getElementById('bn-workspace-root-input');
2512
+ if (el) el.value = r.dir;
2513
+ }
2514
+ }, '正在打开目录选择…');
2515
+ },
2516
+ }, '选择目录…'),
2517
+ h('button', {
2518
+ type: 'button', className: 'bn-btn',
2519
+ onClick: () => {
2520
+ const el = document.getElementById('bn-workspace-root-input');
2521
+ if (!el) return;
2522
+ const val = String(el.value || '').trim();
2523
+ void act(async () => {
2524
+ await api('/settings', { method: 'POST', body: { patch: { workspaceRoot: val || null } } });
2525
+ }, '已保存,Agent 重启中…');
2526
+ },
2527
+ }, '保存'),
2528
+ state.settings && state.settings.workspaceRoot
2529
+ ? h('button', {
2530
+ type: 'button', className: 'bn-btn',
2531
+ style: { background: 'transparent', border: '1px solid var(--bn-line, #ddd)' },
2532
+ onClick: () => {
2533
+ const el = document.getElementById('bn-workspace-root-input');
2534
+ if (el) el.value = '';
2535
+ void act(async () => {
2536
+ await api('/settings', { method: 'POST', body: { patch: { workspaceRoot: null } } });
2537
+ }, '已恢复默认');
2538
+ },
2539
+ }, '恢复默认')
2540
+ : null,
2541
+ ),
2542
+ h('p', { className: 'bn-sub', style: { marginTop: 6, fontSize: 12 } },
2543
+ state.settings && state.settings.workspaceRoot
2544
+ ? `当前生效:${state.settings.workspaceRoot}`
2545
+ : `当前生效:默认系统目录(%LOCALAPPDATA%\\DSH-PANEL\\workspaces)`,
2546
+ ),
1140
2547
  ),
1141
2548
  state.dsh ? h('p', { className: 'bn-sub', style: { marginTop: 8 } },
1142
2549
  'DSH 接通:skill ' + (state.dsh.skills ? '已就绪' : '未注入') + ' · 会话 ' + (state.dsh.chat ? '已就绪' : '未注入') +
@@ -1144,6 +2551,26 @@
1144
2551
  ? ' · 最近 ' + (state.dsh.recentKickoffs[0].ok ? '已开拍' : '开拍失败')
1145
2552
  : ''),
1146
2553
  ) : null,
2554
+ h('p', { className: 'bn-sub', style: { marginTop: 8 } }, '面板更新提示:手动卸载旧面板,再次通过 bnpanel 安装最新版本即可'),
2555
+ state.device && state.device.hash ? h('div', { style: { marginTop: 18 } },
2556
+ h('div', { className: 'bn-sub' }, '本机指纹'),
2557
+ h('div', { style: { display: 'flex', gap: 8, alignItems: 'center', marginTop: 6 } },
2558
+ h('code', { className: 'bn-mono', style: { fontSize: 12, wordBreak: 'break-all' } }, state.device.hash),
2559
+ h('button', {
2560
+ type: 'button',
2561
+ className: 'bn-btn',
2562
+ onClick: () => {
2563
+ const hash = state.device && state.device.hash;
2564
+ if (!hash) return;
2565
+ void navigator.clipboard.writeText(hash).then(
2566
+ () => setToast({ text: '设备指纹已复制' }),
2567
+ () => setToast({ text: '复制失败,请手动选择指纹', bad: true }),
2568
+ );
2569
+ },
2570
+ }, '复制'),
2571
+ ),
2572
+ ) : null,
2573
+ checkNote ? h('p', { className: 'bn-sub', style: { marginTop: 8 } }, checkNote) : null,
1147
2574
  h('div', { style: { marginTop: 16, display: 'flex', gap: 8, flexWrap: 'wrap' } },
1148
2575
  h('button', {
1149
2576
  className: 'bn-btn',
@@ -1151,17 +2578,42 @@
1151
2578
  onClick: () => act(async () => {
1152
2579
  const res = await api('/updates/check', { method: 'POST' });
1153
2580
  const p = res && res.panel;
1154
- if (p && p.updateAvailable) return 'Agent 已检查;面板可更新至 v' + p.latest;
1155
- if (p && p.error) return 'Agent 已检查;面板检查失败:' + p.error;
1156
- return 'Agent / 面板更新已检查';
2581
+ if (p && p.error) {
2582
+ setCheckNote(String(p.error));
2583
+ throw new Error(p.error);
2584
+ }
2585
+ const text = p && p.updateAvailable
2586
+ ? '发现面板 v' + p.latest + ',请手动卸载旧面板,再通过 bnpanel 安装'
2587
+ : '已检查,面板已是最新';
2588
+ setCheckNote(text);
2589
+ return text;
1157
2590
  }),
1158
2591
  }, h(Icon, { name: 'refresh' }), '检查更新'),
1159
2592
  ),
1160
- h('p', { className: 'bn-sub', style: { marginTop: 18 } }, '安装免费;每个 Agent 首次安装赠送 1 次试用生成。正式授权请到「我的授权」。'),
1161
2593
  ),
1162
2594
  ) : null,
1163
2595
  ),
1164
2596
 
2597
+ tab === 'agents' ? h('p', { className: 'bn-foot-note' },
2598
+ h('span', null, '开了新任务,到左侧聊天窗口看进度。'),
2599
+ h('span', null, '开拍前,在聊天窗口给 DSH 全部权限。'),
2600
+ h('span', null, '其他问题,点右下角客服。'),
2601
+ ) : null,
2602
+ h('button', {
2603
+ type: 'button',
2604
+ className: 'bn-cs' + (contactOpen ? ' on' : ''),
2605
+ 'aria-label': '在线客服',
2606
+ title: '在线客服',
2607
+ onClick: () => { void openContact(); },
2608
+ },
2609
+ h('svg', { width: 22, height: 22, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 1.7, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true },
2610
+ h('path', { d: 'M4 13a8 8 0 0 1 16 0' }),
2611
+ h('path', { d: 'M4 13v3a2 2 0 0 0 2 2h1.5v-7H6a2 2 0 0 0-2 2z' }),
2612
+ h('path', { d: 'M20 13v3a2 2 0 0 1-2 2h-1.5v-7H18a2 2 0 0 1 2 2z' }),
2613
+ h('path', { d: 'M12 20h2.5a2 2 0 0 0 2-2' }),
2614
+ ),
2615
+ ),
2616
+
1165
2617
  contactOpen ? h('div', { className: 'bn-modal-back', onClick: (e) => { if (e.target === e.currentTarget) setContactOpen(false); } },
1166
2618
  h('div', { className: 'bn-modal bn-contact', role: 'dialog', 'aria-modal': 'true', 'aria-labelledby': 'bn-contact-title' },
1167
2619
  h('div', { className: 'bn-contact-head' },
@@ -1238,6 +2690,172 @@
1238
2690
  ),
1239
2691
  ) : null,
1240
2692
 
2693
+ docsOpen && doc ? h('div', { className: 'bn-docs-back bn-layer', popover: 'manual', onClick: () => setDocsOpen(false) },
2694
+ h('aside', { className: 'bn-docs', onClick: (event) => event.stopPropagation() },
2695
+ h('div', { className: 'bn-docs-bar' },
2696
+ h('strong', null, doc.title),
2697
+ h('a', { className: 'bn-btn', href: doc.url, target: '_blank', rel: 'noreferrer' }, docOpenLabel(doc.url)),
2698
+ h('button', { type: 'button', className: 'bn-btn ghost', onClick: () => setDocsOpen(false) }, '关闭'),
2699
+ ),
2700
+ docs.length > 1 ? h('div', { className: 'bn-docs-tabs' },
2701
+ docs.map((item) => h('button', {
2702
+ key: item.id,
2703
+ type: 'button',
2704
+ className: item.id === doc.id ? 'on' : '',
2705
+ onClick: () => { setDocId(item.id); setDocBlocked(false); },
2706
+ }, item.title)),
2707
+ ) : null,
2708
+ h('div', { className: 'bn-docs-frame' },
2709
+ h('iframe', {
2710
+ key: doc.id,
2711
+ title: doc.title,
2712
+ src: doc.url,
2713
+ onLoad: (event) => {
2714
+ const frame = event.target;
2715
+ window.setTimeout(() => {
2716
+ if (!frame.isConnected) return;
2717
+ try {
2718
+ const href = frame.contentWindow && frame.contentWindow.location && frame.contentWindow.location.href;
2719
+ setDocBlocked(!href || href === 'about:blank');
2720
+ } catch {
2721
+ setDocBlocked(false);
2722
+ }
2723
+ }, 700);
2724
+ },
2725
+ }),
2726
+ docBlocked ? h('div', { className: 'bn-docs-miss' },
2727
+ h('p', null, '这篇文档不允许嵌在面板里。'),
2728
+ h('a', { className: 'bn-btn', href: doc.url, target: '_blank', rel: 'noreferrer' }, docOpenLabel(doc.url)),
2729
+ ) : null,
2730
+ ),
2731
+ ),
2732
+ ) : null,
2733
+
2734
+ marketOpen ? (() => {
2735
+ const rows = caseRows();
2736
+ const slugs = [];
2737
+ AGENT_ORDER.forEach((slug) => { if (rows.some((row) => row.agent === slug)) slugs.push(slug); });
2738
+ rows.forEach((row) => { if (row.agent && slugs.indexOf(row.agent) < 0) slugs.push(row.agent); });
2739
+ const visible = marketFilter === 'all' ? rows : rows.filter((row) => row.agent === marketFilter);
2740
+ return h('div', { className: 'bn-market-back bn-layer', popover: 'manual', onClick: (event) => { if (event.target === event.currentTarget) closeMarket(); } },
2741
+ h('div', { className: 'bn-market', role: 'dialog', 'aria-modal': 'true', 'aria-label': '案例' },
2742
+ h('div', { className: 'bn-market-head' },
2743
+ h('div', { className: 'bn-market-kicker' }, rows.length + ' 条成片'),
2744
+ h('h2', null, '看成品,拿提示词去拍'),
2745
+ h('p', null, '公开的可以直接复制或做同款。标了专享的,要先激活对应的 Agent。'),
2746
+ h('button', { type: 'button', className: 'bn-market-x', onClick: closeMarket, 'aria-label': '关闭' }, '×'),
2747
+ h('div', { className: 'bn-market-filters' },
2748
+ h('button', { type: 'button', className: marketFilter === 'all' ? 'on' : '', 'aria-pressed': marketFilter === 'all', onClick: () => setMarketFilter('all') }, '全部'),
2749
+ slugs.map((slug) => h('button', {
2750
+ key: slug,
2751
+ type: 'button',
2752
+ className: marketFilter === slug ? 'on' : '',
2753
+ 'aria-pressed': marketFilter === slug,
2754
+ onClick: () => setMarketFilter(slug),
2755
+ }, agentName(slug))),
2756
+ ),
2757
+ ),
2758
+ h('div', { className: 'bn-market-body' },
2759
+ visible.length
2760
+ ? h('div', { className: 'bn-market-grid' }, visible.map((item) => h('button', {
2761
+ key: item.id,
2762
+ type: 'button',
2763
+ className: 'bn-case',
2764
+ onClick: () => openPlayer(item),
2765
+ },
2766
+ h('div', { className: 'bn-case-cover' },
2767
+ item.coverUrl
2768
+ ? h('img', { src: item.coverUrl, alt: '' })
2769
+ : h('div', { className: 'bn-case-fallback' }, agentName(item.agent)),
2770
+ item.access === 'licensed' ? h('span', { className: 'bn-case-lock' }, '专享') : null,
2771
+ h('span', { className: 'bn-case-play', 'aria-hidden': true },
2772
+ h('svg', { width: 12, height: 12, viewBox: '0 0 24 24' }, h('path', { d: 'M8 5v14l11-7z', fill: 'currentColor' })),
2773
+ ),
2774
+ ),
2775
+ h('div', { className: 'bn-case-body' },
2776
+ h('div', { className: 'bn-case-title' }, item.title),
2777
+ h('div', { className: 'bn-case-blurb' }, item.blurb || (item.access === 'licensed' ? '激活后可查看提示词,并一键做同款。' : '看完这条,就可以按同样的提示词再拍一条。')),
2778
+ h('div', { className: 'bn-case-meta' },
2779
+ item.agent ? h('span', null, agentName(item.agent)) : null,
2780
+ item.style ? h('span', null, item.style) : null,
2781
+ ),
2782
+ ),
2783
+ )))
2784
+ : h('div', { className: 'bn-empty' },
2785
+ h('h3', null, '这个 Agent 还没有案例'),
2786
+ h('p', null, '换一个筛选,或者等新的成片上架。'),
2787
+ ),
2788
+ ),
2789
+ ),
2790
+ );
2791
+ })() : null,
2792
+
2793
+ player ? (() => {
2794
+ const rows = playerRows();
2795
+ const at = Math.max(0, rows.findIndex((row) => row.id === player.id));
2796
+ const many = rows.length > 1;
2797
+ const licensed = player.access === 'licensed';
2798
+ const owned = holdsProduct(player.agent);
2799
+ const known = Object.prototype.hasOwnProperty.call(unlocked, player.id);
2800
+ const text = licensed ? (known ? unlocked[player.id] : '') : (player.prompt || '');
2801
+ const waiting = promptsOn && licensed && owned && !known && !promptError[player.id];
2802
+ const failed = promptsOn && licensed && owned && promptError[player.id];
2803
+ const locked = promptsOn && licensed && !owned;
2804
+ const shoot = player.agent
2805
+ ? h('button', { type: 'button', className: 'bn-btn play', onClick: () => { void shootLike(player); } }, locked ? '去激活' : '用同款开拍')
2806
+ : null;
2807
+ return h('div', { className: 'bn-player-back bn-layer', popover: 'manual', onClick: (event) => { if (event.target === event.currentTarget) closePlayer(); } },
2808
+ h('div', { id: 'bn-player', className: 'bn-player' + (promptsOn ? ' has-script' : ''), style: { '--ar': String(playerRatio) }, role: 'dialog', 'aria-label': player.title },
2809
+ h('video', {
2810
+ key: player.id,
2811
+ id: 'bn-player-video',
2812
+ src: player.videoUrl,
2813
+ poster: player.coverUrl || undefined,
2814
+ controls: true,
2815
+ autoPlay: true,
2816
+ playsInline: true,
2817
+ onLoadedMetadata: (event) => {
2818
+ const node = event.target;
2819
+ if (node.videoWidth && node.videoHeight) setPlayerRatio(node.videoWidth / node.videoHeight);
2820
+ },
2821
+ }),
2822
+ promptsOn ? h('div', { className: 'bn-player-dock' },
2823
+ h('div', { className: 'bn-player-top' },
2824
+ h('strong', null, player.title),
2825
+ many ? h('span', { className: 'bn-player-count' }, (at + 1) + ' / ' + rows.length) : null,
2826
+ h('button', { type: 'button', className: 'bn-btn ghost', onClick: closePlayer }, '关闭'),
2827
+ ),
2828
+ locked
2829
+ ? h('p', { className: 'bn-player-quote lock' }, '激活 ' + agentName(player.agent) + ' 后可查看提示词并做同款')
2830
+ : h('p', { className: 'bn-player-quote' + (text ? '' : ' quiet') },
2831
+ waiting ? '正在打开这条提示词…'
2832
+ : failed ? promptError[player.id]
2833
+ : text || '这条还没有提示词。做同款会按它的风格模板开拍。'),
2834
+ h('div', { className: 'bn-player-foot' },
2835
+ many ? h('div', { className: 'bn-player-nav' },
2836
+ h('button', { type: 'button', className: 'bn-btn', onClick: () => movePlayer(-1) }, '上一条'),
2837
+ h('button', { type: 'button', className: 'bn-btn', onClick: () => movePlayer(1) }, '下一条'),
2838
+ ) : null,
2839
+ h('div', { className: 'bn-player-actions' },
2840
+ text ? h('button', { type: 'button', className: 'bn-btn', onClick: () => { void copyPrompt(text); } }, '复制') : null,
2841
+ failed ? h('button', { type: 'button', className: 'bn-btn', onClick: () => { setPromptError((cur) => { const next = { ...cur }; delete next[player.id]; return next; }); primePrompt(player); } }, '重试') : null,
2842
+ locked
2843
+ ? h('button', { type: 'button', className: 'bn-btn play', onClick: () => goActivate(player.agent) }, '去激活')
2844
+ : shoot,
2845
+ ),
2846
+ ),
2847
+ ) : h('div', { className: 'bn-player-bar' },
2848
+ many ? h('button', { type: 'button', className: 'bn-btn', onClick: () => movePlayer(-1) }, '上一条') : null,
2849
+ h('span', { className: 'bn-player-count' }, '案例' + (many ? ' ' + (at + 1) + ' / ' + rows.length : '')),
2850
+ h('strong', null, player.title),
2851
+ shoot,
2852
+ many ? h('button', { type: 'button', className: 'bn-btn', onClick: () => movePlayer(1) }, '下一条') : null,
2853
+ h('button', { type: 'button', className: 'bn-btn ghost', onClick: closePlayer }, '关闭'),
2854
+ ),
2855
+ ),
2856
+ );
2857
+ })() : null,
2858
+
1241
2859
  toast ? h('div', { className: 'bn-toast' + (toast.bad ? ' bad' : '') }, toast.text) : null,
1242
2860
  );
1243
2861
  }