@v587d/capital-generation 2.6.5 → 2.7.1
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/CHANGELOG.md +92 -0
- package/LICENSE +1 -1
- package/README.md +83 -30
- package/THIRD_PARTY_NOTICES.md +51 -0
- package/capital-config/client.js +58 -2
- package/capital-config/client.src.cjs +482 -27
- package/capital-config/index.js +177 -4
- package/capital-config/package.json +1 -1
- package/capital-watchlist/client.js +48 -7
- package/capital-watchlist/client.src.cjs +383 -66
- package/capital-watchlist/holding-rules.js +64 -0
- package/capital-watchlist/index.js +117 -2
- package/capital-watchlist/package.json +2 -1
- package/chart-ui/package.json +1 -1
- package/lib/agents/selected-skills-provider.d.ts +26 -0
- package/lib/agents/selected-skills-provider.js +99 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.js +35 -11
- package/lib/time/tools.d.ts +6 -0
- package/lib/time/tools.js +6 -1
- package/lib/watchlist/tools.d.ts +52 -0
- package/lib/watchlist/tools.js +146 -0
- package/lib/web-retriever/local-fetch.d.ts +1 -1
- package/lib/web-retriever/local-fetch.js +1 -1
- package/lib/web-retriever/wind-client.d.ts +1 -1
- package/lib/web-retriever/wind-client.js +1 -1
- package/package.json +13 -3
- package/preset/capital-generation/agent.patch.yml +7 -0
- package/preset/capital-generation/skills/capital-equity-research/SKILL.md +45 -0
- package/preset/capital-generation/skills/capital-event-impact/SKILL.md +29 -0
- package/preset/capital-generation/skills/capital-portfolio-review/SKILL.md +29 -0
- package/selected-skills/InvestSkill/ADDING-NEW-SKILLS.md +546 -0
- package/selected-skills/InvestSkill/CHANGELOG.md +373 -0
- package/selected-skills/InvestSkill/CI-CD-GUIDE.md +432 -0
- package/selected-skills/InvestSkill/CLAUDE.md +148 -0
- package/selected-skills/InvestSkill/CONTRIBUTING.md +291 -0
- package/selected-skills/InvestSkill/DEPLOYMENTS.md +321 -0
- package/selected-skills/InvestSkill/FAQ.md +509 -0
- package/selected-skills/InvestSkill/GEMINI.md +419 -0
- package/selected-skills/InvestSkill/LICENSE +21 -0
- package/selected-skills/InvestSkill/PLATFORM-COMPATIBILITY.md +529 -0
- package/selected-skills/InvestSkill/README-claude-code.md +435 -0
- package/selected-skills/InvestSkill/README-cursor.md +475 -0
- package/selected-skills/InvestSkill/README-gemini.md +532 -0
- package/selected-skills/InvestSkill/README-ollama.md +106 -0
- package/selected-skills/InvestSkill/README-zh-TW.md +461 -0
- package/selected-skills/InvestSkill/README.md +311 -0
- package/selected-skills/InvestSkill/RELEASE-QUICK-REFERENCE.md +230 -0
- package/selected-skills/InvestSkill/RELEASE_NOTES.md +121 -0
- package/selected-skills/InvestSkill/SECURITY.md +232 -0
- package/selected-skills/InvestSkill/TODO.md +28 -0
- package/selected-skills/InvestSkill/UPSTREAM.md +62 -0
- package/selected-skills/InvestSkill/install.sh +212 -0
- package/selected-skills/InvestSkill/package.json +64 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/README.md +119 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/10k-digest/SKILL.md +338 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/bear-case/SKILL.md +233 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/catalyst-calendar/SKILL.md +327 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/chart-master/SKILL.md +648 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/competitor-analysis/SKILL.md +478 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/dcf-valuation/SKILL.md +109 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/dividend-analysis/SKILL.md +684 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/earnings-call-analysis/SKILL.md +456 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/earnings-preview/SKILL.md +277 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/economics-analysis/SKILL.md +349 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/etf-analysis/SKILL.md +279 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/fact-check/SKILL.md +288 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/financial-report-analyst/SKILL.md +544 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/full-report/SKILL.md +301 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/fundamental-analysis/SKILL.md +67 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/industry-map/SKILL.md +336 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/insider-trading/SKILL.md +502 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/institutional-ownership/SKILL.md +548 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/learning-coach/SKILL.md +311 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/options-analysis/SKILL.md +495 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/portfolio-review/SKILL.md +465 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/position-ladder/SKILL.md +429 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/report-generator/SKILL.md +857 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/research-bundle/SKILL.md +94 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/result-validator/SKILL.md +174 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/risk-stress-test/SKILL.md +293 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/sector-analysis/SKILL.md +426 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/short-interest/SKILL.md +397 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/stock-eval/SKILL.md +645 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/stock-screener/SKILL.md +244 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/stock-valuation/SKILL.md +640 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/tax-lens/SKILL.md +351 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/technical-analysis/SKILL.md +654 -0
- package/selected-skills/InvestSkill/plugins/us-stock-analysis/skills/thesis-tracker/SKILL.md +317 -0
- package/selected-skills/README.md +54 -0
- package/selected-skills/catalog.js +733 -0
- package/selected-skills/china-stock-research-skills/.github/ISSUE_TEMPLATE/bug_report.md +35 -0
- package/selected-skills/china-stock-research-skills/.github/ISSUE_TEMPLATE/skill_request.md +28 -0
- package/selected-skills/china-stock-research-skills/.github/PULL_REQUEST_TEMPLATE.md +15 -0
- package/selected-skills/china-stock-research-skills/CHANGELOG.md +59 -0
- package/selected-skills/china-stock-research-skills/CONTRIBUTING.md +121 -0
- package/selected-skills/china-stock-research-skills/GITHUB_PUBLISHING.md +259 -0
- package/selected-skills/china-stock-research-skills/INSTALL.md +151 -0
- package/selected-skills/china-stock-research-skills/LICENSE +21 -0
- package/selected-skills/china-stock-research-skills/PUBLISH_CHECKLIST.md +165 -0
- package/selected-skills/china-stock-research-skills/README.en.md +209 -0
- package/selected-skills/china-stock-research-skills/README.md +209 -0
- package/selected-skills/china-stock-research-skills/RELEASE_ASSETS.md +222 -0
- package/selected-skills/china-stock-research-skills/ROADMAP.md +45 -0
- package/selected-skills/china-stock-research-skills/SKILLS.md +85 -0
- package/selected-skills/china-stock-research-skills/UPSTREAM.md +11 -0
- package/selected-skills/china-stock-research-skills/examples/full-report-flow.md +20 -0
- package/selected-skills/china-stock-research-skills/examples/module-select-cases.md +26 -0
- package/selected-skills/china-stock-research-skills/examples/quickstart-prompts.md +25 -0
- package/selected-skills/china-stock-research-skills/skills/business-decomposition-order-quality/SKILL.md +55 -0
- package/selected-skills/china-stock-research-skills/skills/business-decomposition-order-quality/references/idc-order-ledger-guide.md +34 -0
- package/selected-skills/china-stock-research-skills/skills/business-decomposition-order-quality/references/order-quality-checklist.md +16 -0
- package/selected-skills/china-stock-research-skills/skills/china-stock-research-orchestrator/SKILL.md +75 -0
- package/selected-skills/china-stock-research-skills/skills/china-stock-research-orchestrator/references/final-output-contract.md +62 -0
- package/selected-skills/china-stock-research-skills/skills/china-stock-research-orchestrator/references/routing-matrix.md +34 -0
- package/selected-skills/china-stock-research-skills/skills/china-stock-research-orchestrator/references/sector-overlay-escalation-rules.md +38 -0
- package/selected-skills/china-stock-research-skills/skills/financial-health/SKILL.md +54 -0
- package/selected-skills/china-stock-research-skills/skills/financial-health/references/idc-balance-sheet-stress-guide.md +31 -0
- package/selected-skills/china-stock-research-skills/skills/financial-health/references/red-flag-checklist.md +14 -0
- package/selected-skills/china-stock-research-skills/skills/industry-competition-moat/SKILL.md +54 -0
- package/selected-skills/china-stock-research-skills/skills/industry-competition-moat/references/idc-value-chain-and-peers.md +42 -0
- package/selected-skills/china-stock-research-skills/skills/industry-competition-moat/references/moat-grid.md +13 -0
- package/selected-skills/china-stock-research-skills/skills/risk-warning-catalysts/SKILL.md +54 -0
- package/selected-skills/china-stock-research-skills/skills/risk-warning-catalysts/references/idc-monitoring-indicators.md +33 -0
- package/selected-skills/china-stock-research-skills/skills/risk-warning-catalysts/references/monitoring-dashboard.md +25 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/analysis-pattern-selector.md +24 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/asset-heavy-ramp-overlay.md +28 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/business-model-transition-overlay.md +28 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/citation-standard.md +48 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/company-disclosure-map.md +37 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/consumer-channel-brand-overlay.md +29 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/cyclical-price-driven-overlay.md +29 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/export-manufacturing-supply-chain-overlay.md +29 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/financial-kpi-dictionary.md +43 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/idc-heavy-asset-transition-overlay.md +73 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/language-output-standard.md +36 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/project-order-business-overlay.md +28 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/regulated-healthcare-policy-overlay.md +29 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/research-output-template.md +50 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/sector-adaptation-checklist.md +42 -0
- package/selected-skills/china-stock-research-skills/skills/shared/references/source-registry.md +49 -0
- package/selected-skills/china-stock-research-skills/skills/shared/templates/catalyst-calendar.md +5 -0
- package/selected-skills/china-stock-research-skills/skills/shared/templates/company-fact-sheet.md +25 -0
- package/selected-skills/china-stock-research-skills/skills/shared/templates/evidence-table.md +5 -0
- package/selected-skills/china-stock-research-skills/skills/shared/templates/idc-project-ledger.md +5 -0
- package/selected-skills/china-stock-research-skills/skills/shared/templates/valuation-scenario-table.md +7 -0
- package/selected-skills/china-stock-research-skills/skills/strategy-business-transition/SKILL.md +55 -0
- package/selected-skills/china-stock-research-skills/skills/strategy-business-transition/references/idc-transition-markers.md +27 -0
- package/selected-skills/china-stock-research-skills/skills/strategy-business-transition/references/transition-scorecard.md +13 -0
- package/selected-skills/china-stock-research-skills/skills/valuation-investment-strategy/SKILL.md +55 -0
- package/selected-skills/china-stock-research-skills/skills/valuation-investment-strategy/references/idc-valuation-overlays.md +31 -0
- package/selected-skills/china-stock-research-skills/skills/valuation-investment-strategy/references/method-selection.md +14 -0
- package/selected-skills/investment-skills/.github/workflows/validate.yml +25 -0
- package/selected-skills/investment-skills/.tbd/config.yml +107 -0
- package/selected-skills/investment-skills/LICENSE +21 -0
- package/selected-skills/investment-skills/Makefile +29 -0
- package/selected-skills/investment-skills/README.md +253 -0
- package/selected-skills/investment-skills/UPSTREAM.md +12 -0
- package/selected-skills/investment-skills/docs/development.md +37 -0
- package/selected-skills/investment-skills/docs/roadmap.md +25 -0
- package/selected-skills/investment-skills/skills/buffett-investment-framework/SKILL.md +192 -0
- package/selected-skills/investment-skills/skills/buffett-investment-framework/agents/openai.yaml +4 -0
- package/selected-skills/investment-skills/skills/buffett-investment-framework/references/00-source-key.md +82 -0
- package/selected-skills/investment-skills/skills/buffett-investment-framework/references/01-decision-posture.md +242 -0
- package/selected-skills/investment-skills/skills/buffett-investment-framework/references/02-business-economics.md +188 -0
- package/selected-skills/investment-skills/skills/buffett-investment-framework/references/03-management-governance.md +213 -0
- package/selected-skills/investment-skills/skills/buffett-investment-framework/references/04-financial-reality.md +192 -0
- package/selected-skills/investment-skills/skills/buffett-investment-framework/references/05-valuation.md +166 -0
- package/selected-skills/investment-skills/skills/buffett-investment-framework/references/06-capital-allocation.md +238 -0
- package/selected-skills/investment-skills/skills/buffett-investment-framework/references/07-risk-monitoring.md +189 -0
- package/selected-skills/investment-skills/skills/buffett-investment-framework/references/08-specialized-overlays.md +309 -0
- package/selected-skills/investment-skills/skills/buffett-investment-framework/scripts/framework.py +470 -0
package/capital-config/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import z from '@deepseek-ai/schemastery'
|
|
2
|
+
import { SELECTED_SKILL_CATALOG, SELECTED_SKILL_SKILL_DIRS } from '../selected-skills/catalog.js'
|
|
2
3
|
|
|
3
4
|
export const name = 'capital-config'
|
|
4
5
|
|
|
@@ -81,8 +82,17 @@ const PaddleOcrSchema = z.object({
|
|
|
81
82
|
pollBudgetMs: z.number().default(PADDLE_OCR_DEFAULTS.pollBudgetMs).volatile().description('ocr 内部等作业的预算毫秒,0 = 默认 200000'),
|
|
82
83
|
})
|
|
83
84
|
|
|
85
|
+
const SelectedSkillsShape = Object.fromEntries(SELECTED_SKILL_CATALOG.map((entry) => [
|
|
86
|
+
entry.key,
|
|
87
|
+
z.boolean().default(false).volatile().description(`Enable ${entry.name} for the Capital root Agent (experimental; default off)`),
|
|
88
|
+
]))
|
|
89
|
+
const SelectedSkillsSchema = z.object(SelectedSkillsShape)
|
|
90
|
+
|
|
91
|
+
const SELECTED_SKILL_DEFAULTS = Object.fromEntries(SELECTED_SKILL_CATALOG.map((entry) => [entry.key, false]))
|
|
92
|
+
|
|
84
93
|
export const Config = z.object({
|
|
85
94
|
customPersona: z.string().default('').volatile().description('Capital 模式附加人设文本'),
|
|
95
|
+
selectedSkills: SelectedSkillsSchema.default(SELECTED_SKILL_DEFAULTS).description('Explicitly selected community experiments; default off and visible only to the Capital root Agent'),
|
|
86
96
|
fuyaoCredentialRef: z.string().default('FUYAO_API_KEY').volatile().description('Fuyao credentials 引用名'),
|
|
87
97
|
retriever: z.object({
|
|
88
98
|
baseURL: z.string().default('').volatile().description('AnySearch API 地址'),
|
|
@@ -104,10 +114,173 @@ export const Config = z.object({
|
|
|
104
114
|
})
|
|
105
115
|
|
|
106
116
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
117
|
+
* 「精选 Skills」那一格的**原文旁路**:卡片上的「详情」悬浮要显示 `SKILL.md` 原文,
|
|
118
|
+
* 而原文是随包携带的快照文件(35 份共 ~750 KB)。
|
|
119
|
+
*
|
|
120
|
+
* 为什么走一条本机路由,而不是把原文打进客户端 bundle:客户端 bundle 在页面加载那一刻
|
|
121
|
+
* 整体送达浏览器(`window.__ModuleLoader__.load` 是单文件 IIFE,没有按需分片),750 KB 会
|
|
122
|
+
* 让每一次打开插件页都付一遍——包括从不点「详情」的那次。旁路只在悬停时取一份,且取的是
|
|
123
|
+
* **磁盘上当前那份**,不是构建期抄的副本:抄来的原文会随快照更新而变旧,而这块 UI 说的
|
|
124
|
+
* 是"这就是原文"(控件对自己的状态说谎 = 事故)。
|
|
125
|
+
*
|
|
126
|
+
* 闭集:路径按 `SELECTED_SKILL_CATALOG` × `SELECTED_SKILL_SKILL_DIRS` 在模块加载时现算成
|
|
127
|
+
* `Map<skill 名, file: URL>`,请求里的名字**只做这张表的键**,不参与任何路径拼接——
|
|
128
|
+
* `%2F..%2F` 之类一律落在"表里没有这个名字"那一侧(404)。路径用 `URL` 表示:`fs` 直接收
|
|
129
|
+
* `file:` URL,省掉一次 `fileURLToPath`(也就省掉在 import 期依赖 node 内置模块)。
|
|
130
|
+
*
|
|
131
|
+
* ⛔ 认证围栏与 `/capital-charts`、`/capital-watchlist` 同一写法(`connection.requestRejection`,
|
|
132
|
+
* docs/dev/chart-presentation.md §6.1):`webServer.register({ kind: 'prefix' })` 本身不做任何认证。
|
|
133
|
+
*/
|
|
134
|
+
export const SKILL_DOC_ROUTE = '/capital-skills'
|
|
135
|
+
/** 单份原文的字节上限:超限**整份拒绝、绝不截断**("原文"被切一半比没有原文更误导人)。 */
|
|
136
|
+
export const MAX_SKILL_DOC_BYTES = 128 * 1024
|
|
137
|
+
|
|
138
|
+
const SKILL_DOC_SUFFIX = 'SKILL.md'
|
|
139
|
+
|
|
140
|
+
/** catalog 里的顺序 = 卡片上的顺序,所以这里只多算一份"名字 → 快照文件"的索引。 */
|
|
141
|
+
export const SKILL_DOCS = new Map(SELECTED_SKILL_CATALOG.map((entry) => [
|
|
142
|
+
entry.name,
|
|
143
|
+
new URL(`../selected-skills/${entry.repository}/${SELECTED_SKILL_SKILL_DIRS[entry.repository]}/${entry.name}/${SKILL_DOC_SUFFIX}`, import.meta.url),
|
|
144
|
+
]))
|
|
145
|
+
|
|
146
|
+
function fsModule() {
|
|
147
|
+
const processLike = globalThis.process
|
|
148
|
+
const fs = processLike?.getBuiltinModule?.('node:fs')
|
|
149
|
+
if (!fs || typeof fs.readFileSync !== 'function') throw new Error('capital-config: Node fs is unavailable')
|
|
150
|
+
return fs
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function sendJson(res, status, payload) {
|
|
154
|
+
res.statusCode = status
|
|
155
|
+
res.setHeader('content-type', 'application/json; charset=utf-8')
|
|
156
|
+
res.setHeader('cache-control', 'no-store')
|
|
157
|
+
res.setHeader('x-content-type-options', 'nosniff')
|
|
158
|
+
res.end(JSON.stringify(payload))
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @param options.readFile - `(url) => string | Buffer`,用例注入假读盘。
|
|
163
|
+
* @param options.authorize - `(req) => 401 | 403 | undefined`;非空即拒,**且一次都不碰文件系统**。
|
|
164
|
+
*/
|
|
165
|
+
export function createSkillDocHandler(options = {}) {
|
|
166
|
+
const readFile = options.readFile ?? ((target) => fsModule().readFileSync(target, 'utf8'))
|
|
167
|
+
const statSize = options.statSize ?? ((target) => fsModule().statSync(target).size)
|
|
168
|
+
const authorize = options.authorize
|
|
169
|
+
return async function handler(req, res) {
|
|
170
|
+
if (typeof authorize === 'function') {
|
|
171
|
+
let rejection
|
|
172
|
+
try {
|
|
173
|
+
rejection = authorize(req)
|
|
174
|
+
} catch {
|
|
175
|
+
// 围栏自己答不上来时必须 fail closed:放行就等于"认证失败 = 不认证"。
|
|
176
|
+
rejection = 401
|
|
177
|
+
}
|
|
178
|
+
if (rejection !== undefined && rejection !== null) {
|
|
179
|
+
res.statusCode = rejection
|
|
180
|
+
res.setHeader('content-type', 'text/plain; charset=utf-8')
|
|
181
|
+
res.setHeader('cache-control', 'no-store')
|
|
182
|
+
res.end(rejection === 401 ? 'unauthorized' : 'forbidden')
|
|
183
|
+
return
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (req?.method !== 'GET') {
|
|
187
|
+
sendJson(res, 405, { error: 'method_not_allowed' })
|
|
188
|
+
return
|
|
189
|
+
}
|
|
190
|
+
let pathname
|
|
191
|
+
try {
|
|
192
|
+
pathname = new URL(req.url ?? '/', 'http://localhost').pathname
|
|
193
|
+
} catch {
|
|
194
|
+
sendJson(res, 400, { error: 'bad_request' })
|
|
195
|
+
return
|
|
196
|
+
}
|
|
197
|
+
if (!pathname.startsWith(`${SKILL_DOC_ROUTE}/`)) {
|
|
198
|
+
sendJson(res, 404, { error: 'not_found' })
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
const match = /^([^/]+)\.md$/.exec(pathname.slice(`${SKILL_DOC_ROUTE}/`.length))
|
|
202
|
+
if (!match) {
|
|
203
|
+
sendJson(res, 404, { error: 'not_found' })
|
|
204
|
+
return
|
|
205
|
+
}
|
|
206
|
+
let name
|
|
207
|
+
try {
|
|
208
|
+
name = decodeURIComponent(match[1])
|
|
209
|
+
} catch {
|
|
210
|
+
sendJson(res, 400, { error: 'bad_request' })
|
|
211
|
+
return
|
|
212
|
+
}
|
|
213
|
+
const target = SKILL_DOCS.get(name)
|
|
214
|
+
if (target === undefined) {
|
|
215
|
+
sendJson(res, 404, { error: 'skill_not_catalogued', name })
|
|
216
|
+
return
|
|
217
|
+
}
|
|
218
|
+
let bytes
|
|
219
|
+
try {
|
|
220
|
+
bytes = statSize(target)
|
|
221
|
+
} catch {
|
|
222
|
+
// 快照没随包落地(装到一半 / files 清单漏了):说清楚"读不到",别回一份空原文当好结果。
|
|
223
|
+
sendJson(res, 404, { error: 'skill_doc_unreadable', name })
|
|
224
|
+
return
|
|
225
|
+
}
|
|
226
|
+
if (bytes > MAX_SKILL_DOC_BYTES) {
|
|
227
|
+
sendJson(res, 413, { error: 'skill_doc_too_large', name, limit: MAX_SKILL_DOC_BYTES })
|
|
228
|
+
return
|
|
229
|
+
}
|
|
230
|
+
let body
|
|
231
|
+
try {
|
|
232
|
+
body = readFile(target)
|
|
233
|
+
} catch {
|
|
234
|
+
sendJson(res, 404, { error: 'skill_doc_unreadable', name })
|
|
235
|
+
return
|
|
236
|
+
}
|
|
237
|
+
res.statusCode = 200
|
|
238
|
+
res.setHeader('content-type', 'text/plain; charset=utf-8')
|
|
239
|
+
res.setHeader('cache-control', 'no-store')
|
|
240
|
+
res.setHeader('x-content-type-options', 'nosniff')
|
|
241
|
+
res.end(typeof body === 'string' ? body : Buffer.from(body))
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* 卡片那侧拼 URL 的唯一口径(文件名里带 `.` 的 slug 也要能拼,所以走 encodeURIComponent)。
|
|
247
|
+
* 客户端 bundle 与这里是**同一条字符串**的两端:漂移的表现为"详情永远读不到",由
|
|
248
|
+
* `test/capital-config.test.mjs` 的同字断言钉住(客户端不能 import 本模块 ⇒ 只能对着产物量)。
|
|
249
|
+
*/
|
|
250
|
+
export function skillDocUrl(name) {
|
|
251
|
+
return `${SKILL_DOC_ROUTE}/${encodeURIComponent(name)}.md`
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* 本行消费两件事:自己的配置(schema 事实,见上)与快照原文的读盘旁路。
|
|
256
|
+
*
|
|
257
|
+
* `webServer` 只走 `inject`——`ctx.get('webServer')` 解析得到值**不代表**属性访问合法
|
|
258
|
+
* (cordis 的属性代理只认"本层声明过 inject"),探测式写法会把正确性押在装配顺序上,
|
|
259
|
+
* 这条踩过两次(见 `chart-ui/index.js` 的同一段注释)。认证面 `connection` 反之要**惰性**
|
|
260
|
+
* 解析:它缺席(Electron / file:// 这类没有浏览器认证面的载体)就退化成"没有认证面"的旧行为,
|
|
261
|
+
* 但解析抛错一律 401。
|
|
110
262
|
*/
|
|
111
263
|
export function apply(ctx) {
|
|
112
|
-
|
|
264
|
+
const authorize = (req) => {
|
|
265
|
+
let connection
|
|
266
|
+
try {
|
|
267
|
+
connection = ctx.get('connection')
|
|
268
|
+
} catch {
|
|
269
|
+
return 401
|
|
270
|
+
}
|
|
271
|
+
if (connection === undefined || connection === null) return undefined
|
|
272
|
+
if (typeof connection.requestRejection !== 'function') return undefined
|
|
273
|
+
return connection.requestRejection(req)
|
|
274
|
+
}
|
|
275
|
+
ctx.inject(['webServer'], (webCtx) => {
|
|
276
|
+
webCtx.effect(
|
|
277
|
+
() => webCtx.webServer.register({
|
|
278
|
+
kind: 'prefix',
|
|
279
|
+
path: SKILL_DOC_ROUTE,
|
|
280
|
+
handler: createSkillDocHandler({ authorize }),
|
|
281
|
+
}),
|
|
282
|
+
'capital-config: skill 原文旁路',
|
|
283
|
+
)
|
|
284
|
+
})
|
|
285
|
+
ctx.logger?.info?.('capital-config: settings entry active (volatile config surface + skill 原文旁路)')
|
|
113
286
|
}
|
|
@@ -5,12 +5,12 @@ window.__ModuleLoader__.load({
|
|
|
5
5
|
var module = { exports: {} }
|
|
6
6
|
var exports = module.exports
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' })
|
|
8
|
-
"use strict";var{createElement:e,useEffect:K,useState:_}=require("react"),{createSnapshotStore:B}=require("@deepseek-ai/dsh-client-store"),{IconChecklistOutlineRegular:Y,IconCloseOutlineRegular:C,IconEllipsisOutlineRegular:W,IconGoalOutlineRegular:G,IconListPenOutlineRegular:J,IconPinOutlineRegular:V,IconRefreshOutlineRegular:X,IconSearchOutlineRegular:Z,IconTrashOutlineRegular:aa,Menu:ta,Modal:ea}=require("@deepseek-ai/dsh-client-ui-primitives"),f="capital-watchlist",v="capital.watchlist",E="conversation.input.overlay",$="/capital-watchlist",ia="capital-generation",ra=300,A="capital-watchlist-css",la={"command.label":"\u81EA\u9009\u80A1","command.description":"\u6DFB\u52A0 / \u67E5\u770B / \u5220\u9664\u81EA\u9009\u80A1",title:"\u81EA\u9009\u80A1",close:"\u5173\u95ED",searchPlaceholder:"\u8F93\u5165\u8BC1\u5238\u4EE3\u7801\u6216\u540D\u79F0\uFF0C\u652F\u6301A\u80A1/\u6E2F\u80A1/\u7F8E\u80A1",add:"\u6DFB\u52A0",added:"\u5DF2\u6DFB\u52A0",refreshing:"\u5237\u65B0\u4E2D\u2026",refresh:"\u5237\u65B0\u62A5\u4EF7",loading:"\u6B63\u5728\u8BFB\u53D6\u6E05\u5355\u2026",empty:"\u8FD8\u6CA1\u6709\u81EA\u9009\u80A1\uFF0C\u7528\u4E0A\u9762\u7684\u8F93\u5165\u6846\u6DFB\u52A0\u3002",colName:"\u540D\u79F0",colQuote:"\u6700\u65B0\u4EF7 / \u6DA8\u8DCC\u5E45",colAction:"\u64CD\u4F5C",updated:"\u66F4\u65B0\u65F6\u95F4",notRefreshed:"\u672A\u5237\u65B0",stale:"\u4E0A\u4E00\u6B21\u5FEB\u7167",exchangeTime:"\u4EA4\u6613\u6240\u65F6\u95F4",noChangePct:"\u6682\u65E0\u6DA8\u8DCC\u6570\u636E",typeAShare:"A\u80A1",typeHkStock:"\u6E2F\u80A1",typeUsStock:"\u7F8E\u80A1",typeAIndex:"A\u6307",typeHkIndex:"\u6E2F\u6307",typeUsIndex:"\u7F8E\u6307",kindStock:"\u80A1\u7968",kindIndex:"\u6307\u6570",kindEtf:"ETF",remove:"\u79FB\u9664",more:"\u66F4\u591A",pin:"\u7F6E\u9876",predict:"\u9884\u6D4B",predictTip:"AI\u9884\u6D4B\u8BE5\u8BC1\u5238\u6807\u7684",review:"\u590D\u76D8",reviewTip:"AI\u590D\u76D8\u8BE5\u8BC1\u5238\u6807\u7684",predictPromptPrefix:"\u8BF7\u9884\u6D4B ",predictPromptSuffix:"\uFF1A\u672A\u6765 5 \u4E2A\u4EA4\u6613\u65E5\u7684\u8D70\u52BF\u4E0E\u5173\u952E\u70B9\u4F4D\uFF0C\u8BF4\u660E\u4F9D\u636E\uFF0C\u5E76\u7ED9\u51FA\u5224\u65AD\u7684\u4E0D\u786E\u5B9A\u6027\u3002",reviewPromptPrefix:"\u8BF7\u590D\u76D8 ",reviewPromptSuffix:"\uFF1A\u4ECA\u65E5\u8D70\u52BF\u4E0E\u91CF\u4EF7\u3001\u8FD1 20 \u65E5\u8D8B\u52BF\u3001\u57FA\u7840\u9762\u3001\u6D88\u606F\u9762\uFF0C\u7ED9\u51FA\u7ED3\u8BBA\u548C\u5FC5\u8981\u98CE\u9669\u8BC4\u4F30\u3002",searching:"\u641C\u7D22\u4E2D\u2026",composingHint:"\u8F93\u5165\u5B8C\u6210\u540E\u81EA\u52A8\u641C\u7D22",clearInput:"\u6E05\u7A7A\u8F93\u5165",confirmTitle:"\u786E\u8BA4\u79FB\u9664\uFF1F",confirmDescPrefix:"\u786E\u5B9A\u5C06 ",confirmDescSuffix:" \u4ECE\u81EA\u9009\u4E2D\u79FB\u9664\u5417\uFF1F",confirmCancel:"\u53D6\u6D88",confirmOk:"\u786E\u8BA4\u79FB\u9664",truncated:"\u6CA1\u6709\u66F4\u591A\uFF0C\u8BF7\u8F93\u5165\u51C6\u786E\u7684\u8BC1\u5238\u4EE3\u7801\u6216\u540D\u79F0\u3002",filterAll:"\u5168\u90E8",filterLabel:"\u6309\u5E02\u573A\u7B5B\u9009\u5019\u9009",filterNoHit:"\u8FD9\u4E2A\u5E02\u573A\u4E0B\u6CA1\u6709\u5339\u914D\u7684\u6807\u7684\u3002",noHit:"\u6CA1\u6709\u5339\u914D\u7684\u6807\u7684\uFF08A\u80A1 / \u6E2F\u80A1 / \u7F8E\u80A1\uFF0C\u542B\u6307\u6570\u4E0E\u573A\u5185\u57FA\u91D1\uFF09\u3002","error.invalid_query":"\u8F93\u5165\u4E0D\u88AB\u63A5\u53D7","error.not_found":"\u6CA1\u6709\u627E\u5230\u8BE5\u6807\u7684","error.ambiguous":"\u547D\u4E2D\u591A\u6761\uFF0C\u8BF7\u4ECE\u5019\u9009\u91CC\u9009\u4E00\u6761","error.list_full":"\u81EA\u9009\u80A1\u6700\u591A {max} \u6761\uFF0C\u5148\u5220\u4E00\u6761\u518D\u52A0","error.list_full_noMax":"\u81EA\u9009\u80A1\u5DF2\u8FBE\u4E0A\u9650\uFF0C\u5148\u5220\u4E00\u6761\u518D\u52A0","error.credential_missing":"\u672A\u914D\u7F6E Fuyao \u5BC6\u94A5\uFF1A\u5728\u300C\u63D2\u4EF6\u300D\u9875\u7684 Capital \u6A21\u5F0F\u5361\u7247\u91CC\u586B API Key\uFF08\u53EA\u5F71\u54CD A \u80A1\u90A3\u4E00\u8DEF\uFF0C\u6E2F\u7F8E\u80A1\u7167\u5E38\u7528\uFF09","error.rate_limited":"\u884C\u60C5\u670D\u52A1\u9650\u6D41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.fuyao_unavailable":"A \u80A1\u884C\u60C5\u6682\u65F6\u53D6\u4E0D\u5230\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.tencent_unavailable":"\u6E2F\u7F8E\u80A1\u884C\u60C5\u6682\u65F6\u53D6\u4E0D\u5230\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.quote_unavailable":"\u8BE5\u6807\u7684\u6CA1\u6709\u53EF\u7528\u62A5\u4EF7","error.refresh_timeout":"\u5237\u65B0\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.store_unavailable":"\u81EA\u9009\u80A1\u5B58\u50A8\u4E0D\u53EF\u7528","error.unauthorized":"\u767B\u5F55\u72B6\u6001\u5DF2\u5931\u6548\uFF1A\u8BF7\u5148\u56DE\u5230\u5BBF\u4E3B\u7A97\u53E3\u91CD\u65B0\u767B\u5F55",errorSuffix:"\uFF08\u5176\u4ED6\u6807\u7684\u4ECD\u662F\u4E0A\u4E00\u6B21\u6210\u529F\u5FEB\u7167\uFF09","partial.a-share":"A \u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A","partial.hk":"\u6E2F\u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A","partial.us":"\u7F8E\u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A"},sa={"command.label":"Watchlist","command.description":"Add / view / remove watched symbols",title:"Watchlist",close:"Close",searchPlaceholder:"Symbol code or name \u2014 A-share / HK / US",add:"Add",added:"Added",refreshing:"Refreshing\u2026",refresh:"Refresh quotes",loading:"Loading list\u2026",empty:"No symbols yet \u2014 use the input above to add one.",colName:"Symbol",colQuote:"Last / change",colAction:"Actions",updated:"Updated",notRefreshed:"Not refreshed",stale:"last snapshot",exchangeTime:"exchange time",noChangePct:"No change data yet",typeAShare:"A-Share",typeHkStock:"HK",typeUsStock:"US",typeAIndex:"A-Index",typeHkIndex:"HK-Index",typeUsIndex:"US-Index",kindStock:"stock",kindIndex:"index",kindEtf:"ETF",remove:"Remove",more:"More",pin:"Pin to top",predict:"Predict",predictTip:"AI prediction for this symbol",review:"Review",reviewTip:"AI review of this symbol",predictPromptPrefix:"Predict ",predictPromptSuffix:" over the next 5 sessions: the likely path and key levels, the evidence behind the call, and how uncertain it is.",reviewPromptPrefix:"Review ",reviewPromptSuffix:" with today's trend and volume, the last 20 sessions, fundamental, news, then a conclusion and the necessary risks analysis.",searching:"Searching\u2026",composingHint:"Search runs when you finish typing",clearInput:"Clear input",confirmTitle:"Remove this symbol?",confirmDescPrefix:"Remove ",confirmDescSuffix:" from your watchlist?",confirmCancel:"Cancel",confirmOk:"Remove",truncated:"No more candidates \u2014 enter an accurate code or name.",filterAll:"All",filterLabel:"Filter candidates by market",filterNoHit:"No matching symbol in this market.",noHit:"No matching symbol (A-share / HK / US, including indices and listed funds).","error.invalid_query":"Input not accepted","error.not_found":"Symbol not found","error.ambiguous":"Multiple hits \u2014 pick one candidate","error.list_full":"Watchlist holds at most {max} symbols \u2014 remove one first","error.list_full_noMax":"Watchlist is full \u2014 remove one first","error.credential_missing":"No Fuyao API key: set it on the Capital card in the Plugins page (A-share quotes only \u2014 HK and US keep working)","error.rate_limited":"Quote service is rate limited \u2014 try again later","error.fuyao_unavailable":"A-share quotes unavailable \u2014 try again later","error.tencent_unavailable":"HK / US quotes unavailable \u2014 try again later","error.quote_unavailable":"No quote for this symbol","error.refresh_timeout":"Refresh timed out \u2014 try again later","error.store_unavailable":"Watchlist storage unavailable","error.unauthorized":"Session expired \u2014 sign back in to the host first",errorSuffix:" (other symbols still show their last good snapshot)","partial.a-share":"A-share search unavailable: ","partial.hk":"HK search unavailable: ","partial.us":"US search unavailable: "},na={"a-share":"typeAShare","hk-stock":"typeHkStock","us-stock":"typeUsStock","a-share-index":"typeAIndex","hk-index":"typeHkIndex","us-index":"typeUsIndex","fund-etf":"typeAShare"},oa={"a-share":"kindStock","hk-stock":"kindStock","us-stock":"kindStock","a-share-index":"kindIndex","hk-index":"kindIndex","us-index":"kindIndex","fund-etf":"kindEtf"};function ca(l,t){let a=na[l];return a===void 0?String(l??""):t(a)}function da(l,t){let a=oa[l];return a===void 0?String(l??""):t(a)}var pa=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\u00AD\u200B-\u200F\u2028\u2029\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]/gu;function k(l){return String(l??"").replace(pa,"")}function b(l){return Array.isArray(l)?l.map(t=>t===null||typeof t!="object"?t:{...t,name:k(t.name)}):l}var ha={"a-share":"capital-watchlist-tag-cn","a-share-index":"capital-watchlist-tag-cn","fund-etf":"capital-watchlist-tag-cn","hk-stock":"capital-watchlist-tag-hk","hk-index":"capital-watchlist-tag-hk","us-stock":"capital-watchlist-tag-us","us-index":"capital-watchlist-tag-us"},R=[{id:"all"},{id:"cn",label:"CN"},{id:"hk",label:"HK"},{id:"us",label:"US"}],P=l=>l.exchange==="HK"?"hk":l.exchange==="US"?"us":"cn",ua=`
|
|
8
|
+
"use strict";var S=Object.defineProperty;var st=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var ot=Object.prototype.hasOwnProperty;var ct=(e,a,t)=>()=>{if(t)throw t[0];try{return e&&(a=e(e=0)),a}catch(s){throw t=[s],s}};var dt=(e,a)=>{for(var t in a)S(e,t,{get:a[t],enumerable:!0})},pt=(e,a,t,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let i of nt(a))!ot.call(e,i)&&i!==t&&S(e,i,{get:()=>a[i],enumerable:!(s=st(a,i))||s.enumerable});return e};var ht=e=>pt(S({},"__esModule",{value:!0}),e);var H={};dt(H,{ASSET_TYPES:()=>ut,HOLDABLE_ASSET_TYPES:()=>P,MAX_ROW_WEIGHT_PCT:()=>wt,MAX_TOTAL_WEIGHT_PCT:()=>ft,holdingWeight:()=>I,isHoldable:()=>mt,otherHeldWeightPct:()=>R,weightCeiling:()=>gt});var ut,P,mt,wt,ft,I,R,gt,z=ct(()=>{"use strict";ut=["a-share","a-share-index","fund-etf","hk-stock","hk-index","us-stock","us-index"],P=["a-share","fund-etf","hk-stock","us-stock"],mt=e=>P.includes(e?.asset_type),wt=100,ft=120,I=e=>e?.holding===null||e?.holding===void 0?0:e?.holding?.weight_pct??0,R=(e,a)=>e.reduce((t,s)=>s?.thscode===a?t:t+I(s),0),gt=(e,a)=>Math.max(0,Math.min(100,120-R(e,a)))});var{createElement:l,useEffect:bt,useState:M}=require("react"),{createSnapshotStore:xt}=require("@deepseek-ai/dsh-client-store"),{IconChecklistOutlineRegular:yt,IconCloseOutlineRegular:O,IconDatabaseOutlineRegular:vt,IconEllipsisOutlineRegular:kt,IconGoalOutlineRegular:Nt,IconListPenOutlineRegular:St,IconPinOutlineRegular:_t,IconRefreshOutlineRegular:Ct,IconSearchOutlineRegular:Et,IconTrashOutlineRegular:Tt,Menu:At,MenuItemButton:$t,Modal:Pt,Switch:It}=require("@deepseek-ai/dsh-client-ui-primitives"),{isHoldable:F,weightCeiling:W}=(z(),ht(H)),f="capital-watchlist",_="capital.watchlist",L="conversation.input.overlay",j="/capital-watchlist",Rt="capital-generation",Ht=300,C=10,D="capital-watchlist-css",zt={"command.label":"\u81EA\u9009\u80A1","command.description":"\u6DFB\u52A0 / \u67E5\u770B / \u5220\u9664\u81EA\u9009\u80A1",title:"\u81EA\u9009\u80A1",close:"\u5173\u95ED",searchPlaceholder:"\u8F93\u5165\u8BC1\u5238\u4EE3\u7801\u6216\u540D\u79F0\uFF0C\u652F\u6301A\u80A1/\u6E2F\u80A1/\u7F8E\u80A1",add:"\u6DFB\u52A0",added:"\u5DF2\u6DFB\u52A0",refreshing:"\u5237\u65B0\u4E2D\u2026",refresh:"\u5237\u65B0\u62A5\u4EF7",loading:"\u6B63\u5728\u8BFB\u53D6\u6E05\u5355\u2026",empty:"\u8FD8\u6CA1\u6709\u81EA\u9009\u80A1\uFF0C\u7528\u4E0A\u9762\u7684\u8F93\u5165\u6846\u6DFB\u52A0\u3002",colName:"\u540D\u79F0",colQuote:"\u6700\u65B0\u4EF7 / \u6DA8\u8DCC\u5E45",colAction:"\u64CD\u4F5C",updated:"\u66F4\u65B0\u65F6\u95F4",notRefreshed:"\u672A\u5237\u65B0",stale:"\u4E0A\u4E00\u6B21\u5FEB\u7167",exchangeTime:"\u4EA4\u6613\u6240\u65F6\u95F4",noChangePct:"\u6682\u65E0\u6DA8\u8DCC\u6570\u636E",typeAShare:"A\u80A1",typeHkStock:"\u6E2F\u80A1",typeUsStock:"\u7F8E\u80A1",typeAIndex:"A\u6307",typeHkIndex:"\u6E2F\u6307",typeUsIndex:"\u7F8E\u6307",kindStock:"\u80A1\u7968",kindIndex:"\u6307\u6570",kindEtf:"ETF",remove:"\u79FB\u9664",more:"\u66F4\u591A",pin:"\u7F6E\u9876",holdingWeightLabel:"\u6301\u4ED3\u6BD4\u4F8B",holdingStepper:"\u6301\u4ED3\u6BD4\u4F8B\uFF08\u6BCF\u6863 10 \u4E2A\u767E\u5206\u70B9\uFF09",holdingStepUp:"\u589E\u52A0\u6301\u4ED3\u6BD4\u4F8B",holdingStepDown:"\u51CF\u5C11\u6301\u4ED3\u6BD4\u4F8B",holdingName:"\u6301\u4ED3",predict:"\u9884\u6D4B",predictTip:"AI\u9884\u6D4B\u8BE5\u8BC1\u5238\u6807\u7684",review:"\u590D\u76D8",reviewTip:"AI\u590D\u76D8\u8BE5\u8BC1\u5238\u6807\u7684",predictPromptPrefix:"\u8BF7\u9884\u6D4B ",predictPromptSuffix:"\uFF1A\u672A\u6765 5 \u4E2A\u4EA4\u6613\u65E5\u7684\u8D70\u52BF\u4E0E\u5173\u952E\u70B9\u4F4D\uFF0C\u8BF4\u660E\u4F9D\u636E\uFF0C\u5E76\u7ED9\u51FA\u5224\u65AD\u7684\u4E0D\u786E\u5B9A\u6027\u3002",reviewPromptPrefix:"\u8BF7\u590D\u76D8 ",reviewPromptSuffix:"\uFF1A\u4ECA\u65E5\u8D70\u52BF\u4E0E\u91CF\u4EF7\u3001\u8FD1 20 \u65E5\u8D8B\u52BF\u3001\u57FA\u7840\u9762\u3001\u6D88\u606F\u9762\uFF0C\u7ED9\u51FA\u7ED3\u8BBA\u548C\u5FC5\u8981\u98CE\u9669\u8BC4\u4F30\u3002",searching:"\u641C\u7D22\u4E2D\u2026",composingHint:"\u8F93\u5165\u5B8C\u6210\u540E\u81EA\u52A8\u641C\u7D22",clearInput:"\u6E05\u7A7A\u8F93\u5165",confirmTitle:"\u786E\u8BA4\u79FB\u9664\uFF1F",confirmDescPrefix:"\u786E\u5B9A\u5C06 ",confirmDescSuffix:" \u4ECE\u81EA\u9009\u4E2D\u79FB\u9664\u5417\uFF1F",confirmCancel:"\u53D6\u6D88",confirmOk:"\u786E\u8BA4\u79FB\u9664",truncated:"\u6CA1\u6709\u66F4\u591A\uFF0C\u8BF7\u8F93\u5165\u51C6\u786E\u7684\u8BC1\u5238\u4EE3\u7801\u6216\u540D\u79F0\u3002",filterAll:"\u5168\u90E8",filterLabel:"\u6309\u5E02\u573A\u7B5B\u9009\u5019\u9009",filterNoHit:"\u8FD9\u4E2A\u5E02\u573A\u4E0B\u6CA1\u6709\u5339\u914D\u7684\u6807\u7684\u3002",noHit:"\u6CA1\u6709\u5339\u914D\u7684\u6807\u7684\uFF08A\u80A1 / \u6E2F\u80A1 / \u7F8E\u80A1\uFF0C\u542B\u6307\u6570\u4E0E\u573A\u5185\u57FA\u91D1\uFF09\u3002","error.invalid_query":"\u8F93\u5165\u4E0D\u88AB\u63A5\u53D7","error.not_found":"\u6CA1\u6709\u627E\u5230\u8BE5\u6807\u7684","error.ambiguous":"\u547D\u4E2D\u591A\u6761\uFF0C\u8BF7\u4ECE\u5019\u9009\u91CC\u9009\u4E00\u6761","error.list_full":"\u81EA\u9009\u80A1\u6700\u591A {max} \u6761\uFF0C\u5148\u5220\u4E00\u6761\u518D\u52A0","error.list_full_noMax":"\u81EA\u9009\u80A1\u5DF2\u8FBE\u4E0A\u9650\uFF0C\u5148\u5220\u4E00\u6761\u518D\u52A0","error.credential_missing":"\u672A\u914D\u7F6E Fuyao \u5BC6\u94A5\uFF1A\u5728\u300C\u63D2\u4EF6\u300D\u9875\u7684 Capital \u6A21\u5F0F\u5361\u7247\u91CC\u586B API Key\uFF08\u53EA\u5F71\u54CD A \u80A1\u90A3\u4E00\u8DEF\uFF0C\u6E2F\u7F8E\u80A1\u7167\u5E38\u7528\uFF09","error.rate_limited":"\u884C\u60C5\u670D\u52A1\u9650\u6D41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.fuyao_unavailable":"A \u80A1\u884C\u60C5\u6682\u65F6\u53D6\u4E0D\u5230\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.tencent_unavailable":"\u6E2F\u7F8E\u80A1\u884C\u60C5\u6682\u65F6\u53D6\u4E0D\u5230\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.quote_unavailable":"\u8BE5\u6807\u7684\u6CA1\u6709\u53EF\u7528\u62A5\u4EF7","error.refresh_timeout":"\u5237\u65B0\u8D85\u65F6\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5","error.store_unavailable":"\u81EA\u9009\u80A1\u5B58\u50A8\u4E0D\u53EF\u7528","error.unauthorized":"\u767B\u5F55\u72B6\u6001\u5DF2\u5931\u6548\uFF1A\u8BF7\u5148\u56DE\u5230\u5BBF\u4E3B\u7A97\u53E3\u91CD\u65B0\u767B\u5F55",errorSuffix:"\uFF08\u5176\u4ED6\u6807\u7684\u4ECD\u662F\u4E0A\u4E00\u6B21\u6210\u529F\u5FEB\u7167\uFF09","partial.a-share":"A \u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A","partial.hk":"\u6E2F\u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A","partial.us":"\u7F8E\u80A1\u68C0\u7D22\u4E0D\u53EF\u7528\uFF1A"},Mt={"command.label":"Watchlist","command.description":"Add / view / remove watched symbols",title:"Watchlist",close:"Close",searchPlaceholder:"Symbol code or name \u2014 A-share / HK / US",add:"Add",added:"Added",refreshing:"Refreshing\u2026",refresh:"Refresh quotes",loading:"Loading list\u2026",empty:"No symbols yet \u2014 use the input above to add one.",colName:"Symbol",colQuote:"Last / change",colAction:"Actions",updated:"Updated",notRefreshed:"Not refreshed",stale:"last snapshot",exchangeTime:"exchange time",noChangePct:"No change data yet",typeAShare:"A-Share",typeHkStock:"HK",typeUsStock:"US",typeAIndex:"A-Index",typeHkIndex:"HK-Index",typeUsIndex:"US-Index",kindStock:"stock",kindIndex:"index",kindEtf:"ETF",remove:"Remove",more:"More",pin:"Pin to top",holdingWeightLabel:"Holding weight",holdingStepper:"Holding weight, in steps of 10 percentage points",holdingStepUp:"Increase holding weight",holdingStepDown:"Decrease holding weight",holdingName:"Holding",predict:"Predict",predictTip:"AI prediction for this symbol",review:"Review",reviewTip:"AI review of this symbol",predictPromptPrefix:"Predict ",predictPromptSuffix:" over the next 5 sessions: the likely path and key levels, the evidence behind the call, and how uncertain it is.",reviewPromptPrefix:"Review ",reviewPromptSuffix:" with today's trend and volume, the last 20 sessions, fundamental, news, then a conclusion and the necessary risks analysis.",searching:"Searching\u2026",composingHint:"Search runs when you finish typing",clearInput:"Clear input",confirmTitle:"Remove this symbol?",confirmDescPrefix:"Remove ",confirmDescSuffix:" from your watchlist?",confirmCancel:"Cancel",confirmOk:"Remove",truncated:"No more candidates \u2014 enter an accurate code or name.",filterAll:"All",filterLabel:"Filter candidates by market",filterNoHit:"No matching symbol in this market.",noHit:"No matching symbol (A-share / HK / US, including indices and listed funds).","error.invalid_query":"Input not accepted","error.not_found":"Symbol not found","error.ambiguous":"Multiple hits \u2014 pick one candidate","error.list_full":"Watchlist holds at most {max} symbols \u2014 remove one first","error.list_full_noMax":"Watchlist is full \u2014 remove one first","error.credential_missing":"No Fuyao API key: set it on the Capital card in the Plugins page (A-share quotes only \u2014 HK and US keep working)","error.rate_limited":"Quote service is rate limited \u2014 try again later","error.fuyao_unavailable":"A-share quotes unavailable \u2014 try again later","error.tencent_unavailable":"HK / US quotes unavailable \u2014 try again later","error.quote_unavailable":"No quote for this symbol","error.refresh_timeout":"Refresh timed out \u2014 try again later","error.store_unavailable":"Watchlist storage unavailable","error.unauthorized":"Session expired \u2014 sign back in to the host first",errorSuffix:" (other symbols still show their last good snapshot)","partial.a-share":"A-share search unavailable: ","partial.hk":"HK search unavailable: ","partial.us":"US search unavailable: "},Ot={"a-share":"typeAShare","hk-stock":"typeHkStock","us-stock":"typeUsStock","a-share-index":"typeAIndex","hk-index":"typeHkIndex","us-index":"typeUsIndex","fund-etf":"typeAShare"},Ft={"a-share":"kindStock","hk-stock":"kindStock","us-stock":"kindStock","a-share-index":"kindIndex","hk-index":"kindIndex","us-index":"kindIndex","fund-etf":"kindEtf"};function Lt(e,a){let t=Ot[e];return t===void 0?String(e??""):a(t)}function jt(e,a){let t=Ft[e];return t===void 0?String(e??""):a(t)}var Dt=/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\u00AD\u200B-\u200F\u2028\u2029\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]/gu;function T(e){return String(e??"").replace(Dt,"")}function y(e){return Array.isArray(e)?e.map(a=>a===null||typeof a!="object"?a:{...a,name:T(a.name)}):e}var Ut={"a-share":"capital-watchlist-tag-cn","a-share-index":"capital-watchlist-tag-cn","fund-etf":"capital-watchlist-tag-cn","hk-stock":"capital-watchlist-tag-hk","hk-index":"capital-watchlist-tag-hk","us-stock":"capital-watchlist-tag-us","us-index":"capital-watchlist-tag-us"},B=[{id:"all"},{id:"cn",label:"CN"},{id:"hk",label:"HK"},{id:"us",label:"US"}],U=e=>e.exchange==="HK"?"hk":e.exchange==="US"?"us":"cn",qt=`
|
|
9
9
|
/* \u5BBD 420 / \u5706\u89D2 18 / \u65E0\u5185\u8FB9\u8DDD\uFF08\u5185\u8FB9\u8DDD\u4F4F\u5728\u5404\u6BB5\u81EA\u5DF1\u5934\u4E0A\uFF0C\u597D\u8BA9\u8868\u5934\u4E0E\u5206\u9694\u7EBF\u5BF9\u9F50\uFF09\u3002
|
|
10
10
|
\u9650\u9AD8\u6309\u5B98\u65B9\u53E3\u5F84\u8D70 max-height: 100%\uFF08\u5BF9 .root \u7684 padding box\uFF09\uFF0C\u4E0D\u81EA\u5DF1\u7B97 vh\u3002 */
|
|
11
11
|
.capital-watchlist-dialog.capital-watchlist-dialog { width: min(420px, 92vw); max-height: 100%; padding: 0; gap: 0; border-radius: 18px; }
|
|
12
12
|
/* \u5E95\u8272\u4E0E\u6295\u5F71\u5F52\u5B98\u65B9 .dialog\uFF1B\u6EDA\u52A8\u6761\u6309\u5B98\u65B9\u5951\u7EA6\u53EA\u5728\u5BB9\u5668\u4E0A\u91CD\u7ED1 l2 \u90A3\u4E00\u5BF9\uFF0C\u4E0D\u81EA\u5DF1\u5199 scrollbar-* \u9009\u62E9\u5668\u3002 */
|
|
13
|
-
.capital-watchlist-card { position: relative; display: flex; flex-direction: column; min-height: 0; overflow: hidden; border-radius: 18px; --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2); --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2); }
|
|
13
|
+
.capital-watchlist-card { position: relative; display: flex; flex-direction: column; min-height: 0; overflow: hidden; border-radius: 18px; --capital-watchlist-up: #d1493f; --capital-watchlist-down: #17a063; --dsh-scrollbar-thumb: var(--dsw-alias-scrollbar-bg-l2); --dsh-scrollbar-thumb-hover: var(--dsw-alias-scrollbar-hover-l2); }
|
|
14
14
|
.capital-watchlist-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 18px 20px 14px; }
|
|
15
15
|
.capital-watchlist-title { margin: 0; font-size: 17px; line-height: 24px; font-weight: 600; letter-spacing: .3px; color: var(--dsw-alias-label-primary); }
|
|
16
16
|
/* \u5706\u5F62\u7070\u5E95\u952E\uFF1A\u7070\u5E95 bg-module-platform + glyph label-secondary\uFF0C\u4E24\u5957\u4E3B\u9898\u90FD\u62C9\u5F97\u5F00\uFF1B\u6B63\u5706\u987B\u914D corner-shape: round\u3002 */
|
|
@@ -68,7 +68,7 @@ window.__ModuleLoader__.load({
|
|
|
68
68
|
.capital-watchlist-option:hover:not([aria-disabled="true"]) { background: color-mix(in srgb, var(--dsw-alias-state-business-primary) 10%, transparent); }
|
|
69
69
|
.capital-watchlist-option[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
|
|
70
70
|
/* \u952E\u76D8\u7126\u70B9\u8D70\u5B98\u65B9\u8868\u8FBE\u5F0F\uFF1A\u73AF\u8272\u7531\u5BBF\u4E3B\u6309\u4E3B\u9898\u4E0E\u8F93\u5165\u6A21\u6001\u7BA1\u597D\uFF08\u6307\u9488\u6A21\u6001\u81EA\u52A8\u900F\u660E\uFF09\uFF0C\u4E0D\u81EA\u5DF1\u9020\u73AF\u3002 */
|
|
71
|
-
.capital-watchlist-close:focus-visible, .capital-watchlist-clear:focus-visible, .capital-watchlist-option:focus-visible, .capital-watchlist-filterbtn:focus-visible, .capital-watchlist-more:focus-visible, .capital-watchlist-predict:focus-visible, .capital-watchlist-review:focus-visible, .capital-watchlist-refresh:focus-visible, .capital-watchlist-confirmbtn:focus-visible { outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); outline-offset: 1px; }
|
|
71
|
+
.capital-watchlist-close:focus-visible, .capital-watchlist-clear:focus-visible, .capital-watchlist-option:focus-visible, .capital-watchlist-filterbtn:focus-visible, .capital-watchlist-more:focus-visible, .capital-watchlist-predict:focus-visible, .capital-watchlist-review:focus-visible, .capital-watchlist-refresh:focus-visible, .capital-watchlist-confirmbtn:focus-visible, .capital-watchlist-stepperbtn:focus-visible { outline: var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary)); outline-offset: 1px; }
|
|
72
72
|
.capital-watchlist-optionmain { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
|
|
73
73
|
.capital-watchlist-optionname { font-size: 14px; line-height: 18px; font-weight: 500; color: var(--dsw-alias-label-primary); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
|
74
74
|
.capital-watchlist-optioncode { font-size: 12px; line-height: 15px; color: var(--dsw-alias-label-tertiary); }
|
|
@@ -122,6 +122,10 @@ window.__ModuleLoader__.load({
|
|
|
122
122
|
.capital-watchlist-row:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
123
123
|
.capital-watchlist-namewrap { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
|
|
124
124
|
.capital-watchlist-name { font-size: 14px; font-weight: 500; color: var(--dsw-alias-label-primary); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
|
125
|
+
/* \u7528\u6237\u5728\u8FD9\u6761\u9762\u677F\u4E0A\u4EB2\u624B\u6807\u8FC7\u6301\u4ED3\u7684\u90A3\u4E00\u884C\uFF1A\u540D\u79F0\u6807\u7EA2\uFF082026-10-09 \u7528\u6237\u70B9\u540D\uFF0C\u66FF\u4EE3\u539F\u5148\u90A3\u679A\u5FBD\u6807\uFF09\u3002
|
|
126
|
+
\u26A0\uFE0F \u989C\u8272\u4E0D\u662F\u8FD9\u6761\u6807\u8BB0\u7684\u552F\u4E00\u901A\u9053\u2014\u2014\u5B83\u4E0E"\u7EA2\u6DA8"\u540C\u8272\uFF0C\u6240\u4EE5 title \u91CC\u540C\u65F6\u5199\u7740"\u6301\u4ED3 20%"\uFF0C
|
|
127
|
+
\u8BFB\u5C4F\u4E0E\u9F20\u6807\u60AC\u505C\u90FD\u62FF\u5F97\u5230\u540C\u4E00\u53E5\u8BDD\uFF08\u89C1 nameTitle\uFF09\u3002 */
|
|
128
|
+
.capital-watchlist-name-held { color: var(--capital-watchlist-up); }
|
|
125
129
|
/* \u4EE3\u7801\u4E0E\u7C7B\u578B\u5FBD\u6807\u540C\u5904\u7B2C\u4E8C\u884C\uFF082026-10-07 \u8D77\u8FD9\u4E00\u884C\u5C31\u8FD9\u4E24\u6837\uFF0C\u5E01\u79CD\u4E0D\u8FDB\u9762\u677F\uFF09\uFF1Agap \u662F\u8FD9\u4E00\u5BF9\u552F\u4E00\u7684\u95F4\u8DDD\u6765\u6E90\uFF0C\u5FBD\u6807\u81EA\u5E26\u5185\u8FB9\u8DDD\uFF0C\u522B\u518D\u5404\u5199 margin\u300210px \u4E0E\u5019\u9009\u884C capital-watchlist-option \u90A3\u6761 gap \u540C\u503C\u2014\u2014\u540C\u4E00\u4EF6\u4E8B\u7684\u4E24\u79CD\u6392\u6CD5\uFF0C\u4E0D\u8BE5\u4E00\u5904\u7D27\u4E00\u5904\u677E\uFF1B6px \u5728\u5B9E\u673A\u4E0A\u8BFB\u8D77\u6765\u662F"\u8D34\u7740"\uFF082026-10-07 \u7528\u6237\u70B9\u540D\uFF09\u3002 */
|
|
126
130
|
.capital-watchlist-codeline { display: flex; align-items: center; gap: 10px; min-width: 0; }
|
|
127
131
|
.capital-watchlist-code { font-size: 11px; color: var(--dsw-alias-label-tertiary); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
|
@@ -133,8 +137,8 @@ window.__ModuleLoader__.load({
|
|
|
133
137
|
.capital-watchlist-quote { min-width: 0; padding-right: 12px; text-align: right; font-variant-numeric: tabular-nums; }
|
|
134
138
|
.capital-watchlist-price { font-size: 14px; font-weight: 500; color: var(--dsw-alias-label-primary); white-space: nowrap; }
|
|
135
139
|
.capital-watchlist-change { margin-top: 1px; font-size: 12px; font-weight: 500; white-space: nowrap; }
|
|
136
|
-
.capital-watchlist-up { color:
|
|
137
|
-
.capital-watchlist-down { color:
|
|
140
|
+
.capital-watchlist-up { color: var(--capital-watchlist-up); }
|
|
141
|
+
.capital-watchlist-down { color: var(--capital-watchlist-down); }
|
|
138
142
|
.capital-watchlist-flat { color: var(--dsw-alias-label-secondary); }
|
|
139
143
|
/* \u7B2C\u56DB\u6863\uFF1A\u4EF7\u6709\u3001\u6DA8\u8DCC\u8FD8\u6CA1\u6709\uFF08\u505C\u724C / \u672A\u5F00\u76D8\uFF09\u3002\u523B\u610F\u6BD4 flat \u518D\u6D45\u4E00\u6863\u2014\u2014flat \u90A3\u4E00\u6863\u8BF4\u7684\u662F"\u4ECA\u65E5\u5E73\u76D8"
|
|
140
144
|
\u8FD9\u4E2A\u7ED3\u8BBA\uFF0C\u501F\u7528\u5B83\u5C31\u628A"\u6CA1\u8FD9\u4E2A\u6570"\u753B\u6210\u4E86\u4E00\u4E2A\u6295\u8D44\u5224\u65AD\u3002 */
|
|
@@ -218,8 +222,45 @@ window.__ModuleLoader__.load({
|
|
|
218
222
|
.capital-watchlist-confirmbtn:hover { background: var(--dsw-alias-interactive-bg-hover-accent); }
|
|
219
223
|
.capital-watchlist-confirmdanger { border: 1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary) 25%, transparent); background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 15%, transparent); color: var(--dsw-alias-state-error-primary); }
|
|
220
224
|
.capital-watchlist-confirmdanger:hover { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 25%, transparent); }
|
|
221
|
-
|
|
222
|
-
`);return await navigator.clipboard.writeText(t),t}dispose(){this.timer!==null&&clearTimeout(this.timer),this.searchController!==null&&this.searchController.abort()}};function z(l){if(typeof l!="number"||!Number.isFinite(l))return"";let t=new Date(l),a=s=>String(s).padStart(2,"0");return`${a(t.getMonth()+1)}-${a(t.getDate())} ${a(t.getHours())}:${a(t.getMinutes())}`}function T({assetType:l,t}){return e("span",{className:`capital-watchlist-tag ${ha[l]??"capital-watchlist-tag-cn"}`},ca(l,t))}function fa(l,t,a){let s=k(l.name);return`${t(`${a}PromptPrefix`)}${s} (${l.thscode} \xB7 ${da(l.asset_type,t)})${t(`${a}PromptSuffix`)}`}function wa({quote:l,failureCode:t,refreshing:a,t:s}){let i=t!==void 0;if(l==null)return a===!0?e("div",{className:"capital-watchlist-quote"},e("span",{className:"capital-watchlist-skeleton capital-watchlist-skeleton-price"}),e("span",{className:"capital-watchlist-skeleton capital-watchlist-skeleton-change"})):i?e("div",{className:"capital-watchlist-quote",title:s(`error.${t}`)},e("div",{className:"capital-watchlist-price capital-watchlist-quotefailed"},"\u2014")):e("div",{className:"capital-watchlist-quote"},e("div",{className:"capital-watchlist-price"},s("notRefreshed")));let d=typeof l.change_pct=="number"&&Number.isFinite(l.change_pct),n=d?`${l.change_pct>0?"+":""}${l.change_pct.toFixed(2)}%`:"\u2014",o=i?"capital-watchlist-stale":d?l.change_pct>0?"capital-watchlist-up":l.change_pct<0?"capital-watchlist-down":"capital-watchlist-flat":"capital-watchlist-nodata",c=typeof l.source_time=="string"&&l.source_time.length>0?`${s("exchangeTime")} ${l.source_time}`:"",p=[];return i?p.push(`${s(`error.${t}`)} \xB7 ${s("stale")} ${z(l.captured_at)}`):d||p.push(s("noChangePct")),c.length>0&&p.push(c),e("div",{className:"capital-watchlist-quote",title:p.length===0?void 0:p.join(" \xB7 ")},e("div",{className:i?"capital-watchlist-price capital-watchlist-stale":"capital-watchlist-price"},l.price.toFixed(2)),e("div",{className:`capital-watchlist-change ${o}`},n))}function ga(l,t){if(t.code!=="list_full")return l(`error.${t.code}`);let a=t.limit;return typeof a!="number"||!Number.isFinite(a)?l("error.list_full_noMax"):l("error.list_full").replace("{max}",String(a))}function ba({useDialog:l,surface:t,t:a,inputActions:s}){let i=l(r=>r),[d,n]=_(!1),[o,c]=_(null),p=i.pendingRemove??null;if(K(()=>()=>t.dispose(),[t]),!i.open)return null;let h=i.dropdownOpen===!0,w=p!==null,M=r=>{if(r.key==="Escape"){if(w){r.stopPropagation(),t.setPendingRemove(null);return}h&&(r.stopPropagation(),t.hideDropdown())}},H=r=>{if(!h)return;let u=r.relatedTarget;u!=null&&r.currentTarget?.contains?.(u)===!0||t.hideDropdown()},g=i.error,O=g==null?null:e("p",{className:"capital-watchlist-notice",role:"alert","data-code":g.code},`${a(`error.${g.code}`)}${g.partial===!0?a("errorSuffix"):""}`),N=(r,u)=>{s.insertText(fa(r,a,u),s.captureInsertion())===!0&&t.close()},x=i.marketFilter==="all"?i.candidates:i.candidates.filter(r=>P(r)===i.marketFilter),S={all:i.candidates.length,cn:0,hk:0,us:0};for(let r of i.candidates)S[P(r)]+=1;let F=i.candidates.length===0?null:e("div",{className:"capital-watchlist-filter",role:"group","aria-label":a("filterLabel")},R.map(r=>e("button",{key:r.id,type:"button",className:"capital-watchlist-filterbtn","aria-pressed":i.marketFilter===r.id,onClick:()=>t.setMarketFilter(r.id)},e("span",{className:"capital-watchlist-filterlabel"},r.id==="all"?a("filterAll"):r.label),e("span",{className:"capital-watchlist-filtercount"},String(S[r.id]))))),j=h?e("div",{className:"capital-watchlist-dropdown","aria-label":a("title"),"data-menu-material":"translucent"},F,e("div",{className:"capital-watchlist-options",role:"listbox","aria-label":a("title")},x.map(r=>e("button",{key:r.thscode,type:"button",role:"option",className:"capital-watchlist-option",title:r.name,"aria-disabled":r.in_list===!0||o===r.thscode,onClick:()=>{r.in_list===!0||o===r.thscode||(n(!0),c(r.thscode),t.add(r).finally(()=>{n(!1),c(null)}))}},e("span",{className:"capital-watchlist-optionmain"},e("span",{className:"capital-watchlist-optionname"},r.name),e("span",{className:"capital-watchlist-codeline"},e("span",{className:"capital-watchlist-optioncode"},r.thscode),e(T,{assetType:r.asset_type,t:a}))),e("span",{className:"capital-watchlist-addbtn","data-state":r.in_list===!0?"added":"idle"},r.in_list===!0?a("added"):a("add")))),i.truncated===!0&&x.length>0?e("div",{className:"capital-watchlist-hint capital-watchlist-endhint"},a("truncated")):null),i.composing===!0?e("div",{className:"capital-watchlist-hint"},a("composingHint")):i.searching===!0||i.pendingSearch===!0?e("div",{className:"capital-watchlist-hint"},a("searching")):i.searchError!==null&&i.searchError!==void 0?e("div",{className:"capital-watchlist-hint capital-watchlist-searcherror",role:"alert","data-code":i.searchError.code},a(`error.${i.searchError.code}`)):i.candidates.length===0?e("div",{className:"capital-watchlist-hint"},a("noHit")):x.length===0?e("div",{className:"capital-watchlist-hint","data-filter":i.marketFilter},a("filterNoHit")):null,...(i.searchPartial??[]).map(r=>e("div",{key:`partial-${r.market}`,className:"capital-watchlist-hint capital-watchlist-searcherror",role:"status","data-market":r.market,"data-code":r.code},`${a(`partial.${r.market}`)}${a(`error.${r.code}`)}`))):null,U=i.items.length===0?null:e("div",{className:"capital-watchlist-grid capital-watchlist-head"},e("span",null,a("colName")),e("span",{className:"capital-watchlist-quote"},a("colQuote")),e("span",{className:"capital-watchlist-headaction"},a("colAction"))),D=i.loadError!==null&&i.loadError!==void 0?e("p",{className:"capital-watchlist-empty capital-watchlist-loaderror",role:"alert","data-code":i.loadError.code},a(`error.${i.loadError.code}`)):e("p",{className:"capital-watchlist-empty"},a("empty")),L=i.loading?e("p",{className:"capital-watchlist-empty"},a("loading")):i.items.length===0?D:e("div",{className:h?"capital-watchlist-list capital-watchlist-list-open":"capital-watchlist-list"},i.items.map((r,u)=>e("div",{key:r.thscode,className:"capital-watchlist-grid capital-watchlist-row","data-thscode":r.thscode},e("span",{className:"capital-watchlist-namewrap"},e("span",{className:"capital-watchlist-name",title:`${r.name} ${r.ticker}`},r.name),e("span",{className:"capital-watchlist-codeline"},e("span",{className:"capital-watchlist-code"},r.ticker),e(T,{assetType:r.asset_type,t:a}))),e(wa,{quote:r.quote,failureCode:i.failures[r.thscode],refreshing:i.refreshing,t:a}),e("span",{className:"capital-watchlist-rowactions"},e("button",{type:"button",className:"capital-watchlist-predict",disabled:d,title:a("predictTip"),"aria-label":`${a("predict")} ${r.name}`,onClick:()=>N(r,"predict")},e(G,{size:14})),e("button",{type:"button",className:"capital-watchlist-review",disabled:d,title:a("reviewTip"),"aria-label":`${a("review")} ${r.name}`,onClick:()=>N(r,"review")},e(J,{size:14})),e(ta,{open:i.rowMenu===r.thscode,anchor:e("button",{type:"button",className:"capital-watchlist-more",disabled:d,title:a("more"),"aria-label":`${a("more")} ${r.name}`,"aria-haspopup":"menu","aria-expanded":i.rowMenu===r.thscode,onClick:()=>t.toggleRowMenu(r.thscode)},e(W,{size:14})),items:[{id:"pin",label:a("pin"),icon:e(V,{size:14}),disabled:u===0},{id:"remove",label:a("remove"),icon:e(aa,{size:14}),danger:!0}],onSelect:Q=>{t.closeRowMenu(),Q==="pin"?t.pin(r.thscode):t.setPendingRemove(r)},onClose:()=>t.closeRowMenu(),align:"end",portal:!0,className:"capital-watchlist-actions"}))))),q=e("div",{className:w?"capital-watchlist-confirm capital-watchlist-confirm-open":"capital-watchlist-confirm","aria-hidden":w?void 0:"true"},e("div",{className:"capital-watchlist-confirmbox",role:w?"alertdialog":void 0,"aria-label":a("confirmTitle")},e("div",{className:"capital-watchlist-confirmtitle"},a("confirmTitle")),w?e("p",{className:"capital-watchlist-confirmdesc"},a("confirmDescPrefix"),e("strong",null,`${p.name} \xB7 ${p.ticker}`),a("confirmDescSuffix")):null,e("div",{className:"capital-watchlist-confirmactions"},e("button",{type:"button",className:"capital-watchlist-confirmbtn",onClick:()=>t.setPendingRemove(null)},a("confirmCancel")),e("button",{type:"button",className:"capital-watchlist-confirmbtn capital-watchlist-confirmdanger",onClick:()=>{let r=p;t.setPendingRemove(null),r!==null&&t.remove(r.thscode)}},a("confirmOk")))));return e(ea,{open:!0,onClose:()=>t.close(),title:a("title"),headless:!0,shortcutModal:"watchlist",className:"capital-watchlist-dialog"},e("div",{className:"capital-watchlist-card",onKeyDown:M},e("div",{className:"capital-watchlist-header"},e("h2",{className:"capital-watchlist-title"},a("title")),e("button",{type:"button",className:"capital-watchlist-close","aria-label":a("close"),onClick:()=>t.close()},e(C,{size:14}))),e("div",{className:"capital-watchlist-search",onBlur:H},e("div",{className:"capital-watchlist-field"},e("span",{className:"capital-watchlist-searchicon"},e(Z,{size:16})),e("input",{className:"capital-watchlist-input","data-modal-autofocus":!0,value:i.query,placeholder:a("searchPlaceholder"),onChange:r=>t.onQueryChange(r.target.value,r.isComposing),onCompositionStart:()=>t.beginComposition(),onCompositionEnd:r=>t.endComposition(r.target.value)}),i.query.length>0?e("button",{type:"button",className:"capital-watchlist-clear",title:a("clearInput"),"aria-label":a("clearInput"),onMouseDown:r=>r.preventDefault(),onClick:()=>t.onQueryChange("",!1)},e(C,{size:12})):null),j),i.addError!==null&&i.addError!==void 0?e("p",{className:"capital-watchlist-adderror",role:"status","data-code":i.addError.code},ga(a,i.addError)):null,U,L,e("div",{className:"capital-watchlist-footer"},e("div",{className:"capital-watchlist-footcol"},e("button",{type:"button",className:"capital-watchlist-refresh",disabled:i.refreshing||d,onClick:()=>{t.refresh()}},e(X,{size:14}),i.refreshing?a("refreshing"):a("refresh")),O),e("span",{className:"capital-watchlist-updated"},`${a("updated")} ${i.refreshed_at===null||i.refreshed_at===void 0?a("notRefreshed"):z(i.refreshed_at)}`)),q))}function xa(l){l.effect(ma,`${f}: styles`),l.effect(()=>l.locale.register(v,{zh:la,en:sa}),`${f}: dictionaries`);let t=new Map,a=n=>{let o=t.get(n);return o===void 0&&(o=new y,t.set(n,o)),o};l.effect(()=>()=>{for(let n of t.values())n.dispose();t.clear()},`${f}: per-session surfaces`);let s=n=>{let c=l.sessions?.list?.getSnapshot?.().byId?.[n]?.projectionValues?.agentPreset;return typeof c=="string"?c:void 0},i=new Set,d=n=>{let o=s(n);return o!==void 0?o===ia:(i.has(n)||(i.add(n),Promise.resolve(l.sessions?.refreshProjections?.(n)).catch(()=>{})),!1)};l.slots.inject(E,()=>l.slots.register({name:E,id:"capital-watchlist-dialog",order:3,locale:v,inject:n=>{let o=a(n);return{hooks:{dialog:o.state},surface:o}}},ba)),l.inject(["commandUi"],n=>{let o=l.locale.bind(v);n.effect(()=>n.commandUi.register({name:"watchlist",label:()=>o("command.label"),description:()=>o("command.description"),icon:Y,available:c=>d(c.sessionId),ui:{kind:"action",run:c=>{a(c.sessionId).open()}}}),`${f}: /watchlist contribution`)}),l.logger?.info?.(`${f}: \u5BA2\u6237\u7AEF\u534A\u8FB9\u5DF2\u6302\u8F7D\uFF08/watchlist \u83DC\u5355\u884C + \u81EA\u9009\u80A1\u5F39\u7A97\uFF09`)}exports.name=f;exports.inject=["slots","locale","commandUi","sessions"];exports.apply=xa;
|
|
225
|
+
/* \u6301\u4ED3\u8FD9\u4E00\u7C07\u4F4F\u5728\u300C\u66F4\u591A\u300D\u83DC\u5355\u91CC\uFF08\u52FE\u4E00\u4E0B\u624D\u957F\u51FA\u6BD4\u4F8B\u90A3\u4E00\u884C\uFF09\u3002\u26D4 \u8FD9\u4E9B\u9009\u62E9\u5668\u5FC5\u987B\u662F**\u88F8\u7C7B**\uFF1A\u83DC\u5355\u662F
|
|
226
|
+
portal \u5230 document.body \u7684\uFF0C".capital-watchlist-card \u2026" \u90A3\u79CD\u540E\u4EE3\u9009\u62E9\u5668\u591F\u4E0D\u5230\u5B83\uFF0C\u6302\u5728\u90A3\u513F
|
|
227
|
+
\u7684\u89C4\u5219\u4F1A\u9759\u9ED8\u4E0D\u751F\u6548\u3002\u989C\u8272\u4E5F\u4E00\u5F8B\u8D70 --dsw-alias-*\uFF1Acard \u4E0A\u90A3\u5BF9\u6DA8\u8DCC\u53D8\u91CF\u540C\u6837\u900F\u4E0D\u8FDB\u53BB\u3002
|
|
228
|
+
\u884C\u7684\u51E0\u4F55\u7167\u5B98\u65B9 .item \u6284\uFF08min-height 34 / padding 6px 8px / gap 6 / radius md / 13px 20px\uFF09\uFF1A
|
|
229
|
+
\u81EA\u5DF1\u53D1\u660E\u7684\u884C\u9AD8\u4F1A\u5728\u540C\u4E00\u5F20\u83DC\u5355\u91CC\u957F\u51FA\u4E09\u79CD\u8282\u594F\u3002 */
|
|
230
|
+
.capital-watchlist-checkrow { box-sizing: border-box; display: flex; align-items: center; gap: 6px; width: 100%; min-height: 34px; padding: 6px 8px; border-radius: var(--dsw-radius-md); font-family: inherit; font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-primary); text-align: left; }
|
|
231
|
+
/* \u884C\u9996\u56FE\u6807\u7167\u5B98\u65B9 .itemIcon \u7684\u51E0\u4F55\uFF0814x14\u3001flex: none\u3001menu-icon \u8272\uFF09\uFF1A\u4E0E\u300C\u7F6E\u9876\u300D\u300C\u79FB\u9664\u300D\u90A3\u4E24\u884C
|
|
232
|
+
\u540C\u4E00\u652F\u4F4D\uFF0C\u56FE\u6807\u5927\u5C0F\u4E00\u4E0D\u4E00\u5217\u624D\u4E0D\u6296\u3002 */
|
|
233
|
+
.capital-watchlist-checkicon { display: inline-flex; flex: none; width: 14px; height: 14px; align-items: center; justify-content: center; color: var(--dsw-alias-menu-icon); }
|
|
234
|
+
.capital-watchlist-checklabel { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
235
|
+
/* \u6BD4\u4F8B\u90A3\u4E00\u884C\uFF1A\u6807\u9898\u5728\u5DE6\u3001\u2212/\u8BFB\u6570/+ \u5728\u540C\u4E00\u884C\u7684\u53F3\u8FB9\uFF082026-10-09 \u7528\u6237\u70B9\u540D"\u548C\u6807\u8BB0\u6301\u4ED3\u4E00\u4E2A\u7EA7\u522B"\uFF09\u3002 */
|
|
236
|
+
.capital-watchlist-stepper { box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 34px; padding: 6px 8px; border-radius: var(--dsw-radius-md); font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-primary); }
|
|
237
|
+
.capital-watchlist-stepperlabel { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
238
|
+
.capital-watchlist-stepperline { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: none; }
|
|
239
|
+
/* \u6B65\u8FDB\u952E\uFF1A\u5C0F\u65B9\u952E\uFF0C\u63CF\u8FB9\u4E0E\u5E95\u9762\u7167\u641C\u7D22\u6846\u90A3\u4E00\u6761\u53E3\u5F84\uFF08\u4E2D\u6027\u63CF\u8FB9 0.5px\uFF0C\u72B6\u6001\u8272\u624D 1px\uFF09\u3002
|
|
240
|
+
\u534A\u5F84\u523B\u610F\u5199 8px \u800C\u4E0D\u662F 999px / 50%\uFF1A\u9762\u677F\u6709\u4E00\u6761"\u6B63\u5706\u4E0E\u80F6\u56CA\u5FC5\u987B\u914D corner-shape: round"\u7684
|
|
241
|
+
\u8BA1\u6570\u95F8\u95E8\uFF0C\u4E3A\u4E00\u9897\u6309\u952E\u591A\u914D\u4E00\u5BF9\u6CA1\u6709\u610F\u4E49\u3002 */
|
|
242
|
+
.capital-watchlist-stepperbtn { flex: none; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border: 0.5px solid var(--dsw-alias-border-l1); border-radius: 8px; background: var(--dsw-alias-bg-module-platform); color: var(--dsw-alias-label-secondary); font-family: inherit; font-size: 15px; line-height: 1; cursor: pointer; }
|
|
243
|
+
.capital-watchlist-stepperbtn:hover:not(:disabled) { background: var(--dsw-alias-interactive-bg-hover-accent); }
|
|
244
|
+
.capital-watchlist-stepperbtn:disabled { opacity: .45; cursor: not-allowed; }
|
|
245
|
+
/* \u8BFB\u6570\uFF1Amin-width \u8BA9 0~100 / 10% / 100% \u8FD9\u51E0\u79CD\u5199\u6CD5\u90FD\u4E0D\u628A\u4E24\u8FB9\u7684\u952E\u63A8\u8D70\uFF08\u6570\u5B57\u7528 tabular-nums\uFF09\u3002
|
|
246
|
+
\u6CA1\u586B\u7684\u65F6\u5019\u663E\u793A\u7684\u5C31\u662F\u8FD9\u4E00\u683C\u7684**\u5269\u4F59\u989D\u5EA6**\uFF080~N\uFF09\uFF0C\u4E0D\u518D\u5199"\u672A\u586B"\uFF08\u7528\u6237\u70B9\u540D\u7528 placeholder \u63D0\u793A\uFF09\uFF1B
|
|
247
|
+
placeholder \u964D\u4E00\u6863\u989C\u8272\uFF0C\u514D\u5F97"\u6CA1\u8FD9\u4E2A\u6570"\u8BFB\u8D77\u6765\u50CF\u4E00\u4E2A\u6570\u3002 */
|
|
248
|
+
.capital-watchlist-stepperreadout { min-width: 46px; text-align: center; font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; color: var(--dsw-alias-label-primary); }
|
|
249
|
+
.capital-watchlist-stepperplaceholder { color: var(--dsw-alias-label-tertiary); }
|
|
250
|
+
/* \u26D4 \u8FD9\u5F20\u83DC\u5355\u5FC5\u987B**\u56FA\u5B9A\u5BBD\u5EA6**\uFF0C\u4E0D\u80FD\u6309\u5185\u5BB9\u957F\u3002\u5B98\u65B9 .list \u53EA\u7ED9 min-width\uFF08\u6536\u7F29\u5230\u5185\u5BB9\u5BBD\uFF09\uFF0C
|
|
251
|
+
\u800C\u6211\u4EEC\u662F align:'end' \u8D34\u53F3\u7F18\u5F00\u7684\u2014\u2014\u6BD4\u4F8B\u90A3\u4E00\u884C\u4E00\u51FA\u73B0\u5C31\u628A\u5217\u8868\u6491\u5BBD\u51E0\u5341\u50CF\u7D20\uFF0C\u5DE6\u7F18\u6574\u5757\u8DF3\u4E00\u4E0B
|
|
252
|
+
\uFF082026-10-09 \u5B9E\u673A\uFF1A"\u70B9\u51FB\u6807\u8BB0\u540E\u6574\u4E2A div \u4E25\u91CD\u4F4D\u79FB"\uFF09\u3002\u540C\u4E00\u5904\u5185\u5BB9\u8D85\u51FA\u8FD8\u4F1A\u957F\u51FA\u6A2A\u5411\u6EDA\u52A8\u6761\uFF1A
|
|
253
|
+
.scrollable .viewport \u5199\u4E86 overflow-y:auto\uFF0C\u6309 CSS \u53E3\u5F84 overflow-x \u5C31\u8BA1\u7B97\u6210 auto\u3002
|
|
254
|
+
256 = \u5217\u8868\u81EA\u8EAB 4px padding \xD7 2 + \u6700\u5BBD\u90A3\u4E00\u884C\u7684\u5185\u5BB9\uFF08\u56FE\u6807\u884C\u4E0E\u6BD4\u4F8B\u884C\u90FD\u5728 205 \u4E0A\u4E0B\uFF09\uFF0C
|
|
255
|
+
\u4E2D\u82F1\u4E24\u5957\u8BED\u8A00\u90FD\u4E0D\u622A\u65AD\u3002 */
|
|
256
|
+
.capital-watchlist-rows { width: 256px; }
|
|
257
|
+
/* \u884C\u5185\u7684\u6BCF\u4E00\u9897\u6309\u94AE\u90FD\u6309 border-box \u7B97\u5BBD\uFF1A\u5B98\u65B9 .item \u662F width:100% + padding 6px 8px \u800C**\u6CA1\u6709**
|
|
258
|
+
\u58F0\u660E box-sizing\uFF08\u8FD9\u5957\u4E3B\u9898\u6CA1\u6709\u5168\u5C40 border-box \u91CD\u7F6E\uFF0C\u53EA\u6709 .list / .root \u81EA\u5DF1\u58F0\u660E\u4E86\uFF09\uFF0C\u4E8E\u662F\u5B83\u5929\u7136
|
|
259
|
+
\u6BD4\u5217\u8868\u5185\u5BB9\u76D2\u5BBD 16px\u2014\u2014\u90A3 16px \u5C31\u662F\u4E0A\u9762\u90A3\u6761\u6A2A\u5411\u6EDA\u52A8\u6761\u7684\u53E6\u4E00\u534A\u3002
|
|
260
|
+
\u9009\u62E9\u5668\u6839\u5728\u6211\u4EEC\u81EA\u5DF1\u6302\u5728 portal \u5217\u8868\u4E0A\u7684\u7C7B\uFF0C\u6240\u4EE5\u591F\u5F97\u7740\uFF08\u540E\u4EE3\u94FE\u6CA1\u6709\u79BB\u5F00\u8FD9\u5F20\u5217\u8868\uFF09\u3002 */
|
|
261
|
+
.capital-watchlist-rows button { box-sizing: border-box; }
|
|
262
|
+
`;function Qt(){let e=globalThis.document;if(!e||typeof e.createElement!="function"||e.querySelector(`style[data-${D}]`))return;let a=e.createElement("style");a.setAttribute(`data-${D}`,""),a.textContent=qt;let t=e.head??e.body;if(!(t===void 0||typeof t.appendChild!="function"))return t.appendChild(a),()=>a.remove()}async function w(e,{query:a,body:t,signal:s}={}){let i=a!==void 0?`${j}${e}?${a}`:`${j}${e}`,d=t===void 0?{method:"GET",cache:"no-store",credentials:"same-origin",signal:s}:{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t),credentials:"same-origin",signal:s},n=await fetch(i,d),c=await n.text(),o={};try{o=c.length>0?JSON.parse(c):{}}catch{o={}}if(n.ok===!0&&o.ok===!0)return o;let p=typeof o.code=="string"&&o.code.length>0?o.code:n.status===401||n.status===403?"unauthorized":"fuyao_unavailable",h=new Error(p);throw h.code=p,h.candidates=o.candidates,h.limit=o.limit,h}var q=()=>({open:!1,loading:!1,refreshing:!1,searching:!1,items:[],candidates:[],truncated:!1,marketFilter:"all",query:"",dropdownOpen:!1,rowMenu:null,pendingRemove:null,refreshed_at:null,error:null,searchError:null,searchPartial:null,addError:null,loadError:null,failures:{},composing:!1,pendingSearch:!1}),E=class{constructor(){this.store=xt(q()),this.searchController=null,this.timer=null,this.pending=null,this.lastQuery=null,this.holdingOps=new Map}get state(){return this.store}get snapshot(){return this.store.getSnapshot()}patch(a){this.store.update(t=>Object.assign(t,a))}open(){this.patch({...q(),open:!0,loading:!0}),this.load().then(()=>this.refresh(),()=>this.patch({loading:!1}))}close(){this.timer!==null&&clearTimeout(this.timer),this.searchController!==null&&this.searchController.abort(),this.lastQuery=null,this.patch({open:!1,rowMenu:null,composing:!1,pendingSearch:!1}),this.holdingOps.clear()}async load(){try{let a=await w("/list");this.holdingOps.clear(),this.patch({items:y(a.items)??[],seeded_at:a.seeded_at,loading:!1,loadError:null})}catch(a){throw this.patch({loading:!1,loadError:{code:a.code??"fuyao_unavailable"}}),a}}refresh(){if(this.pending!==null)return this.pending;this.patch({refreshing:!0});let a=w("/refresh",{body:{}}).then(t=>{let s={};for(let n of t.failures??[])s[n.thscode]=n.code;let i=y(t.items),d=i??this.snapshot.items;i!==null&&this.holdingOps.clear(),this.patch({items:d,refreshed_at:t.refreshed_at??this.snapshot.refreshed_at,failures:s,error:t.error?{code:t.error.code,partial:d.length>0&&d.some(n=>s[n.thscode]===void 0)}:null})}).catch(t=>{this.patch({error:{code:t.code??"fuyao_unavailable",partial:this.snapshot.items.some(s=>s.quote!==null)}})}).finally(()=>{this.patch({refreshing:!1}),this.pending=null});return this.pending=a,a}onQueryChange(a,t){let s=a.trim(),i=t===void 0?this.snapshot.composing===!0:t===!0;if(this.patch({query:a,searchError:null,composing:i,dropdownOpen:s.length>0}),this.timer!==null&&clearTimeout(this.timer),s.length===0){this.searchController!==null&&this.searchController.abort(),this.lastQuery=null,this.patch({candidates:[],truncated:!1,searching:!1,pendingSearch:!1});return}s===this.lastQuery&&this.snapshot.pendingSearch===!1||(this.patch({candidates:[],truncated:!1,pendingSearch:!i}),i!==!0&&(this.timer=setTimeout(()=>this.search(s),Ht)))}beginComposition(){this.timer!==null&&clearTimeout(this.timer),this.patch({composing:!0})}endComposition(a){this.onQueryChange(a,!1)}hideDropdown(){this.patch({dropdownOpen:!1})}setMarketFilter(a){B.some(t=>t.id===a)&&this.patch({marketFilter:a})}toggleRowMenu(a){this.patch({rowMenu:this.snapshot.rowMenu===a?null:a})}closeRowMenu(){this.snapshot.rowMenu!==null&&this.patch({rowMenu:null})}setPendingRemove(a){this.patch({pendingRemove:a??null})}replaceRow(a){let[t]=y([a]);t===void 0||typeof t?.thscode!="string"||this.patch({items:this.snapshot.items.map(s=>s.thscode===t.thscode?t:s)})}async search(a){this.lastQuery=a,this.searchController!==null&&this.searchController.abort();let t=new AbortController;this.searchController=t,this.patch({searching:!0,searchError:null,searchPartial:null});let s=()=>this.snapshot.query.trim()===a;try{let i=await w("/search",{query:`q=${encodeURIComponent(a)}`,signal:t.signal});if(!s()){this.patch({searching:!1});return}this.patch({candidates:y(i.items)??[],truncated:i.truncated===!0,searching:!1,pendingSearch:!1,searchPartial:Array.isArray(i.partial)&&i.partial.length>0?i.partial:null})}catch(i){if(i.name==="AbortError"||(this.lastQuery===a&&(this.lastQuery=null),!s()))return;this.patch({candidates:[],truncated:!1,searching:!1,pendingSearch:!1,searchError:{code:i.code??"fuyao_unavailable"},searchPartial:null})}}async add(a){try{await w("/add",{body:{thscode:a.thscode}})}catch(s){this.patch({addError:{code:s.code??"fuyao_unavailable",candidates:s.candidates,limit:s.limit}}),s.candidates!==void 0&&this.patch({candidates:s.candidates,truncated:!1});return}this.patch({addError:null,candidates:this.snapshot.candidates.map(s=>s.thscode===a.thscode?{...s,in_list:!0}:s)}),await this.load().catch(()=>{}),await this.refresh();let t=this.snapshot.items.find(s=>s.thscode===a.thscode);t!==void 0&&t.quote===null&&this.snapshot.failures[a.thscode]===void 0&&await this.refresh()}async remove(a){let t=this.snapshot.items;this.patch({items:t.filter(s=>s.thscode!==a),rowMenu:null});try{await w("/remove",{body:{thscode:a}}),this.snapshot.addError?.code==="list_full"&&this.patch({addError:null})}catch{this.patch({items:t})}}async pin(a){let t=this.snapshot.items,s=t.find(i=>i.thscode===a);if(s!==void 0){this.patch({items:[s,...t.filter(i=>i.thscode!==a)],rowMenu:null});try{let i=await w("/pin",{body:{thscode:a}});Array.isArray(i.items)&&this.patch({items:y(i.items)})}catch{let i=this.snapshot.items,d=t.map(c=>i.find(o=>o.thscode===c.thscode)).filter(Boolean),n=new Set(d.map(c=>c.thscode));this.patch({items:[...d,...i.filter(c=>!n.has(c.thscode))]})}}}async writeHolding(a,t,s){let i=this.snapshot.items.find(o=>o.thscode===a);if(i===void 0)return;let d=this.holdingOps.get(a)??{seq:0,baseline:i};this.holdingOps.set(a,d);let n=++d.seq;this.patch({items:this.snapshot.items.map(o=>o.thscode===a?s(o):o)});let c=()=>this.holdingOps.get(a)!==d||d.seq!==n;try{let o=await w("/holding",{body:t});if(c())return;this.replaceRow(o.item),d.baseline=o.item??s(i),this.holdingOps.delete(a)}catch{if(c())return;this.replaceRow(d.baseline),this.holdingOps.delete(a)}}markHolding(a,t){return this.writeHolding(a,{thscode:a,weight_pct:t},s=>({...s,holding:{weight_pct:t,marked_at:Date.now()}}))}clearHolding(a){return this.writeHolding(a,{thscode:a,clear:!0},t=>{let s={...t};return delete s.holding,s})}stepHolding(a,t){let s=this.snapshot.items,i=s.find(n=>n.thscode===a)?.holding?.weight_pct;if(typeof i!="number"&&t<0)return;let d=Math.min(W(s,a),Math.max(0,(typeof i=="number"?i:0)+t));if(d!==i)return this.markHolding(a,d)}async copyToClipboard(){let a=this.snapshot.items.map(t=>[t.thscode,T(t.name),t.asset_type,t.quote?.price??"",t.quote?.change_pct??"",t.quote?.captured_at??""].join(" ")).join(`
|
|
263
|
+
`);return await navigator.clipboard.writeText(a),a}dispose(){this.timer!==null&&clearTimeout(this.timer),this.searchController!==null&&this.searchController.abort()}};function K(e){if(typeof e!="number"||!Number.isFinite(e))return"";let a=new Date(e),t=s=>String(s).padStart(2,"0");return`${t(a.getMonth()+1)}-${t(a.getDate())} ${t(a.getHours())}:${t(a.getMinutes())}`}function Q({assetType:e,t:a}){return l("span",{className:`capital-watchlist-tag ${Ut[e]??"capital-watchlist-tag-cn"}`},Lt(e,a))}function Wt(e,a,t){let s=T(e.name);return`${a(`${t}PromptPrefix`)}${s} (${e.thscode} \xB7 ${jt(e.asset_type,a)})${a(`${t}PromptSuffix`)}`}function Bt({quote:e,failureCode:a,refreshing:t,t:s}){let i=a!==void 0;if(e==null)return t===!0?l("div",{className:"capital-watchlist-quote"},l("span",{className:"capital-watchlist-skeleton capital-watchlist-skeleton-price"}),l("span",{className:"capital-watchlist-skeleton capital-watchlist-skeleton-change"})):i?l("div",{className:"capital-watchlist-quote",title:s(`error.${a}`)},l("div",{className:"capital-watchlist-price capital-watchlist-quotefailed"},"\u2014")):l("div",{className:"capital-watchlist-quote"},l("div",{className:"capital-watchlist-price"},s("notRefreshed")));let d=typeof e.change_pct=="number"&&Number.isFinite(e.change_pct),n=d?`${e.change_pct>0?"+":""}${e.change_pct.toFixed(2)}%`:"\u2014",c=i?"capital-watchlist-stale":d?e.change_pct>0?"capital-watchlist-up":e.change_pct<0?"capital-watchlist-down":"capital-watchlist-flat":"capital-watchlist-nodata",o=typeof e.source_time=="string"&&e.source_time.length>0?`${s("exchangeTime")} ${e.source_time}`:"",p=[];return i?p.push(`${s(`error.${a}`)} \xB7 ${s("stale")} ${K(e.captured_at)}`):d||p.push(s("noChangePct")),o.length>0&&p.push(o),l("div",{className:"capital-watchlist-quote",title:p.length===0?void 0:p.join(" \xB7 ")},l("div",{className:i?"capital-watchlist-price capital-watchlist-stale":"capital-watchlist-price"},e.price.toFixed(2)),l("div",{className:`capital-watchlist-change ${c}`},n))}function Kt(e,a){if(a.code!=="list_full")return e(`error.${a.code}`);let t=a.limit;return typeof t!="number"||!Number.isFinite(t)?e("error.list_full_noMax"):e("error.list_full").replace("{max}",String(t))}function Yt(e,a){let t=e?.weight_pct;return t==null?a("holdingName"):`${a("holdingName")} ${t}%`}function Gt(e,a){let t=`${e.name} ${e.ticker}`;return e.holding===null||e.holding===void 0?t:`${t} \xB7 ${Yt(e.holding,a)}`}function Xt({useDialog:e,surface:a,t,inputActions:s}){let i=e(r=>r),[d,n]=M(!1),[c,o]=M(null),p=i.pendingRemove??null;if(bt(()=>()=>a.dispose(),[a]),!i.open)return null;let h=i.dropdownOpen===!0,g=p!==null,Y=r=>{if(r.key==="Escape"){if(g){r.stopPropagation(),a.setPendingRemove(null);return}h&&(r.stopPropagation(),a.hideDropdown())}},G=r=>{if(!h)return;let m=r.relatedTarget;m!=null&&r.currentTarget?.contains?.(m)===!0||a.hideDropdown()},b=i.error,X=b==null?null:l("p",{className:"capital-watchlist-notice",role:"alert","data-code":b.code},`${t(`error.${b.code}`)}${b.partial===!0?t("errorSuffix"):""}`),A=(r,m)=>{s.insertText(Wt(r,t,m),s.captureInsertion())===!0&&a.close()},v=i.marketFilter==="all"?i.candidates:i.candidates.filter(r=>U(r)===i.marketFilter),$={all:i.candidates.length,cn:0,hk:0,us:0};for(let r of i.candidates)$[U(r)]+=1;let J=i.candidates.length===0?null:l("div",{className:"capital-watchlist-filter",role:"group","aria-label":t("filterLabel")},B.map(r=>l("button",{key:r.id,type:"button",className:"capital-watchlist-filterbtn","aria-pressed":i.marketFilter===r.id,onClick:()=>a.setMarketFilter(r.id)},l("span",{className:"capital-watchlist-filterlabel"},r.id==="all"?t("filterAll"):r.label),l("span",{className:"capital-watchlist-filtercount"},String($[r.id]))))),V=h?l("div",{className:"capital-watchlist-dropdown","aria-label":t("title"),"data-menu-material":"translucent"},J,l("div",{className:"capital-watchlist-options",role:"listbox","aria-label":t("title")},v.map(r=>l("button",{key:r.thscode,type:"button",role:"option",className:"capital-watchlist-option",title:r.name,"aria-disabled":r.in_list===!0||c===r.thscode,onClick:()=>{r.in_list===!0||c===r.thscode||(n(!0),o(r.thscode),a.add(r).finally(()=>{n(!1),o(null)}))}},l("span",{className:"capital-watchlist-optionmain"},l("span",{className:"capital-watchlist-optionname"},r.name),l("span",{className:"capital-watchlist-codeline"},l("span",{className:"capital-watchlist-optioncode"},r.thscode),l(Q,{assetType:r.asset_type,t}))),l("span",{className:"capital-watchlist-addbtn","data-state":r.in_list===!0?"added":"idle"},r.in_list===!0?t("added"):t("add")))),i.truncated===!0&&v.length>0?l("div",{className:"capital-watchlist-hint capital-watchlist-endhint"},t("truncated")):null),i.composing===!0?l("div",{className:"capital-watchlist-hint"},t("composingHint")):i.searching===!0||i.pendingSearch===!0?l("div",{className:"capital-watchlist-hint"},t("searching")):i.searchError!==null&&i.searchError!==void 0?l("div",{className:"capital-watchlist-hint capital-watchlist-searcherror",role:"alert","data-code":i.searchError.code},t(`error.${i.searchError.code}`)):i.candidates.length===0?l("div",{className:"capital-watchlist-hint"},t("noHit")):v.length===0?l("div",{className:"capital-watchlist-hint","data-filter":i.marketFilter},t("filterNoHit")):null,...(i.searchPartial??[]).map(r=>l("div",{key:`partial-${r.market}`,className:"capital-watchlist-hint capital-watchlist-searcherror",role:"status","data-market":r.market,"data-code":r.code},`${t(`partial.${r.market}`)}${t(`error.${r.code}`)}`))):null,Z=i.items.length===0?null:l("div",{className:"capital-watchlist-grid capital-watchlist-head"},l("span",null,t("colName")),l("span",{className:"capital-watchlist-quote"},t("colQuote")),l("span",{className:"capital-watchlist-headaction"},t("colAction"))),tt=i.loadError!==null&&i.loadError!==void 0?l("p",{className:"capital-watchlist-empty capital-watchlist-loaderror",role:"alert","data-code":i.loadError.code},t(`error.${i.loadError.code}`)):l("p",{className:"capital-watchlist-empty"},t("empty")),at=i.loading?l("p",{className:"capital-watchlist-empty"},t("loading")):i.items.length===0?tt:l("div",{className:h?"capital-watchlist-list capital-watchlist-list-open":"capital-watchlist-list"},i.items.map((r,m)=>{let x=r.holding!==null&&r.holding!==void 0,u=r.holding?.weight_pct,it=F(r)||x,k=W(i.items,r.thscode),lt=!x||u===null||u===void 0||u<=0,rt=(typeof u=="number"?u:0)+C>k;return l("div",{key:r.thscode,className:"capital-watchlist-grid capital-watchlist-row","data-thscode":r.thscode},l("span",{className:"capital-watchlist-namewrap"},l("span",{className:x?"capital-watchlist-name capital-watchlist-name-held":"capital-watchlist-name",title:Gt(r,t)},r.name),l("span",{className:"capital-watchlist-codeline"},l("span",{className:"capital-watchlist-code"},r.ticker),l(Q,{assetType:r.asset_type,t}))),l(Bt,{quote:r.quote,failureCode:i.failures[r.thscode],refreshing:i.refreshing,t}),l("span",{className:"capital-watchlist-rowactions"},l("button",{type:"button",className:"capital-watchlist-predict",disabled:d,title:t("predictTip"),"aria-label":`${t("predict")} ${r.name}`,onClick:()=>A(r,"predict")},l(Nt,{size:14})),l("button",{type:"button",className:"capital-watchlist-review",disabled:d,title:t("reviewTip"),"aria-label":`${t("review")} ${r.name}`,onClick:()=>A(r,"review")},l(St,{size:14})),l(At,{open:i.rowMenu===r.thscode,anchor:l("button",{type:"button",className:"capital-watchlist-more",disabled:d,title:t("more"),"aria-label":`${t("more")} ${r.name}`,"aria-haspopup":"menu","aria-expanded":i.rowMenu===r.thscode,onClick:()=>a.toggleRowMenu(r.thscode)},l(kt,{size:14})),items:[{id:"pin",label:t("pin"),icon:l(_t,{size:14}),disabled:m===0}],children:[...it?[l("div",{key:"holding-check",role:"group","aria-label":t("holdingName"),className:"capital-watchlist-checkrow"},l("span",{className:"capital-watchlist-checkicon","aria-hidden":"true"},l(vt,{size:14})),l("span",{className:"capital-watchlist-checklabel"},t("holdingName")),l(It,{checked:x,disabled:d,label:t("holdingName"),onChange:N=>N?a.markHolding(r.thscode,null):a.clearHolding(r.thscode)}))]:[],...x&&F(r)?[l("div",{key:"holding-step",className:"capital-watchlist-stepper",role:"group","aria-label":t("holdingStepper")},l("span",{className:"capital-watchlist-stepperlabel"},t("holdingWeightLabel")),l("span",{className:"capital-watchlist-stepperline"},l("button",{type:"button",className:"capital-watchlist-stepperbtn","aria-label":t("holdingStepDown"),disabled:lt,onClick:()=>a.stepHolding(r.thscode,-C)},"\u2212"),l("span",{className:typeof u=="number"?"capital-watchlist-stepperreadout":"capital-watchlist-stepperreadout capital-watchlist-stepperplaceholder",role:"status"},typeof u=="number"?`${u}%`:`0~${k}`),l("button",{type:"button",className:"capital-watchlist-stepperbtn","aria-label":t("holdingStepUp"),title:`0~${k}`,disabled:rt,onClick:()=>a.stepHolding(r.thscode,C)},"+")))]:[],l($t,{key:"remove",danger:!0,separatorBefore:!0,icon:l(Tt,{size:14}),onSelect:()=>{a.closeRowMenu(),a.setPendingRemove(r)}},t("remove"))],onSelect:N=>{N==="pin"&&(a.closeRowMenu(),a.pin(r.thscode))},onClose:()=>a.closeRowMenu(),align:"end",portal:!0,listClassName:"capital-watchlist-rows",className:"capital-watchlist-actions"})))})),et=l("div",{className:g?"capital-watchlist-confirm capital-watchlist-confirm-open":"capital-watchlist-confirm","aria-hidden":g?void 0:"true"},l("div",{className:"capital-watchlist-confirmbox",role:g?"alertdialog":void 0,"aria-label":t("confirmTitle")},l("div",{className:"capital-watchlist-confirmtitle"},t("confirmTitle")),g?l("p",{className:"capital-watchlist-confirmdesc"},t("confirmDescPrefix"),l("strong",null,`${p.name} \xB7 ${p.ticker}`),t("confirmDescSuffix")):null,l("div",{className:"capital-watchlist-confirmactions"},l("button",{type:"button",className:"capital-watchlist-confirmbtn",onClick:()=>a.setPendingRemove(null)},t("confirmCancel")),l("button",{type:"button",className:"capital-watchlist-confirmbtn capital-watchlist-confirmdanger",onClick:()=>{let r=p;a.setPendingRemove(null),r!==null&&a.remove(r.thscode)}},t("confirmOk")))));return l(Pt,{open:!0,onClose:()=>a.close(),title:t("title"),headless:!0,shortcutModal:"watchlist",className:"capital-watchlist-dialog"},l("div",{className:"capital-watchlist-card",onKeyDown:Y},l("div",{className:"capital-watchlist-header"},l("h2",{className:"capital-watchlist-title"},t("title")),l("button",{type:"button",className:"capital-watchlist-close","aria-label":t("close"),onClick:()=>a.close()},l(O,{size:14}))),l("div",{className:"capital-watchlist-search",onBlur:G},l("div",{className:"capital-watchlist-field"},l("span",{className:"capital-watchlist-searchicon"},l(Et,{size:16})),l("input",{className:"capital-watchlist-input","data-modal-autofocus":!0,value:i.query,placeholder:t("searchPlaceholder"),onChange:r=>a.onQueryChange(r.target.value,r.isComposing),onCompositionStart:()=>a.beginComposition(),onCompositionEnd:r=>a.endComposition(r.target.value)}),i.query.length>0?l("button",{type:"button",className:"capital-watchlist-clear",title:t("clearInput"),"aria-label":t("clearInput"),onMouseDown:r=>r.preventDefault(),onClick:()=>a.onQueryChange("",!1)},l(O,{size:12})):null),V),i.addError!==null&&i.addError!==void 0?l("p",{className:"capital-watchlist-adderror",role:"status","data-code":i.addError.code},Kt(t,i.addError)):null,Z,at,l("div",{className:"capital-watchlist-footer"},l("div",{className:"capital-watchlist-footcol"},l("button",{type:"button",className:"capital-watchlist-refresh",disabled:i.refreshing||d,onClick:()=>{a.refresh()}},l(Ct,{size:14}),i.refreshing?t("refreshing"):t("refresh")),X),l("span",{className:"capital-watchlist-updated"},`${t("updated")} ${i.refreshed_at===null||i.refreshed_at===void 0?t("notRefreshed"):K(i.refreshed_at)}`)),et))}function Jt(e){e.effect(Qt,`${f}: styles`),e.effect(()=>e.locale.register(_,{zh:zt,en:Mt}),`${f}: dictionaries`);let a=new Map,t=n=>{let c=a.get(n);return c===void 0&&(c=new E,a.set(n,c)),c};e.effect(()=>()=>{for(let n of a.values())n.dispose();a.clear()},`${f}: per-session surfaces`);let s=n=>{let o=e.sessions?.list?.getSnapshot?.().byId?.[n]?.projectionValues?.agentPreset;return typeof o=="string"?o:void 0},i=new Set,d=n=>{let c=s(n);return c!==void 0?c===Rt:(i.has(n)||(i.add(n),Promise.resolve(e.sessions?.refreshProjections?.(n)).catch(()=>{})),!1)};e.slots.inject(L,()=>e.slots.register({name:L,id:"capital-watchlist-dialog",order:3,locale:_,inject:n=>{let c=t(n);return{hooks:{dialog:c.state},surface:c}}},Xt)),e.inject(["commandUi"],n=>{let c=e.locale.bind(_);n.effect(()=>n.commandUi.register({name:"watchlist",label:()=>c("command.label"),description:()=>c("command.description"),icon:yt,available:o=>d(o.sessionId),ui:{kind:"action",run:o=>{t(o.sessionId).open()}}}),`${f}: /watchlist contribution`)}),e.logger?.info?.(`${f}: \u5BA2\u6237\u7AEF\u534A\u8FB9\u5DF2\u6302\u8F7D\uFF08/watchlist \u83DC\u5355\u884C + \u81EA\u9009\u80A1\u5F39\u7A97\uFF09`)}exports.name=f;exports.inject=["slots","locale","commandUi","sessions"];exports.apply=Jt;
|
|
223
264
|
return module.exports
|
|
224
265
|
},
|
|
225
266
|
})
|