econtone-studio 0.0.0-stage → 1.0.0

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/lib/client.js ADDED
@@ -0,0 +1,4476 @@
1
+ window.__ModuleLoader__.load({
2
+ id: 'econtone-studio',
3
+ factory(require) {
4
+ const ReactMod = require('react');
5
+ const React = (ReactMod && typeof ReactMod.createElement === 'function')
6
+ ? ReactMod
7
+ : (ReactMod && ReactMod.default && typeof ReactMod.default.createElement === 'function'
8
+ ? ReactMod.default
9
+ : ReactMod);
10
+ const h = React.createElement;
11
+
12
+ const CSS = `.ets-root{
13
+ --bg:#ffffff; --card:#f4f5f7; --panel:#ffffff;
14
+ --surface:#ebedf2; --surface-2:#e2e6ec;
15
+ --line:#e3e6ea; --line-2:#d2d6df;
16
+ --ink:#15171f; --ink-2:#15171f; --ink-3:#4c5364; --muted:#6e7789;
17
+ --blue:#4D6BFE; --blue-d:#3B53E0; --blue-w:#eef1ff; --blue-line:#d5dcff;
18
+ --brand:var(--blue);
19
+ --gold:#C8941F; --gold-2:#E8B23A; --gold-w:#fbf3df; --gold-line:#eadcba;
20
+ --navy:#2A4A6B;
21
+ --ok:#1F8A5B; --ok-w:#e8f6ee; --warn:#A96A0C; --warn-w:#fdf3e2;
22
+ --err:#C8363B; --err-w:#fdeced;
23
+ --r:16px; --r-sm:12px; --r-xs:8px; --sb:256px;
24
+ --shadow:0 1px 2px rgba(21,23,31,.05), 0 10px 28px -20px rgba(21,23,31,.3);
25
+ }
26
+ @media (prefers-color-scheme: dark){
27
+ .ets-root{
28
+ --bg:#15161a; --card:#1c1e24; --panel:#24262e;
29
+ --surface:#2b2f38; --surface-2:#343945;
30
+ --line:#2f333c; --line-2:#3d424d;
31
+ --ink:#e8eaf0; --ink-2:#a8afbe; --ink-3:#7b8394; --muted:#7b8394;
32
+ --blue:#7d92ff; --blue-d:#6a80f5; --blue-w:#232842; --blue-line:#39406a;
33
+ --gold:#E0AE43; --gold-2:#E8B23A; --gold-w:#2e2717; --gold-line:#4a3d1f;
34
+ --navy:#9db8d6;
35
+ --ok:#43b581; --ok-w:#1e3329; --warn:#d19a45; --warn-w:#332916;
36
+ --err:#e2686c; --err-w:#3a2224;
37
+ --shadow:0 1px 2px rgba(0,0,0,.3), 0 10px 28px -20px rgba(0,0,0,.8);
38
+ }
39
+ }
40
+ .ets-root *{box-sizing:border-box;margin:0;padding:0;}
41
+ .ets-root{height:100%;}
42
+ .ets-root{font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei","Segoe UI",Roboto,sans-serif;
43
+ background:var(--bg);color:var(--ink);font-size:16px;line-height:1.6;-webkit-font-smoothing:antialiased;}
44
+ .ets-root button{font-family:inherit;color:inherit;background:none;border:none;cursor:pointer;}
45
+ .ets-root .mono{font-family:ui-monospace,"SF Mono",Cascadia Mono,Consolas,monospace;}
46
+ .ets-root .num{font-variant-numeric:tabular-nums;}
47
+ .ets-root .main{display:flex;flex-direction:column;min-width:0;min-height:0;background:var(--bg);}
48
+ .ets-root .tb{display:flex;align-items:center;gap:12px;padding:11px 22px;border-bottom:1px solid var(--line);
49
+ background:var(--panel);flex-wrap:wrap;row-gap:9px;flex:none;z-index:5;}
50
+ .ets-root .crumb{display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--ink-3);}
51
+ .ets-root .crumb b{color:var(--ink);font-weight:650;font-size:13.5px;}
52
+ .ets-root .doc.icon-only{padding:6px;}
53
+ .ets-root .icon-btn{display:inline-flex;align-items:center;justify-content:center;padding:6px;}
54
+ .ets-root .icon-btn svg{width:14px;height:14px;color:var(--ink-3);}
55
+ .ets-root .icon-btn:hover svg{color:var(--ink);}
56
+ .ets-root .doc.icon-only svg{width:16px;height:16px;}
57
+ .ets-root .doc{display:flex;align-items:center;gap:8px;padding:7px 11px;border:1px solid var(--line);
58
+ border-radius:var(--r-xs);background:var(--panel);font-size:13px;font-weight:550;}
59
+ .ets-root .doc:hover{border-color:var(--line-2);}
60
+ .ets-root .doc svg{width:15px;height:15px;color:var(--ink-3);}
61
+ .ets-root .doc .sha{font-size:10.5px;color:var(--ink-3);font-weight:400;}
62
+ .ets-root .tb .grow{flex:1;}
63
+ .ets-root .seg{display:inline-flex;background:var(--surface);border:1px solid var(--line);border-radius:var(--r-xs);padding:3px;gap:3px;}
64
+ .ets-root .seg button{padding:5px 13px;border-radius:6px;font-size:12.5px;color:var(--ink-2);font-weight:550;white-space:nowrap;}
65
+ .ets-root .seg button.on{background:var(--panel);color:var(--ink);box-shadow:0 1px 2px rgba(0,0,0,.07);}
66
+ .ets-root .seg button:hover:not(.on){color:var(--ink);}
67
+ .ets-root .lang{display:inline-flex;border:1px solid var(--line);border-radius:var(--r-xs);background:var(--surface);padding:3px;gap:3px;}
68
+ .ets-root .lang button{padding:5px 11px;border-radius:6px;font-size:11.5px;font-weight:700;letter-spacing:.5px;color:var(--ink-3);}
69
+ .ets-root .lang button.on{background:var(--panel);color:var(--ink);box-shadow:0 1px 2px rgba(0,0,0,.07);}
70
+ .ets-root .btn{display:inline-flex;align-items:center;gap:7px;padding:9px 17px;border-radius:10px;
71
+ font-size:13.5px;font-weight:650;border:1px solid transparent;transition:.15s;white-space:nowrap;}
72
+ .ets-root .btn svg{width:15px;height:15px;}
73
+ .ets-root .btn-ghost{border-color:var(--line-2);background:var(--panel);color:var(--ink-2);}
74
+ .ets-root .btn-ghost:hover{border-color:var(--blue);color:var(--blue);}
75
+ .ets-root .btn-primary{background:var(--blue);color:#fff;}
76
+ .ets-root .btn-primary:hover{background:var(--blue-d);}
77
+ .ets-root .btn-gold{border-color:var(--gold-line);background:var(--gold-w);color:var(--gold);}
78
+ .ets-root .btn-gold:hover{border-color:var(--gold);}
79
+ .ets-root .btn:active{transform:translateY(1px);}
80
+ .ets-root .btn[disabled]{opacity:.5;cursor:default;transform:none;}
81
+ .ets-root .content{flex:1;overflow:auto;min-height:0;background:var(--bg);scroll-behavior:smooth;}
82
+ .ets-root .wrap{max-width:1160px;margin:0 auto;padding:22px 26px 84px;}
83
+ .ets-root .hero{display:flex;align-items:center;gap:15px;padding:2px 2px 22px;}
84
+ .ets-root .hero-logo{width:46px;height:46px;border-radius:11px;flex:none;display:grid;place-items:center;
85
+ background:none;box-shadow:0 1px 2px rgba(21,23,31,.14);overflow:hidden;}
86
+ .ets-root .hero-logo svg{width:46px;height:46px;display:block;}
87
+ .ets-root .hero-brand h1{font-size:20px;font-weight:750;letter-spacing:.2px;display:flex;align-items:center;gap:9px;}
88
+ .ets-root .hero-brand .v{font-size:10px;font-weight:800;letter-spacing:1.1px;color:var(--bg);background:var(--ink);
89
+ padding:2px 8px;border-radius:6px;}
90
+ .ets-root .hero-brand p{font-size:13px;color:var(--ink-3);margin-top:2px;}
91
+ .ets-root .hero .grow{flex:1;}
92
+ .ets-root .hero-meta{display:flex;align-items:center;gap:10px;font-size:12px;color:var(--ink-2);letter-spacing:.6px;}
93
+ .ets-root .led{width:7px;height:7px;border-radius:50%;background:var(--ok);box-shadow:0 0 0 4px rgba(31,138,91,.13);}
94
+ .ets-root .hero-meta .ver{font-size:10.5px;font-weight:700;letter-spacing:.6px;color:var(--ink-3);
95
+ border:1px solid var(--line);padding:2px 7px;border-radius:5px;background:var(--panel);}
96
+ .ets-root .card{background:var(--card);border:1px solid var(--line);border-radius:var(--r);
97
+ padding:20px 22px;margin-bottom:18px;}
98
+ .ets-root .card-h{display:flex;align-items:center;gap:10px;margin-bottom:15px;flex-wrap:wrap;}
99
+ .ets-root .card-h .t{font-size:15px;font-weight:750;letter-spacing:.2px;}
100
+ .ets-root .card-h .n{font-size:11.5px;color:var(--ink-3);}
101
+ .ets-root .card-h .grow{flex:1;}
102
+ .ets-root .sub{font-size:12px;color:var(--ink-3);margin-top:9px;line-height:1.55;}
103
+ .ets-root .meta{display:grid;grid-template-columns:1fr 1fr 1fr 1.45fr;gap:12px 14px;margin-bottom:14px;}
104
+ .ets-root .inp-wrap{position:relative;display:block;}
105
+ .ets-root .inp-wrap .inp-x{position:absolute;right:8px;top:50%;transform:translateY(-50%);border:0;
106
+ background:transparent;color:var(--muted);font-size:15px;line-height:1;cursor:pointer;
107
+ padding:2px 5px;display:none;}
108
+ .ets-root .inp-wrap.has-val .inp-x{display:block;}
109
+ .ets-root .inp-wrap .inp-x:hover{color:var(--err);}
110
+ .ets-root .inp-wrap input{padding-right:28px;}
111
+ .ets-root .fld label{display:block;font-size:11px;font-weight:750;letter-spacing:.5px;color:var(--ink-3);margin-bottom:6px;}
112
+ .ets-root .fld input, .ets-root .fld select{width:100%;padding:9px 12px;border:1px solid var(--line);border-radius:9px;
113
+ background:var(--panel);font-family:inherit;font-size:13px;color:var(--ink);}
114
+ .ets-root .fld input:focus, .ets-root .fld select:focus{outline:none;border-color:var(--blue);box-shadow:0 0 0 3px var(--blue-w);}
115
+ .ets-root .fld input::placeholder{color:var(--muted);}
116
+ .ets-root input::placeholder, .ets-root textarea::placeholder{color:var(--muted);}
117
+ .ets-root .hint-chip{display:inline-block;margin-top:5px;font-size:10.5px;color:var(--ink-3);
118
+ font-family:ui-monospace,Consolas,monospace;background:transparent;border:0;
119
+ padding:0;border-radius:0;}
120
+ .ets-root .hint-chip.warn{color:var(--warn);border:1px solid var(--gold-line);background:var(--warn-w);
121
+ padding:2px 6px;border-radius:5px;}
122
+ .ets-root .tip{position:relative;cursor:help;text-decoration:underline dotted var(--line-2);text-underline-offset:3px;}
123
+ .ets-root .tip:focus-visible{outline:2px solid var(--blue);outline-offset:2px;border-radius:3px;}
124
+ .ets-root .tip::after{content:attr(data-tip);position:absolute;left:0;bottom:calc(100% + 9px);
125
+ width:max-content;max-width:330px;background:var(--ink);color:var(--bg);
126
+ font-size:11.5px;font-weight:400;line-height:1.55;letter-spacing:0;padding:9px 11px;border-radius:9px;
127
+ text-align:left;white-space:normal;opacity:0;pointer-events:none;transform:translateY(4px);
128
+ transition:.14s;z-index:30;box-shadow:0 14px 30px -16px rgba(0,0,0,.5);}
129
+ .ets-root .tip:hover::after, .ets-root .tip:focus-visible::after{opacity:1;transform:none;}
130
+ .ets-root .tip.tip-b::after{bottom:auto;top:calc(100% + 9px);}
131
+ .ets-root .tip.tip-r::after{left:auto;right:0;}
132
+ .ets-root .t.tip{text-underline-offset:5px;text-decoration-color:var(--line-2);}
133
+ .ets-root #draft{width:100%;min-height:136px;max-height:300px;resize:vertical;border:1px solid var(--line);
134
+ border-radius:11px;background:var(--bg);color:var(--ink);font-family:inherit;font-size:14px;
135
+ line-height:1.8;padding:13px 15px;}
136
+ .ets-root #draft:focus{outline:none;border-color:var(--blue);box-shadow:0 0 0 3px var(--blue-w);}
137
+ .ets-root .meta-foot{display:flex;align-items:center;gap:11px;margin-top:9px;font-size:11px;color:var(--ink);flex-wrap:wrap;}
138
+ .ets-root .meta-foot .grow{flex:1;}
139
+ .ets-root .meta-foot b{color:var(--ink-2);font-weight:700;font-variant-numeric:tabular-nums;}
140
+ .ets-root #charCount{color:var(--ink-2);}
141
+ .ets-root .sc-issues .more{color:var(--ink-3);margin-top:2px;font-size:10.5px;}
142
+ .ets-root .meta-foot .hint-chip{margin-top:0;}
143
+ .ets-root .mf-label{font-size:11px;font-weight:700;letter-spacing:.4px;color:var(--ink);}
144
+ .ets-root .tiny{font-size:12px;color:var(--ink-2);border:1px solid var(--line);background:var(--panel);
145
+ padding:5px 12px;border-radius:8px;transition:.12s;}
146
+ .ets-root .tiny:hover{border-color:var(--line-2);color:var(--ink);}
147
+ .ets-root .score-row{display:grid;grid-template-columns:repeat(4,minmax(0,1fr)) 248px;gap:12px;align-items:stretch;}
148
+ .ets-root .sc{background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:13px 15px;
149
+ display:flex;flex-direction:column;}
150
+ .ets-root .sc .top{display:flex;align-items:baseline;gap:7px;margin-bottom:7px;}
151
+ .ets-root .sc .top b{font-size:11px;font-weight:800;letter-spacing:.5px;color:var(--ink-3);}
152
+ .ets-root .sc .top span{font-size:12.5px;color:var(--ink-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
153
+ .ets-root .sc .top em{margin-left:auto;font-style:normal;font-size:15px;font-weight:750;
154
+ display:inline-flex;align-items:baseline;gap:1px;font-variant-numeric:tabular-nums;}
155
+ .ets-root .sc .top em i{font-style:normal;font-size:11px;color:var(--ink-2);font-weight:500;}
156
+ .ets-root .sc .bar{height:5px;border-radius:99px;background:var(--surface-2);overflow:hidden;}
157
+ .ets-root .sc .bar i{display:block;height:100%;border-radius:99px;background:var(--blue);}
158
+ .ets-root .sc.warn .bar i{background:var(--gold);}
159
+ .ets-root .sc .ev{font-size:11px;color:var(--ink-3);margin-top:5px;line-height:1.45;
160
+ display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:2.9em;}
161
+ .ets-root .input-actions{display:flex;justify-content:flex-end;margin-top:12px;}
162
+ .ets-root .wt{display:flex;align-items:center;gap:6px;margin-top:8px;font-size:10.5px;color:var(--ink-3);}
163
+ .ets-root .wt input{width:48px;padding:2px 5px;font-size:11px;border:1px solid var(--line);border-radius:5px;background:var(--panel);color:var(--ink);text-align:right;}
164
+ .ets-root .wt i{font-style:normal;}
165
+ .ets-root .sc-issues{background:var(--panel);border:1px solid var(--line);border-radius:9px;
166
+ margin-top:auto;padding:8px 10px;font-size:11px;line-height:1.55;color:var(--ink);
167
+ height:92px;overflow:auto;}
168
+ .ets-root .sc-issues .li{position:relative;padding-left:11px;margin-bottom:4px;}
169
+ .ets-root .sc-issues .li:last-child{margin-bottom:0;}
170
+ .ets-root .sc-issues .li::before{content:"·";position:absolute;left:2px;color:var(--ink-3);}
171
+ .ets-root .sc-issues .none{color:var(--ink-3);}
172
+ .ets-root .card-h .btn-score{padding:6px 14px;font-size:12.5px;gap:6px;}
173
+ @keyframes ets-etsScoreDone{0%{transform:scale(1)}35%{transform:scale(1.07)}70%{transform:scale(.98)}100%{transform:scale(1)}}
174
+ .ets-root .btn-score.is-done{animation:ets-etsScoreDone .5s ease-out;}
175
+ .ets-root .sc-eval .eval-bar{height:6px;border-radius:99px;background:var(--surface-2);overflow:hidden;max-width:320px;margin:14px auto 0;}
176
+ .ets-root .sc-eval .eval-bar i{display:block;height:100%;border-radius:99px;background:var(--blue);}
177
+ .ets-root .sc-eval{grid-column:1/-1;background:var(--panel);border:1px dashed var(--line-2);border-radius:12px;
178
+ padding:26px 18px;text-align:center;color:var(--ink);font-size:13px;letter-spacing:.3px;}
179
+ .ets-root .total{display:flex;align-items:center;gap:13px;background:var(--panel);border:1px solid var(--line);
180
+ border-radius:12px;padding:12px 15px;}
181
+ .ets-root .ring{position:relative;width:66px;height:66px;flex:none;border-radius:50%;
182
+ background:conic-gradient(var(--gold) calc(var(--p,0) * 1%), var(--surface-2) 0);}
183
+ .ets-root .ring::after{content:"";position:absolute;inset:6px;border-radius:50%;background:var(--panel);}
184
+ .ets-root .ring b{position:absolute;inset:0;display:grid;place-items:center;font-size:21px;font-weight:800;letter-spacing:-.6px;z-index:1;}
185
+ .ets-root .total .tx{min-width:0;}
186
+ .ets-root .total .tx>b{display:block;font-size:10.5px;font-weight:750;letter-spacing:.9px;color:var(--ink-3);}
187
+ .ets-root .band-chip{display:inline-block;font-size:11px;font-weight:800;letter-spacing:.2px;padding:2px 8px;
188
+ border-radius:99px;background:var(--gold-w);color:var(--gold);border:1px solid var(--gold-line);margin:5px 0 3px;}
189
+ .ets-root .adv{font-size:11px;color:var(--ink-2);line-height:1.6;}
190
+ .ets-root .console{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px 26px;}
191
+ .ets-root .cn.disabled{opacity:.45;pointer-events:none;filter:grayscale(1);}
192
+ .ets-root .cn-run{grid-column:1/-1;grid-row:auto;justify-content:flex-end;align-items:flex-end;margin-top:2px;}
193
+ .ets-root .cn-run .btn{width:auto;min-width:320px;justify-content:center;padding:9px 18px;}
194
+ .ets-root .cn{display:flex;flex-direction:column;justify-content:flex-start;gap:7px;min-width:0;}
195
+ .ets-root .cn .lb{font-size:10.5px;font-weight:750;letter-spacing:.9px;color:var(--ink-3);display:flex;align-items:center;gap:6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
196
+ .ets-root .cn .lb.tip{overflow:visible;text-overflow:clip;}
197
+ .ets-root .cn .rw{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
198
+ .ets-root .hist-tools{display:flex;gap:10px;margin-top:4px;margin-bottom:12px;}
199
+ .ets-root #histSearch{flex:1 1 0;min-width:0;width:auto;}
200
+ .ets-root #histModeSel{flex:0 0 140px;width:140px;max-width:140px;}
201
+ .ets-root .hist-group{border:1px solid var(--line);border-radius:8px;background:var(--panel);overflow:hidden;}
202
+ .ets-root .hist-group-head{display:flex;align-items:center;gap:12px;padding:10px 12px;cursor:pointer;font-size:13.5px;}
203
+ .ets-root .hist-group-head:hover{background:var(--surface);}
204
+ .ets-root .hist-group-preview{color:var(--ink-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0;}
205
+ .ets-root .hist-group-count{color:var(--ink-3);font-size:12px;white-space:nowrap;}
206
+ .ets-root .hist-group-when{color:var(--ink-3);font-size:12px;white-space:nowrap;}
207
+ .ets-root .hist-chev{color:var(--ink-3);font-size:11px;width:12px;text-align:center;flex:none;}
208
+ .ets-root .hist-row.open{background:var(--surface);}
209
+ .ets-root .hist-group-body{padding:6px 8px 8px;display:flex;flex-direction:column;gap:6px;border-top:1px solid var(--line);}
210
+ .ets-root .hist-pager{display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:12px;font-size:12px;color:var(--ink-3);}
211
+ .ets-root .hist-pager button{font-size:12px;}
212
+ .ets-root .ets-update{position:fixed;left:50%;top:14px;transform:translateX(-50%);z-index:9999;
213
+ background:var(--ink);color:var(--bg);padding:8px 10px 8px 14px;border-radius:9px;
214
+ font-size:12.5px;display:flex;gap:10px;align-items:center;box-shadow:0 6px 24px rgba(0,0,0,.25);}
215
+ .ets-root .ets-update button{background:var(--bg);color:var(--ink);padding:4px 10px;border-radius:6px;
216
+ font-weight:700;font-size:12px;}
217
+ .ets-root .hist-page{padding:18px 26px 90px;max-width:1400px;margin:0 auto;}
218
+ .ets-root .hist-list{display:flex;flex-direction:column;gap:8px;margin-top:4px;}
219
+ .ets-root .hist-back{padding:6px 14px;font-size:12px;}
220
+ .ets-root .hist-item{display:flex;flex-direction:column;gap:6px;}
221
+ .ets-root .hist-detail{border:1px solid var(--line);border-radius:8px;background:var(--surface);padding:12px 14px;}
222
+ .ets-root .hist-cols{display:grid;grid-template-columns:1fr 1fr;gap:16px;}
223
+ .ets-root .hist-col h5{margin:0 0 6px;font-size:13px;letter-spacing:.06em;color:var(--ink-3);display:flex;gap:8px;align-items:baseline;}
224
+ .ets-root .hist-col h5 b{font-size:17px;color:var(--ink);}
225
+ .ets-root .hist-text{margin:0;max-height:280px;overflow:auto;white-space:pre-wrap;font-size:14px;line-height:1.8;color:var(--ink-2);}
226
+ .ets-root .hist-text mark{background:var(--ok-w);border-bottom:2px solid var(--ok);color:var(--ink);border-radius:2px;padding:0 1px;}
227
+ .ets-root .hist-text mark sup{font-size:10px;font-weight:800;margin-left:1px;vertical-align:super;color:var(--ok);}
228
+ .ets-root .hist-text .dele{display:none;}
229
+ .ets-root .hist-text.show-del .dele{display:inline;}
230
+ .ets-root .hist-text .dele s{color:var(--err);text-decoration:line-through;text-decoration-thickness:1.5px;}
231
+ .ets-root .hist-text .dele sup{color:var(--err);font-weight:800;font-size:10px;margin-left:1px;vertical-align:super;}
232
+ .ets-root .hist-legend{margin-top:6px;font-size:11.5px;color:var(--ink-3);display:flex;align-items:center;gap:10px;}
233
+ .ets-root .hist-legend label{display:inline-flex;align-items:center;gap:5px;cursor:pointer;}
234
+ .ets-root .hist-row{cursor:pointer;}
235
+ .ets-root .hist-row{display:flex;align-items:center;gap:12px;padding:10px 12px;border:1px solid var(--line);border-radius:8px;background:var(--panel);font-size:14px;}
236
+ .ets-root .hist-when{color:var(--ink-3);font-size:12.5px;white-space:nowrap;}
237
+ .ets-root .hist-num{font-size:13.5px;font-weight:700;color:var(--ink);}
238
+ .ets-root .hist-task{color:var(--ink-2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:34%;}
239
+ .ets-root .hist-mode{color:var(--ink-3);font-size:12.5px;white-space:nowrap;}
240
+ .ets-root .hist-stat{color:var(--ink-3);font-size:12.5px;white-space:nowrap;}
241
+ .ets-root .hist-row .grow{flex:1;}
242
+ .ets-root .skill-card{width:560px;max-width:94vw;}
243
+ .ets-root .skill-search{margin-top:10px;}
244
+ .ets-root .skill-all{display:flex;align-items:center;gap:7px;margin-top:9px;font-size:11.5px;color:var(--ink-3);cursor:pointer;}
245
+ .ets-root .skill-all input{width:13px;height:13px;accent-color:var(--blue);}
246
+ .ets-root .skill-list{max-height:46vh;overflow:auto;display:flex;flex-direction:column;gap:6px;margin-top:10px;}
247
+ .ets-root .skill-item{display:block;text-align:left;padding:9px 11px;border:1px solid var(--line);border-radius:8px;background:var(--surface);cursor:pointer;}
248
+ .ets-root .skill-item:hover{border-color:var(--line-2);background:var(--panel);}
249
+ .ets-root .skill-item b{display:block;font-size:12.5px;color:var(--ink);}
250
+ .ets-root .skill-item i{display:block;margin-top:2px;font-size:11px;color:var(--ink-3);font-style:normal;line-height:1.45;}
251
+ .ets-root .skill-empty{font-size:12px;color:var(--ink-3);padding:10px 2px;}
252
+ .ets-root .sel3:disabled{background:var(--surface);color:var(--ink-3);cursor:not-allowed;}
253
+ .ets-root .cn.locked .lb{color:var(--ink-3);}
254
+ .ets-root .sel3{width:100%;padding:7px 10px;border:1px solid var(--line);border-radius:8px;background:var(--panel);
255
+ font-family:inherit;font-size:12.5px;color:var(--ink);cursor:pointer;}
256
+ .ets-root .sel3:focus{outline:none;border-color:var(--blue);box-shadow:0 0 0 3px var(--blue-w);}
257
+ .ets-root .flag{align-self:flex-start;font-size:10.5px;color:var(--ink-3);background:var(--panel);border:1px solid var(--line);
258
+ padding:5px 9px;border-radius:7px;white-space:nowrap;letter-spacing:.2px;}
259
+ .ets-root .stepper{display:flex;align-items:center;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--panel);}
260
+ .ets-root .stepper button{width:27px;height:29px;font-size:14px;line-height:1;color:var(--ink-2);}
261
+ .ets-root .stepper button:hover{background:var(--surface-2);}
262
+ .ets-root .stepper b{min-width:28px;text-align:center;font-size:13px;line-height:29px;border-left:1px solid var(--line);border-right:1px solid var(--line);}
263
+ .ets-root .knob{position:relative;width:34px;height:34px;flex:none;}
264
+ .ets-root .knob-face{position:absolute;inset:0;border-radius:50%;background:var(--surface-2);border:1px solid var(--line-2);}
265
+ .ets-root .knob-face::after{content:"";position:absolute;inset:5px;border-radius:50%;background:var(--panel);}
266
+ .ets-root .knob-ptr{position:absolute;left:50%;top:5px;width:2px;height:9px;background:var(--blue);border-radius:2px;
267
+ transform-origin:50% 12px;transform:translateX(-50%) rotate(var(--a,-108deg));z-index:1;}
268
+ .ets-root .knob input{position:absolute;inset:-5px;width:calc(100% + 10px);height:calc(100% + 10px);opacity:0;cursor:grab;}
269
+ .ets-root .cn .kv{font-size:13px;font-weight:750;color:var(--blue);min-width:24px;}
270
+ .ets-root input[type=range]{-webkit-appearance:none;appearance:none;height:6px;border-radius:99px;
271
+ background:var(--surface-2);outline:none;border:1px solid var(--line);}
272
+ .ets-root input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:13px;height:19px;border-radius:4px;
273
+ cursor:grab;background:var(--panel);border:1.5px solid var(--blue);}
274
+ .ets-root input[type=range]::-moz-range-thumb{width:13px;height:19px;border-radius:4px;cursor:grab;background:var(--panel);border:1.5px solid var(--blue);}
275
+ .ets-root #extent{width:180px;}
276
+ .ets-root .cn .fv{font-size:12px;font-weight:750;color:var(--warn);width:44px;text-align:right;}
277
+ .ets-root .auto-pill{font-size:10px;font-weight:800;letter-spacing:.5px;color:var(--warn);
278
+ background:var(--gold-w);border:1px solid var(--gold-line);padding:1px 5px;border-radius:4px;}
279
+ .ets-root #draftText{background:#fff;border:1px solid var(--line);border-radius:10px;padding:12px 14px;min-height:64px;
280
+ font-size:14px;line-height:1.8;}
281
+ .ets-root #draftText .draft-pending{color:var(--muted);font-size:13px;}
282
+ .ets-root .out-empty{color:var(--ink-3);font-size:12.5px;padding:26px 12px;text-align:center;}
283
+ .ets-root .out-panel{background:var(--panel);border:1px solid var(--line);border-radius:12px;padding:18px 20px;}
284
+ .ets-root .out-score{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:16px;padding-top:13px;
285
+ border-top:1px dashed var(--line);font-size:11.5px;color:var(--ink-2);}
286
+ .ets-root .out-score .scorepair{display:inline-flex;align-items:baseline;gap:1px;font-variant-numeric:tabular-nums;}
287
+ .ets-root .out-score .of{font-size:11px;color:var(--ink-3);}
288
+ .ets-root .out-score .big{font-size:17px;font-weight:800;color:var(--warn);letter-spacing:-.3px;}
289
+ .ets-root .out-score .delta{font-size:11px;font-weight:700;padding:1px 6px;border-radius:99px;
290
+ background:var(--ok-w);color:var(--ok);}
291
+ .ets-root .out-score .delta.down{background:var(--err-w);color:var(--err);}
292
+ .ets-root .out-score .r{color:var(--ink-3);}
293
+ .ets-root .out-score .r b{color:var(--ink-2);font-weight:700;}
294
+ .ets-root .cn .fval{display:flex;align-items:center;gap:10px;width:100%;min-width:0;}
295
+ .ets-root .cn .fval input[type=range]{flex:1 1 auto;min-width:0;}
296
+ .ets-root .cn .fval .fv{min-width:44px;text-align:right;}
297
+ .ets-root .cn input[type=range]{-webkit-appearance:none;appearance:none;height:4px;border-radius:99px;
298
+ background:var(--line-2);width:100%;outline:none;}
299
+ .ets-root .cn input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:14px;
300
+ border-radius:50%;background:var(--brand);border:2px solid #fff;cursor:pointer;
301
+ box-shadow:0 1px 3px rgba(0,0,0,.18);}
302
+ .ets-root .task-tabs{display:flex;gap:6px;flex-wrap:wrap;margin:0 0 14px;padding:0 2px;}
303
+ .ets-root .task-tab{display:flex;align-items:center;gap:8px;padding:6px 10px;border:1px solid var(--line);
304
+ border-radius:9px;background:var(--surface);font-size:12px;color:var(--muted);cursor:pointer;
305
+ max-width:220px;}
306
+ .ets-root .task-tab.on{background:var(--panel);border-color:var(--brand);color:var(--ink);box-shadow:0 1px 0 rgba(0,0,0,.02);}
307
+ .ets-root .task-tab .ord{font-weight:800;color:var(--muted);}
308
+ .ets-root .task-tab.on .ord{color:var(--brand);}
309
+ .ets-root .task-tab .nm{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:140px;}
310
+ .ets-root .task-tab .x{border:0;background:transparent;color:var(--muted);cursor:pointer;font-size:13px;line-height:1;padding:0 2px;}
311
+ .ets-root .task-tab .x:hover{color:var(--err);}
312
+ .ets-root .task-rename{width:120px;padding:2px 6px;border:1px solid var(--brand);border-radius:6px;
313
+ font-size:12px;background:#fff;color:var(--ink);outline:none;}
314
+ .ets-root .task-add{border:1px dashed var(--line-2);background:transparent;color:var(--ink-3);
315
+ border-radius:9px;padding:6px 12px;font-size:12px;cursor:pointer;}
316
+ .ets-root .task-add:hover{color:var(--brand);border-color:var(--brand);}
317
+ .ets-root .hist-sel{max-width:190px;font-size:11.5px;color:var(--ink);background:var(--surface);
318
+ border:1px solid var(--line);border-radius:6px;padding:2px 6px;outline:none;cursor:pointer;}
319
+ .ets-root .hist-sel[hidden]{display:none;}
320
+ .ets-root .run-stamp{font-size:10.5px;color:var(--ink-3);padding:2px 7px;border:1px solid var(--line);border-radius:5px;}
321
+ .ets-root .run-stamp.stale{color:var(--warn);border-color:var(--gold-line);background:var(--warn-w);}
322
+ .ets-root .run-badge{font-size:11px;color:var(--ink-3);background:var(--surface);border:1px solid var(--line);
323
+ border-radius:6px;padding:1px 7px;}
324
+ .ets-root .sc, .ets-root .total{cursor:pointer;transition:transform .22s cubic-bezier(.22,.61,.36,1), box-shadow .22s ease, border-color .22s ease;transform-origin:center;will-change:transform;}
325
+ .ets-root .sc:hover, .ets-root .total:hover{transform:scale(1.03);z-index:1;border-color:var(--line-2);box-shadow:0 10px 24px -16px rgba(20,24,34,.38);}
326
+ @media (prefers-reduced-motion: reduce){
327
+ .ets-root .sc, .ets-root .total{transition:none;}
328
+ .ets-root .sc:hover, .ets-root .total:hover{transform:none;box-shadow:none;}
329
+ }
330
+ .ets-root .sc-modal{width:560px;max-width:94vw;}
331
+ .ets-root .sc-modal-score{font-size:22px;font-weight:800;font-family:ui-monospace,Consolas,monospace;letter-spacing:-.3px;margin:0 0 8px;color:var(--ink);}
332
+ .ets-root .sc-modal-list{max-height:48vh;overflow:auto;display:flex;flex-direction:column;gap:8px;margin-top:12px;}
333
+ .ets-root .sc-m-item{border:1px solid var(--line);border-radius:8px;background:var(--surface);padding:9px 11px;}
334
+ .ets-root .sc-m-item .code{font-size:9.5px;font-weight:800;letter-spacing:.5px;color:var(--ink-3);text-transform:uppercase;}
335
+ .ets-root .sc-m-item p{margin:3px 0 0;font-size:12.5px;line-height:1.55;color:var(--ink);word-break:break-word;}
336
+ .ets-root .sc-m-item small{display:block;margin-top:3px;font-size:10.5px;color:var(--ink-3);}
337
+ .ets-root .sc-meta{display:flex;gap:16px;flex-wrap:wrap;font-size:11.5px;color:var(--ink-3);margin:0 0 8px;}
338
+ .ets-root .bind-mask{position:fixed;inset:0;background:rgba(16,18,26,.38);display:flex;
339
+ align-items:center;justify-content:center;z-index:60;}
340
+ .ets-root .bind-mask[hidden]{display:none;}
341
+ .ets-root .bind-card{width:520px;max-width:92vw;background:var(--panel);border:1px solid var(--line);
342
+ border-radius:14px;padding:22px 22px 18px;box-shadow:0 18px 60px rgba(0,0,0,.18);}
343
+ .ets-root .bind-card h3{margin:0 0 8px;font-size:16px;}
344
+ .ets-root .bind-sub{margin:0 0 12px;font-size:12px;line-height:1.65;color:var(--ink-2);}
345
+ .ets-root .bind-lab{display:block;font-size:11px;letter-spacing:.4px;color:var(--ink-3);margin:14px 0 6px;}
346
+ .ets-root .bind-input{width:100%;padding:9px 11px;border:1px solid var(--line-2);border-radius:9px;
347
+ font-size:12.5px;background:#fff;color:var(--ink);}
348
+ .ets-root .bind-now{font-size:11.5px;color:var(--ink-3);margin:0 0 8px;min-height:16px;}
349
+ .ets-root .bind-now b{color:var(--ink-2);font-weight:650;margin:0 2px;}
350
+ .ets-root .bind-list{max-height:168px;overflow:auto;border:1px solid var(--line);border-radius:9px;padding:6px;}
351
+ .ets-root .bind-evs{margin-left:auto;font-size:10.5px;color:var(--ink-3);}
352
+ .ets-root .bind-row{display:flex;align-items:center;gap:8px;padding:7px 8px;border-radius:7px;
353
+ font-size:12px;cursor:pointer;}
354
+ .ets-root .bind-row:hover{background:var(--surface);}
355
+ .ets-root .bind-name{min-width:0;max-width:46%;overflow:hidden;text-overflow:ellipsis;
356
+ white-space:nowrap;color:var(--ink);}
357
+ .ets-root .bind-cwd{margin-left:auto;color:var(--ink-3);font-size:11px;max-width:55%;
358
+ overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
359
+ .ets-root .bind-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:18px;}
360
+ .ets-root .out-working{display:flex;flex-direction:column;align-items:center;justify-content:center;
361
+ min-height:132px;border:1px dashed var(--line-2);border-radius:10px;color:var(--ink-2);
362
+ font-size:13px;letter-spacing:.3px;text-align:center;padding:16px;}
363
+ .ets-root .wk-head{font-size:13px;color:var(--ink-2);}
364
+ .ets-root .wk-pre{margin-top:13px;max-width:94%;max-height:98px;overflow:hidden;text-align:left;
365
+ font-size:12px;line-height:1.75;color:var(--ink-3);white-space:pre-wrap;word-break:break-word;
366
+ -webkit-mask-image:linear-gradient(180deg,transparent 0%,#000 38%);
367
+ mask-image:linear-gradient(180deg,transparent 0%,#000 38%);}
368
+ .ets-root .out{font-size:16px;line-height:2;color:var(--ink);letter-spacing:.1px;}
369
+ .ets-root .out p{margin-bottom:12px;}
370
+ .ets-root .out p:last-child{margin-bottom:0;}
371
+ .ets-root .out.hide-add mark{background:none;color:inherit;padding:0;border-radius:0;font-weight:inherit;
372
+ box-shadow:none;text-decoration:none;border-bottom:0;}
373
+ .ets-root .out.hide-add mark:hover{background:none;border-bottom-color:transparent;}
374
+ .ets-root .out.hide-add mark sup{display:none;}
375
+ .ets-root .out .dele{display:none;}
376
+ .ets-root .out .dele s{color:var(--err);text-decoration:line-through;text-decoration-thickness:1.5px;}
377
+ .ets-root .out .dele sup{color:var(--err);font-weight:800;font-size:9px;margin-left:1px;vertical-align:super;}
378
+ .ets-root .out.show-del .dele{display:inline;}
379
+ .ets-root .out s{color:var(--err);text-decoration:line-through;text-decoration-thickness:1px;opacity:.7;}
380
+ .ets-root .out mark{background:var(--ok-w);border-bottom:2px solid var(--ok);color:var(--ink);
381
+ padding:1px 3px;border-radius:3px;cursor:pointer;transition:.12s;}
382
+ .ets-root .out mark:hover{background:color-mix(in srgb, var(--ok-w) 70%, var(--ok));}
383
+ .ets-root .out mark.sev-err{border-bottom-color:var(--err);}
384
+ .ets-root .out mark.sev-warn{border-bottom-color:var(--warn);}
385
+ .ets-root .out mark sup{font-size:10px;font-weight:800;margin-left:2px;vertical-align:super;color:var(--ok);}
386
+ .ets-root .out mark.sev-err sup{color:var(--err);}
387
+ .ets-root .out mark.sev-warn sup{color:var(--warn);}
388
+ .ets-root .out mark:focus{outline:2px solid var(--blue);outline-offset:2px;}
389
+ .ets-root .legend{display:flex;align-items:center;gap:16px;margin-top:16px;padding-top:14px;
390
+ border-top:1px dashed var(--line);font-size:11.5px;color:var(--ink-3);flex-wrap:wrap;}
391
+ .ets-root .legend .k{display:inline-flex;align-items:center;gap:6px;}
392
+ .ets-root .legend .sw1{width:18px;height:11px;border-radius:3px;background:var(--ok-w);border-bottom:2px solid var(--ok);}
393
+ .ets-root .legend .sw2{width:18px;height:11px;border-radius:3px;background:var(--err-w);}
394
+ .ets-root .legend .sw3{width:18px;height:11px;border-radius:3px;border:1px solid var(--line-2);}
395
+ .ets-root .toggle{display:inline-flex;align-items:center;gap:8px;font-size:12.5px;color:var(--ink-2);}
396
+ .ets-root .toggle .tr{width:32px;height:18px;border-radius:99px;background:var(--surface-2);position:relative;transition:.15s;border:1px solid var(--line);}
397
+ .ets-root .toggle .tr::after{content:"";position:absolute;top:1px;left:1px;width:14px;height:14px;border-radius:50%;background:var(--panel);box-shadow:0 1px 2px rgba(0,0,0,.2);transition:.15s;}
398
+ .ets-root .toggle.on .tr{background:var(--blue);border-color:var(--blue);}
399
+ .ets-root .toggle.on .tr::after{left:15px;}
400
+ .ets-root .out-foot{display:flex;align-items:center;gap:12px;margin-top:16px;flex-wrap:wrap;}
401
+ .ets-root .out-foot .grow{flex:1;}
402
+ .ets-root .stats{display:inline-flex;align-items:stretch;background:var(--panel);border:1px solid var(--line);
403
+ border-radius:11px;overflow:hidden;}
404
+ .ets-root .stat{display:flex;align-items:baseline;gap:6px;padding:8px 15px;}
405
+ .ets-root .stat+.stat{border-left:1px solid var(--line);}
406
+ .ets-root .stat b{font-size:18px;font-weight:800;color:var(--warn);letter-spacing:-.4px;line-height:1.1;}
407
+ .ets-root .stat b i{font-style:normal;font-size:11px;font-weight:700;color:var(--ink-3);margin-left:1px;}
408
+ .ets-root .stat span{font-size:11.5px;color:var(--ink-2);}
409
+ .ets-root .stats.sm .stat{padding:5px 11px;gap:5px;}
410
+ .ets-root .stats.sm .stat b{font-size:13.5px;}
411
+ .ets-root .stats.sm .stat span{font-size:11px;color:var(--ink-2);}
412
+ .ets-root .dtabs{display:flex;align-items:center;gap:4px;border-bottom:1px solid var(--line);margin:-6px 0 18px;}
413
+ .ets-root .dtabs .grow{flex:1;}
414
+ .ets-root .dt-count{font-size:11.5px;color:var(--ink-3);padding-bottom:1px;}
415
+ .ets-root .dtab{position:relative;padding:11px 16px 12px;font-size:13.5px;font-weight:550;color:var(--muted);border-radius:7px 7px 0 0;}
416
+ .ets-root .dtab:hover{color:var(--ink);background:var(--surface);}
417
+ .ets-root .dtab.on{color:var(--ink);font-weight:700;}
418
+ .ets-root .dtab.on::after{content:"";position:absolute;left:12px;right:12px;bottom:-1px;height:2px;background:var(--gold);border-radius:2px;}
419
+ .ets-root .dtab .n{font-size:10.5px;font-weight:800;margin-left:5px;color:var(--ink-3);}
420
+ .ets-root .dtab.on .n{color:var(--ink-2);}
421
+ .ets-root .dpanel{animation:ets-fade .22s ease;}
422
+ @keyframes ets-fade{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}
423
+ .ets-root .dh{display:grid;grid-template-columns:22px minmax(0,1fr) minmax(0,1fr) 56px;gap:0 12px;
424
+ font-size:11px;font-weight:750;letter-spacing:1px;color:var(--ink-3);padding:0 0 9px;}
425
+ .ets-root .hunk{border:1px solid var(--line);border-radius:var(--r-sm);margin:0 0 12px;background:var(--panel);overflow:hidden;}
426
+ .ets-root .hunk.focus{border-color:var(--blue);box-shadow:0 0 0 3px var(--blue-w);}
427
+ .ets-root .hunk.ok{border-color:var(--ok);}
428
+ .ets-root .hunk.no{opacity:.42;}
429
+ .ets-root .dh-note{font-size:11.5px;color:var(--ink-3);margin:0 2px 10px;}
430
+ .ets-root .hunk-head{display:flex;align-items:center;gap:8px;padding:9px 12px;background:var(--surface);
431
+ border-bottom:1px solid var(--line);flex-wrap:wrap;}
432
+ .ets-root .hk-no{font-size:11px;font-weight:800;color:var(--warn);background:var(--gold-w);
433
+ border:1px solid var(--gold-line);padding:1px 7px;border-radius:5px;letter-spacing:.3px;}
434
+ .ets-root .hunk-why{margin:0 12px 12px;padding:9px 11px;background:var(--surface);
435
+ border:1px solid var(--line);border-radius:9px;font-size:12px;line-height:1.55;color:var(--ink-2);}
436
+ .ets-root .hunk-why b{color:var(--ink);margin-right:7px;font-weight:750;}
437
+ .ets-root .hk-id{font-size:11px;color:var(--ink-3);letter-spacing:.3px;}
438
+ .ets-root .pl{font-size:10px;font-weight:800;letter-spacing:.6px;padding:2px 7px;border-radius:5px;text-transform:uppercase;}
439
+ .ets-root .pl-polish{background:var(--surface-2);background:color-mix(in srgb, var(--navy) 12%, transparent);color:var(--navy);}
440
+ .ets-root .pl-trace{background:var(--blue-w);color:var(--blue);}
441
+ .ets-root .pl-prosody{background:var(--gold-w);color:var(--warn);}
442
+ .ets-root .sev{font-size:11px;font-weight:700;letter-spacing:.2px;display:inline-flex;align-items:center;gap:4px;}
443
+ .ets-root .sev-err{color:var(--err);}
444
+ .ets-root .sev-warn{color:var(--warn);}
445
+ .ets-root .sev-info{color:var(--ink-3);}
446
+ .ets-root .hk-note{font-size:11px;color:var(--ink-3);}
447
+ .ets-root .hk-actions{margin-left:auto;display:flex;gap:5px;}
448
+ .ets-root .mini{width:26px;height:26px;border-radius:7px;display:grid;place-items:center;
449
+ border:1px solid var(--line);background:var(--panel);color:var(--ink-3);}
450
+ .ets-root .mini:hover{border-color:var(--ok);color:var(--ok);}
451
+ .ets-root .mini.rej:hover{border-color:var(--err);color:var(--err);}
452
+ .ets-root .mini svg{width:13px;height:13px;}
453
+ .ets-root .hunk-body{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);}
454
+ .ets-root .hunk-body>div{padding:13px 15px;font-size:14px;line-height:1.9;}
455
+ .ets-root .hunk-body .del{border-right:1px solid var(--line);background:var(--err-w);background:color-mix(in srgb, var(--err-w) 40%, var(--panel));}
456
+ .ets-root .hunk-body .ins{background:var(--ok-w);background:color-mix(in srgb, var(--ok-w) 40%, var(--panel));}
457
+ .ets-root .hunk-body del{background:var(--err-w);color:var(--err);text-decoration:line-through;
458
+ text-decoration-thickness:1.5px;border-radius:3px;padding:0 2px;}
459
+ .ets-root .hunk-body ins{background:var(--ok-w);color:var(--ok);text-decoration:none;
460
+ border-radius:3px;padding:0 2px;font-weight:600;}
461
+ .ets-root .hunk-body .nil{color:var(--muted);}
462
+ .ets-root .stacked .hunk-body{grid-template-columns:1fr;}
463
+ .ets-root .stacked .hunk-body .del{border-right:none;border-bottom:1px dashed var(--line);}
464
+ .ets-root del{background:var(--err-w);color:var(--err);text-decoration:line-through;padding:0 2px;border-radius:2px;}
465
+ .ets-root ins{background:var(--ok-w);color:var(--ok);text-decoration:none;padding:0 2px;border-radius:2px;font-weight:550;}
466
+ .ets-root .grid2{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
467
+ .ets-root .card-i{border:1px solid var(--line);border-radius:var(--r-sm);padding:13px 15px;background:var(--panel);
468
+ border-left-width:4px;cursor:pointer;transition:.12s;}
469
+ .ets-root .card-i:hover{box-shadow:var(--shadow);}
470
+ .ets-root .card-i.err{border-left-color:var(--err);}
471
+ .ets-root .card-i.warn{border-left-color:var(--warn);}
472
+ .ets-root .card-i.info{border-left-color:var(--line-2);}
473
+ .ets-root .card-i.sel{background:var(--surface);}
474
+ .ets-root .c-top{display:flex;align-items:center;gap:7px;margin-bottom:4px;flex-wrap:wrap;}
475
+ .ets-root .c-top .src{margin-left:auto;font-size:10px;color:var(--ink-3);}
476
+ .ets-root .c-ttl{font-size:13.5px;font-weight:650;line-height:1.5;}
477
+ .ets-root .c-ttl code{font-family:ui-monospace,Consolas,monospace;font-size:12.5px;background:var(--surface-2);
478
+ padding:1px 5px;border-radius:4px;font-weight:600;}
479
+ .ets-root .c-why{font-size:12px;color:var(--ink-2);margin-top:5px;line-height:1.55;}
480
+ .ets-root .c-why code{font-family:ui-monospace,Consolas,monospace;font-size:11px;background:var(--surface-2);padding:0 3px;border-radius:3px;}
481
+ .ets-root .c-meta{display:flex;align-items:center;gap:9px;margin-top:8px;font-size:10.5px;color:var(--ink-3);flex-wrap:wrap;}
482
+ .ets-root .c-meta .grow{flex:1;}
483
+ .ets-root .link{font-size:11.5px;color:var(--blue);font-weight:600;}
484
+ .ets-root .link:hover{text-decoration:underline;}
485
+ .ets-root .two{display:grid;grid-template-columns:minmax(0,1fr) 420px;gap:20px;align-items:start;}
486
+ .ets-root .move-empty{font-size:12px;color:var(--ink-3);padding:14px 4px;}
487
+ .ets-root .move-empty{font-size:12px;color:var(--ink-3);padding:14px 4px;}
488
+ .ets-root .move{display:flex;gap:10px;align-items:flex-start;padding:11px 13px;border:1px solid var(--line);
489
+ border-radius:var(--r-sm);margin-bottom:9px;}
490
+ .ets-root .move .st{width:20px;height:20px;border-radius:50%;flex:none;display:grid;place-items:center;font-size:10.5px;font-weight:800;margin-top:1px;}
491
+ .ets-root .move .st.y{background:var(--ok-w);color:var(--ok);}
492
+ .ets-root .move .st.n{background:var(--err-w);color:var(--err);}
493
+ .ets-root .move .st.p{background:var(--surface-2);color:var(--ink-3);}
494
+ .ets-root .move .b{min-width:0;flex:1;}
495
+ .ets-root .move .l1{display:flex;align-items:center;gap:7px;flex-wrap:wrap;}
496
+ .ets-root .move .l1 b{font-size:12.5px;font-weight:700;}
497
+ .ets-root .move .kind{font-size:9.5px;letter-spacing:.4px;color:var(--ink-3);border:1px solid var(--line);padding:1px 5px;border-radius:4px;}
498
+ .ets-root .move .reason{font-size:11.5px;color:var(--ink-2);margin-top:3px;line-height:1.55;}
499
+ .ets-root .move .metrics{display:flex;gap:12px;margin-top:6px;font-size:10.5px;color:var(--ink-3);flex-wrap:wrap;}
500
+ .ets-root .move .metrics b{color:var(--ink-2);font-weight:600;}
501
+ .ets-root .st-tag{margin-left:auto;font-size:10.5px;}
502
+ .ets-root .st-y{color:var(--ok);}
503
+ .ets-root .st-n{color:var(--err);}
504
+ .ets-root .st-p{color:var(--ink-3);}
505
+ .ets-root .cert{border:1px solid var(--line);border-radius:var(--r-sm);padding:16px;
506
+ background:linear-gradient(180deg,var(--gold-w),transparent 62%),var(--panel);}
507
+ .ets-root .cert h4{font-size:11px;font-weight:800;letter-spacing:1.2px;color:var(--gold);margin-bottom:11px;}
508
+ .ets-root .kv{display:grid;grid-template-columns:70px 1fr;gap:5px 11px;font-size:12px;}
509
+ .ets-root .kv dt{color:var(--ink-3);}
510
+ .ets-root .kv code{font-family:ui-monospace,Consolas,monospace;font-size:11px;background:var(--panel);
511
+ border:1px solid var(--line);padding:0 4px;border-radius:4px;}
512
+ .ets-root .rounds{margin-top:14px;border-top:1px dashed var(--gold-line);padding-top:12px;}
513
+ .ets-root .round{display:flex;gap:9px;margin-bottom:9px;}
514
+ .ets-root .round .rn{font-size:10.5px;font-weight:800;color:var(--ink-3);width:17px;flex:none;}
515
+ .ets-root .round .rb b{font-size:12px;font-weight:650;}
516
+ .ets-root .round .rb p{font-size:11px;color:var(--ink-2);margin-top:2px;}
517
+ .ets-root .chain{display:flex;align-items:center;gap:6px;margin-top:12px;font-size:10.5px;color:var(--ink-3);flex-wrap:wrap;}
518
+ .ets-root .chain code{font-family:ui-monospace,Consolas,monospace;background:var(--panel);border:1px solid var(--line);padding:1px 5px;border-radius:4px;}
519
+ .ets-root .note{font-size:11px;color:var(--ink-3);line-height:1.55;margin-top:9px;padding:8px 10px;
520
+ background:var(--surface);border-radius:7px;border:1px solid var(--line);}
521
+ .ets-root .note b{color:var(--ink-2);}
522
+ .ets-root .skel{display:none;}
523
+ .ets-root .skel.on{display:block;}
524
+ .ets-root .sk{height:88px;border-radius:var(--r-sm);margin-bottom:12px;
525
+ background:linear-gradient(90deg,var(--panel) 25%,var(--surface) 37%,var(--panel) 63%);
526
+ background-size:400% 100%;animation:ets-sh 1.2s ease infinite;}
527
+ @keyframes ets-sh{0%{background-position:100% 50%}100%{background-position:0 50%}}
528
+ .ets-root .sk.tall{height:220px;}
529
+ .ets-root .end{display:flex;align-items:center;justify-content:center;gap:10px;padding:18px;color:var(--ink-3);font-size:12px;}
530
+ .ets-root .end::before, .ets-root .end::after{content:"";height:1px;background:var(--line);flex:1;}
531
+ .ets-root .status{display:flex;align-items:center;gap:15px;padding:7px 18px;border-top:1px solid var(--line);
532
+ background:var(--surface);font-size:11px;color:var(--ink-3);flex-wrap:wrap;flex:none;}
533
+ .ets-root .status .it{display:flex;align-items:center;gap:6px;white-space:nowrap;}
534
+ .ets-root .status .grow{flex:1;}
535
+ .ets-root .dot{width:6px;height:6px;border-radius:50%;background:var(--ok);}
536
+ .ets-root .tag{font-size:10.5px;font-weight:700;letter-spacing:.4px;padding:2px 6px;border-radius:5px;border:1px solid var(--line);}
537
+ .ets-root .tag.el{color:var(--warn);border-color:var(--gold-line);background:var(--warn-w);}
538
+ .ets-root .tag.ok{color:var(--ok);border-color:transparent;background:var(--ok-w);}
539
+ .ets-root .tag.ins{color:var(--ink-3);background:var(--surface-2);border-color:transparent;}
540
+ .ets-root .toast{position:fixed;left:50%;bottom:52px;transform:translateX(-50%) translateY(8px);opacity:0;
541
+ pointer-events:none;background:var(--ink);color:var(--bg);font-size:12.5px;padding:9px 16px;
542
+ border-radius:9px;transition:.2s;z-index:9;box-shadow:0 10px 24px -12px rgba(0,0,0,.5);}
543
+ .ets-root .toast.show{opacity:1;transform:translateX(-50%) translateY(0);}
544
+ @media(max-width:1240px){
545
+ .ets-root .score-row{grid-template-columns:repeat(2,minmax(0,1fr));}
546
+ .ets-root .total{grid-column:1/-1;}
547
+ .ets-root .console{grid-template-columns:repeat(2,minmax(0,1fr));}
548
+ .ets-root .cn-run{grid-column:auto;grid-row:auto;}
549
+ }
550
+ @media(max-width:760px){
551
+ .ets-root .console{grid-template-columns:1fr;}
552
+ .ets-root .cn-run{grid-column:auto;grid-row:auto;}
553
+ }
554
+ @media(max-width:1120px){
555
+ .ets-root .meta{grid-template-columns:1fr 1fr;}
556
+ .ets-root .two{grid-template-columns:1fr;}
557
+ .ets-root .grid2{grid-template-columns:1fr;}
558
+ }
559
+ @media(max-width:980px){
560
+ .ets-root .hunk-body{grid-template-columns:1fr;}
561
+ .ets-root .hunk-body .del{border-right:none;border-bottom:1px dashed var(--line);}
562
+ .ets-root .hero-meta{display:none;}
563
+ }
564
+ @media (prefers-color-scheme: dark){
565
+ .ets-root .btn-primary{background:#4D6BFE;color:#fff;}
566
+ .ets-root .btn-primary:hover{background:#3B53E0;}
567
+ .ets-root .out mark:hover{background:var(--ok-w);}
568
+ .ets-root .hero-brand .v{color:#15171f;}
569
+ }
570
+ .ets-root[data-theme="mint"]{
571
+ --bg:#EEF7F5; --card:rgba(255,255,255,.58); --panel:rgba(255,255,255,.72);
572
+ --surface:rgba(255,255,255,.52); --surface-2:rgba(255,255,255,.34);
573
+ --line:rgba(24,104,98,.13); --line-2:rgba(24,104,98,.22);
574
+ --ink:#12211F; --ink-2:#334542; --ink-3:#4E625F; --muted:#647A77;
575
+ --blue:#178C82; --blue-d:#12756D; --blue-w:rgba(44,173,163,.16); --blue-line:rgba(23,140,130,.40);
576
+ --gold:#8A5B00; --gold-2:#F2B705; --gold-w:rgba(242,183,5,.16); --gold-line:rgba(242,183,5,.40);
577
+ --navy:#12211F;
578
+ --ok:#1E8C84; --ok-w:rgba(30,140,132,.14); --warn:#8A5B00; --warn-w:rgba(242,183,5,.16);
579
+ --err:#D2464B; --err-w:rgba(229,72,77,.12);
580
+ --shadow:0 18px 40px -28px rgba(7,61,56,.42), 0 2px 8px rgba(7,61,56,.06);
581
+ font-family:"Urbanist","Segoe UI",system-ui,-apple-system,"PingFang SC","Microsoft YaHei",sans-serif;
582
+ background:
583
+ radial-gradient(880px 520px at 6% -14%, rgba(44,173,163,.42) 0%, rgba(44,173,163,0) 62%),
584
+ radial-gradient(720px 460px at 98% -6%, rgba(124,245,208,.50) 0%, rgba(124,245,208,0) 60%),
585
+ radial-gradient(760px 520px at 46% 116%, rgba(44,173,163,.22) 0%, rgba(44,173,163,0) 62%),
586
+ linear-gradient(158deg,#E8F8F4 0%,#F3F6F7 46%,#E4F5F1 100%);
587
+ }
588
+ .ets-root[data-theme="mint"] .main, .ets-root[data-theme="mint"] .content{background:transparent;}
589
+ .ets-root[data-theme="mint"] .tb{
590
+ background:rgba(255,255,255,.55); border-bottom:1px solid rgba(255,255,255,.70);
591
+ -webkit-backdrop-filter:blur(18px) saturate(1.15); backdrop-filter:blur(18px) saturate(1.15);
592
+ }
593
+ .ets-root[data-theme="mint"] .hero{
594
+ background:linear-gradient(135deg,rgba(255,255,255,.62) 0%,rgba(255,255,255,.26) 100%);
595
+ border:1px solid rgba(255,255,255,.75); border-radius:18px; padding:16px 18px;
596
+ -webkit-backdrop-filter:blur(18px) saturate(1.15); backdrop-filter:blur(18px) saturate(1.15);
597
+ box-shadow:0 20px 44px -30px rgba(7,61,56,.45), inset 0 1px 0 rgba(255,255,255,.65);
598
+ }
599
+ .ets-root[data-theme="mint"] .hero-brand .v{background:var(--blue); color:#fff; border-radius:999px;}
600
+ .ets-root[data-theme="mint"] .card{
601
+ background:rgba(255,255,255,.52); border:1px solid rgba(255,255,255,.68); border-radius:18px;
602
+ -webkit-backdrop-filter:blur(22px) saturate(1.12); backdrop-filter:blur(22px) saturate(1.12);
603
+ box-shadow:0 22px 48px -32px rgba(7,61,56,.45), inset 0 1px 0 rgba(255,255,255,.60);
604
+ }
605
+ .ets-root[data-theme="mint"] .sc, .ets-root[data-theme="mint"] .total, .ets-root[data-theme="mint"] .out-panel{
606
+ background:rgba(255,255,255,.46); border-color:rgba(255,255,255,.60);
607
+ -webkit-backdrop-filter:blur(10px); backdrop-filter:blur(10px);
608
+ }
609
+ .ets-root[data-theme="mint"] .sc-issues, .ets-root[data-theme="mint"] .sc-eval{
610
+ background:rgba(255,255,255,.80); border-color:rgba(31,156,146,.16); color:var(--ink);
611
+ }
612
+ .ets-root[data-theme="mint"] #draft, .ets-root[data-theme="mint"] .fld input, .ets-root[data-theme="mint"] .fld select{
613
+ background:rgba(255,255,255,.78); border-color:rgba(255,255,255,.80);
614
+ }
615
+ .ets-root[data-theme="mint"] .btn, .ets-root[data-theme="mint"] .tiny, .ets-root[data-theme="mint"] .tag, .ets-root[data-theme="mint"] .hint-chip, .ets-root[data-theme="mint"] .seg, .ets-root[data-theme="mint"] .seg button, .ets-root[data-theme="mint"] .lang, .ets-root[data-theme="mint"] .lang button, .ets-root[data-theme="mint"] .doc{border-radius:999px;}
616
+ .ets-root[data-theme="mint"] .btn-primary{
617
+ background:var(--blue); color:#FFFFFF; box-shadow:0 6px 18px -6px rgba(23,140,130,.55);
618
+ }
619
+ .ets-root[data-theme="mint"] .btn-primary:hover{background:var(--blue-d);}
620
+ .ets-root[data-theme="mint"] .sc .bar{background:rgba(18,90,85,.10);}
621
+ .ets-root[data-theme="mint"] .sc .bar i{background:linear-gradient(90deg,#1F9C92 0%,#7CF5D0 100%);}
622
+ .ets-root[data-theme="mint"] .sc.warn .bar i{background:#E8A400;}
623
+ .ets-root[data-theme="mint"] .ring{
624
+ background:conic-gradient(from -90deg,
625
+ #0E6E66 0%,
626
+ #1F9C92 26%,
627
+ #7CF5D0 50%,
628
+ #2FB3A7 74%,
629
+ #0E6E66 100%);
630
+ box-shadow:0 10px 24px -14px rgba(31,156,146,.65);
631
+ }
632
+ .ets-root[data-theme="mint"] .ring::after{
633
+ background:radial-gradient(circle at 50% 32%, rgba(255,255,255,.94) 0%, rgba(255,255,255,.70) 100%);
634
+ }
635
+ .ets-root[data-theme="mint"] .ring b{
636
+ background:linear-gradient(145deg,#0E6E66 0%,#1F9C92 55%,#3AC9BA 100%);
637
+ -webkit-background-clip:text; background-clip:text;
638
+ color:transparent; -webkit-text-fill-color:transparent;
639
+ }
640
+ .ets-root[data-theme="mint"] .dtab.on::after{background:var(--blue);}
641
+ .ets-root[data-theme="mint"] .dtab.on .n{color:var(--blue);}
642
+ .ets-root .theme-wrap{position:relative;display:inline-flex;}
643
+ .ets-root .theme-pop{position:absolute;top:calc(100% + 9px);right:0;z-index:60;width:272px;padding:8px;
644
+ display:flex;flex-direction:column;gap:5px;border-radius:16px;border:1px solid var(--line);
645
+ background:var(--panel);box-shadow:0 26px 52px -26px rgba(0,0,0,.45),0 2px 8px rgba(0,0,0,.08);
646
+ -webkit-backdrop-filter:blur(22px) saturate(1.1); backdrop-filter:blur(22px) saturate(1.1);}
647
+ .ets-root .theme-pop[hidden]{display:none;}
648
+ .ets-root .th-card{display:flex;align-items:center;gap:10px;width:100%;padding:7px;border-radius:11px;
649
+ border:1px solid transparent;background:transparent;text-align:left;cursor:pointer;transition:.12s;}
650
+ .ets-root .th-card:hover{background:var(--surface);}
651
+ .ets-root .th-card.on{border-color:var(--blue-line);background:var(--blue-w);}
652
+ .ets-root .th-prev{position:relative;width:66px;height:42px;flex:none;border-radius:9px;overflow:hidden;
653
+ border:1px solid var(--line);box-shadow:inset 0 1px 0 rgba(255,255,255,.35);}
654
+ .ets-root .th-prev i{position:absolute;bottom:8px;width:9px;height:9px;border-radius:50%;}
655
+ .ets-root .th-prev i:nth-child(1){left:8px;}
656
+ .ets-root .th-prev i:nth-child(2){left:21px;}
657
+ .ets-root .th-prev i:nth-child(3){left:34px;}
658
+ .ets-root .th-classic{background:linear-gradient(135deg,#ffffff 0%,#f4f5f7 100%);}
659
+ .ets-root .th-classic i:nth-child(1){background:#4D6BFE;}
660
+ .ets-root .th-classic i:nth-child(2){background:#C8941F;}
661
+ .ets-root .th-classic i:nth-child(3){background:#2A4A6B;}
662
+ .ets-root .th-mint{background:linear-gradient(135deg,#E8F8F4 0%,#7CF5D0 58%,#2CADA3 100%);}
663
+ .ets-root .th-mint i:nth-child(1){background:#1F9C92;}
664
+ .ets-root .th-mint i:nth-child(2){background:#2CADA3;}
665
+ .ets-root .th-mint i:nth-child(3){background:#F2B705;}
666
+ .ets-root .th-ink{background:linear-gradient(135deg,#0B0C0E 0%,#1A1B20 55%,#2A2417 100%);}
667
+ .ets-root .th-ink i:nth-child(1){background:#E8B23A;}
668
+ .ets-root .th-ink i:nth-child(2){background:#F7D883;}
669
+ .ets-root .th-ink i:nth-child(3){background:#8A8779;}
670
+ .ets-root .th-paper{background:linear-gradient(135deg,#FBF7EC 0%,#F1E7D3 100%);}
671
+ .ets-root .th-paper i:nth-child(1){background:#1F1D1A;}
672
+ .ets-root .th-paper i:nth-child(2){background:#9A3B2E;}
673
+ .ets-root .th-paper i:nth-child(3){background:#B8892A;}
674
+ .ets-root .th-tx{min-width:0;}
675
+ .ets-root .th-tx b{display:block;font-size:12.5px;font-weight:650;color:var(--ink);}
676
+ .ets-root .th-tx i{display:block;font-size:11px;font-style:normal;color:var(--ink-3);margin-top:2px;}
677
+ .ets-root[data-theme="ink"]{
678
+ --bg:#0B0C0E; --card:rgba(20,21,25,.72); --panel:rgba(24,25,30,.82);
679
+ --surface:rgba(32,34,40,.72); --surface-2:rgba(44,46,54,.58);
680
+ --line:rgba(232,178,58,.16); --line-2:rgba(232,178,58,.30);
681
+ --ink:#F2EEE3; --ink-2:#CFC8B7; --ink-3:#948C7A; --muted:#6E6857;
682
+ --blue:#D4A72C; --blue-d:#B78E1C; --blue-w:rgba(232,178,58,.14); --blue-line:rgba(232,178,58,.38);
683
+ --gold:#E8B23A; --gold-2:#F7D883; --gold-w:rgba(232,178,58,.12); --gold-line:rgba(232,178,58,.30);
684
+ --navy:#D8C9A4;
685
+ --ok:#54B478; --ok-w:rgba(84,180,120,.16); --warn:#E8B23A; --warn-w:rgba(232,178,58,.14);
686
+ --err:#E2686C; --err-w:rgba(226,104,108,.14);
687
+ --shadow:0 20px 44px -30px rgba(0,0,0,.85), 0 2px 8px rgba(0,0,0,.45);
688
+ font-family:"Urbanist","Segoe UI",system-ui,-apple-system,"PingFang SC","Microsoft YaHei",sans-serif;
689
+ background:
690
+ radial-gradient(900px 520px at 8% -12%, rgba(232,178,58,.16) 0%, rgba(232,178,58,0) 62%),
691
+ radial-gradient(760px 480px at 96% 108%, rgba(212,167,44,.12) 0%, rgba(212,167,44,0) 60%),
692
+ linear-gradient(160deg,#0B0C0E 0%,#121318 52%,#0A0B0D 100%);
693
+ }
694
+ .ets-root[data-theme="ink"] .main, .ets-root[data-theme="ink"] .content{background:transparent;}
695
+ .ets-root[data-theme="ink"] .tb{
696
+ background:rgba(11,12,14,.66); border-bottom:1px solid rgba(232,178,58,.16);
697
+ -webkit-backdrop-filter:blur(18px) saturate(1.1); backdrop-filter:blur(18px) saturate(1.1);
698
+ }
699
+ .ets-root[data-theme="ink"] .hero{
700
+ background:linear-gradient(135deg,rgba(232,178,58,.14) 0%,rgba(255,255,255,.03) 100%);
701
+ border:1px solid rgba(232,178,58,.22); border-radius:18px; padding:16px 18px;
702
+ -webkit-backdrop-filter:blur(18px); backdrop-filter:blur(18px);
703
+ box-shadow:0 22px 46px -30px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.06);
704
+ }
705
+ .ets-root[data-theme="ink"] .hero-brand .v{background:var(--gold); color:#151006; border-radius:999px;}
706
+ .ets-root[data-theme="ink"] .card{
707
+ background:rgba(18,19,23,.66); border:1px solid rgba(232,178,58,.18); border-radius:18px;
708
+ -webkit-backdrop-filter:blur(22px); backdrop-filter:blur(22px);
709
+ box-shadow:0 24px 50px -34px rgba(0,0,0,.95), inset 0 1px 0 rgba(255,255,255,.05);
710
+ }
711
+ .ets-root[data-theme="ink"] .sc, .ets-root[data-theme="ink"] .total, .ets-root[data-theme="ink"] .out-panel{background:rgba(26,27,32,.60); border-color:rgba(232,178,58,.16);}
712
+ .ets-root[data-theme="ink"] .sc-issues, .ets-root[data-theme="ink"] .sc-eval{
713
+ background:rgba(13,14,17,.72); border-color:rgba(232,178,58,.18); color:var(--ink);
714
+ }
715
+ .ets-root[data-theme="ink"] #draft, .ets-root[data-theme="ink"] .fld input, .ets-root[data-theme="ink"] .fld select{
716
+ background:rgba(13,14,17,.72); border-color:rgba(232,178,58,.18);
717
+ }
718
+ .ets-root[data-theme="ink"] .btn, .ets-root[data-theme="ink"] .tiny, .ets-root[data-theme="ink"] .tag, .ets-root[data-theme="ink"] .hint-chip, .ets-root[data-theme="ink"] .seg, .ets-root[data-theme="ink"] .seg button, .ets-root[data-theme="ink"] .lang, .ets-root[data-theme="ink"] .lang button, .ets-root[data-theme="ink"] .doc{border-radius:999px;}
719
+ .ets-root[data-theme="ink"] .btn-primary{
720
+ background:var(--gold); color:#1A1408; box-shadow:0 6px 20px rgba(232,178,58,.25);
721
+ }
722
+ .ets-root[data-theme="ink"] .btn-primary:hover{background:var(--gold-2);}
723
+ .ets-root[data-theme="ink"] .btn-ghost{background:transparent; border-color:rgba(232,178,58,.24); color:var(--ink-2);}
724
+ .ets-root[data-theme="ink"] .seg button.on, .ets-root[data-theme="ink"] .lang button.on{background:rgba(232,178,58,.18); color:var(--gold-2);}
725
+ .ets-root[data-theme="ink"] .tip::after{background:#1D1E24; color:var(--ink); border:1px solid rgba(232,178,58,.20);}
726
+ .ets-root[data-theme="ink"] .legend{color:var(--ink-2); border-top-color:rgba(232,178,58,.16);}
727
+ .ets-root[data-theme="ink"] .sc-issues .none{color:var(--ink-3);}
728
+ .ets-root[data-theme="ink"] .ring{
729
+ background:conic-gradient(from -90deg,#8A6A17 0%,#E8B23A 30%,#F7D883 50%,#C9A227 72%,#8A6A17 100%);
730
+ box-shadow:0 10px 24px -14px rgba(232,178,58,.50);
731
+ }
732
+ .ets-root[data-theme="ink"] .ring::after{
733
+ background:radial-gradient(circle at 50% 32%, rgba(22,23,28,.96) 0%, rgba(12,13,16,.92) 100%);
734
+ }
735
+ .ets-root[data-theme="ink"] .ring b{
736
+ background:linear-gradient(145deg,#F7D883 0%,#E8B23A 55%,#B78E1C 100%);
737
+ -webkit-background-clip:text; background-clip:text;
738
+ color:transparent; -webkit-text-fill-color:transparent;
739
+ }
740
+ .ets-root .bind-mask{animation:ets-bindfade .16s ease both;}
741
+ .ets-root .bind-card{position:relative;background:#FFFFFF;border:1px solid var(--line);
742
+ box-shadow:0 30px 70px -30px rgba(0,0,0,.45);
743
+ animation:ets-bindpop .2s cubic-bezier(.2,.9,.3,1) both;}
744
+ .ets-root .bind-x{position:absolute;top:9px;right:9px;width:28px;height:28px;border-radius:8px;
745
+ display:grid;place-items:center;color:var(--ink-3);border:1px solid transparent;
746
+ transition:.12s;z-index:2;background:transparent;}
747
+ .ets-root .bind-x:hover{background:var(--surface);color:var(--ink);border-color:var(--line);}
748
+ .ets-root .bind-x svg{width:14px;height:14px;}
749
+ .ets-root[data-theme="mint"] .bind-card{background:#F7FBFA;}
750
+ .ets-root[data-theme="ink"] .bind-card{background:#15161B;border-color:rgba(232,178,58,.26);}
751
+ .ets-root[data-theme="ink"] .bind-input{background:#1B1C22;border-color:rgba(232,178,58,.22);color:var(--ink);}
752
+ .ets-root[data-theme="ink"] .bind-x:hover{background:rgba(232,178,58,.14);color:var(--gold-2);border-color:rgba(232,178,58,.26);}
753
+ @keyframes ets-bindfade{from{opacity:0}to{opacity:1}}
754
+ @keyframes ets-bindpop{from{opacity:0;transform:translateY(8px) scale(.97)}to{opacity:1;transform:none}}
755
+ .ets-root[data-theme="mint"] .seg{
756
+ background:rgba(31,156,146,.10); border-color:rgba(31,156,146,.20);
757
+ }
758
+ .ets-root[data-theme="mint"] .seg button{color:var(--blue-d);}
759
+ .ets-root[data-theme="mint"] .seg button.on{
760
+ background:var(--blue); color:#FFFFFF;
761
+ box-shadow:0 6px 16px -6px rgba(31,156,146,.55);
762
+ }
763
+ .ets-root[data-theme="mint"] .seg button:hover:not(.on){
764
+ background:rgba(31,156,146,.12); color:var(--blue-d);
765
+ }
766
+ .ets-root[data-theme="mint"] .sel3{
767
+ background:#FFFFFF; border-color:rgba(31,156,146,.26); color:var(--ink);
768
+ }
769
+ .ets-root[data-theme="mint"] .sel3:focus{
770
+ border-color:var(--blue); box-shadow:0 0 0 3px var(--blue-w);
771
+ }
772
+ .ets-root[data-theme="mint"] .cn input[type=range]::-webkit-slider-thumb{
773
+ background:var(--blue); border-color:#FFFFFF;
774
+ }
775
+ .ets-root[data-theme="mint"] .cn input[type=range]::-moz-range-thumb{
776
+ background:var(--blue); border-color:#FFFFFF;
777
+ }
778
+ .ets-root[data-theme="paper"]{
779
+ --bg:#F6F1E6; --card:#FFFDF8; --panel:#FFFDF8;
780
+ --surface:#F1EADC; --surface-2:#E7DCC9;
781
+ --line:#DED2BE; --line-2:#C2B098;
782
+ --ink:#1F1D1A; --ink-2:#3A342C; --ink-3:#6B6154; --muted:#7A7263;
783
+ --blue:#9A3B2E; --blue-d:#7C2C22; --blue-w:#F5E2DC; --blue-line:#DFB3A6;
784
+ --gold:#7E5B18; --gold-2:#B8892A; --gold-w:#F4EAD2; --gold-line:#E0CB9E;
785
+ --navy:#2F3B33;
786
+ --ok:#3F6B4F; --ok-w:#E7EFE6; --warn:#7E5B18; --warn-w:#F4EAD2;
787
+ --err:#A33A2E; --err-w:#F6E3DE;
788
+ --r:6px; --r-sm:4px; --r-xs:3px;
789
+ --shadow:0 1px 0 rgba(31,29,26,.06);
790
+ --brand:var(--blue);
791
+ font-family:"Segoe UI","PingFang SC","Microsoft YaHei",system-ui,sans-serif;
792
+ background-image:
793
+ radial-gradient(1200px 480px at 50% -10%, rgba(154,59,46,.05) 0%, rgba(154,59,46,0) 70%),
794
+ linear-gradient(180deg,#F8F4EA 0%,#F3ECDD 100%);
795
+ }
796
+ .ets-root[data-theme="paper"] .main, .ets-root[data-theme="paper"] .content{background:transparent;}
797
+ .ets-root[data-theme="paper"] .tb{
798
+ background:var(--bg); border-bottom:1px solid var(--ink); padding:9px 24px;
799
+ }
800
+ .ets-root[data-theme="paper"] #jumpSeg{background:transparent; border:0; padding:0; gap:14px;}
801
+ .ets-root[data-theme="paper"] #jumpSeg button{border-radius:0; padding:2px 0 4px; color:var(--ink-3); background:transparent;}
802
+ .ets-root[data-theme="paper"] #jumpSeg button.on{background:transparent; color:var(--ink); box-shadow:inset 0 -2px 0 var(--blue);}
803
+ .ets-root[data-theme="paper"] .tb .doc, .ets-root[data-theme="paper"] .tb .seg, .ets-root[data-theme="paper"] .tb .lang{border-radius:3px;}
804
+ .ets-root[data-theme="paper"] .hero{
805
+ display:flex; align-items:flex-end; gap:12px; padding:2px 0 12px;
806
+ border-bottom:3px double var(--ink); margin-bottom:2px;
807
+ }
808
+ .ets-root[data-theme="paper"] .hero-logo{width:38px; height:38px; border-radius:3px; box-shadow:none; border:1px solid var(--ink);}
809
+ .ets-root[data-theme="paper"] .hero-logo svg{width:38px; height:38px;}
810
+ .ets-root[data-theme="paper"] .hero-brand h1{
811
+ font-family:"Songti SC","SimSun",Georgia,"Times New Roman",serif;
812
+ font-size:30px; font-weight:700; letter-spacing:-.02em; line-height:1.1;
813
+ }
814
+ .ets-root[data-theme="paper"] .hero-brand .v{
815
+ background:var(--blue); color:#FFF6EC; border-radius:2px; font-size:9px;
816
+ letter-spacing:.14em; padding:2px 6px; transform:translateY(-2px);
817
+ }
818
+ .ets-root[data-theme="paper"] .hero-brand p{
819
+ font-size:11px; letter-spacing:.22em; text-transform:uppercase; color:var(--ink-3);
820
+ margin-top:4px;
821
+ }
822
+ .ets-root[data-theme="paper"] .hero-meta{font-size:11px; letter-spacing:.14em; color:var(--ink-3);}
823
+ .ets-root[data-theme="paper"] .hero-meta .ver{border-radius:2px; border-color:var(--line-2); background:transparent;}
824
+ .ets-root[data-theme="paper"] .wrap{
825
+ max-width:1400px; display:grid;
826
+ grid-template-columns:minmax(0,1.5fr) minmax(320px,.82fr);
827
+ grid-template-areas:
828
+ "hero hero"
829
+ "tabs tabs"
830
+ "input score"
831
+ "draft score"
832
+ "output params"
833
+ "detail detail";
834
+ gap:18px 24px; align-items:start; padding:16px 26px 96px;
835
+ }
836
+ .ets-root[data-theme="paper"] .hero{grid-area:hero;}
837
+ .ets-root[data-theme="paper"] .task-tabs{grid-area:tabs;}
838
+ .ets-root[data-theme="paper"] #sec-input{grid-area:input;}
839
+ .ets-root[data-theme="paper"] #sec-draft{grid-area:draft;}
840
+ .ets-root[data-theme="paper"] #sec-output{grid-area:output;}
841
+ .ets-root[data-theme="paper"] .wrap > section.card:has(.score-row){grid-area:score;}
842
+ .ets-root[data-theme="paper"] .wrap > section.card:has(.console){grid-area:params;}
843
+ .ets-root[data-theme="paper"] #sec-detail{grid-area:detail;}
844
+ .ets-root[data-theme="paper"] .wrap > .end{grid-column:1/-1; grid-row:7; margin-top:4px;}
845
+ @media (max-width:900px){
846
+ .ets-root[data-theme="paper"] .wrap{display:block; padding:12px 14px 88px;}
847
+ .ets-root[data-theme="paper"] .meta{grid-template-columns:1fr 1fr;}
848
+ .ets-root[data-theme="paper"] .meta > *{min-width:0;}
849
+ .ets-root[data-theme="paper"] .card{margin-bottom:14px;}
850
+ }
851
+ .ets-root[data-theme="paper"] .card{
852
+ background:var(--card); border:1px solid var(--line-2); border-radius:4px;
853
+ padding:16px 18px; box-shadow:none;
854
+ }
855
+ .ets-root[data-theme="paper"] .card-h{
856
+ border-bottom:1px solid var(--line); padding-bottom:8px; margin-bottom:13px; gap:8px;
857
+ }
858
+ .ets-root[data-theme="paper"] .card-h .t{
859
+ font-family:"Songti SC","SimSun",Georgia,serif; font-size:17px; font-weight:700; letter-spacing:.01em;
860
+ }
861
+ .ets-root[data-theme="paper"] .card-h .n{font-size:10.5px; letter-spacing:.08em; text-transform:uppercase;}
862
+ .ets-root[data-theme="paper"] .fld label, .ets-root[data-theme="paper"] .lb{font-size:10.5px; letter-spacing:.12em; text-transform:uppercase; color:var(--ink-3);}
863
+ .ets-root[data-theme="paper"] .fld input, .ets-root[data-theme="paper"] .fld select, .ets-root[data-theme="paper"] .sel3, .ets-root[data-theme="paper"] #draft, .ets-root[data-theme="paper"] .bind-input{
864
+ background:#FFFEFA; border:1px solid var(--line-2); border-radius:2px;
865
+ color:var(--ink); font-size:14px;
866
+ }
867
+ .ets-root[data-theme="paper"] #draft{
868
+ border-left:3px solid var(--blue); padding:14px 16px; line-height:1.85;
869
+ font-size:14.5px; box-shadow:inset 0 0 0 1px #fff; min-height:300px;
870
+ }
871
+ .ets-root[data-theme="paper"] .tiny{border-radius:2px; background:transparent; border-color:var(--line-2); font-size:11.5px;}
872
+ .ets-root[data-theme="paper"] .tiny:hover{border-color:var(--ink); color:var(--ink);}
873
+ .ets-root[data-theme="paper"] .hint-chip{border-radius:2px; background:var(--surface); font-size:10px;}
874
+ .ets-root[data-theme="paper"] .score-row{grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px;}
875
+ .ets-root[data-theme="paper"] .total{grid-column:1/-1;}
876
+ .ets-root[data-theme="paper"] .sc{
877
+ background:var(--card); border:1px solid var(--line); border-radius:3px; padding:11px 12px;
878
+ }
879
+ .ets-root[data-theme="paper"] .sc .top b{font-family:Georgia,serif; font-size:11px; letter-spacing:.08em; color:var(--blue-d);}
880
+ .ets-root[data-theme="paper"] .sc .top em{font-family:Georgia,serif;}
881
+ .ets-root[data-theme="paper"] .sc .bar{height:3px; border-radius:0; background:var(--surface-2);}
882
+ .ets-root[data-theme="paper"] .sc .bar i{border-radius:0; background:var(--ink-2);}
883
+ .ets-root[data-theme="paper"] .sc .top em{font-variant-numeric:tabular-nums; letter-spacing:0;}
884
+ .ets-root[data-theme="paper"] .sc .top em i{margin-left:0; letter-spacing:0;}
885
+ .ets-root[data-theme="paper"] .sc.warn .bar i{background:var(--gold-2);}
886
+ .ets-root[data-theme="paper"] .sc .ev{font-size:10.5px; color:var(--ink-3);}
887
+ .ets-root[data-theme="paper"] .sc-issues{
888
+ background:var(--surface); border:1px solid var(--line); border-radius:2px;
889
+ font-size:10.5px; color:var(--ink-2); max-height:150px;
890
+ }
891
+ .ets-root[data-theme="paper"] .sc-issues .li::before{color:var(--blue);}
892
+ .ets-root[data-theme="paper"] .total{border-radius:3px; border:1px solid var(--line); background:var(--surface);}
893
+ .ets-root[data-theme="paper"] .ring{box-shadow:none; background:conic-gradient(from -90deg,#7E5B18 0%,#B8892A 45%,#D9B768 60%,#7E5B18 100%);}
894
+ .ets-root[data-theme="paper"] .ring::after{background:var(--card);}
895
+ .ets-root[data-theme="paper"] .ring b{font-family:Georgia,serif; background:none; color:var(--ink); -webkit-text-fill-color:var(--ink);}
896
+ .ets-root[data-theme="paper"] .total .tx>b{font-size:10px; letter-spacing:.14em; text-transform:uppercase;}
897
+ .ets-root[data-theme="paper"] .adv{font-size:11px; color:var(--ink-3); line-height:1.6;}
898
+ .ets-root[data-theme="paper"] .console{grid-template-columns:minmax(0,1fr) !important; gap:13px;}
899
+ .ets-root[data-theme="paper"] .cn{min-width:0;}
900
+ .ets-root[data-theme="paper"] .cn-run{grid-column:auto; grid-row:auto;}
901
+ .ets-root[data-theme="paper"] .cn .fv{font-family:Georgia,serif; color:var(--blue-d);}
902
+ .ets-root[data-theme="paper"] .cn input[type=range]::-webkit-slider-thumb{background:var(--blue); border:2px solid #FFFDF8; border-radius:2px;}
903
+ .ets-root[data-theme="paper"] .seg{
904
+ background:transparent; border:1px solid var(--line-2); border-radius:2px; padding:2px; gap:2px;
905
+ }
906
+ .ets-root[data-theme="paper"] .seg button{border-radius:1px; font-size:11.5px; padding:5px 10px; color:var(--ink-3);}
907
+ .ets-root[data-theme="paper"] .seg button.on{background:var(--ink); color:#FBF6EA; box-shadow:none;}
908
+ .ets-root[data-theme="paper"] .btn{
909
+ border-radius:2px; border:1px solid var(--ink); background:transparent; color:var(--ink);
910
+ font-size:12.5px; padding:8px 14px;
911
+ }
912
+ .ets-root[data-theme="paper"] .btn-primary{
913
+ background:var(--blue); border-color:var(--blue-d); color:#FFF6EC;
914
+ box-shadow:3px 3px 0 rgba(31,29,26,.85);
915
+ }
916
+ .ets-root[data-theme="paper"] .btn-primary:hover{background:var(--blue-d); box-shadow:3px 3px 0 rgba(31,29,26,.85);}
917
+ .ets-root[data-theme="paper"] .btn-primary:active{transform:translate(2px,2px); box-shadow:1px 1px 0 rgba(31,29,26,.85);}
918
+ .ets-root[data-theme="paper"] .cn-run .btn{width:100%; justify-content:center; padding:11px 14px; font-size:14px;}
919
+ .ets-root[data-theme="paper"] .out-panel{background:var(--card); border:1px solid var(--line); border-radius:3px;}
920
+ .ets-root[data-theme="paper"] .out{font-size:15.5px; line-height:2.05; letter-spacing:.005em;}
921
+ .ets-root[data-theme="paper"] .dtabs{border-bottom:1px solid var(--ink);}
922
+ .ets-root[data-theme="paper"] .dtab{border-radius:0; font-family:"Songti SC","SimSun",Georgia,serif; font-size:14px;}
923
+ .ets-root[data-theme="paper"] .dtab.on::after{background:var(--blue); height:3px; left:0; right:0;}
924
+ .ets-root[data-theme="paper"] .dtab.on .n{color:var(--blue);}
925
+ .ets-root[data-theme="paper"] .hunk{border-radius:3px; border-color:var(--line); box-shadow:none;}
926
+ .ets-root[data-theme="paper"] .hunk-head{background:var(--surface);}
927
+ .ets-root[data-theme="paper"] .mini{border-radius:2px;}
928
+ .ets-root[data-theme="paper"] .toast{border-radius:3px; background:var(--ink); color:#FBF6EA;}
929
+ .ets-root{height:100%;min-height:420px;position:relative;display:flex;flex-direction:column;}
930
+ .ets-root .main{flex:1;min-width:0;min-height:0;}
931
+ .ets-fatal{position:absolute;left:16px;right:16px;bottom:16px;z-index:99;
932
+ background:#fdeced;color:#8a1f24;border:1px solid #f3c2c5;border-radius:10px;
933
+ padding:12px 14px;font:12px/1.55 ui-monospace,Consolas,monospace;white-space:pre-wrap;
934
+ max-height:50%;overflow:auto;}
935
+ `;
936
+
937
+ const HTML = '<style>' + CSS + '</style>' + `<div class="main">
938
+
939
+ <div class="tb">
940
+ <div class="crumb"><span data-i18n="tb.crumb">工作台</span> <span>/</span> <b>EconTone Studio</b></div>
941
+ <button class="doc" id="btnBind" data-i18n-title="bind.title" title="绑定工作对话">
942
+ <svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M10.6 13.4a4.2 4.2 0 0 0 5.9 0l2.1-2.1a4.2 4.2 0 0 0-5.9-5.9l-1 1" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/><path d="M13.4 10.6a4.2 4.2 0 0 0-5.9 0l-2.1 2.1a4.2 4.2 0 0 0 5.9 5.9l1-1" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg>
943
+ <span data-i18n="bind.title">绑定工作对话</span> <span class="sha mono" id="bindName">EconTone</span>
944
+ </button>
945
+
946
+ <div class="seg" id="jumpSeg">
947
+ <button class="on" data-jump="top" data-i18n="tb.overview">概览</button>
948
+ <button data-jump="detail" data-i18n="tb.detail">详情</button>
949
+ </div>
950
+
951
+ <div class="grow"></div>
952
+
953
+ <button class="doc" id="btnHistory" data-i18n-title="hist.title" title="历史记录">
954
+ <svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M3.5 12a8.5 8.5 0 1 0 2.6-6.1M3.5 4.5V9H8" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 8v4.5l3 1.8" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>
955
+ <span data-i18n="hist.title">历史</span>
956
+ </button>
957
+
958
+ <button class="doc" id="btnSync" data-i18n-title="sync.tip" title="同步两个窗口">
959
+ <svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M4 9a8 8 0 0 1 13.6-3.2L20 8M20 4v4h-4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/><path d="M20 15a8 8 0 0 1-13.6 3.2L4 16M4 20v-4h4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>
960
+ <span data-i18n="sync.now">同步</span>
961
+ </button>
962
+
963
+ <div class="theme-wrap" id="themeWrap">
964
+ <button class="doc" id="themeBtn" aria-haspopup="true" aria-expanded="false" data-i18n-title="theme.title" title="界面风格">
965
+ <svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><circle cx="12" cy="12" r="9" stroke="currentColor" stroke-width="1.4"/><path d="M12 3.4a8.6 8.6 0 1 0 0 17.2c1.9 0 2.9-1.2 2.9-2.5 0-1.6-1.5-2.3-1.5-3.7 0-1.1.9-1.9 2.2-1.9h1.3a2.7 2.7 0 0 0 2.7-2.7" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"/></svg>
966
+ <span id="themeName">主题:默认</span>
967
+ </button>
968
+ <div class="theme-pop" id="themePop" role="dialog" data-i18n-aria="theme.title" aria-label="界面风格" hidden>
969
+ <button class="th-card on" data-t="classic" type="button">
970
+ <span class="th-prev th-classic"><i></i><i></i><i></i></span>
971
+ <span class="th-tx"><b data-i18n="theme.classic">默认</b><i data-i18n="theme.classicDesc">墨 · 靛 · 金</i></span>
972
+ </button>
973
+ <button class="th-card" data-t="mint" type="button">
974
+ <span class="th-prev th-mint"><i></i><i></i><i></i></span>
975
+ <span class="th-tx"><b data-i18n="theme.mint">风格 1</b><i data-i18n="theme.mintDesc">薄荷青 · 玻璃</i></span>
976
+ </button>
977
+ <button class="th-card" data-t="ink" type="button">
978
+ <span class="th-prev th-ink"><i></i><i></i><i></i></span>
979
+ <span class="th-tx"><b data-i18n="theme.ink">风格 2</b><i data-i18n="theme.inkDesc">黑金 · 玻璃</i></span>
980
+ </button>
981
+ <button class="th-card" data-t="paper" type="button">
982
+ <span class="th-prev th-paper"><i></i><i></i><i></i></span>
983
+ <span class="th-tx"><b data-i18n="theme.paper">风格 3</b><i data-i18n="theme.paperDesc">稿纸 · 朱砂 · 双栏</i></span>
984
+ </button>
985
+ </div>
986
+ </div>
987
+
988
+ <button class="doc" id="btnPopout" data-i18n-title="open.tip" title="在独立窗口打开">
989
+ <svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M14 4h6v6M20 4l-8 8" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/><path d="M18 14v4.5A1.5 1.5 0 0 1 16.5 20h-11A1.5 1.5 0 0 1 4 18.5v-11A1.5 1.5 0 0 1 5.5 6H10" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>
990
+ <span data-i18n="open.window">独立窗口</span>
991
+ </button>
992
+
993
+ <div class="lang" id="langSwitch" role="group" aria-label="Language">
994
+ <button data-l="zh" class="on" lang="zh-CN">中</button>
995
+ <button data-l="en" lang="en">EN</button>
996
+ </div>
997
+ <button class="doc icon-only" id="btnRepo" data-i18n-title="repo.tip" title="GitHub 仓库" aria-label="GitHub">
998
+ <svg viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
999
+ </button>
1000
+ </div>
1001
+
1002
+ <div class="content" id="content">
1003
+
1004
+ <div class="hist-page" id="histPage" hidden>
1005
+ <div class="card">
1006
+ <div class="card-h">
1007
+ <span class="t" data-i18n="hist.title">历史记录</span>
1008
+ <span class="grow"></span>
1009
+ <button class="btn btn-primary hist-back" id="histBack" data-i18n="hist.back">返回工作台</button>
1010
+ </div>
1011
+ <div class="hist-tools">
1012
+ <input class="bind-input hist-search" id="histSearch" spellcheck="false" placeholder="搜索原文、编号、时间、任务…" />
1013
+ <select class="sel3 hist-mode" id="histModeSel">
1014
+ <option value="all" data-i18n="hist.allTypes">全部类型</option>
1015
+ <option value="measure" data-i18n="hist.score">评分</option>
1016
+ <option value="arbitrate" data-i18n="hist.rewrite">改写</option>
1017
+ </select>
1018
+ </div>
1019
+ <div class="hist-list" id="histList"></div>
1020
+ <div class="hist-pager" id="histPager"></div>
1021
+ </div>
1022
+ </div>
1023
+ <div class="wrap">
1024
+
1025
+ <!-- 品牌头 -->
1026
+ <header class="hero">
1027
+ <div class="hero-logo" aria-hidden="true">
1028
+ <!-- 官方 EconTone 应用图标:Light Paper 底 + 小尺寸符号(金斜带) -->
1029
+ <svg viewBox="0 0 256 256" width="46" height="46" role="img">
1030
+ <rect width="256" height="256" rx="57.6" fill="#F2EFE6"/>
1031
+ <g transform="translate(17.02 17.02) scale(0.867)">
1032
+ <path fill="#111111" d="M168 56 A74.29 74.29 0 0 1 168 200 A170 170 0 0 0 168 56 Z M88 200 A74.29 74.29 0 0 1 88 56 A170 170 0 0 0 88 200 Z"/>
1033
+ <path fill="#111111" d="M80 128 A48 48 0 1 0 176 128 A48 48 0 1 0 80 128 Z"/>
1034
+ <path fill="#E8B23A" d="M109.66 157.66 L157.66 109.66 L146.34 98.34 L98.34 146.34 Z"/>
1035
+ </g>
1036
+ </svg>
1037
+ </div>
1038
+ <div class="hero-brand">
1039
+ <h1>EconTone Studio <span class="v">BETA</span></h1>
1040
+ <p data-i18n="hero.sub">基于博弈思想的经管论文精修工作台</p>
1041
+ </div>
1042
+ <div class="grow"></div>
1043
+ <div class="hero-meta">
1044
+ <span class="led"></span><span>ONLINE</span>
1045
+ <span class="ver" id="heroVer">v0.5 · TESTING</span>
1046
+ </div>
1047
+ </header>
1048
+
1049
+ <div class="task-tabs" id="taskTabs" role="tablist"></div>
1050
+
1051
+ <!-- 1 文本与元信息 -->
1052
+ <section class="card" id="sec-input">
1053
+ <div class="card-h">
1054
+ <span class="t tip" data-i18n="in.title" data-i18n-tip="in.hint" tabindex="0">文本输入</span>
1055
+ <span class="grow"></span>
1056
+ <button class="tiny" id="btnClear" data-i18n="in.clear">清空</button>
1057
+ <button class="tiny" id="btnFile" data-i18n="in.file">从文件载入</button>
1058
+ <button class="tiny" id="btnSample" data-i18n="in.sample">示例</button>
1059
+ </div>
1060
+
1061
+ <div class="meta">
1062
+ <div class="fld">
1063
+ <label data-i18n="meta.journal">目标期刊</label>
1064
+ <input id="mJournal" data-i18n-ph="meta.journalPh" placeholder="如 AER / QJE / MS" />
1065
+ </div>
1066
+ <div class="fld">
1067
+ <label data-i18n="meta.field">学科</label>
1068
+ <input id="mField" data-i18n-ph="meta.fieldPh" placeholder="如 微观经济学 / 劳动经济学" />
1069
+ </div>
1070
+ <div class="fld">
1071
+ <label class="tip tip-r" data-i18n="meta.section" data-i18n-tip="meta.hint" tabindex="0">文本位置</label>
1072
+ <input id="mSection" data-i18n-ph="meta.sectionPh" placeholder="如 正文 / 摘要 / 引言" autocomplete="off" />
1073
+ <span class="hint-chip" id="sectionHint">--profile body</span>
1074
+ </div>
1075
+ <div class="fld">
1076
+ <label data-i18n="meta.note">备注</label>
1077
+ <input id="mNote" data-i18n-ph="meta.notePh" placeholder="如:双盲评审,避免第一人称" />
1078
+ </div>
1079
+ </div>
1080
+
1081
+ <textarea id="draft" data-i18n-ph="in.ph" spellcheck="false">Place-based policies are a central instrument of regional policy in developing economies. Their employment effects, however, remain contested.
1082
+
1083
+ Recent studies utilize a difference-in-difference design to identify the effect of place-based policies. It is worth noting that the parallel trend hypothesis is likely to hold in our setting.
1084
+
1085
+ We find that the policy significantly increases employment, and the effect is robust across specifications.
1086
+
1087
+ These results suggest that the policy is effective and should be extended to other regions.
1088
+
1089
+ Our estimates exploit variation in the timing of county-level pilot designation between 2003 and 2010.</textarea>
1090
+
1091
+ <div class="meta-foot">
1092
+ <div class="stats sm">
1093
+ <div class="stat"><b class="num" id="charCount">642</b><span data-i18n="in.chars">字符</span></div>
1094
+ <div class="stat"><b class="num" id="lineCount">9</b><span data-i18n="in.rows">行</span></div>
1095
+ </div>
1096
+ <span class="mf-label" data-i18n="in.task">任务</span>
1097
+ <span class="hint-chip" id="taskHint" data-i18n-title="in.taskAuto" title="根据粘贴的文本自动识别">PO-EN 英文润色</span>
1098
+ <span class="grow"></span>
1099
+ <span class="tag ins">UTF-8</span>
1100
+ </div>
1101
+ </section>
1102
+
1103
+ <!-- 1.5 初稿(仅中译英时出现) -->
1104
+ <section class="card" id="sec-draft" hidden>
1105
+ <div class="card-h">
1106
+ <span class="t" data-i18n="dr.title">英文初稿</span>
1107
+ <span class="tag ins" data-i18n="dr.badge">agent 直译 · 未调用 skill</span>
1108
+ <span class="grow"></span>
1109
+ </div>
1110
+ <div class="out" id="draftText"></div>
1111
+ </section>
1112
+
1113
+ <!-- 2 评分 -->
1114
+ <section class="card">
1115
+ <div class="card-h">
1116
+ <span class="t tip" data-i18n="sc.title" data-i18n-tip="sc.note" tabindex="0">评分卡</span>
1117
+ <span class="grow"></span>
1118
+ <button class="tiny icon-btn" id="btnRunRefresh" data-i18n-title="run.refresh" title="按运行记录获取最新结果" aria-label="refresh">
1119
+ <svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M20 11a8 8 0 1 0-2.3 6.7M20 5v6h-6" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></svg>
1120
+ </button>
1121
+ <button class="tiny" id="btnScoreClear" data-i18n="sc.clear">清空</button>
1122
+ <button class="btn btn-primary btn-score" id="btnScore" data-i18n="sc.run">评分</button>
1123
+ </div>
1124
+ <div class="score-row" id="scoreRow">
1125
+ <div class="sc">
1126
+ <div class="top"><b>P1</b><span data-i18n="sc.p1">术语与语域</span><em class="num">30<i>/40</i></em></div>
1127
+ <div class="bar"><i style="width:75%"></i></div>
1128
+ <div class="ev" data-i18n="sc.e1">polish · 4 处禁用变体</div>
1129
+ </div>
1130
+ <div class="sc">
1131
+ <div class="top"><b>P2</b><span data-i18n="sc.p2">主张与结构</span><em class="num">32<i>/40</i></em></div>
1132
+ <div class="bar"><i style="width:80%"></i></div>
1133
+ <div class="ev" data-i18n="sc.e2">polish · 1 处显著无幅度</div>
1134
+ </div>
1135
+ <div class="sc warn">
1136
+ <div class="top"><b>T1</b><span data-i18n="sc.t1">AI 痕迹</span><em class="num">8<i>/10</i></em></div>
1137
+ <div class="bar"><i style="width:80%"></i></div>
1138
+ <div class="ev">trace · risk 41.2 ELEVATED</div>
1139
+ </div>
1140
+ <div class="sc warn">
1141
+ <div class="top"><b>R1</b><span data-i18n="sc.r1">节奏</span><em class="num">8<i>/10</i></em></div>
1142
+ <div class="bar"><i style="width:80%"></i></div>
1143
+ <div class="ev">prosody · ADJUST · 5 WARN</div>
1144
+ </div>
1145
+ <div class="total">
1146
+ <div class="ring" style="--p:78"><b class="num">78</b></div>
1147
+ <div class="tx">
1148
+ <b data-i18n="sc.total">总分 / 100</b>
1149
+ <div class="adv" data-i18n="sc.advice">只修错,不重构;作者写得顺的句子保持原样</div>
1150
+ </div>
1151
+ </div>
1152
+ </div>
1153
+ </section>
1154
+
1155
+ <!-- 3 运行参数 -->
1156
+ <section class="card">
1157
+ <div class="card-h">
1158
+ <span class="t tip" data-i18n="cn.title" data-i18n-tip="cn.note" tabindex="0">运行参数</span>
1159
+ <span class="grow"></span>
1160
+ <button class="toggle on" id="gameSwitch" type="button" aria-pressed="true" data-i18n-title="cn.switchTip" title="打开时使用博弈模式;关闭时自行选择本地 skill">
1161
+ <span class="tr"></span><span data-i18n="cn.switch">博弈</span>
1162
+ </button>
1163
+ </div>
1164
+ <div class="console">
1165
+ <div class="cn">
1166
+ <span class="lb tip" data-i18n="cn.game" data-i18n-tip="game.hint" tabindex="0">博弈模型 / GAME MODEL</span>
1167
+ <select class="sel3 wide" id="gameSel">
1168
+ <option value="stack" data-i18n="game.stack">斯塔克伯格 · 字典序(默认)</option>
1169
+ <option value="maxsum" data-i18n="game.maxsum">斯塔克伯格 · 最大和联盟</option>
1170
+ <option value="nash" data-i18n="game.nash">斯塔克伯格 · 纳什议价</option>
1171
+ <option value="cournot" data-i18n="game.cournot">古诺竞争 · 同时决策</option>
1172
+ <option value="bertrand" data-i18n="game.bertrand">伯川德竞争 · 同时决策</option>
1173
+ <option value="none" data-i18n="game.none">不使用均衡(None)</option>
1174
+ </select>
1175
+ <span class="flag mono" id="gameFlag">--coalition none</span>
1176
+ </div>
1177
+
1178
+ <div class="cn">
1179
+ <span class="lb tip" data-i18n="cn.order" data-i18n-tip="order.hint" tabindex="0">博弈顺序 / ORDER</span>
1180
+ <div class="seg" id="orderSeg">
1181
+ <button class="on" data-o="sequential" data-i18n="order.seq">序贯</button>
1182
+ <button data-o="simultaneous" data-i18n="order.sim">同时</button>
1183
+ </div>
1184
+ </div>
1185
+
1186
+ <div class="cn">
1187
+ <span class="lb" data-i18n="cn.coop">合作类型 / COOPERATION</span>
1188
+ <div class="seg" id="coopSeg">
1189
+ <button data-coop="coop" data-i18n="coop.coop">合作</button>
1190
+ <button class="on" data-coop="noncoop" data-i18n="coop.non">非合作</button>
1191
+ </div>
1192
+ </div>
1193
+
1194
+ <div class="cn">
1195
+ <span class="lb" data-i18n="cn.coal">联盟 / COALITION</span>
1196
+ <div class="seg" id="coalSeg">
1197
+ <button class="on" data-c="none">none</button>
1198
+ <button data-c="maxsum">maxsum</button>
1199
+ <button data-c="nash">nash</button>
1200
+ </div>
1201
+ </div>
1202
+
1203
+ <div class="cn">
1204
+ <span class="lb"><span data-i18n="cn.extent">修改幅度 / EXTENT</span> <span class="auto-pill">0 = AUTO</span></span>
1205
+ <div class="rw">
1206
+ <input type="range" id="extent" min="0" max="100" step="1" value="0" data-i18n-aria="cn.extentAria" aria-label="修改幅度">
1207
+ <b class="fv num" id="extentVal">AUTO</b>
1208
+ </div>
1209
+ </div>
1210
+
1211
+ <div class="cn">
1212
+ <span class="lb tip" data-i18n="cn.mode" data-i18n-tip="mode.hint" tabindex="0">Action Mode · 约束</span>
1213
+ <div class="seg" id="modeSeg">
1214
+ <button class="on" data-m="constrained" data-i18n="mode.constrained">受约束</button>
1215
+ <button data-m="free" data-i18n="mode.free">自由</button>
1216
+ </div>
1217
+ </div>
1218
+ <div class="cn">
1219
+ <span class="lb" data-i18n="cn.budget">期望时间 / BUDGET</span>
1220
+ <div class="fval">
1221
+ <input type="range" id="budget" min="30" max="180" step="5" value="60" aria-label="budget">
1222
+ <b class="fv num" id="budgetVal">60s</b>
1223
+ </div>
1224
+ </div>
1225
+
1226
+ <div class="cn">
1227
+ <span class="lb tip" data-i18n="cn.conn" data-i18n-tip="conn.hint" tabindex="0">连接方式 / LINK</span>
1228
+ <div class="seg" id="connSeg">
1229
+ <button data-c="stream" data-i18n="conn.stream">流式直连</button>
1230
+ <button class="on" data-c="agent" data-i18n="conn.agent">Agent 参与</button>
1231
+ </div>
1232
+ </div>
1233
+ <div class="cn" id="engineCard">
1234
+ <span class="lb tip" data-i18n="cn.engine" data-i18n-tip="engine.hint" tabindex="0">引擎选择 / ENGINE</span>
1235
+ <select class="sel3 wide" id="engineSel">
1236
+ <option value="polish" data-i18n="engine.polish">polish</option>
1237
+ <option value="ai-trace" data-i18n="engine.aitrace">ai-trace</option>
1238
+ <option value="prosody" data-i18n="engine.prosody">prosody</option>
1239
+ <option value="equilibrium">equilibrium</option>
1240
+ <option value="__pick__" id="enginePickOpt">+ 选择本地 skill…</option>
1241
+ </select>
1242
+ </div>
1243
+ <div class="cn cn-run">
1244
+ <button class="btn btn-primary" id="btnRun" data-i18n-title="tb.eqTitle" title="求解字典序 Stackelberg 均衡,单节约 10 分钟">
1245
+ <svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M7 5.5v13l11-6.5-11-6.5Z" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/></svg>
1246
+ <span data-i18n="tb.run">润色</span>
1247
+ </button>
1248
+ </div>
1249
+ </div>
1250
+ </section>
1251
+
1252
+ <!-- 4 改写稿(整段) -->
1253
+ <section class="card" id="sec-output">
1254
+ <div class="card-h">
1255
+ <span class="t" data-i18n="out.title">改写稿</span>
1256
+ <select class="hist-sel mono" id="histSel" hidden></select>
1257
+ <span class="run-badge mono" id="runBadge" hidden></span>
1258
+ <span class="run-stamp mono" id="outStamp" hidden></span>
1259
+ <span class="grow"></span>
1260
+ <button class="tiny" id="btnRefresh" data-i18n="out.refresh" title="重新连接这一次改写">刷新</button>
1261
+ <button class="toggle on" id="showAddBtn" aria-pressed="true">
1262
+ <span class="tr"></span><span id="showAddLabel" data-i18n="out.showadd">显示增加或替换</span>
1263
+ </button>
1264
+ <button class="toggle" id="showDelBtn" aria-pressed="false">
1265
+ <span class="tr"></span><span id="showDelLabel" data-i18n="out.showdel">显示删除</span>
1266
+ </button>
1267
+ </div>
1268
+
1269
+ <div class="out-panel">
1270
+ <div class="out" id="outText">
1271
+ <p>Place-based policies are a central instrument of regional policy in developing economies. Their employment effects, however, remain contested.</p>
1272
+
1273
+ <p>Recent studies <mark data-ref="h1" data-sev="err" class="sev-err" tabindex="0">use<sup>1</sup></mark> a <mark data-ref="h1" data-sev="err" class="sev-err" tabindex="0">difference-in-differences<sup>1</sup></mark> design to identify the effect of place-based policies. <span class="dele"><s>It is worth noting that the </s></span><mark data-ref="h2" data-sev="err" class="sev-err" tabindex="0">The parallel-trends assumption<sup>2</sup></mark> is plausible in our setting; pre-trend tests are available for 2003–2010.</p>
1274
+
1275
+ <p>We find that the policy <span class="dele"><s>significantly increases </s></span><mark data-ref="h3" data-sev="err" class="sev-err" tabindex="0">raises employment by 3.2 percentage points<sup>3</sup></mark>, and the estimate is stable across specifications.</p>
1276
+
1277
+ <p>These results suggest that the policy was effective over the sample period; <span class="dele"><s>should be extended to other regions</s></span><mark data-ref="h4" data-sev="warn" class="sev-warn" tabindex="0">extending it to other regions requires evidence from a different design<sup>4</sup></mark>.</p>
1278
+
1279
+ <p>Our estimates exploit variation in the timing of county-level pilot designation between 2003 and 2010.</p>
1280
+ </div>
1281
+ <div class="out-score" id="outScore"></div>
1282
+ </div>
1283
+
1284
+ <div class="legend">
1285
+ <span class="k"><span class="sw1"></span><span data-i18n="out.lg1">绿底 = 新增或替换</span></span>
1286
+ <span class="k"><span class="sw2"></span><span data-i18n="out.lg2">删除线 = 原文被删</span></span>
1287
+ <span class="k"><span class="sw3"></span><sup style="color:var(--err);font-weight:800">n</sup><span data-i18n="out.lg3">编号 = 对应下方改动条目</span></span>
1288
+ <span class="grow"></span>
1289
+ <span data-i18n="out.lg4">点编号可直接跳到细节</span>
1290
+ </div>
1291
+
1292
+ <div class="out-foot">
1293
+ <div class="stats">
1294
+ <div class="stat"><b class="num" id="outCount">4</b><span data-i18n="stat.edits">处改动</span></div>
1295
+ <div class="stat"><b class="num" id="outWords">12</b><span data-i18n="stat.words">处词级替换</span></div>
1296
+ </div>
1297
+ <span class="grow"></span>
1298
+ <button class="btn btn-ghost" id="saveOut" data-i18n="out.save">保存采纳结果</button>
1299
+ <button class="btn btn-ghost" id="copyOut" data-i18n="out.copy">复制改写稿</button>
1300
+ </div>
1301
+ </section>
1302
+
1303
+ <!-- 5 详细结果(滚动到此处才加载) -->
1304
+ <section class="card" id="sec-detail">
1305
+ <div class="card-h">
1306
+ <span class="t" data-i18n="det.title">详细结果</span>
1307
+ </div>
1308
+
1309
+ <div class="skel" id="detailSkel">
1310
+ <div class="sk"></div><div class="sk"></div><div class="sk tall"></div>
1311
+ </div>
1312
+
1313
+ <div id="detailBody" hidden>
1314
+ <div class="dtabs" role="tablist">
1315
+ <button class="dtab on" data-dtab="diff" role="tab" aria-selected="true"><span data-i18n="det.tab.diff">逐条对比</span><span class="n num" id="diffCount">0</span></button>
1316
+ <button class="dtab" data-dtab="issues" role="tab" aria-selected="false"><span data-i18n="det.tab.issues">问题清单</span><span class="n num" id="issueCount">0</span></button>
1317
+ <button class="dtab" data-dtab="moves" role="tab" aria-selected="false"><span class="tip tip-b" data-i18n="det.tab.moves" data-i18n-tip="mv.note">修改与证书</span><span class="n num" id="moveCount">0</span></button>
1318
+ <span class="grow"></span>
1319
+ <div class="stats sm">
1320
+ <div class="stat"><span data-i18n="det.accepted">已采纳</span><b class="num"><span id="adoptCount">2</span><i>/4</i></b></div>
1321
+ </div>
1322
+ </div>
1323
+
1324
+ <!-- diff -->
1325
+ <div class="dpanel" id="dtab-diff">
1326
+ <div class="dh"><span></span><span data-i18n="cmp.original">原文 ORIGINAL</span><span data-i18n="cmp.revised">改文 REVISED</span><span></span></div>
1327
+
1328
+ <article class="hunk ok" data-hunk="h1">
1329
+ <header class="hunk-head">
1330
+ <span class="hk-id mono">eu-0001</span>
1331
+ <span class="pl pl-polish">polish</span>
1332
+ <span class="sev sev-err">⛔ BANNED ×2</span>
1333
+ <span class="hk-note" data-i18n="hn.1">术语表 · 第 2 段</span>
1334
+ <span class="hk-actions">
1335
+ <button class="mini" data-i18n-aria="hn.accept" data-i18n-title="hn.accept" aria-label="采纳" title="采纳"><svg viewBox="0 0 24 24" fill="none"><path d="m5 12.5 4.5 4.5L19 7" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
1336
+ <button class="mini rej" data-i18n-aria="hn.ignore" data-i18n-title="hn.ignore" aria-label="忽略" title="忽略"><svg viewBox="0 0 24 24" fill="none"><path d="M6 6l12 12M18 6 6 18" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
1337
+ </span>
1338
+ </header>
1339
+ <div class="hunk-body">
1340
+ <div class="del">Recent studies <del>utilize</del> a <del>difference-in-difference</del> design to identify the effect of place-based policies.</div>
1341
+ <div class="ins">Recent studies <ins>use</ins> a <ins>difference-in-differences</ins> design to identify the effect of place-based policies.</div>
1342
+ </div>
1343
+ </article>
1344
+
1345
+ <article class="hunk ok" data-hunk="h2">
1346
+ <header class="hunk-head">
1347
+ <span class="hk-id mono">eu-0003</span>
1348
+ <span class="pl pl-polish">polish</span>
1349
+ <span class="sev sev-err">⛔ BANNED ×2</span>
1350
+ <span class="hk-note" data-i18n="hn.2">删除 + 术语替换</span>
1351
+ <span class="hk-actions">
1352
+ <button class="mini" data-i18n-aria="hn.accept" data-i18n-title="hn.accept" aria-label="采纳" title="采纳"><svg viewBox="0 0 24 24" fill="none"><path d="m5 12.5 4.5 4.5L19 7" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
1353
+ <button class="mini rej" data-i18n-aria="hn.ignore" data-i18n-title="hn.ignore" aria-label="忽略" title="忽略"><svg viewBox="0 0 24 24" fill="none"><path d="M6 6l12 12M18 6 6 18" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
1354
+ </span>
1355
+ </header>
1356
+ <div class="hunk-body">
1357
+ <div class="del"><del>It is worth noting that</del> the <del>parallel trend hypothesis</del> is likely to hold in our setting.</div>
1358
+ <div class="ins">The <ins>parallel-trends assumption</ins> is plausible in our setting; pre-trend tests are available for 2003–2010.</div>
1359
+ </div>
1360
+ </article>
1361
+
1362
+ <article class="hunk" data-hunk="h3">
1363
+ <header class="hunk-head">
1364
+ <span class="hk-id mono">eu-0005</span>
1365
+ <span class="pl pl-polish">polish</span>
1366
+ <span class="sev sev-err">⛔ CLAIM</span>
1367
+ <span class="hk-note" data-i18n="hn.3">显著陈述缺少幅度</span>
1368
+ <span class="hk-actions">
1369
+ <button class="mini" data-i18n-aria="hn.accept" data-i18n-title="hn.accept" aria-label="采纳" title="采纳"><svg viewBox="0 0 24 24" fill="none"><path d="m5 12.5 4.5 4.5L19 7" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
1370
+ <button class="mini rej" data-i18n-aria="hn.ignore" data-i18n-title="hn.ignore" aria-label="忽略" title="忽略"><svg viewBox="0 0 24 24" fill="none"><path d="M6 6l12 12M18 6 6 18" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
1371
+ </span>
1372
+ </header>
1373
+ <div class="hunk-body">
1374
+ <div class="del">We find that the policy <del>significantly increases</del> employment, and the effect is robust across specifications.</div>
1375
+ <div class="ins">We find that the policy <ins>raises employment by 3.2 percentage points</ins>, and the estimate is stable across specifications.</div>
1376
+ </div>
1377
+ </article>
1378
+
1379
+ <article class="hunk" data-hunk="h4">
1380
+ <header class="hunk-head">
1381
+ <span class="hk-id mono">eu-0006</span>
1382
+ <span class="pl pl-polish">polish</span>
1383
+ <span class="sev sev-warn">⚠ OVERCLAIM</span>
1384
+ <span class="hk-note" data-i18n="hn.4">结论外推强于识别设计</span>
1385
+ <span class="hk-actions">
1386
+ <button class="mini" data-i18n-aria="hn.accept" data-i18n-title="hn.accept" aria-label="采纳" title="采纳"><svg viewBox="0 0 24 24" fill="none"><path d="m5 12.5 4.5 4.5L19 7" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
1387
+ <button class="mini rej" data-i18n-aria="hn.ignore" data-i18n-title="hn.ignore" aria-label="忽略" title="忽略"><svg viewBox="0 0 24 24" fill="none"><path d="M6 6l12 12M18 6 6 18" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg></button>
1388
+ </span>
1389
+ </header>
1390
+ <div class="hunk-body">
1391
+ <div class="del">These results suggest that the policy is effective and <del>should be extended to other regions</del>.</div>
1392
+ <div class="ins">These results suggest that the policy was effective over the sample period; <ins>extending it to other regions requires evidence from a different design</ins>.</div>
1393
+ </div>
1394
+ </article>
1395
+ </div>
1396
+
1397
+ <!-- issues -->
1398
+ <div class="dpanel" id="dtab-issues" hidden>
1399
+ <div class="grid2" id="issuesGrid">
1400
+ <article class="card-i err sel" data-ref="h1">
1401
+ <div class="c-top"><span class="sev sev-err">⛔ BANNED</span><span class="src">terminology_check</span></div>
1402
+ <div class="c-ttl"><code>utilize</code> → <code>use</code></div>
1403
+ <div class="c-why" data-i18n-html="c1.why">术语表将此列为应避免变体。同段另有 <code>difference-in-difference</code> 缺复数。</div>
1404
+ <div class="c-meta"><span>polish · <span data-i18n="loc.p2">第 2 段</span></span><span class="grow"></span><button class="link" data-i18n="cmp.locate">定位</button></div>
1405
+ </article>
1406
+
1407
+ <article class="card-i err" data-ref="h2">
1408
+ <div class="c-top"><span class="sev sev-err">⛔ BANNED</span><span class="src">terminology_check</span></div>
1409
+ <div class="c-ttl"><code>it is worth noting that</code> → <span data-i18n="c2.ttl">删除</span></div>
1410
+ <div class="c-why" data-i18n-html="c2.why">填充式引导语,删除后不损失信息;同段 <code>parallel trend hypothesis</code> 应为 <code>parallel-trends assumption</code>。</div>
1411
+ <div class="c-meta"><span>polish · <span data-i18n="loc.p2">第 2 段</span></span><span class="grow"></span><button class="link" data-i18n="cmp.locate">定位</button></div>
1412
+ </article>
1413
+
1414
+ <article class="card-i err" data-ref="h3">
1415
+ <div class="c-top"><span class="sev sev-err">⛔ CLAIM</span><span class="src">score · P2</span></div>
1416
+ <div class="c-ttl" data-i18n="c3.ttl">显著陈述没有幅度</div>
1417
+ <div class="c-why" data-i18n="c3.why">“significantly increases” 未给系数或百分点。硬约束:不得发明数值,缺口应交回作者。</div>
1418
+ <div class="c-meta"><span>polish · <span data-i18n="loc.p3">第 3 段</span></span><span class="tag ins">[MAGNITUDE?]</span><span class="grow"></span><button class="link" data-i18n="cmp.locate">定位</button></div>
1419
+ </article>
1420
+
1421
+ <article class="card-i warn" data-ref="h4">
1422
+ <div class="c-top"><span class="sev sev-warn">⚠ OVERCLAIM</span><span class="src">polish</span></div>
1423
+ <div class="c-ttl" data-i18n="c4.ttl">结论外推强于识别设计</div>
1424
+ <div class="c-why" data-i18n="c4.why">“should be extended” 是政策建议,样本与设计不支持跨区外推。</div>
1425
+ <div class="c-meta"><span>polish · <span data-i18n="loc.p4">第 4 段</span></span><span class="grow"></span><button class="link" data-i18n="cmp.locate">定位</button></div>
1426
+ </article>
1427
+
1428
+ <article class="card-i warn">
1429
+ <div class="c-top"><span class="sev sev-warn">⚠ DENSE</span><span class="src">prosody_check</span></div>
1430
+ <div class="c-ttl" data-i18n="c5.ttl">第 2 段平均句长 41 词</div>
1431
+ <div class="c-why" data-i18n="c5.why">带宽 16–34;该段 2 句超过 40 词,长句连排导致阅读负担。</div>
1432
+ <div class="c-meta"><span>prosody · body</span><span class="grow"></span><button class="link" data-i18n="cmp.locate">定位</button></div>
1433
+ </article>
1434
+
1435
+ <article class="card-i warn">
1436
+ <div class="c-top"><span class="sev sev-warn">⚠ TIER</span><span class="src">scan_detectability</span></div>
1437
+ <div class="c-ttl">risk_index 41.2 · ELEVATED</div>
1438
+ <div class="c-why" data-i18n="c6.why">burstiness 38.1、公式化短语 2.53/100 词。次级目标,可被术语约束否决。</div>
1439
+ <div class="c-meta"><span>trace · <span data-i18n="loc.all">全文</span></span><span class="grow"></span><button class="link" data-i18n="cmp.details">详情</button></div>
1440
+ </article>
1441
+
1442
+ <article class="card-i info">
1443
+ <div class="c-top"><span class="sev sev-info">ℹ BAND</span><span class="src">prosody_check</span></div>
1444
+ <div class="c-ttl" data-i18n="c7.ttl">nPVI 52.1 高于带宽 46.4</div>
1445
+ <div class="c-why" data-i18n="c7.why">节奏偏“顿挫”。增强项,不阻断交付。</div>
1446
+ <div class="c-meta"><span>prosody · <span data-i18n="loc.all">全文</span></span><span class="grow"></span><button class="link" data-i18n="cmp.locate">定位</button></div>
1447
+ </article>
1448
+
1449
+ <article class="card-i info">
1450
+ <div class="c-top"><span class="sev sev-info">ℹ REJECTED</span><span class="src">play.py</span></div>
1451
+ <div class="c-ttl"><span data-i18n="c8.ttl">m3 被拒绝</span>:burstiness 33.9 落入 RED</div>
1452
+ <div class="c-why" data-i18n="c8.why">节奏收益不足以抵消痕迹恶化。拒绝记录是证书的一部分,不是失败。</div>
1453
+ <div class="c-meta"><span>equilibrium · round 2</span><span class="grow"></span><button class="link" data-i18n="cmp.viewCert">看证书</button></div>
1454
+ </article>
1455
+
1456
+ <article class="card-i info">
1457
+ <div class="c-top"><span class="sev sev-info">ℹ STALE</span><span class="src">studio_bridge</span></div>
1458
+ <div class="c-ttl" data-i18n="c9.ttl">1 个候选基于旧稿被跳过</div>
1459
+ <div class="c-why" data-i18n-html="c9.why"><code>m5</code> 的 base 为 <code>draft.md</code>,当前已是 <code>draft.m4.md</code>,按规则跳过而非猜测。</div>
1460
+ <div class="c-meta"><span>derived · sha mismatch</span><span class="grow"></span><button class="link" data-i18n="cmp.recompute">重算</button></div>
1461
+ </article>
1462
+ </div>
1463
+ </div>
1464
+
1465
+ <!-- moves + cert -->
1466
+ <div class="dpanel" id="dtab-moves" hidden>
1467
+ <div class="two">
1468
+ <div id="movesList">
1469
+ <div class="move">
1470
+ <div class="st y">✓</div>
1471
+ <div class="b">
1472
+ <div class="l1"><b>m1</b><span class="pl pl-polish">polish</span><span class="kind">wording</span><span class="st-tag st-y" data-i18n="mv.accepted">已接受</span></div>
1473
+ <div class="reason">accepted: terminology −1, rhythm +2.4</div>
1474
+ <div class="metrics"><span>risk <b>41.2 → 39.8</b></span><span>composite <b>+2.40</b></span></div>
1475
+ </div>
1476
+ </div>
1477
+ <div class="move">
1478
+ <div class="st y">✓</div>
1479
+ <div class="b">
1480
+ <div class="l1"><b>m2</b><span class="pl pl-trace">trace</span><span class="kind">wording</span><span class="st-tag st-y" data-i18n="mv.accepted">已接受</span></div>
1481
+ <div class="reason">accepted: risk 41.2 → 36.8, tier ELEVATED → MODERATE</div>
1482
+ <div class="metrics"><span>burstiness <b>38.1 → 39.4</b></span><span>pegs <b>2.53 → 1.90</b></span></div>
1483
+ </div>
1484
+ </div>
1485
+ <div class="move">
1486
+ <div class="st n">✕</div>
1487
+ <div class="b">
1488
+ <div class="l1"><b>m3</b><span class="pl pl-prosody">prosody</span><span class="kind">boundary</span><span class="st-tag st-n" data-i18n="mv.rejected">已拒绝</span></div>
1489
+ <div class="reason">rejected: burstiness 33.9 falls into RED</div>
1490
+ <div class="metrics"><span>guard <b class="mono">LEGAL</b></span><span>content words <b>42 → 42</b></span></div>
1491
+ </div>
1492
+ </div>
1493
+ <div class="move">
1494
+ <div class="st n">✕</div>
1495
+ <div class="b">
1496
+ <div class="l1"><b>m4</b><span class="pl pl-polish">polish</span><span class="kind">wording</span><span class="st-tag st-n" data-i18n="mv.rejected">已拒绝</span></div>
1497
+ <div class="reason">rejected: adds 1 terminology hit(s)</div>
1498
+ <div class="metrics"><span>terminology <b>4 → 5</b></span><span data-i18n="mv.hard">硬约束否决</span></div>
1499
+ </div>
1500
+ </div>
1501
+ <div class="move">
1502
+ <div class="st p">·</div>
1503
+ <div class="b">
1504
+ <div class="l1"><b>m5</b><span class="pl pl-prosody">prosody</span><span class="kind">boundary</span><span class="st-tag st-p" data-i18n="mv.pending">待裁决</span></div>
1505
+ <div class="reason" data-i18n-html="mv.m5">guard: <code>LEGAL</code> · 拆分为 2 句 · 待第 3 轮测量</div>
1506
+ <div class="metrics"><span>candidate <b>cand/m5.md</b></span><span data-i18n="mv.basematch">base 匹配 ✓</span></div>
1507
+ </div>
1508
+ </div>
1509
+ </div>
1510
+
1511
+ <div>
1512
+ <div class="cert">
1513
+ <h4 class="tip tip-b" data-i18n-tip="cert.stop" tabindex="0">EQUILIBRIUM CERTIFICATE</h4>
1514
+ <dl class="kv">
1515
+ <dt data-i18n="cert.form">形式</dt><dd id="certForm">非合作 Stackelberg(迭代)</dd>
1516
+ <dt data-i18n="cert.leader">领跑</dt><dd data-i18n="cert.leaderV">polish · 专业有效性(硬约束)</dd>
1517
+ <dt data-i18n="cert.followers">跟随</dt><dd>trace · prosody</dd>
1518
+ <dt data-i18n="cert.coal">联盟</dt><dd id="certCoal"><code>none</code> · 迭代成本 <code>2.0</code></dd>
1519
+ <dt data-i18n="cert.mode">模式</dt><dd id="certMode"><code>constrained</code> · 边界需过 guard</dd>
1520
+ <dt data-i18n="cert.rounds">轮次</dt><dd data-i18n="cert.roundsV">3(第 2 轮后无可用动作)</dd>
1521
+ <dt data-i18n="cert.record">记录</dt><dd data-i18n="cert.recordV">接受 2 · 拒绝 3 · 陈旧 1</dd>
1522
+ </dl>
1523
+ <div class="rounds">
1524
+ <div class="round"><span class="rn">R1</span><div class="rb"><b data-i18n="cert.r1">接受 m1(polish)</b><p>terminology 4 → 3;rhythm 88.2 → 90.6</p></div></div>
1525
+ <div class="round"><span class="rn">R2</span><div class="rb"><b data-i18n="cert.r2">接受 m2(trace)</b><p>risk 39.8 → 36.8;tier ELEVATED → MODERATE</p></div></div>
1526
+ <div class="round"><span class="rn">R3</span><div class="rb"><b data-i18n="cert.r3">无可用动作 · 停止</b><p data-i18n="cert.r3p">m3 / m4 均被硬约束或 RED 线否决</p></div></div>
1527
+ </div>
1528
+ <div class="chain"><code>draft.md</code><span>→</span><code>m1</code><span>→</span><code>m2</code></div>
1529
+ </div>
1530
+ </div>
1531
+ </div>
1532
+ </div>
1533
+ </div>
1534
+ </section>
1535
+
1536
+ <div class="end" data-i18n="det.end">已到页尾</div>
1537
+ </div>
1538
+ </div>
1539
+
1540
+ <footer class="status" id="statusBar">
1541
+ <span class="it"><i class="dot" id="stDot"></i><span data-i18n="st.engine">引擎 5/5</span></span>
1542
+ <span class="it mono" id="stFp">fp —</span>
1543
+ <span class="it">profile <b id="stProfile" style="color:var(--ink-2)">body</b></span>
1544
+ <span class="it" id="stRisk">risk_index —</span>
1545
+ <span class="it">nPVI <b id="stNpvi" style="color:var(--ink-2)">—</b></span>
1546
+ <span class="it"><span data-i18n="st.measured">测量</span> <span id="stTime" class="mono">—</span></span>
1547
+ <span class="grow"></span>
1548
+ <span class="it" data-i18n-html="st.gesture">手势:<b>J / K</b> 切换 · <b>↵</b> 采纳 · <b>⌫</b> 忽略</span>
1549
+ <span class="it"><span class="tag ok" data-i18n="st.saved">已保存</span></span>
1550
+ </footer>
1551
+
1552
+ <div class="bind-mask" id="bindMask" hidden>
1553
+ <div class="bind-card">
1554
+ <button class="bind-x" id="bindClose" type="button" data-i18n-aria="bind.close" aria-label="关闭" title="关闭">
1555
+ <svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>
1556
+ </button>
1557
+ <h3 data-i18n="bind.title">绑定工作对话</h3>
1558
+ <p class="bind-sub" data-i18n="bind.sub">工作台会在选定目录里使用一个 EconTone 对话,之后的运行都复用它——这样能命中提示缓存,skill 也不必每次重新加载。</p>
1559
+ <label class="bind-lab" data-i18n="bind.cwd">工作目录</label>
1560
+ <input id="bindCwd" class="bind-input" spellcheck="false" />
1561
+ <label class="bind-lab" data-i18n="bind.conv">工作对话</label>
1562
+ <div class="bind-now" id="bindNow"></div>
1563
+ <div class="bind-list" id="bindList"></div>
1564
+ <div class="bind-actions">
1565
+ <button class="btn btn-ghost" id="bindProbe" data-i18n="bind.probe">测试连接</button>
1566
+ <span style="flex:1"></span>
1567
+ <button class="btn btn-ghost" id="bindCancel" data-i18n="bind.later">稍后</button>
1568
+ <button class="btn btn-primary" id="bindOk" data-i18n="bind.ok">绑定并开始</button>
1569
+ </div>
1570
+ </div>
1571
+ </div>
1572
+
1573
+ <!-- 评分卡详情浮窗 -->
1574
+ <div class="bind-mask" id="scMask" hidden>
1575
+ <div class="bind-card sc-modal">
1576
+ <button class="bind-x" id="scClose" type="button" aria-label="关闭" title="关闭">
1577
+ <svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>
1578
+ </button>
1579
+ <h3 id="scModalTitle">评分卡</h3>
1580
+ <div class="sc-modal-score" id="scModalScore"></div>
1581
+ <p class="bind-sub" id="scModalEv"></p>
1582
+ <div class="sc-modal-list" id="scModalList"></div>
1583
+ <div class="bind-actions">
1584
+ <span style="flex:1"></span>
1585
+ <button class="btn btn-ghost" id="scOk" data-i18n="sc.detail.close">关闭</button>
1586
+ </div>
1587
+ </div>
1588
+ </div>
1589
+
1590
+ <!-- 本地 skill 选择 -->
1591
+ <div class="bind-mask" id="skillMask" hidden>
1592
+ <div class="bind-card skill-card">
1593
+ <button class="bind-x" id="skillClose" type="button" aria-label="关闭" title="关闭">
1594
+ <svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>
1595
+ </button>
1596
+ <h3 data-i18n="skill.title">选择本地 skill</h3>
1597
+ <p class="bind-sub" data-i18n="skill.sub">单技能模式下可改用本机任意 skill;选中后 skill 名会写进提示词。</p>
1598
+ <input class="bind-input skill-search" id="skillSearch" spellcheck="false" placeholder="搜索名称或描述" />
1599
+ <label class="skill-all"><input type="checkbox" id="skillAll" /> <span data-i18n="skill.all">显示全部 skill</span></label>
1600
+ <div class="skill-list" id="skillList"></div>
1601
+ <div class="bind-actions">
1602
+ <span style="flex:1"></span>
1603
+ <button class="btn btn-ghost" id="skillOk" data-i18n="skill.cancel">取消</button>
1604
+ </div>
1605
+ </div>
1606
+ </div>
1607
+ </div>
1608
+ <div class="toast" id="toast"></div>`;
1609
+
1610
+ const BUILD = '1.0.0';
1611
+
1612
+ function showFatal(node, err) {
1613
+ try {
1614
+ var box = node.querySelector('.ets-fatal');
1615
+ if (!box) { box = document.createElement('div'); box.className = 'ets-fatal'; node.appendChild(box); }
1616
+ box.textContent = '[EconTone Studio] build ' + BUILD + ' 渲染失败:\n' + String((err && err.stack) || err);
1617
+ } catch (_) {}
1618
+ }
1619
+
1620
+
1621
+ function initStudio(root){
1622
+ var $ = function(s,r){ return (r||root).querySelector(s); };
1623
+ var $$ = function(s,r){ return Array.prototype.slice.call((r||root).querySelectorAll(s)); };
1624
+ function on(id, ev, fn){ var el = $('#'+id); if (el) el.addEventListener(ev, fn); return el; }
1625
+ var toastT;
1626
+ function toast(msg){
1627
+ var t = $('#toast'); t.textContent = msg; t.classList.add('show');
1628
+ clearTimeout(toastT); toastT = setTimeout(function(){ t.classList.remove('show'); }, 1900);
1629
+ }
1630
+
1631
+ /* ================= 字典 ================= */
1632
+ var I18N = {
1633
+ zh:{
1634
+ 'nav.new':'新会话','nav.workbench':'工作台','nav.sub':'经管写作工作台','nav.workspace':'工作区',
1635
+ 'nav.settings':'设置','nav.help':'帮助',
1636
+ 'hero.sub':'基于博弈思想的经管论文精修工作台',
1637
+ 'sess.1':'AER 引言重写','sess.1.m':'12 分钟前 · 8 轮',
1638
+ 'sess.2':'JDE 摘要 · 术语校准','sess.2.m':'刚刚 · 进行中',
1639
+ 'sess.3':'机制段落 第 3 版','sess.3.m':'昨天',
1640
+ 'sess.4':'稳健性检验措辞','sess.4.m':'11-09',
1641
+ 'sess.5':'文献综述收尾','sess.5.m':'11-07',
1642
+ 'tb.crumb':'工作台','tb.docTitle':'切换文档','tb.overview':'概览','tb.detail':'详情',
1643
+ 'tb.score':'评分 Score','tb.run':'润色','tb.eq':'均衡',
1644
+ 'tb.eqTitle':'求解字典序 Stackelberg 均衡,单节约 10 分钟',
1645
+ 'theme.title':'界面风格','theme.classic':'默认','theme.mint':'风格 1','theme.ink':'风格 2','theme.paper':'风格 3','theme.prefix':'主题:',
1646
+ 'theme.classicDesc':'墨 · 靛 · 金','theme.mintDesc':'薄荷青 · 玻璃','theme.inkDesc':'黑金 · 玻璃','theme.paperDesc':'稿纸 · 朱砂 · 双栏',
1647
+ 'theme.classicTitle':'当前设计:墨 · 靛 · 金','theme.mintTitle':'薄荷青绿 SaaS:Teal · Urbanist · 大圆角 · 玻璃渐变',
1648
+ 'in.title':'文本输入','in.sub':'粘贴、拖入或从文件载入','in.file':'从文件载入','in.sample':'示例','in.clear':'清空',
1649
+ 'in.task':'任务','in.taskAuto':'根据粘贴的文本自动识别',
1650
+ 'in.hint':'支持 .md / .tex / .txt;也可直接粘贴',
1651
+ 'in.ph':'在此粘贴或输入待优化的经管论文文本…',
1652
+ 'in.chars':'字符','in.rows':'行',
1653
+ 'meta.journal':'目标期刊','meta.field':'学科','meta.section':'文本位置','meta.note':'备注',
1654
+ 'meta.journalPh':'如 AER / QJE / MS','meta.fieldPh':'如 微观经济学 / 劳动经济学','meta.notePh':'如:双盲评审,避免第一人称',
1655
+ 'meta.sectionPh':'如 正文 / 摘要 / 引言','meta.sectionUnknown':'未识别',
1656
+ 'meta.hint':'文本位置决定 --profile(韵律带宽);期刊与备注只拼进改写提示词。',
1657
+ 'f.micro':'微观经济学','f.macro':'宏观经济学','f.metric':'计量经济学','f.fin':'金融学','f.mgmt':'管理学','f.other':'其他',
1658
+ 'sec.body':'正文','sec.abs':'摘要','sec.intro':'引言',
1659
+ 'sc.title':'评分卡','sc.note':'score.py · 4 行加权 40 / 40 / 10 / 10','sc.run':'评分','sc.clear':'清空',
1660
+ 'sc.detail.close':'关闭','sc.detail.empty':'没有更多细节','run.refresh':'按运行记录获取最新结果','sc.weight':'权重',
1661
+ 'skill.title':'选择本地 skill','skill.sub':'默认只列写作/润色类;选中后 skill 名会写进提示词。','skill.cancel':'取消','skill.all':'显示全部 skill',
1662
+ 'sc.p1':'术语与语域','sc.p2':'主张与结构','sc.t1':'AI 痕迹','sc.r1':'节奏',
1663
+ 'sc.e1':'polish · 4 处禁用变体','sc.e2':'polish · 1 处显著无幅度',
1664
+ 'sc.total':'总分 / 100','sc.lat':'幅度','sc.advice':'只修错,不重构;作者写得顺的句子保持原样',
1665
+ 'cn.title':'运行参数','cn.note':'play.py · 字典序 Stackelberg,术语优先','cn.switch':'博弈','cn.switchTip':'打开时使用博弈模式;关闭时自行选择本地 skill',
1666
+ 'hist.title':'历史记录','hist.back':'返回工作台','hist.empty':'还没有历史记录','hist.open':'打开','hist.score':'评分','hist.rewrite':'改写',
1667
+ 'hist.allTypes':'全部类型','hist.searchPh':'搜索原文、编号、时间、任务…','hist.runs':'次运行','hist.prev':'上一页','hist.next':'下一页','hist.page':'第 {a} / {b} 页','hist.none':'没有匹配的记录',
1668
+ 'task.new':'新任务','out.refresh':'刷新',
1669
+ 'dr.title':'英文初稿','dr.badge':'agent 直译 · 未调用 skill','task.reconnect':'任务已过期,请重新发起改写',
1670
+ 'bind.title':'绑定工作对话','bind.cwd':'工作目录','bind.conv':'工作对话',
1671
+ 'bind.sub':'工作台会在选定目录里使用一个 EconTone 对话,之后的运行都复用它——这样能命中提示缓存,skill 也不必每次重新加载。',
1672
+ 'bind.ok':'绑定并开始','bind.later':'稍后','bind.probe':'测试连接','bind.close':'关闭','open.window':'独立窗口',
1673
+ 'open.tip':'在独立窗口打开工作台','open.opened':'已在默认浏览器打开:',
1674
+ 'repo.tip':'GitHub 仓库','repo.soon':'已打开 GitHub 仓库',
1675
+ 'sync.now':'同步','sync.tip':'立即与另一个窗口同步','sync.done':'已同步','sync.none':'没有可同步的内容',
1676
+ 'open.blocked':'无法自动打开,链接已复制,请粘贴到浏览器:',
1677
+ 'bind.now':'当前绑定:','bind.none':'尚未绑定工作对话','bind.created':'已新建并绑定 ',
1678
+ 'bind.switched':'已切换到 ','bind.probeOk':'对话可用:','bind.probeFail':'对话不可用:',
1679
+ 'cn.budget':'期望时间 / BUDGET','cn.engine':'引擎选择 / ENGINE',
1680
+ 'engine.polish':'polish','engine.aitrace':'ai-trace','engine.prosody':'prosody',
1681
+ 'engine.hint':'不用均衡时,直接单独跑一个技能:polish(语言润色)/ ai-trace(去痕迹)/ prosody(节奏)。',
1682
+ 'game.none':'不使用均衡(None)','cn.conn':'连接方式 / LINK',
1683
+ 'conn.stream':'流式直连','conn.agent':'Agent 参与',
1684
+ 'conn.hint':'流式直连:直接调模型,实时回传思考与正文,约 15–30 秒,过程可见;不经过 agent 的工具与技能。Agent 参与:交给子 Agent 执行,可调用 EconTone 技能,质量路径更完整,但启动慢、过程不可见。',
1685
+ 'cn.task':'任务 / TASK','cn.game':'博弈模型 / GAME MODEL','cn.order':'博弈顺序 / ORDER','cn.coop':'合作类型 / COOPERATION',
1686
+ 'order.seq':'序贯','order.sim':'同时',
1687
+ 'order.hint':'序贯:领跑者先动、跟随者回应;同时:各玩家一次性提出动作,按联合增益裁决(引擎用单轮并列测量近似)。',
1688
+ 'cn.coal':'联盟 / COALITION','cn.mode':'Action Mode · 约束','cn.rounds':'轮次 / ROUNDS',
1689
+ 'mode.hint':'Action Mode 只控制各 skill 的动作集有没有边界,与博弈类型无关;自由模式下仍然可以是主从博弈。',
1690
+ 'cn.cost':'迭代成本 / COST','cn.extent':'修改幅度 / EXTENT',
1691
+ 'coop.coop':'合作','coop.non':'非合作',
1692
+ 'mode.constrained':'受约束','mode.free':'自由',
1693
+ 'cn.costAria':'迭代成本','cn.extentAria':'修改幅度',
1694
+ 'game.stack':'斯塔克伯格 · 字典序(默认)',
1695
+ 'game.maxsum':'斯塔克伯格 · 最大和联盟',
1696
+ 'game.nash':'斯塔克伯格 · 纳什议价',
1697
+ 'game.cournot':'古诺竞争 · 同时决策',
1698
+ 'game.bertrand':'伯川德竞争 · 同时决策',
1699
+ 'game.free':'自由博弈 · 无边界约束',
1700
+ 'game.hint':'引擎只实现 Stackelberg 家族:术语是硬约束、痕迹次级、节奏为增强。Cournot / Bertrand 描述企业产量竞争,不是改写协议,故不列入。',
1701
+ 'task.po':'PO-EN 英文润色','task.zh2en':'TR-ZH2EN 中译英','task.en2zh':'TR-EN2ZH 英译中',
1702
+ 'out.title':'润色稿','out.count':'4 处改动 · 12 处词级替换',
1703
+ 'out.showdel':'显示删除','out.hide':'隐藏删除',
1704
+ 'out.showadd':'显示增加或替换','out.hideadd':'隐藏增加或替换',
1705
+ 'out.lg1':'绿底 = 新增或替换','out.lg2':'删除线 = 原文被删','out.lg3':'编号 = 对应下方改动条目',
1706
+ 'out.lg4':'点编号可直接跳到细节','out.copy':'复制改写稿','out.save':'保存采纳结果',
1707
+ 'toast.copyEmpty':'还没有可复制的改写稿','toast.copyFail':'复制失败,请手动选择文本',
1708
+ 'toast.saved':'已保存:','toast.saveFail':'保存失败:',
1709
+ 'det.title':'详细结果','det.note':'逐条对比 · 问题清单 · 修改与证书','det.accepted':'已采纳',
1710
+ 'tag.demo':'示例',
1711
+ 'stat.edits':'处改动','stat.words':'处词级替换',
1712
+ 'det.tab.diff':'逐条对比','det.tab.issues':'问题清单','det.tab.moves':'修改与证书','det.end':'已到页尾',
1713
+ 'det.loading':'正在加载详细结果…','det.loaded':'详细结果已加载',
1714
+ 'cmp.original':'原文 ORIGINAL','cmp.revised':'改文 REVISED',
1715
+ 'cmp.locate':'定位','cmp.details':'详情','cmp.viewCert':'看证书','cmp.recompute':'重算',
1716
+ 'hn.1':'术语表 · 第 2 段','hn.2':'删除 + 术语替换','hn.3':'显著陈述缺少幅度','hn.4':'结论外推强于识别设计',
1717
+ 'hn.accept':'采纳','hn.ignore':'忽略',
1718
+ 'loc.p2':'第 2 段','loc.p3':'第 3 段','loc.p4':'第 4 段','loc.all':'全文',
1719
+ 'c1.why':'术语表将此列为应避免变体。同段另有 <code>difference-in-difference</code> 缺复数。',
1720
+ 'c2.ttl':'删除',
1721
+ 'c2.why':'填充式引导语,删除后不损失信息;同段 <code>parallel trend hypothesis</code> 应为 <code>parallel-trends assumption</code>。',
1722
+ 'c3.ttl':'显著陈述没有幅度',
1723
+ 'c3.why':'“significantly increases” 未给系数或百分点。硬约束:不得发明数值,缺口应交回作者。',
1724
+ 'c4.ttl':'结论外推强于识别设计',
1725
+ 'c4.why':'“should be extended” 是政策建议,样本与设计不支持跨区外推。',
1726
+ 'c5.ttl':'第 2 段平均句长 41 词',
1727
+ 'c5.why':'带宽 16–34;该段 2 句超过 40 词,长句连排导致阅读负担。',
1728
+ 'c6.why':'burstiness 38.1、公式化短语 2.53/100 词。次级目标,可被术语约束否决。',
1729
+ 'c7.ttl':'nPVI 52.1 高于带宽 46.4',
1730
+ 'c7.why':'节奏偏“顿挫”。增强项,不阻断交付。',
1731
+ 'c8.ttl':'m3 被拒绝',
1732
+ 'c8.why':'节奏收益不足以抵消痕迹恶化。拒绝记录是证书的一部分,不是失败。',
1733
+ 'c9.ttl':'1 个候选基于旧稿被跳过',
1734
+ 'c9.why':'<code>m5</code> 的 base 为 <code>draft.md</code>,当前已是 <code>draft.m4.md</code>,按规则跳过而非猜测。',
1735
+ 'mv.accepted':'已接受','mv.rejected':'已拒绝','mv.pending':'待裁决',
1736
+ 'mv.hard':'硬约束否决','mv.m5':'guard: <code>LEGAL</code> · 拆分为 2 句 · 待第 3 轮测量',
1737
+ 'mv.basematch':'base 匹配 ✓',
1738
+ 'mv.note':'裁决顺序:术语 → 痕迹 → 节奏。任一上层约束被破坏,下层收益不计。',
1739
+ 'cert.form':'形式','cert.formCoop':'合作 Stackelberg(迭代)','cert.formNon':'非合作 Stackelberg(迭代)',
1740
+ 'cert.leader':'领跑','cert.leaderV':'polish · 专业有效性(硬约束)',
1741
+ 'cert.followers':'跟随','cert.coal':'联盟',
1742
+ 'cert.mode':'模式',
1743
+ 'cert.cost':'迭代成本','cert.modeCon':'边界需过 guard','cert.modeFree':'边界可越,仅记警告',
1744
+ 'cert.rounds':'轮次','cert.roundsV':'3(第 2 轮后无可用动作)',
1745
+ 'cert.record':'记录','cert.recordV':'接受 2 · 拒绝 3 · 陈旧 1',
1746
+ 'cert.r1':'接受 m1(polish)','cert.r2':'接受 m2(trace)','cert.r3':'无可用动作 · 停止',
1747
+ 'cert.r3p':'m3 / m4 均被硬约束或 RED 线否决',
1748
+ 'cert.stop':'停止条件:没有任何合法动作能在不破坏更高优先级约束的前提下提升目标。单节完整求解通常 10 分钟以上——它在测量,不是卡住。',
1749
+ 'st.engine':'引擎 5/5','st.measured':'测量','st.saved':'已保存',
1750
+ 'st.gesture':'手势:<b>J / K</b> 切换 · <b>↵</b> 采纳 · <b>⌫</b> 忽略',
1751
+ 'toast.adopt':'采纳 {h}','toast.ignore':'忽略 {h}(理由已记录)',
1752
+ 'toast.game':'博弈模型 → {g}',
1753
+ 'toast.scored':'评分完成:78 / 100 · 幅度 64% · reduced',
1754
+ 'toast.ran':'改动 4 处已生成',
1755
+ 'toast.eq':'均衡作业已提交(后台运行)',
1756
+ 'toast.entry':'EconTone Studio · 主面板',
1757
+ 'toast.file':'选择 .md / .tex 文件(设计稿未接文件系统)',
1758
+ 'toast.sample':'已载入示例文本',
1759
+ 'toast.copied':'改写稿已复制',
1760
+ 'toast.nav':'已跳到详细结果'
1761
+ },
1762
+ en:{
1763
+ 'nav.new':'New session','nav.workbench':'Workbench','nav.sub':'Economics writing studio','nav.workspace':'Workspace',
1764
+ 'nav.settings':'Settings','nav.help':'Help',
1765
+ 'hero.sub':'A game-theoretic workbench for refining economics and management papers',
1766
+ 'sess.1':'AER introduction rewrite','sess.1.m':'12 min ago · 8 rounds',
1767
+ 'sess.2':'JDE abstract · terminology pass','sess.2.m':'just now · running',
1768
+ 'sess.3':'Mechanism section v3','sess.3.m':'yesterday',
1769
+ 'sess.4':'Robustness wording','sess.4.m':'Nov 9',
1770
+ 'sess.5':'Literature review wrap-up','sess.5.m':'Nov 7',
1771
+ 'tb.crumb':'Workbench','tb.docTitle':'Switch document','tb.overview':'Overview','tb.detail':'Details',
1772
+ 'tb.score':'Score','tb.run':'Polish','tb.eq':'Equilibrium',
1773
+ 'tb.eqTitle':'Solve the lexicographic Stackelberg equilibrium; usually 10+ minutes per section',
1774
+ 'theme.title':'Theme','theme.classic':'Default','theme.mint':'Style 1','theme.ink':'Style 2','theme.paper':'Style 3','theme.prefix':'Theme: ',
1775
+ 'theme.classicDesc':'Ink · indigo · gold','theme.mintDesc':'Mint teal · glass','theme.inkDesc':'Black gold · glass','theme.paperDesc':'Paper · vermilion · two-column',
1776
+ 'theme.classicTitle':'Current design: ink, indigo, gold','theme.mintTitle':'Mint teal SaaS: teal, Urbanist, large radii, glass gradient',
1777
+ 'in.title':'Text in','in.sub':'Paste, drop, or load a file','in.file':'Load file','in.sample':'Sample','in.clear':'Clear',
1778
+ 'in.task':'task','in.taskAuto':'detected from the pasted text',
1779
+ 'in.hint':'.md / .tex / .txt supported; paste works too',
1780
+ 'in.ph':'Paste or type the economics manuscript to work on…',
1781
+ 'in.chars':'chars','in.rows':'lines',
1782
+ 'meta.journal':'Target journal','meta.field':'Field','meta.section':'Section','meta.note':'Notes',
1783
+ 'meta.journalPh':'e.g. AER / QJE / MS','meta.fieldPh':'e.g. microeconomics / labor economics','meta.notePh':'e.g. double-blind review, avoid first person',
1784
+ 'meta.sectionPh':'e.g. body / abstract / intro','meta.sectionUnknown':'unrecognized',
1785
+ 'meta.hint':'Section maps to --profile (rhythm bands); journal and notes only feed the rewrite prompt.',
1786
+ 'f.micro':'Microeconomics','f.macro':'Macroeconomics','f.metric':'Econometrics','f.fin':'Finance','f.mgmt':'Management','f.other':'Other',
1787
+ 'sec.body':'Body','sec.abs':'Abstract','sec.intro':'Introduction',
1788
+ 'sc.title':'Scorecard','sc.note':'score.py · four rows weighted 40 / 40 / 10 / 10','sc.run':'Score','sc.clear':'Clear',
1789
+ 'sc.detail.close':'Close','sc.detail.empty':'No further detail','run.refresh':'Fetch the latest stored result','sc.weight':'Weight',
1790
+ 'skill.title':'Choose a local skill','skill.sub':'Writing/polish skills are listed first; the chosen name goes into the prompt.','skill.cancel':'Cancel','skill.all':'Show all skills',
1791
+ 'sc.p1':'Terminology & register','sc.p2':'Claims & structure','sc.t1':'AI-trace risk','sc.r1':'Rhythm',
1792
+ 'sc.e1':'polish · 4 banned variants','sc.e2':'polish · 1 significance claim without magnitude',
1793
+ 'sc.total':'TOTAL / 100','sc.lat':'Latitude','sc.advice':'Fix errors only; keep the sentences that already work',
1794
+ 'cn.title':'Run parameters','cn.note':'play.py · lexicographic Stackelberg, terminology first','cn.switch':'Game','cn.switchTip':'On: game mode. Off: pick a local skill yourself',
1795
+ 'hist.title':'History','hist.back':'Back to workbench','hist.empty':'No history yet','hist.open':'Open','hist.score':'Score','hist.rewrite':'Rewrite',
1796
+ 'hist.allTypes':'All types','hist.searchPh':'Search text, id, time, task…','hist.runs':'runs','hist.prev':'Prev','hist.next':'Next','hist.page':'Page {a} / {b}','hist.none':'No matching entries',
1797
+ 'task.new':'New task','out.refresh':'Refresh',
1798
+ 'dr.title':'English draft','dr.badge':'agent translation · no skill called','task.reconnect':'This run has expired; start a new rewrite',
1799
+ 'bind.title':'Bind a working conversation','bind.cwd':'Working directory','bind.conv':'Working conversation',
1800
+ 'bind.sub':'The workbench will use one EconTone conversation inside the chosen directory and reuse it for later runs, so prompt caching hits and skills are not reloaded every time.',
1801
+ 'bind.ok':'Bind and start','bind.later':'Later','bind.probe':'Test','bind.close':'Close','open.window':'Window',
1802
+ 'open.tip':'Open the workbench in a standalone window','open.opened':'Opened in your default browser: ',
1803
+ 'repo.tip':'GitHub repository','repo.soon':'Opened the GitHub repository',
1804
+ 'sync.now':'Sync','sync.tip':'Sync with the other window now','sync.done':'Synced','sync.none':'Nothing to sync',
1805
+ 'open.blocked':'Could not open automatically; link copied \u2014 paste it in your browser: ',
1806
+ 'bind.now':'Bound to: ','bind.none':'No conversation bound yet','bind.created':'Created and bound ',
1807
+ 'bind.switched':'Switched to ','bind.probeOk':'Conversation OK: ','bind.probeFail':'Conversation unavailable: ',
1808
+ 'cn.budget':'TIME BUDGET','cn.engine':'ENGINE',
1809
+ 'engine.polish':'polish','engine.aitrace':'ai-trace','engine.prosody':'prosody',
1810
+ 'engine.hint':'Without the equilibrium orchestrator, run one single skill: polish / ai-trace / prosody.',
1811
+ 'game.none':'No equilibrium (None)','cn.conn':'CONNECTION',
1812
+ 'conn.stream':'Streaming','conn.agent':'Via agent',
1813
+ 'conn.hint':'Streaming: calls the model directly and streams its thinking and output back, ~15-30s, visible. It does not go through the agent loop, so no tools or skills. Via agent: hands the task to a child agent that can use the EconTone skills; better path fidelity, but slower to start and opaque while running.',
1814
+ 'cn.task':'TASK','cn.game':'GAME MODEL','cn.order':'GAME ORDER','cn.coop':'COOPERATION',
1815
+ 'order.seq':'Sequential','order.sim':'Simultaneous',
1816
+ 'order.hint':'Sequential: the leader moves first and followers respond. Simultaneous: every player proposes at once and joint gain decides (the engine approximates this with one round).',
1817
+ 'cn.coal':'COALITION','cn.mode':'ACTION MODE','cn.rounds':'ROUNDS',
1818
+ 'mode.hint':'Action Mode only controls whether each skill is bounded to its own action set. It is independent of the game form: a free run can still be a leader-follower game.',
1819
+ 'cn.cost':'ITERATION COST','cn.extent':'EDIT EXTENT',
1820
+ 'coop.coop':'Cooperative','coop.non':'Non-cooperative',
1821
+ 'mode.constrained':'Constrained','mode.free':'Free',
1822
+ 'cn.costAria':'Iteration cost','cn.extentAria':'Edit extent',
1823
+ 'game.stack':'Stackelberg · lexicographic (default)',
1824
+ 'game.maxsum':'Stackelberg · max-sum coalition',
1825
+ 'game.nash':'Stackelberg · Nash bargaining',
1826
+ 'game.cournot':'Cournot · simultaneous',
1827
+ 'game.bertrand':'Bertrand · simultaneous',
1828
+ 'game.free':'Free play · no boundary guard',
1829
+ 'game.hint':'The engine implements the Stackelberg family only: terminology is the hard constraint, trace comes second, rhythm is an enhancement. Cournot and Bertrand describe output competition, not an editing protocol, so they are not offered.',
1830
+ 'task.po':'PO-EN English polish','task.zh2en':'TR-ZH2EN Chinese→English','task.en2zh':'TR-EN2ZH English→Chinese',
1831
+ 'out.title':'Polished text','out.count':'4 edits · 12 word-level replacements',
1832
+ 'out.showdel':'Show deletions','out.hide':'Hide deletions',
1833
+ 'out.showadd':'Show additions','out.hideadd':'Hide additions',
1834
+ 'out.lg1':'Green = inserted or replaced','out.lg2':'Strikethrough = removed original','out.lg3':'Number = the edit below',
1835
+ 'out.lg4':'Click a number to jump to the detail','out.copy':'Copy revised text','out.save':'Save result',
1836
+ 'toast.copyEmpty':'Nothing to copy yet','toast.copyFail':'Copy failed; select the text manually',
1837
+ 'toast.saved':'Saved: ','toast.saveFail':'Save failed: ',
1838
+ 'det.title':'Details','det.note':'Edits · issues · moves and certificate','det.accepted':'accepted',
1839
+ 'tag.demo':'sample',
1840
+ 'stat.edits':'edits','stat.words':'word-level replacements',
1841
+ 'det.tab.diff':'Edits','det.tab.issues':'Issues','det.tab.moves':'Moves & certificate','det.end':'End of page',
1842
+ 'det.loading':'Loading details…','det.loaded':'Details loaded',
1843
+ 'cmp.original':'ORIGINAL','cmp.revised':'REVISED',
1844
+ 'cmp.locate':'Locate','cmp.details':'Details','cmp.viewCert':'View certificate','cmp.recompute':'Recompute',
1845
+ 'hn.1':'Glossary · paragraph 2','hn.2':'Deletion + term fix','hn.3':'Significance claim without magnitude','hn.4':'Conclusion overreaches the design',
1846
+ 'hn.accept':'Accept','hn.ignore':'Ignore',
1847
+ 'loc.p2':'paragraph 2','loc.p3':'paragraph 3','loc.p4':'paragraph 4','loc.all':'whole text',
1848
+ 'c1.why':'The glossary lists this as a variant to avoid. The same paragraph writes <code>difference-in-difference</code> without the plural.',
1849
+ 'c2.ttl':'delete',
1850
+ 'c2.why':'A filler opener; deleting it loses nothing. The same paragraph’s <code>parallel trend hypothesis</code> should read <code>parallel-trends assumption</code>.',
1851
+ 'c3.ttl':'Significance claim without a magnitude',
1852
+ 'c3.why':'“significantly increases” gives no coefficient or percentage points. Hard constraint: never invent a number — the gap goes back to the author.',
1853
+ 'c4.ttl':'Conclusion overreaches the identification',
1854
+ 'c4.why':'“should be extended” is a policy recommendation that the sample and design do not support.',
1855
+ 'c5.ttl':'Paragraph 2 averages 41 words per sentence',
1856
+ 'c5.why':'The band is 16–34; two sentences exceed 40 words, and the run of long sentences carries the load.',
1857
+ 'c6.why':'Burstiness 38.1 and formulaic phrases at 2.53 per 100 words. A secondary objective that terminology constraints can veto.',
1858
+ 'c7.ttl':'nPVI 52.1 above the band of 46.4',
1859
+ 'c7.why':'The rhythm runs choppy. An enhancement, never a blocker.',
1860
+ 'c8.ttl':'m3 rejected',
1861
+ 'c8.why':'The rhythm gain cannot offset the trace regression. A rejection is part of the certificate, not a failure.',
1862
+ 'c9.ttl':'1 candidate skipped as stale',
1863
+ 'c9.why':'<code>m5</code> was built on <code>draft.md</code> while the current text is <code>draft.m4.md</code>; it is skipped rather than guessed at.',
1864
+ 'mv.accepted':'accepted','mv.rejected':'rejected','mv.pending':'pending',
1865
+ 'mv.hard':'vetoed by a hard constraint','mv.m5':'guard: <code>LEGAL</code> · split into 2 sentences · awaiting round 3',
1866
+ 'mv.basematch':'base matches ✓',
1867
+ 'mv.note':'Order: terminology → trace → rhythm. A broken higher constraint nullifies a lower gain.',
1868
+ 'cert.form':'Form','cert.formCoop':'Cooperative Stackelberg (iterative)','cert.formNon':'Non-cooperative Stackelberg (iterative)',
1869
+ 'cert.leader':'Leader','cert.leaderV':'polish · professional validity (hard constraint)',
1870
+ 'cert.followers':'Followers','cert.coal':'Coalition',
1871
+ 'cert.mode':'Mode',
1872
+ 'cert.cost':'iteration cost','cert.modeCon':'boundaries must pass the guard','cert.modeFree':'boundaries may cross; warnings only',
1873
+ 'cert.rounds':'Rounds','cert.roundsV':'3 (no acceptable move after round 2)',
1874
+ 'cert.record':'Record','cert.recordV':'accepted 2 · rejected 3 · stale 1',
1875
+ 'cert.r1':'Accepted m1 (polish)','cert.r2':'Accepted m2 (trace)','cert.r3':'No acceptable move · stop',
1876
+ 'cert.r3p':'m3 and m4 were rejected by a hard constraint or the RED line',
1877
+ 'cert.stop':'Stop rule: no legal move raises an objective without breaking a higher-priority constraint. A full solve usually takes 10+ minutes per section — it is measuring, not stuck.',
1878
+ 'st.engine':'Engine 5/5','st.measured':'measured','st.saved':'Saved',
1879
+ 'st.gesture':'Gestures: <b>J / K</b> switch · <b>↵</b> accept · <b>⌫</b> ignore',
1880
+ 'toast.adopt':'Accepted {h}','toast.ignore':'Ignored {h} (reason recorded)',
1881
+ 'toast.game':'Game model → {g}',
1882
+ 'toast.scored':'Scored: 78 / 100 · latitude 64% · reduced',
1883
+ 'toast.ran':'4 edits generated',
1884
+ 'toast.eq':'Equilibrium job submitted (runs in background)',
1885
+ 'toast.entry':'EconTone Studio · main panel',
1886
+ 'toast.file':'Pick a .md / .tex file (no filesystem in this mock)',
1887
+ 'toast.sample':'Sample text loaded',
1888
+ 'toast.copied':'Revised text copied',
1889
+ 'toast.nav':'Jumped to details'
1890
+ }
1891
+ };
1892
+
1893
+ var lang = 'zh';
1894
+ /* ================= 主题 ================= */
1895
+ var THEME_KEY = 'ets-theme';
1896
+ var THEME_IDS = ['classic', 'mint', 'ink', 'paper'];
1897
+ var theme = 'classic';
1898
+ var themeEl = root; /* 构建时改写成面板根节点 */
1899
+ function applyTheme(th){
1900
+ theme = (THEME_IDS.indexOf(th) >= 0) ? th : 'classic';
1901
+ try{ themeEl.setAttribute('data-theme', theme); }catch(e){}
1902
+ var nm = $('#themeName');
1903
+ if (nm) nm.textContent = t('theme.prefix') + t('theme.' + theme);
1904
+ $$('#themePop .th-card').forEach(function(b){ b.classList.toggle('on', b.dataset.t === theme); });
1905
+ try{ localStorage.setItem(THEME_KEY, theme); }catch(e){}
1906
+ if (typeof scheduleSaveParams === 'function') { try { scheduleSaveParams(); } catch (e) {} }
1907
+ }
1908
+ function themePop(open){
1909
+ var pop = $('#themePop'), btn = $('#themeBtn');
1910
+ if (!pop) return;
1911
+ if (open) pop.removeAttribute('hidden'); else pop.setAttribute('hidden', '');
1912
+ if (btn) btn.setAttribute('aria-expanded', open ? 'true' : 'false');
1913
+ }
1914
+ function t(k, vars){
1915
+ var s = (I18N[lang] && I18N[lang][k]) || I18N.zh[k] || k;
1916
+ if(vars){ for(var p in vars){ s = s.split('{'+p+'}').join(vars[p]); } }
1917
+ return s;
1918
+ }
1919
+
1920
+ function applyLang(l){
1921
+ lang = (l === 'en') ? 'en' : 'zh';
1922
+ root.setAttribute('lang', (lang === 'en') ? 'en' : 'zh-CN');
1923
+ $$('[data-i18n]').forEach(function(el){ if (el.dataset && el.dataset.busy === '1') return; el.textContent = t(el.dataset.i18n); });
1924
+ $$('[data-i18n-html]').forEach(function(el){ el.innerHTML = t(el.dataset.i18nHtml); });
1925
+ $$('[data-i18n-ph]').forEach(function(el){ el.placeholder = t(el.dataset.i18nPh); });
1926
+ $$('[data-i18n-title]').forEach(function(el){ el.title = t(el.dataset.i18nTitle); });
1927
+ $$('[data-i18n-aria]').forEach(function(el){ el.setAttribute('aria-label', t(el.dataset.i18nAria)); });
1928
+ $$('[data-i18n-tip]').forEach(function(el){ el.setAttribute('data-tip', t(el.dataset.i18nTip)); });
1929
+ $$('#langSwitch button').forEach(function(b){ b.classList.toggle('on', b.dataset.l === lang); });
1930
+ if (typeof applyTheme === 'function') applyTheme(theme);
1931
+ refreshCounters(); paintExtent(); paintShowDel(); paintGame(); resolveSection();
1932
+ try{ localStorage.setItem('ets-lang', lang); }catch(e){}
1933
+ if (typeof scheduleSaveParams === 'function') { try { scheduleSaveParams(); } catch (e) {} }
1934
+ }
1935
+
1936
+ /* ================= 输入 ================= */
1937
+ var draft = $('#draft');
1938
+ function detectTask(v){
1939
+ var cjk = (v.match(/[\u4e00-\u9fff]/g) || []).length;
1940
+ var lat = (v.match(/[A-Za-z]/g) || []).length;
1941
+ if(cjk + lat === 0) return 'po';
1942
+ return (cjk / (cjk + lat)) >= 0.25 ? 'zh2en' : 'po';
1943
+ }
1944
+ function paintTask(){
1945
+ var k = detectTask(draft.value || '');
1946
+ var chip = $('#taskHint');
1947
+ if(chip) chip.textContent = t(k === 'zh2en' ? 'task.zh2en' : 'task.po');
1948
+ }
1949
+ function refreshCounters(){
1950
+ var v = draft.value || '';
1951
+ var chars = v.length, rows = v ? v.split(/\n/).length : 0;
1952
+ var cc = $('#charCount'); if(cc) cc.textContent = chars.toLocaleString();
1953
+ var lc = $('#lineCount'); if(lc) lc.textContent = rows;
1954
+ paintTask();
1955
+ }
1956
+ if (draft) draft.addEventListener('input', refreshCounters);
1957
+ on('btnSample', 'click', function(){ toast(t('toast.sample')); });
1958
+ on('btnFile', 'click', function(){ toast(t('toast.file')); });
1959
+ on('btnClear', 'click', function(){
1960
+ if (!draft) return;
1961
+ draft.value = '';
1962
+ refreshCounters();
1963
+ var box = $('#scoreRow'); if (box) box.innerHTML = '';
1964
+ var issues = $('#issuesGrid'); if (issues) issues.innerHTML = '';
1965
+ var out = $('#outText'); if (out) out.innerHTML = '';
1966
+ var os = $('#outScore'); if (os) os.innerHTML = '';
1967
+ try { localStorage.removeItem('ets.state.v1'); } catch (e) {}
1968
+ toast(t('in.clear'));
1969
+ });
1970
+
1971
+ /* ================= 文本位置 → --profile ================= */
1972
+ var SECTION_RULES = [
1973
+ {re:/abstract|摘要|abs/i, p:'abstract'},
1974
+ {re:/intro|引言|introduction/i, p:'intro'},
1975
+ {re:/body|正文|main|text/i, p:'body'}
1976
+ ];
1977
+ function resolveSection(){
1978
+ var el = $('#mSection'); if(!el) return 'body';
1979
+ var v = (el.value || '').trim(), p = 'body', ok = true;
1980
+ if(v){
1981
+ ok = false;
1982
+ for(var i = 0; i < SECTION_RULES.length; i++){
1983
+ if(SECTION_RULES[i].re.test(v)){ p = SECTION_RULES[i].p; ok = true; break; }
1984
+ }
1985
+ }
1986
+ var chip = $('#sectionHint');
1987
+ if(chip){
1988
+ chip.textContent = '--profile ' + p + (ok ? '' : ' · ' + t('meta.sectionUnknown'));
1989
+ chip.classList.toggle('warn', !ok);
1990
+ }
1991
+ var sp = $('#stProfile'); if(sp) sp.textContent = p;
1992
+ return p;
1993
+ }
1994
+ on('mSection', 'input', resolveSection);
1995
+
1996
+ /* ================= 顶部跳转 ================= */
1997
+ var content = $('#content');
1998
+ $$('#jumpSeg button').forEach(function(b){
1999
+ b.addEventListener('click', function(){
2000
+ $$('#jumpSeg button').forEach(function(x){ x.classList.remove('on'); });
2001
+ b.classList.add('on');
2002
+ if(b.dataset.jump === 'top'){ content.scrollTo({top:0, behavior:'smooth'}); }
2003
+ else { $('#sec-detail').scrollIntoView({behavior:'smooth', block:'start'}); loadDetail(); }
2004
+ });
2005
+ });
2006
+
2007
+ /* ================= 参数 · 博弈(预设 + 细调) ================= */
2008
+ var GS = { coalition:'none', mode:'constrained', model:'stack', order:'sequential', budget:60, conn:'agent', engine:'polish',
2009
+ weights: { P1: 40, P2: 40, T1: 10, R1: 10 } };
2010
+ var GAME = {
2011
+ stack: { coalition:'none', order:'sequential' },
2012
+ maxsum: { coalition:'maxsum', order:'sequential' },
2013
+ nash: { coalition:'nash', order:'sequential' },
2014
+ cournot: { coalition:'none', order:'simultaneous' },
2015
+ bertrand: { coalition:'none', order:'simultaneous' },
2016
+ none: { coalition:'none', order:'sequential' }
2017
+ };
2018
+ function gameKey(){ return GS.model; }
2019
+ // 顺序与合作是两个独立维度:同时不等于合作(古诺/伯川德本身就是非合作的)。
2020
+ function modelFor(order, coalition, current){
2021
+ if (order === 'simultaneous') return (current === 'bertrand' ? 'bertrand' : 'cournot');
2022
+ if (coalition === 'nash') return 'nash';
2023
+ if (coalition === 'maxsum') return 'maxsum';
2024
+ return 'stack';
2025
+ }
2026
+ function coopKey(){ return GS.coalition === 'none' ? 'noncoop' : 'coop'; }
2027
+ function paintGame(){
2028
+ var sel = $('#gameSel'); if(sel){ sel.value = GS.model; }
2029
+ var gsw = $('#gameSwitch');
2030
+ if (gsw){
2031
+ var soloNow = GS.model === 'none';
2032
+ gsw.classList.toggle('on', !soloNow);
2033
+ gsw.setAttribute('aria-pressed', soloNow ? 'false' : 'true');
2034
+ }
2035
+ $$('#coalSeg button').forEach(function(b){ b.classList.toggle('on', b.dataset.c === GS.coalition); });
2036
+ $$('#modeSeg button').forEach(function(b){ b.classList.toggle('on', b.dataset.m === GS.mode); });
2037
+ $$('#coopSeg button').forEach(function(b){ b.classList.toggle('on', b.dataset.coop === coopKey()); });
2038
+ $$('#orderSeg button').forEach(function(b){ b.classList.toggle('on', b.dataset.o === GS.order); });
2039
+ $$('#connSeg button').forEach(function(b){ b.classList.toggle('on', b.dataset.c === GS.conn); });
2040
+ var bg = $('#budget'); if(bg){ bg.value = GS.budget; }
2041
+ var bv = $('#budgetVal'); if(bv){ bv.textContent = GS.budget + 's'; }
2042
+ var f = $('#gameFlag');
2043
+ var cost = '2.0';
2044
+ var cc = $('#certCoal');
2045
+ if(cc) cc.innerHTML = '<code>' + GS.coalition + '</code> · ' + t('cert.cost') + ' <code>' + cost + '</code>';
2046
+ var cm = $('#certMode');
2047
+ if(cm) cm.innerHTML = '<code>' + GS.mode + '</code> · ' + t(GS.mode === 'free' ? 'cert.modeFree' : 'cert.modeCon');
2048
+ var cf = $('#certForm');
2049
+ if(cf) cf.textContent = t(coopKey() === 'coop' ? 'cert.formCoop' : 'cert.formNon');
2050
+ var solo = GS.model === 'none';
2051
+ ['orderSeg', 'coopSeg', 'coalSeg', 'modeSeg'].forEach(function(id){
2052
+ var el = $('#' + id); if (!el) return;
2053
+ var cn = (el.closest && el.closest('.cn')) || el.parentNode;
2054
+ if (cn) cn.classList.toggle('disabled', solo);
2055
+ $$('#' + id + ' button').forEach(function(b){ b.disabled = solo; });
2056
+ });
2057
+ var ec = $('#engineCard'); if (ec) ec.hidden = false;
2058
+ var es = $('#engineSel');
2059
+ if (es){
2060
+ if (!solo) GS.engine = 'equilibrium';
2061
+ else if (GS.engine === 'equilibrium') GS.engine = 'polish';
2062
+ var custom = (GS.engine.indexOf('skill:') === 0) ? GS.engine.slice(6) : '';
2063
+ var pick = es.querySelector('option[value="__pick__"]');
2064
+ var co = es.querySelector('option[data-custom="1"]');
2065
+ if (custom){
2066
+ if (!co){ co = document.createElement('option'); co.dataset.custom = '1'; es.insertBefore(co, pick || null); }
2067
+ co.value = 'skill:' + custom; co.textContent = custom;
2068
+ } else if (co){ co.parentNode.removeChild(co); }
2069
+ Array.prototype.forEach.call(es.options, function(o){
2070
+ var isEq = o.value === 'equilibrium';
2071
+ o.hidden = solo ? isEq : !isEq;
2072
+ });
2073
+ es.value = GS.engine;
2074
+ es.disabled = !solo;
2075
+ es.title = solo
2076
+ ? et('单技能模式,可自由选择引擎', 'Single-skill mode: pick any engine')
2077
+ : et('选择博弈模型时自动锁定为 equilibrium', 'Locked to equilibrium while a game model is selected');
2078
+ }
2079
+ if (ec) ec.classList.toggle('locked', !solo);
2080
+ if(f) f.textContent = solo ? ('--single-skill ' + GS.engine) : ('--coalition ' + GS.coalition
2081
+ + (GS.order === 'simultaneous' ? ' --rounds 1' : '')
2082
+ + (GS.mode === 'free' ? ' --mode free' : ''));
2083
+ if (typeof scheduleSaveParams === 'function') scheduleSaveParams();
2084
+ }
2085
+ var gswEl = $('#gameSwitch');
2086
+ if (gswEl) gswEl.addEventListener('click', function(){
2087
+ if (GS.model === 'none'){ GS.model = 'stack'; GS.coalition = 'none'; GS.order = 'sequential'; }
2088
+ else { GS.model = 'none'; }
2089
+ paintGame();
2090
+ });
2091
+ on('gameSel', 'change', function(){
2092
+ var g = GAME[this.value] || GAME.stack;
2093
+ GS.model = this.value;
2094
+ if (this.value !== 'none') {
2095
+ GS.coalition = g.coalition;
2096
+ GS.order = g.order;
2097
+ }
2098
+ paintGame();
2099
+ toast(t('toast.game', {g: t('game.' + this.value)}));
2100
+ });
2101
+ $$('#orderSeg button').forEach(function(b){
2102
+ b.addEventListener('click', function(){
2103
+ GS.order = b.dataset.o;
2104
+ // 只改顺序,不动合作/联盟
2105
+ GS.model = modelFor(GS.order, GS.coalition, GS.model);
2106
+ paintGame();
2107
+ });
2108
+ });
2109
+ $$('#coalSeg button').forEach(function(b){
2110
+ b.addEventListener('click', function(){
2111
+ GS.coalition = b.dataset.c;
2112
+ GS.model = modelFor(GS.order, GS.coalition, GS.model);
2113
+ paintGame();
2114
+ });
2115
+ });
2116
+ $$('#modeSeg button').forEach(function(b){
2117
+ b.addEventListener('click', function(){ GS.mode = b.dataset.m; paintGame(); });
2118
+ });
2119
+ $$('#connSeg button').forEach(function(b){
2120
+ b.addEventListener('click', function(){ GS.conn = b.dataset.c;
2121
+ try { localStorage.setItem('ets.connDefault.v1', GS.conn); } catch (e) {}
2122
+ paintGame(); });
2123
+ });
2124
+ var engineEl = $('#engineSel');
2125
+ if (engineEl) engineEl.addEventListener('change', function(){
2126
+ if (GS.model !== 'none'){ paintGame(); return; }
2127
+ if (engineEl.value === '__pick__'){ engineEl.value = GS.engine; openSkillPicker(); return; }
2128
+ GS.engine = engineEl.value;
2129
+ paintGame();
2130
+ });
2131
+ var budgetEl = $('#budget');
2132
+ if(budgetEl){
2133
+ budgetEl.addEventListener('input', function(){
2134
+ GS.budget = parseInt(budgetEl.value, 10) || 60;
2135
+ paintGame();
2136
+ });
2137
+ }
2138
+ $$('#coopSeg button').forEach(function(b){
2139
+ b.addEventListener('click', function(){
2140
+ if(b.dataset.coop === 'noncoop'){ GS.coalition = 'none'; }
2141
+ else if(GS.coalition === 'none'){ GS.coalition = 'maxsum'; }
2142
+ GS.model = modelFor(GS.order, GS.coalition, GS.model);
2143
+ paintGame();
2144
+ });
2145
+ });
2146
+ var extent = $('#extent');
2147
+ function paintExtent(){ $('#extentVal').textContent = (+extent.value === 0) ? 'AUTO' : extent.value + '%';
2148
+ if (typeof scheduleSaveParams === 'function') scheduleSaveParams(); }
2149
+ if (extent) extent.addEventListener('input', paintExtent);
2150
+
2151
+ /* ================= 改写稿标注 ================= */
2152
+ var showAdd = true;
2153
+ function paintShowAdd(){
2154
+ $('#showAddLabel').textContent = t(showAdd ? 'out.hideadd' : 'out.showadd');
2155
+ $('#showAddBtn').classList.toggle('on', showAdd);
2156
+ $('#showAddBtn').setAttribute('aria-pressed', showAdd ? 'true' : 'false');
2157
+ $('#outText').classList.toggle('hide-add', !showAdd);
2158
+ }
2159
+ on('showAddBtn', 'click', function(){
2160
+ showAdd = !showAdd;
2161
+ paintShowAdd();
2162
+ });
2163
+
2164
+ var showDel = false;
2165
+ function paintShowDel(){
2166
+ $('#showDelLabel').textContent = t(showDel ? 'out.hide' : 'out.showdel');
2167
+ $('#showDelBtn').classList.toggle('on', showDel);
2168
+ $('#showDelBtn').setAttribute('aria-pressed', showDel ? 'true' : 'false');
2169
+ }
2170
+ on('showDelBtn', 'click', function(){
2171
+ showDel = !showDel;
2172
+ $('#outText').classList.toggle('show-del', showDel);
2173
+ paintShowDel();
2174
+ });
2175
+
2176
+ /* ================= 详细结果:滚动到才加载 ================= */
2177
+ var detailLoaded = false, detailLoading = false;
2178
+ function loadDetail(){
2179
+ if(detailLoaded || detailLoading) return;
2180
+ detailLoading = true;
2181
+ $('#detailSkel').classList.add('on');
2182
+ setTimeout(function(){
2183
+ detailLoading = false; detailLoaded = true;
2184
+ $('#detailSkel').classList.remove('on');
2185
+ $('#detailBody').hidden = false;
2186
+ activateDTab('diff');
2187
+ toast(t('det.loaded'));
2188
+ }, 520);
2189
+ }
2190
+ if('IntersectionObserver' in window){
2191
+ var io = new IntersectionObserver(function(entries){
2192
+ entries.forEach(function(e){ if(e.isIntersecting) loadDetail(); });
2193
+ }, {root: content, threshold: 0.15});
2194
+ io.observe($('#sec-detail'));
2195
+ } else { loadDetail(); }
2196
+
2197
+ function activateDTab(name){
2198
+ $$('.dtab').forEach(function(b){
2199
+ var on = b.dataset.dtab === name;
2200
+ b.classList.toggle('on', on); b.setAttribute('aria-selected', on ? 'true' : 'false');
2201
+ });
2202
+ ['diff','issues','moves'].forEach(function(k){
2203
+ var p = $('#dtab-'+k); if(p) p.hidden = (k !== name);
2204
+ });
2205
+ }
2206
+ $$('.dtab').forEach(function(b){ b.addEventListener('click', function(){ activateDTab(b.dataset.dtab); }); });
2207
+
2208
+ $$('#outText mark').forEach(function(m){
2209
+ m.addEventListener('click', function(){ jumpToHunk(m.dataset.ref); });
2210
+ m.addEventListener('keydown', function(e){ if(e.key === 'Enter'){ jumpToHunk(m.dataset.ref); } });
2211
+ });
2212
+
2213
+ function jumpToHunk(ref){
2214
+ loadDetail();
2215
+ $('#sec-detail').scrollIntoView({behavior:'smooth', block:'start'});
2216
+ setTimeout(function(){
2217
+ activateDTab('diff');
2218
+ var h = root.querySelector('.hunk[data-hunk="'+ref+'"]');
2219
+ if(h){
2220
+ $$('.hunk').forEach(function(x){ x.classList.remove('focus'); });
2221
+ h.classList.add('focus');
2222
+ h.scrollIntoView({behavior:'smooth', block:'center'});
2223
+ setTimeout(function(){ h.classList.remove('focus'); }, 1600);
2224
+ }
2225
+ }, detailLoaded ? 0 : 560);
2226
+ }
2227
+
2228
+ /* ================= 改动块 ================= */
2229
+ var adopted = 2;
2230
+ function refreshAdopt(){ var el = $('#adoptCount'); if(el) el.textContent = adopted; }
2231
+ $$('.hunk').forEach(function(h){
2232
+ if(h.classList.contains('ok')) h.dataset.state = 'yes';
2233
+ var yes = $('.mini', h), no = $('.mini.rej', h);
2234
+ function set(state){
2235
+ var prev = h.dataset.state || '';
2236
+ h.classList.remove('ok','no','focus');
2237
+ if(state === 'yes'){ h.classList.add('ok'); if(prev !== 'yes') adopted++; }
2238
+ if(state === 'no'){ h.classList.add('no'); if(prev === 'yes') adopted--; }
2239
+ h.dataset.state = state; refreshAdopt();
2240
+ }
2241
+ yes.addEventListener('click', function(e){ e.stopPropagation(); set('yes'); toast(t('toast.adopt', {h:h.dataset.hunk.toUpperCase()})); });
2242
+ no.addEventListener('click', function(e){ e.stopPropagation(); set('no'); toast(t('toast.ignore', {h:h.dataset.hunk.toUpperCase()})); });
2243
+ });
2244
+
2245
+ $$('.card-i[data-ref]').forEach(function(c){
2246
+ c.addEventListener('click', function(){
2247
+ $$('.card-i').forEach(function(x){ x.classList.remove('sel'); });
2248
+ c.classList.add('sel');
2249
+ jumpToHunk(c.dataset.ref);
2250
+ });
2251
+ });
2252
+
2253
+ /* ================= 动作 ================= */
2254
+ function busy(btn, ms, done){
2255
+ var old = btn.innerHTML; btn.disabled = true; btn.textContent = '● …';
2256
+ setTimeout(function(){ btn.disabled = false; btn.innerHTML = old; toast(done); }, ms);
2257
+ }
2258
+ on('btnRun', 'click', function(){
2259
+ if (root.__etsAction && root.__etsAction('run')) return;
2260
+ busy(this, 1100, t('toast.ran'));
2261
+ });
2262
+ on('entryStudio', 'click', function(){ toast(t('toast.entry')); });
2263
+ on('copyOut', 'click', function(){
2264
+ var text = (typeof appliedText === 'function' && typeof LAST_RUN !== 'undefined' && LAST_RUN)
2265
+ ? appliedText(LAST_RUN)
2266
+ : ((typeof LAST_RUN !== 'undefined' && LAST_RUN && LAST_RUN.finalText)
2267
+ ? LAST_RUN.finalText
2268
+ : ($('#outText') ? $('#outText').innerText : ''));
2269
+ if (!text || !String(text).trim()){ toast(t('toast.copyEmpty')); return; }
2270
+ var done = function(){ toast(t('toast.copied')); };
2271
+ var fail = function(){ toast(t('toast.copyFail')); };
2272
+ try {
2273
+ if (navigator.clipboard && navigator.clipboard.writeText){
2274
+ navigator.clipboard.writeText(String(text)).then(done).catch(function(){
2275
+ fallbackCopy(String(text)) ? done() : fail();
2276
+ });
2277
+ return;
2278
+ }
2279
+ } catch (e) {}
2280
+ fallbackCopy(String(text)) ? done() : fail();
2281
+ });
2282
+
2283
+ function fallbackCopy(text){
2284
+ try {
2285
+ var ta = document.createElement('textarea');
2286
+ ta.value = text;
2287
+ ta.style.position = 'fixed';
2288
+ ta.style.opacity = '0';
2289
+ root.appendChild(ta);
2290
+ ta.focus(); ta.select();
2291
+ var ok = document.execCommand('copy');
2292
+ root.removeChild(ta);
2293
+ return ok;
2294
+ } catch (e) { return false; }
2295
+ }
2296
+ $$('#langSwitch button').forEach(function(b){ b.addEventListener('click', function(){ applyLang(b.dataset.l); }); });
2297
+ var themeBtn = $('#themeBtn');
2298
+ if (themeBtn) themeBtn.addEventListener('click', function(e){
2299
+ e.stopPropagation();
2300
+ var pop = $('#themePop');
2301
+ if (pop) themePop(pop.hasAttribute('hidden'));
2302
+ });
2303
+ $$('#themePop .th-card').forEach(function(b){
2304
+ b.addEventListener('click', function(){ applyTheme(b.dataset.t); themePop(false); });
2305
+ });
2306
+ if (!window.__etsThemeWired) {
2307
+ window.__etsThemeWired = true;
2308
+ document.addEventListener('pointerdown', function(e){
2309
+ var pop = document.getElementById('themePop');
2310
+ var wrap = document.getElementById('themeWrap');
2311
+ if (!pop || pop.hasAttribute('hidden')) return;
2312
+ if (wrap && !wrap.contains(e.target)) {
2313
+ pop.setAttribute('hidden', '');
2314
+ var b = document.getElementById('themeBtn');
2315
+ if (b) b.setAttribute('aria-expanded', 'false');
2316
+ }
2317
+ });
2318
+ document.addEventListener('keydown', function(e){
2319
+ if (e.key !== 'Escape') return;
2320
+ var pop = document.getElementById('themePop');
2321
+ if (!pop) return;
2322
+ pop.setAttribute('hidden', '');
2323
+ var b = document.getElementById('themeBtn');
2324
+ if (b) b.setAttribute('aria-expanded', 'false');
2325
+ });
2326
+ }
2327
+
2328
+ /* ================= 初始化 ================= */
2329
+ var savedTheme = 'classic';
2330
+ try{ savedTheme = localStorage.getItem(THEME_KEY) || 'classic'; }catch(e){}
2331
+ applyTheme(savedTheme);
2332
+
2333
+ var saved = null;
2334
+ try{ saved = localStorage.getItem('ets-lang'); }catch(e){}
2335
+ applyLang(saved || ((navigator.language || 'zh').toLowerCase().indexOf('zh') === 0 ? 'zh' : 'en'));
2336
+ refreshAdopt(); paintShowDel(); paintShowAdd();
2337
+
2338
+ /* ================= 引擎对接(P3.5) ================= */
2339
+ var API_BASE = '/econtone-studio/api';
2340
+ var LAST_RUN = null;
2341
+ var LAST_MEASURE = null;
2342
+ var DECISIONS = {};
2343
+ var DECISION_RUN = null;
2344
+ var SYNCING = false;
2345
+ var LAST_SEEN = 0;
2346
+ var DIRTY = false;
2347
+ var dirtyTimer = null;
2348
+ var TASKS = [];
2349
+ var ACTIVE = null;
2350
+ var POLL_MS = 500;
2351
+ var POLL_MAX = 420; /* 210s: agent 路径最长 180s + 宽容 */
2352
+
2353
+ function et(zh, en){ return lang === 'en' ? en : zh; }
2354
+ function esc(s){
2355
+ return String(s == null ? '' : s).replace(/[&<>"]/g, function(c){
2356
+ return { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[c];
2357
+ });
2358
+ }
2359
+
2360
+ function apiFetch(path, opts){
2361
+ return fetch(API_BASE + path, opts).then(function(r){
2362
+ return r.json().catch(function(){
2363
+ return { ok: false, error: { code: 'HTTP_' + r.status, message: 'bad response' } };
2364
+ });
2365
+ }).then(function(body){
2366
+ if (!body || body.ok !== true){
2367
+ var e = (body && body.error) || {};
2368
+ var err = new Error((e.code ? e.code + ' · ' : '') + (e.message || 'request failed'));
2369
+ err.code = e.code;
2370
+ throw err;
2371
+ }
2372
+ return body.data;
2373
+ });
2374
+ }
2375
+
2376
+ var CODE_ZH = {
2377
+ BANNED: '术语表禁用', ACRONYM: '缩写未展开', MIXED: '中英混排',
2378
+ SLURRY: '长句连排', POUNDING: '重音密集', ROBOTIC: '句式机械',
2379
+ DENSE: '句子过密', FLAT: '语调平直', REGISTER: '模板化表达', TIER: '痕迹风险'
2380
+ };
2381
+ function codeLabel(code){
2382
+ if (lang === 'en') return code || '';
2383
+ return CODE_ZH[code] || code || '';
2384
+ }
2385
+
2386
+ function p2Label(evidence){
2387
+ var s = String(evidence || '');
2388
+ if (lang === 'en') return s;
2389
+ if (/^clean$/i.test(s)) return '无问题';
2390
+ if (/claims match/i.test(s)) return '主张与证据一致';
2391
+ if (/no stated design/i.test(s)) return '未声明识别策略';
2392
+ if (/causal verb/i.test(s)) return '有因果动词但缺少识别语言';
2393
+ if (/without a magnitude/i.test(s)) return '显著性陈述缺少幅度';
2394
+ return s;
2395
+ }
2396
+
2397
+ function evidenceOf(f){ return (f.evidence && f.evidence[0]) || {}; }
2398
+
2399
+ function dimLines(run, id){
2400
+ var list = run.findings || [];
2401
+ var out = [];
2402
+ var MAX = 1, MAXLEN = 96;
2403
+ var clip = function(s){
2404
+ s = String(s == null ? '' : s);
2405
+ return s.length > MAXLEN ? s.slice(0, MAXLEN) + '…' : s;
2406
+ };
2407
+ if (id === 'P2'){
2408
+ var row = ((run.score || {}).rows || []).filter(function(r){ return r.id === 'P2'; })[0];
2409
+ if (row && row.evidence) out.push(p2Label(row.evidence));
2410
+ return out;
2411
+ }
2412
+ var want = id === 'P1' ? 'polish' : (id === 'T1' ? 'trace' : 'prosody');
2413
+ var hits = [];
2414
+ list.forEach(function(f){
2415
+ if (f.player !== want) return;
2416
+ var ev = evidenceOf(f);
2417
+ var text = f.original || ev.message || '';
2418
+ var cl = codeLabel(ev.code);
2419
+ var prefix = (cl && cl !== 'MODEL') ? cl + (lang === 'en' ? ': ' : ':') : '';
2420
+ hits.push(clip(prefix + text));
2421
+ });
2422
+ hits.slice(0, MAX).forEach(function(x){ out.push(x); });
2423
+ if (hits.length > MAX) out.push(et('\u5176\u4f59 ' + (hits.length - MAX) + ' \u6761', 'and ' + (hits.length - MAX) + ' more'));
2424
+ return out;
2425
+ }
2426
+
2427
+ function isChinese(text){
2428
+ var t = String(text || '');
2429
+ if (!t) return false;
2430
+ var cjk = (t.match(/[\u4e00-\u9fff]/g) || []).length;
2431
+ return cjk >= 8 && cjk / t.length >= 0.15;
2432
+ }
2433
+ function syncDraftVisibility(){
2434
+ var box = $('#sec-draft');
2435
+ if (!box) return;
2436
+ var text = (draft && draft.value) || '';
2437
+ if (!isChinese(text)) { box.hidden = true; return; }
2438
+ box.hidden = false;
2439
+ var d = (LAST_MEASURE && LAST_MEASURE.draft) ? String(LAST_MEASURE.draft) : '';
2440
+ if (d) { renderDraft({ draft: d }); return; }
2441
+ if (box.dataset.busy === '1') {
2442
+ $('#draftText').innerHTML = '<p class="draft-pending">' + esc(et('\u6b63\u5728\u7ffb\u8bd1\u4e2d\u2026', 'Translating\u2026')) + '</p>';
2443
+ } else {
2444
+ $('#draftText').innerHTML = '<p class="draft-pending">' + esc(et('\u5c1a\u672a\u751f\u6210\u521d\u7a3f', 'No draft yet')) + '</p>';
2445
+ }
2446
+ }
2447
+
2448
+ function renderDraft(run){
2449
+ var box = $('#sec-draft');
2450
+ if (!box) return;
2451
+ var draft = run && run.draft ? String(run.draft) : '';
2452
+ if (!draft){ box.hidden = true; $('#draftText').innerHTML = ''; return; }
2453
+ box.hidden = false;
2454
+ $('#draftText').innerHTML = draft.split(/\n{2,}/).map(function(p){
2455
+ return '<p>' + esc(p) + '</p>';
2456
+ }).join('');
2457
+ }
2458
+
2459
+ function normRow(r){
2460
+ if (!r) return 0;
2461
+ var sc = Number(r.score), mx = Number(r.max);
2462
+ if (!isFinite(sc)) return 0;
2463
+ return mx > 0 ? Math.round(100 * sc / mx) : Math.round(sc);
2464
+ }
2465
+ function weightsOf(){
2466
+ var w = (GS && GS.weights) || {};
2467
+ return { P1: Number(w.P1) || 0, P2: Number(w.P2) || 0, T1: Number(w.T1) || 0, R1: Number(w.R1) || 0 };
2468
+ }
2469
+ function weightedTotal(rows){
2470
+ var w = weightsOf(), sum = 0, acc = 0;
2471
+ (rows || []).forEach(function(r){
2472
+ var ww = Number(w[r.id]);
2473
+ if (!isFinite(ww) || ww <= 0) return;
2474
+ sum += ww; acc += normRow(r) * ww;
2475
+ });
2476
+ return sum > 0 ? Math.round(acc / sum) : 0;
2477
+ }
2478
+ function repaintTotals(){
2479
+ var rows = (LAST_MEASURE && LAST_MEASURE.score && LAST_MEASURE.score.rows) || [];
2480
+ var tot = weightedTotal(rows);
2481
+ var ring = document.querySelector('#scoreRow .total .ring');
2482
+ var num = document.querySelector('#scoreRow .total .ring b');
2483
+ if (ring) ring.style.setProperty('--p', tot);
2484
+ if (num) num.textContent = tot;
2485
+ if (LAST_RUN) safeRender(renderFinalScore, LAST_RUN);
2486
+ }
2487
+
2488
+ function renderScore(run){
2489
+ var box = $('#scoreRow'); if (!box) return;
2490
+ var s = run.score || {};
2491
+ var rows = s.rows || [];
2492
+ var html = rows.map(function(r){
2493
+ var pct = r.max ? Math.round(100 * r.score / r.max) : 0;
2494
+ var warn = (r.id === 'T1' || r.id === 'R1') ? ' warn' : '';
2495
+ var name = t('sc.' + String(r.id).toLowerCase());
2496
+ var norm = normRow(r);
2497
+ var wv = (weightsOf()[r.id] == null) ? '' : weightsOf()[r.id];
2498
+ var lines = dimLines(run, r.id);
2499
+ var inner = lines.length
2500
+ ? lines.map(function(x){ return '<div class="li">' + esc(x) + '</div>'; }).join('')
2501
+ : '<div class="none">' + esc(et('无问题', 'No issues')) + '</div>';
2502
+ return '<div class="sc' + warn + '" data-dim="' + esc(r.id) + '">'
2503
+ + '<div class="top"><b>' + esc(r.id) + '</b><span>' + esc(name) + '</span>'
2504
+ + '<em class="num">' + norm + '<i>/100</i></em></div>'
2505
+ + '<div class="bar"><i style="width:' + norm + '%"></i></div>'
2506
+ + '<div class="ev">' + esc(r.evidence || '') + '</div>'
2507
+ + '<div class="sc-issues" data-dim="' + esc(r.id) + '">' + inner + '</div>'
2508
+ + '<div class="wt"><span>' + esc(t('sc.weight')) + '</span>'
2509
+ + '<input type="number" min="0" max="100" step="1" data-w="' + esc(r.id) + '" value="' + esc(wv) + '" aria-label="weight" />'
2510
+ + '<i>%</i></div>'
2511
+ + '</div>';
2512
+ }).join('');
2513
+ var total = weightedTotal(rows);
2514
+ var lat = (s.editing_latitude == null) ? '—' : s.editing_latitude;
2515
+ html += '<div class="total" data-dim="TOTAL"><div class="ring" style="--p:' + total + '">'
2516
+ + '<b class="num">' + total + '</b></div>'
2517
+ + '<div class="tx"><b>' + esc(t('sc.total')) + '</b>'
2518
+ + '<div class="adv">' + esc(s.advice || '') + '</div></div></div>';
2519
+ box.innerHTML = html;
2520
+ }
2521
+
2522
+ function renderIssues(run){
2523
+ var box = $('#issuesGrid'); if (!box) return;
2524
+ var list = run.findings || [];
2525
+ var count = $('#issueCount'); if (count) count.textContent = list.length;
2526
+ if (!list.length){
2527
+ box.innerHTML = '<div class="note" style="grid-column:1/-1">'
2528
+ + esc(et('未发现问题', 'No findings')) + '</div>';
2529
+ return;
2530
+ }
2531
+ box.innerHTML = list.map(function(f){
2532
+ var sev = f.severity === 'error' ? 'err' : (f.severity === 'warn' ? 'warn' : 'info');
2533
+ var icon = f.severity === 'error' ? '⛔' : (f.severity === 'warn' ? '⚠' : 'ℹ');
2534
+ var ev = evidenceOf(f);
2535
+ var title = f.original ? '<code>' + esc(f.original) + '</code>' : esc(f.reason || '');
2536
+ var why = f.original ? esc(f.reason || '') : '';
2537
+ var loc = f.paragraph
2538
+ ? et('第 ' + f.paragraph + ' 段', 'paragraph ' + f.paragraph)
2539
+ : et('全文', 'whole text');
2540
+ return '<article class="card-i ' + sev + '" data-ref="' + esc(f.id) + '">'
2541
+ + '<div class="c-top"><span class="sev sev-' + sev + '">' + icon + ' '
2542
+ + esc(codeLabel(ev.code)) + '</span>'
2543
+ + '<span class="src">' + esc(f.player || '') + '</span></div>'
2544
+ + '<div class="c-ttl">' + title + '</div>'
2545
+ + (why ? '<div class="c-why">' + why + '</div>' : '')
2546
+ + '<div class="c-meta"><span>' + esc(loc) + '</span><span class="grow"></span></div>'
2547
+ + '</article>';
2548
+ }).join('');
2549
+ }
2550
+
2551
+ function renderStatus(run, elapsedMs){
2552
+ var fp = $('#stFp');
2553
+ if (fp) fp.textContent = 'fp ' + ((run.engine && run.engine.fingerprint) || '—');
2554
+ var tm = $('#stTime');
2555
+ if (tm) tm.textContent = elapsedMs ? (elapsedMs / 1000).toFixed(1) + 's' : '—';
2556
+ var risk = null;
2557
+ (run.findings || []).forEach(function(f){
2558
+ var ev = evidenceOf(f);
2559
+ if (risk == null && ev.source === 'trace' && ev.code === 'TIER') risk = ev.value;
2560
+ });
2561
+ var rk = $('#stRisk');
2562
+ if (rk) rk.textContent = 'risk_index ' + (risk == null ? '—' : Number(risk).toFixed(1));
2563
+ var prof = $('#stProfile');
2564
+ if (prof && run.profile) prof.textContent = run.profile;
2565
+ }
2566
+
2567
+ function setCertTab(enabled){
2568
+ var tab = root.querySelector('.dtab[data-dtab="moves"]');
2569
+ if (!tab) return;
2570
+ tab.classList.toggle('disabled', !enabled);
2571
+ tab.disabled = !enabled;
2572
+ if (!enabled && tab.classList.contains('on')) {
2573
+ try { activateDTab('diff'); } catch (e) {}
2574
+ }
2575
+ }
2576
+
2577
+ function normalizeMove(raw){
2578
+ if (typeof raw === 'string'){
2579
+ var s = raw.trim();
2580
+ var id = '', player = '';
2581
+ var mm = /^([a-z]\d+)\s+([a-z-]+)/i.exec(s);
2582
+ if (mm){ id = mm[1]; player = mm[2]; }
2583
+ var v = '';
2584
+ if (/拒绝|rejected|否决/i.test(s)) v = 'rejected';
2585
+ else if (/跳过|stale/i.test(s)) v = 'stale';
2586
+ else if (/接受|accepted|应用|applied/i.test(s)) v = 'accepted';
2587
+ return { id: id, player: player, kind: '', verdict: v, metric: s };
2588
+ }
2589
+ var m = raw || {};
2590
+ var vv = String(m.verdict || m.status || (m.accepted === true ? 'accepted' : (m.accepted === false ? 'rejected' : '')));
2591
+ var text = m.metric || m.reason || m.note || m.detail || m.description || '';
2592
+ return {
2593
+ id: m.id || '', player: m.player || m.engine || '',
2594
+ kind: m.kind || m.type || '', verdict: vv, metric: text,
2595
+ };
2596
+ }
2597
+ function renderMoves(run){
2598
+ var box = $('#movesList');
2599
+ if (!box) return;
2600
+ var cert = run && run.certificate;
2601
+ var moves = [];
2602
+ if (cert) (cert.rounds || []).forEach(function(rd){
2603
+ (rd.moves || []).forEach(function(raw){ moves.push({ round: rd.round, m: normalizeMove(raw) }); });
2604
+ });
2605
+ if (!moves.length){
2606
+ box.innerHTML = '<div class="move-empty">' + esc(et('本次运行没有候选动作', 'No moves in this run')) + '</div>';
2607
+ return;
2608
+ }
2609
+ box.innerHTML = moves.map(function(x){
2610
+ var m = x.m;
2611
+ var v = String(m.verdict || '');
2612
+ var cls = /^accepted/.test(v) ? 'y' : (/^rejected/.test(v) ? 'n' : 'p');
2613
+ var icon = cls === 'y' ? '\u2713' : (cls === 'n' ? '\u2715' : '\u00b7');
2614
+ var tag = cls === 'y' ? t('mv.accepted')
2615
+ : (cls === 'n' ? t('mv.rejected')
2616
+ : (/^stale/.test(v) ? et('\u5df2\u8df3\u8fc7', 'Skipped') : t('mv.pending')));
2617
+ var player = String(m.player || '').toLowerCase();
2618
+ return '<div class="move">'
2619
+ + '<div class="st ' + cls + '">' + icon + '</div>'
2620
+ + '<div class="b"><div class="l1">'
2621
+ + (m.id ? '<b>' + esc(m.id) + '</b>' : '')
2622
+ + (m.player ? '<span class="pl pl-' + esc(player) + '">' + esc(m.player) + '</span>' : '')
2623
+ + (m.kind ? '<span class="kind">' + esc(m.kind) + '</span>' : '')
2624
+ + '<span class="st-tag st-' + cls + '">' + esc(tag) + '</span></div>'
2625
+ + '<div class="reason">' + esc(m.metric || '') + '</div>'
2626
+ + '<div class="metrics"><span>' + esc(et('\u7b2c ' + x.round + ' \u8f6e', 'round ' + x.round)) + '</span></div>'
2627
+ + '</div></div>';
2628
+ }).join('');
2629
+ }
2630
+
2631
+ function renderCertificate(run){
2632
+ var cert = run.certificate;
2633
+ var mc = $('#moveCount');
2634
+ var totalMoves = 0;
2635
+ if (cert) (cert.rounds || []).forEach(function(rd){ totalMoves += (rd.moves || []).length; });
2636
+ if (mc) mc.textContent = totalMoves;
2637
+ if (!cert) return;
2638
+ var kv = $('.cert .kv');
2639
+ if (kv){
2640
+ var accepted = 0, rejected = 0;
2641
+ (cert.rounds || []).forEach(function(rd){
2642
+ (rd.moves || []).forEach(function(m){
2643
+ if (m.accepted) accepted++;
2644
+ else if (!m.stale && !m.error) rejected++;
2645
+ });
2646
+ });
2647
+ var g = cert.game || {};
2648
+ kv.innerHTML = ''
2649
+ + '<dt>' + esc(et('形式', 'Form')) + '</dt><dd><code>' + esc(g.model || '') + '</code></dd>'
2650
+ + '<dt>' + esc(et('联盟', 'Coalition')) + '</dt><dd><code>' + esc(g.cooperation || 'none') + '</code></dd>'
2651
+ + '<dt>' + esc(et('模式', 'Mode')) + '</dt><dd><code>' + esc(cert.mode || '') + '</code></dd>'
2652
+ + '<dt>' + esc(et('迭代成本', 'Iter. cost')) + '</dt><dd><code>' + esc(String(g.iteration_cost == null ? '' : g.iteration_cost)) + '</code></dd>'
2653
+ + '<dt>' + esc(et('轮次', 'Rounds')) + '</dt><dd>' + ((cert.rounds || []).length) + '</dd>'
2654
+ + '<dt>' + esc(et('记录', 'Record')) + '</dt><dd>'
2655
+ + esc(et('接受 ', 'accepted ') + accepted + et(' · 拒绝 ', ' · rejected ') + rejected) + '</dd>'
2656
+ + '<dt>' + esc(et('停止', 'Stopped')) + '</dt><dd>' + esc(cert.stopped_because || '') + '</dd>';
2657
+ }
2658
+ var rounds = $('.cert .rounds');
2659
+ if (rounds && (cert.rounds || []).length){
2660
+ rounds.innerHTML = cert.rounds.map(function(rd){
2661
+ var n = (rd.moves || []).length;
2662
+ return '<div class="round"><span class="rn">R' + rd.round + '</span><div class="rb">'
2663
+ + '<b>' + esc(rd.accepted || et('无可用动作', 'no acceptable move')) + '</b>'
2664
+ + '<p>' + n + esc(et(' 个候选', ' candidates')) + '</p></div></div>';
2665
+ }).join('');
2666
+ }
2667
+ }
2668
+
2669
+ function renderRewrite(run){
2670
+ var out = $('#outText');
2671
+ if (!out) return;
2672
+ var base = run.baseText;
2673
+ if (!base) {
2674
+ var typed = (draft && draft.value) || '';
2675
+ base = (isChinese(typed) && LAST_MEASURE && LAST_MEASURE.draft)
2676
+ ? String(LAST_MEASURE.draft)
2677
+ : typed;
2678
+ }
2679
+ var text = run.finalText || '';
2680
+ var edits = (run.edits || []).slice().sort(function(a, b){
2681
+ return a.base_range.start - b.base_range.start;
2682
+ });
2683
+ var plainOut = function(s){
2684
+ out.innerHTML = String(s || '').split(/\n{2,}/).map(function(p){
2685
+ return '<p>' + esc(p) + '</p>';
2686
+ }).join('');
2687
+ var cc = $('#outCount'); if (cc) cc.textContent = 0;
2688
+ var ww = $('#outWords'); if (ww) ww.textContent = 0;
2689
+ };
2690
+ if (!text && !base){
2691
+ out.innerHTML = '<div class="out-empty">' + esc(et('还没有改写稿,点「润色」开始', 'No rewrite yet \u2014 press Rewrite')) + '</div>';
2692
+ return;
2693
+ }
2694
+ if (!base){ plainOut(text); return; }
2695
+ if (!edits.length){ plainOut(text || base); return; }
2696
+ var html = '', cur = 0, accepted = 0, words = 0;
2697
+ edits.forEach(function(e, idx){
2698
+ var br = e.base_range || {}, ar = e.after_range || {};
2699
+ var s = br.start, en = br.end;
2700
+ if (!(s >= 0) || !(en >= s) || en > base.length || s < cur) return;
2701
+ html += esc(base.slice(cur, s));
2702
+ if (decisionOf(e.id) === 'no') {
2703
+ html += esc(base.slice(s, en));
2704
+ } else {
2705
+ accepted++;
2706
+ var n = idx + 1;
2707
+ var del = String(e.original || base.slice(s, en) || '');
2708
+ var add = (e.op === 'delete') ? '' : String(text.slice(ar.start, ar.end) || '');
2709
+ if (del) {
2710
+ html += '<span class="dele" data-ref="' + esc(e.id) + '"><s>' + esc(del)
2711
+ + '</s><sup>' + n + '</sup></span>';
2712
+ }
2713
+ if (add) {
2714
+ var why = String(e.reason || '');
2715
+ html += '<mark data-ref="' + esc(e.id) + '" tabindex="0"'
2716
+ + (why ? ' title="' + esc(why) + '"' : '') + '>'
2717
+ + esc(add) + '<sup>' + n + '</sup></mark>';
2718
+ words += add.trim() ? add.trim().split(/\s+/).length : 0;
2719
+ }
2720
+ }
2721
+ cur = en;
2722
+ });
2723
+ html += esc(base.slice(cur));
2724
+ out.innerHTML = html.split(/\n{2,}/).map(function(p){
2725
+ return '<p>' + p + '</p>';
2726
+ }).join('');
2727
+ Array.prototype.forEach.call(out.querySelectorAll('mark[data-ref]'), function(m){
2728
+ m.addEventListener('click', function(){ jumpToHunk(m.getAttribute('data-ref')); });
2729
+ m.addEventListener('keydown', function(ev){
2730
+ if (ev.key === 'Enter') jumpToHunk(m.getAttribute('data-ref'));
2731
+ });
2732
+ });
2733
+ var c = $('#outCount'); if (c) c.textContent = accepted;
2734
+ var w = $('#outWords'); if (w) w.textContent = words;
2735
+ }
2736
+
2737
+ function whyText(e){
2738
+ var ev = (e.evidence && e.evidence[0]) || {};
2739
+ var r = String(e.reason || ev.message || '');
2740
+ if (!r) return et('模型未单独给出这一条的理由', 'the model gave no per-edit reason here');
2741
+ if (lang === 'zh'){
2742
+ if (r.indexOf('accepted:') === 0) return '引擎判定接受(' + r.slice(9).trim() + ')';
2743
+ if (r.indexOf('rejected:') === 0) return '引擎判定拒绝(' + r.slice(9).trim() + ')';
2744
+ if (ev.source === 'mechanical') return '拼写 / 冠词 / 空格修正';
2745
+ }
2746
+ return r;
2747
+ }
2748
+
2749
+ var ICON_OK = '<svg viewBox="0 0 24 24" fill="none"><path d="m5 12.5 4.5 4.5L19 7" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
2750
+ var ICON_NO = '<svg viewBox="0 0 24 24" fill="none"><path d="M6 6l12 12M18 6 6 18" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg>';
2751
+
2752
+ function decisionOf(id){ return (DECISIONS && DECISIONS[id] === 'no') ? 'no' : 'yes'; }
2753
+ function acceptedCount(run){
2754
+ var edits = (run && run.edits) || [], n = 0;
2755
+ edits.forEach(function(e){ if (decisionOf(e.id) !== 'no') n++; });
2756
+ return n;
2757
+ }
2758
+ function appliedText(run){
2759
+ run = run || LAST_RUN;
2760
+ if (!run) return '';
2761
+ var base = run.baseText || '';
2762
+ var text = run.finalText || '';
2763
+ var edits = (run.edits || []).slice().sort(function(a, b){ return a.base_range.start - b.base_range.start; });
2764
+ if (!base || !text || !edits.length) return text || base;
2765
+ var out = '', cur = 0;
2766
+ edits.forEach(function(e){
2767
+ var br = e.base_range || {}, ar = e.after_range || {};
2768
+ var s = br.start, en = br.end;
2769
+ if (!(s >= 0) || !(en >= s) || en > base.length || s < cur) return;
2770
+ out += base.slice(cur, s);
2771
+ out += (decisionOf(e.id) === 'no') ? base.slice(s, en) : text.slice(ar.start, ar.end);
2772
+ cur = en;
2773
+ });
2774
+ out += base.slice(cur);
2775
+ return out;
2776
+ }
2777
+ function adoptNote(){
2778
+ if (!LAST_RUN || !(LAST_RUN.edits || []).length) return '';
2779
+ var total = LAST_RUN.edits.length, acc = acceptedCount(LAST_RUN);
2780
+ return et('已采纳 ' + acc + '/' + total + ' 处 · 复制与保存按采纳结果',
2781
+ acc + '/' + total + ' accepted · copy and save follow your choices');
2782
+ }
2783
+ function refreshAdopt(){
2784
+ if (!LAST_RUN || !(LAST_RUN.edits || []).length) return;
2785
+ var el = $('#adoptCount');
2786
+ if (el) {
2787
+ el.textContent = acceptedCount(LAST_RUN);
2788
+ var holder = el.parentNode;
2789
+ if (holder) { var i = holder.querySelector('i'); if (i) i.textContent = '/' + LAST_RUN.edits.length; }
2790
+ }
2791
+ var note = root.querySelector('#diffNote');
2792
+ if (note) note.textContent = adoptNote();
2793
+ }
2794
+ function saveDecisions(){
2795
+ if (!LAST_RUN || !LAST_RUN.runId) return;
2796
+ apiFetch('/run/decisions', {
2797
+ method: 'POST', headers: { 'content-type': 'application/json' },
2798
+ body: JSON.stringify({ runId: LAST_RUN.runId, decisions: DECISIONS }),
2799
+ }).catch(function(){});
2800
+ }
2801
+ function setDecision(id, state){
2802
+ DECISIONS[id] = (state === 'no') ? 'no' : 'yes';
2803
+ var art = null;
2804
+ try { art = root.querySelector('.hunk[data-live="1"][data-hunk="' + String(id).replace(/"/g, '') + '"]'); } catch (e) {}
2805
+ if (art) {
2806
+ art.classList.toggle('ok', DECISIONS[id] !== 'no');
2807
+ art.classList.toggle('no', DECISIONS[id] === 'no');
2808
+ }
2809
+ refreshAdopt();
2810
+ try { if (LAST_RUN) renderRewrite(LAST_RUN); } catch (e) {}
2811
+ saveDecisions();
2812
+ }
2813
+
2814
+ function renderDiff(run){
2815
+ var box = $('#dtab-diff');
2816
+ if (!box) return;
2817
+ var base = run.baseText;
2818
+ if (!base) {
2819
+ var typed = (draft && draft.value) || '';
2820
+ base = (isChinese(typed) && LAST_MEASURE && LAST_MEASURE.draft)
2821
+ ? String(LAST_MEASURE.draft)
2822
+ : typed;
2823
+ }
2824
+ var text = run.finalText || '';
2825
+ var edits = run.edits || [];
2826
+ var head = '<div class="dh"><span></span><span>' + esc(t('cmp.original'))
2827
+ + '</span><span>' + esc(t('cmp.revised')) + '</span><span></span></div>';
2828
+ var dc = $('#diffCount'); if (dc) dc.textContent = edits.length;
2829
+ if (!edits.length){
2830
+ box.innerHTML = head + '<div class="note">'
2831
+ + esc(et('本次改写没有产生可应用的改动', 'No applicable edits this run')) + '</div>';
2832
+ return;
2833
+ }
2834
+ box.innerHTML = head + '<div class="dh-note" id="diffNote">' + esc(adoptNote()) + '</div>' + edits.map(function(e, idx){
2835
+ var s = e.base_range.start, en = e.base_range.end;
2836
+ var c0 = Math.max(0, s - 36), c1 = Math.min(base.length, en + 36);
2837
+ var before = base.slice(c0, s), after = base.slice(en, c1);
2838
+ var gone = base.slice(s, en);
2839
+ var add = text.slice(e.after_range.start, e.after_range.end);
2840
+ var nil = '<span class="nil">\u2205</span>';
2841
+ var original = esc(before) + (gone ? '<del>' + esc(gone) + '</del>' : nil) + esc(after);
2842
+ var revised = esc(before) + (add ? '<ins>' + esc(add) + '</ins>' : nil) + esc(after);
2843
+ var ev = (e.evidence && e.evidence[0]) || {};
2844
+ var kind = ev.source === 'model' ? et('模型改写', 'model') : et('机械修正', 'mechanical');
2845
+ return '<article class="hunk ' + (decisionOf(e.id) === 'no' ? 'no' : 'ok') + '" data-live="1" data-hunk="' + esc(e.id) + '">'
2846
+ + '<header class="hunk-head"><span class="hk-no mono">#' + (idx + 1) + '</span>'
2847
+ + '<span class="hk-id mono">' + esc(e.id) + '</span>'
2848
+ + '<span class="pl pl-polish">polish</span>'
2849
+ + '<span class="sev sev-info">' + esc(kind) + '</span>'
2850
+ + '<span class="hk-actions" style="margin-left:auto">'
2851
+ + '<button class="mini" type="button" data-dec="yes" title="' + esc(t('hn.accept')) + '" aria-label="' + esc(t('hn.accept')) + '">' + ICON_OK + '</button>'
2852
+ + '<button class="mini rej" type="button" data-dec="no" title="' + esc(t('hn.ignore')) + '" aria-label="' + esc(t('hn.ignore')) + '">' + ICON_NO + '</button>'
2853
+ + '</span></header>'
2854
+ + '<div class="hunk-body"><div class="del">…' + original + '…</div>'
2855
+ + '<div class="ins">…' + revised + '…</div></div>'
2856
+ + '<div class="hunk-why"><b>' + esc(et('改动依据', 'Why')) + '</b>'
2857
+ + esc(whyText(e)) + '</div></article>';
2858
+ }).join('');
2859
+ }
2860
+
2861
+ function renderFinalScore(run){
2862
+ var box = $('#outScore'); if (!box) return;
2863
+ var fs = run.finalScore;
2864
+ if (!fs){ box.innerHTML = ''; return; }
2865
+ var before = null;
2866
+ if (run.score && Array.isArray(run.score.rows) && run.score.rows.length) before = weightedTotal(run.score.rows);
2867
+ else if (run.score && run.score.total != null) before = run.score.total;
2868
+ else if (LAST_MEASURE && LAST_MEASURE.score) before = weightedTotal(LAST_MEASURE.score.rows || []);
2869
+ var after = (fs.rows && fs.rows.length) ? weightedTotal(fs.rows) : ((fs.total == null) ? 0 : fs.total);
2870
+ var d = (before == null) ? 0 : (after - before);
2871
+ var rows = (fs.rows || []).map(function(r){
2872
+ return '<span class="r">' + esc(r.id) + ' <b>' + normRow(r) + '</b></span>';
2873
+ }).join('');
2874
+ box.innerHTML = '<span>' + esc(et('改写后', 'After')) + '</span>'
2875
+ + '<span class="scorepair"><span class="big">' + after + '</span><span class="of">/100</span></span>'
2876
+ + (before == null ? '' : '<span class="delta' + (d < 0 ? ' down' : '') + '">' + (d >= 0 ? '+' : '') + d + '</span>')
2877
+ + rows
2878
+ + '<span class="r">' + esc(et('改写前 ', 'before ') + (before == null ? '\u2014' : before)) + '</span>';
2879
+ }
2880
+
2881
+ function fmtStamp(iso){
2882
+ if (!iso) return '';
2883
+ var d = new Date(iso);
2884
+ if (isNaN(d.getTime())) return String(iso).slice(0, 16).replace('T', ' ');
2885
+ var p2 = function(n){ return (n < 10 ? '0' : '') + n; };
2886
+ return p2(d.getMonth() + 1) + '-' + p2(d.getDate()) + ' ' + p2(d.getHours()) + ':' + p2(d.getMinutes());
2887
+ }
2888
+ function historyPush(run){
2889
+ if (!run || !run.runId || !TASKS || !TASKS.length) return;
2890
+ var t = activeTask();
2891
+ if (!t) return;
2892
+ if (!Array.isArray(t.history)) t.history = [];
2893
+ if (t.history.some(function(x){ return x.runId === run.runId; })) return;
2894
+ t.history.unshift({ runId: run.runId, createdAt: run.createdAt || '' });
2895
+ t.history = t.history.slice(0, 30);
2896
+ saveTasks();
2897
+ }
2898
+ function renderHistory(){
2899
+ var sel = $('#histSel');
2900
+ if (!sel) return;
2901
+ var t = activeTask();
2902
+ var list = (t && Array.isArray(t.history)) ? t.history : [];
2903
+ if (!list.length) { sel.hidden = true; sel.innerHTML = ''; return; }
2904
+ sel.hidden = false;
2905
+ sel.innerHTML = list.map(function(x){
2906
+ return '<option value="' + esc(x.runId) + '">#' + esc(String(x.runId).replace(/^r-/, '').slice(0, 8))
2907
+ + ' · ' + esc(fmtStamp(x.createdAt)) + '</option>';
2908
+ }).join('');
2909
+ if (LAST_RUN && LAST_RUN.runId) sel.value = LAST_RUN.runId;
2910
+ }
2911
+ function loadHistoryRun(runId){
2912
+ if (!runId) return;
2913
+ var out = $('#outText');
2914
+ if (out) out.innerHTML = '<div class="out-working"><div class="wk-head">'
2915
+ + esc(et('\u6b63\u5728\u8bfb\u53d6\u5386\u53f2\u6539\u5199\u2026', 'Loading this rewrite\u2026')) + '</div></div>';
2916
+ apiFetch('/run?id=' + encodeURIComponent(runId)).then(function(st){
2917
+ if (st.status === 'done' && st.result) {
2918
+ renderAll(st.result, 0);
2919
+ renderHistory();
2920
+ toast(et('\u5df2\u5207\u5230\u8be5\u6b21\u6539\u5199', 'Loaded that rewrite'));
2921
+ } else {
2922
+ toast(et('\u8fd9\u6b21\u6539\u5199\u5df2\u8fc7\u671f', 'That rewrite has expired'));
2923
+ }
2924
+ }).catch(function(){
2925
+ toast(et('\u8fd9\u6b21\u6539\u5199\u5df2\u8fc7\u671f', 'That rewrite has expired'));
2926
+ });
2927
+ }
2928
+ var histSel = $('#histSel');
2929
+ if (histSel) histSel.addEventListener('change', function(){ loadHistoryRun(histSel.value); });
2930
+
2931
+ function safeRender(fn, a, b){
2932
+ try { fn(a, b); }
2933
+ catch (e) { if (window.console && console.warn) console.warn('[EconTone] render step failed:', e && e.message); }
2934
+ }
2935
+ function renderAll(run, elapsedMs){
2936
+ var isMeasure = run.mode === 'measure' || (!!run.score && !run.finalText);
2937
+ if (isMeasure) {
2938
+ var cm = activeTask();
2939
+ if (cm && cm.scoreCleared) { LAST_MEASURE = null; emptyScoreCard(); return; }
2940
+ LAST_MEASURE = run;
2941
+ safeRender(renderScore, run);
2942
+ safeRender(renderIssues, run);
2943
+ safeRender(renderStatus, run, elapsedMs);
2944
+ safeRender(renderDraft, run);
2945
+ return;
2946
+ }
2947
+ LAST_RUN = run;
2948
+ if (run.runId !== DECISION_RUN) {
2949
+ DECISION_RUN = run.runId || null;
2950
+ DECISIONS = (run.decisions && typeof run.decisions === 'object') ? run.decisions : {};
2951
+ }
2952
+ paintBadge();
2953
+ // 评分已由自动评分负责:改写返回不覆盖主评分卡
2954
+ var cw = activeTask();
2955
+ if (!LAST_MEASURE && run.score && !(cw && cw.scoreCleared)) {
2956
+ LAST_MEASURE = { score: run.score, findings: run.findings, mode: 'measure' };
2957
+ renderScore(LAST_MEASURE);
2958
+ renderIssues(LAST_MEASURE);
2959
+ }
2960
+ safeRender(renderCertificate, run);
2961
+ safeRender(renderMoves, run);
2962
+ safeRender(setCertTab, !!run.certificate);
2963
+ safeRender(renderRewrite, run);
2964
+ safeRender(renderDiff, run);
2965
+ safeRender(refreshAdopt);
2966
+ safeRender(renderFinalScore, run);
2967
+ safeRender(historyPush, run);
2968
+ safeRender(renderHistory);
2969
+ var stp = $('#outStamp');
2970
+ if (stp){
2971
+ try {
2972
+ var nEdits = (run.edits || []).length;
2973
+ var rid = String(run.draftId || '').trim() || String(run.runId || '').replace(/^r-/, '');
2974
+ var curLen = (draft && draft.value) ? draft.value.length : 0;
2975
+ var baseLen = (typeof run.baseText === 'string') ? run.baseText.length : null;
2976
+ stp.hidden = false;
2977
+ stp.classList.remove('stale');
2978
+ stp.textContent = (rid ? rid + ' \u00b7 ' : '') + nEdits + ' ' + et('\u5904\u6539\u52a8', 'edits')
2979
+ + (baseLen == null ? '' : ' \u00b7 ' + baseLen + ' ' + et('\u5b57\u7b26', 'chars'));
2980
+ if (baseLen != null && baseLen !== curLen){
2981
+ stp.classList.add('stale');
2982
+ toast(et('\u672c\u6b21\u7ed3\u679c\u57fa\u4e8e ' + baseLen + ' \u5b57\u7b26\u7684\u6587\u672c\uff0c\u4e0e\u5f53\u524d\u8f93\u5165\uff08' + curLen + '\uff09\u4e0d\u4e00\u81f4\uff0c\u8bf7\u91cd\u65b0\u6da6\u8272',
2983
+ 'This result used ' + baseLen + ' characters; the editor has ' + curLen + '. Polish again.'));
2984
+ }
2985
+ } catch (e) {}
2986
+ }
2987
+ }
2988
+
2989
+ function poll(runId, onDone, onFail, onProgress){
2990
+ var tries = 0;
2991
+ var timer = setInterval(function(){
2992
+ tries++;
2993
+ if (tries > POLL_MAX){ clearInterval(timer); onFail(new Error('POLL_TIMEOUT')); return; }
2994
+ apiFetch('/run?id=' + encodeURIComponent(runId)).then(function(st){
2995
+ if (st.status === 'done' && st.result){ clearInterval(timer); onDone(st.result); }
2996
+ else if (st.status === 'error'){
2997
+ clearInterval(timer);
2998
+ onFail(new Error((st.error && st.error.message) || 'run failed'));
2999
+ } else if (onProgress) {
3000
+ onProgress(st);
3001
+ }
3002
+ }).catch(function(err){ clearInterval(timer); onFail(err); });
3003
+ }, POLL_MS);
3004
+ }
3005
+
3006
+ function startRun(mode, onDone, onFail, onProgress){
3007
+ var text = (draft && draft.value) || '';
3008
+ if (!text.trim()){ onFail(new Error(et('先粘贴一段文本', 'Paste some text first'))); return; }
3009
+ var started = Date.now();
3010
+ apiFetch('/run', {
3011
+ method: 'POST',
3012
+ headers: { 'content-type': 'application/json' },
3013
+ body: JSON.stringify({ text: text, profile: resolveSection(), mode: mode,
3014
+ taskId: (activeTask() || {}).id || '',
3015
+ draftId: (mode === 'arbitrate') ? (PENDING_DRAFT_ID || '') : '',
3016
+ order: GS.order, coalition: GS.coalition, actionMode: GS.mode,
3017
+ engine: GS.engine, model: GS.model,
3018
+ uiLang: lang, budgetSec: GS.budget, conn: GS.conn,
3019
+ baselineScore: (LAST_MEASURE && LAST_MEASURE.score) ? LAST_MEASURE.score : null,
3020
+ draftText: (LAST_MEASURE && LAST_MEASURE.draft) ? LAST_MEASURE.draft : '',
3021
+ latitude: (LAST_RUN && LAST_RUN.score && LAST_RUN.score.editing_latitude != null)
3022
+ ? LAST_RUN.score.editing_latitude : null,
3023
+ journal: ($('#mJournal') || {}).value || '',
3024
+ field: ($('#mField') || {}).value || '',
3025
+ section: ($('#mSection') || {}).value || '',
3026
+ extent: (function(){
3027
+ var el = $('#extent');
3028
+ if (!el) return 'auto';
3029
+ return String(el.value) === '0' ? 'auto' : (el.value + '%');
3030
+ })() }),
3031
+ }).then(function(res){
3032
+ if (res && res.status === 'done' && res.result){ onDone(res.result, Date.now() - started); return; }
3033
+ saveJob({ runId: res.runId, mode: mode, startedAt: started });
3034
+ poll(res.runId, function(result){
3035
+ clearJob();
3036
+ onDone(result, Date.now() - started);
3037
+ }, function(err){
3038
+ clearJob();
3039
+ onFail(err);
3040
+ }, onProgress || function(){});
3041
+ }).catch(onFail);
3042
+ }
3043
+
3044
+ var PENDING_DRAFT_ID = '';
3045
+ function newDraftId(){
3046
+ return 'd-' + Date.now().toString(36) + '-' + Math.random().toString(36).slice(2, 5);
3047
+ }
3048
+ function runArbitrate(){
3049
+ var btn = $('#btnRun'); var out = $('#outText'); var oscore = $('#outScore');
3050
+ PENDING_DRAFT_ID = newDraftId();
3051
+ var curTask = activeTask();
3052
+ if (curTask){
3053
+ curTask.lastDraftId = PENDING_DRAFT_ID;
3054
+ try { snapshotTask(); pushState(0); saveTasks(); } catch (e) {}
3055
+ }
3056
+ if (out) out.innerHTML = '<div class="out-working">' + esc(et('正在改写中…', 'Rewriting…')) + '</div>';
3057
+ if (oscore) oscore.innerHTML = '';
3058
+ if (btn) btn.disabled = true;
3059
+ startRun('arbitrate', function(run, ms){
3060
+ try { renderAll(run, ms); }
3061
+ finally {
3062
+ if (btn) btn.disabled = false;
3063
+ var ta = activeTask();
3064
+ if (ta){ ta.lastRunId = run.runId || ta.lastRunId; ta.lastRunAt = Date.now(); ta.lastDraftId = run.draftId || ta.lastDraftId || PENDING_DRAFT_ID; }
3065
+ try { pushState(0); } catch (e) {}
3066
+ saveState();
3067
+ }
3068
+ var stop = (run.certificate && run.certificate.stopped_because) || '';
3069
+ toast(et('改写完成', 'Rewrite done') + (stop ? ':' + stop : ''));
3070
+ }, function(err){
3071
+ if (btn) btn.disabled = false;
3072
+ if (out) out.innerHTML = '<div class="out-working">'
3073
+ + esc(et('改写失败:', 'Rewrite failed: ') + (err.message || err)) + '</div>';
3074
+ toast(et('改写失败:', 'Rewrite failed: ') + (err.message || err));
3075
+ }, function(st){
3076
+ paintWorking(st, out);
3077
+ });
3078
+ }
3079
+
3080
+ /* 进行中的作业:切走再回来也能接着等 */
3081
+ var JOB_KEY = 'ets.job.v1';
3082
+ function saveJob(job){
3083
+ try { localStorage.setItem(JOB_KEY, JSON.stringify(job)); } catch (e) {}
3084
+ }
3085
+ function clearJob(){
3086
+ try { localStorage.removeItem(JOB_KEY); } catch (e) {}
3087
+ }
3088
+ function loadJob(){
3089
+ var raw = null;
3090
+ try { raw = localStorage.getItem(JOB_KEY); } catch (e) {}
3091
+ if (!raw) return null;
3092
+ try { return JSON.parse(raw); } catch (e) { return null; }
3093
+ }
3094
+ function paintWorking(st, out){
3095
+ if (!out || !st) return;
3096
+ var secs = Math.round((st.elapsedMs || 0) / 1000);
3097
+ var text = st.phase === 'rewrite'
3098
+ ? et('正在改写中… 已生成 ' + (st.chars || 0) + ' 字 · ' + secs + 's',
3099
+ 'Rewriting… ' + (st.chars || 0) + ' chars · ' + secs + 's')
3100
+ : et('正在裁决…(play.py 测量候选)· ' + secs + 's',
3101
+ 'Arbitrating… · ' + secs + 's');
3102
+ var budget = Number(GS && GS.budget) || 60;
3103
+ if (secs > budget + 2){
3104
+ text += ' · ' + et('已超期望时间,继续等待…', 'past the expected time, still running…');
3105
+ }
3106
+ var pre = String(st.preview || '');
3107
+ out.innerHTML = '<div class="out-working">'
3108
+ + '<div class="wk-head">' + esc(text) + '</div>'
3109
+ + (pre ? '<div class="wk-pre">' + esc(pre) + '</div>' : '')
3110
+ + '</div>';
3111
+ }
3112
+ function resumeJob(){
3113
+ var job = loadJob();
3114
+ if (!job || !job.runId) return;
3115
+ if (Date.now() - (job.startedAt || 0) > 30 * 60 * 1000){ clearJob(); return; }
3116
+ var isMeasure = job.mode !== 'arbitrate';
3117
+ var out = $('#outText');
3118
+ var btn = isMeasure ? $('#btnScore') : $('#btnRun');
3119
+ if (isMeasure){
3120
+ setScoreBusy(true);
3121
+ if (!LAST_MEASURE) emptyScoreCard();
3122
+ var box0 = $('#scoreRow');
3123
+ if (box0 && !LAST_MEASURE){
3124
+ box0.innerHTML = '<div class="sc-eval"><span>' + esc(et('正在评估中…', 'Evaluating…')) + '</span>'
3125
+ + '<div class="eval-bar"><i></i></div></div>';
3126
+ }
3127
+ } else {
3128
+ if (btn) btn.disabled = true;
3129
+ if (out){
3130
+ out.innerHTML = '<div class="out-working"><div class="wk-head">'
3131
+ + esc(et('正在恢复上一次改写…', 'Resuming the previous rewrite…'))
3132
+ + '</div></div>';
3133
+ }
3134
+ }
3135
+ poll(job.runId, function(run, ms){
3136
+ clearJob();
3137
+ if (isMeasure){
3138
+ var t1 = activeTask();
3139
+ if (t1) t1.scoreCleared = false;
3140
+ LAST_MEASURE = run;
3141
+ safeRender(renderScore, run);
3142
+ safeRender(renderIssues, run);
3143
+ safeRender(renderStatus, run, ms);
3144
+ }
3145
+ renderAll(run, ms);
3146
+ var tr = activeTask();
3147
+ if (tr){ tr.lastRunId = run.runId || tr.lastRunId; tr.lastRunAt = Date.now(); }
3148
+ if (isMeasure){ try { snapshotTask(); pushState(0); saveTasks(); } catch (e) {} }
3149
+ saveState();
3150
+ if (isMeasure) setScoreBusy(false);
3151
+ else if (btn) btn.disabled = false;
3152
+ toast(et('恢复完成', 'Resumed and finished'));
3153
+ }, function(err){
3154
+ clearJob();
3155
+ if (isMeasure){
3156
+ setScoreBusy(false);
3157
+ var box = $('#scoreRow');
3158
+ if (box) box.innerHTML = '<div class="sc-eval">'
3159
+ + esc(et('评估失败:', 'Evaluation failed: ') + (err.message || err)) + '</div>';
3160
+ } else {
3161
+ if (btn) btn.disabled = false;
3162
+ if (out) out.innerHTML = '<div class="out-working">'
3163
+ + esc(et('改写失败:', 'Rewrite failed: ') + (err.message || err)) + '</div>';
3164
+ }
3165
+ }, function(st){
3166
+ if (!isMeasure) paintWorking(st, out);
3167
+ });
3168
+ }
3169
+
3170
+ /* 状态持久化:切到对话/别的插件再回来,内容不丢 */
3171
+ var STORE_KEY = 'ets.state.v1';
3172
+ var saveTimer = null;
3173
+ function collectState(){
3174
+ var j = $('#mJournal'), f = $('#mField'), s = $('#mSection'), n = $('#mNote');
3175
+ return {
3176
+ text: (draft && draft.value) || '',
3177
+ meta: {
3178
+ journal: j ? j.value : '',
3179
+ field: f ? f.value : '',
3180
+ section: s ? s.value : '',
3181
+ note: n ? n.value : '',
3182
+ },
3183
+ run: LAST_RUN,
3184
+ };
3185
+ }
3186
+ function saveState(){
3187
+ DIRTY = true;
3188
+ clearTimeout(dirtyTimer);
3189
+ dirtyTimer = setTimeout(function(){ DIRTY = false; }, 1600);
3190
+ clearTimeout(saveTimer);
3191
+ saveTimer = setTimeout(function(){
3192
+ try { localStorage.setItem(STORE_KEY, JSON.stringify(collectState())); } catch (e) {}
3193
+ try { snapshotTask(); saveTasks(); } catch (e) {}
3194
+ }, 400);
3195
+ }
3196
+ function restoreState(){
3197
+ var raw = null;
3198
+ try { raw = localStorage.getItem(STORE_KEY); } catch (e) {}
3199
+ if (!raw) return;
3200
+ var st = null;
3201
+ try { st = JSON.parse(raw); } catch (e) { return; }
3202
+ if (st.meta){
3203
+ var pairs = [['mJournal', 'journal'], ['mField', 'field'], ['mSection', 'section'], ['mNote', 'note']];
3204
+ pairs.forEach(function(p){
3205
+ var el = $('#' + p[0]);
3206
+ if (el) el.value = st.meta[p[1]] || '';
3207
+ });
3208
+ }
3209
+ if (typeof st.text === 'string' && draft) draft.value = st.text;
3210
+ refreshCounters(); resolveSection();
3211
+ if (st.run && st.run.score) renderAll(st.run, 0);
3212
+ }
3213
+ if (draft) draft.addEventListener('input', saveState);
3214
+ ['mJournal', 'mField', 'mSection', 'mNote'].forEach(function(id){
3215
+ var el = $('#' + id);
3216
+ if (el) el.addEventListener('input', saveState);
3217
+ });
3218
+ restoreState();
3219
+ loadTasks();
3220
+ resumeJob();
3221
+ loadBinding();
3222
+
3223
+ /* 工作对话绑定:列出现有会话 + 新建;一律显示对话标题,完整 session id 收进悬停提示 */
3224
+ function shortId(id){
3225
+ var s = String(id || '');
3226
+ return s.length > 16 ? s.slice(0, 9) + '\u2026' + s.slice(-4) : s;
3227
+ }
3228
+ /* 标题优先;没有标题才退回短 id,保证每一行仍能认出是哪个对话 */
3229
+ function convLabel(title, id){
3230
+ var t = String(title || '').trim();
3231
+ return t || shortId(id);
3232
+ }
3233
+ function idTip(id){
3234
+ var v = String(id || '');
3235
+ return v ? ' title="' + esc(v) + '"' : '';
3236
+ }
3237
+ function boundOf(b){
3238
+ var id = (b && b.bound && b.bound.sessionId) ? String(b.bound.sessionId) : '';
3239
+ if (!id) return { id: '', label: '' };
3240
+ return { id: id, label: convLabel((b && b.boundTitle) || (b.bound && b.bound.title), id) };
3241
+ }
3242
+ function renderBind(b){
3243
+ var mask = $('#bindMask');
3244
+ if (!mask) return;
3245
+ mask.hidden = false;
3246
+ var cwd = $('#bindCwd');
3247
+ if (cwd) cwd.value = (b.bound && b.bound.cwd) || b.defaultCwd || '';
3248
+ var bd = boundOf(b);
3249
+ var boundId = bd.id;
3250
+ var now = $('#bindNow');
3251
+ if (now) {
3252
+ now.innerHTML = boundId
3253
+ ? esc(t('bind.now')) + '<b' + idTip(boundId) + '>' + esc(bd.label) + '</b>'
3254
+ : esc(t('bind.none'));
3255
+ }
3256
+ var list = $('#bindList');
3257
+ if (!list) return;
3258
+ var rows = ['<label class="bind-row"><input type="radio" name="bindSel" value=""' + (boundId ? '' : ' checked') + '><span>'
3259
+ + esc(et('新建 EconTone 对话', 'New “EconTone” conversation')) + '</span></label>'];
3260
+ (b.sessions || []).forEach(function(s){
3261
+ var id = String(s.id || '');
3262
+ rows.push('<label class="bind-row"><input type="radio" name="bindSel" value="' + esc(id) + '"' + (id === boundId ? ' checked' : '') + '>'
3263
+ + '<span class="bind-name"' + idTip(id) + '>' + esc(convLabel(s.title, id)) + '</span>'
3264
+ + '<span class="bind-cwd">' + esc(s.cwd || '') + '</span>'
3265
+ + '<span class="bind-evs mono">' + esc(String(s.events == null ? 0 : s.events)) + '</span></label>');
3266
+ });
3267
+ list.innerHTML = rows.join('');
3268
+ }
3269
+
3270
+ function loadBinding(){
3271
+ apiFetch('/binding').then(function(b){
3272
+ var nm = $('#bindName');
3273
+ var bd = boundOf(b);
3274
+ if (nm) {
3275
+ nm.textContent = bd.label || et('未绑定', 'unbound');
3276
+ nm.title = bd.id;
3277
+ }
3278
+ if (b && b.bound) return;
3279
+ renderBind(b || {});
3280
+ }).catch(function(){});
3281
+ }
3282
+
3283
+ var bindOk = $('#bindOk');
3284
+ if (bindOk) bindOk.addEventListener('click', function(){
3285
+ var sel = root.querySelector('input[name="bindSel"]:checked');
3286
+ var cwdEl = $('#bindCwd');
3287
+ apiFetch('/binding', {
3288
+ method: 'POST',
3289
+ headers: { 'content-type': 'application/json' },
3290
+ body: JSON.stringify({
3291
+ cwd: cwdEl ? cwdEl.value : '',
3292
+ sessionId: sel ? sel.value : '',
3293
+ name: 'EconTone',
3294
+ }),
3295
+ }).then(function(b){
3296
+ var m = $('#bindMask'); if (m) m.hidden = true;
3297
+ var sid = String((b && b.sessionId) || '');
3298
+ var sname = convLabel(b && b.title, sid);
3299
+ var nm2 = $('#bindName');
3300
+ if (nm2) {
3301
+ nm2.textContent = sname;
3302
+ nm2.title = sid;
3303
+ }
3304
+ var label = (b && b.created) ? t('bind.created') : t('bind.switched');
3305
+ toast(label + sname);
3306
+ }).catch(function(err){
3307
+ toast(et('绑定失败:', 'Bind failed: ') + (err.message || err));
3308
+ });
3309
+ });
3310
+
3311
+ var bindProbe = $('#bindProbe');
3312
+ if (bindProbe) bindProbe.addEventListener('click', function(){
3313
+ bindProbe.disabled = true;
3314
+ apiFetch('/binding/probe', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' })
3315
+ .then(function(r){
3316
+ toast(t('bind.probeOk') + String((r && r.reply) || '').slice(0, 40));
3317
+ bindProbe.disabled = false;
3318
+ })
3319
+ .catch(function(err){
3320
+ toast(t('bind.probeFail') + ((err && err.message) || err));
3321
+ bindProbe.disabled = false;
3322
+ });
3323
+ });
3324
+
3325
+ var btnBind = $('#btnBind');
3326
+ if (btnBind) btnBind.addEventListener('click', function(){
3327
+ apiFetch('/binding').then(function(b){ renderBind(b || {}); }).catch(function(){});
3328
+ });
3329
+
3330
+ var bindCancel = $('#bindCancel');
3331
+ if (bindCancel) bindCancel.addEventListener('click', function(){
3332
+ var m = $('#bindMask'); if (m) m.hidden = true;
3333
+ });
3334
+
3335
+ // 三种关闭方式:右上角 ×、点遮罩空白、Esc
3336
+ var bindClose = $('#bindClose');
3337
+ if (bindClose) bindClose.addEventListener('click', function(){
3338
+ var m = $('#bindMask'); if (m) m.hidden = true;
3339
+ });
3340
+
3341
+ var bindMaskEl = $('#bindMask');
3342
+ if (bindMaskEl) bindMaskEl.addEventListener('click', function(e){
3343
+ if (e.target === bindMaskEl) bindMaskEl.hidden = true;
3344
+ });
3345
+
3346
+ if (!window.__etsBindWired) {
3347
+ window.__etsBindWired = true;
3348
+ document.addEventListener('keydown', function(e){
3349
+ if (e.key !== 'Escape') return;
3350
+ var m = document.getElementById('bindMask');
3351
+ if (m && !m.hasAttribute('hidden')) m.hidden = true;
3352
+ });
3353
+ }
3354
+
3355
+ /* ===== \u4efb\u52a1\u6807\u7b7e\u9875 ===== */
3356
+ var TASKS_KEY = 'ets.tasks.v1';
3357
+ var ACTIVE_KEY = 'ets.active.v1';
3358
+ var PARAMS_KEY = 'ets.params.v1';
3359
+ function collectParams(){
3360
+ return {
3361
+ model: GS.model, order: GS.order, coalition: GS.coalition, mode: GS.mode,
3362
+ budget: GS.budget, conn: GS.conn, engine: GS.engine,
3363
+ weights: GS.weights || { P1: 40, P2: 40, T1: 10, R1: 10 },
3364
+ extent: ($('#extent') || {}).value || '0',
3365
+ };
3366
+ }
3367
+ function applyParams(p){
3368
+ if (!p || typeof p !== 'object') return;
3369
+ if (p.model) GS.model = p.model;
3370
+ if (p.order) GS.order = p.order;
3371
+ if (p.coalition) GS.coalition = p.coalition;
3372
+ if (p.mode) GS.mode = p.mode;
3373
+ if (p.budget) GS.budget = p.budget;
3374
+ GS.conn = (p.conn === 'stream') ? 'stream' : 'agent';
3375
+ if (p.engine) GS.engine = p.engine;
3376
+ if (p.weights && typeof p.weights === 'object'){
3377
+ GS.weights = {
3378
+ P1: Number(p.weights.P1), P2: Number(p.weights.P2),
3379
+ T1: Number(p.weights.T1), R1: Number(p.weights.R1),
3380
+ };
3381
+ ['P1','P2','T1','R1'].forEach(function(k){ if (!isFinite(GS.weights[k])) GS.weights[k] = 0; });
3382
+ }
3383
+ var ex = $('#extent');
3384
+ if (ex && p.extent != null) ex.value = p.extent;
3385
+ try { paintGame(); paintExtent(); } catch (e) {}
3386
+ }
3387
+ var paramsSaveTimer = null;
3388
+ function scheduleSaveParams(){
3389
+ if (SYNCING) return;
3390
+ clearTimeout(paramsSaveTimer);
3391
+ paramsSaveTimer = setTimeout(function(){
3392
+ try { localStorage.setItem(PARAMS_KEY, JSON.stringify(collectParams())); } catch (e) {}
3393
+ saveTasks();
3394
+ }, 300);
3395
+ }
3396
+
3397
+ function blankTask(){
3398
+ return {
3399
+ id: 't-' + Date.now().toString(36) + '-' + Math.random().toString(36).slice(2, 5),
3400
+ name: '', text: '', meta: { journal: '', field: '', section: '', note: '' },
3401
+ extent: null, run: null,
3402
+ };
3403
+ }
3404
+ function activeTask(){
3405
+ if (!TASKS || !TASKS.length) return null;
3406
+ for (var i = 0; i < TASKS.length; i++) if (TASKS[i].id === ACTIVE) return TASKS[i];
3407
+ return null;
3408
+ }
3409
+ var taskSaveTimer = null;
3410
+ function pushState(attempt){
3411
+ attempt = attempt || 0;
3412
+ if (!TASKS || !TASKS.length) return;
3413
+ var anyContent = TASKS.some(function(t){
3414
+ return t && (((t.text || '').trim().length > 0) || t.measured || (t.run && t.run.finalText));
3415
+ });
3416
+ if (!anyContent) return;
3417
+ if (SYNCING && attempt < 6){
3418
+ setTimeout(function(){ pushState(attempt + 1); }, 500);
3419
+ return;
3420
+ }
3421
+ try {
3422
+ var stamp = Date.now();
3423
+ apiFetch('/state', {
3424
+ method: 'POST',
3425
+ headers: { 'content-type': 'application/json' },
3426
+ body: JSON.stringify({ state: {
3427
+ tasks: TASKS, active: ACTIVE, params: collectParams(),
3428
+ theme: theme, lang: lang, savedAt: stamp,
3429
+ } }),
3430
+ }).then(function(){ LAST_SEEN = stamp; }).catch(function(){
3431
+ if (attempt < 6) setTimeout(function(){ pushState(attempt + 1); }, 800);
3432
+ });
3433
+ } catch (e) {}
3434
+ }
3435
+ function saveTasks(){
3436
+ if (!TASKS || !TASKS.length) return;
3437
+ try {
3438
+ localStorage.setItem(TASKS_KEY, JSON.stringify(TASKS));
3439
+ localStorage.setItem(ACTIVE_KEY, ACTIVE || '');
3440
+ } catch (e) {}
3441
+ clearTimeout(taskSaveTimer);
3442
+ taskSaveTimer = setTimeout(function(){ pushState(0); }, 400);
3443
+ }
3444
+ function snapshotTask(){
3445
+ var t = activeTask(); if (!t) return;
3446
+ if (draft) t.text = draft.value;
3447
+ var j = $('#mJournal'), f = $('#mField'), sec = $('#mSection'), n = $('#mNote');
3448
+ t.meta = {
3449
+ journal: j ? j.value : '', field: f ? f.value : '',
3450
+ section: sec ? sec.value : '', note: n ? n.value : '',
3451
+ };
3452
+ var ex = $('#extent'); if (ex) t.extent = String(ex.value);
3453
+ t.run = LAST_RUN || t.run || null;
3454
+ t.measured = LAST_MEASURE || null;
3455
+ if (!t.renamed) t.name = (t.text || '').trim().slice(0, 24);
3456
+ }
3457
+ function clearRunUI(){
3458
+ LAST_RUN = null;
3459
+ LAST_MEASURE = null;
3460
+ var a = $('#scoreRow'); if (a) a.innerHTML = '';
3461
+ var stamp = $('#outStamp'); if (stamp){ stamp.hidden = true; stamp.textContent = ''; stamp.classList.remove('stale'); }
3462
+ var b = $('#issuesGrid'); if (b) b.innerHTML = '';
3463
+ var c = $('#outText'); if (c) c.innerHTML = '';
3464
+ var d = $('#outScore'); if (d) d.innerHTML = '';
3465
+ renderDraft(null);
3466
+ paintBadge();
3467
+ }
3468
+ function applyTask(t){
3469
+ if (!t) return;
3470
+ if (draft) draft.value = t.text || '';
3471
+ var j = $('#mJournal'), f = $('#mField'), sec = $('#mSection'), n = $('#mNote');
3472
+ if (j) j.value = (t.meta && t.meta.journal) || '';
3473
+ if (f) f.value = (t.meta && t.meta.field) || '';
3474
+ if (sec) sec.value = (t.meta && t.meta.section) || '';
3475
+ if (n) n.value = (t.meta && t.meta.note) || '';
3476
+ var ex = $('#extent');
3477
+ if (ex) {
3478
+ ex.value = t.extent || '0';
3479
+ try { ex.dispatchEvent(new Event('input')); } catch (e) {}
3480
+ }
3481
+ refreshCounters(); resolveSection();
3482
+ clearRunUI();
3483
+ LAST_MEASURE = t.scoreCleared ? null : (t.measured || null);
3484
+ if (LAST_MEASURE) { renderScore(LAST_MEASURE); renderIssues(LAST_MEASURE); }
3485
+ else {
3486
+ var bs = $('#btnScore');
3487
+ if (bs && bs.dataset.busy === '1'){
3488
+ var bx = $('#scoreRow');
3489
+ if (bx) bx.innerHTML = '<div class="sc-eval"><span>' + esc(et('正在评估中…', 'Evaluating…')) + '</span>'
3490
+ + '<div class="eval-bar"><i></i></div></div>';
3491
+ } else {
3492
+ emptyScoreCard();
3493
+ }
3494
+ }
3495
+ if (t.run) renderAll(t.run, 0);
3496
+ else {
3497
+ var outEmpty = $('#outText');
3498
+ if (outEmpty) outEmpty.innerHTML = '<div class="out-empty">'
3499
+ + esc(et('还没有改写稿,点「润色」开始', 'No rewrite yet \u2014 press Rewrite')) + '</div>';
3500
+ var outSc = $('#outScore'); if (outSc) outSc.innerHTML = '';
3501
+ }
3502
+ syncDraftVisibility();
3503
+ renderHistory();
3504
+ paintBadge();
3505
+ }
3506
+ function renderTabs(){
3507
+ var box = $('#taskTabs'); if (!box) return;
3508
+ var html = TASKS.map(function(t, i){
3509
+ var label = (t.name || t.text || '').trim().slice(0, 18) || et('\u65b0\u4efb\u52a1', 'New task');
3510
+ return '<button class="task-tab' + (t.id === ACTIVE ? ' on' : '') + '" data-t="' + t.id + '">'
3511
+ + '<span class="ord">#' + (i + 1) + '</span>'
3512
+ + '<span class="nm">' + esc(label) + '</span>'
3513
+ + (TASKS.length > 1 ? '<span class="x" data-x="' + t.id + '">\u00d7</span>' : '')
3514
+ + '</button>';
3515
+ }).join('');
3516
+ html += '<button class="task-add" id="taskAdd">+ ' + esc(et('\u65b0\u4efb\u52a1', 'New task')) + '</button>';
3517
+ box.innerHTML = html;
3518
+ $$('#taskTabs .task-tab').forEach(function(b){
3519
+ b.addEventListener('click', function(ev){
3520
+ if (ev.target && ev.target.getAttribute && ev.target.getAttribute('data-x')) return;
3521
+ switchTask(b.getAttribute('data-t'));
3522
+ });
3523
+ });
3524
+ $$('#taskTabs .x').forEach(function(x){
3525
+ x.addEventListener('click', function(ev){
3526
+ ev.stopPropagation();
3527
+ closeTask(x.getAttribute('data-x'));
3528
+ });
3529
+ });
3530
+ $$('#taskTabs .task-tab').forEach(function(b){
3531
+ b.addEventListener('dblclick', function(ev){
3532
+ ev.stopPropagation();
3533
+ var id = b.getAttribute('data-t');
3534
+ var t = null;
3535
+ for (var i = 0; i < TASKS.length; i++) if (TASKS[i].id === id) t = TASKS[i];
3536
+ if (!t) return;
3537
+ var nm = b.querySelector('.nm');
3538
+ if (!nm) return;
3539
+ var inp = document.createElement('input');
3540
+ inp.className = 'task-rename';
3541
+ inp.value = t.name || '';
3542
+ nm.replaceWith(inp);
3543
+ inp.focus(); inp.select();
3544
+ var done = false;
3545
+ var commit = function(ok){
3546
+ if (done) return;
3547
+ done = true;
3548
+ if (ok) { t.name = inp.value.trim().slice(0, 40); t.renamed = true; }
3549
+ saveTasks(); renderTabs();
3550
+ };
3551
+ inp.addEventListener('keydown', function(e){
3552
+ if (e.key === 'Enter') commit(true);
3553
+ if (e.key === 'Escape') commit(false);
3554
+ });
3555
+ inp.addEventListener('blur', function(){ commit(true); });
3556
+ });
3557
+ });
3558
+ var add = box.querySelector('.task-add');
3559
+ if (add) add.addEventListener('click', function(){ newTask(false); });
3560
+ }
3561
+ function switchTask(id){
3562
+ if (!id || id === ACTIVE) return;
3563
+ snapshotTask(); saveTasks();
3564
+ ACTIVE = id; saveTasks();
3565
+ applyTask(activeTask()); renderTabs(); saveState();
3566
+ }
3567
+ function newTask(silent){
3568
+ if (ACTIVE) { snapshotTask(); saveTasks(); }
3569
+ var t = blankTask();
3570
+ TASKS.push(t); ACTIVE = t.id;
3571
+ saveTasks(); applyTask(t); renderTabs();
3572
+ if (!silent) toast(et('\u5df2\u65b0\u5efa\u4efb\u52a1', 'New task created'));
3573
+ }
3574
+ function closeTask(id){
3575
+ if (TASKS.length <= 1) return;
3576
+ TASKS = TASKS.filter(function(t){ return t.id !== id; });
3577
+ if (ACTIVE === id) { ACTIVE = TASKS[0].id; applyTask(activeTask()); }
3578
+ saveTasks(); renderTabs();
3579
+ }
3580
+ function adoptTasks(list, active){
3581
+ if (Array.isArray(list) && list.length){
3582
+ TASKS = list;
3583
+ ACTIVE = (active && TASKS.some(function(t){ return t.id === active; })) ? active : TASKS[0].id;
3584
+ } else {
3585
+ try { TASKS = JSON.parse(localStorage.getItem(TASKS_KEY) || '[]') || []; } catch (e) { TASKS = []; }
3586
+ try { ACTIVE = localStorage.getItem(ACTIVE_KEY) || null; } catch (e) { ACTIVE = null; }
3587
+ if (!Array.isArray(TASKS) || !TASKS.length) { newTask(true); return; }
3588
+ if (!TASKS.some(function(t){ return t.id === ACTIVE; })) ACTIVE = TASKS[0].id;
3589
+ }
3590
+ applyTask(activeTask()); renderTabs();
3591
+ }
3592
+ function loadTasks(){
3593
+ var localParams = null;
3594
+ try { localParams = JSON.parse(localStorage.getItem(PARAMS_KEY) || 'null'); } catch (e) {}
3595
+ apiFetch('/state').then(function(r){
3596
+ var st = r && r.state;
3597
+ if (st && st.theme) { try { applyTheme(st.theme); } catch (e) {} }
3598
+ if (st && st.lang) { try { applyLang(st.lang); } catch (e) {} }
3599
+ adoptTasks(st && st.tasks, st && st.active);
3600
+ applyParams((st && st.params) || localParams);
3601
+ applyConnDefault();
3602
+ if (st && st.savedAt) LAST_SEEN = st.savedAt;
3603
+ }).catch(function(){
3604
+ adoptTasks(null, null);
3605
+ applyParams(localParams);
3606
+ applyConnDefault();
3607
+ });
3608
+ }
3609
+
3610
+ /* ===== \u4efb\u52a1\u7f16\u53f7 + \u91cd\u65b0\u8fde\u63a5 ===== */
3611
+ function paintBadge(){
3612
+ var b = $('#runBadge'); if (!b) return;
3613
+ var r = LAST_RUN;
3614
+ if (r && r.runId && r.finalText) {
3615
+ b.hidden = false;
3616
+ b.textContent = '#' + String(r.runId).replace(/^r-/, '').slice(0, 8);
3617
+ } else {
3618
+ b.hidden = true;
3619
+ b.textContent = '';
3620
+ }
3621
+ }
3622
+ function refreshRun(){
3623
+ var job = loadJob();
3624
+ var rid = (job && job.runId) || (LAST_RUN && LAST_RUN.runId);
3625
+ if (!rid) { toast(et('\u8fd8\u6ca1\u6709\u53ef\u5237\u65b0\u7684\u6539\u5199', 'Nothing to refresh yet')); return; }
3626
+ var out = $('#outText');
3627
+ if (out) out.innerHTML = '<div class="out-working"><div class="wk-head">'
3628
+ + esc(et('\u6b63\u5728\u91cd\u65b0\u8fde\u63a5\u2026', 'Reconnecting\u2026')) + '</div></div>';
3629
+ var wasMeasure = !!(LAST_RUN && LAST_RUN.runId === rid && !LAST_RUN.finalText);
3630
+ apiFetch('/run?id=' + encodeURIComponent(rid)).then(function(st){
3631
+ if (st.status === 'done' && st.result) {
3632
+ clearJob(); renderAll(st.result, 0); paintBadge(); saveState();
3633
+ if (wasMeasure && !st.result.finalText) {
3634
+ toast(et('\u8fd9\u4e00\u6b21\u53ea\u6709\u8bc4\u5206\uff0c\u6ca1\u6709\u6539\u5199\u7a3f', 'This run only has a score, no rewrite'));
3635
+ }
3636
+ snapshotTask(); saveTasks();
3637
+ toast(et('\u5df2\u91cd\u65b0\u8fde\u63a5', 'Reconnected'));
3638
+ } else if (st.status === 'running') {
3639
+ resumeJob();
3640
+ } else if (st.status === 'error') {
3641
+ toast(et('\u6539\u5199\u5931\u8d25\uff1a', 'Rewrite failed: ')
3642
+ + ((st.error && st.error.message) || ''));
3643
+ }
3644
+ }).catch(function(){
3645
+ if (out) out.innerHTML = '<div class="out-working">'
3646
+ + esc(et('\u4efb\u52a1\u5df2\u8fc7\u671f\uff0c\u8bf7\u91cd\u65b0\u53d1\u8d77\u6539\u5199', 'This run has expired; start a new rewrite'))
3647
+ + '</div>';
3648
+ toast(et('\u4efb\u52a1\u5df2\u8fc7\u671f', 'Run expired'));
3649
+ });
3650
+ }
3651
+ /* ===== 评分(右上角按钮触发,不再输入即评) ===== */
3652
+ var scoreDoneTimer = null;
3653
+ function emptyScoreCard(){
3654
+ var box = $('#scoreRow');
3655
+ if (!box) return;
3656
+ box.innerHTML = '<div class="sc-eval">'
3657
+ + esc(et('\u70b9\u51fb\u53f3\u4e0a\u89d2\u300c\u8bc4\u5206\u300d\u5f00\u59cb\u8bc4\u4f30', 'Click Score to evaluate')) + '</div>';
3658
+ }
3659
+ function scoreBars(on){
3660
+ var bars = document.querySelectorAll('#scoreRow .sc .bar i, #scoreRow .sc-eval .eval-bar i');
3661
+ Array.prototype.forEach.call(bars, function(b){
3662
+ if (on){
3663
+ var parent = b.parentNode;
3664
+ var pw = parent ? parent.getBoundingClientRect().width : 0;
3665
+ var bw = b.getBoundingClientRect().width;
3666
+ var pct = pw > 0 ? Math.round(bw / pw * 100) : 0;
3667
+ if (pct > 100) pct = 100;
3668
+ b.dataset.prevW = b.style.width || '';
3669
+ b.dataset.prevT = b.style.transition || '';
3670
+ b.style.transition = 'none';
3671
+ b.style.width = pct + '%';
3672
+ void b.offsetWidth;
3673
+ var dur = 14 + Math.min(8, Math.round(pct / 15));
3674
+ b.style.transition = 'width ' + dur + 's cubic-bezier(.15,.75,.3,1) ' + (pct >= 94 ? 0 : 0.2) + 's';
3675
+ b.style.width = (pct >= 94 ? pct : Math.max(pct + 3, 94)) + '%';
3676
+ } else {
3677
+ b.style.transition = b.dataset.prevT || '';
3678
+ b.style.width = b.dataset.prevW || '';
3679
+ }
3680
+ });
3681
+ }
3682
+ function setScoreBusy(on){
3683
+ var b = $('#btnScore');
3684
+ var row = $('#scoreRow');
3685
+ if (row) row.classList[on ? 'add' : 'remove']('is-measuring');
3686
+ try { scoreBars(on); } catch (e) {}
3687
+ var c = $('#btnScoreClear');
3688
+ if (c) c.disabled = !!on;
3689
+ if (!b) return;
3690
+ if (on) { clearTimeout(scoreDoneTimer); b.classList.remove('is-done'); }
3691
+ b.dataset.busy = on ? '1' : '0';
3692
+ b.disabled = !!on;
3693
+ b.textContent = on ? et('\u8bc4\u5206\u4e2d\u2026', 'Scoring\u2026') : t('sc.run');
3694
+ }
3695
+ function flashScoreDone(){
3696
+ var b = $('#btnScore');
3697
+ if (!b) return;
3698
+ clearTimeout(scoreDoneTimer);
3699
+ b.textContent = et('\u2713 \u5df2\u8bc4\u5206', '\u2713 Scored');
3700
+ b.classList.add('is-done');
3701
+ scoreDoneTimer = setTimeout(function(){
3702
+ b.classList.remove('is-done');
3703
+ b.textContent = t('sc.run');
3704
+ }, 1000);
3705
+ }
3706
+ function runScore(){
3707
+ var text = (draft && draft.value) || '';
3708
+ if (text.trim().length < 20){
3709
+ toast(et('\u8bf7\u5148\u8f93\u5165\u6b63\u6587', 'Add the text first'));
3710
+ return;
3711
+ }
3712
+ var b = $('#btnScore');
3713
+ if (b && b.dataset.busy === '1') return;
3714
+ var zh = isChinese(text);
3715
+ var sec = $('#sec-draft');
3716
+ if (zh && sec && !(LAST_MEASURE && LAST_MEASURE.draft)) {
3717
+ sec.hidden = false;
3718
+ sec.dataset.busy = '1';
3719
+ $('#draftText').innerHTML = '<p class="draft-pending">' + esc(et('\u6b63\u5728\u7ffb\u8bd1\u4e2d\u2026', 'Translating\u2026')) + '</p>';
3720
+ }
3721
+ var box = $('#scoreRow');
3722
+ if (box && !LAST_MEASURE) {
3723
+ box.innerHTML = '<div class="sc-eval"><span>' + esc(et('\u6b63\u5728\u8bc4\u4f30\u4e2d\u2026', 'Evaluating\u2026')) + '</span>'
3724
+ + '<div class="eval-bar"><i></i></div></div>';
3725
+ }
3726
+ setScoreBusy(true);
3727
+ startRun('measure', function(run){
3728
+ var t0 = activeTask();
3729
+ if (t0){ t0.scoreCleared = false; t0.lastRunId = run.runId || t0.lastRunId; t0.lastRunAt = Date.now(); }
3730
+ renderAll(run, 0);
3731
+ if (sec) sec.dataset.busy = '0';
3732
+ setScoreBusy(false);
3733
+ flashScoreDone();
3734
+ syncDraftVisibility();
3735
+ snapshotTask();
3736
+ try { pushState(0); } catch (e) {}
3737
+ saveTasks();
3738
+ }, function(err){
3739
+ if (sec) sec.dataset.busy = '0';
3740
+ setScoreBusy(false);
3741
+ if (zh) syncDraftVisibility();
3742
+ if (box) box.innerHTML = '<div class="sc-eval">'
3743
+ + esc(et('\u8bc4\u4f30\u5931\u8d25\uff1a', 'Evaluation failed: ') + (err.message || err)) + '</div>';
3744
+ }, null);
3745
+ }
3746
+ var btnScore = $('#btnScore');
3747
+ if (btnScore) btnScore.addEventListener('click', function(){ runScore(); });
3748
+ var btnScoreClear = $('#btnScoreClear');
3749
+ if (btnScoreClear) btnScoreClear.addEventListener('click', function(){
3750
+ LAST_MEASURE = null;
3751
+ var t = activeTask();
3752
+ if (t) { t.measured = null; t.scoreCleared = true; }
3753
+ emptyScoreCard();
3754
+ var grid = $('#issuesGrid'); if (grid) grid.innerHTML = '';
3755
+ snapshotTask(); saveTasks();
3756
+ toast(et('\u5df2\u6e05\u7a7a\u8bc4\u5206', 'Score cleared'));
3757
+ });
3758
+ if (draft) draft.addEventListener('input', function(){ syncDraftVisibility(); });
3759
+
3760
+ /* ===== 评分卡:磁吸 + 详情浮窗 ===== */
3761
+ var scMask = $('#scMask'), scTitle = $('#scModalTitle'), scScore = $('#scModalScore');
3762
+ var scEv = $('#scModalEv'), scList = $('#scModalList');
3763
+ function closeScoreModal(){ if (scMask) scMask.hidden = true; }
3764
+ function openScoreModal(dim){
3765
+ if (!LAST_MEASURE){ toast(et('\u5148\u70b9\u8bc4\u5206\uff0c\u518d\u770b\u8be6\u60c5', 'Score first, then open the detail')); return; }
3766
+ var s = LAST_MEASURE.score || {}, rows = s.rows || [];
3767
+ var items = [], meta = [];
3768
+ if (dim === 'TOTAL'){
3769
+ scTitle.textContent = t('sc.total');
3770
+ scScore.textContent = (s.total == null ? '\u2014' : s.total) + ' / 100';
3771
+ scEv.textContent = s.advice || '';
3772
+ if (s.band) meta.push(et('\u6863\u4f4d', 'Band') + ' \u00b7 ' + s.band);
3773
+ if (s.editing_latitude != null) meta.push(et('\u7f16\u8f91\u5e45\u5ea6', 'Latitude') + ' \u00b7 ' + s.editing_latitude + '%');
3774
+ } else {
3775
+ var row = rows.filter(function(r){ return r.id === dim; })[0] || {};
3776
+ scTitle.textContent = dim + ' \u00b7 ' + t('sc.' + String(dim).toLowerCase());
3777
+ scScore.textContent = (row.score == null ? '\u2014' : row.score) + ' / ' + (row.max == null ? '\u2014' : row.max);
3778
+ scEv.textContent = row.evidence || '';
3779
+ var want = dim === 'P1' ? 'polish' : (dim === 'T1' ? 'trace' : 'prosody');
3780
+ if (dim !== 'P2'){
3781
+ ((LAST_MEASURE.findings) || []).forEach(function(f){
3782
+ if (f.player !== want) return;
3783
+ var ev = evidenceOf(f);
3784
+ var cl = codeLabel(ev.code);
3785
+ items.push({
3786
+ code: (cl && cl !== 'MODEL') ? cl : '',
3787
+ text: f.original || ev.message || '',
3788
+ note: f.paragraph ? et('\u7b2c ' + f.paragraph + ' \u6bb5', 'paragraph ' + f.paragraph) : et('\u5168\u6587', 'whole text')
3789
+ });
3790
+ });
3791
+ } else {
3792
+ var p2 = p2Label(row.evidence || '');
3793
+ if (p2) items.push({ code: 'P2', text: p2, note: '' });
3794
+ }
3795
+ }
3796
+ var out = '';
3797
+ if (meta.length) out += '<div class="sc-meta">' + meta.map(function(m){ return '<span>' + esc(m) + '</span>'; }).join('') + '</div>';
3798
+ if (items.length){
3799
+ out += items.map(function(it){
3800
+ return '<div class="sc-m-item">' + (it.code ? '<span class="code">' + esc(it.code) + '</span>' : '')
3801
+ + '<p>' + esc(it.text) + '</p>' + (it.note ? '<small>' + esc(it.note) + '</small>' : '') + '</div>';
3802
+ }).join('');
3803
+ }
3804
+ if (!out) out = '<div class="sc-m-item"><p>' + esc(et('\u6ca1\u6709\u66f4\u591a\u7ec6\u8282', 'No further detail')) + '</p></div>';
3805
+ scList.innerHTML = out;
3806
+ if (scMask) scMask.hidden = false;
3807
+ }
3808
+ if (scMask){
3809
+ var scCloseBtn = $('#scClose'), scOkBtn = $('#scOk');
3810
+ if (scCloseBtn) scCloseBtn.addEventListener('click', closeScoreModal);
3811
+ if (scOkBtn) scOkBtn.addEventListener('click', closeScoreModal);
3812
+ scMask.addEventListener('click', function(e){ if (e.target === scMask) closeScoreModal(); });
3813
+ document.addEventListener('keydown', function(e){ if (e.key === 'Escape' && !scMask.hidden) closeScoreModal(); });
3814
+ }
3815
+ /* ===== 本地 skill 选择 ===== */
3816
+ var skillMask = $('#skillMask'), skillList = $('#skillList');
3817
+ var skillSearch = $('#skillSearch'), skillAll = $('#skillAll');
3818
+ var SKILLS = [], skillQuery = '';
3819
+ function closeSkillPicker(){ if (skillMask) skillMask.hidden = true; }
3820
+ function skillVisible(){
3821
+ return SKILLS.filter(function(s){
3822
+ if (!(skillAll && skillAll.checked) && s.kind !== 'writing') return false;
3823
+ if (!skillQuery) return true;
3824
+ var hay = (String(s.name || s.id) + ' ' + String(s.description || '')).toLowerCase();
3825
+ return hay.indexOf(skillQuery) >= 0;
3826
+ });
3827
+ }
3828
+ function renderSkillList(){
3829
+ if (!skillList) return;
3830
+ if (!SKILLS.length){
3831
+ skillList.innerHTML = '<div class="skill-empty">' + esc(et('\u6ca1\u6709\u627e\u5230\u672c\u5730 skill', 'No local skills found')) + '</div>';
3832
+ return;
3833
+ }
3834
+ var list = skillVisible();
3835
+ if (!list.length){
3836
+ skillList.innerHTML = '<div class="skill-empty">' + esc(et('\u6ca1\u6709\u5339\u914d\u7684 skill\uff1b\u53ef\u52fe\u9009\u300c\u663e\u793a\u5168\u90e8\u300d', 'No match; tick "Show all skills"')) + '</div>';
3837
+ return;
3838
+ }
3839
+ skillList.innerHTML = list.map(function(s){
3840
+ var desc = String(s.description || '').slice(0, 120);
3841
+ return '<button class="skill-item" type="button" data-skill="' + esc(s.id) + '">'
3842
+ + '<b>' + esc(s.name || s.id) + '</b>'
3843
+ + (desc ? '<i>' + esc(desc) + '</i>' : '')
3844
+ + '</button>';
3845
+ }).join('');
3846
+ }
3847
+ function openSkillPicker(){
3848
+ if (!skillMask) return;
3849
+ skillMask.hidden = false;
3850
+ skillQuery = '';
3851
+ if (skillSearch) skillSearch.value = '';
3852
+ if (skillList) skillList.innerHTML = '<div class="skill-empty">' + esc(et('\u6b63\u5728\u8bfb\u53d6\u672c\u5730 skill\u2026', 'Reading local skills\u2026')) + '</div>';
3853
+ apiFetch('/skills').then(function(r){
3854
+ SKILLS = (r && r.skills) || [];
3855
+ renderSkillList();
3856
+ }).catch(function(){ SKILLS = []; renderSkillList(); });
3857
+ }
3858
+ if (skillSearch) skillSearch.addEventListener('input', function(){
3859
+ skillQuery = String(skillSearch.value || '').trim().toLowerCase();
3860
+ renderSkillList();
3861
+ });
3862
+ if (skillAll) skillAll.addEventListener('change', function(){ renderSkillList(); });
3863
+ if (skillMask){
3864
+ var skillCloseBtn = $('#skillClose'), skillOkBtn = $('#skillOk');
3865
+ if (skillCloseBtn) skillCloseBtn.addEventListener('click', closeSkillPicker);
3866
+ if (skillOkBtn) skillOkBtn.addEventListener('click', closeSkillPicker);
3867
+ skillMask.addEventListener('click', function(e){ if (e.target === skillMask) closeSkillPicker(); });
3868
+ document.addEventListener('keydown', function(e){ if (e.key === 'Escape' && !skillMask.hidden) closeSkillPicker(); });
3869
+ if (skillList) skillList.addEventListener('click', function(e){
3870
+ var btn = e.target && e.target.closest ? e.target.closest('.skill-item') : null;
3871
+ if (!btn) return;
3872
+ GS.engine = 'skill:' + btn.getAttribute('data-skill');
3873
+ closeSkillPicker();
3874
+ paintGame();
3875
+ toast(et('\u5f15\u64ce\u5df2\u5207\u6362\u4e3a ', 'Engine set to ') + btn.getAttribute('data-skill'));
3876
+ });
3877
+ }
3878
+
3879
+ /* ===== 历史记录页 ===== */
3880
+ var histPage = $('#histPage'), histList = $('#histList'), histPager = $('#histPager');
3881
+ var histSearch = $('#histSearch'), histModeSel = $('#histModeSel');
3882
+ var HIST_RUNS = [], histQuery = '', histMode = 'all', histPage_ = 1;
3883
+ var HIST_PAGE_SIZE = 5;
3884
+ function histWhen(ts){
3885
+ if (!ts) return '';
3886
+ var d = new Date(ts);
3887
+ var p2 = function(n){ return (n < 10 ? '0' : '') + n; };
3888
+ return (d.getMonth() + 1) + '-' + p2(d.getDate()) + ' ' + p2(d.getHours()) + ':' + p2(d.getMinutes());
3889
+ }
3890
+ function histScore(sc){
3891
+ if (!sc) return null;
3892
+ if (Array.isArray(sc.rows) && sc.rows.length) return weightedTotal(sc.rows);
3893
+ return (sc.total == null) ? null : sc.total;
3894
+ }
3895
+ function histDiffHtml(r){
3896
+ var base = String(r.baseText || '');
3897
+ var text = String(r.finalText || '');
3898
+ var edits = (r.edits || []).slice().sort(function(a, b){
3899
+ return ((a.base_range || {}).start || 0) - ((b.base_range || {}).start || 0);
3900
+ });
3901
+ if (!base || !edits.length) return esc(text || base);
3902
+ var html = '', cur = 0;
3903
+ edits.forEach(function(e, idx){
3904
+ var br = e.base_range || {}, ar = e.after_range || {};
3905
+ var s = br.start, en = br.end;
3906
+ if (!(s >= 0) || !(en >= s) || en > base.length || s < cur) return;
3907
+ html += esc(base.slice(cur, s));
3908
+ var del = String(e.original || base.slice(s, en) || '');
3909
+ var add = (e.op === 'delete') ? '' : String(text.slice(ar.start, ar.end) || '');
3910
+ var n = idx + 1;
3911
+ if (del) html += '<span class="dele"><s>' + esc(del) + '</s><sup>' + n + '</sup></span>';
3912
+ if (add) html += '<mark>' + esc(add) + '<sup>' + n + '</sup></mark>';
3913
+ cur = en;
3914
+ });
3915
+ html += esc(base.slice(cur));
3916
+ return html;
3917
+ }
3918
+ function histDetailHtml(r){
3919
+ var base = String(r.baseText || '');
3920
+ var fin = String(r.finalText || '');
3921
+ var s1 = histScore(r.score), s2 = histScore(r.finalScore);
3922
+ var head = function(label, sc){
3923
+ return '<h5>' + esc(label)
3924
+ + (sc == null ? '' : ' <b>' + esc(String(sc)) + '</b><span>/ 100</span>')
3925
+ + '</h5>';
3926
+ };
3927
+ if (!base && !fin) return '<div class="skill-empty">' + esc(et('\u8fd9\u6b21\u8fd0\u884c\u6ca1\u6709\u4fdd\u5b58\u6587\u672c', 'No text stored for this run')) + '</div>';
3928
+ var cols = '<div class="hist-cols">'
3929
+ + '<div class="hist-col">' + head(et('\u539f\u6587', 'Original'), s1)
3930
+ + '<pre class="hist-text">' + esc(base || et('\uff08\u65e0\uff09', '(none)')) + '</pre></div>';
3931
+ if (fin){
3932
+ cols += '<div class="hist-col">' + head(et('\u6da6\u8272\u540e', 'Polished'), s2)
3933
+ + '<pre class="hist-text">' + histDiffHtml(r) + '</pre>'
3934
+ + '<div class="hist-legend">'
3935
+ + '<label><input type="checkbox" class="hist-showdel" /> ' + esc(et('\u663e\u793a\u5220\u9664', 'Show deletions')) + '</label>'
3936
+ + '<span>' + esc(et('\u7eff\u5e95 = \u65b0\u589e\u6216\u66ff\u6362', 'green = added/replaced')) + '</span>'
3937
+ + '</div></div>';
3938
+ }
3939
+ cols += '</div>';
3940
+ return cols;
3941
+ }
3942
+ function toggleHistDetail(item){
3943
+ var detail = item.querySelector('.hist-detail');
3944
+ if (!detail) return;
3945
+ var row = item.querySelector('.hist-row');
3946
+ var chev = item.querySelector('.hist-chev');
3947
+ if (!detail.hidden){
3948
+ detail.hidden = true;
3949
+ if (row) row.classList.remove('open');
3950
+ if (chev) chev.textContent = '\u25b8';
3951
+ return;
3952
+ }
3953
+ Array.prototype.forEach.call(document.querySelectorAll('#histList .hist-item'), function(other){
3954
+ if (other === item) return;
3955
+ var od = other.querySelector('.hist-detail');
3956
+ if (!od || od.hidden) return;
3957
+ od.hidden = true;
3958
+ var orow = other.querySelector('.hist-row'); if (orow) orow.classList.remove('open');
3959
+ var ochev = other.querySelector('.hist-chev'); if (ochev) ochev.textContent = '\u25b8';
3960
+ });
3961
+ if (row) row.classList.add('open');
3962
+ if (chev) chev.textContent = '\u25be';
3963
+ try {
3964
+ item.scrollIntoView({ block: 'start', behavior: 'smooth' });
3965
+ setTimeout(function(){
3966
+ var se = document.scrollingElement || document.documentElement;
3967
+ if (se && se.scrollTop > 64) se.scrollTop = se.scrollTop - 64;
3968
+ var sc = null;
3969
+ for (var el = item.parentElement; el && el !== document.body; el = el.parentElement){
3970
+ var st2 = window.getComputedStyle(el);
3971
+ if ((st2.overflowY === 'auto' || st2.overflowY === 'scroll') && el.scrollHeight > el.clientHeight + 4){ sc = el; break; }
3972
+ }
3973
+ if (sc && sc.scrollTop > 64) sc.scrollTop = sc.scrollTop - 64;
3974
+ }, 320);
3975
+ } catch (e) {}
3976
+ if (detail.dataset.loaded === '1'){ detail.hidden = false; return; }
3977
+ var runId = item.getAttribute('data-run');
3978
+ detail.hidden = false;
3979
+ detail.innerHTML = '<div class="skill-empty">' + esc(et('\u6b63\u5728\u8bfb\u53d6\u2026', 'Loading\u2026')) + '</div>';
3980
+ apiFetch('/run?id=' + encodeURIComponent(runId)).then(function(st){
3981
+ if (!st || !st.result){ detail.innerHTML = '<div class="skill-empty">' + esc(et('\u7ed3\u679c\u5df2\u4e22\u5931', 'Result missing')) + '</div>'; return; }
3982
+ detail.innerHTML = histDetailHtml(st.result);
3983
+ detail.dataset.loaded = '1';
3984
+ var delBox = detail.querySelector('.hist-showdel');
3985
+ var pre = detail.querySelector('.hist-text');
3986
+ if (delBox && pre) delBox.addEventListener('change', function(){ pre.classList.toggle('show-del', !!delBox.checked); });
3987
+ }).catch(function(){
3988
+ detail.innerHTML = '<div class="skill-empty">' + esc(et('\u8bfb\u53d6\u5931\u8d25', 'Failed to load')) + '</div>';
3989
+ });
3990
+ }
3991
+ function histGroupOf(runs){
3992
+ var groups = [], map = {};
3993
+ runs.forEach(function(r){
3994
+ var k = r.textKey || r.runId;
3995
+ if (!map[k]){ map[k] = { key: k, preview: r.preview || r.taskName || '', runs: [] }; groups.push(map[k]); }
3996
+ map[k].runs.push(r);
3997
+ });
3998
+ return groups;
3999
+ }
4000
+ function histRender(){
4001
+ if (!histList) return;
4002
+ var q = String(histQuery || '').trim().toLowerCase();
4003
+ var runs = (HIST_RUNS || []).filter(function(r){
4004
+ if (histMode !== 'all' && r.mode !== histMode) return false;
4005
+ if (!q) return true;
4006
+ var hay = [r.preview, r.draftId, r.runId, r.taskName, histWhen(r.startedAt),
4007
+ r.mode === 'measure' ? 'score \u8bc4\u5206' : 'rewrite \u6539\u5199'].join(' ').toLowerCase();
4008
+ return hay.indexOf(q) >= 0;
4009
+ });
4010
+ var groups = histGroupOf(runs);
4011
+ var pages = Math.max(1, Math.ceil(groups.length / HIST_PAGE_SIZE));
4012
+ if (histPage_ > pages) histPage_ = pages;
4013
+ var slice = groups.slice((histPage_ - 1) * HIST_PAGE_SIZE, histPage_ * HIST_PAGE_SIZE);
4014
+ if (!groups.length){
4015
+ histList.innerHTML = '<div class="skill-empty">' + esc(et('\u6ca1\u6709\u5339\u914d\u7684\u8bb0\u5f55', 'No matching entries')) + '</div>';
4016
+ } else {
4017
+ histList.innerHTML = slice.map(function(g){
4018
+ var latest = g.runs[0];
4019
+ var rows = g.runs.map(function(x){
4020
+ var num = x.draftId || String(x.runId || '').replace(/^r-/, '');
4021
+ var mode = x.mode === 'measure' ? et('\u8bc4\u5206', 'Score') : et('\u6539\u5199', 'Rewrite');
4022
+ var stat = (x.mode === 'measure' && x.score != null) ? (x.score + ' / 100')
4023
+ : (x.edits ? x.edits + ' ' + et('\u5904\u6539\u52a8', 'edits') : '');
4024
+ return '<div class="hist-item" data-run="' + esc(x.runId) + '">'
4025
+ + '<div class="hist-row">'
4026
+ + '<span class="hist-when">' + esc(histWhen(x.startedAt)) + '</span>'
4027
+ + '<span class="hist-num">' + esc(num) + '</span>'
4028
+ + '<span class="hist-mode">' + esc(mode) + '</span>'
4029
+ + '<span class="hist-stat">' + esc(stat) + '</span>'
4030
+ + '<span class="grow"></span>'
4031
+ + '<span class="hist-chev">\u25b8</span>'
4032
+ + '<button class="tiny" type="button" data-open="' + esc(x.runId) + '" data-task="' + esc(x.taskId) + '">'
4033
+ + esc(et('\u6253\u5f00', 'Open')) + '</button>'
4034
+ + '</div>'
4035
+ + '<div class="hist-detail" hidden></div>'
4036
+ + '</div>';
4037
+ }).join('');
4038
+ return '<div class="hist-group">'
4039
+ + '<div class="hist-group-head" data-key="' + esc(g.key) + '">'
4040
+ + '<span class="hist-group-preview">' + esc(g.preview || et('\uff08\u65e0\u6587\u672c\uff09', '(no text)')) + '</span>'
4041
+ + '<span class="hist-group-count">' + g.runs.length + ' ' + esc(et('\u6b21\u8fd0\u884c', 'runs')) + '</span>'
4042
+ + '<span class="hist-group-when">' + esc(histWhen(latest && latest.startedAt)) + '</span>'
4043
+ + '<span class="hist-toggle">\u25be</span>'
4044
+ + '</div>'
4045
+ + '<div class="hist-group-body" hidden>' + rows + '</div>'
4046
+ + '</div>';
4047
+ }).join('');
4048
+ }
4049
+ if (histPager){
4050
+ histPager.innerHTML = '<span>' + esc(et('\u7b2c ' + histPage_ + ' / ' + pages + ' \u9875', 'Page ' + histPage_ + ' / ' + pages)) + '</span>'
4051
+ + '<button class="tiny" type="button" data-p="prev"' + (histPage_ <= 1 ? ' disabled' : '') + '>' + esc(et('\u4e0a\u4e00\u9875', 'Prev')) + '</button>'
4052
+ + '<button class="tiny" type="button" data-p="next"' + (histPage_ >= pages ? ' disabled' : '') + '>' + esc(et('\u4e0b\u4e00\u9875', 'Next')) + '</button>';
4053
+ }
4054
+ }
4055
+ function closeHistory(){
4056
+ if (histPage) histPage.hidden = true;
4057
+ var wrap = document.querySelector('.wrap'); if (wrap) wrap.hidden = false;
4058
+ }
4059
+ function openHistory(){
4060
+ if (!histPage || !histList) return;
4061
+ var wrap = document.querySelector('.wrap'); if (wrap) wrap.hidden = true;
4062
+ histPage.hidden = false;
4063
+ histQuery = ''; histPage_ = 1;
4064
+ if (histSearch) histSearch.value = '';
4065
+ if (histModeSel) histModeSel.value = 'all';
4066
+ histMode = 'all';
4067
+ histList.innerHTML = '<div class="skill-empty">' + esc(et('\u6b63\u5728\u8bfb\u53d6\u2026', 'Loading\u2026')) + '</div>';
4068
+ apiFetch('/history').then(function(r){
4069
+ HIST_RUNS = (r && r.runs) || [];
4070
+ histRender();
4071
+ }).catch(function(){
4072
+ histList.innerHTML = '<div class="skill-empty">' + esc(et('\u8bfb\u53d6\u5931\u8d25', 'Failed to load')) + '</div>';
4073
+ });
4074
+ }
4075
+ var btnHistory = $('#btnHistory');
4076
+ if (btnHistory) btnHistory.addEventListener('click', function(){
4077
+ if (histPage && !histPage.hidden) closeHistory();
4078
+ else openHistory();
4079
+ });
4080
+ var histBack = $('#histBack');
4081
+ if (histBack) histBack.addEventListener('click', closeHistory);
4082
+ if (histSearch) histSearch.addEventListener('input', function(){
4083
+ histQuery = String(histSearch.value || '');
4084
+ histPage_ = 1;
4085
+ histRender();
4086
+ });
4087
+ if (histModeSel) histModeSel.addEventListener('change', function(){
4088
+ histMode = histModeSel.value || 'all';
4089
+ histPage_ = 1;
4090
+ histRender();
4091
+ });
4092
+ if (histPager) histPager.addEventListener('click', function(e){
4093
+ var btn = e.target && e.target.closest ? e.target.closest('button[data-p]') : null;
4094
+ if (!btn) return;
4095
+ if (btn.getAttribute('data-p') === 'prev') histPage_ = Math.max(1, histPage_ - 1);
4096
+ else histPage_ = histPage_ + 1;
4097
+ histRender();
4098
+ });
4099
+ if (histList) histList.addEventListener('click', function(e){
4100
+ var head = e.target && e.target.closest ? e.target.closest('.hist-group-head') : null;
4101
+ if (!head) return;
4102
+ var body = head.parentNode.querySelector('.hist-group-body');
4103
+ if (!body) return;
4104
+ body.hidden = !body.hidden;
4105
+ var t = head.querySelector('.hist-toggle');
4106
+ if (t) t.textContent = body.hidden ? '\u25be' : '\u25b4';
4107
+ });
4108
+ if (histList) histList.addEventListener('click', function(e){
4109
+ if (!e.target || !e.target.closest) return;
4110
+ if (e.target.closest('button[data-open]')) return;
4111
+ if (e.target.closest('.hist-detail')) return;
4112
+ var item = e.target.closest('.hist-item');
4113
+ if (!item) return;
4114
+ toggleHistDetail(item);
4115
+ });
4116
+ if (histList) histList.addEventListener('click', function(e){
4117
+ var btn = e.target && e.target.closest ? e.target.closest('button[data-open]') : null;
4118
+ if (!btn) return;
4119
+ var runId = btn.getAttribute('data-open');
4120
+ var taskId = btn.getAttribute('data-task');
4121
+ closeHistory();
4122
+ apiFetch('/run?id=' + encodeURIComponent(runId)).then(function(st){
4123
+ if (!st || !st.result){ toast(et('\u8fd9\u6b21\u8fd0\u884c\u7684\u7ed3\u679c\u5df2\u4e22\u5931', 'This run has no stored result')); return; }
4124
+ var t = null;
4125
+ (TASKS || []).forEach(function(x){ if (x && x.id === taskId) t = x; });
4126
+ if (t){ ACTIVE = t.id; renderTabs(); applyTask(t); }
4127
+ renderAll(st.result, 0);
4128
+ if (t){ t.run = st.result; t.lastRunId = st.result.runId || runId; t.lastDraftId = st.result.draftId || t.lastDraftId; }
4129
+ try { snapshotTask(); pushState(0); saveTasks(); } catch (e) {}
4130
+ toast(et('\u5df2\u6253\u5f00\u8fd9\u6b21\u8fd0\u884c', 'Opened this run'));
4131
+ }).catch(function(err){
4132
+ toast(et('\u6253\u5f00\u5931\u8d25\uff1a', 'Open failed: ') + (err.message || err));
4133
+ });
4134
+ });
4135
+
4136
+ /* 版本更新提示:/build 与当前构建不一致时,顶部提示一键刷新 */
4137
+ (function(){
4138
+ var lastBuild = window.__etsBuild || '';
4139
+ if (!lastBuild) return;
4140
+ var shown = false;
4141
+ function showUpdate(v){
4142
+ if (shown) return;
4143
+ shown = true;
4144
+ var host = document.querySelector('.ets-root') || document.body;
4145
+ var bar = document.createElement('div');
4146
+ bar.className = 'ets-update';
4147
+ bar.innerHTML = '<span>' + (et ? et('\u63d2\u4ef6\u5df2\u66f4\u65b0\u5230 v' + v, 'Plugin updated to v' + v) : ('v' + v)) + '</span>';
4148
+ var btn = document.createElement('button');
4149
+ btn.type = 'button';
4150
+ btn.textContent = (et ? et('\u5237\u65b0\u9875\u9762', 'Reload page') : 'Reload');
4151
+ btn.addEventListener('click', function(){ location.reload(); });
4152
+ bar.appendChild(btn);
4153
+ host.appendChild(bar);
4154
+ }
4155
+ setInterval(function(){
4156
+ fetch('/econtone-studio/api/build', { cache: 'no-store' }).then(function(r){ return r.json() }).then(function(j){
4157
+ var v = j && j.data && j.data.version;
4158
+ if (v && v !== lastBuild) showUpdate(v);
4159
+ }).catch(function(){});
4160
+ }, 6000);
4161
+ })();
4162
+
4163
+ var scRow = $('#scoreRow');
4164
+ if (scRow) scRow.addEventListener('input', function(e){
4165
+ var inp = e.target && e.target.closest ? e.target.closest('input[data-w]') : null;
4166
+ if (!inp) return;
4167
+ var id = inp.getAttribute('data-w');
4168
+ var v = Math.round(Number(inp.value));
4169
+ if (!isFinite(v)) v = 0;
4170
+ v = Math.max(0, Math.min(100, v));
4171
+ if (!GS.weights) GS.weights = { P1: 40, P2: 40, T1: 10, R1: 10 };
4172
+ GS.weights[id] = v;
4173
+ repaintTotals();
4174
+ if (typeof scheduleSaveParams === 'function') scheduleSaveParams();
4175
+ });
4176
+ if (scRow) scRow.addEventListener('click', function(e){
4177
+ if (e.target && e.target.closest && e.target.closest('input, label, .wt')) return;
4178
+ var el = e.target && e.target.closest ? e.target.closest('.sc, .total') : null;
4179
+ if (!el) return;
4180
+ var dim = el.getAttribute('data-dim');
4181
+ if (!dim){ toast(et('\u5148\u70b9\u8bc4\u5206\uff0c\u518d\u770b\u8be6\u60c5', 'Score first, then open the detail')); return; }
4182
+ openScoreModal(dim);
4183
+ });
4184
+ /* ===== GitHub 仓库入口(开源后填写 REPO_URL) ===== */
4185
+ var REPO_URL = 'https://github.com/pykkkkk/EconTone-Studio';
4186
+ var btnRepo = $('#btnRepo');
4187
+ if (btnRepo) btnRepo.addEventListener('click', function(){
4188
+ if (!REPO_URL){
4189
+ toast(et('\u4ed3\u5e93\u5730\u5740\u5c06\u5728\u5f00\u6e90\u540e\u516c\u5e03', 'The repository link will be published after open-sourcing'));
4190
+ return;
4191
+ }
4192
+ apiFetch('/open-page', {
4193
+ method: 'POST',
4194
+ headers: { 'content-type': 'application/json' },
4195
+ body: JSON.stringify({ url: REPO_URL })
4196
+ }).catch(function(){
4197
+ try { window.open(REPO_URL, '_blank', 'noopener'); } catch (e) {}
4198
+ });
4199
+ });
4200
+
4201
+ /* ===== 按运行记录取回结果 ===== */
4202
+ var btnRunRefresh = $('#btnRunRefresh');
4203
+ if (btnRunRefresh) btnRunRefresh.addEventListener('click', function(){
4204
+ var t = activeTask();
4205
+ if (!t){ toast(et('还没有任务', 'No task yet')); return; }
4206
+ btnRunRefresh.disabled = true;
4207
+ var q = '/run/refresh?task=' + encodeURIComponent(t.id);
4208
+ if (t.lastDraftId) q += '&draft=' + encodeURIComponent(t.lastDraftId);
4209
+ apiFetch(q).then(function(r){
4210
+ btnRunRefresh.disabled = false;
4211
+ if (!r) return;
4212
+ if (r.status === 'running' && r.runId){
4213
+ saveJob({ runId: r.runId, mode: 'measure', startedAt: r.startedAt || Date.now() });
4214
+ resumeJob();
4215
+ toast(et('运行中,正在接回…', 'Still running; re-attaching…'));
4216
+ return;
4217
+ }
4218
+ if (r.status === 'done' && r.result){
4219
+ if (r.runId && t.run && t.run.runId === r.runId){
4220
+ toast(et('没有更新的结果', 'No newer result'));
4221
+ return;
4222
+ }
4223
+ t.lastRunId = r.runId || t.lastRunId;
4224
+ if (r.draftId) t.lastDraftId = r.draftId;
4225
+ t.lastRunAt = r.startedAt || Date.now();
4226
+ renderAll(r.result, 0);
4227
+ snapshotTask();
4228
+ try { pushState(0); } catch (e) {}
4229
+ saveTasks();
4230
+ toast(et('已刷新到最新结果', 'Refreshed to the latest result'));
4231
+ return;
4232
+ }
4233
+ toast(et('没有找到这次运行的结果', 'No stored result for this task'));
4234
+ }).catch(function(e){
4235
+ btnRunRefresh.disabled = false;
4236
+ toast(et('刷新失败:', 'Refresh failed: ') + (e.message || e));
4237
+ });
4238
+ });
4239
+
4240
+ var btnRefresh = $('#btnRefresh');
4241
+ if (btnRefresh) btnRefresh.addEventListener('click', function(){ refreshRun(); });
4242
+
4243
+ /* 每个输入框一个一键清空的 × */
4244
+ function addClearButtons(){
4245
+ var list = root.querySelectorAll('input[type="text"], input:not([type])');
4246
+ Array.prototype.forEach.call(list, function(inp){
4247
+ if (inp.dataset.hasClear === '1') return;
4248
+ if (inp.id === 'budget' || inp.id === 'extent') return;
4249
+ inp.dataset.hasClear = '1';
4250
+ var wrap = document.createElement('span');
4251
+ wrap.className = 'inp-wrap';
4252
+ inp.parentNode.insertBefore(wrap, inp);
4253
+ wrap.appendChild(inp);
4254
+ var btn = document.createElement('button');
4255
+ btn.type = 'button';
4256
+ btn.className = 'inp-x';
4257
+ btn.textContent = '\u00d7';
4258
+ btn.title = '\u6e05\u7a7a';
4259
+ wrap.appendChild(btn);
4260
+ var sync = function(){ wrap.classList.toggle('has-val', !!inp.value); };
4261
+ inp.addEventListener('input', sync);
4262
+ btn.addEventListener('click', function(ev){
4263
+ ev.preventDefault();
4264
+ inp.value = '';
4265
+ sync();
4266
+ try { inp.dispatchEvent(new Event('input', { bubbles: true })); } catch (e) {}
4267
+ inp.focus();
4268
+ });
4269
+ sync();
4270
+ });
4271
+ }
4272
+ addClearButtons();
4273
+
4274
+ apiFetch('/health').then(function(h){
4275
+ var scripts = (h.engine && h.engine.scripts) || {};
4276
+ var n = 0;
4277
+ Object.keys(scripts).forEach(function(k){ if (scripts[k].exists) n++; });
4278
+ var dot = $('#stDot');
4279
+ if (dot) dot.className = n === 5 ? 'dot' : 'dot r';
4280
+ var fp = $('#stFp');
4281
+ if (fp) fp.textContent = 'fp ' + ((h.engine && h.engine.fingerprint) || '—');
4282
+ }).catch(function(){
4283
+ var dot = $('#stDot');
4284
+ if (dot) dot.className = 'dot r';
4285
+ });
4286
+
4287
+ var diffBox = $('#dtab-diff');
4288
+ if (diffBox) diffBox.addEventListener('click', function(e){
4289
+ var tgt = e.target;
4290
+ var btn = (tgt && tgt.closest) ? tgt.closest('button.mini') : null;
4291
+ if (!btn) return;
4292
+ var art = btn.closest('.hunk');
4293
+ if (!art || art.getAttribute('data-live') !== '1') return;
4294
+ setDecision(art.getAttribute('data-hunk'), btn.getAttribute('data-dec'));
4295
+ e.preventDefault(); e.stopPropagation();
4296
+ });
4297
+
4298
+ var saveOut = $('#saveOut');
4299
+ if (saveOut) saveOut.addEventListener('click', function(){
4300
+ if (!LAST_RUN || !LAST_RUN.runId){ toast(t('toast.copyEmpty')); return; }
4301
+ saveOut.disabled = true;
4302
+ apiFetch('/run/apply', {
4303
+ method: 'POST', headers: { 'content-type': 'application/json' },
4304
+ body: JSON.stringify({ runId: LAST_RUN.runId, text: appliedText(LAST_RUN), decisions: DECISIONS }),
4305
+ }).then(function(r){
4306
+ toast(t('toast.saved') + ((r && r.path) || ''));
4307
+ saveOut.disabled = false;
4308
+ }).catch(function(err){
4309
+ toast(t('toast.saveFail') + ((err && err.message) || err));
4310
+ saveOut.disabled = false;
4311
+ });
4312
+ });
4313
+
4314
+ function applyConnDefault(){
4315
+ var KEY = 'ets.connDefault.v1';
4316
+ var seen = null;
4317
+ try { seen = localStorage.getItem(KEY); } catch (e) {}
4318
+ if (seen) return; // 用户已经手动选过,尊重选择
4319
+ GS.conn = 'agent';
4320
+ if (TASKS && TASKS.length) {
4321
+ TASKS.forEach(function(t){
4322
+ if (t && t.params && typeof t.params === 'object') t.params.conn = 'agent';
4323
+ });
4324
+ }
4325
+ try { localStorage.setItem(KEY, 'agent'); } catch (e) {}
4326
+ try { $$('#connSeg button').forEach(function(b){ b.classList.toggle('on', b.dataset.c === GS.conn); }); } catch (e) {}
4327
+ try { paintGame(); } catch (e) {}
4328
+ try { scheduleSaveParams(); } catch (e) {}
4329
+ try { saveTasks(); } catch (e) {}
4330
+ }
4331
+
4332
+ var popout = $('#btnPopout');
4333
+ if (popout && window.__etsStandalone) popout.style.display = 'none';
4334
+ if (popout && !window.__etsStandalone) popout.addEventListener('click', function(){
4335
+ var url = '/econtone-studio/page';
4336
+ var full = location.origin + url;
4337
+ var fallback = function(){
4338
+ try {
4339
+ if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(full);
4340
+ } catch (e) {}
4341
+ toast(t('open.blocked') + full);
4342
+ };
4343
+ // 宿主优先:Electron shell.openExternal 或系统默认浏览器(cmd start / open / xdg-open)
4344
+ apiFetch('/open-page', {
4345
+ method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}',
4346
+ }).then(function(r){
4347
+ if (r && r.opened) { toast(t('open.opened') + (r.url || full)); return; }
4348
+ var win = null;
4349
+ try { win = window.open(url, 'econtone-studio', 'width=1360,height=900,menubar=no,toolbar=no,location=no'); } catch (e) {}
4350
+ if (!win) fallback();
4351
+ }).catch(fallback);
4352
+ });
4353
+
4354
+ /* ===== 两个窗口同步:以宿主 /state 为准 ===== */
4355
+ function applyRemoteState(st){
4356
+ if (!st) return false;
4357
+ var changed = false;
4358
+ SYNCING = true;
4359
+ try {
4360
+ if (st.theme && st.theme !== theme) { try { applyTheme(st.theme); } catch (e) {} }
4361
+ if (st.lang && st.lang !== lang) { try { applyLang(st.lang); } catch (e) {} }
4362
+ if (Array.isArray(st.tasks) && st.tasks.length) {
4363
+ st.tasks.forEach(function(rt){
4364
+ if (!rt || !rt.id) return;
4365
+ var lt = null;
4366
+ (TASKS || []).forEach(function(x){ if (x && x.id === rt.id) lt = x; });
4367
+ if (!lt) return;
4368
+ if (!rt.run && lt.run) rt.run = lt.run;
4369
+ if (!rt.measured && lt.measured) rt.measured = lt.measured;
4370
+ });
4371
+ TASKS = st.tasks;
4372
+ ACTIVE = (st.active && st.tasks.some(function(t){ return t.id === st.active; })) ? st.active : st.tasks[0].id;
4373
+ applyParams(st.params || null);
4374
+ renderTabs();
4375
+ applyTask(activeTask());
4376
+ changed = true;
4377
+ } else if (st.params) {
4378
+ applyParams(st.params);
4379
+ changed = true;
4380
+ }
4381
+ if (st.savedAt) LAST_SEEN = st.savedAt;
4382
+ } finally {
4383
+ setTimeout(function(){ SYNCING = false; }, 400);
4384
+ }
4385
+ return changed;
4386
+ }
4387
+
4388
+ function syncFromHost(silent){
4389
+ return apiFetch('/state').then(function(r){
4390
+ var st = r && r.state;
4391
+ if (!st) { if (!silent) toast(t('sync.none')); return; }
4392
+ var ok = applyRemoteState(st);
4393
+ if (!silent) toast(ok ? t('sync.done') : t('sync.none'));
4394
+ }).catch(function(){ if (!silent) toast(t('sync.none')); });
4395
+ }
4396
+
4397
+ var btnSync = $('#btnSync');
4398
+ if (btnSync) btnSync.addEventListener('click', function(){ syncFromHost(false); });
4399
+
4400
+ function pollState(){
4401
+ if (SYNCING || DIRTY) return;
4402
+ if (document.visibilityState === 'hidden') return;
4403
+ apiFetch('/state').then(function(r){
4404
+ var st = r && r.state;
4405
+ if (!st) return;
4406
+ if (st.savedAt && st.savedAt === LAST_SEEN) return;
4407
+ applyRemoteState(st);
4408
+ }).catch(function(){});
4409
+ }
4410
+ setInterval(pollState, 4000);
4411
+
4412
+ var heroVer = $('#heroVer');
4413
+ var buildVersion = (typeof BUILD !== 'undefined' && BUILD) ? BUILD : (window.__etsBuild || '');
4414
+ if (heroVer && buildVersion) heroVer.textContent = 'v' + buildVersion;
4415
+
4416
+ root.__etsAction = function(kind){
4417
+ if (kind === 'score'){ runMeasure(); return true; }
4418
+ if (kind === 'run'){ runArbitrate(); return true; }
4419
+ return false;
4420
+ };
4421
+
4422
+ return function(){ if (toastT) clearTimeout(toastT); };
4423
+ }
4424
+
4425
+
4426
+ function StudioPage() {
4427
+ return h('div', {
4428
+ className: 'ets-root',
4429
+ 'data-build': BUILD,
4430
+ ref: function (node) {
4431
+ if (!node || node.__etsReady) return;
4432
+ node.__etsReady = true;
4433
+ if (!node.querySelector('.main')) { showFatal(node, new Error('面板标记未注入(HTML 为空)')); return; }
4434
+ try { initStudio(node); } catch (e) { console.error('[econtone-studio] init failed', e); showFatal(node, e); }
4435
+ },
4436
+ dangerouslySetInnerHTML: { __html: HTML },
4437
+ });
4438
+ }
4439
+
4440
+ function PanelGlyph(props) {
4441
+ const size = (props && props.size) || 16;
4442
+ return h('svg', {
4443
+ 'data-dsh-panel-entry': 'econtone-studio',
4444
+ viewBox: '0 0 256 256', width: size, height: size,
4445
+ 'aria-hidden': 'true',
4446
+ },
4447
+ h('path', { fill: 'currentColor', d: 'M168 56 A74.29 74.29 0 0 1 168 200 A170 170 0 0 0 168 56 Z M88 200 A74.29 74.29 0 0 1 88 56 A170 170 0 0 0 88 200 Z' }),
4448
+ h('path', { fill: 'currentColor', d: 'M80 128 A48 48 0 1 0 176 128 A48 48 0 1 0 80 128 Z' }),
4449
+ h('path', { fill: '#E8B23A', d: 'M109.66 157.66 L157.66 109.66 L146.34 98.34 L98.34 146.34 Z' })
4450
+ );
4451
+ }
4452
+
4453
+ return {
4454
+ inject: ['slots'],
4455
+ apply(ctx) {
4456
+ ctx.effect(function () {
4457
+ const a = ctx.slots.inject('sidebar.panellist', function () {
4458
+ return ctx.slots.register({
4459
+ name: 'sidebar.panellist',
4460
+ id: 'econtone-studio',
4461
+ order: 20,
4462
+ label: function () { return 'EconTone Studio'; },
4463
+ }, PanelGlyph);
4464
+ });
4465
+ const b = ctx.slots.inject('main', function () {
4466
+ return ctx.slots.register({
4467
+ name: 'main',
4468
+ key: 'econtone-studio',
4469
+ }, StudioPage);
4470
+ });
4471
+ return function () { a(); b(); };
4472
+ }, 'econtone-studio: slots');
4473
+ },
4474
+ };
4475
+ },
4476
+ });