Repository navigation
Expand file tree
/
Copy pathtimeline.html
More file actions
698 lines (646 loc) · 23.9 KB
/
Copy pathtimeline.html
File metadata and controls
698 lines (646 loc) · 23.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="theme-color" content="#FAFAF9">
<title>相位演变时间线 — Phase Detector</title>
<meta name="description" content="一家公司 10-15 年走过的结构相位切换,每个点配触发条件和关键数据。">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Serif+SC:wght@400;500;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js"></script>
<style>
:root {
--bg: #FAFAF9;
--bg-elevated: #FFFFFF;
--bg-card: #F4F4F5;
--border: #E4E4E7;
--border-strong: #D4D4D8;
--text: #18181B;
--text-secondary: #52525B;
--text-muted: #71717A;
--text-dim: #A1A1AA;
--accent: #2563EB;
--accent-dim: rgba(37, 99, 235, 0.08);
--green: #059669;
--amber: #D97706;
--red: #DC2626;
--mono: 'JetBrains Mono', 'Menlo', monospace;
--serif: 'Noto Serif SC', 'Times New Roman', serif;
--sans: 'Inter', -apple-system, system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
background: var(--bg);
color: var(--text);
font-family: var(--sans);
font-size: 15px;
line-height: 1.7;
-webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.site {
border-bottom: 1px solid var(--border);
padding: 20px 0;
position: sticky; top: 0;
background: rgba(250, 250, 249, 0.88);
backdrop-filter: saturate(180%) blur(12px);
z-index: 100;
}
.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.nav { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--text); }
.brand-mark { width: 20px; height: 20px; border: 1.5px solid var(--accent); border-radius: 50%; position: relative; }
.brand-mark::before { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); }
.brand-beta { font-size: 10px; padding: 2px 6px; background: var(--accent-dim); color: var(--accent); border-radius: 3px; font-weight: 600; }
nav.menu a { margin-left: 20px; font-size: 14px; color: var(--text-muted); }
nav.menu a:hover { color: var(--text); text-decoration: none; }
main { padding: 40px 0 100px; }
.hero {
margin-bottom: 36px;
text-align: left;
}
.hero-eyebrow {
font-family: var(--mono);
font-size: 11px;
color: var(--accent);
letter-spacing: 1.5px;
margin-bottom: 12px;
}
h1.hero-title {
font-family: var(--serif);
font-size: clamp(28px, 3.5vw, 38px);
font-weight: 600;
line-height: 1.25;
letter-spacing: -0.01em;
margin-bottom: 14px;
color: var(--text);
}
.hero-lede {
color: var(--text-secondary);
font-size: 15px;
max-width: 760px;
line-height: 1.75;
}
.picker {
padding: 18px 22px;
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: 10px;
margin-bottom: 36px;
display: flex;
gap: 12px;
align-items: center;
flex-wrap: wrap;
}
.picker label {
font-size: 13px;
color: var(--text-muted);
font-family: var(--mono);
text-transform: uppercase;
letter-spacing: 0.5px;
}
select.ticker-select {
flex: 1;
min-width: 260px;
padding: 9px 14px;
border: 1px solid var(--border-strong);
border-radius: 8px;
background: var(--bg);
font-size: 14px;
font-family: inherit;
color: var(--text);
}
select.ticker-select:focus { outline: none; border-color: var(--accent); }
.company-head {
margin-bottom: 32px;
padding: 20px 24px;
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: 10px;
display: flex;
gap: 16px;
align-items: baseline;
flex-wrap: wrap;
}
.company-head__ticker {
font-family: var(--mono);
font-size: 14px;
color: var(--accent);
letter-spacing: 1px;
}
.company-head__name {
font-family: var(--serif);
font-size: 22px;
font-weight: 600;
color: var(--text);
}
.company-head__industry {
font-size: 13px;
color: var(--text-muted);
}
/* Timeline */
.timeline-wrap {
position: relative;
padding: 60px 0 40px;
margin-bottom: 32px;
overflow-x: auto;
}
.timeline-track {
position: relative;
min-width: 700px;
padding: 30px 40px 60px;
}
.timeline-line {
position: absolute;
left: 40px;
right: 40px;
top: 60px;
height: 2px;
background: linear-gradient(to right,
var(--border-strong) 0%,
var(--accent) 15%,
var(--accent) 50%,
var(--amber) 85%,
var(--red) 100%);
border-radius: 1px;
}
.timeline-points {
position: relative;
display: flex;
justify-content: space-between;
}
.tl-point {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
cursor: pointer;
transition: transform 0.15s;
flex: 0 0 auto;
width: 180px;
}
.tl-point:hover { transform: translateY(-2px); }
.tl-point__dot {
width: 16px;
height: 16px;
border-radius: 50%;
background: var(--accent);
border: 3px solid var(--bg);
box-shadow: 0 0 0 2px var(--accent);
z-index: 2;
transition: all 0.15s;
}
.tl-point[data-active="true"] .tl-point__dot {
width: 22px;
height: 22px;
background: var(--bg);
border: 4px solid var(--accent);
box-shadow: 0 0 0 3px var(--accent-dim), 0 4px 12px rgba(37, 99, 235, 0.3);
}
.tl-point__year {
margin-top: 12px;
font-family: var(--mono);
font-size: 14px;
font-weight: 600;
color: var(--text);
}
.tl-point__phase {
margin-top: 6px;
font-size: 11px;
padding: 3px 10px;
border-radius: 999px;
font-family: var(--mono);
white-space: nowrap;
}
.tl-point__label {
margin-top: 8px;
font-size: 11px;
color: var(--text-muted);
text-align: center;
max-width: 160px;
line-height: 1.4;
}
/* Phase color chips — same as company.html */
.phase-stable { background: rgba(5, 150, 105, 0.10); color: var(--green); }
.phase-saturated { background: rgba(113, 113, 122, 0.10); color: var(--text-muted); }
.phase-growth_phase { background: var(--accent-dim); color: var(--accent); }
.phase-approaching_critical { background: rgba(217, 119, 6, 0.12); color: var(--amber); }
.phase-post_transition, .phase-unstable, .phase-contracting { background: rgba(220, 38, 38, 0.10); color: var(--red); }
/* Detail card below timeline */
.snapshot-detail {
padding: 32px 36px;
background: var(--bg-elevated);
border: 1px solid var(--border);
border-radius: 12px;
margin-bottom: 20px;
}
.snapshot-detail__head {
display: flex;
gap: 12px;
align-items: baseline;
flex-wrap: wrap;
margin-bottom: 18px;
padding-bottom: 14px;
border-bottom: 1px solid var(--border);
}
.snapshot-detail__year {
font-family: var(--serif);
font-size: 32px;
font-weight: 600;
color: var(--text);
}
.snapshot-detail__period {
font-size: 14px;
color: var(--text-muted);
}
.snapshot-section {
margin-bottom: 18px;
}
.snapshot-section__label {
font-family: var(--mono);
font-size: 10px;
color: var(--text-dim);
letter-spacing: 1.3px;
text-transform: uppercase;
margin-bottom: 6px;
}
.snapshot-section__text {
color: var(--text-secondary);
font-size: 15px;
line-height: 1.75;
}
.snapshot-eq {
padding: 12px 16px;
background: var(--bg-card);
border-radius: 6px;
font-family: var(--mono);
font-size: 14px;
color: var(--text);
overflow-x: auto;
}
.snapshot-eq .katex { color: var(--text); font-size: 1.05em; }
.metrics-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 10px;
margin-top: 4px;
}
.metric-item {
padding: 10px 14px;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 8px;
}
.metric-item__key {
font-family: var(--mono);
font-size: 10.5px;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 2px;
}
.metric-item__val {
font-size: 14px;
color: var(--text);
font-weight: 500;
}
.trigger-banner {
margin: 0 0 32px;
padding: 16px 22px;
background: #FFFBEB;
border: 1px solid rgba(217, 119, 6, 0.30);
border-left: 4px solid var(--amber);
border-radius: 0 8px 8px 0;
font-size: 14px;
line-height: 1.65;
color: var(--text);
}
.trigger-banner strong {
color: var(--amber);
font-weight: 600;
}
.loader {
padding: 60px 20px;
text-align: center;
color: var(--text-muted);
}
.loading-dots {
display: inline-flex;
gap: 6px;
margin-right: 10px;
}
.loading-dots span {
width: 6px; height: 6px; border-radius: 50%;
background: var(--accent); opacity: 0.4;
animation: dot-pulse 1.4s infinite ease-in-out;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-pulse {
0%, 60%, 100% { opacity: 0.3; transform: scale(0.9); }
30% { opacity: 1; transform: scale(1.1); }
}
.hint-box {
padding: 40px 32px;
background: var(--bg-elevated);
border: 1px dashed var(--border-strong);
border-radius: 12px;
text-align: center;
color: var(--text-muted);
font-size: 15px;
}
footer.site { padding: 40px 0; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); margin-top: 40px; }
.footer-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; }
.footer-links a { color: var(--text-muted); margin-left: 16px; }
@media (max-width: 680px) {
.timeline-wrap { padding: 30px 0 20px; }
.tl-point { width: 140px; }
.snapshot-detail { padding: 22px 20px; }
.snapshot-detail__year { font-size: 26px; }
}
</style>
</head>
<body>
<header class="site">
<div class="container nav">
<a href="/phase" class="brand">
<span class="brand-mark"></span>
Phase Detector
<span class="brand-beta">BETA</span>
</a>
<nav class="menu">
<a href="/phase/screener">筛选器</a>
<a href="/phase/timeline">相位演变</a>
<a href="/phase/analogy">类比引擎</a>
<a href="/phase/memo">Memo</a>
<a href="/phase/redteam">红队</a>
<a href="/phase/about">关于</a>
</nav>
</div>
</header>
<main>
<div class="container">
<section class="hero">
<div class="hero-eyebrow">PHASE EVOLUTION TIMELINE</div>
<h1 class="hero-title">这家公司<br>走过哪几个结构阶段?</h1>
<p class="hero-lede">
一家公司 10-15 年的演变,不是连续变化,而是由几次「结构切换」拼成的。
这里展示 20 家公司的历史相位节点——<strong>每次切换配触发条件和关键数据</strong>,让你看到历史上什么信号预示了结构性变化。
</p>
</section>
<div class="picker">
<label>选公司</label>
<select class="ticker-select" id="ticker-select" disabled>
<option>加载中…</option>
</select>
</div>
<div id="output">
<div class="hint-box">
选一家公司,看它 10-15 年走过的 3-4 个结构阶段和每次切换的触发条件。
<div style="margin-top: 10px; font-size: 13px; color: var(--text-dim);">
当前覆盖 20 家经典公司 · 数据由 Sonnet 4.5 生成
</div>
</div>
</div>
</div>
</main>
<footer class="site">
<div class="container footer-row">
<div>© 2026 Phase Detector · Structural Evolution Timeline</div>
<div class="footer-links">
<a href="/phase">Phase 首页</a>
<a href="https://github.com/dada8899/structural-isomorphism">GitHub</a>
</div>
</div>
</footer>
<script>
const escapeHtml = (s) => String(s || '').replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
const PHASE_CN = {
'growth_phase': '成长期',
'stable': '稳定',
'saturated': '饱和',
'approaching_critical': '接近临界',
'post_transition': '相变后',
'unstable': '失稳',
'contracting': '收缩',
};
// 把 LLM 输出的"半 LaTeX 半 Unicode 半中文"方程转成合法 KaTeX
function normalizeEquation(raw) {
if (!raw) return '';
let eq = String(raw);
// 1. 移除中文括号注释(如 "(双势阱)" "(传染病模型,I=采用者)")
// 检测:括号内包含任何 CJK 字符
eq = eq.replace(/\s*[(\(]\s*[^))]*[\u4e00-\u9fff][^))]*[)\)]/g, '');
// 2. Unicode 上标 → LaTeX
const sups = { '⁰':'0','¹':'1','²':'2','³':'3','⁴':'4','⁵':'5','⁶':'6','⁷':'7','⁸':'8','⁹':'9',
'ⁿ':'n','⁺':'+','⁻':'-','ⁱ':'i' };
eq = eq.replace(/[⁰¹²³⁴⁵⁶⁷⁸⁹ⁿ⁺⁻ⁱ]+/g, (m) => '^{' + [...m].map(c => sups[c] || c).join('') + '}');
// 3. Unicode 下标 → LaTeX
const subs = { '₀':'0','₁':'1','₂':'2','₃':'3','₄':'4','₅':'5','₆':'6','₇':'7','₈':'8','₉':'9',
'ᵢ':'i','ⱼ':'j','ₖ':'k','ₙ':'n','ₘ':'m' };
eq = eq.replace(/[₀₁₂₃₄₅₆₇₈₉ᵢⱼₖₙₘ]+/g, (m) => '_{' + [...m].map(c => subs[c] || c).join('') + '}');
// 4. Unicode 希腊字母 → LaTeX
const greek = {
'α':'\\alpha ','β':'\\beta ','γ':'\\gamma ','δ':'\\delta ','ε':'\\epsilon ',
'ζ':'\\zeta ','η':'\\eta ','θ':'\\theta ','ι':'\\iota ','κ':'\\kappa ',
'λ':'\\lambda ','μ':'\\mu ','ν':'\\nu ','ξ':'\\xi ','π':'\\pi ',
'ρ':'\\rho ','σ':'\\sigma ','τ':'\\tau ','υ':'\\upsilon ','φ':'\\phi ',
'χ':'\\chi ','ψ':'\\psi ','ω':'\\omega ',
'Γ':'\\Gamma ','Δ':'\\Delta ','Θ':'\\Theta ','Λ':'\\Lambda ','Ξ':'\\Xi ',
'Π':'\\Pi ','Σ':'\\Sigma ','Φ':'\\Phi ','Ψ':'\\Psi ','Ω':'\\Omega ',
};
eq = eq.replace(/[α-ωΑ-Ω]/g, c => greek[c] || c);
// 5. 数学算子和关系符号 → LaTeX
const ops = {
'∂':'\\partial ','∇':'\\nabla ','∞':'\\infty ','∑':'\\sum ','∏':'\\prod ','∫':'\\int ',
'→':'\\to ','←':'\\leftarrow ','↔':'\\leftrightarrow ','⟶':'\\longrightarrow ',
'≈':'\\approx ','≠':'\\neq ','≤':'\\leq ','≥':'\\geq ','±':'\\pm ','×':'\\times ','÷':'\\div ',
'·':'\\cdot ','∈':'\\in ','∉':'\\notin ','⊂':'\\subset ','⊃':'\\supset ','∪':'\\cup ','∩':'\\cap ',
'√':'\\sqrt',
};
eq = eq.replace(/[∂∇∞∑∏∫→←↔⟶≈≠≤≥±×÷·∈∉⊂⊃∪∩√]/g, c => ops[c] || c);
// 6. 其他残留中文(不在括号里的)→ 用 \text{...} 包起来
// 保守策略:找连续 CJK 片段包成 \text{}
eq = eq.replace(/[\u4e00-\u9fff]+/g, (m) => '\\text{' + m + '}');
// 7. 清理多余空白
eq = eq.replace(/\s+/g, ' ').trim();
return eq;
}
const FAMILY_CN = {
'ODE1_linear': '线性增长',
'ODE1_exponential_growth': '指数增长',
'ODE1_logistic': '逻辑斯蒂 S 曲线',
'ODE1_saturating': '饱和曲线',
'ODE1_exponential_decay': '指数衰减',
'ODE2_damped_oscillation': '阻尼振荡',
'Bistable_switch': '双稳态切换',
'Fold_bifurcation': '鞍结跳变',
'Hopf_bifurcation': 'Hopf 分岔',
'Phase_transition_1st': '一阶相变',
'Phase_transition_2nd': '二阶相变',
'Network_cascade': '网络级联',
'Power_law_distribution': '幂律分布',
'Self_fulfilling_prophecy': '反身性循环',
'PDE_reaction_diffusion': '反应扩散',
'Hysteresis_loop': '滞回环',
'Game_theoretic_equilibrium': '博弈均衡',
'Heavy_tail_extremal': '重尾极值',
};
let TIMELINE = null;
let ACTIVE_IDX = -1;
async function loadCompanies() {
try {
const r = await fetch('/phase/api/timeline/list');
const d = await r.json();
const sel = document.getElementById('ticker-select');
sel.innerHTML = '<option value="">— 请选择 —</option>' +
(d.tickers || []).map(t => `<option value="${escapeHtml(t.ticker)}">${escapeHtml(t.ticker)} · ${escapeHtml(t.name)} · ${escapeHtml(t.industry || '')}</option>`).join('');
sel.disabled = false;
const init = new URLSearchParams(window.location.search).get('t');
if (init && d.tickers.find(t => t.ticker === init)) {
sel.value = init;
onSelect();
}
} catch (e) {
document.getElementById('ticker-select').innerHTML = '<option>加载失败</option>';
}
}
async function onSelect() {
const sel = document.getElementById('ticker-select');
const ticker = sel.value;
const out = document.getElementById('output');
if (!ticker) return;
history.replaceState({}, '', `/phase/timeline?t=${encodeURIComponent(ticker)}`);
out.innerHTML = `<div class="loader"><span class="loading-dots"><span></span><span></span><span></span></span>加载 ${escapeHtml(ticker)} 时间线…</div>`;
try {
const r = await fetch(`/phase/api/timeline/${encodeURIComponent(ticker)}`);
if (!r.ok) throw new Error(`HTTP ${r.status}`);
TIMELINE = await r.json();
ACTIVE_IDX = TIMELINE.snapshots.length - 1; // 默认选最后一个(当前)
render();
} catch (e) {
out.innerHTML = `<div class="hint-box" style="color: var(--red);">加载失败: ${escapeHtml(e.message)}</div>`;
}
}
function render() {
if (!TIMELINE) return;
const out = document.getElementById('output');
const snaps = TIMELINE.snapshots || [];
// Company head
let html = `
<div class="company-head">
<span class="company-head__ticker">${escapeHtml(TIMELINE.ticker)}</span>
<span class="company-head__name">${escapeHtml(TIMELINE.name)}</span>
<span class="company-head__industry">· ${escapeHtml(TIMELINE.industry || '')}</span>
</div>
`;
// Timeline
html += `
<div class="timeline-wrap">
<div class="timeline-track" style="min-width: ${Math.max(700, snaps.length * 220)}px;">
<div class="timeline-line"></div>
<div class="timeline-points">
${snaps.map((s, i) => `
<div class="tl-point" data-idx="${i}" data-active="${i === ACTIVE_IDX}">
<div class="tl-point__dot"></div>
<div class="tl-point__year">${escapeHtml(String(s.year))}</div>
<span class="tl-point__phase phase-${escapeHtml(s.phase_state)}">${escapeHtml(PHASE_CN[s.phase_state] || s.phase_state)}</span>
<div class="tl-point__label">${escapeHtml(FAMILY_CN[s.dynamics_family] || s.dynamics_family)}</div>
</div>
`).join('')}
</div>
</div>
</div>
`;
// Selected snapshot detail
const s = snaps[ACTIVE_IDX];
if (s) {
const metrics = s.key_metrics || {};
const metricItems = Object.entries(metrics).map(([k, v]) => `
<div class="metric-item">
<div class="metric-item__key">${escapeHtml(k)}</div>
<div class="metric-item__val">${escapeHtml(String(v))}</div>
</div>
`).join('');
html += `
<div class="snapshot-detail">
<div class="snapshot-detail__head">
<span class="snapshot-detail__year">${escapeHtml(String(s.year))}</span>
<span class="snapshot-detail__period">${escapeHtml(s.period_label || '')}</span>
<span class="tl-point__phase phase-${escapeHtml(s.phase_state)}" style="font-size: 12px; padding: 4px 12px;">
${escapeHtml(PHASE_CN[s.phase_state] || s.phase_state)} · ${escapeHtml(FAMILY_CN[s.dynamics_family] || s.dynamics_family)}
</span>
</div>
${s.one_line ? `
<div class="snapshot-section">
<div class="snapshot-section__label">核心状态</div>
<div class="snapshot-section__text" style="font-size: 17px; color: var(--text); font-weight: 500;">${escapeHtml(s.one_line)}</div>
</div>
` : ''}
${s.why_this_phase ? `
<div class="snapshot-section">
<div class="snapshot-section__label">为什么是这个相位</div>
<div class="snapshot-section__text">${escapeHtml(s.why_this_phase)}</div>
</div>
` : ''}
${s.canonical_equation ? `
<div class="snapshot-section">
<div class="snapshot-section__label">对应方程</div>
<div class="snapshot-eq">$$${normalizeEquation(s.canonical_equation)}$$</div>
<div style="margin-top: 6px; font-size: 11px; color: var(--text-dim); font-family: var(--mono);">原始: ${escapeHtml(s.canonical_equation)}</div>
</div>
` : ''}
${metricItems ? `
<div class="snapshot-section">
<div class="snapshot-section__label">关键指标</div>
<div class="metrics-grid">${metricItems}</div>
</div>
` : ''}
</div>
`;
// Trigger to next (if not last)
if (s.trigger_to_next && ACTIVE_IDX < snaps.length - 1) {
const next = snaps[ACTIVE_IDX + 1];
html += `
<div class="trigger-banner">
<strong>⚡ 切换到下个阶段(${next.year})的触发条件:</strong><br>
${escapeHtml(s.trigger_to_next)}
</div>
`;
}
}
out.innerHTML = html;
// Bind clicks
out.querySelectorAll('.tl-point').forEach(pt => {
pt.addEventListener('click', () => {
ACTIVE_IDX = parseInt(pt.dataset.idx, 10);
render();
// Scroll snapshot detail into view
setTimeout(() => {
const el = document.querySelector('.snapshot-detail');
if (el) el.scrollIntoView({behavior: 'smooth', block: 'start'});
}, 50);
});
});
// KaTeX
if (window.renderMathInElement) {
renderMathInElement(out, {
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false},
],
throwOnError: false,
});
}
}
document.getElementById('ticker-select').addEventListener('change', onSelect);
loadCompanies();
</script>
<script src="/assets/js/product-switcher.js?v=20260417b"></script>
</body>
</html>