@celljs/ta-creator 4.32.0 → 4.33.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/web/index.js CHANGED
@@ -1,9 +1,3 @@
1
- // web-src/react.ts
2
- var React;
3
- function bind(react) {
4
- React = react;
5
- }
6
-
7
1
  // web-src/creator-protocol.ts
8
2
  var NAME = "@celljs/ta-creator";
9
3
  var PAGE = `${NAME}/home`;
@@ -14,11 +8,23 @@ var Keys;
14
8
  Keys.ITEMS = "items";
15
9
  Keys.WEEKS = "weeks";
16
10
  Keys.TASKS = "tasks";
11
+ Keys.INSIGHTS = "insights";
12
+ Keys.COMMENTS = "comments";
13
+ Keys.LESSONS = "lessons";
14
+ Keys.PHASES = "phases";
17
15
  })(Keys ||= {});
18
- var STAGES = ["topic", "making", "review", "published"];
19
- var FORMS = ["video", "post"];
20
- var KINDS = ["hot", "howto", "explain"];
16
+ var STAGES = ["topic", "materials", "making", "review", "published"];
17
+ var FORMS = ["video", "post", "article", "note"];
18
+ var FORM_FALLBACKS = {
19
+ video: ["video", "article", "post"],
20
+ post: ["post", "note", "article"],
21
+ article: ["article", "post", "note"],
22
+ note: ["note", "post"]
23
+ };
24
+ var KINDS = ["hot", "howto", "explain", "original"];
21
25
  var STEPS = ["script", "visuals", "voice", "captions", "versions", "checks"];
26
+ var REACHES = ["public", "internal", "both"];
27
+ var SERIES_COLORS = ["#22c55e", "#f97316", "#3b82f6", "#a855f7", "#ec4899", "#14b8a6", "#eab308", "#64748b"];
22
28
  var ASPECTS = ["16:9", "9:16", "3:4", "1:1"];
23
29
  var PLATFORMS = [
24
30
  {
@@ -26,6 +32,8 @@ var PLATFORMS = [
26
32
  name: "B站",
27
33
  color: "#fb7299",
28
34
  video: { aspect: "16:9" },
35
+ article: {},
36
+ note: { maxChars: 1000 },
29
37
  publish: "https://member.bilibili.com/platform/upload/video/frame",
30
38
  declare: "创作声明 → 该视频使用人工智能合成技术"
31
39
  },
@@ -35,6 +43,7 @@ var PLATFORMS = [
35
43
  color: "#ff2442",
36
44
  video: { aspect: "3:4", maxSeconds: 900 },
37
45
  post: { aspect: "3:4", maxImages: 18 },
46
+ article: {},
38
47
  publish: "https://creator.xiaohongshu.com",
39
48
  declare: "内容类型声明 → 笔记含 AI 合成内容"
40
49
  },
@@ -43,6 +52,7 @@ var PLATFORMS = [
43
52
  name: "视频号",
44
53
  color: "#fa9d3b",
45
54
  video: { aspect: "9:16" },
55
+ post: { aspect: "3:4", maxImages: 9 },
46
56
  publish: "https://channels.weixin.qq.com",
47
57
  declare: "声明 → 内容由 AI 生成"
48
58
  },
@@ -61,6 +71,7 @@ var PLATFORMS = [
61
71
  name: "YouTube",
62
72
  color: "#ff0033",
63
73
  video: { aspect: "16:9" },
74
+ note: { maxChars: 1500 },
64
75
  publish: "https://studio.youtube.com",
65
76
  declare: "Altered or synthetic content → Yes"
66
77
  },
@@ -68,9 +79,19 @@ var PLATFORMS = [
68
79
  id: "wechat-article",
69
80
  name: "公众号",
70
81
  color: "#07c160",
71
- post: { aspect: "16:9" },
82
+ article: {},
72
83
  publish: "https://mp.weixin.qq.com",
73
84
  declare: "创作来源 → 内容由 AI 生成"
85
+ },
86
+ {
87
+ id: "zhihu",
88
+ name: "知乎",
89
+ color: "#1772f6",
90
+ video: { aspect: "16:9" },
91
+ article: {},
92
+ note: { maxChars: 1000 },
93
+ publish: "https://www.zhihu.com/creator",
94
+ declare: "创作声明 → 包含 AI 辅助创作"
74
95
  }
75
96
  ];
76
97
  var SOURCES = [
@@ -79,58 +100,232 @@ var SOURCES = [
79
100
  { name: "Product Hunt", url: "https://www.producthunt.com" },
80
101
  { name: "Hugging Face Papers", url: "https://huggingface.co/papers" }
81
102
  ];
103
+ var COMMENT_CLASSES = ["question", "suggestion", "correction", "praise", "negative", "spam"];
104
+ var REPLY_CLASSES = ["question", "suggestion", "correction", "praise"];
105
+ var REPLY_STATES = ["draft", "approved", "sent", "dropped", "withdrawn", "removed"];
106
+
107
+ // web-src/publish-util.ts
108
+ var text = (value, max) => typeof value === "string" ? value.trim().slice(0, max) : "";
109
+ var time = (value) => typeof value === "number" && Number.isFinite(value) && value > 0 ? value : undefined;
110
+ var object = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
111
+ var PublishUtil;
112
+ ((PublishUtil) => {
113
+ function dayOf(at) {
114
+ const day = new Date(at);
115
+ const two = (n) => String(n).padStart(2, "0");
116
+ return `${day.getFullYear()}-${two(day.getMonth() + 1)}-${two(day.getDate())}`;
117
+ }
118
+ PublishUtil.dayOf = dayOf;
119
+ function publishQueue(items) {
120
+ const due = (item) => item.kind === "hot" && item.until ? item.until : Number.POSITIVE_INFINITY;
121
+ return items.filter((one) => one.publishing?.state === "queued" && !one.dropped).sort((a, b) => due(a) - due(b) || (a.approved ?? a.changedAt) - (b.approved ?? b.changedAt));
122
+ }
123
+ PublishUtil.publishQueue = publishQueue;
124
+ function ahead(items, id) {
125
+ const running = items.some((one) => one.publishing?.state === "running" && !one.dropped && one.id !== id) ? 1 : 0;
126
+ const at = publishQueue(items).findIndex((one) => one.id === id);
127
+ return at < 0 ? 0 : at + running;
128
+ }
129
+ PublishUtil.ahead = ahead;
130
+ function slots(items, item, now, hour = 12) {
131
+ const done = new Set((item.links ?? []).map((one) => one.platform));
132
+ const platforms = [
133
+ ...new Set((item.versions ?? []).filter((one) => one.files.length || ["article", "note"].includes(one.form ?? item.form) && !!one.text).map((one) => one.platform))
134
+ ].filter((one) => !done.has(one));
135
+ const others = items.filter((one) => one.id !== item.id && !one.dropped);
136
+ return platforms.map((platform) => {
137
+ const taken = new Set([
138
+ ...others.flatMap((one) => (one.links ?? []).filter((link) => link.platform === platform).map((link) => dayOf(link.scheduled ?? link.at))),
139
+ ...others.filter((one) => one.publishing?.state === "running").flatMap((one) => (one.publishing?.slots ?? []).filter((slot) => slot.platform === platform).map((slot) => dayOf(slot.at ?? one.publishing?.since ?? now)))
140
+ ]);
141
+ if (!taken.has(dayOf(now))) {
142
+ return { platform };
143
+ }
144
+ const day = new Date(now);
145
+ day.setHours(hour, 0, 0, 0);
146
+ do {
147
+ day.setDate(day.getDate() + 1);
148
+ } while (taken.has(dayOf(day.getTime())));
149
+ return { platform, at: day.getTime() };
150
+ });
151
+ }
152
+ PublishUtil.slots = slots;
153
+ function timeOf(value) {
154
+ if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/.test(value.trim())) {
155
+ const at = new Date(value.trim().replace(" ", "T")).getTime();
156
+ return Number.isFinite(at) ? at : undefined;
157
+ }
158
+ return time(value);
159
+ }
160
+ PublishUtil.timeOf = timeOf;
161
+ function publishing(value) {
162
+ const kept = object(value);
163
+ const since = time(kept?.since);
164
+ const state = kept && ["queued", "running", "stopped"].find((one) => one === kept.state);
165
+ if (!kept || !since || !state) {
166
+ return;
167
+ }
168
+ const slots2 = Array.isArray(kept.slots) ? kept.slots.map((one) => object(one)).filter((one) => !!one && !!text(one.platform, 60)).map((one) => ({ platform: text(one.platform, 60), ...time(one.at) ? { at: time(one.at) } : {} })) : undefined;
169
+ return {
170
+ state,
171
+ since,
172
+ ...slots2 ? { slots: slots2 } : {},
173
+ ...text(kept.note, 300) ? { note: text(kept.note, 300) } : {},
174
+ ...text(kept.ask, 500) ? { ask: text(kept.ask, 500) } : {}
175
+ };
176
+ }
177
+ PublishUtil.publishing = publishing;
178
+ })(PublishUtil ||= {});
179
+
180
+ // web-src/react.ts
181
+ var React;
182
+ function bind(react) {
183
+ React = react;
184
+ }
185
+
186
+ // web-src/values.ts
187
+ var text2 = (value, max = 2000) => typeof value === "string" ? value.trim().slice(0, max) : "";
188
+ var texts = (value, max = 50) => Array.isArray(value) ? value.map((one) => text2(one, 200)).filter(Boolean).slice(0, max) : [];
189
+ var time2 = (value) => typeof value === "number" && Number.isFinite(value) && value > 0 ? value : undefined;
190
+ var oneOf = (all, value, fallback) => all.includes(value) ? value : fallback;
191
+ var object2 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
192
+ function hash(value) {
193
+ let h = 0;
194
+ for (const char of value) {
195
+ h = Math.imul(h, 31) + (char.codePointAt(0) ?? 0) | 0;
196
+ }
197
+ return (h >>> 0).toString(36);
198
+ }
199
+ function url(value) {
200
+ const raw = text2(value, 1000);
201
+ return /^https?:\/\/\S+$/i.test(raw) ? raw : undefined;
202
+ }
203
+ function count(value, fallback) {
204
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.round(value) : fallback;
205
+ }
82
206
 
83
207
  // web-src/creator-util.ts
84
208
  var DAY = 86400000;
85
209
  var MAX_TOPICS = 200;
86
210
  var HOT_FOR = 2 * DAY;
87
- var text = (value, max = 2000) => typeof value === "string" ? value.trim().slice(0, max) : "";
88
- var texts = (value, max = 50) => Array.isArray(value) ? value.map((one) => text(one, 200)).filter(Boolean).slice(0, max) : [];
89
- var time = (value) => typeof value === "number" && Number.isFinite(value) && value > 0 ? value : undefined;
90
- var oneOf = (all, value, fallback) => all.includes(value) ? value : fallback;
91
- var object = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
92
211
  var CreatorUtil;
93
212
  ((CreatorUtil) => {
94
213
  function settings(value) {
95
- const kept = object(value) ?? {};
96
- const platforms = Array.isArray(kept.platforms) ? kept.platforms.map(platform).filter((one) => !!one) : [...PLATFORMS];
214
+ const kept = object2(value) ?? {};
215
+ const platforms = Array.isArray(kept.platforms) ? withBuiltins(kept.platforms.map(platform).filter((one) => !!one)) : [...PLATFORMS];
97
216
  const ids = new Set(platforms.map((one) => one.id));
98
- const goal = object(kept.goal);
217
+ const goal = object2(kept.goal);
99
218
  return {
100
- niche: text(kept.niche, 500),
219
+ niche: text2(kept.niche, 500),
101
220
  picked: texts(kept.picked).filter((id) => ids.has(id)),
102
221
  platforms,
103
222
  sources: Array.isArray(kept.sources) ? kept.sources.map(source).filter((one) => !!one) : [...SOURCES],
104
- ...goal && time(goal.from) ? { goal: { from: time(goal.from), days: count(goal.days, 30), videos: count(goal.videos, 0), posts: count(goal.posts, 0) } } : {},
223
+ ...goal && time2(goal.from) ? { goal: { from: time2(goal.from), days: count(goal.days, 30), videos: count(goal.videos, 0), posts: count(goal.posts, 0) } } : {},
105
224
  minutesCap: count(kept.minutesCap, 120),
106
- voice: text(kept.voice, 60) || "zh-CN-XiaoxiaoNeural"
225
+ voice: text2(kept.voice, 60) || "zh-CN-XiaoxiaoNeural",
226
+ series: Array.isArray(kept.series) ? seriesOf(kept.series) : [],
227
+ strategy: kept.strategy === "manual" ? "manual" : "auto",
228
+ phaseWeeks: typeof kept.phaseWeeks === "number" ? Math.min(26, count(kept.phaseWeeks, 4)) : 4,
229
+ commentsEvery: Math.min(72, count(kept.commentsEvery, 0)),
230
+ commentsDays: Math.max(1, Math.min(60, count(kept.commentsDays, 14)))
107
231
  };
108
232
  }
109
233
  CreatorUtil.settings = settings;
234
+ function withBuiltins(kept) {
235
+ const forms = (one) => ({ video: one.video, post: one.post, article: one.article, note: one.note });
236
+ const known = kept.map((one) => {
237
+ const builtin = PLATFORMS.find((it) => it.id === one.id);
238
+ if (!builtin) {
239
+ return one;
240
+ }
241
+ const { video: _v, post: _p, article: _a, note: _n, ...rest } = one;
242
+ return JSON.parse(JSON.stringify({ ...rest, ...forms(builtin) }));
243
+ });
244
+ return [...known, ...PLATFORMS.filter((one) => !kept.some((it) => it.id === one.id))];
245
+ }
246
+ CreatorUtil.withBuiltins = withBuiltins;
247
+ function reach(item2, settings2) {
248
+ return item2.reach ?? settings2.series.find((one) => one.id === item2.series)?.reach ?? "public";
249
+ }
250
+ CreatorUtil.reach = reach;
251
+ function platformsFor(settings2, item2) {
252
+ const to = reach(item2, settings2);
253
+ return picked(settings2).filter((platform2) => to === "both" || to === "internal" === !!platform2.internal).map((platform2) => ({ platform: platform2, form: formFor(platform2, item2.form) })).filter((one) => !!one.form);
254
+ }
255
+ CreatorUtil.platformsFor = platformsFor;
256
+ function takes(platform2, form) {
257
+ return !!platform2[form];
258
+ }
259
+ CreatorUtil.takes = takes;
260
+ function formFor(platform2, form) {
261
+ return FORM_FALLBACKS[form].find((one) => takes(platform2, one));
262
+ }
263
+ CreatorUtil.formFor = formFor;
264
+ function ready(version2, form) {
265
+ return version2.files.length > 0 || (version2.form ?? form) !== "video" && (version2.form ?? form) !== "post" && !!version2.text;
266
+ }
267
+ CreatorUtil.ready = ready;
268
+ function seriesOf(values) {
269
+ const all = [];
270
+ for (const value of values) {
271
+ const kept = object2(value);
272
+ const name = text2(kept?.name, 40);
273
+ if (!kept || !name) {
274
+ continue;
275
+ }
276
+ const id = text2(kept.id, 60) || `s${hash(name)}`;
277
+ if (all.some((one) => one.id === id)) {
278
+ continue;
279
+ }
280
+ const about = text2(kept.about, 200);
281
+ const perWeek = count(kept.perWeek, 0);
282
+ all.push({
283
+ id,
284
+ name,
285
+ ...about ? { about } : {},
286
+ color: text2(kept.color, 40) || SERIES_COLORS[all.length % SERIES_COLORS.length],
287
+ ...kept.ordered === true ? { ordered: true } : {},
288
+ ...perWeek ? { perWeek: Math.min(perWeek, 14) } : {},
289
+ ...kept.reach === "internal" || kept.reach === "both" ? { reach: kept.reach } : {}
290
+ });
291
+ }
292
+ return all.slice(0, 12);
293
+ }
294
+ CreatorUtil.seriesOf = seriesOf;
110
295
  function platform(value) {
111
- const kept = object(value);
112
- const id = text(kept?.id, 60);
113
- const name = text(kept?.name, 60);
296
+ const kept = object2(value);
297
+ const id = text2(kept?.id, 60);
298
+ const name = text2(kept?.name, 60);
114
299
  if (!kept || !id || !name) {
115
300
  return;
116
301
  }
117
302
  const shape = (one) => {
118
- const it = object(one);
303
+ const it = object2(one);
119
304
  return it ? { aspect: oneOf(ASPECTS, it.aspect, "16:9"), ...count(it.maxSeconds, 0) ? { maxSeconds: count(it.maxSeconds, 0) } : {} } : undefined;
120
305
  };
121
306
  const video = shape(kept.video);
122
- const post = object(kept.post) ? {
123
- aspect: oneOf(ASPECTS, object(kept.post)?.aspect, "3:4"),
124
- ...count(object(kept.post)?.maxImages, 0) ? { maxImages: count(object(kept.post)?.maxImages, 0) } : {}
307
+ const post = object2(kept.post) ? {
308
+ aspect: oneOf(ASPECTS, object2(kept.post)?.aspect, "3:4"),
309
+ ...count(object2(kept.post)?.maxImages, 0) ? { maxImages: count(object2(kept.post)?.maxImages, 0) } : {}
125
310
  } : undefined;
311
+ const words = (one) => {
312
+ const it = object2(one);
313
+ return it ? count(it.maxChars, 0) ? { maxChars: count(it.maxChars, 0) } : {} : undefined;
314
+ };
315
+ const article = words(kept.article);
316
+ const note = words(kept.note);
126
317
  const publish = url(kept.publish);
127
- const declare = text(kept.declare, 200);
318
+ const declare = text2(kept.declare, 200);
319
+ const inside = kept.internal === true ? { internal: true } : {};
128
320
  return {
321
+ ...inside,
129
322
  id,
130
323
  name,
131
- color: text(kept.color, 40) || "#8e8e93",
324
+ color: text2(kept.color, 40) || "#8e8e93",
132
325
  ...video ? { video } : {},
133
326
  ...post ? { post } : {},
327
+ ...article ? { article } : {},
328
+ ...note ? { note } : {},
134
329
  ...publish ? { publish } : {},
135
330
  ...declare ? { declare } : {}
136
331
  };
@@ -141,14 +336,14 @@ var CreatorUtil;
141
336
  }
142
337
  CreatorUtil.items = items;
143
338
  function item(value) {
144
- const kept = object(value);
145
- const id = text(kept?.id, 80);
146
- const title = text(kept?.title, 200);
147
- const at = time(kept?.at);
339
+ const kept = object2(value);
340
+ const id = text2(kept?.id, 80);
341
+ const title = text2(kept?.title, 200);
342
+ const at = time2(kept?.at);
148
343
  if (!kept || !id || !title || !at) {
149
344
  return;
150
345
  }
151
- const origin = object(kept.origin);
346
+ const origin = object2(kept.origin);
152
347
  const originUrl = url(origin?.url);
153
348
  return {
154
349
  id,
@@ -156,28 +351,38 @@ var CreatorUtil;
156
351
  form: oneOf(FORMS, kept.form, "video"),
157
352
  kind: oneOf(KINDS, kept.kind, "howto"),
158
353
  stage: oneOf(STAGES, kept.stage, "topic"),
159
- ...text(kept.why, 300) ? { why: text(kept.why, 300) } : {},
354
+ ...text2(kept.series, 60) ? { series: text2(kept.series, 60) } : {},
355
+ ...count(kept.number, 0) ? { number: count(kept.number, 0) } : {},
356
+ ...REACHES.includes(kept.reach) ? { reach: kept.reach } : {},
357
+ ...text2(kept.why, 300) ? { why: text2(kept.why, 300) } : {},
160
358
  ...typeof kept.heat === "number" ? { heat: Math.max(0, Math.min(100, Math.round(kept.heat))) } : {},
161
- ...time(kept.until) ? { until: time(kept.until) } : {},
359
+ ...time2(kept.until) ? { until: time2(kept.until) } : {},
162
360
  ...texts(kept.seen, 10).length ? { seen: texts(kept.seen, 10) } : {},
163
361
  ...origin && originUrl ? {
164
362
  origin: {
165
363
  url: originUrl,
166
- ...text(origin.title, 200) ? { title: text(origin.title, 200) } : {},
167
- ...text(origin.author, 100) ? { author: text(origin.author, 100) } : {},
168
- ...text(origin.licence, 100) ? { licence: text(origin.licence, 100) } : {}
364
+ ...text2(origin.title, 200) ? { title: text2(origin.title, 200) } : {},
365
+ ...text2(origin.author, 100) ? { author: text2(origin.author, 100) } : {},
366
+ ...text2(origin.licence, 100) ? { licence: text2(origin.licence, 100) } : {}
169
367
  }
170
368
  } : {},
369
+ ...Array.isArray(kept.needs) ? {
370
+ needs: kept.needs.map(need).filter((one) => !!one).slice(0, 12)
371
+ } : {},
171
372
  ...Array.isArray(kept.done) ? { done: STEPS.filter((step) => kept.done.includes(step)) } : {},
172
- ...text(kept.script, 20000) ? { script: text(kept.script, 20000) } : {},
373
+ ...text2(kept.script, 20000) ? { script: text2(kept.script, 20000) } : {},
173
374
  ...Array.isArray(kept.versions) ? { versions: kept.versions.map(version).filter((one) => !!one) } : {},
174
375
  ...Array.isArray(kept.checks) ? { checks: kept.checks.map(check).filter((one) => !!one) } : {},
175
- ...text(kept.session, 1000) ? { session: text(kept.session, 1000) } : {},
176
- ...time(kept.approved) ? { approved: time(kept.approved) } : {},
376
+ ...text2(kept.session, 1000) ? { session: text2(kept.session, 1000) } : {},
377
+ ...time2(kept.approved) ? { approved: time2(kept.approved) } : {},
378
+ ...PublishUtil.publishing(kept.publishing) ? { publishing: PublishUtil.publishing(kept.publishing) } : {},
177
379
  ...Array.isArray(kept.links) ? { links: kept.links.map(link).filter((one) => !!one) } : {},
380
+ ...Array.isArray(kept.stats) ? { stats: kept.stats.map(stat).filter((one) => !!one) } : {},
178
381
  ...kept.dropped === true ? { dropped: true } : {},
382
+ ...time2(kept.commentsAt) ? { commentsAt: time2(kept.commentsAt) } : {},
383
+ ...time2(kept.commentsGap) ? { commentsGap: time2(kept.commentsGap) } : {},
179
384
  at,
180
- changedAt: time(kept.changedAt) ?? at
385
+ changedAt: time2(kept.changedAt) ?? at
181
386
  };
182
387
  }
183
388
  CreatorUtil.item = item;
@@ -185,10 +390,10 @@ var CreatorUtil;
185
390
  if (!Array.isArray(value)) {
186
391
  return [];
187
392
  }
188
- return value.map((one) => object(one)).filter((one) => !!one && /^\d{4}-\d{2}-\d{2}$/.test(String(one.week))).map((one) => ({
393
+ return value.map((one) => object2(one)).filter((one) => !!one && /^\d{4}-\d{2}-\d{2}$/.test(String(one.week))).map((one) => ({
189
394
  week: String(one.week),
190
- platforms: (Array.isArray(one.platforms) ? one.platforms : []).map((it) => object(it)).filter((it) => !!it && !!text(it.platform, 60)).map((it) => ({
191
- platform: text(it.platform, 60),
395
+ platforms: (Array.isArray(one.platforms) ? one.platforms : []).map((it) => object2(it)).filter((it) => !!it && !!text2(it.platform, 60)).map((it) => ({
396
+ platform: text2(it.platform, 60),
192
397
  views: count(it.views, 0),
193
398
  ...typeof it.likes === "number" ? { likes: count(it.likes, 0) } : {},
194
399
  ...typeof it.follows === "number" ? { follows: count(it.follows, 0) } : {},
@@ -207,6 +412,7 @@ var CreatorUtil;
207
412
  const of = (stage) => items2.filter((one) => one.stage === stage && !one.dropped);
208
413
  return {
209
414
  topic: of("topic").filter((one) => !expired(one, now)).sort((a, b) => (b.heat ?? 0) - (a.heat ?? 0) || b.at - a.at),
415
+ materials: of("materials").sort(latest),
210
416
  making: of("making").sort(latest),
211
417
  review: of("review").sort(latest),
212
418
  published: of("published").sort((a, b) => publishedAt(b) - publishedAt(a))
@@ -218,16 +424,18 @@ var CreatorUtil;
218
424
  }
219
425
  CreatorUtil.expired = expired;
220
426
  function publishedAt(item2) {
221
- return Math.min(...(item2.links ?? []).map((one) => one.at), item2.changedAt);
427
+ return Math.min(...(item2.links ?? []).map((one) => one.scheduled ?? one.at), item2.changedAt);
222
428
  }
223
429
  CreatorUtil.publishedAt = publishedAt;
224
- function addTopics(items2, topics, now, id) {
430
+ function addTopics(items2, topics, now, id, series = []) {
225
431
  const key = (title) => title.toLowerCase().replace(/[\s\p{P}]+/gu, "");
226
432
  const titles = new Set(items2.map((one) => key(one.title)));
227
433
  const origins = new Set(items2.map((one) => one.origin?.url).filter(Boolean));
228
434
  const added = [];
229
435
  for (const topic of topics) {
230
- const made = item({ ...topic, id: id(), stage: "topic", at: now, changedAt: now });
436
+ const of = seriesNamed(series, topic.series);
437
+ const number = of?.ordered ? count(topic.number, 0) || nextNumber([...items2, ...added], of.id) : undefined;
438
+ const made = item({ ...topic, series: of?.id, number, id: id(), stage: "topic", at: now, changedAt: now });
231
439
  if (!made || titles.has(key(made.title)) || made.origin && origins.has(made.origin.url)) {
232
440
  continue;
233
441
  }
@@ -256,6 +464,43 @@ var CreatorUtil;
256
464
  return items2.map((one, index) => index === at ? changed : one);
257
465
  }
258
466
  CreatorUtil.change = change;
467
+ function seriesNamed(series, value) {
468
+ const key = text2(value, 60).toLowerCase();
469
+ return key ? series.find((one) => one.id.toLowerCase() === key || one.name.toLowerCase() === key) : undefined;
470
+ }
471
+ CreatorUtil.seriesNamed = seriesNamed;
472
+ function nextNumber(items2, series) {
473
+ return items2.filter((one) => one.series === series).reduce((most, one) => Math.max(most, one.number ?? 0), 0) + 1;
474
+ }
475
+ CreatorUtil.nextNumber = nextNumber;
476
+ function removed(items2, stage) {
477
+ return items2.filter((one) => one.dropped && one.stage === stage && stage !== "published").sort((a, b) => b.changedAt - a.changedAt);
478
+ }
479
+ CreatorUtil.removed = removed;
480
+ function bySeries(items2, series) {
481
+ const known = new Set(series.map((one) => one.id));
482
+ const groups = series.map((one) => {
483
+ const of = items2.filter((item2) => item2.series === one.id);
484
+ return { series: one, items: one.ordered ? [...of].sort((a, b) => (a.number ?? 1e9) - (b.number ?? 1e9)) : of };
485
+ });
486
+ const rest = items2.filter((item2) => !item2.series || !known.has(item2.series));
487
+ return [...groups, ...rest.length ? [{ items: rest }] : []];
488
+ }
489
+ CreatorUtil.bySeries = bySeries;
490
+ function views(item2) {
491
+ return item2.stats?.length ? item2.stats.reduce((all, one) => all + one.views, 0) : undefined;
492
+ }
493
+ CreatorUtil.views = views;
494
+ function setStats(items2, id, stats, now) {
495
+ const read = stats.map((one) => stat({ at: now, ...object2(one) ?? {} })).filter((one) => !!one);
496
+ const before = items2.find((one) => one.id === id);
497
+ if (!before) {
498
+ throw new Error(`No such piece: ${id}.`);
499
+ }
500
+ const kept = (before.stats ?? []).filter((one) => !read.some((it) => it.platform === one.platform));
501
+ return change(items2, id, { stats: [...kept, ...read] }, now);
502
+ }
503
+ CreatorUtil.setStats = setStats;
259
504
  function progress(items2, goal, now) {
260
505
  if (!goal) {
261
506
  return;
@@ -267,7 +512,7 @@ var CreatorUtil;
267
512
  });
268
513
  return {
269
514
  videos: published.filter((one) => one.form === "video").length,
270
- posts: published.filter((one) => one.form === "post").length,
515
+ posts: published.filter((one) => one.form !== "video").length,
271
516
  day: Math.max(1, Math.min(goal.days, Math.floor((now - goal.from) / DAY) + 1))
272
517
  };
273
518
  }
@@ -304,42 +549,63 @@ var CreatorUtil;
304
549
  return minutes(weeks2, now) >= settings2.minutesCap * 0.75 ? 2 : 6;
305
550
  }
306
551
  CreatorUtil.offer = offer;
552
+ function need(value) {
553
+ const kept = object2(value);
554
+ const words = text2(kept?.text, 300);
555
+ if (!kept || !words) {
556
+ return;
557
+ }
558
+ return { id: text2(kept.id, 60), text: words, ...kept.done === true ? { done: true } : {} };
559
+ }
560
+ CreatorUtil.need = need;
307
561
  function version(value) {
308
- const kept = object(value);
309
- const platform2 = text(kept?.platform, 60);
562
+ const kept = object2(value);
563
+ const platform2 = text2(kept?.platform, 60);
310
564
  if (!kept || !platform2) {
311
565
  return;
312
566
  }
313
- const cover = text(kept.cover, 500);
567
+ const cover = text2(kept.cover, 500);
314
568
  return {
315
569
  platform: platform2,
316
- title: text(kept.title, 200),
317
- text: text(kept.text, 5000),
570
+ ...FORMS.includes(kept.form) ? { form: kept.form } : {},
571
+ title: text2(kept.title, 200),
572
+ text: text2(kept.text, 20000),
318
573
  tags: texts(kept.tags, 20),
319
574
  files: texts(kept.files, 40),
320
575
  ...cover ? { cover } : {}
321
576
  };
322
577
  }
323
578
  function check(value) {
324
- const kept = object(value);
325
- return kept && text(kept.text, 200) ? { text: text(kept.text, 200), ok: kept.ok === true } : undefined;
579
+ const kept = object2(value);
580
+ return kept && text2(kept.text, 200) ? { text: text2(kept.text, 200), ok: kept.ok === true } : undefined;
326
581
  }
327
582
  function link(value) {
328
- const kept = object(value);
583
+ const kept = object2(value);
329
584
  const href = url(kept?.url);
330
- return kept && href && text(kept.platform, 60) ? { platform: text(kept.platform, 60), url: href, at: time(kept.at) ?? Date.now() } : undefined;
585
+ const scheduled = PublishUtil.timeOf(kept?.scheduled);
586
+ return kept && href && text2(kept.platform, 60) ? { platform: text2(kept.platform, 60), url: href, at: time2(kept.at) ?? Date.now(), ...scheduled ? { scheduled } : {} } : undefined;
587
+ }
588
+ function stat(value) {
589
+ const kept = object2(value);
590
+ const platform2 = text2(kept?.platform, 60);
591
+ if (!kept || !platform2 || typeof kept.views !== "number") {
592
+ return;
593
+ }
594
+ const optional = (key) => typeof kept[key] === "number" ? { [key]: count(kept[key], 0) } : {};
595
+ return {
596
+ platform: platform2,
597
+ views: count(kept.views, 0),
598
+ ...optional("likes"),
599
+ ...optional("comments"),
600
+ ...optional("follows"),
601
+ ...typeof kept.completion === "number" && Number.isFinite(kept.completion) ? { completion: Math.max(0, Math.min(1, kept.completion)) } : {},
602
+ at: time2(kept.at) ?? Date.now()
603
+ };
331
604
  }
332
605
  function source(value) {
333
- const kept = object(value);
606
+ const kept = object2(value);
334
607
  const href = url(kept?.url);
335
- return kept && href && text(kept.name, 80) ? { name: text(kept.name, 80), url: href } : undefined;
336
- }
337
- function url(value) {
338
- const raw = text(value, 1000);
339
- return /^https?:\/\/\S+$/i.test(raw) ? raw : undefined;
340
- }
341
- function count(value, fallback) {
342
- return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.round(value) : fallback;
608
+ return kept && href && text2(kept.name, 80) ? { name: text2(kept.name, 80), url: href } : undefined;
343
609
  }
344
610
  })(CreatorUtil ||= {});
345
611
 
@@ -413,10 +679,8 @@ var EN = {
413
679
  reviewEmpty: "Nothing waits for you",
414
680
  publishedEmpty: "Nothing published yet",
415
681
  open: "Open",
416
- pass: "Pass, fill it in",
417
682
  change: "Change",
418
683
  changeAsk: "What should change?",
419
- approved: "Passed: Ta fills in the pages, you press Publish",
420
684
  views: "Views",
421
685
  follows: "New followers",
422
686
  minutes: "Your time this week",
@@ -435,8 +699,144 @@ var EN = {
435
699
  failed: "Did not work: {error}",
436
700
  makePrompt: "Make this piece: {title} ({id})",
437
701
  findPrompt: "Find hot topics for my channel now",
438
- passPrompt: "Passed: fill in the publishing pages of {id}, stopping before Publish",
439
- changePrompt: "Change {id}: {note}"
702
+ changePrompt: "Change {id}: {note}",
703
+ all: "All",
704
+ seriesNone: "No series",
705
+ seriesLabel: "Series",
706
+ seriesHint: "Run several at once: topics are found and reviewed series by series",
707
+ seriesName: "Name",
708
+ seriesAbout: "What it is about, for whom",
709
+ seriesOrdered: "A course, in order",
710
+ addSeries: "Add a series",
711
+ episode: "No. {n}",
712
+ seriesStat: "{published} published · {waiting} waiting",
713
+ remove: "Remove",
714
+ removeAsk: "Remove “{title}”?",
715
+ removeHint: "You can put it back from Removed below",
716
+ removedLabel: "Removed {n}",
717
+ restore: "Put back",
718
+ pass: "Pass, publish it",
719
+ approved: "Passed: Ta publishes it on each platform",
720
+ passPrompt: "Passed: publish {id} on each platform and keep the links",
721
+ queuedNext: "Passed: published next",
722
+ queuedAhead: "Passed: {n} to publish before it",
723
+ publishingNow: "Publishing now",
724
+ slotNow: "now",
725
+ stoppedNote: "Not published: {note}",
726
+ publishAgain: "Publish again",
727
+ doingScript: "Writing the script: a hook in the first 3 seconds",
728
+ doingVisuals: "Drawing the scenes: host, terminal, phone",
729
+ doingVoice: "Recording the voice, scene by scene",
730
+ doingCaptions: "Burning in the captions",
731
+ doingVersions: "Writing a title and words for each platform",
732
+ doingChecks: "Checking the AI label, privacy and length",
733
+ doneAll: "Made: waiting for your review",
734
+ flowSeries: "{n} series",
735
+ flowNone: "None yet",
736
+ flowWaiting: "{n} wait for you",
737
+ flowPassed: "Passed, publishing",
738
+ flowWeek: "{n} this week",
739
+ flowMonday: "Reviewed each Monday",
740
+ showAll: "Show all {n}",
741
+ showLess: "Show less",
742
+ openChat: "Open",
743
+ publishedCount: "Published",
744
+ totalViews: "Views, all",
745
+ lastWeek: "Views last week",
746
+ bySeries: "By series",
747
+ byKind: "By kind",
748
+ byForm: "By form",
749
+ byPlatform: "By platform",
750
+ perPiece: "views a piece",
751
+ completion: "watched {n}%",
752
+ pieces: "{n} pieces",
753
+ weekly: "Views by week",
754
+ top: "Did best",
755
+ insights: "What the review found",
756
+ insightsHint: "The next topics follow it",
757
+ noInsights: "After each Monday’s review, what it found shows here",
758
+ reviewNow: "Review now",
759
+ reviewPrompt: "Review my channel now: read the numbers of each piece on each platform, compare series, kinds and forms, and keep what you find for the topics to come",
760
+ viewsShort: "{n} views",
761
+ cancel: "Cancel",
762
+ noneYet: "Nothing published yet",
763
+ article: "Article",
764
+ note: "Note",
765
+ original: "Your own",
766
+ talk: "Comments",
767
+ materials: "Materials",
768
+ needsTitle: "Waiting for your materials",
769
+ needsHint: "Ta looked in the working directory first; send the rest in its conversation",
770
+ giveNow: "Send them",
771
+ skipNeeds: "Go on without",
772
+ skipPrompt: "{id}: do not wait for the materials, make it with what there is",
773
+ flowMaterials: "{n} wait for materials",
774
+ public: "Public",
775
+ internal: "In-company",
776
+ both: "Both",
777
+ reachTip: "Who it is for: tap to change",
778
+ noInside: "For your company, but no in-company platform is picked: add one in Settings",
779
+ drafts: "Answers waiting for you",
780
+ autoSent: "Answered lately",
781
+ asked: "What the audience asks",
782
+ send: "Send",
783
+ dropReply: "Don’t answer",
784
+ withdraw: "Take back",
785
+ withdrawn: "Taken back",
786
+ sending: "Posting soon",
787
+ sent: "Posted",
788
+ autoTag: "by Ta",
789
+ replyLevels: "How comments are answered",
790
+ levelAct: "On its own",
791
+ levelAsk: "Show me first",
792
+ levelOff: "Not at all",
793
+ levelAuto: "Let Ta adjust",
794
+ levelLearn: "Ta learns from you: answers sent as written move a kind to “on its own”; changed or taken back, back to “show me first”",
795
+ question: "Question",
796
+ suggestion: "Suggestion",
797
+ correction: "Correction",
798
+ praise: "Praise",
799
+ negative: "Negative",
800
+ spam: "Ad",
801
+ noComments: "No comments read yet",
802
+ commentsHint: "Read after publishing: more often while comments come, less while none do",
803
+ commentsPace: "Reading comments",
804
+ paceHow: "How often",
805
+ paceAuto: "Auto",
806
+ paceHours: "Every {n} h",
807
+ paceDaily: "Daily",
808
+ paceFor: "For how long",
809
+ paceDays: "{n} days",
810
+ paceAutoNote: "Ta reads more often when many come (down to 1 h) and slows down when none do (up to 2 days); a new piece starts where the last ones settled",
811
+ paceNow: "Now about every {n} h",
812
+ paceFixedNote: "Each piece is read at this pace; Ta still learns, for when you go back to Auto",
813
+ flowDrafts: "{n} to answer",
814
+ flowComments: "{n} comments",
815
+ ledTo: "Made a topic",
816
+ strategy: "Strategy",
817
+ strategyAuto: "Learns itself",
818
+ strategyManual: "I decide",
819
+ strategyAutoHint: "Each review updates it; remove what you disagree with",
820
+ strategyManualHint: "Reviews only propose; it changes once you take them",
821
+ ruleMine: "Yours",
822
+ take: "Take",
823
+ decline: "No",
824
+ keepRule: "Keep",
825
+ addRule: "Add a rule",
826
+ ruleHint: "e.g. at least one article a week",
827
+ proposedRules: "Proposed",
828
+ phases: "Looking back",
829
+ phaseEvery: "Every {n} weeks",
830
+ phaseOff: "Off",
831
+ phaseNow: "Look back now",
832
+ phasePrompt: "Look back on this stage of my channel now: what was published, how the numbers and followers went, what the strategy was and what changed, what to change next; keep it and make it a topic of the channel’s own story",
833
+ noPhases: "Every few weeks Ta looks back on the stage; the look back can become a piece",
834
+ insideLabel: "In-company platforms",
835
+ insideHint: "They take only pieces for your company, such as an internal knowledge base",
836
+ insideName: "Name",
837
+ insideUrl: "Address of its publishing page",
838
+ addInside: "Add",
839
+ seriesInside: "In-company"
440
840
  };
441
841
  var ZH = {
442
842
  title: "创作者",
@@ -468,10 +868,8 @@ var ZH = {
468
868
  reviewEmpty: "没有等你审的",
469
869
  publishedEmpty: "还没有发布",
470
870
  open: "打开",
471
- pass: "通过,去发布",
472
871
  change: "改一句",
473
872
  changeAsk: "要改哪里?",
474
- approved: "已通过:Ta 填好发布页,你来点发布",
475
873
  views: "播放与浏览",
476
874
  follows: "新增关注",
477
875
  minutes: "本周花了你",
@@ -490,8 +888,144 @@ var ZH = {
490
888
  failed: "没做成:{error}",
491
889
  makePrompt: "做这条内容:{title}({id})",
492
890
  findPrompt: "现在给我的内容号找一批热点选题",
493
- passPrompt: "{id} 审过了:去各平台填好发布页,停在发布按钮前",
494
- changePrompt: "{id} 要改:{note}"
891
+ changePrompt: "{id} 要改:{note}",
892
+ all: "全部",
893
+ seriesNone: "未归入系列",
894
+ seriesLabel: "系列",
895
+ seriesHint: "同时做几个系列:选题按系列找,数据按系列复盘",
896
+ seriesName: "系列名",
897
+ seriesAbout: "讲什么、给谁看",
898
+ seriesOrdered: "由浅入深按期",
899
+ addSeries: "新系列",
900
+ episode: "第 {n} 期",
901
+ seriesStat: "已发 {published} · 待做 {waiting}",
902
+ remove: "删除",
903
+ removeAsk: "删除「{title}」?",
904
+ removeHint: "可以在下面的「已删除」里找回",
905
+ removedLabel: "已删除 {n}",
906
+ restore: "恢复",
907
+ pass: "通过,自动发布",
908
+ approved: "已通过:Ta 正在各平台发布",
909
+ passPrompt: "{id} 审过了:去各平台发布,发完记下链接",
910
+ queuedNext: "已通过:下一条就发它",
911
+ queuedAhead: "已通过:前面还有 {n} 条在发",
912
+ publishingNow: "正在发布",
913
+ slotNow: "立即",
914
+ stoppedNote: "没发出去:{note}",
915
+ publishAgain: "再发一次",
916
+ doingScript: "写脚本:开头 3 秒抓住人",
917
+ doingVisuals: "画画面:主播、终端、手机",
918
+ doingVoice: "逐个场景配音",
919
+ doingCaptions: "把字幕烧进画面",
920
+ doingVersions: "按平台改写标题和文案",
921
+ doingChecks: "检查 AI 标识、隐私和时长",
922
+ doneAll: "做好了,等你审",
923
+ flowSeries: "{n} 个系列",
924
+ flowNone: "暂无",
925
+ flowWaiting: "{n} 条等你审",
926
+ flowPassed: "已通过,发布中",
927
+ flowWeek: "本周 {n} 条",
928
+ flowMonday: "每周一复盘",
929
+ showAll: "展开全部 {n}",
930
+ showLess: "收起",
931
+ openChat: "打开",
932
+ publishedCount: "已发布",
933
+ totalViews: "累计播放",
934
+ lastWeek: "上周播放",
935
+ bySeries: "按系列",
936
+ byKind: "按类型",
937
+ byForm: "按形式",
938
+ byPlatform: "按平台",
939
+ perPiece: "条均播放",
940
+ completion: "完播 {n}%",
941
+ pieces: "{n} 条",
942
+ weekly: "每周播放",
943
+ top: "表现最好",
944
+ insights: "复盘结论",
945
+ insightsHint: "下一批选题照着调",
946
+ noInsights: "每周一复盘后,结论会出现在这里",
947
+ reviewNow: "现在复盘",
948
+ reviewPrompt: "现在复盘我的内容号:读各平台每条内容的数据,按系列、类型、形式对比,把结论记下来用于后面的选题",
949
+ viewsShort: "{n} 播放",
950
+ cancel: "取消",
951
+ noneYet: "还没有发布",
952
+ article: "长文",
953
+ note: "动态",
954
+ original: "原创",
955
+ talk: "互动",
956
+ materials: "等素材",
957
+ needsTitle: "等你的素材",
958
+ needsHint: "Ta 已先在工作目录里找过,剩下的在对话里发给 Ta",
959
+ giveNow: "去发素材",
960
+ skipNeeds: "不等了,先做",
961
+ skipPrompt: "{id} 不等素材了,用现有的先做",
962
+ flowMaterials: "{n} 条等素材",
963
+ public: "公开",
964
+ internal: "公司内",
965
+ both: "内外都发",
966
+ reachTip: "发布范围:点一下切换",
967
+ noInside: "这条要发公司内,但还没选公司内平台:在设置里添加",
968
+ drafts: "等你过目的回复",
969
+ autoSent: "最近的回复",
970
+ asked: "观众在问",
971
+ send: "发送",
972
+ dropReply: "不回",
973
+ withdraw: "撤回",
974
+ withdrawn: "已撤回",
975
+ sending: "稍后发出",
976
+ sent: "已发出",
977
+ autoTag: "Ta 自动回",
978
+ replyLevels: "回复方式",
979
+ levelAct: "自动回",
980
+ levelAsk: "先给我看",
981
+ levelOff: "不回",
982
+ levelAuto: "交给 Ta 调",
983
+ levelLearn: "Ta 会跟着你学:照发多了改成自动回,常改常撤就退回先给你看",
984
+ question: "提问",
985
+ suggestion: "建议",
986
+ correction: "纠错",
987
+ praise: "夸奖",
988
+ negative: "负面",
989
+ spam: "广告",
990
+ noComments: "还没有读到评论",
991
+ commentsHint: "发布后自动读评论:评论多就读得勤,没有就放慢",
992
+ commentsPace: "读评论",
993
+ paceHow: "多久读一次",
994
+ paceAuto: "自动",
995
+ paceHours: "每 {n} 小时",
996
+ paceDaily: "每天",
997
+ paceFor: "读多久",
998
+ paceDays: "{n} 天",
999
+ paceAutoNote: "Ta 按评论多少自己调:新评论多就读得勤(最快 1 小时),没有就放慢(最慢 2 天);新发布的从最近几条摸出的节奏开始",
1000
+ paceNow: "现在约每 {n} 小时一次",
1001
+ paceFixedNote: "每条都按这个节奏读;Ta 仍在学,切回自动时直接用上",
1002
+ flowDrafts: "{n} 条待回",
1003
+ flowComments: "{n} 条评论",
1004
+ ledTo: "已成选题",
1005
+ strategy: "策略",
1006
+ strategyAuto: "自动进化",
1007
+ strategyManual: "我来定",
1008
+ strategyAutoHint: "每次复盘自动更新,不认同的删掉就行",
1009
+ strategyManualHint: "复盘只提建议,你采纳才生效",
1010
+ ruleMine: "你定的",
1011
+ take: "采纳",
1012
+ decline: "不要",
1013
+ keepRule: "固定",
1014
+ addRule: "加一条规则",
1015
+ ruleHint: "比如:每周至少一篇长文",
1016
+ proposedRules: "复盘建议",
1017
+ phases: "阶段回顾",
1018
+ phaseEvery: "每 {n} 周",
1019
+ phaseOff: "不回顾",
1020
+ phaseNow: "现在回顾",
1021
+ phasePrompt: "现在回顾我的内容号这一阶段:发了什么、数据和粉丝怎么变、策略是什么又改了什么、下一阶段改什么;记下来,并做成一期讲这个号自己经历的选题",
1022
+ noPhases: "每隔几周 Ta 回顾一次这一阶段,回顾可以做成一期内容",
1023
+ insideLabel: "公司内平台",
1024
+ insideHint: "只发给公司内看的内容,比如内部知识库",
1025
+ insideName: "平台名",
1026
+ insideUrl: "发布页地址",
1027
+ addInside: "添加",
1028
+ seriesInside: "公司内"
495
1029
  };
496
1030
  var ZH_TW = {
497
1031
  title: "創作者",
@@ -523,10 +1057,8 @@ var ZH_TW = {
523
1057
  reviewEmpty: "沒有等你審的",
524
1058
  publishedEmpty: "還沒有發佈",
525
1059
  open: "打開",
526
- pass: "通過,去發佈",
527
1060
  change: "改一句",
528
1061
  changeAsk: "要改哪裡?",
529
- approved: "已通過:Ta 填好發佈頁,你來點發佈",
530
1062
  views: "播放與瀏覽",
531
1063
  follows: "新增追蹤",
532
1064
  minutes: "本週花了你",
@@ -545,8 +1077,144 @@ var ZH_TW = {
545
1077
  failed: "沒做成:{error}",
546
1078
  makePrompt: "做這條內容:{title}({id})",
547
1079
  findPrompt: "現在給我的內容號找一批熱點選題",
548
- passPrompt: "{id} 審過了:去各平台填好發佈頁,停在發佈按鈕前",
549
- changePrompt: "{id} 要改:{note}"
1080
+ changePrompt: "{id} 要改:{note}",
1081
+ all: "全部",
1082
+ seriesNone: "未歸入系列",
1083
+ seriesLabel: "系列",
1084
+ seriesHint: "同時做幾個系列:選題按系列找,數據按系列複盤",
1085
+ seriesName: "系列名",
1086
+ seriesAbout: "講什麼、給誰看",
1087
+ seriesOrdered: "由淺入深按期",
1088
+ addSeries: "新系列",
1089
+ episode: "第 {n} 期",
1090
+ seriesStat: "已發 {published} · 待做 {waiting}",
1091
+ remove: "刪除",
1092
+ removeAsk: "刪除「{title}」?",
1093
+ removeHint: "可以在下面的「已刪除」裡找回",
1094
+ removedLabel: "已刪除 {n}",
1095
+ restore: "恢復",
1096
+ pass: "通過,自動發佈",
1097
+ approved: "已通過:Ta 正在各平台發佈",
1098
+ passPrompt: "{id} 審過了:去各平台發佈,發完記下連結",
1099
+ queuedNext: "已通過:下一條就發它",
1100
+ queuedAhead: "已通過:前面還有 {n} 條在發",
1101
+ publishingNow: "正在發佈",
1102
+ slotNow: "立即",
1103
+ stoppedNote: "沒發出去:{note}",
1104
+ publishAgain: "再發一次",
1105
+ doingScript: "寫腳本:開頭 3 秒抓住人",
1106
+ doingVisuals: "畫畫面:主播、終端、手機",
1107
+ doingVoice: "逐個場景配音",
1108
+ doingCaptions: "把字幕燒進畫面",
1109
+ doingVersions: "按平台改寫標題和文案",
1110
+ doingChecks: "檢查 AI 標識、隱私和時長",
1111
+ doneAll: "做好了,等你審",
1112
+ flowSeries: "{n} 個系列",
1113
+ flowNone: "暫無",
1114
+ flowWaiting: "{n} 條等你審",
1115
+ flowPassed: "已通過,發佈中",
1116
+ flowWeek: "本週 {n} 條",
1117
+ flowMonday: "每週一複盤",
1118
+ showAll: "展開全部 {n}",
1119
+ showLess: "收起",
1120
+ openChat: "打開",
1121
+ publishedCount: "已發佈",
1122
+ totalViews: "累計播放",
1123
+ lastWeek: "上週播放",
1124
+ bySeries: "按系列",
1125
+ byKind: "按類型",
1126
+ byForm: "按形式",
1127
+ byPlatform: "按平台",
1128
+ perPiece: "條均播放",
1129
+ completion: "完播 {n}%",
1130
+ pieces: "{n} 條",
1131
+ weekly: "每週播放",
1132
+ top: "表現最好",
1133
+ insights: "複盤結論",
1134
+ insightsHint: "下一批選題照著調",
1135
+ noInsights: "每週一複盤後,結論會出現在這裡",
1136
+ reviewNow: "現在複盤",
1137
+ reviewPrompt: "現在複盤我的內容號:讀各平台每條內容的數據,按系列、類型、形式對比,把結論記下來用於後面的選題",
1138
+ viewsShort: "{n} 播放",
1139
+ cancel: "取消",
1140
+ noneYet: "還沒有發佈",
1141
+ article: "長文",
1142
+ note: "動態",
1143
+ original: "原創",
1144
+ talk: "互動",
1145
+ materials: "等素材",
1146
+ needsTitle: "等你的素材",
1147
+ needsHint: "Ta 已先在工作目錄裡找過,剩下的在對話裡發給 Ta",
1148
+ giveNow: "去發素材",
1149
+ skipNeeds: "不等了,先做",
1150
+ skipPrompt: "{id} 不等素材了,用現有的先做",
1151
+ flowMaterials: "{n} 條等素材",
1152
+ public: "公開",
1153
+ internal: "公司內",
1154
+ both: "內外都發",
1155
+ reachTip: "發佈範圍:點一下切換",
1156
+ noInside: "這條要發公司內,但還沒選公司內平台:在設定裡新增",
1157
+ drafts: "等你過目的回覆",
1158
+ autoSent: "最近的回覆",
1159
+ asked: "觀眾在問",
1160
+ send: "發送",
1161
+ dropReply: "不回",
1162
+ withdraw: "撤回",
1163
+ withdrawn: "已撤回",
1164
+ sending: "稍後發出",
1165
+ sent: "已發出",
1166
+ autoTag: "Ta 自動回",
1167
+ replyLevels: "回覆方式",
1168
+ levelAct: "自動回",
1169
+ levelAsk: "先給我看",
1170
+ levelOff: "不回",
1171
+ levelAuto: "交給 Ta 調",
1172
+ levelLearn: "Ta 會跟著你學:照發多了改成自動回,常改常撤就退回先給你看",
1173
+ question: "提問",
1174
+ suggestion: "建議",
1175
+ correction: "糾錯",
1176
+ praise: "稱讚",
1177
+ negative: "負面",
1178
+ spam: "廣告",
1179
+ noComments: "還沒有讀到留言",
1180
+ commentsHint: "發佈後自動讀評論:評論多就讀得勤,沒有就放慢",
1181
+ commentsPace: "讀評論",
1182
+ paceHow: "多久讀一次",
1183
+ paceAuto: "自動",
1184
+ paceHours: "每 {n} 小時",
1185
+ paceDaily: "每天",
1186
+ paceFor: "讀多久",
1187
+ paceDays: "{n} 天",
1188
+ paceAutoNote: "Ta 依評論多少自己調:新評論多就讀得勤(最快 1 小時),沒有就放慢(最慢 2 天);新發佈的從最近幾條摸出的節奏開始",
1189
+ paceNow: "現在約每 {n} 小時一次",
1190
+ paceFixedNote: "每條都照這個節奏讀;Ta 仍在學,切回自動時直接用上",
1191
+ flowDrafts: "{n} 條待回",
1192
+ flowComments: "{n} 條留言",
1193
+ ledTo: "已成選題",
1194
+ strategy: "策略",
1195
+ strategyAuto: "自動進化",
1196
+ strategyManual: "我來定",
1197
+ strategyAutoHint: "每次複盤自動更新,不認同的刪掉就行",
1198
+ strategyManualHint: "複盤只提建議,你採納才生效",
1199
+ ruleMine: "你定的",
1200
+ take: "採納",
1201
+ decline: "不要",
1202
+ keepRule: "固定",
1203
+ addRule: "加一條規則",
1204
+ ruleHint: "比如:每週至少一篇長文",
1205
+ proposedRules: "複盤建議",
1206
+ phases: "階段回顧",
1207
+ phaseEvery: "每 {n} 週",
1208
+ phaseOff: "不回顧",
1209
+ phaseNow: "現在回顧",
1210
+ phasePrompt: "現在回顧我的內容號這一階段:發了什麼、數據和粉絲怎麼變、策略是什麼又改了什麼、下一階段改什麼;記下來,並做成一期講這個號自己經歷的選題",
1211
+ noPhases: "每隔幾週 Ta 回顧一次這一階段,回顧可以做成一期內容",
1212
+ insideLabel: "公司內平台",
1213
+ insideHint: "只發給公司內看的內容,比如內部知識庫",
1214
+ insideName: "平台名",
1215
+ insideUrl: "發佈頁地址",
1216
+ addInside: "新增",
1217
+ seriesInside: "公司內"
550
1218
  };
551
1219
  var JA = {
552
1220
  title: "クリエイター",
@@ -578,10 +1246,8 @@ var JA = {
578
1246
  reviewEmpty: "確認待ちはありません",
579
1247
  publishedEmpty: "まだ公開していません",
580
1248
  open: "開く",
581
- pass: "OK、投稿へ",
582
1249
  change: "直す",
583
1250
  changeAsk: "どこを直しますか?",
584
- approved: "OK 済み:Ta が投稿ページに入力し、投稿はあなたが押します",
585
1251
  views: "再生と閲覧",
586
1252
  follows: "新規フォロワー",
587
1253
  minutes: "今週かかった時間",
@@ -600,8 +1266,144 @@ var JA = {
600
1266
  failed: "できませんでした:{error}",
601
1267
  makePrompt: "このコンテンツを作って:{title}({id})",
602
1268
  findPrompt: "私のチャンネル向けに今の話題からネタを探して",
603
- passPrompt: "{id} は確認済み:各プラットフォームの投稿ページに入力し、投稿ボタンの手前で止めて",
604
- changePrompt: "{id} を直して:{note}"
1269
+ changePrompt: "{id} を直して:{note}",
1270
+ all: "すべて",
1271
+ seriesNone: "シリーズなし",
1272
+ seriesLabel: "シリーズ",
1273
+ seriesHint: "複数のシリーズを同時に:ネタ探しも振り返りもシリーズごと",
1274
+ seriesName: "シリーズ名",
1275
+ seriesAbout: "何を、誰に向けて",
1276
+ seriesOrdered: "順に深める連載",
1277
+ addSeries: "新しいシリーズ",
1278
+ episode: "第 {n} 回",
1279
+ seriesStat: "公開 {published} · 待ち {waiting}",
1280
+ remove: "削除",
1281
+ removeAsk: "「{title}」を削除しますか?",
1282
+ removeHint: "下の「削除済み」から戻せます",
1283
+ removedLabel: "削除済み {n}",
1284
+ restore: "戻す",
1285
+ pass: "OK、自動で投稿",
1286
+ approved: "OK 済み:Ta が各プラットフォームに投稿中",
1287
+ passPrompt: "{id} は確認済み:各プラットフォームに投稿し、リンクを記録して",
1288
+ queuedNext: "OK 済み:次に投稿します",
1289
+ queuedAhead: "OK 済み:先に {n} 件を投稿します",
1290
+ publishingNow: "投稿中",
1291
+ slotNow: "すぐ",
1292
+ stoppedNote: "投稿できませんでした:{note}",
1293
+ publishAgain: "もう一度投稿",
1294
+ doingScript: "台本:最初の 3 秒でつかむ",
1295
+ doingVisuals: "映像:ホスト、ターミナル、スマホ",
1296
+ doingVoice: "シーンごとにナレーション",
1297
+ doingCaptions: "字幕を焼き込む",
1298
+ doingVersions: "プラットフォームごとにタイトルと文面",
1299
+ doingChecks: "AI 表示、個人情報、長さを確認",
1300
+ doneAll: "完成、確認待ち",
1301
+ flowSeries: "{n} シリーズ",
1302
+ flowNone: "なし",
1303
+ flowWaiting: "{n} 件が確認待ち",
1304
+ flowPassed: "OK 済み、投稿中",
1305
+ flowWeek: "今週 {n} 件",
1306
+ flowMonday: "毎週月曜に振り返り",
1307
+ showAll: "すべて表示 {n}",
1308
+ showLess: "閉じる",
1309
+ openChat: "開く",
1310
+ publishedCount: "公開済み",
1311
+ totalViews: "累計再生",
1312
+ lastWeek: "先週の再生",
1313
+ bySeries: "シリーズ別",
1314
+ byKind: "種類別",
1315
+ byForm: "形式別",
1316
+ byPlatform: "プラットフォーム別",
1317
+ perPiece: "1 件あたり再生",
1318
+ completion: "完走 {n}%",
1319
+ pieces: "{n} 件",
1320
+ weekly: "週ごとの再生",
1321
+ top: "好調だったもの",
1322
+ insights: "振り返りの結論",
1323
+ insightsHint: "次のネタはこれに沿って",
1324
+ noInsights: "毎週月曜の振り返りのあと、結論がここに出ます",
1325
+ reviewNow: "今すぐ振り返る",
1326
+ reviewPrompt: "私のチャンネルを今すぐ振り返って:各プラットフォームの各コンテンツのデータを読み、シリーズ・種類・形式で比べ、結論を今後のネタ選びのために記録して",
1327
+ viewsShort: "{n} 再生",
1328
+ cancel: "キャンセル",
1329
+ noneYet: "まだ公開なし",
1330
+ article: "記事",
1331
+ note: "短文",
1332
+ original: "オリジナル",
1333
+ talk: "コメント",
1334
+ materials: "素材待ち",
1335
+ needsTitle: "あなたの素材待ち",
1336
+ needsHint: "Ta が先に作業ディレクトリを探しました。残りは会話で送ってください",
1337
+ giveNow: "素材を送る",
1338
+ skipNeeds: "待たずに作る",
1339
+ skipPrompt: "{id}:素材を待たず、今あるもので作って",
1340
+ flowMaterials: "{n} 件が素材待ち",
1341
+ public: "公開",
1342
+ internal: "社内",
1343
+ both: "社内外",
1344
+ reachTip: "公開範囲:タップで切り替え",
1345
+ noInside: "社内向けですが社内プラットフォームが未選択です:設定で追加",
1346
+ drafts: "確認待ちの返信",
1347
+ autoSent: "最近の返信",
1348
+ asked: "視聴者の声",
1349
+ send: "送信",
1350
+ dropReply: "返信しない",
1351
+ withdraw: "取り消す",
1352
+ withdrawn: "取り消し済み",
1353
+ sending: "まもなく投稿",
1354
+ sent: "投稿済み",
1355
+ autoTag: "Ta が自動返信",
1356
+ replyLevels: "返信のしかた",
1357
+ levelAct: "自動で返信",
1358
+ levelAsk: "先に見せる",
1359
+ levelOff: "返信しない",
1360
+ levelAuto: "Ta に任せる",
1361
+ levelLearn: "Ta はあなたから学びます:そのまま送ることが多ければ自動に、直したり取り消したりが多ければ確認に戻ります",
1362
+ question: "質問",
1363
+ suggestion: "提案",
1364
+ correction: "指摘",
1365
+ praise: "称賛",
1366
+ negative: "否定的",
1367
+ spam: "広告",
1368
+ noComments: "まだコメントを読んでいません",
1369
+ commentsHint: "公開後に自動で読みます。コメントが多いほど頻繁に、ないときは間隔を空けます",
1370
+ commentsPace: "コメントの確認",
1371
+ paceHow: "頻度",
1372
+ paceAuto: "自動",
1373
+ paceHours: "{n} 時間ごと",
1374
+ paceDaily: "毎日",
1375
+ paceFor: "期間",
1376
+ paceDays: "{n} 日",
1377
+ paceAutoNote: "新しいコメントが多ければ頻繁に(最短 1 時間)、なければ間隔を空けます(最長 2 日)。新しい投稿は直近の投稿で落ち着いた間隔から始めます",
1378
+ paceNow: "今はおよそ {n} 時間ごと",
1379
+ paceFixedNote: "どの投稿もこの頻度で読みます。Ta は学び続け、自動に戻すとすぐ使います",
1380
+ flowDrafts: "返信待ち {n}",
1381
+ flowComments: "{n} 件のコメント",
1382
+ ledTo: "ネタになった",
1383
+ strategy: "戦略",
1384
+ strategyAuto: "自動で進化",
1385
+ strategyManual: "自分で決める",
1386
+ strategyAutoHint: "振り返りのたびに更新。合わないものは削除",
1387
+ strategyManualHint: "振り返りは提案だけ。採用すると反映",
1388
+ ruleMine: "あなたのルール",
1389
+ take: "採用",
1390
+ decline: "不要",
1391
+ keepRule: "固定",
1392
+ addRule: "ルールを追加",
1393
+ ruleHint: "例:毎週少なくとも 1 本の記事",
1394
+ proposedRules: "振り返りの提案",
1395
+ phases: "段階の振り返り",
1396
+ phaseEvery: "{n} 週ごと",
1397
+ phaseOff: "しない",
1398
+ phaseNow: "今すぐ振り返る",
1399
+ phasePrompt: "私のチャンネルのこの段階を今すぐ振り返って:何を公開し、数字とフォロワーはどう動き、戦略は何で何を変えたか、次に何を変えるか。記録し、このチャンネル自身の話としてネタにして",
1400
+ noPhases: "数週間ごとに Ta が段階を振り返ります。振り返りは 1 本のコンテンツにもなります",
1401
+ insideLabel: "社内プラットフォーム",
1402
+ insideHint: "社内向けのコンテンツだけを投稿(社内ナレッジベースなど)",
1403
+ insideName: "名前",
1404
+ insideUrl: "投稿ページのアドレス",
1405
+ addInside: "追加",
1406
+ seriesInside: "社内"
605
1407
  };
606
1408
  var WORDS = { "zh-CN": ZH, "zh-TW": ZH_TW, "en-US": EN, "ja-JP": JA };
607
1409
  var CreatorWords;
@@ -610,8 +1412,8 @@ var CreatorWords;
610
1412
  return TaLanguageUtil.pick(language, WORDS);
611
1413
  }
612
1414
  CreatorWords.of = of;
613
- function format(text2, values) {
614
- return text2.replace(/\{(\w+)\}/g, (all, key) => (key in values) ? String(values[key]) : all);
1415
+ function format(text3, values) {
1416
+ return text3.replace(/\{(\w+)\}/g, (all, key) => (key in values) ? String(values[key]) : all);
615
1417
  }
616
1418
  CreatorWords.format = format;
617
1419
  })(CreatorWords ||= {});
@@ -656,6 +1458,14 @@ async function openPiece(context, item) {
656
1458
  }
657
1459
  await talk(pi, item.title, format(useWordsOf(pi).makePrompt, { title: item.title, id: item.id }));
658
1460
  }
1461
+ async function tell(context, item, text3) {
1462
+ const { pi } = context;
1463
+ if (item.session && await pi.openChat?.(item.session)) {
1464
+ await pi.sendUserMessage(text3);
1465
+ } else {
1466
+ await talk(pi, item.title, text3);
1467
+ }
1468
+ }
659
1469
  function useWordsOf(pi) {
660
1470
  return CreatorWords.of(pi.ui.language);
661
1471
  }
@@ -669,18 +1479,93 @@ function PlatformName({ platform, bare }) {
669
1479
  style: { background: platform.color }
670
1480
  }), !bare && platform.name);
671
1481
  }
672
- function Steps({ item, words }) {
1482
+ var STEP_ICONS = { script: "FileText", visuals: "Image", voice: "Mic", captions: "Text", versions: "Columns2", checks: "ShieldCheck" };
1483
+ var DOING = {
1484
+ script: "doingScript",
1485
+ visuals: "doingVisuals",
1486
+ voice: "doingVoice",
1487
+ captions: "doingCaptions",
1488
+ versions: "doingVersions",
1489
+ checks: "doingChecks"
1490
+ };
1491
+ function stepOf(item) {
673
1492
  const done = new Set(item.done ?? []);
674
- const next = STEPS.find((step) => !done.has(step));
675
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
676
- className: "tcre-steps",
677
- "aria-hidden": true
678
- }, STEPS.map((step) => /* @__PURE__ */ React.createElement("i", {
679
- key: step,
680
- "data-state": done.has(step) ? "done" : step === next ? "now" : undefined
681
- }))), /* @__PURE__ */ React.createElement("div", {
682
- className: "tcre-steps-label"
683
- }, /* @__PURE__ */ React.createElement("span", null, STEPS.map((step) => words[step]).join(" · ")), /* @__PURE__ */ React.createElement("span", null, next ? words[next] : words.review)));
1493
+ return STEPS.find((step) => !done.has(step));
1494
+ }
1495
+ function doing(words, step) {
1496
+ return step ? words[DOING[step]] : words.doneAll;
1497
+ }
1498
+ function Pipeline({ pi, item, words, color }) {
1499
+ const done = new Set(item.done ?? []);
1500
+ const now = stepOf(item);
1501
+ const { Check } = pi.ui.icons;
1502
+ return /* @__PURE__ */ React.createElement("div", {
1503
+ className: "tcre-pipe-wrap",
1504
+ style: color ? { "--tcre-c": color } : undefined
1505
+ }, /* @__PURE__ */ React.createElement("ol", {
1506
+ className: "tcre-pipe"
1507
+ }, STEPS.map((step) => {
1508
+ const Icon = pi.ui.icons[STEP_ICONS[step]];
1509
+ const state = done.has(step) ? "done" : step === now ? "now" : "todo";
1510
+ return /* @__PURE__ */ React.createElement("li", {
1511
+ key: step,
1512
+ "data-state": state
1513
+ }, /* @__PURE__ */ React.createElement("span", {
1514
+ className: "tcre-pipe-dot"
1515
+ }, state === "done" ? /* @__PURE__ */ React.createElement(Check, {
1516
+ size: 14,
1517
+ strokeWidth: 3
1518
+ }) : Icon && /* @__PURE__ */ React.createElement(Icon, {
1519
+ size: 15
1520
+ })), /* @__PURE__ */ React.createElement("span", {
1521
+ className: "tcre-pipe-label"
1522
+ }, words[step]));
1523
+ })), /* @__PURE__ */ React.createElement("div", {
1524
+ className: "tcre-pipe-now",
1525
+ "data-done": now ? undefined : true
1526
+ }, now && /* @__PURE__ */ React.createElement("i", {
1527
+ className: "tcre-pulse"
1528
+ }), doing(words, now)));
1529
+ }
1530
+ function SeriesTag({ series, number, words }) {
1531
+ if (!series && !number) {
1532
+ return null;
1533
+ }
1534
+ return /* @__PURE__ */ React.createElement("span", {
1535
+ className: "tcre-series-tag",
1536
+ style: series ? { "--tcre-c": series.color } : undefined
1537
+ }, series && /* @__PURE__ */ React.createElement("i", null), series?.name, number ? /* @__PURE__ */ React.createElement("b", null, format(words.episode, { n: number })) : null);
1538
+ }
1539
+ function seriesOf(context, id) {
1540
+ return id ? context.store.state.settings.series.find((one) => one.id === id) : undefined;
1541
+ }
1542
+ function IconButton({ pi, icon, label, onClick }) {
1543
+ const Icon = pi.ui.icons[icon];
1544
+ const [busy, run] = pi.ui.useBusy();
1545
+ return /* @__PURE__ */ React.createElement("button", {
1546
+ type: "button",
1547
+ className: "tcre-icon",
1548
+ "aria-label": label,
1549
+ title: label,
1550
+ disabled: busy,
1551
+ onClick: (event) => {
1552
+ event.stopPropagation();
1553
+ run(() => Promise.resolve().then(onClick).catch(failed(pi)));
1554
+ }
1555
+ }, Icon && /* @__PURE__ */ React.createElement(Icon, {
1556
+ size: 15
1557
+ }));
1558
+ }
1559
+ async function remove(context, item) {
1560
+ const { pi, store } = context;
1561
+ const words = useWordsOf(pi);
1562
+ if (item.stage !== "topic") {
1563
+ const sure = await pi.ui.confirm(format(words.removeAsk, { title: item.title }), words.removeHint, { confirmLabel: words.remove, danger: true });
1564
+ if (!sure) {
1565
+ return;
1566
+ }
1567
+ }
1568
+ await store.call("remove", item.id);
684
1569
  }
685
1570
  function short(n, language) {
686
1571
  return new Intl.NumberFormat(language, { notation: n >= 1e4 ? "compact" : "standard", maximumFractionDigits: 1 }).format(n);
@@ -692,6 +1577,7 @@ function BusyButton({
692
1577
  pi,
693
1578
  className,
694
1579
  disabled,
1580
+ pressed,
695
1581
  onClick,
696
1582
  children
697
1583
  }) {
@@ -700,6 +1586,7 @@ function BusyButton({
700
1586
  type: "button",
701
1587
  className: busy ? `${className} ta-busy` : className,
702
1588
  disabled,
1589
+ "aria-pressed": pressed,
703
1590
  onClick: () => void run(() => Promise.resolve().then(onClick).catch(failed(pi)))
704
1591
  }, busy && /* @__PURE__ */ React.createElement("span", {
705
1592
  className: "ta-spinner ta-busy-mark"
@@ -708,14 +1595,15 @@ function BusyButton({
708
1595
 
709
1596
  // web-src/cards.tsx
710
1597
  var VIDEO = /\.(mp4|mov|webm|m4v)$/i;
1598
+ var IMAGE = /\.(png|jpe?g|webp|gif)$/i;
711
1599
  function useFileUrl(context, path) {
712
- const [url, setUrl] = React.useState();
1600
+ const [url2, setUrl] = React.useState();
713
1601
  React.useEffect(() => {
714
1602
  let live = true;
715
1603
  setUrl(undefined);
716
1604
  if (path) {
717
1605
  const { pi } = context;
718
- pi.workspace.fileUrl(path).then((url2) => pi.files.loadable(url2)).then((got) => live && setUrl(got), () => {
1606
+ pi.workspace.fileUrl(path).then((url3) => pi.files.loadable(url3)).then((got) => live && setUrl(got), () => {
719
1607
  return;
720
1608
  });
721
1609
  }
@@ -723,25 +1611,27 @@ function useFileUrl(context, path) {
723
1611
  live = false;
724
1612
  };
725
1613
  }, [path]);
726
- return url;
1614
+ return url2;
727
1615
  }
728
1616
  function Preview({ context, version }) {
729
- const file = version?.files[0];
730
- const url = useFileUrl(context, file);
1617
+ const file = version?.files.find((one) => VIDEO.test(one) || IMAGE.test(one));
1618
+ const url2 = useFileUrl(context, file);
731
1619
  const cover = useFileUrl(context, version?.cover);
732
1620
  const words = useWords(context.pi);
733
1621
  return /* @__PURE__ */ React.createElement("div", {
734
1622
  className: "tcre-preview"
735
- }, url && file && VIDEO.test(file) ? /* @__PURE__ */ React.createElement("video", {
736
- src: url,
1623
+ }, url2 && file && VIDEO.test(file) ? /* @__PURE__ */ React.createElement("video", {
1624
+ src: url2,
737
1625
  poster: cover,
738
1626
  controls: true,
739
1627
  playsInline: true,
740
1628
  preload: "metadata"
741
- }) : url ? /* @__PURE__ */ React.createElement("img", {
742
- src: url,
1629
+ }) : url2 ? /* @__PURE__ */ React.createElement("img", {
1630
+ src: url2,
743
1631
  alt: ""
744
- }) : /* @__PURE__ */ React.createElement("div", {
1632
+ }) : version?.text && !file ? /* @__PURE__ */ React.createElement("div", {
1633
+ className: "tcre-preview-words"
1634
+ }, version.text) : /* @__PURE__ */ React.createElement("div", {
745
1635
  className: "tcre-preview-empty"
746
1636
  }, version ? "" : words.versions), /* @__PURE__ */ React.createElement("span", {
747
1637
  className: "tcre-ai"
@@ -749,23 +1639,26 @@ function Preview({ context, version }) {
749
1639
  className: "tcre-count"
750
1640
  }, "1/", version.files.length));
751
1641
  }
752
- function ReviewCard({ context, item, send }) {
1642
+ function ReviewCard({
1643
+ context,
1644
+ item,
1645
+ send,
1646
+ onRemove
1647
+ }) {
753
1648
  const { pi, store } = context;
754
1649
  const words = useWords(pi);
1650
+ const [more, setMore] = React.useState(false);
755
1651
  const versions = item.versions ?? [];
756
1652
  const [shown, setShown] = React.useState(0);
757
1653
  const opened = React.useRef(Date.now());
758
1654
  const version = versions[Math.min(shown, versions.length - 1)];
759
1655
  const minutes = () => Math.min(30, Math.max(1, Math.round((Date.now() - opened.current) / 60000)));
760
- const say = async (text2) => {
761
- if (send) {
762
- await send(text2);
763
- } else if (item.session && await pi.openChat?.(item.session)) {
764
- await pi.sendUserMessage(text2);
765
- } else {
766
- await talk(pi, item.title, text2);
767
- }
768
- };
1656
+ const say = (text3) => send ? send(text3) : tell(context, item, text3);
1657
+ const state = useStore(store);
1658
+ const reach = CreatorUtil.reach(item, state.settings);
1659
+ const open = item.stage === "review" && !item.approved;
1660
+ const inside = CreatorUtil.picked(state.settings).some((one) => one.internal);
1661
+ const nextReach = () => store.call("update", item.id, { reach: REACHES[(REACHES.indexOf(reach) + 1) % REACHES.length] });
769
1662
  const change = async () => {
770
1663
  const note = (await pi.ui.input(words.changeAsk))?.trim();
771
1664
  if (note) {
@@ -774,12 +1667,34 @@ function ReviewCard({ context, item, send }) {
774
1667
  }
775
1668
  };
776
1669
  const pass = async () => {
777
- await store.call("approve", item.id, minutes());
778
- await say(format(words.passPrompt, { id: item.id }));
1670
+ await store.call("approve", item.id, minutes(), format(words.passPrompt, { id: item.id }));
779
1671
  };
780
1672
  return /* @__PURE__ */ React.createElement("div", {
781
1673
  className: "tcre-card tcre-review"
782
- }, /* @__PURE__ */ React.createElement(Preview, {
1674
+ }, (item.series || onRemove || reach !== "public" || open) && /* @__PURE__ */ React.createElement("div", {
1675
+ className: "tcre-review-head"
1676
+ }, /* @__PURE__ */ React.createElement(SeriesTag, {
1677
+ series: seriesOf(context, item.series),
1678
+ number: item.number,
1679
+ words
1680
+ }), /* @__PURE__ */ React.createElement("span", {
1681
+ className: "tcre-grow"
1682
+ }), open ? /* @__PURE__ */ React.createElement(BusyButton, {
1683
+ pi,
1684
+ className: "tcre-reach",
1685
+ onClick: nextReach
1686
+ }, /* @__PURE__ */ React.createElement("span", {
1687
+ title: words.reachTip,
1688
+ "data-reach": reach
1689
+ }, words[reach])) : reach !== "public" && /* @__PURE__ */ React.createElement("span", {
1690
+ className: "tcre-reach",
1691
+ "data-reach": reach
1692
+ }, words[reach]), onRemove && /* @__PURE__ */ React.createElement(IconButton, {
1693
+ pi,
1694
+ icon: "Trash2",
1695
+ label: words.remove,
1696
+ onClick: onRemove
1697
+ })), /* @__PURE__ */ React.createElement(Preview, {
783
1698
  context,
784
1699
  version
785
1700
  }), versions.length > 1 && /* @__PURE__ */ React.createElement("div", {
@@ -794,10 +1709,15 @@ function ReviewCard({ context, item, send }) {
794
1709
  onClick: () => setShown(at)
795
1710
  }, /* @__PURE__ */ React.createElement(PlatformName, {
796
1711
  platform: platformOf(context, one.platform) ?? { id: one.platform, name: one.platform, color: "var(--ta-muted)" }
797
- })))), /* @__PURE__ */ React.createElement("div", {
1712
+ }), one.form && one.form !== item.form && /* @__PURE__ */ React.createElement("em", {
1713
+ className: "tcre-tab-form"
1714
+ }, words[one.form])))), /* @__PURE__ */ React.createElement("div", {
798
1715
  className: "tcre-review-title"
799
- }, version?.title || item.title), version?.text && /* @__PURE__ */ React.createElement("p", {
800
- className: "tcre-review-text"
1716
+ }, version?.title || item.title), version?.text && /* @__PURE__ */ React.createElement("button", {
1717
+ type: "button",
1718
+ className: "tcre-review-text",
1719
+ "data-open": more || undefined,
1720
+ onClick: () => setMore(!more)
801
1721
  }, version.text), !!version?.tags.length && /* @__PURE__ */ React.createElement("div", {
802
1722
  className: "tcre-tags"
803
1723
  }, version.tags.map((tag) => `#${tag}`).join(" ")), item.origin && /* @__PURE__ */ React.createElement("div", {
@@ -807,9 +1727,12 @@ function ReviewCard({ context, item, send }) {
807
1727
  }, item.checks.map((check) => /* @__PURE__ */ React.createElement("span", {
808
1728
  key: check.text,
809
1729
  "data-ok": check.ok || undefined
810
- }, /* @__PURE__ */ React.createElement("i", null, check.ok ? "✓" : "!"), check.text))), item.approved ? /* @__PURE__ */ React.createElement("div", {
811
- className: "tcre-approved"
812
- }, words.approved) : item.stage === "review" && /* @__PURE__ */ React.createElement("div", {
1730
+ }, /* @__PURE__ */ React.createElement("i", null, check.ok ? "✓" : "!"), check.text))), open && reach !== "public" && !inside && /* @__PURE__ */ React.createElement("div", {
1731
+ className: "tcre-notice"
1732
+ }, words.noInside), item.approved ? /* @__PURE__ */ React.createElement(Publishing, {
1733
+ context,
1734
+ item
1735
+ }) : item.stage === "review" && /* @__PURE__ */ React.createElement("div", {
813
1736
  className: "tcre-buttons"
814
1737
  }, /* @__PURE__ */ React.createElement(BusyButton, {
815
1738
  pi,
@@ -821,14 +1744,59 @@ function ReviewCard({ context, item, send }) {
821
1744
  onClick: pass
822
1745
  }, words.pass)));
823
1746
  }
1747
+ function Publishing({ context, item }) {
1748
+ const { pi, store } = context;
1749
+ const words = useWords(pi);
1750
+ const state = useStore(store);
1751
+ const publishing = item.publishing;
1752
+ if (publishing?.state === "stopped") {
1753
+ return /* @__PURE__ */ React.createElement("div", {
1754
+ className: "tcre-approved",
1755
+ "data-tone": "warn"
1756
+ }, /* @__PURE__ */ React.createElement("span", null, format(words.stoppedNote, { note: publishing.note || "—" })), /* @__PURE__ */ React.createElement(BusyButton, {
1757
+ pi,
1758
+ className: "tcre-secondary",
1759
+ onClick: () => store.call("approve", item.id, 0, format(words.passPrompt, { id: item.id }))
1760
+ }, words.publishAgain));
1761
+ }
1762
+ if (publishing?.state === "running") {
1763
+ const two = (n) => String(n).padStart(2, "0");
1764
+ const when = (at) => at ? `${new Date(at).getMonth() + 1}-${new Date(at).getDate()} ${two(new Date(at).getHours())}:${two(new Date(at).getMinutes())}` : words.slotNow;
1765
+ return /* @__PURE__ */ React.createElement("div", {
1766
+ className: "tcre-approved"
1767
+ }, /* @__PURE__ */ React.createElement("span", null, words.publishingNow), (publishing.slots ?? []).map((slot) => /* @__PURE__ */ React.createElement("span", {
1768
+ key: slot.platform,
1769
+ className: "tcre-slot"
1770
+ }, /* @__PURE__ */ React.createElement(PlatformName, {
1771
+ platform: platformOf(context, slot.platform) ?? { id: slot.platform, name: slot.platform, color: "var(--ta-muted)" }
1772
+ }), when(slot.at))));
1773
+ }
1774
+ if (publishing?.state === "queued") {
1775
+ const n = PublishUtil.ahead(state.items, item.id);
1776
+ return /* @__PURE__ */ React.createElement("div", {
1777
+ className: "tcre-approved"
1778
+ }, n ? format(words.queuedAhead, { n }) : words.queuedNext);
1779
+ }
1780
+ return /* @__PURE__ */ React.createElement("div", {
1781
+ className: "tcre-approved"
1782
+ }, words.approved);
1783
+ }
824
1784
  function reviewBlock(context) {
825
- return function Review({ code, closed, send }) {
1785
+ return function Review({ code, closed, send, conversation }) {
826
1786
  const state = useStore(context.store);
1787
+ const id = closed ? ReviewCode.id(code) : undefined;
1788
+ const item = id ? state.items.find((one) => one.id === id) : undefined;
1789
+ const bind2 = item && conversation && !item.session && item.stage === "review" ? item.id : undefined;
1790
+ React.useEffect(() => {
1791
+ if (bind2 && conversation) {
1792
+ context.store.call("update", bind2, { session: conversation }).catch(() => {
1793
+ return;
1794
+ });
1795
+ }
1796
+ }, [bind2, conversation]);
827
1797
  if (!closed) {
828
1798
  return null;
829
1799
  }
830
- const id = ReviewCode.id(code);
831
- const item = id ? state.items.find((one) => one.id === id) : undefined;
832
1800
  if (!item) {
833
1801
  return state.loaded ? /* @__PURE__ */ React.createElement("pre", null, code) : null;
834
1802
  }
@@ -852,12 +1820,266 @@ var ReviewCode;
852
1820
  ReviewCode.id = id;
853
1821
  })(ReviewCode ||= {});
854
1822
 
1823
+ // web-src/channel-util.ts
1824
+ var HOUR = 3600000;
1825
+ var DAY2 = 24 * HOUR;
1826
+ var MAX_COMMENTS = 600;
1827
+ var COMMENTS_FOR = 60 * DAY2;
1828
+ var MAX_LESSONS = 40;
1829
+ var ChannelUtil;
1830
+ ((ChannelUtil) => {
1831
+ function analysis(items, settings) {
1832
+ const published = items.filter((one) => one.stage === "published" && !one.dropped);
1833
+ const measured = published.filter((one) => one.stats?.length);
1834
+ const group = (key, of) => {
1835
+ const read = of.filter((one) => one.stats?.length);
1836
+ const total = read.reduce((all, one) => all + (CreatorUtil.views(one) ?? 0), 0);
1837
+ const watched = read.flatMap((one) => (one.stats ?? []).filter((stat) => stat.completion !== undefined));
1838
+ const weight = watched.reduce((all, one) => all + Math.max(1, one.views), 0);
1839
+ return {
1840
+ key,
1841
+ count: of.length,
1842
+ measured: read.length,
1843
+ views: total,
1844
+ average: read.length ? Math.round(total / read.length) : 0,
1845
+ ...watched.length ? { completion: watched.reduce((all, one) => all + (one.completion ?? 0) * Math.max(1, one.views), 0) / weight } : {}
1846
+ };
1847
+ };
1848
+ const known = new Set(settings.series.map((one) => one.id));
1849
+ const none = published.filter((one) => !one.series || !known.has(one.series));
1850
+ const platforms = [...new Set(measured.flatMap((one) => (one.stats ?? []).map((stat) => stat.platform)))].map((platform) => {
1851
+ const stats = measured.flatMap((one) => (one.stats ?? []).filter((stat) => stat.platform === platform));
1852
+ const total = stats.reduce((all, one) => all + one.views, 0);
1853
+ return { key: platform, count: stats.length, measured: stats.length, views: total, average: stats.length ? Math.round(total / stats.length) : 0 };
1854
+ });
1855
+ return {
1856
+ published: published.length,
1857
+ measured: measured.length,
1858
+ views: measured.reduce((all, one) => all + (CreatorUtil.views(one) ?? 0), 0),
1859
+ series: [
1860
+ ...settings.series.map((one) => group(one.id, published.filter((item) => item.series === one.id))),
1861
+ ...none.length ? [group("", none)] : []
1862
+ ],
1863
+ kinds: KINDS.map((kind) => group(kind, published.filter((one) => one.kind === kind))).filter((one) => one.count),
1864
+ forms: FORMS.map((form) => group(form, published.filter((one) => one.form === form))).filter((one) => one.count),
1865
+ platforms: platforms.sort((a, b) => b.views - a.views),
1866
+ top: measured.map((item) => ({ item, views: CreatorUtil.views(item) ?? 0 })).sort((a, b) => b.views - a.views).slice(0, 5)
1867
+ };
1868
+ }
1869
+ ChannelUtil.analysis = analysis;
1870
+ function insights(value) {
1871
+ const all = (Array.isArray(value) ? value : []).map((one) => object2(one)).filter((one) => !!one && !!text2(one.text, 300) && !!time2(one.at)).map((one) => {
1872
+ const at = time2(one.at);
1873
+ const words = text2(one.text, 300);
1874
+ return {
1875
+ id: text2(one.id, 60) || `i${hash(words + at)}`,
1876
+ text: words,
1877
+ tone: oneOf(["good", "bad", "idea"], one.tone, "idea"),
1878
+ ...text2(one.series, 60) ? { series: text2(one.series, 60) } : {},
1879
+ ...one.by === "user" ? { by: "user" } : {},
1880
+ ...one.state === "proposed" || one.state === "declined" ? { state: one.state } : {},
1881
+ at
1882
+ };
1883
+ }).sort((a, b) => b.at - a.at);
1884
+ const mine = all.filter((one) => one.by === "user");
1885
+ const ta = all.filter((one) => one.by !== "user").slice(0, 30);
1886
+ return [...mine, ...ta].sort((a, b) => b.at - a.at);
1887
+ }
1888
+ ChannelUtil.insights = insights;
1889
+ function addInsights(kept, added, series, now, mode = "auto") {
1890
+ const read = added.map((one) => typeof one === "string" ? { text: one } : object2(one)).filter((one) => !!one).map((one, at) => ({
1891
+ ...one,
1892
+ id: `i${now.toString(36)}${at}`,
1893
+ by: undefined,
1894
+ series: CreatorUtil.seriesNamed(series, one.series)?.id,
1895
+ ...mode === "manual" ? { state: "proposed" } : { state: undefined },
1896
+ at: now
1897
+ }));
1898
+ return insights([...read, ...kept.filter((one) => one.state !== "proposed")]);
1899
+ }
1900
+ ChannelUtil.addInsights = addInsights;
1901
+ function addRule(kept, words, series, now, seriesId) {
1902
+ const rule = text2(words, 300);
1903
+ if (!rule) {
1904
+ throw new Error("A rule needs its words.");
1905
+ }
1906
+ return insights([
1907
+ { id: `u${now.toString(36)}`, text: rule, tone: "idea", by: "user", series: CreatorUtil.seriesNamed(series, seriesId)?.id, at: now },
1908
+ ...kept
1909
+ ]);
1910
+ }
1911
+ ChannelUtil.addRule = addRule;
1912
+ function decideRule(kept, id, action) {
1913
+ const rule = kept.find((one) => one.id === id);
1914
+ if (!rule) {
1915
+ throw new Error(`No such rule: ${id}.`);
1916
+ }
1917
+ const changed = (patch) => insights(kept.map((one) => one.id === id ? { ...one, ...patch, state: patch.state } : one));
1918
+ switch (action) {
1919
+ case "take":
1920
+ return changed({ state: undefined });
1921
+ case "decline":
1922
+ case "remove":
1923
+ return rule.by === "user" ? insights(kept.filter((one) => one.id !== id)) : changed({ state: "declined" });
1924
+ case "keep":
1925
+ return changed({ by: "user", state: undefined });
1926
+ default:
1927
+ throw new Error(`An answer to a rule is take, decline, keep or remove: ${action}.`);
1928
+ }
1929
+ }
1930
+ ChannelUtil.decideRule = decideRule;
1931
+ function latestInsights(insights2) {
1932
+ const ta = insights2.filter((one) => one.by !== "user" && !one.state);
1933
+ const newest = ta[0]?.at ?? 0;
1934
+ return insights2.filter((one) => one.by === "user" || !one.state && newest - one.at < DAY2);
1935
+ }
1936
+ ChannelUtil.latestInsights = latestInsights;
1937
+ function proposed(insights2) {
1938
+ return insights2.filter((one) => one.state === "proposed");
1939
+ }
1940
+ ChannelUtil.proposed = proposed;
1941
+ function phases(value) {
1942
+ return (Array.isArray(value) ? value : []).map((one) => object2(one)).filter((one) => !!one && !!time2(one.from) && !!time2(one.to) && !!text2(one.summary, 2000) && !!time2(one.at)).map((one) => ({
1943
+ from: time2(one.from),
1944
+ to: time2(one.to),
1945
+ summary: text2(one.summary, 2000),
1946
+ ...text2(one.topic, 80) ? { topic: text2(one.topic, 80) } : {},
1947
+ at: time2(one.at)
1948
+ })).sort((a, b) => b.at - a.at).slice(0, 24);
1949
+ }
1950
+ ChannelUtil.phases = phases;
1951
+ function phaseDue(settings, items, phases2, now) {
1952
+ if (!settings.phaseWeeks) {
1953
+ return;
1954
+ }
1955
+ const published = items.filter((one) => one.stage === "published" && !one.dropped).map(CreatorUtil.publishedAt);
1956
+ const from = phases2[0]?.to ?? (published.length ? Math.min(...published) : undefined);
1957
+ if (from === undefined || now - from < settings.phaseWeeks * 7 * DAY2 || !published.some((at) => at >= from)) {
1958
+ return;
1959
+ }
1960
+ return { from, to: now };
1961
+ }
1962
+ ChannelUtil.phaseDue = phaseDue;
1963
+ function needsOf(values, now) {
1964
+ return values.map((one, at) => CreatorUtil.need(typeof one === "string" ? { text: one } : { id: `n${now.toString(36)}${at}`, ...object2(one) ?? {} })).filter((one) => !!one).map((one, at) => one.id ? one : { ...one, id: `n${now.toString(36)}${at}` }).slice(0, 12);
1965
+ }
1966
+ ChannelUtil.needsOf = needsOf;
1967
+ function given(item) {
1968
+ return (item.needs ?? []).every((one) => one.done);
1969
+ }
1970
+ ChannelUtil.given = given;
1971
+ ChannelUtil.PACE = { start: 6 * HOUR, first: 12 * HOUR, min: HOUR, max: 2 * DAY2, many: 3 };
1972
+ function nextGap(gap, added) {
1973
+ if (added >= ChannelUtil.PACE.many) {
1974
+ return Math.max(ChannelUtil.PACE.min, Math.round(gap / 2));
1975
+ }
1976
+ return added ? gap : Math.min(ChannelUtil.PACE.max, gap * 2);
1977
+ }
1978
+ ChannelUtil.nextGap = nextGap;
1979
+ function firstGap(items) {
1980
+ const gaps = items.filter((one) => one.commentsGap).sort((a, b) => (b.commentsAt ?? 0) - (a.commentsAt ?? 0)).slice(0, 5).map((one) => one.commentsGap).sort((a, b) => a - b);
1981
+ return gaps.length ? Math.max(ChannelUtil.PACE.min, Math.min(ChannelUtil.PACE.first, gaps[Math.floor(gaps.length / 2)])) : ChannelUtil.PACE.start;
1982
+ }
1983
+ ChannelUtil.firstGap = firstGap;
1984
+ function commentsGap(item, items, settings) {
1985
+ return settings.commentsEvery ? settings.commentsEvery * HOUR : item.commentsGap ?? firstGap(items);
1986
+ }
1987
+ ChannelUtil.commentsGap = commentsGap;
1988
+ function comments(value, now = Date.now()) {
1989
+ return (Array.isArray(value) ? value : []).map(comment).filter((one) => !!one && now - one.at < COMMENTS_FOR).sort((a, b) => a.at - b.at).slice(-MAX_COMMENTS);
1990
+ }
1991
+ ChannelUtil.comments = comments;
1992
+ function addComments(kept, item, input, levels, now, id) {
1993
+ const all = [...kept];
1994
+ const added = [];
1995
+ for (const value of input) {
1996
+ const read = object2(value);
1997
+ const platform = text2(read?.platform, 60);
1998
+ const words = text2(read?.text, 1000);
1999
+ if (!read || !platform || !words) {
2000
+ continue;
2001
+ }
2002
+ const key = text2(read.key, 120) || `t${hash(words)}`;
2003
+ const cls = oneOf(COMMENT_CLASSES, read.class, "question");
2004
+ const level = REPLY_CLASSES.includes(cls) ? levels[cls] : "off";
2005
+ const answer = text2(read.reply, 500);
2006
+ const reply = answer && level !== "off" ? level === "act" && read.sent === true ? { text: answer, state: "sent", auto: true, at: now } : { text: answer, state: "draft", at: now } : undefined;
2007
+ const at = all.findIndex((one) => one.item === item && one.platform === platform && one.key === key);
2008
+ if (at >= 0) {
2009
+ const before = all[at];
2010
+ const open = !before.reply || before.reply.state === "draft";
2011
+ all[at] = {
2012
+ ...before,
2013
+ ...typeof read.likes === "number" ? { likes: count(read.likes, 0) } : {},
2014
+ ...open && reply ? { reply } : {}
2015
+ };
2016
+ continue;
2017
+ }
2018
+ const made = {
2019
+ id: id(),
2020
+ item,
2021
+ platform,
2022
+ key,
2023
+ text: words,
2024
+ class: cls,
2025
+ ...typeof read.likes === "number" ? { likes: count(read.likes, 0) } : {},
2026
+ ...reply ? { reply } : {},
2027
+ at: now
2028
+ };
2029
+ all.push(made);
2030
+ added.push(made);
2031
+ }
2032
+ return { comments: comments(all, now), added };
2033
+ }
2034
+ ChannelUtil.addComments = addComments;
2035
+ function examples(comments2, max = 8) {
2036
+ return comments2.filter((one) => one.reply?.draft && (one.reply.state === "approved" || one.reply.state === "sent")).sort((a, b) => (b.reply?.at ?? 0) - (a.reply?.at ?? 0)).slice(0, max).map((one) => ({ comment: one.text, draft: one.reply?.draft ?? "", sent: one.reply?.text ?? "" }));
2037
+ }
2038
+ ChannelUtil.examples = examples;
2039
+ function lessons(value) {
2040
+ return (Array.isArray(value) ? value : []).map((one) => object2(one)).filter((one) => !!one && !!text2(one.text, 300) && !!time2(one.at)).map((one) => ({ text: text2(one.text, 300), item: text2(one.item, 80), at: time2(one.at) })).sort((a, b) => b.at - a.at).slice(0, MAX_LESSONS);
2041
+ }
2042
+ ChannelUtil.lessons = lessons;
2043
+ function comment(value) {
2044
+ const kept = object2(value);
2045
+ const id = text2(kept?.id, 80);
2046
+ const words = text2(kept?.text, 1000);
2047
+ const at = time2(kept?.at);
2048
+ if (!kept || !id || !words || !at || !text2(kept.item, 80) || !text2(kept.platform, 60)) {
2049
+ return;
2050
+ }
2051
+ const reply = object2(kept.reply);
2052
+ const answer = text2(reply?.text, 500);
2053
+ const draft = text2(reply?.draft, 500);
2054
+ return {
2055
+ id,
2056
+ item: text2(kept.item, 80),
2057
+ platform: text2(kept.platform, 60),
2058
+ key: text2(kept.key, 120) || `t${hash(words)}`,
2059
+ text: words,
2060
+ class: oneOf(COMMENT_CLASSES, kept.class, "question"),
2061
+ ...typeof kept.likes === "number" ? { likes: count(kept.likes, 0) } : {},
2062
+ ...reply && answer ? {
2063
+ reply: {
2064
+ text: answer,
2065
+ state: oneOf(REPLY_STATES, reply.state, "draft"),
2066
+ ...reply.auto === true ? { auto: true } : {},
2067
+ ...draft ? { draft } : {},
2068
+ at: time2(reply.at) ?? at
2069
+ }
2070
+ } : {},
2071
+ ...text2(kept.topic, 80) ? { topic: text2(kept.topic, 80) } : {},
2072
+ at
2073
+ };
2074
+ }
2075
+ })(ChannelUtil ||= {});
2076
+
855
2077
  // web-src/creator-store.ts
856
- var KEYS = [Keys.SETTINGS, Keys.ITEMS, Keys.WEEKS];
2078
+ var KEYS = [Keys.SETTINGS, Keys.ITEMS, Keys.WEEKS, Keys.INSIGHTS, Keys.COMMENTS, Keys.PHASES];
857
2079
 
858
2080
  class CreatorStore {
859
2081
  pi;
860
- current = { loaded: false, settings: CreatorUtil.settings(undefined), items: [], weeks: [] };
2082
+ current = { loaded: false, settings: CreatorUtil.settings(undefined), items: [], weeks: [], insights: [], comments: [], phases: [] };
861
2083
  listeners = new Set;
862
2084
  constructor(pi) {
863
2085
  this.pi = pi;
@@ -878,8 +2100,16 @@ class CreatorStore {
878
2100
  return this.pi.callHost(method, ...params);
879
2101
  }
880
2102
  read() {
881
- Promise.all(KEYS.map((key) => this.pi.storage.get(key))).then(([settings, items, weeks]) => {
882
- const next = { loaded: true, settings: CreatorUtil.settings(settings), items: CreatorUtil.items(items), weeks: CreatorUtil.weeks(weeks) };
2103
+ Promise.all(KEYS.map((key) => this.pi.storage.get(key))).then(([settings, items, weeks, insights, comments, phases]) => {
2104
+ const next = {
2105
+ loaded: true,
2106
+ settings: CreatorUtil.settings(settings),
2107
+ items: CreatorUtil.items(items),
2108
+ weeks: CreatorUtil.weeks(weeks),
2109
+ insights: ChannelUtil.insights(insights),
2110
+ comments: ChannelUtil.comments(comments),
2111
+ phases: ChannelUtil.phases(phases)
2112
+ };
883
2113
  if (!this.current.loaded || JSON.stringify(next) !== JSON.stringify(this.current)) {
884
2114
  this.set(next);
885
2115
  }
@@ -893,31 +2123,737 @@ class CreatorStore {
893
2123
  }
894
2124
  }
895
2125
 
896
- // web-src/page.tsx
897
- var COLUMNS = ["topic", "making", "review", "published", "data"];
898
- function CreatorHead({ context }) {
899
- const state = useStore(context.store);
2126
+ // web-src/strategy.tsx
2127
+ var PHASE_WEEKS = [2, 4, 8, 0];
2128
+ function Strategy({ context }) {
2129
+ const { pi, store } = context;
2130
+ const state = useStore(store);
2131
+ const words = useWords(pi);
2132
+ const [rule, setRule] = React.useState("");
2133
+ const mode = state.settings.strategy;
2134
+ const rules = ChannelUtil.latestInsights(state.insights);
2135
+ const proposed = ChannelUtil.proposed(state.insights);
2136
+ const { TrendingUp, TrendingDown, Lightbulb, User } = pi.ui.icons;
2137
+ const tones = { good: TrendingUp, bad: TrendingDown, idea: Lightbulb };
2138
+ const icon = (one) => one.by === "user" ? User : tones[one.tone];
2139
+ const add = async () => {
2140
+ await store.call("addRule", rule);
2141
+ setRule("");
2142
+ };
2143
+ return /* @__PURE__ */ React.createElement("div", {
2144
+ className: "tcre-card tcre-panel tcre-insights"
2145
+ }, /* @__PURE__ */ React.createElement("div", {
2146
+ className: "tcre-panel-title"
2147
+ }, words.strategy, /* @__PURE__ */ React.createElement("div", {
2148
+ className: "ta-segmented tcre-seg"
2149
+ }, ["auto", "manual"].map((one) => /* @__PURE__ */ React.createElement(BusyButton, {
2150
+ key: one,
2151
+ pi,
2152
+ pressed: mode === one,
2153
+ className: mode === one ? "ta-on" : "",
2154
+ onClick: () => store.call("setSettings", { strategy: one })
2155
+ }, one === "auto" ? words.strategyAuto : words.strategyManual))), /* @__PURE__ */ React.createElement("span", {
2156
+ className: "tcre-grow"
2157
+ }), /* @__PURE__ */ React.createElement(BusyButton, {
2158
+ pi,
2159
+ className: "tcre-secondary tcre-small",
2160
+ onClick: () => talk(pi, words.reviewNow, words.reviewPrompt)
2161
+ }, words.reviewNow)), /* @__PURE__ */ React.createElement("div", {
2162
+ className: "tcre-muted tcre-strategy-hint"
2163
+ }, mode === "auto" ? words.strategyAutoHint : words.strategyManualHint), proposed.map((one) => /* @__PURE__ */ React.createElement(Rule, {
2164
+ key: one.id,
2165
+ context,
2166
+ rule: one,
2167
+ Icon: tones[one.tone],
2168
+ proposed: true
2169
+ }, /* @__PURE__ */ React.createElement(BusyButton, {
2170
+ pi,
2171
+ className: "tcre-text tcre-small",
2172
+ onClick: () => store.call("rule", one.id, "decline")
2173
+ }, words.decline), /* @__PURE__ */ React.createElement(BusyButton, {
2174
+ pi,
2175
+ className: "tcre-secondary tcre-small",
2176
+ onClick: () => store.call("rule", one.id, "take")
2177
+ }, words.take))), rules.map((one) => /* @__PURE__ */ React.createElement(Rule, {
2178
+ key: one.id,
2179
+ context,
2180
+ rule: one,
2181
+ Icon: icon(one)
2182
+ }, one.by !== "user" && /* @__PURE__ */ React.createElement(IconButton, {
2183
+ pi,
2184
+ icon: "Pin",
2185
+ label: words.keepRule,
2186
+ onClick: () => store.call("rule", one.id, "keep")
2187
+ }), /* @__PURE__ */ React.createElement(IconButton, {
2188
+ pi,
2189
+ icon: "X",
2190
+ label: words.remove,
2191
+ onClick: () => store.call("rule", one.id, "remove")
2192
+ }))), !rules.length && !proposed.length && /* @__PURE__ */ React.createElement("div", {
2193
+ className: "tcre-muted tcre-pad"
2194
+ }, words.noInsights), /* @__PURE__ */ React.createElement("div", {
2195
+ className: "tcre-rule-add"
2196
+ }, /* @__PURE__ */ React.createElement("input", {
2197
+ className: "tcre-field",
2198
+ value: rule,
2199
+ placeholder: words.ruleHint,
2200
+ onChange: (event) => setRule(event.target.value),
2201
+ onKeyDown: (event) => {
2202
+ if (event.key === "Enter" && rule.trim() && !event.nativeEvent.isComposing) {
2203
+ add();
2204
+ }
2205
+ }
2206
+ }), /* @__PURE__ */ React.createElement(BusyButton, {
2207
+ pi,
2208
+ className: "tcre-secondary tcre-small",
2209
+ disabled: !rule.trim(),
2210
+ onClick: add
2211
+ }, words.addRule)));
2212
+ }
2213
+ function Rule({
2214
+ context,
2215
+ rule,
2216
+ Icon,
2217
+ proposed,
2218
+ children
2219
+ }) {
900
2220
  const words = useWords(context.pi);
2221
+ const series = seriesOf(context, rule.series);
901
2222
  return /* @__PURE__ */ React.createElement("div", {
902
- className: "tcre-pagehead"
2223
+ className: "tcre-insight",
2224
+ "data-tone": rule.by === "user" ? "user" : rule.tone,
2225
+ "data-proposed": proposed || undefined
903
2226
  }, /* @__PURE__ */ React.createElement("span", {
904
- className: "tcre-pagehead-title"
905
- }, words.title), /* @__PURE__ */ React.createElement("span", {
906
- className: "tcre-pagehead-sub"
907
- }, state.settings.niche || words.sub));
2227
+ className: "tcre-insight-icon"
2228
+ }, Icon && /* @__PURE__ */ React.createElement(Icon, {
2229
+ size: 14
2230
+ })), /* @__PURE__ */ React.createElement("span", {
2231
+ className: "tcre-insight-text"
2232
+ }, proposed && /* @__PURE__ */ React.createElement("span", {
2233
+ className: "tcre-chip"
2234
+ }, words.proposedRules), rule.by === "user" && /* @__PURE__ */ React.createElement("span", {
2235
+ className: "tcre-chip"
2236
+ }, words.ruleMine), series && /* @__PURE__ */ React.createElement(SeriesTag, {
2237
+ series,
2238
+ words
2239
+ }), rule.text), /* @__PURE__ */ React.createElement("span", {
2240
+ className: "tcre-rule-actions"
2241
+ }, children));
908
2242
  }
909
- function CreatorPage({ context }) {
2243
+ function Phases({ context }) {
2244
+ const { pi, store } = context;
2245
+ const state = useStore(store);
2246
+ const words = useWords(pi);
2247
+ const every = state.settings.phaseWeeks;
2248
+ const day = (at) => new Date(at).toLocaleDateString(pi.ui.language, { month: "numeric", day: "numeric" });
2249
+ return /* @__PURE__ */ React.createElement("div", {
2250
+ className: "tcre-card tcre-panel tcre-wide"
2251
+ }, /* @__PURE__ */ React.createElement("div", {
2252
+ className: "tcre-panel-title"
2253
+ }, words.phases, /* @__PURE__ */ React.createElement("div", {
2254
+ className: "ta-segmented tcre-seg"
2255
+ }, PHASE_WEEKS.map((n) => /* @__PURE__ */ React.createElement(BusyButton, {
2256
+ key: n,
2257
+ pi,
2258
+ pressed: every === n,
2259
+ className: every === n ? "ta-on" : "",
2260
+ onClick: () => store.call("setSettings", { phaseWeeks: n })
2261
+ }, n ? format(words.phaseEvery, { n }) : words.phaseOff))), /* @__PURE__ */ React.createElement("span", {
2262
+ className: "tcre-grow"
2263
+ }), /* @__PURE__ */ React.createElement(BusyButton, {
2264
+ pi,
2265
+ className: "tcre-secondary tcre-small",
2266
+ onClick: () => talk(pi, words.phaseNow, words.phasePrompt)
2267
+ }, words.phaseNow)), state.phases.length ? state.phases.slice(0, 6).map((one) => /* @__PURE__ */ React.createElement("div", {
2268
+ key: one.at,
2269
+ className: "tcre-phase"
2270
+ }, /* @__PURE__ */ React.createElement("span", {
2271
+ className: "tcre-phase-when"
2272
+ }, day(one.from), " – ", day(one.to)), /* @__PURE__ */ React.createElement("span", {
2273
+ className: "tcre-phase-text"
2274
+ }, one.summary), one.topic && /* @__PURE__ */ React.createElement("span", {
2275
+ className: "tcre-chip"
2276
+ }, words.ledTo))) : /* @__PURE__ */ React.createElement("div", {
2277
+ className: "tcre-muted tcre-pad"
2278
+ }, words.noPhases));
2279
+ }
2280
+
2281
+ // web-src/numbers.tsx
2282
+ function GroupBars({
2283
+ context,
2284
+ groups,
2285
+ label,
2286
+ wide
2287
+ }) {
910
2288
  const { pi } = context;
911
- const state = useStore(context.store);
912
2289
  const words = useWords(pi);
913
- const device = pi.ui.useDevice();
914
- const [column, setColumn] = React.useState("topic");
915
- const [editing, setEditing] = React.useState(false);
916
- if (!state.loaded) {
917
- return /* @__PURE__ */ React.createElement(pi.ui.Loading, null);
918
- }
919
- if (editing || !state.settings.picked.length) {
920
- return /* @__PURE__ */ React.createElement("div", {
2290
+ const most = Math.max(1, ...groups.map((one) => one.group.average));
2291
+ return /* @__PURE__ */ React.createElement("div", {
2292
+ className: wide ? "tcre-card tcre-panel tcre-wide" : "tcre-card tcre-panel"
2293
+ }, /* @__PURE__ */ React.createElement("div", {
2294
+ className: "tcre-panel-title"
2295
+ }, label, /* @__PURE__ */ React.createElement("span", {
2296
+ className: "tcre-muted"
2297
+ }, words.perPiece)), groups.map(({ group, name, color }) => /* @__PURE__ */ React.createElement("div", {
2298
+ key: group.key || name,
2299
+ className: "tcre-bar"
2300
+ }, /* @__PURE__ */ React.createElement("span", {
2301
+ className: "tcre-bar-label",
2302
+ title: name
2303
+ }, color && /* @__PURE__ */ React.createElement("i", {
2304
+ style: { background: color }
2305
+ }), name), /* @__PURE__ */ React.createElement("span", {
2306
+ className: "tcre-bar-track"
2307
+ }, group.average > 0 && /* @__PURE__ */ React.createElement("i", {
2308
+ style: { width: `${group.average / most * 100}%`, background: color }
2309
+ })), /* @__PURE__ */ React.createElement("span", {
2310
+ className: "tcre-bar-value"
2311
+ }, group.measured ? short(group.average, pi.ui.language) : "—"), /* @__PURE__ */ React.createElement("span", {
2312
+ className: "tcre-bar-note"
2313
+ }, group.count ? format(words.pieces, { n: group.count }) : words.noneYet, group.completion !== undefined ? ` · ${format(words.completion, { n: Math.round(group.completion * 100) })}` : ""))));
2314
+ }
2315
+ function WeekLine({ context }) {
2316
+ const state = useStore(context.store);
2317
+ const words = useWords(context.pi);
2318
+ const weeks = state.weeks.filter((one) => one.platforms.length).slice(-12);
2319
+ if (weeks.length < 2) {
2320
+ return null;
2321
+ }
2322
+ const values = weeks.map((week) => week.platforms.reduce((all, one) => all + one.views, 0));
2323
+ const most = Math.max(1, ...values);
2324
+ const points = values.map((value, at) => `${at / (values.length - 1) * 100},${36 - value / most * 32}`).join(" ");
2325
+ return /* @__PURE__ */ React.createElement("div", {
2326
+ className: "tcre-card tcre-panel"
2327
+ }, /* @__PURE__ */ React.createElement("div", {
2328
+ className: "tcre-panel-title"
2329
+ }, words.weekly), /* @__PURE__ */ React.createElement("svg", {
2330
+ className: "tcre-line",
2331
+ viewBox: "0 0 100 40",
2332
+ preserveAspectRatio: "none",
2333
+ "aria-hidden": true
2334
+ }, /* @__PURE__ */ React.createElement("polyline", {
2335
+ points,
2336
+ vectorEffect: "non-scaling-stroke"
2337
+ })), /* @__PURE__ */ React.createElement("div", {
2338
+ className: "tcre-line-labels"
2339
+ }, /* @__PURE__ */ React.createElement("span", null, weeks[0].week.slice(5)), /* @__PURE__ */ React.createElement("span", null, weeks[weeks.length - 1].week.slice(5))));
2340
+ }
2341
+ function Numbers({ context }) {
2342
+ const { pi } = context;
2343
+ const state = useStore(context.store);
2344
+ const words = useWords(pi);
2345
+ const now = Date.now();
2346
+ const thisWeek = CreatorUtil.weekOf(now);
2347
+ const weeks = state.weeks.filter((one) => one.week < thisWeek && one.platforms.length);
2348
+ const last = weeks[weeks.length - 1];
2349
+ const before = weeks[weeks.length - 2];
2350
+ const sum = (week, key) => (week?.platforms ?? []).reduce((all, one) => all + (one[key] ?? 0), 0);
2351
+ const delta = (a, b) => b > 0 ? `${a >= b ? "+" : ""}${Math.round((a - b) / b * 100)}%` : "";
2352
+ const analysis = ChannelUtil.analysis(state.items, state.settings);
2353
+ const progress = CreatorUtil.progress(state.items, state.settings.goal, now);
2354
+ const goal = state.settings.goal;
2355
+ const stats = [
2356
+ [words.publishedCount, String(analysis.published)],
2357
+ [words.totalViews, analysis.measured ? short(analysis.views, pi.ui.language) : "—"],
2358
+ [words.lastWeek, last ? short(sum(last, "views"), pi.ui.language) : "—", last && before ? delta(sum(last, "views"), sum(before, "views")) : undefined],
2359
+ [words.follows, last ? short(sum(last, "follows"), pi.ui.language) : "—"],
2360
+ [words.minutes, format(words.minutesValue, { n: CreatorUtil.minutes(state.weeks, now) })]
2361
+ ];
2362
+ const seriesGroups = analysis.series.map((group) => {
2363
+ const series = state.settings.series.find((one) => one.id === group.key);
2364
+ return { group, name: series?.name ?? words.seriesNone, color: series?.color ?? "var(--ta-muted)" };
2365
+ });
2366
+ return /* @__PURE__ */ React.createElement("div", {
2367
+ className: "tcre-data"
2368
+ }, /* @__PURE__ */ React.createElement("div", {
2369
+ className: "tcre-card tcre-kpis"
2370
+ }, stats.map(([label, value, change]) => /* @__PURE__ */ React.createElement("div", {
2371
+ key: label,
2372
+ className: "tcre-kpi",
2373
+ "data-none": value === "—" || undefined
2374
+ }, /* @__PURE__ */ React.createElement("b", null, value, change && /* @__PURE__ */ React.createElement("em", {
2375
+ "data-down": change.startsWith("-") || undefined
2376
+ }, change)), /* @__PURE__ */ React.createElement("span", null, label)))), /* @__PURE__ */ React.createElement(Strategy, {
2377
+ context
2378
+ }), seriesGroups.length > 0 && /* @__PURE__ */ React.createElement(GroupBars, {
2379
+ context,
2380
+ label: words.bySeries,
2381
+ groups: seriesGroups,
2382
+ wide: true
2383
+ }), analysis.kinds.length > 0 && /* @__PURE__ */ React.createElement(GroupBars, {
2384
+ context,
2385
+ label: words.byKind,
2386
+ groups: analysis.kinds.map((group) => ({ group, name: words[group.key] }))
2387
+ }), analysis.forms.length > 0 && /* @__PURE__ */ React.createElement(GroupBars, {
2388
+ context,
2389
+ label: words.byForm,
2390
+ groups: analysis.forms.map((group) => ({ group, name: words[group.key] }))
2391
+ }), analysis.platforms.length > 0 && /* @__PURE__ */ React.createElement(GroupBars, {
2392
+ context,
2393
+ label: words.byPlatform,
2394
+ groups: analysis.platforms.map((group) => {
2395
+ const platform = platformOf(context, group.key);
2396
+ return { group, name: platform?.name ?? group.key, color: platform?.color };
2397
+ })
2398
+ }), /* @__PURE__ */ React.createElement(WeekLine, {
2399
+ context
2400
+ }), analysis.top.length > 0 && /* @__PURE__ */ React.createElement("div", {
2401
+ className: "tcre-card tcre-panel"
2402
+ }, /* @__PURE__ */ React.createElement("div", {
2403
+ className: "tcre-panel-title"
2404
+ }, words.top), analysis.top.map(({ item, views }, at) => /* @__PURE__ */ React.createElement("div", {
2405
+ key: item.id,
2406
+ className: "tcre-top-row"
2407
+ }, /* @__PURE__ */ React.createElement("b", null, at + 1), /* @__PURE__ */ React.createElement("span", {
2408
+ className: "tcre-top-title"
2409
+ }, item.title), /* @__PURE__ */ React.createElement(SeriesTag, {
2410
+ series: seriesOf(context, item.series),
2411
+ words
2412
+ }), /* @__PURE__ */ React.createElement("span", {
2413
+ className: "tcre-bar-value"
2414
+ }, short(views, pi.ui.language))))), /* @__PURE__ */ React.createElement(Phases, {
2415
+ context
2416
+ }), goal && progress && /* @__PURE__ */ React.createElement("div", {
2417
+ className: "tcre-card tcre-panel tcre-goal"
2418
+ }, /* @__PURE__ */ React.createElement("div", {
2419
+ className: "tcre-panel-title"
2420
+ }, format(words.goal, { days: goal.days }), /* @__PURE__ */ React.createElement("span", {
2421
+ className: "tcre-grow"
2422
+ }), /* @__PURE__ */ React.createElement("span", {
2423
+ className: "tcre-muted"
2424
+ }, format(words.goalDay, { day: progress.day }))), [
2425
+ [words.video, progress.videos, goal.videos],
2426
+ [words.post, progress.posts, goal.posts]
2427
+ ].map(([label, made, aim]) => /* @__PURE__ */ React.createElement("div", {
2428
+ key: label
2429
+ }, /* @__PURE__ */ React.createElement("div", {
2430
+ className: "tcre-goal-row"
2431
+ }, /* @__PURE__ */ React.createElement("span", null, label), /* @__PURE__ */ React.createElement("span", {
2432
+ className: "tcre-muted"
2433
+ }, made, " / ", aim)), /* @__PURE__ */ React.createElement("div", {
2434
+ className: "tcre-goal-track"
2435
+ }, /* @__PURE__ */ React.createElement("i", {
2436
+ style: { width: `${aim ? Math.min(100, made / aim * 100) : 0}%` }
2437
+ }))))), !analysis.measured && !last && /* @__PURE__ */ React.createElement("div", {
2438
+ className: "tcre-muted tcre-pad tcre-data-note"
2439
+ }, words.noData));
2440
+ }
2441
+
2442
+ // web-src/setup.tsx
2443
+ function Setup({ context, done }) {
2444
+ const { pi, store } = context;
2445
+ const state = useStore(store);
2446
+ const words = useWords(pi);
2447
+ const [niche, setNiche] = React.useState(state.settings.niche);
2448
+ const [picked, setPicked] = React.useState(state.settings.picked);
2449
+ const [series, setSeries] = React.useState(state.settings.series);
2450
+ const [platforms, setPlatforms] = React.useState(state.settings.platforms);
2451
+ const [inside, setInside] = React.useState({ name: "", url: "" });
2452
+ const { Trash2, Plus } = pi.ui.icons;
2453
+ const first = !state.settings.picked.length;
2454
+ const save = (goal) => store.call("setSettings", {
2455
+ niche: niche.trim(),
2456
+ picked,
2457
+ platforms,
2458
+ series: series.map((one) => ({ ...one, name: one.name.trim(), about: one.about?.trim() })).filter((one) => one.name),
2459
+ ...goal ? { goal: { from: Date.now(), days: 30, videos: 8, posts: 12 } } : {}
2460
+ }).then(done);
2461
+ const set = (at, patch) => setSeries(series.map((one, index) => index === at ? { ...one, ...patch } : one));
2462
+ const add = () => setSeries([...series, { id: `s${Date.now().toString(36)}`, name: "", color: SERIES_COLORS[series.length % SERIES_COLORS.length] }]);
2463
+ return /* @__PURE__ */ React.createElement("div", {
2464
+ className: "tcre-setup"
2465
+ }, /* @__PURE__ */ React.createElement("div", {
2466
+ className: "tcre-setup-title"
2467
+ }, words.setupTitle), /* @__PURE__ */ React.createElement("textarea", {
2468
+ className: "tcre-input",
2469
+ rows: 2,
2470
+ value: niche,
2471
+ placeholder: words.nicheHint,
2472
+ onChange: (event) => setNiche(event.target.value)
2473
+ }), /* @__PURE__ */ React.createElement("div", {
2474
+ className: "tcre-setup-label"
2475
+ }, words.seriesLabel, /* @__PURE__ */ React.createElement("span", null, words.seriesHint)), /* @__PURE__ */ React.createElement("div", {
2476
+ className: "tcre-card tcre-series-edit"
2477
+ }, series.map((one, at) => /* @__PURE__ */ React.createElement("div", {
2478
+ key: one.id,
2479
+ className: "tcre-series-row",
2480
+ style: { "--tcre-c": one.color }
2481
+ }, /* @__PURE__ */ React.createElement("i", null), /* @__PURE__ */ React.createElement("div", {
2482
+ className: "tcre-series-fields"
2483
+ }, /* @__PURE__ */ React.createElement("input", {
2484
+ className: "tcre-field tcre-field-name",
2485
+ value: one.name,
2486
+ placeholder: words.seriesName,
2487
+ onChange: (event) => set(at, { name: event.target.value })
2488
+ }), /* @__PURE__ */ React.createElement("input", {
2489
+ className: "tcre-field",
2490
+ value: one.about ?? "",
2491
+ placeholder: words.seriesAbout,
2492
+ onChange: (event) => set(at, { about: event.target.value })
2493
+ })), /* @__PURE__ */ React.createElement("button", {
2494
+ type: "button",
2495
+ className: "tcre-toggle",
2496
+ "aria-pressed": !!one.ordered,
2497
+ onClick: () => set(at, { ordered: !one.ordered })
2498
+ }, words.seriesOrdered), /* @__PURE__ */ React.createElement("button", {
2499
+ type: "button",
2500
+ className: "tcre-toggle",
2501
+ "aria-pressed": one.reach === "internal",
2502
+ onClick: () => set(at, { reach: one.reach === "internal" ? undefined : "internal" })
2503
+ }, words.seriesInside), /* @__PURE__ */ React.createElement("button", {
2504
+ type: "button",
2505
+ className: "tcre-icon",
2506
+ "aria-label": words.remove,
2507
+ title: words.remove,
2508
+ onClick: () => setSeries(series.filter((_, index) => index !== at))
2509
+ }, /* @__PURE__ */ React.createElement(Trash2, {
2510
+ size: 15
2511
+ })))), /* @__PURE__ */ React.createElement("button", {
2512
+ type: "button",
2513
+ className: "tcre-series-add",
2514
+ onClick: add
2515
+ }, /* @__PURE__ */ React.createElement(Plus, {
2516
+ size: 15
2517
+ }), words.addSeries)), /* @__PURE__ */ React.createElement("div", {
2518
+ className: "tcre-setup-label"
2519
+ }, words.platformsLabel), /* @__PURE__ */ React.createElement("div", {
2520
+ className: "tcre-pick"
2521
+ }, platforms.filter((platform) => !platform.internal).map((platform) => {
2522
+ const on = picked.includes(platform.id);
2523
+ return /* @__PURE__ */ React.createElement("button", {
2524
+ key: platform.id,
2525
+ type: "button",
2526
+ "aria-pressed": on,
2527
+ onClick: () => setPicked(on ? picked.filter((id) => id !== platform.id) : [...picked, platform.id])
2528
+ }, /* @__PURE__ */ React.createElement(PlatformName, {
2529
+ platform
2530
+ }));
2531
+ })), /* @__PURE__ */ React.createElement("div", {
2532
+ className: "tcre-setup-label"
2533
+ }, words.insideLabel, /* @__PURE__ */ React.createElement("span", null, words.insideHint)), /* @__PURE__ */ React.createElement("div", {
2534
+ className: "tcre-pick"
2535
+ }, platforms.filter((platform) => platform.internal).map((platform) => {
2536
+ const on = picked.includes(platform.id);
2537
+ return /* @__PURE__ */ React.createElement("span", {
2538
+ key: platform.id,
2539
+ className: "tcre-inside"
2540
+ }, /* @__PURE__ */ React.createElement("button", {
2541
+ type: "button",
2542
+ "aria-pressed": on,
2543
+ onClick: () => setPicked(on ? picked.filter((id) => id !== platform.id) : [...picked, platform.id])
2544
+ }, /* @__PURE__ */ React.createElement(PlatformName, {
2545
+ platform
2546
+ })), /* @__PURE__ */ React.createElement("button", {
2547
+ type: "button",
2548
+ className: "tcre-icon",
2549
+ "aria-label": words.remove,
2550
+ title: words.remove,
2551
+ onClick: () => {
2552
+ setPlatforms(platforms.filter((one) => one.id !== platform.id));
2553
+ setPicked(picked.filter((id) => id !== platform.id));
2554
+ }
2555
+ }, /* @__PURE__ */ React.createElement(Trash2, {
2556
+ size: 14
2557
+ })));
2558
+ })), /* @__PURE__ */ React.createElement("div", {
2559
+ className: "tcre-inside-add"
2560
+ }, /* @__PURE__ */ React.createElement("input", {
2561
+ className: "tcre-field tcre-field-name",
2562
+ value: inside.name,
2563
+ placeholder: words.insideName,
2564
+ onChange: (event) => setInside({ ...inside, name: event.target.value })
2565
+ }), /* @__PURE__ */ React.createElement("input", {
2566
+ className: "tcre-field",
2567
+ value: inside.url,
2568
+ placeholder: words.insideUrl,
2569
+ onChange: (event) => setInside({ ...inside, url: event.target.value })
2570
+ }), /* @__PURE__ */ React.createElement("button", {
2571
+ type: "button",
2572
+ className: "tcre-secondary tcre-small",
2573
+ disabled: !inside.name.trim() || !/^https?:\/\/\S+$/i.test(inside.url.trim()),
2574
+ onClick: () => {
2575
+ const id = `in-${Date.now().toString(36)}`;
2576
+ setPlatforms([
2577
+ ...platforms,
2578
+ { id, name: inside.name.trim(), color: "#0052d9", article: {}, internal: true, publish: inside.url.trim() }
2579
+ ]);
2580
+ setPicked([...picked, id]);
2581
+ setInside({ name: "", url: "" });
2582
+ }
2583
+ }, words.addInside)), /* @__PURE__ */ React.createElement("div", {
2584
+ className: "tcre-buttons"
2585
+ }, !first && /* @__PURE__ */ React.createElement("button", {
2586
+ type: "button",
2587
+ className: "tcre-text",
2588
+ onClick: done
2589
+ }, words.cancel), /* @__PURE__ */ React.createElement("span", {
2590
+ className: "tcre-grow"
2591
+ }), !state.settings.goal && /* @__PURE__ */ React.createElement(BusyButton, {
2592
+ pi,
2593
+ className: "tcre-secondary",
2594
+ disabled: !picked.length,
2595
+ onClick: () => save(true)
2596
+ }, words.startGoal), /* @__PURE__ */ React.createElement(BusyButton, {
2597
+ pi,
2598
+ className: "tcre-primary",
2599
+ disabled: !picked.length,
2600
+ onClick: () => save(false)
2601
+ }, first ? words.start : words.save)));
2602
+ }
2603
+
2604
+ // web-src/talk.tsx
2605
+ var DAY3 = 86400000;
2606
+ var LEVELS = ["act", "ask", "off"];
2607
+ var LEVEL_WORDS = { act: "levelAct", ask: "levelAsk", off: "levelOff" };
2608
+ var HOUR2 = 3600000;
2609
+ var PACE_HOURS = [0, 2, 6, 24];
2610
+ var PACE_DAYS = [7, 14, 30];
2611
+ function drafts(comments) {
2612
+ return comments.filter((one) => one.reply?.state === "draft").sort((a, b) => b.at - a.at);
2613
+ }
2614
+ function Talk({ context }) {
2615
+ const { pi, store } = context;
2616
+ const state = useStore(store);
2617
+ const words = useWords(pi);
2618
+ const now = Date.now();
2619
+ const waiting = drafts(state.comments);
2620
+ const asked = state.comments.filter((one) => (one.class === "question" || one.class === "suggestion") && now - one.at < 14 * DAY3).sort((a, b) => (b.likes ?? 0) - (a.likes ?? 0) || b.at - a.at).slice(0, 12);
2621
+ const recent = state.comments.filter((one) => one.reply && one.reply.state !== "draft" && one.reply.state !== "dropped" && now - one.reply.at < 7 * DAY3).sort((a, b) => (b.reply?.at ?? 0) - (a.reply?.at ?? 0)).slice(0, 20);
2622
+ return /* @__PURE__ */ React.createElement("div", {
2623
+ className: "tcre-talk"
2624
+ }, !state.comments.length && /* @__PURE__ */ React.createElement("div", {
2625
+ className: "tcre-empty"
2626
+ }, /* @__PURE__ */ React.createElement(pi.ui.Empty, {
2627
+ compact: true,
2628
+ title: words.noComments,
2629
+ hint: words.commentsHint
2630
+ })), waiting.length > 0 && /* @__PURE__ */ React.createElement("section", {
2631
+ className: "tcre-section"
2632
+ }, /* @__PURE__ */ React.createElement("div", {
2633
+ className: "tcre-h"
2634
+ }, /* @__PURE__ */ React.createElement("span", null, words.drafts)), /* @__PURE__ */ React.createElement("div", {
2635
+ className: "tcre-list"
2636
+ }, waiting.map((one) => /* @__PURE__ */ React.createElement(Draft, {
2637
+ key: one.id,
2638
+ context,
2639
+ comment: one
2640
+ })))), /* @__PURE__ */ React.createElement(Levels, {
2641
+ context
2642
+ }), /* @__PURE__ */ React.createElement(Pace, {
2643
+ context
2644
+ }), asked.length > 0 && /* @__PURE__ */ React.createElement("div", {
2645
+ className: "tcre-card tcre-panel"
2646
+ }, /* @__PURE__ */ React.createElement("div", {
2647
+ className: "tcre-panel-title"
2648
+ }, words.asked), asked.map((one) => /* @__PURE__ */ React.createElement("div", {
2649
+ key: one.id,
2650
+ className: "tcre-asked"
2651
+ }, /* @__PURE__ */ React.createElement("span", {
2652
+ className: "tcre-class",
2653
+ "data-class": one.class
2654
+ }, words[one.class]), /* @__PURE__ */ React.createElement("span", {
2655
+ className: "tcre-asked-text"
2656
+ }, one.text), one.topic ? /* @__PURE__ */ React.createElement("span", {
2657
+ className: "tcre-chip"
2658
+ }, words.ledTo) : one.likes ? /* @__PURE__ */ React.createElement("span", {
2659
+ className: "tcre-muted"
2660
+ }, "♥ ", one.likes) : null))), recent.length > 0 && /* @__PURE__ */ React.createElement("div", {
2661
+ className: "tcre-card tcre-panel"
2662
+ }, /* @__PURE__ */ React.createElement("div", {
2663
+ className: "tcre-panel-title"
2664
+ }, words.autoSent), recent.map((one) => /* @__PURE__ */ React.createElement(Answered, {
2665
+ key: one.id,
2666
+ context,
2667
+ comment: one
2668
+ }))));
2669
+ }
2670
+ function Meta({ context, comment }) {
2671
+ const state = useStore(context.store);
2672
+ const words = useWords(context.pi);
2673
+ const piece = state.items.find((one) => one.id === comment.item);
2674
+ return /* @__PURE__ */ React.createElement("div", {
2675
+ className: "tcre-comment-meta"
2676
+ }, /* @__PURE__ */ React.createElement("span", {
2677
+ className: "tcre-class",
2678
+ "data-class": comment.class
2679
+ }, words[comment.class]), /* @__PURE__ */ React.createElement(PlatformName, {
2680
+ platform: platformOf(context, comment.platform)
2681
+ }), piece && /* @__PURE__ */ React.createElement("span", {
2682
+ className: "tcre-comment-piece"
2683
+ }, piece.title));
2684
+ }
2685
+ function Draft({ context, comment }) {
2686
+ const { pi, store } = context;
2687
+ const words = useWords(pi);
2688
+ const [text3, setText] = React.useState(comment.reply?.text ?? "");
2689
+ return /* @__PURE__ */ React.createElement("div", {
2690
+ className: "tcre-card tcre-comment"
2691
+ }, /* @__PURE__ */ React.createElement(Meta, {
2692
+ context,
2693
+ comment
2694
+ }), /* @__PURE__ */ React.createElement("div", {
2695
+ className: "tcre-comment-text"
2696
+ }, comment.text), /* @__PURE__ */ React.createElement("textarea", {
2697
+ className: "tcre-input tcre-reply-input",
2698
+ rows: 2,
2699
+ value: text3,
2700
+ onChange: (event) => setText(event.target.value)
2701
+ }), /* @__PURE__ */ React.createElement("div", {
2702
+ className: "tcre-buttons"
2703
+ }, /* @__PURE__ */ React.createElement("span", {
2704
+ className: "tcre-grow"
2705
+ }), /* @__PURE__ */ React.createElement(BusyButton, {
2706
+ pi,
2707
+ className: "tcre-text",
2708
+ onClick: () => store.call("reply", comment.id, "drop")
2709
+ }, words.dropReply), /* @__PURE__ */ React.createElement(BusyButton, {
2710
+ pi,
2711
+ className: "tcre-primary tcre-small",
2712
+ disabled: !text3.trim(),
2713
+ onClick: () => store.call("reply", comment.id, "send", text3)
2714
+ }, words.send)));
2715
+ }
2716
+ function Answered({ context, comment }) {
2717
+ const { pi, store } = context;
2718
+ const words = useWords(pi);
2719
+ const reply = comment.reply;
2720
+ if (!reply) {
2721
+ return null;
2722
+ }
2723
+ const where = { approved: words.sending, sent: words.sent, withdrawn: words.withdrawn, removed: words.withdrawn, draft: "", dropped: "" }[reply.state];
2724
+ return /* @__PURE__ */ React.createElement("div", {
2725
+ className: "tcre-answered"
2726
+ }, /* @__PURE__ */ React.createElement(Meta, {
2727
+ context,
2728
+ comment
2729
+ }), /* @__PURE__ */ React.createElement("div", {
2730
+ className: "tcre-comment-text"
2731
+ }, comment.text), /* @__PURE__ */ React.createElement("div", {
2732
+ className: "tcre-answer"
2733
+ }, /* @__PURE__ */ React.createElement("span", null, reply.text), /* @__PURE__ */ React.createElement("span", {
2734
+ className: "tcre-grow"
2735
+ }), /* @__PURE__ */ React.createElement("span", {
2736
+ className: "tcre-muted"
2737
+ }, reply.auto ? `${words.autoTag} · ` : "", where), reply.state === "sent" && /* @__PURE__ */ React.createElement(BusyButton, {
2738
+ pi,
2739
+ className: "tcre-text",
2740
+ onClick: () => store.call("reply", comment.id, "withdraw")
2741
+ }, words.withdraw)));
2742
+ }
2743
+ function Pace({ context }) {
2744
+ const { pi, store } = context;
2745
+ const state = useStore(store);
2746
+ const words = useWords(pi);
2747
+ const { commentsEvery: every, commentsDays: days } = state.settings;
2748
+ const latest = state.items.filter((one) => one.stage === "published" && one.commentsGap).sort((a, b) => (b.commentsAt ?? 0) - (a.commentsAt ?? 0))[0];
2749
+ const now = latest?.commentsGap ? Math.max(1, Math.round(latest.commentsGap / HOUR2)) : undefined;
2750
+ const choice = (values, value, label, set) => /* @__PURE__ */ React.createElement("div", {
2751
+ className: "ta-segmented tcre-seg"
2752
+ }, values.map((n) => /* @__PURE__ */ React.createElement(BusyButton, {
2753
+ key: n,
2754
+ pi,
2755
+ pressed: value === n,
2756
+ className: value === n ? "ta-on" : "",
2757
+ onClick: () => store.call("setSettings", set(n))
2758
+ }, label(n))));
2759
+ return /* @__PURE__ */ React.createElement("div", {
2760
+ className: "tcre-card tcre-panel"
2761
+ }, /* @__PURE__ */ React.createElement("div", {
2762
+ className: "tcre-panel-title"
2763
+ }, words.commentsPace), /* @__PURE__ */ React.createElement("div", {
2764
+ className: "tcre-level-row"
2765
+ }, /* @__PURE__ */ React.createElement("span", null, words.paceHow), /* @__PURE__ */ React.createElement("span", {
2766
+ className: "tcre-grow"
2767
+ }), choice(PACE_HOURS, every, (n) => !n ? words.paceAuto : n === 24 ? words.paceDaily : format(words.paceHours, { n }), (n) => ({ commentsEvery: n }))), /* @__PURE__ */ React.createElement("div", {
2768
+ className: "tcre-level-row"
2769
+ }, /* @__PURE__ */ React.createElement("span", null, words.paceFor), /* @__PURE__ */ React.createElement("span", {
2770
+ className: "tcre-grow"
2771
+ }), choice(PACE_DAYS, days, (n) => format(words.paceDays, { n }), (n) => ({ commentsDays: n }))), /* @__PURE__ */ React.createElement("div", {
2772
+ className: "tcre-muted tcre-level-note"
2773
+ }, every ? words.paceFixedNote : now ? `${format(words.paceNow, { n: now })} · ${words.paceAutoNote}` : words.paceAutoNote));
2774
+ }
2775
+ function Levels({ context }) {
2776
+ const { pi, store } = context;
2777
+ const words = useWords(pi);
2778
+ const [levels, setLevels] = React.useState();
2779
+ React.useEffect(() => {
2780
+ let live = true;
2781
+ store.call("replyLevels").then((got) => live && setLevels(got), () => {
2782
+ return;
2783
+ });
2784
+ return () => {
2785
+ live = false;
2786
+ };
2787
+ }, [store]);
2788
+ if (!levels) {
2789
+ return null;
2790
+ }
2791
+ const set = (cls, level) => store.call("setReplyLevel", cls, level).then(setLevels);
2792
+ return /* @__PURE__ */ React.createElement("div", {
2793
+ className: "tcre-card tcre-panel"
2794
+ }, /* @__PURE__ */ React.createElement("div", {
2795
+ className: "tcre-panel-title"
2796
+ }, words.replyLevels), levels.map((one) => /* @__PURE__ */ React.createElement("div", {
2797
+ key: one.class,
2798
+ className: "tcre-level-row"
2799
+ }, /* @__PURE__ */ React.createElement("span", {
2800
+ className: "tcre-class",
2801
+ "data-class": one.class
2802
+ }, words[one.class]), /* @__PURE__ */ React.createElement("span", {
2803
+ className: "tcre-grow"
2804
+ }), one.locked && /* @__PURE__ */ React.createElement(BusyButton, {
2805
+ pi,
2806
+ className: "tcre-text tcre-small",
2807
+ onClick: () => set(one.class, null)
2808
+ }, words.levelAuto), /* @__PURE__ */ React.createElement("div", {
2809
+ className: "ta-segmented tcre-seg"
2810
+ }, LEVELS.map((level) => /* @__PURE__ */ React.createElement(BusyButton, {
2811
+ key: level,
2812
+ pi,
2813
+ pressed: one.level === level,
2814
+ className: one.level === level ? "ta-on" : "",
2815
+ onClick: () => set(one.class, level)
2816
+ }, words[LEVEL_WORDS[level]]))))), /* @__PURE__ */ React.createElement("div", {
2817
+ className: "tcre-muted tcre-level-note"
2818
+ }, words.levelLearn));
2819
+ }
2820
+
2821
+ // web-src/page.tsx
2822
+ var COLUMNS = ["topic", "making", "review", "published", "talk", "data"];
2823
+ var COLUMN_ICONS = {
2824
+ topic: "Lightbulb",
2825
+ making: "Film",
2826
+ review: "Eye",
2827
+ published: "Send",
2828
+ talk: "MessageCircle",
2829
+ data: "ChartColumn"
2830
+ };
2831
+ var FIRST = 6;
2832
+ function CreatorHead({ context }) {
2833
+ const state = useStore(context.store);
2834
+ const words = useWords(context.pi);
2835
+ return /* @__PURE__ */ React.createElement("div", {
2836
+ className: "tcre-pagehead"
2837
+ }, /* @__PURE__ */ React.createElement("span", {
2838
+ className: "tcre-pagehead-title"
2839
+ }, words.title), /* @__PURE__ */ React.createElement("span", {
2840
+ className: "tcre-pagehead-sub"
2841
+ }, state.settings.niche || words.sub));
2842
+ }
2843
+ function CreatorPage({ context }) {
2844
+ const { pi } = context;
2845
+ const state = useStore(context.store);
2846
+ const words = useWords(pi);
2847
+ const device = pi.ui.useDevice();
2848
+ const compact = device.layout === "compact";
2849
+ const [column, setColumn] = React.useState();
2850
+ const [series, setSeries] = React.useState("");
2851
+ const [editing, setEditing] = React.useState(false);
2852
+ if (!state.loaded) {
2853
+ return /* @__PURE__ */ React.createElement(pi.ui.Loading, null);
2854
+ }
2855
+ if (editing || !state.settings.picked.length) {
2856
+ return /* @__PURE__ */ React.createElement("div", {
921
2857
  className: "tcre-page"
922
2858
  }, /* @__PURE__ */ React.createElement(Setup, {
923
2859
  context,
@@ -925,20 +2861,19 @@ function CreatorPage({ context }) {
925
2861
  }));
926
2862
  }
927
2863
  const now = Date.now();
928
- const columns = CreatorUtil.columns(state.items, now);
929
- const counts = {
930
- topic: columns.topic.length,
931
- making: columns.making.length,
932
- review: columns.review.length,
933
- published: columns.published.length,
934
- data: undefined
935
- };
936
- const body = (one) => {
937
- switch (one) {
2864
+ const all = CreatorUtil.columns(state.items, now);
2865
+ const waiting = all.review.filter((one) => !one.approved).length;
2866
+ const shown = column ?? (waiting ? "review" : "topic");
2867
+ const known = state.settings.series.some((one) => one.id === series);
2868
+ const of = (items) => known ? items.filter((one) => one.series === series) : items;
2869
+ const columns = { topic: of(all.topic), making: of([...all.materials, ...all.making]), review: of(all.review), published: of(all.published) };
2870
+ const body = () => {
2871
+ switch (shown) {
938
2872
  case "topic":
939
2873
  return /* @__PURE__ */ React.createElement(Topics, {
940
2874
  context,
941
- items: columns.topic
2875
+ items: columns.topic,
2876
+ series: known ? series : ""
942
2877
  });
943
2878
  case "making":
944
2879
  return /* @__PURE__ */ React.createElement(Making, {
@@ -946,151 +2881,407 @@ function CreatorPage({ context }) {
946
2881
  items: columns.making
947
2882
  });
948
2883
  case "review":
949
- return columns.review.length ? columns.review.map((item) => /* @__PURE__ */ React.createElement(ReviewCard, {
950
- key: item.id,
2884
+ return /* @__PURE__ */ React.createElement(Reviews, {
951
2885
  context,
952
- item
953
- })) : /* @__PURE__ */ React.createElement(Empty, {
954
- pi,
955
- text: words.reviewEmpty
2886
+ items: columns.review
956
2887
  });
957
2888
  case "published":
958
2889
  return /* @__PURE__ */ React.createElement(Published, {
959
2890
  context,
960
2891
  items: columns.published
961
2892
  });
2893
+ case "talk":
2894
+ return /* @__PURE__ */ React.createElement(Talk, {
2895
+ context
2896
+ });
962
2897
  case "data":
963
2898
  return /* @__PURE__ */ React.createElement(Numbers, {
964
- context,
965
- board: device.layout !== "compact"
2899
+ context
966
2900
  });
967
2901
  }
968
2902
  };
969
- const settings = /* @__PURE__ */ React.createElement("button", {
970
- type: "button",
971
- className: "tcre-link",
972
- onClick: () => setEditing(true)
973
- }, words.settings);
974
- if (device.layout === "compact") {
975
- return /* @__PURE__ */ React.createElement("div", {
976
- className: "tcre-page"
977
- }, /* @__PURE__ */ React.createElement("div", {
978
- className: "ta-segmented tcre-seg",
979
- role: "tablist"
980
- }, COLUMNS.map((one) => /* @__PURE__ */ React.createElement("button", {
981
- key: one,
982
- type: "button",
983
- role: "tab",
984
- "aria-selected": one === column,
985
- className: one === column ? "ta-on" : undefined,
986
- onClick: () => setColumn(one)
987
- }, words[one], counts[one] ? /* @__PURE__ */ React.createElement("em", null, counts[one]) : null))), /* @__PURE__ */ React.createElement("div", {
988
- className: "tcre-col",
989
- key: column
990
- }, body(column)), /* @__PURE__ */ React.createElement("div", {
991
- className: "tcre-foot"
992
- }, settings));
993
- }
994
2903
  return /* @__PURE__ */ React.createElement("div", {
995
- className: "tcre-board"
2904
+ className: "tcre-page tcre-home",
2905
+ "data-compact": compact || undefined
996
2906
  }, /* @__PURE__ */ React.createElement("div", {
997
- className: "tcre-board-bar"
998
- }, CreatorUtil.picked(state.settings).map((platform) => /* @__PURE__ */ React.createElement(PlatformName, {
2907
+ className: "tcre-top"
2908
+ }, /* @__PURE__ */ React.createElement("div", {
2909
+ className: "tcre-topbar"
2910
+ }, !compact && CreatorUtil.picked(state.settings).map((platform) => /* @__PURE__ */ React.createElement(PlatformName, {
999
2911
  key: platform.id,
1000
2912
  platform
1001
2913
  })), /* @__PURE__ */ React.createElement("span", {
1002
2914
  className: "tcre-grow"
1003
- }), /* @__PURE__ */ React.createElement("span", {
2915
+ }), !compact && /* @__PURE__ */ React.createElement("span", {
1004
2916
  className: "tcre-pill"
1005
- }, words.minutes, " ", /* @__PURE__ */ React.createElement("b", null, format(words.minutesValue, { n: CreatorUtil.minutes(state.weeks, now) }))), settings), /* @__PURE__ */ React.createElement("div", {
1006
- className: "tcre-board-cols"
1007
- }, COLUMNS.map((one) => /* @__PURE__ */ React.createElement("section", {
1008
- key: one,
1009
- className: "tcre-board-col"
1010
- }, /* @__PURE__ */ React.createElement("header", null, words[one], !!counts[one] && /* @__PURE__ */ React.createElement("em", null, counts[one])), /* @__PURE__ */ React.createElement("div", {
1011
- className: "tcre-board-list"
1012
- }, body(one))))));
2917
+ }, words.minutes, " ", /* @__PURE__ */ React.createElement("b", null, format(words.minutesValue, { n: CreatorUtil.minutes(state.weeks, now) }))), /* @__PURE__ */ React.createElement("button", {
2918
+ type: "button",
2919
+ className: "tcre-link",
2920
+ onClick: () => setEditing(true)
2921
+ }, words.settings)), /* @__PURE__ */ React.createElement(Flow, {
2922
+ context,
2923
+ columns,
2924
+ shown,
2925
+ pick: setColumn
2926
+ }), shown !== "data" && shown !== "talk" && /* @__PURE__ */ React.createElement(SeriesBar, {
2927
+ context,
2928
+ counts: shown === "making" ? [...all.materials, ...all.making] : all[shown],
2929
+ picked: known ? series : "",
2930
+ pick: setSeries,
2931
+ add: () => setEditing(true)
2932
+ })), /* @__PURE__ */ React.createElement("div", {
2933
+ className: "tcre-body",
2934
+ key: shown
2935
+ }, body()));
2936
+ }
2937
+ function Flow({ context, columns, shown, pick }) {
2938
+ const { pi } = context;
2939
+ const state = useStore(context.store);
2940
+ const words = useWords(pi);
2941
+ const now = Date.now();
2942
+ const waiting = columns.review.filter((one) => !one.approved).length;
2943
+ const thisWeek = columns.published.filter((one) => CreatorUtil.publishedAt(one) >= new Date(`${CreatorUtil.weekOf(now)}T00:00:00`).getTime()).length;
2944
+ const materials = columns.making.filter((one) => one.stage === "materials").length;
2945
+ const making = columns.making.filter((one) => one.stage === "making");
2946
+ const step = making[0] && stepOf(making[0]);
2947
+ const answers = drafts(state.comments).length;
2948
+ const last = state.weeks.filter((one) => one.week < CreatorUtil.weekOf(now) && one.platforms.length).pop();
2949
+ const hint = {
2950
+ topic: state.settings.series.length ? format(words.flowSeries, { n: state.settings.series.length }) : words.findNow,
2951
+ making: materials ? format(words.flowMaterials, { n: materials }) : step ? `${words[step]} · ${making[0].title}` : making.length ? words.doneAll : words.flowNone,
2952
+ review: waiting ? format(words.flowWaiting, { n: waiting }) : columns.review.length ? words.flowPassed : words.flowNone,
2953
+ published: format(words.flowWeek, { n: thisWeek }),
2954
+ talk: answers ? format(words.flowDrafts, { n: answers }) : format(words.flowComments, { n: state.comments.length }),
2955
+ data: last ? `${words.lastWeek} ${short(last.platforms.reduce((all, one) => all + one.views, 0), pi.ui.language)}` : words.flowMonday
2956
+ };
2957
+ const count2 = (one) => one === "data" ? undefined : one === "talk" ? answers || undefined : columns[one].length;
2958
+ const { ChevronRight } = pi.ui.icons;
2959
+ return /* @__PURE__ */ React.createElement("div", {
2960
+ className: "tcre-flow",
2961
+ role: "tablist"
2962
+ }, COLUMNS.map((one, at) => {
2963
+ const Icon = pi.ui.icons[COLUMN_ICONS[one]];
2964
+ return /* @__PURE__ */ React.createElement(React.Fragment, {
2965
+ key: one
2966
+ }, at > 0 && /* @__PURE__ */ React.createElement("span", {
2967
+ className: "tcre-flow-arrow",
2968
+ "data-gap": one === "talk" || undefined
2969
+ }, one !== "talk" && one !== "data" && /* @__PURE__ */ React.createElement(ChevronRight, {
2970
+ size: 14
2971
+ })), /* @__PURE__ */ React.createElement("button", {
2972
+ type: "button",
2973
+ role: "tab",
2974
+ "aria-selected": one === shown,
2975
+ className: "tcre-flow-node",
2976
+ "data-stage": one,
2977
+ "data-attn": one === "review" && waiting > 0 || one === "talk" && answers > 0 || undefined,
2978
+ onClick: () => pick(one)
2979
+ }, /* @__PURE__ */ React.createElement("span", {
2980
+ className: "tcre-flow-icon"
2981
+ }, Icon && /* @__PURE__ */ React.createElement(Icon, {
2982
+ size: 17
2983
+ })), /* @__PURE__ */ React.createElement("span", {
2984
+ className: "tcre-flow-text"
2985
+ }, /* @__PURE__ */ React.createElement("span", {
2986
+ className: "tcre-flow-name"
2987
+ }, words[one], count2(one) !== undefined && /* @__PURE__ */ React.createElement("b", null, count2(one))), /* @__PURE__ */ React.createElement("span", {
2988
+ className: "tcre-flow-hint"
2989
+ }, hint[one]))));
2990
+ }));
2991
+ }
2992
+ function SeriesBar({ context, counts, picked, pick, add }) {
2993
+ const state = useStore(context.store);
2994
+ const words = useWords(context.pi);
2995
+ const { Plus } = context.pi.ui.icons;
2996
+ if (!state.settings.series.length) {
2997
+ return null;
2998
+ }
2999
+ return /* @__PURE__ */ React.createElement("div", {
3000
+ className: "tcre-series-bar"
3001
+ }, /* @__PURE__ */ React.createElement("button", {
3002
+ type: "button",
3003
+ className: "tcre-chip-btn",
3004
+ "aria-pressed": !picked,
3005
+ onClick: () => pick("")
3006
+ }, words.all, /* @__PURE__ */ React.createElement("em", null, counts.length)), state.settings.series.map((one) => /* @__PURE__ */ React.createElement("button", {
3007
+ key: one.id,
3008
+ type: "button",
3009
+ className: "tcre-chip-btn",
3010
+ "aria-pressed": picked === one.id,
3011
+ style: { "--tcre-c": one.color },
3012
+ onClick: () => pick(picked === one.id ? "" : one.id)
3013
+ }, /* @__PURE__ */ React.createElement("i", null), one.name, /* @__PURE__ */ React.createElement("em", null, counts.filter((item) => item.series === one.id).length))), /* @__PURE__ */ React.createElement("button", {
3014
+ type: "button",
3015
+ className: "tcre-chip-btn tcre-chip-add",
3016
+ "aria-label": words.addSeries,
3017
+ title: words.addSeries,
3018
+ onClick: add
3019
+ }, /* @__PURE__ */ React.createElement(Plus, {
3020
+ size: 14
3021
+ })));
1013
3022
  }
1014
- function Empty({ pi, text: text2, hint, children }) {
3023
+ function Empty({ pi, text: text3, hint, children }) {
1015
3024
  return /* @__PURE__ */ React.createElement("div", {
1016
3025
  className: "tcre-empty"
1017
3026
  }, /* @__PURE__ */ React.createElement(pi.ui.Empty, {
1018
3027
  compact: true,
1019
- title: text2,
3028
+ title: text3,
1020
3029
  hint
1021
3030
  }, children));
1022
3031
  }
1023
3032
  function kindLabel(item, words) {
1024
- return [words[item.form], words[item.kind]].join(" · ");
3033
+ return [words[item.form], words[item.kind], ...item.reach && item.reach !== "public" ? [words[item.reach]] : []].join(" · ");
1025
3034
  }
1026
- function Topics({ context, items }) {
3035
+ function Removed({ context, stage }) {
1027
3036
  const { pi, store } = context;
3037
+ const state = useStore(store);
1028
3038
  const words = useWords(pi);
1029
- const latest = items.reduce((at, one) => Math.max(at, one.at), 0);
1030
- const find = () => talk(pi, words.findNow, words.findPrompt);
3039
+ const [open, setOpen] = React.useState(false);
3040
+ const items = CreatorUtil.removed(state.items, stage);
1031
3041
  if (!items.length) {
1032
- return /* @__PURE__ */ React.createElement(Empty, {
1033
- pi,
1034
- text: words.noTopics,
1035
- hint: words.noTopicsHint
1036
- }, /* @__PURE__ */ React.createElement(BusyButton, {
1037
- pi,
1038
- className: "tcre-secondary tcre-small",
1039
- onClick: find
1040
- }, words.findNow));
3042
+ return null;
1041
3043
  }
3044
+ return /* @__PURE__ */ React.createElement("div", {
3045
+ className: "tcre-removed"
3046
+ }, /* @__PURE__ */ React.createElement("button", {
3047
+ type: "button",
3048
+ className: "tcre-link",
3049
+ onClick: () => setOpen(!open)
3050
+ }, format(words.removedLabel, { n: items.length })), open && /* @__PURE__ */ React.createElement("div", {
3051
+ className: "tcre-removed-list"
3052
+ }, items.slice(0, 30).map((item) => /* @__PURE__ */ React.createElement("div", {
3053
+ key: item.id,
3054
+ className: "tcre-removed-row"
3055
+ }, /* @__PURE__ */ React.createElement("span", null, item.title), /* @__PURE__ */ React.createElement(BusyButton, {
3056
+ pi,
3057
+ className: "tcre-text",
3058
+ onClick: () => store.call("restore", item.id)
3059
+ }, words.restore)))));
3060
+ }
3061
+ function SectionHead({ context, series, items }) {
3062
+ const state = useStore(context.store);
3063
+ const words = useWords(context.pi);
3064
+ const published = state.items.filter((one) => one.stage === "published" && !one.dropped && series && one.series === series.id).length;
3065
+ return /* @__PURE__ */ React.createElement("div", {
3066
+ className: "tcre-section-head",
3067
+ style: series ? { "--tcre-c": series.color } : undefined
3068
+ }, /* @__PURE__ */ React.createElement("i", null), /* @__PURE__ */ React.createElement("span", {
3069
+ className: "tcre-section-name"
3070
+ }, series?.name ?? words.seriesNone), series?.about && /* @__PURE__ */ React.createElement("span", {
3071
+ className: "tcre-section-about"
3072
+ }, series.about), /* @__PURE__ */ React.createElement("span", {
3073
+ className: "tcre-grow"
3074
+ }), series && /* @__PURE__ */ React.createElement("span", {
3075
+ className: "tcre-section-stat"
3076
+ }, format(words.seriesStat, { published, waiting: items.length })));
3077
+ }
3078
+ function Topics({ context, items, series }) {
3079
+ const { pi } = context;
3080
+ const state = useStore(context.store);
3081
+ const words = useWords(pi);
3082
+ const latest = items.reduce((at, one) => Math.max(at, one.at), 0);
3083
+ const find = () => talk(pi, words.findNow, words.findPrompt);
3084
+ const groups = CreatorUtil.bySeries(items, state.settings.series).filter((group) => group.items.length || group.series?.id === series);
1042
3085
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
1043
3086
  className: "tcre-h"
1044
3087
  }, /* @__PURE__ */ React.createElement("span", null, latest ? format(words.hotAt, {
1045
3088
  time: new Date(latest).toLocaleTimeString(pi.ui.language, { hour: "2-digit", minute: "2-digit", hour12: false })
1046
3089
  }) : ""), /* @__PURE__ */ React.createElement(BusyButton, {
1047
3090
  pi,
1048
- className: "tcre-link",
3091
+ className: "tcre-secondary tcre-small",
1049
3092
  onClick: find
1050
- }, words.findNow)), items.map((item) => /* @__PURE__ */ React.createElement("div", {
3093
+ }, words.findNow)), !items.length && /* @__PURE__ */ React.createElement(Empty, {
3094
+ pi,
3095
+ text: words.noTopics,
3096
+ hint: words.noTopicsHint
3097
+ }), groups.map((group) => /* @__PURE__ */ React.createElement(TopicGroup, {
3098
+ key: group.series?.id ?? "-",
3099
+ context,
3100
+ series: group.series,
3101
+ items: group.items,
3102
+ whole: !!series
3103
+ })), /* @__PURE__ */ React.createElement(Removed, {
3104
+ context,
3105
+ stage: "topic"
3106
+ }));
3107
+ }
3108
+ function TopicGroup({ context, series, items, whole }) {
3109
+ const words = useWords(context.pi);
3110
+ const [open, setOpen] = React.useState(whole);
3111
+ const shown = open ? items : items.slice(0, FIRST);
3112
+ return /* @__PURE__ */ React.createElement("section", {
3113
+ className: "tcre-section"
3114
+ }, /* @__PURE__ */ React.createElement(SectionHead, {
3115
+ context,
3116
+ series,
3117
+ items
3118
+ }), /* @__PURE__ */ React.createElement("div", {
3119
+ className: "tcre-grid"
3120
+ }, shown.map((item) => /* @__PURE__ */ React.createElement(Topic, {
1051
3121
  key: item.id,
3122
+ context,
3123
+ item
3124
+ }))), items.length > FIRST && /* @__PURE__ */ React.createElement("button", {
3125
+ type: "button",
3126
+ className: "tcre-more",
3127
+ onClick: () => setOpen(!open)
3128
+ }, open ? words.showLess : format(words.showAll, { n: items.length })));
3129
+ }
3130
+ function Topic({ context, item }) {
3131
+ const { pi } = context;
3132
+ const words = useWords(pi);
3133
+ return /* @__PURE__ */ React.createElement("div", {
1052
3134
  className: "tcre-card tcre-topic"
1053
3135
  }, /* @__PURE__ */ React.createElement("div", {
3136
+ className: "tcre-topic-meta"
3137
+ }, item.number ? /* @__PURE__ */ React.createElement("span", {
3138
+ className: "tcre-ep"
3139
+ }, format(words.episode, { n: item.number })) : null, /* @__PURE__ */ React.createElement("span", {
3140
+ className: "tcre-chip"
3141
+ }, kindLabel(item, words)), item.heat !== undefined && item.kind === "hot" && /* @__PURE__ */ React.createElement("span", {
3142
+ className: "tcre-heat"
3143
+ }, format(words.heat, { n: item.heat })), /* @__PURE__ */ React.createElement("span", {
3144
+ className: "tcre-grow"
3145
+ }), /* @__PURE__ */ React.createElement(IconButton, {
3146
+ pi,
3147
+ icon: "Trash2",
3148
+ label: words.remove,
3149
+ onClick: () => remove(context, item)
3150
+ })), /* @__PURE__ */ React.createElement("div", {
1054
3151
  className: "tcre-topic-title"
1055
3152
  }, item.title), item.why && /* @__PURE__ */ React.createElement("p", null, item.why), /* @__PURE__ */ React.createElement("div", {
1056
3153
  className: "tcre-topic-foot"
1057
- }, /* @__PURE__ */ React.createElement("span", {
1058
- className: "tcre-chips"
1059
- }, /* @__PURE__ */ React.createElement("span", {
1060
- className: "tcre-chip"
1061
- }, kindLabel(item, words)), item.heat !== undefined && /* @__PURE__ */ React.createElement("span", {
1062
- className: "tcre-heat"
1063
- }, format(words.heat, { n: item.heat }))), /* @__PURE__ */ React.createElement("span", {
1064
- className: "tcre-buttons-inline"
1065
3154
  }, /* @__PURE__ */ React.createElement(BusyButton, {
3155
+ pi,
3156
+ className: "tcre-primary tcre-small",
3157
+ onClick: () => make(context, item)
3158
+ }, words.make)));
3159
+ }
3160
+ function Waiting({ context, item }) {
3161
+ const { pi, store } = context;
3162
+ const words = useWords(pi);
3163
+ const { Check, Circle } = pi.ui.icons;
3164
+ const skip = async () => {
3165
+ await store.call("skip", item.id);
3166
+ await tell(context, item, format(words.skipPrompt, { id: item.id }));
3167
+ };
3168
+ return /* @__PURE__ */ React.createElement("div", {
3169
+ className: "tcre-card tcre-making tcre-waiting"
3170
+ }, /* @__PURE__ */ React.createElement("div", {
3171
+ className: "tcre-making-head"
3172
+ }, /* @__PURE__ */ React.createElement("div", {
3173
+ className: "tcre-making-main"
3174
+ }, /* @__PURE__ */ React.createElement(SeriesTag, {
3175
+ series: seriesOf(context, item.series),
3176
+ number: item.number,
3177
+ words
3178
+ }), /* @__PURE__ */ React.createElement("span", {
3179
+ className: "tcre-making-title"
3180
+ }, item.title)), /* @__PURE__ */ React.createElement(IconButton, {
3181
+ pi,
3182
+ icon: "Trash2",
3183
+ label: words.remove,
3184
+ onClick: () => remove(context, item)
3185
+ })), /* @__PURE__ */ React.createElement("ul", {
3186
+ className: "tcre-needs"
3187
+ }, (item.needs ?? []).map((need) => /* @__PURE__ */ React.createElement("li", {
3188
+ key: need.id,
3189
+ "data-done": need.done || undefined
3190
+ }, need.done ? /* @__PURE__ */ React.createElement(Check, {
3191
+ size: 14
3192
+ }) : /* @__PURE__ */ React.createElement(Circle, {
3193
+ size: 14
3194
+ }), need.text))), /* @__PURE__ */ React.createElement("div", {
3195
+ className: "tcre-buttons"
3196
+ }, /* @__PURE__ */ React.createElement("span", {
3197
+ className: "tcre-muted tcre-needs-hint"
3198
+ }, words.needsHint), /* @__PURE__ */ React.createElement("span", {
3199
+ className: "tcre-grow"
3200
+ }), /* @__PURE__ */ React.createElement(BusyButton, {
1066
3201
  pi,
1067
3202
  className: "tcre-text",
1068
- onClick: () => store.call("drop", item.id)
1069
- }, words.drop), /* @__PURE__ */ React.createElement(BusyButton, {
3203
+ onClick: skip
3204
+ }, words.skipNeeds), /* @__PURE__ */ React.createElement(BusyButton, {
1070
3205
  pi,
1071
- className: "tcre-primary",
1072
- onClick: () => make(context, item)
1073
- }, words.make))))));
3206
+ className: "tcre-primary tcre-small",
3207
+ onClick: () => openPiece(context, item)
3208
+ }, words.giveNow)));
1074
3209
  }
1075
3210
  function Making({ context, items }) {
1076
- const words = useWords(context.pi);
1077
- if (!items.length) {
1078
- return /* @__PURE__ */ React.createElement(Empty, {
1079
- pi: context.pi,
1080
- text: words.makingEmpty
1081
- });
1082
- }
1083
- return /* @__PURE__ */ React.createElement(React.Fragment, null, items.map((item) => /* @__PURE__ */ React.createElement(BusyButton, {
3211
+ const { pi } = context;
3212
+ const words = useWords(pi);
3213
+ const waiting = items.filter((one) => one.stage === "materials");
3214
+ const making = items.filter((one) => one.stage === "making");
3215
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, !items.length && /* @__PURE__ */ React.createElement(Empty, {
3216
+ pi,
3217
+ text: words.makingEmpty
3218
+ }), waiting.length > 0 && /* @__PURE__ */ React.createElement("section", {
3219
+ className: "tcre-section"
3220
+ }, /* @__PURE__ */ React.createElement("div", {
3221
+ className: "tcre-h"
3222
+ }, /* @__PURE__ */ React.createElement("span", null, words.needsTitle)), /* @__PURE__ */ React.createElement("div", {
3223
+ className: "tcre-list"
3224
+ }, waiting.map((item) => /* @__PURE__ */ React.createElement(Waiting, {
1084
3225
  key: item.id,
1085
- pi: context.pi,
1086
- className: "tcre-card tcre-making",
1087
- onClick: () => openPiece(context, item)
1088
- }, /* @__PURE__ */ React.createElement("span", {
1089
- className: "tcre-making-title"
1090
- }, item.title), /* @__PURE__ */ React.createElement(Steps, {
3226
+ context,
3227
+ item
3228
+ })))), /* @__PURE__ */ React.createElement("div", {
3229
+ className: "tcre-list"
3230
+ }, making.map((item) => {
3231
+ const series = seriesOf(context, item.series);
3232
+ return /* @__PURE__ */ React.createElement("div", {
3233
+ key: item.id,
3234
+ className: "tcre-card tcre-making"
3235
+ }, /* @__PURE__ */ React.createElement("div", {
3236
+ className: "tcre-making-head"
3237
+ }, /* @__PURE__ */ React.createElement("div", {
3238
+ className: "tcre-making-main"
3239
+ }, /* @__PURE__ */ React.createElement(SeriesTag, {
3240
+ series,
3241
+ number: item.number,
3242
+ words
3243
+ }), /* @__PURE__ */ React.createElement("span", {
3244
+ className: "tcre-making-title"
3245
+ }, item.title)), /* @__PURE__ */ React.createElement(BusyButton, {
3246
+ pi,
3247
+ className: "tcre-secondary tcre-small",
3248
+ onClick: () => openPiece(context, item)
3249
+ }, words.openChat), /* @__PURE__ */ React.createElement(IconButton, {
3250
+ pi,
3251
+ icon: "Trash2",
3252
+ label: words.remove,
3253
+ onClick: () => remove(context, item)
3254
+ })), /* @__PURE__ */ React.createElement(Pipeline, {
3255
+ pi,
3256
+ item,
3257
+ words,
3258
+ color: series?.color
3259
+ }));
3260
+ })), /* @__PURE__ */ React.createElement(Removed, {
3261
+ context,
3262
+ stage: "making"
3263
+ }), /* @__PURE__ */ React.createElement(Removed, {
3264
+ context,
3265
+ stage: "materials"
3266
+ }));
3267
+ }
3268
+ function Reviews({ context, items }) {
3269
+ const { pi } = context;
3270
+ const words = useWords(pi);
3271
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, !items.length && /* @__PURE__ */ React.createElement(Empty, {
3272
+ pi,
3273
+ text: words.reviewEmpty
3274
+ }), /* @__PURE__ */ React.createElement("div", {
3275
+ className: "tcre-grid tcre-grid-wide"
3276
+ }, items.map((item) => /* @__PURE__ */ React.createElement(ReviewCard, {
3277
+ key: item.id,
3278
+ context,
1091
3279
  item,
1092
- words
1093
- }))));
3280
+ onRemove: () => remove(context, item)
3281
+ }))), /* @__PURE__ */ React.createElement(Removed, {
3282
+ context,
3283
+ stage: "review"
3284
+ }));
1094
3285
  }
1095
3286
  function Published({ context, items }) {
1096
3287
  const { pi } = context;
@@ -1101,181 +3292,176 @@ function Published({ context, items }) {
1101
3292
  text: words.publishedEmpty
1102
3293
  });
1103
3294
  }
1104
- return /* @__PURE__ */ React.createElement(React.Fragment, null, items.map((item) => /* @__PURE__ */ React.createElement("div", {
1105
- key: item.id,
1106
- className: "tcre-card tcre-pub"
1107
- }, /* @__PURE__ */ React.createElement("span", {
1108
- className: "tcre-pub-main"
1109
- }, /* @__PURE__ */ React.createElement("span", {
1110
- className: "tcre-pub-title"
1111
- }, item.title), /* @__PURE__ */ React.createElement("span", {
1112
- className: "tcre-pub-kind"
1113
- }, words[item.form]), /* @__PURE__ */ React.createElement("span", {
1114
- className: "tcre-pub-links"
1115
- }, (item.links ?? []).map((link) => /* @__PURE__ */ React.createElement(BusyButton, {
1116
- key: link.platform,
1117
- pi,
1118
- className: "tcre-text",
1119
- onClick: () => pi.openLink?.(link.url)
1120
- }, /* @__PURE__ */ React.createElement(PlatformName, {
1121
- platform: platformOf(context, link.platform)
1122
- }))))))));
1123
- }
1124
- function Numbers({ context, board }) {
1125
- const { pi } = context;
1126
- const state = useStore(context.store);
1127
- const words = useWords(pi);
1128
- const now = Date.now();
1129
- const thisWeek = CreatorUtil.weekOf(now);
1130
- const weeks = state.weeks.filter((one) => one.week < thisWeek && one.platforms.length);
1131
- const last = weeks[weeks.length - 1];
1132
- const before = weeks[weeks.length - 2];
1133
- const sum = (week, key) => (week?.platforms ?? []).reduce((all, one) => all + (one[key] ?? 0), 0);
1134
- const delta = (a, b) => b > 0 ? `${a >= b ? "+" : ""}${Math.round((a - b) / b * 100)}%` : "";
1135
- const progress = CreatorUtil.progress(state.items, state.settings.goal, now);
1136
- const goal = state.settings.goal;
1137
- const most = Math.max(1, ...(last?.platforms ?? []).map((one) => one.views));
1138
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
1139
- className: "tcre-card tcre-stats"
1140
- }, /* @__PURE__ */ React.createElement("div", {
1141
- className: "tcre-stats-row"
1142
- }, /* @__PURE__ */ React.createElement("div", {
1143
- className: "tcre-stat",
1144
- "data-none": last ? undefined : true
1145
- }, /* @__PURE__ */ React.createElement("b", null, last ? short(sum(last, "views"), pi.ui.language) : "—", last && before && /* @__PURE__ */ React.createElement("em", null, delta(sum(last, "views"), sum(before, "views")))), /* @__PURE__ */ React.createElement("span", null, words.views)), /* @__PURE__ */ React.createElement("div", {
1146
- className: "tcre-stat",
1147
- "data-none": last ? undefined : true
1148
- }, /* @__PURE__ */ React.createElement("b", null, last ? short(sum(last, "follows"), pi.ui.language) : "—"), /* @__PURE__ */ React.createElement("span", null, words.follows)), !board && /* @__PURE__ */ React.createElement("div", {
1149
- className: "tcre-stat"
1150
- }, /* @__PURE__ */ React.createElement("b", null, format(words.minutesValue, { n: CreatorUtil.minutes(state.weeks, now) })), /* @__PURE__ */ React.createElement("span", null, words.minutes))), !last && /* @__PURE__ */ React.createElement("div", {
1151
- className: "tcre-stats-note"
1152
- }, words.noData)), last && /* @__PURE__ */ React.createElement("div", {
1153
- className: "tcre-card tcre-bars"
1154
- }, last.platforms.map((one) => {
1155
- const platform = platformOf(context, one.platform);
3295
+ return /* @__PURE__ */ React.createElement("div", {
3296
+ className: "tcre-card tcre-rows"
3297
+ }, items.map((item) => {
3298
+ const views = CreatorUtil.views(item);
1156
3299
  return /* @__PURE__ */ React.createElement("div", {
1157
- key: one.platform,
1158
- className: "tcre-bar"
3300
+ key: item.id,
3301
+ className: "tcre-pub"
3302
+ }, /* @__PURE__ */ React.createElement("div", {
3303
+ className: "tcre-pub-main"
1159
3304
  }, /* @__PURE__ */ React.createElement("span", {
1160
- className: "tcre-bar-label"
1161
- }, platform?.name ?? one.platform), /* @__PURE__ */ React.createElement("span", {
1162
- className: "tcre-bar-track"
1163
- }, /* @__PURE__ */ React.createElement("i", {
1164
- style: { width: `${one.views / most * 100}%`, background: platform?.color }
1165
- })), /* @__PURE__ */ React.createElement("span", {
1166
- className: "tcre-bar-value"
1167
- }, short(one.views, pi.ui.language)));
1168
- })), goal && progress && /* @__PURE__ */ React.createElement("div", {
1169
- className: "tcre-card tcre-goal"
1170
- }, /* @__PURE__ */ React.createElement("div", {
1171
- className: "tcre-goal-title"
1172
- }, format(words.goal, { days: goal.days }), /* @__PURE__ */ React.createElement("span", {
1173
- className: "tcre-muted"
1174
- }, format(words.goalDay, { day: progress.day }))), [
1175
- [words.video, progress.videos, goal.videos],
1176
- [words.post, progress.posts, goal.posts]
1177
- ].map(([label, made, aim]) => /* @__PURE__ */ React.createElement("div", {
1178
- key: label
1179
- }, /* @__PURE__ */ React.createElement("div", {
1180
- className: "tcre-goal-row"
1181
- }, /* @__PURE__ */ React.createElement("span", null, label), /* @__PURE__ */ React.createElement("span", {
1182
- className: "tcre-muted"
1183
- }, made, " / ", aim)), /* @__PURE__ */ React.createElement("div", {
1184
- className: "tcre-goal-track"
1185
- }, /* @__PURE__ */ React.createElement("i", {
1186
- style: { width: `${aim ? Math.min(100, made / aim * 100) : 0}%` }
1187
- }))))));
1188
- }
1189
- function Setup({ context, done }) {
1190
- const { pi, store } = context;
1191
- const state = useStore(store);
1192
- const words = useWords(pi);
1193
- const [niche, setNiche] = React.useState(state.settings.niche);
1194
- const [picked, setPicked] = React.useState(state.settings.picked);
1195
- const save = (goal) => store.call("setSettings", {
1196
- niche: niche.trim(),
1197
- picked,
1198
- ...goal ? { goal: { from: Date.now(), days: 30, videos: 8, posts: 12 } } : {}
1199
- }).then(done);
1200
- return /* @__PURE__ */ React.createElement("div", {
1201
- className: "tcre-setup"
1202
- }, /* @__PURE__ */ React.createElement("div", {
1203
- className: "tcre-setup-title"
1204
- }, words.setupTitle), /* @__PURE__ */ React.createElement("textarea", {
1205
- className: "tcre-input",
1206
- rows: 2,
1207
- value: niche,
1208
- placeholder: words.nicheHint,
1209
- onChange: (event) => setNiche(event.target.value)
1210
- }), /* @__PURE__ */ React.createElement("div", {
1211
- className: "tcre-setup-label"
1212
- }, words.platformsLabel), /* @__PURE__ */ React.createElement("div", {
1213
- className: "tcre-pick"
1214
- }, state.settings.platforms.map((platform) => {
1215
- const on = picked.includes(platform.id);
1216
- return /* @__PURE__ */ React.createElement("button", {
1217
- key: platform.id,
1218
- type: "button",
1219
- "aria-pressed": on,
1220
- onClick: () => setPicked(on ? picked.filter((id) => id !== platform.id) : [...picked, platform.id])
3305
+ className: "tcre-pub-title"
3306
+ }, item.title), /* @__PURE__ */ React.createElement("span", {
3307
+ className: "tcre-pub-meta"
3308
+ }, /* @__PURE__ */ React.createElement(SeriesTag, {
3309
+ series: seriesOf(context, item.series),
3310
+ number: item.number,
3311
+ words
3312
+ }), /* @__PURE__ */ React.createElement("span", null, words[item.form]), /* @__PURE__ */ React.createElement("span", null, new Date(CreatorUtil.publishedAt(item)).toLocaleDateString(pi.ui.language, { month: "numeric", day: "numeric" })), (item.links ?? []).map((link) => /* @__PURE__ */ React.createElement(BusyButton, {
3313
+ key: link.platform,
3314
+ pi,
3315
+ className: "tcre-text tcre-pf-link",
3316
+ onClick: () => pi.openLink?.(link.url)
1221
3317
  }, /* @__PURE__ */ React.createElement(PlatformName, {
1222
- platform
1223
- }));
1224
- })), /* @__PURE__ */ React.createElement("div", {
1225
- className: "tcre-buttons"
1226
- }, !state.settings.goal && /* @__PURE__ */ React.createElement(BusyButton, {
1227
- pi,
1228
- className: "tcre-secondary",
1229
- disabled: !picked.length,
1230
- onClick: () => save(true)
1231
- }, words.startGoal), /* @__PURE__ */ React.createElement(BusyButton, {
1232
- pi,
1233
- className: "tcre-primary",
1234
- disabled: !picked.length,
1235
- onClick: () => save(false)
1236
- }, state.settings.picked.length ? words.save : words.start)));
3318
+ platform: platformOf(context, link.platform)
3319
+ }))))), /* @__PURE__ */ React.createElement("span", {
3320
+ className: "tcre-pub-views",
3321
+ "data-none": views === undefined || undefined
3322
+ }, views === undefined ? "—" : short(views, pi.ui.language), /* @__PURE__ */ React.createElement("small", null, words.views)));
3323
+ }));
1237
3324
  }
1238
3325
 
1239
3326
  // web-src/style.ts
1240
3327
  var STYLE = `
1241
3328
  .tcre-page { height: 100%; overflow-y: auto; box-sizing: border-box; padding: 4px 16px calc(24px + env(safe-area-inset-bottom)); background: var(--ta-side); color: var(--ta-text); font-size: calc(14px * var(--ta-font-scale)); line-height: 1.5; }
1242
- :root:not([data-theme='light']) :is(.tcre-page, .tcre-board) { --ta-card: var(--ta-raised); }
3329
+ :root:not([data-theme='light']) .tcre-page { --ta-card: var(--ta-raised); }
3330
+ .tcre-page { --tcre-line: color-mix(in oklab, var(--ta-text) 9%, transparent); --tcre-ok: var(--ta-success, #16a34a); }
1243
3331
  .tcre-pagehead { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.25; }
1244
3332
  .tcre-pagehead-title { font-weight: 600; font-size: calc(15px * var(--ta-font-scale)); }
1245
3333
  .tcre-pagehead-sub { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: calc(11.5px * var(--ta-font-scale)); }
1246
- .tcre-seg { margin: 6px 0 12px; }
1247
- .tcre-seg button { min-width: 0; height: calc(32px * var(--ta-font-scale)); padding: 0 2px; gap: 3px; font-size: calc(13.5px * var(--ta-font-scale)); white-space: nowrap; }
1248
- .tcre-seg .ta-on { font-weight: 600; }
1249
- .tcre-seg em, .tcre-board-col header em { font-style: normal; font-weight: 400; font-size: calc(11px * var(--ta-font-scale)); color: var(--ta-muted); font-variant-numeric: tabular-nums; }
1250
- .tcre-col { animation: tcre-in 160ms var(--ta-ease); }
1251
- @keyframes tcre-in { from { opacity: 0; } }
1252
- .tcre-h { display: flex; justify-content: space-between; align-items: center; margin: 4px 4px 8px; color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); }
1253
- .tcre-card { display: block; width: 100%; box-sizing: border-box; margin: 0 0 10px; padding: 13px 14px; border: 0; border-radius: 16px; background: var(--ta-card); color: inherit; font: inherit; text-align: left; }
1254
- :root[data-theme='light'] .tcre-card { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
1255
- button.tcre-card { cursor: pointer; -webkit-tap-highlight-color: transparent; }
1256
- .tcre-topic-title, .tcre-making-title, .tcre-review-title { display: block; font-size: calc(15.5px * var(--ta-font-scale)); font-weight: 600; line-height: 1.4; }
1257
- .tcre-topic p { margin: 5px 0 10px; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }
1258
- .tcre-topic-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
1259
- .tcre-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
1260
- .tcre-chip { padding: 2px 8px; border-radius: 999px; background: var(--ta-chip); color: var(--ta-secondary); font-size: calc(11.5px * var(--ta-font-scale)); white-space: nowrap; }
3334
+ .tcre-grow { flex: 1; }
3335
+ .tcre-muted { color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); font-weight: 400; }
3336
+ .tcre-pad { padding: 6px 2px; }
3337
+
3338
+ /* The page: the top (bar, stations, series), then the station picked with room to read. */
3339
+ .tcre-home { padding: 0 0 calc(32px + env(safe-area-inset-bottom)); }
3340
+ .tcre-top { padding: 10px 28px 0; }
3341
+ .tcre-body { box-sizing: border-box; max-width: calc(var(--ta-page-wide) + 56px); margin: 0 auto; padding: 18px 28px 0; animation: tcre-in 180ms var(--ta-ease); }
3342
+ .tcre-home[data-compact] .tcre-body { max-width: none; }
3343
+ .tcre-home[data-compact] .tcre-top { padding: 4px 14px 0; }
3344
+ .tcre-home[data-compact] .tcre-body { padding: 14px 14px 0; }
3345
+ @keyframes tcre-in { from { opacity: 0; transform: translateY(4px); } }
3346
+ .tcre-topbar { display: flex; align-items: center; gap: 14px; min-height: 34px; max-width: var(--ta-page-wide); margin: 0 auto; }
3347
+ .tcre-pill { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--ta-chip); color: var(--ta-muted); font: inherit; font-size: calc(12.5px * var(--ta-font-scale)); white-space: nowrap; }
3348
+ button.tcre-pill { cursor: pointer; }
3349
+ button.tcre-pill:hover { background: var(--ta-hover); }
3350
+ .tcre-pill b { color: var(--ta-text); font-weight: 600; }
3351
+
3352
+ /* The stations a piece goes through. */
3353
+ .tcre-flow { display: flex; align-items: stretch; max-width: var(--ta-page-wide); margin: 14px auto 0; padding: 6px; border-radius: 18px; background: var(--ta-card); box-sizing: border-box; }
3354
+ :root[data-theme='light'] .tcre-flow { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), inset 0 0 0 1px var(--tcre-line); }
3355
+ .tcre-flow-node { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 11px; padding: 10px 12px; border: 0; border-radius: 13px; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background 160ms var(--ta-ease); -webkit-tap-highlight-color: transparent; }
3356
+ .tcre-flow-node:hover { background: var(--ta-hover); }
3357
+ .tcre-flow-node[aria-selected='true'] { background: var(--ta-side); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
3358
+ :root:not([data-theme='light']) .tcre-flow-node[aria-selected='true'] { background: color-mix(in oklab, var(--ta-text) 9%, transparent); box-shadow: none; }
3359
+ .tcre-flow-icon { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: var(--tcre-s); background: color-mix(in oklab, var(--tcre-s) 15%, transparent); }
3360
+ .tcre-flow-node[data-stage='topic'] { --tcre-s: #eab308; }
3361
+ .tcre-flow-node[data-stage='making'] { --tcre-s: #3b82f6; }
3362
+ .tcre-flow-node[data-stage='review'] { --tcre-s: #f97316; }
3363
+ .tcre-flow-node[data-stage='published'] { --tcre-s: #22c55e; }
3364
+ .tcre-flow-node[data-stage='data'] { --tcre-s: #a855f7; }
3365
+ .tcre-flow-node[data-attn] .tcre-flow-icon { position: relative; }
3366
+ .tcre-flow-node[data-attn] .tcre-flow-icon::after { content: ''; position: absolute; top: -2px; right: -2px; width: 9px; height: 9px; border-radius: 50%; background: #f97316; box-shadow: 0 0 0 2px var(--ta-card); }
3367
+ .tcre-flow-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
3368
+ .tcre-flow-name { display: flex; align-items: baseline; gap: 6px; font-size: calc(13.5px * var(--ta-font-scale)); font-weight: 600; white-space: nowrap; }
3369
+ .tcre-flow-name b { font-size: calc(17px * var(--ta-font-scale)); font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.2px; }
3370
+ .tcre-flow-hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: calc(11.5px * var(--ta-font-scale)); }
3371
+ .tcre-flow-node[data-attn] .tcre-flow-hint { color: #f97316; }
3372
+ .tcre-flow-arrow { flex: none; width: 16px; display: grid; place-items: center; color: var(--ta-muted); opacity: 0.6; }
3373
+ .tcre-flow-arrow[data-gap] { width: 13px; position: relative; }
3374
+ .tcre-flow-arrow[data-gap]::before { content: ''; width: 1px; height: 60%; background: var(--tcre-line); }
3375
+ .tcre-home[data-compact] .tcre-flow { margin-top: 8px; padding: 4px; border-radius: 16px; }
3376
+ .tcre-home[data-compact] .tcre-flow-node { flex-direction: column; gap: 4px; padding: 8px 2px 7px; text-align: center; }
3377
+ .tcre-home[data-compact] .tcre-flow-icon { width: 30px; height: 30px; border-radius: 10px; }
3378
+ .tcre-home[data-compact] .tcre-flow-text { align-items: center; }
3379
+ .tcre-home[data-compact] .tcre-flow-name { gap: 3px; font-size: calc(12px * var(--ta-font-scale)); font-weight: 500; }
3380
+ .tcre-home[data-compact] .tcre-flow-name b { font-size: calc(12px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-secondary); }
3381
+ .tcre-home[data-compact] .tcre-flow-node[aria-selected='true'] .tcre-flow-name { font-weight: 600; }
3382
+ .tcre-home[data-compact] .tcre-flow-hint { display: none; }
3383
+ .tcre-home[data-compact] .tcre-flow-arrow { width: 6px; }
3384
+ .tcre-home[data-compact] .tcre-flow-arrow svg { display: none; }
3385
+
3386
+ /* The series, as chips to look at one at a time. */
3387
+ .tcre-series-bar { display: flex; gap: 8px; max-width: var(--ta-page-wide); margin: 14px auto 0; overflow-x: auto; scrollbar-width: none; }
3388
+ .tcre-series-bar::-webkit-scrollbar { display: none; }
3389
+ .tcre-chip-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--ta-secondary); font: inherit; font-size: calc(13px * var(--ta-font-scale)); white-space: nowrap; cursor: pointer; box-shadow: inset 0 0 0 1px var(--tcre-line); }
3390
+ .tcre-chip-btn:hover { background: var(--ta-hover); }
3391
+ .tcre-chip-btn i { width: 8px; height: 8px; border-radius: 3px; background: var(--tcre-c); }
3392
+ .tcre-chip-btn em { font-style: normal; color: var(--ta-muted); font-size: calc(11.5px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; }
3393
+ .tcre-chip-btn[aria-pressed='true'] { background: var(--ta-text); color: var(--ta-side); box-shadow: none; font-weight: 600; }
3394
+ .tcre-chip-btn[aria-pressed='true'] em { color: color-mix(in oklab, var(--ta-side) 70%, transparent); }
3395
+ .tcre-chip-add { width: 30px; padding: 0; justify-content: center; color: var(--ta-muted); }
3396
+
3397
+ /* Cards. */
3398
+ .tcre-card { display: block; width: 100%; box-sizing: border-box; margin: 0; padding: 14px 16px; border: 0; border-radius: 16px; background: var(--ta-card); color: inherit; font: inherit; text-align: left; }
3399
+ :root[data-theme='light'] .tcre-card { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), inset 0 0 0 1px var(--tcre-line); }
3400
+ .tcre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
3401
+ .tcre-grid-wide { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); align-items: start; }
3402
+ .tcre-list { display: flex; flex-direction: column; gap: 12px; }
3403
+ .tcre-h { display: flex; justify-content: space-between; align-items: center; margin: 0 2px 14px; color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); }
3404
+ .tcre-chip { padding: 1px 8px; border-radius: 999px; background: var(--ta-chip); color: var(--ta-secondary); font-size: calc(11.5px * var(--ta-font-scale)); white-space: nowrap; }
1261
3405
  .tcre-heat { color: var(--ta-warning, #d97706); font-size: calc(12px * var(--ta-font-scale)); font-weight: 600; white-space: nowrap; }
1262
- .tcre-buttons-inline { display: flex; align-items: center; gap: 4px; flex: none; }
1263
- .tcre-primary, .tcre-secondary { height: calc(32px * var(--ta-font-scale)); padding: 0 14px; border: 0; border-radius: 999px; font: inherit; font-size: calc(13.5px * var(--ta-font-scale)); font-weight: 600; white-space: nowrap; cursor: pointer; }
3406
+ .tcre-ep { padding: 1px 8px; border-radius: 999px; background: color-mix(in oklab, var(--tcre-c, var(--ta-text)) 14%, transparent); color: var(--tcre-c, var(--ta-text)); font-size: calc(11.5px * var(--ta-font-scale)); font-weight: 600; white-space: nowrap; }
3407
+ .tcre-primary, .tcre-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: calc(34px * var(--ta-font-scale)); padding: 0 16px; border: 0; border-radius: 999px; font: inherit; font-size: calc(13.5px * var(--ta-font-scale)); font-weight: 600; white-space: nowrap; cursor: pointer; }
1264
3408
  .tcre-primary { background: var(--ta-text); color: var(--ta-side); }
1265
3409
  .tcre-secondary { background: var(--ta-chip); color: var(--ta-text); font-weight: 500; }
1266
3410
  .tcre-primary:disabled, .tcre-secondary:disabled { opacity: 0.5; cursor: default; }
3411
+ .tcre-small { height: calc(30px * var(--ta-font-scale)); padding: 0 14px; font-size: calc(12.5px * var(--ta-font-scale)); }
1267
3412
  .tcre-text, .tcre-link { border: 0; background: transparent; color: var(--ta-secondary); font: inherit; font-size: calc(13px * var(--ta-font-scale)); padding: 4px 6px; cursor: pointer; }
1268
- .tcre-link { color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); }
1269
- .tcre-steps { display: flex; gap: 4px; margin: 10px 0 6px; }
1270
- .tcre-steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--ta-chip); }
1271
- .tcre-steps i[data-state='done'] { background: var(--ta-text); }
1272
- .tcre-steps i[data-state='now'] { background: color-mix(in oklab, var(--ta-text) 40%, var(--ta-chip)); }
1273
- .tcre-steps-label { display: flex; justify-content: space-between; gap: 8px; color: var(--ta-muted); font-size: calc(11.5px * var(--ta-font-scale)); }
1274
- .tcre-steps-label span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1275
- .tcre-steps-label span:last-child { flex: none; white-space: nowrap; }
3413
+ .tcre-link { padding: 5px 10px; border-radius: 999px; color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); }
3414
+ .tcre-link:hover { background: var(--ta-hover); color: var(--ta-text); }
3415
+ .tcre-icon { flex: none; width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--ta-muted); cursor: pointer; }
3416
+ .tcre-icon:hover { background: var(--ta-hover); color: var(--ta-text); }
3417
+ .tcre-icon:disabled { opacity: 0.5; }
1276
3418
  .tcre-pf { display: inline-flex; align-items: center; gap: 5px; color: var(--ta-secondary); font-size: calc(12.5px * var(--ta-font-scale)); white-space: nowrap; }
1277
3419
  .tcre-pf i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
3420
+ .tcre-series-tag { display: inline-flex; align-items: center; gap: 5px; min-width: 0; color: var(--ta-secondary); font-size: calc(12px * var(--ta-font-scale)); white-space: nowrap; }
3421
+ .tcre-series-tag i { flex: none; width: 7px; height: 7px; border-radius: 2px; background: var(--tcre-c); }
3422
+ .tcre-series-tag b { margin-left: 2px; color: var(--tcre-c, var(--ta-text)); font-weight: 600; }
3423
+
3424
+ /* Topics, by series. */
3425
+ .tcre-section + .tcre-section { margin-top: 28px; }
3426
+ .tcre-section-head { display: flex; align-items: center; gap: 10px; margin: 0 2px 12px; min-width: 0; }
3427
+ .tcre-section-head > i { flex: none; width: 4px; height: 18px; border-radius: 2px; background: var(--tcre-c, var(--ta-muted)); }
3428
+ .tcre-section-name { flex: none; font-size: calc(15px * var(--ta-font-scale)); font-weight: 650; }
3429
+ .tcre-section-about { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); }
3430
+ .tcre-section-stat { flex: none; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; }
3431
+ .tcre-topic { display: flex; flex-direction: column; padding: 12px 14px 14px; }
3432
+ .tcre-topic-meta { display: flex; align-items: center; gap: 6px; min-height: 28px; margin: -4px -6px 4px 0; }
3433
+ .tcre-topic-title { font-size: calc(15px * var(--ta-font-scale)); font-weight: 600; line-height: 1.45; }
3434
+ .tcre-topic p { flex: 1; margin: 6px 0 12px; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
3435
+ .tcre-topic-foot { display: flex; justify-content: flex-end; margin-top: auto; }
3436
+ .tcre-more { display: block; margin: 12px auto 0; padding: 6px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--ta-muted); font: inherit; font-size: calc(12.5px * var(--ta-font-scale)); cursor: pointer; }
3437
+ .tcre-more:hover { background: var(--ta-hover); color: var(--ta-text); }
3438
+
3439
+ /* Making: the stations of a piece. */
3440
+ .tcre-making { padding: 16px 18px 14px; }
3441
+ .tcre-making-head { display: flex; align-items: center; gap: 8px; }
3442
+ .tcre-making-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
3443
+ .tcre-making-title { font-size: calc(15.5px * var(--ta-font-scale)); font-weight: 600; line-height: 1.4; }
3444
+ .tcre-pipe-wrap { --tcre-c: var(--tcre-ok); margin-top: 16px; }
3445
+ .tcre-pipe { display: flex; margin: 0; padding: 0; list-style: none; }
3446
+ .tcre-pipe li { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; }
3447
+ .tcre-pipe li + li::before { content: ''; position: absolute; top: 16px; right: calc(50% + 20px); left: calc(-50% + 20px); height: 2px; border-radius: 1px; background: var(--tcre-line); }
3448
+ .tcre-pipe li[data-state='done'] + li::before { background: var(--tcre-c); }
3449
+ .tcre-pipe li[data-state='now']::before { background: linear-gradient(90deg, var(--tcre-c), var(--tcre-line)); }
3450
+ .tcre-pipe-dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--ta-muted); background: var(--ta-chip); transition: background 200ms var(--ta-ease); }
3451
+ .tcre-pipe li[data-state='done'] .tcre-pipe-dot { background: var(--tcre-c); color: #fff; }
3452
+ .tcre-pipe li[data-state='now'] .tcre-pipe-dot { background: color-mix(in oklab, var(--tcre-c) 16%, var(--ta-card)); color: var(--tcre-c); box-shadow: 0 0 0 2px var(--tcre-c); animation: tcre-breathe 1.8s ease-in-out infinite; }
3453
+ @keyframes tcre-breathe { 50% { box-shadow: 0 0 0 2px var(--tcre-c), 0 0 0 7px color-mix(in oklab, var(--tcre-c) 18%, transparent); } }
3454
+ .tcre-pipe-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
3455
+ .tcre-pipe li[data-state='done'] .tcre-pipe-label { color: var(--ta-secondary); }
3456
+ .tcre-pipe li[data-state='now'] .tcre-pipe-label { color: var(--ta-text); font-weight: 600; }
3457
+ .tcre-pipe-now { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 9px 12px; border-radius: 10px; background: color-mix(in oklab, var(--tcre-c) 9%, transparent); color: var(--ta-secondary); font-size: calc(12.5px * var(--ta-font-scale)); }
3458
+ .tcre-pipe-now[data-done] { color: var(--tcre-c); font-weight: 600; }
3459
+ .tcre-pulse { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--tcre-c); animation: tcre-blink 1.2s ease-in-out infinite; }
3460
+ @keyframes tcre-blink { 50% { opacity: 0.25; } }
3461
+
3462
+ /* Review. */
1278
3463
  .tcre-review { padding: 12px; }
3464
+ .tcre-review-head { display: flex; align-items: center; gap: 8px; min-height: 28px; margin: -2px -2px 8px 2px; }
1279
3465
  .tcre-preview { position: relative; overflow: hidden; border-radius: 12px; background: #111215; aspect-ratio: 16 / 10; display: grid; place-items: center; }
1280
3466
  .tcre-preview video, .tcre-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
1281
3467
  .tcre-preview-empty { color: #7c7c82; font-size: calc(12px * var(--ta-font-scale)); }
@@ -1284,72 +3470,174 @@ button.tcre-card { cursor: pointer; -webkit-tap-highlight-color: transparent; }
1284
3470
  .tcre-count { left: 8px; }
1285
3471
  .tcre-tabs { margin: 12px 0 10px; }
1286
3472
  .tcre-tabs .ta-on .tcre-pf { color: var(--ta-text); font-weight: 600; }
1287
- @media (prefers-reduced-motion: reduce) { .tcre-col { animation: none; } }
1288
- .tcre-review-title { margin: 10px 2px 4px; font-size: calc(15px * var(--ta-font-scale)); }
1289
- .tcre-review-text { margin: 0 2px; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); white-space: pre-wrap; }
1290
- .tcre-tags, .tcre-origin { margin: 4px 2px 0; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); overflow-wrap: anywhere; }
1291
- .tcre-checks { display: flex; flex-direction: column; gap: 7px; margin: 12px 2px; font-size: calc(13px * var(--ta-font-scale)); color: var(--ta-text); }
3473
+ .tcre-review-title { display: block; margin: 10px 2px 4px; font-size: calc(15px * var(--ta-font-scale)); font-weight: 600; line-height: 1.4; }
3474
+ .tcre-review-text { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; width: 100%; margin: 0; padding: 0 2px; border: 0; background: transparent; color: var(--ta-secondary); font: inherit; font-size: calc(13px * var(--ta-font-scale)); line-height: 1.6; text-align: left; white-space: pre-wrap; cursor: pointer; }
3475
+ .tcre-review-text[data-open] { display: block; }
3476
+ .tcre-tags, .tcre-origin { margin: 6px 2px 0; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); overflow-wrap: anywhere; }
3477
+ .tcre-checks { display: flex; flex-direction: column; gap: 7px; margin: 12px 2px; padding-top: 12px; border-top: 1px solid var(--tcre-line); font-size: calc(13px * var(--ta-font-scale)); color: var(--ta-text); }
1292
3478
  .tcre-checks span { display: flex; gap: 8px; align-items: flex-start; }
1293
3479
  .tcre-checks i { flex: none; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: calc(10px * var(--ta-font-scale)); font-weight: 700; color: var(--ta-warning, #d97706); background: color-mix(in oklab, var(--ta-warning, #d97706) 18%, transparent); }
1294
- .tcre-checks span[data-ok] i { color: var(--ta-success, #16a34a); background: color-mix(in oklab, var(--ta-success, #16a34a) 18%, transparent); }
1295
- .tcre-buttons { display: flex; gap: 8px; margin-top: 4px; }
1296
- .tcre-buttons .tcre-secondary { flex: 1; }
1297
- .tcre-buttons .tcre-primary { flex: 2; }
1298
- .tcre-approved { margin: 4px 2px 2px; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }
1299
- .tcre-pub { display: block; }
1300
- .tcre-pub-main { flex: 1; min-width: 0; }
1301
- .tcre-pub-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: calc(14px * var(--ta-font-scale)); font-weight: 600; line-height: 1.4; }
1302
- .tcre-pub-kind { display: block; margin-top: 2px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
1303
- .tcre-pub-links { display: flex; flex-wrap: wrap; gap: 2px; margin: 2px 0 -4px -6px; }
1304
- .tcre-stats { padding: 14px 0; }
1305
- .tcre-stats-row { display: flex; }
1306
- .tcre-stats-row > * { flex: 1; }
1307
- .tcre-stat { min-width: 0; padding: 0 14px; display: flex; flex-direction: column; gap: 2px; }
1308
- .tcre-stat + .tcre-stat { border-left: 1px solid color-mix(in oklab, var(--ta-text) 9%, transparent); }
1309
- .tcre-stat b { font-size: calc(20px * var(--ta-font-scale)); font-weight: 600; line-height: 1.2; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
1310
- .tcre-stat[data-none] b { color: var(--ta-muted); font-weight: 400; }
1311
- .tcre-stat b em { margin-left: 4px; font-style: normal; font-weight: 400; font-size: calc(12px * var(--ta-font-scale)); color: var(--ta-success, #16a34a); }
1312
- .tcre-stat span { color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
1313
- .tcre-stats-note { margin: 12px 14px 0; padding-top: 10px; border-top: 1px solid color-mix(in oklab, var(--ta-text) 9%, transparent); color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
1314
- .tcre-bar { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: calc(12.5px * var(--ta-font-scale)); }
1315
- .tcre-bar-label { width: 58px; flex: none; color: var(--ta-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1316
- .tcre-bar-track { flex: 1; height: 8px; border-radius: 4px; background: var(--ta-chip); overflow: hidden; }
1317
- .tcre-bar-track i { display: block; height: 100%; border-radius: 4px; }
1318
- .tcre-bar-value { width: 48px; text-align: right; font-variant-numeric: tabular-nums; }
1319
- .tcre-goal-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 2px; font-size: calc(13.5px * var(--ta-font-scale)); font-weight: 600; }
1320
- .tcre-goal-title .tcre-muted { font-weight: 400; font-size: calc(12px * var(--ta-font-scale)); }
1321
- .tcre-goal-row { display: flex; justify-content: space-between; margin: 10px 0 6px; font-size: calc(13px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; }
3480
+ .tcre-checks span[data-ok] i { color: var(--tcre-ok); background: color-mix(in oklab, var(--tcre-ok) 18%, transparent); }
3481
+ .tcre-buttons { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
3482
+ .tcre-review .tcre-buttons .tcre-secondary { flex: 1; }
3483
+ .tcre-review .tcre-buttons .tcre-primary { flex: 2; }
3484
+ .tcre-approved { margin: 4px 2px 2px; padding: 9px 12px; border-radius: 10px; background: color-mix(in oklab, var(--tcre-ok) 10%, transparent); color: var(--tcre-ok); font-size: calc(13px * var(--ta-font-scale)); font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
3485
+ .tcre-approved[data-tone="warn"] { background: color-mix(in oklab, var(--ta-warning, #d97706) 12%, transparent); color: var(--ta-warning, #d97706); justify-content: space-between; }
3486
+ .tcre-approved[data-tone="warn"] > span { flex: 1; min-width: 0; }
3487
+ .tcre-slot { display: inline-flex; align-items: center; gap: 6px; color: var(--ta-muted); font-weight: 400; font-variant-numeric: tabular-nums; }
3488
+
3489
+ /* Published, a row each. */
3490
+ .tcre-rows { padding: 4px 16px; }
3491
+ .tcre-pub { display: flex; align-items: center; gap: 16px; padding: 12px 0; }
3492
+ .tcre-pub + .tcre-pub { border-top: 1px solid var(--tcre-line); }
3493
+ .tcre-pub-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
3494
+ .tcre-pub-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(14.5px * var(--ta-font-scale)); font-weight: 600; }
3495
+ .tcre-pub-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
3496
+ .tcre-pf-link { padding: 0; }
3497
+ .tcre-pf-link:hover .tcre-pf { color: var(--ta-text); text-decoration: underline; }
3498
+ .tcre-pub-views { flex: none; min-width: 56px; text-align: right; font-size: calc(16px * var(--ta-font-scale)); font-weight: 600; font-variant-numeric: tabular-nums; }
3499
+ .tcre-pub-views[data-none] { color: var(--ta-muted); font-weight: 400; }
3500
+ .tcre-pub-views small { display: block; color: var(--ta-muted); font-size: calc(11px * var(--ta-font-scale)); font-weight: 400; }
3501
+
3502
+ /* Numbers. */
3503
+ .tcre-data { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 12px; align-items: start; }
3504
+ .tcre-home[data-compact] .tcre-data { grid-template-columns: minmax(0, 1fr); }
3505
+ .tcre-home[data-compact] .tcre-bar { grid-template-columns: minmax(64px, 104px) minmax(0, 1fr) 52px; }
3506
+ .tcre-kpis { grid-column: 1 / -1; display: flex; padding: 16px 0; }
3507
+ .tcre-kpi { flex: 1; min-width: 0; padding: 0 18px; display: flex; flex-direction: column; gap: 3px; }
3508
+ .tcre-kpi + .tcre-kpi { border-left: 1px solid var(--tcre-line); }
3509
+ .tcre-kpi b { display: flex; align-items: baseline; gap: 6px; font-size: calc(22px * var(--ta-font-scale)); font-weight: 650; line-height: 1.2; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
3510
+ .tcre-kpi[data-none] b { color: var(--ta-muted); font-weight: 400; }
3511
+ .tcre-kpi em { font-style: normal; font-weight: 500; font-size: calc(12px * var(--ta-font-scale)); color: var(--tcre-ok); }
3512
+ .tcre-kpi em[data-down] { color: var(--ta-danger, #dc2626); }
3513
+ .tcre-kpi span { color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
3514
+ .tcre-home[data-compact] .tcre-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 14px; padding: 14px 0; }
3515
+ .tcre-home[data-compact] .tcre-kpi { padding: 0 14px; }
3516
+ .tcre-home[data-compact] .tcre-kpi:nth-child(3n + 1) { border-left: 0; }
3517
+ .tcre-home[data-compact] .tcre-kpi b { font-size: calc(18px * var(--ta-font-scale)); }
3518
+ .tcre-panel { padding: 14px 16px 12px; }
3519
+ .tcre-panel-title { display: flex; align-items: center; gap: 8px; min-height: 30px; margin-bottom: 8px; font-size: calc(14px * var(--ta-font-scale)); font-weight: 600; }
3520
+ .tcre-insights, .tcre-wide { grid-column: 1 / -1; }
3521
+ .tcre-flow-node[data-stage='talk'] { --tcre-s: #14b8a6; }
3522
+ .tcre-flow-node[data-attn][data-stage='talk'] .tcre-flow-hint { color: #14b8a6; }
3523
+ .tcre-talk { display: flex; flex-direction: column; gap: 14px; max-width: var(--ta-page-wide); margin: 0 auto; }
3524
+ .tcre-comment { padding: 14px 16px 12px; }
3525
+ .tcre-comment-meta { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
3526
+ .tcre-comment-piece { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3527
+ .tcre-comment-text { margin: 8px 0; font-size: calc(14px * var(--ta-font-scale)); line-height: 1.55; overflow-wrap: anywhere; }
3528
+ .tcre-reply-input { width: 100%; box-sizing: border-box; resize: vertical; background: var(--ta-side); box-shadow: inset 0 0 0 1px var(--tcre-line); }
3529
+ .tcre-class { flex: none; padding: 1px 7px; border-radius: 6px; font-size: calc(11.5px * var(--ta-font-scale)); font-weight: 600; color: var(--tcre-k, var(--ta-secondary)); background: color-mix(in oklab, var(--tcre-k, var(--ta-muted)) 14%, transparent); }
3530
+ .tcre-class[data-class='question'] { --tcre-k: #3b82f6; }
3531
+ .tcre-class[data-class='suggestion'] { --tcre-k: #a855f7; }
3532
+ .tcre-class[data-class='correction'] { --tcre-k: #f97316; }
3533
+ .tcre-class[data-class='praise'] { --tcre-k: #22c55e; }
3534
+ .tcre-asked { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-top: 1px solid var(--tcre-line); font-size: calc(13.5px * var(--ta-font-scale)); }
3535
+ .tcre-asked:first-of-type { border-top: 0; }
3536
+ .tcre-asked-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
3537
+ .tcre-answered { padding: 10px 0; border-top: 1px solid var(--tcre-line); }
3538
+ .tcre-answered:first-of-type { border-top: 0; }
3539
+ .tcre-answered .tcre-comment-text { margin: 6px 0 4px; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }
3540
+ .tcre-answer { display: flex; align-items: baseline; gap: 10px; padding-left: 10px; border-left: 2px solid var(--tcre-line); font-size: calc(13.5px * var(--ta-font-scale)); }
3541
+ .tcre-answer > span:first-child { min-width: 0; overflow-wrap: anywhere; }
3542
+ .tcre-level-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--tcre-line); }
3543
+ .tcre-level-row:first-of-type { border-top: 0; }
3544
+ .tcre-level-note { margin-top: 6px; font-size: calc(12px * var(--ta-font-scale)); line-height: 1.5; }
3545
+ .tcre-seg { flex: none; font-size: calc(12px * var(--ta-font-scale)); }
3546
+ .tcre-panel-title .tcre-seg { margin-left: 10px; font-weight: 500; }
3547
+ .tcre-strategy-hint { margin: -2px 0 8px; font-size: calc(12px * var(--ta-font-scale)); }
3548
+ .tcre-insight-text { flex: 1; min-width: 0; }
3549
+ .tcre-insight-text .tcre-chip { margin-right: 6px; }
3550
+ .tcre-insight[data-proposed] { opacity: 0.85; }
3551
+ .tcre-insight[data-tone='user'] .tcre-insight-icon { color: #3b82f6; background: color-mix(in oklab, #3b82f6 15%, transparent); }
3552
+ .tcre-rule-actions { flex: none; display: flex; align-items: center; gap: 4px; }
3553
+ .tcre-rule-add { display: flex; gap: 8px; margin-top: 10px; }
3554
+ .tcre-rule-add .tcre-field { flex: 1; min-width: 0; }
3555
+ .tcre-phase { display: flex; align-items: baseline; gap: 12px; padding: 9px 0; border-top: 1px solid var(--tcre-line); font-size: calc(13.5px * var(--ta-font-scale)); }
3556
+ .tcre-phase:first-of-type { border-top: 0; }
3557
+ .tcre-phase-when { flex: none; color: var(--ta-muted); font-variant-numeric: tabular-nums; font-size: calc(12px * var(--ta-font-scale)); }
3558
+ .tcre-phase-text { flex: 1; min-width: 0; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
3559
+ .tcre-needs { list-style: none; margin: 10px 0 4px; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: calc(13.5px * var(--ta-font-scale)); }
3560
+ .tcre-needs li { display: flex; align-items: center; gap: 8px; }
3561
+ .tcre-needs li svg { flex: none; color: var(--ta-muted); }
3562
+ .tcre-needs li[data-done] { color: var(--ta-muted); text-decoration: line-through; }
3563
+ .tcre-needs li[data-done] svg { color: var(--tcre-ok); }
3564
+ .tcre-needs-hint { min-width: 0; font-size: calc(12px * var(--ta-font-scale)); }
3565
+ .tcre-home[data-compact] .tcre-needs-hint { display: none; }
3566
+ .tcre-reach { flex: none; padding: 1px 8px; border: 0; border-radius: 6px; font: inherit; font-size: calc(11.5px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-secondary); background: color-mix(in oklab, var(--ta-text) 7%, transparent); cursor: pointer; }
3567
+ .tcre-reach [data-reach='internal'], .tcre-reach[data-reach='internal'] { color: #0052d9; }
3568
+ .tcre-reach [data-reach='both'], .tcre-reach[data-reach='both'] { color: #7c3aed; }
3569
+ .tcre-tab-form { margin-left: 4px; font-style: normal; color: var(--ta-muted); font-size: 0.9em; }
3570
+ .tcre-preview-words { box-sizing: border-box; width: 100%; height: 100%; padding: 18px 20px; overflow: hidden; color: #e7e7ea; font-size: calc(13px * var(--ta-font-scale)); line-height: 1.7; white-space: pre-wrap; text-align: left; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
3571
+ .tcre-notice { margin: 10px 2px 0; padding: 8px 10px; border-radius: 10px; color: var(--ta-warning, #d97706); background: color-mix(in oklab, var(--ta-warning, #d97706) 12%, transparent); font-size: calc(12.5px * var(--ta-font-scale)); }
3572
+ .tcre-inside { display: inline-flex; align-items: center; gap: 2px; }
3573
+ .tcre-inside-add { display: flex; gap: 8px; margin-top: 8px; }
3574
+ .tcre-inside-add .tcre-field { flex: 1; min-width: 0; }
3575
+ .tcre-inside-add .tcre-field-name { flex: 0 1 140px; }
3576
+ .tcre-insight { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; font-size: calc(13.5px * var(--ta-font-scale)); line-height: 1.55; }
3577
+ .tcre-insight + .tcre-insight { border-top: 1px solid var(--tcre-line); }
3578
+ .tcre-insight .tcre-series-tag { margin-right: 8px; }
3579
+ .tcre-insight-icon { flex: none; width: 24px; height: 24px; margin-top: -1px; border-radius: 8px; display: grid; place-items: center; }
3580
+ .tcre-insight[data-tone='good'] .tcre-insight-icon { color: var(--tcre-ok); background: color-mix(in oklab, var(--tcre-ok) 14%, transparent); }
3581
+ .tcre-insight[data-tone='bad'] .tcre-insight-icon { color: var(--ta-danger, #dc2626); background: color-mix(in oklab, var(--ta-danger, #dc2626) 12%, transparent); }
3582
+ .tcre-insight[data-tone='idea'] .tcre-insight-icon { color: #eab308; background: color-mix(in oklab, #eab308 15%, transparent); }
3583
+ .tcre-bar { display: grid; grid-template-columns: minmax(72px, 180px) 1fr 56px; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 6px 0; font-size: calc(12.5px * var(--ta-font-scale)); }
3584
+ .tcre-bar-label { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--ta-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3585
+ .tcre-bar-label i { flex: none; width: 7px; height: 7px; border-radius: 2px; }
3586
+ .tcre-bar-track { height: 8px; border-radius: 4px; background: var(--ta-chip); overflow: hidden; }
3587
+ .tcre-bar-track i { display: block; height: 100%; min-width: 2px; border-radius: 4px; background: var(--ta-text); }
3588
+ .tcre-bar-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
3589
+ .tcre-bar-note { grid-column: 2 / 4; color: var(--ta-muted); font-size: calc(11.5px * var(--ta-font-scale)); }
3590
+ .tcre-line { display: block; width: 100%; height: 90px; overflow: visible; }
3591
+ .tcre-line polyline { fill: none; stroke: #a855f7; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
3592
+ .tcre-line-labels { display: flex; justify-content: space-between; margin-top: 4px; color: var(--ta-muted); font-size: calc(11px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; }
3593
+ .tcre-top-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: calc(13px * var(--ta-font-scale)); }
3594
+ .tcre-top-row + .tcre-top-row { border-top: 1px solid var(--tcre-line); }
3595
+ .tcre-top-row > b { flex: none; width: 18px; color: var(--ta-muted); font-variant-numeric: tabular-nums; }
3596
+ .tcre-top-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3597
+ .tcre-goal-row { display: flex; justify-content: space-between; margin: 8px 0 6px; font-size: calc(13px * var(--ta-font-scale)); font-variant-numeric: tabular-nums; }
1322
3598
  .tcre-goal-track { height: 6px; border-radius: 3px; background: var(--ta-chip); overflow: hidden; }
1323
- .tcre-goal-track i { display: block; height: 100%; border-radius: 3px; background: var(--ta-text); }
1324
- .tcre-empty { margin: 0 0 10px; border: 1px dashed color-mix(in oklab, var(--ta-text) 16%, transparent); border-radius: 16px; }
1325
- .tcre-empty .ta-empty-compact { padding: 22px 14px; }
1326
- .tcre-empty .ta-empty-hint { max-width: 240px; }
1327
- .tcre-small { height: calc(28px * var(--ta-font-scale)); margin-top: 6px; padding: 0 12px; font-size: calc(12.5px * var(--ta-font-scale)); }
1328
- .tcre-muted { color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); }
1329
- .tcre-foot { display: flex; justify-content: center; padding: 6px 0; }
1330
- .tcre-board { height: 100%; display: flex; flex-direction: column; background: var(--ta-side); color: var(--ta-text); font-size: calc(14px * var(--ta-font-scale)); line-height: 1.5; }
1331
- .tcre-board-bar { display: flex; align-items: center; gap: 16px; padding: 10px 24px; border-bottom: 1px solid var(--ta-border-muted, var(--ta-border)); }
1332
- .tcre-board-bar .tcre-link { padding: 5px 12px; border-radius: 999px; color: var(--ta-secondary); }
1333
- .tcre-board-bar .tcre-link:hover { background: var(--ta-hover); color: var(--ta-text); }
1334
- .tcre-pill { padding: 5px 12px; border-radius: 999px; background: var(--ta-chip); color: var(--ta-muted); font-size: calc(12.5px * var(--ta-font-scale)); white-space: nowrap; }
1335
- .tcre-pill b { margin-left: 2px; color: var(--ta-text); font-weight: 600; }
1336
- .tcre-grow { flex: 1; }
1337
- .tcre-board-cols { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 16px; padding: 18px 24px 0; overflow-x: auto; }
1338
- .tcre-board-col { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
1339
- .tcre-board-col header { display: flex; align-items: center; gap: 6px; height: 22px; margin: 0 2px 12px; font-size: calc(13.5px * var(--ta-font-scale)); font-weight: 600; }
1340
- .tcre-board-col header em { min-width: 18px; padding: 0 6px; box-sizing: border-box; border-radius: 999px; background: var(--ta-chip); color: var(--ta-secondary); text-align: center; line-height: 18px; }
1341
- .tcre-board-list { flex: 1; overflow-y: auto; padding-bottom: 20px; }
1342
- .tcre-board .tcre-card { padding: 11px 12px; }
1343
- .tcre-board :is(.tcre-topic-title, .tcre-making-title) { font-size: calc(13.5px * var(--ta-font-scale)); }
1344
- .tcre-board .tcre-topic-foot { flex-wrap: wrap; }
1345
- .tcre-setup { max-width: 520px; margin: 18px auto; }
1346
- .tcre-setup-title { font-size: calc(20px * var(--ta-font-scale)); font-weight: 600; margin: 0 2px 12px; }
1347
- .tcre-setup-label { margin: 16px 2px 8px; color: var(--ta-muted); font-size: calc(13px * var(--ta-font-scale)); }
3599
+ .tcre-goal-track i { display: block; height: 100%; border-radius: 3px; background: var(--tcre-ok); }
3600
+ .tcre-data-note { grid-column: 1 / -1; text-align: center; }
3601
+
3602
+ /* What is empty, what was removed. */
3603
+ .tcre-empty { margin: 0 0 12px; border: 1px dashed color-mix(in oklab, var(--ta-text) 16%, transparent); border-radius: 16px; }
3604
+ .tcre-empty .ta-empty-compact { padding: 26px 14px; }
3605
+ .tcre-empty .ta-empty-hint { max-width: 260px; }
3606
+ .tcre-removed { margin-top: 24px; text-align: center; }
3607
+ .tcre-removed-list { max-width: var(--ta-page-width); margin: 8px auto 0; text-align: left; }
3608
+ .tcre-removed-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; color: var(--ta-muted); font-size: calc(13px * var(--ta-font-scale)); }
3609
+ .tcre-removed-row + .tcre-removed-row { border-top: 1px solid var(--tcre-line); }
3610
+ .tcre-removed-row > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3611
+
3612
+ /* Settings. */
3613
+ .tcre-setup { max-width: var(--ta-page-width); margin: 22px auto; }
3614
+ .tcre-setup-title { font-size: calc(20px * var(--ta-font-scale)); font-weight: 650; margin: 0 2px 14px; }
3615
+ .tcre-setup-label { display: flex; align-items: baseline; gap: 10px; margin: 22px 2px 8px; color: var(--ta-text); font-size: calc(13.5px * var(--ta-font-scale)); font-weight: 600; }
3616
+ .tcre-setup-label span { color: var(--ta-muted); font-weight: 400; font-size: calc(12px * var(--ta-font-scale)); }
1348
3617
  .tcre-input { width: 100%; box-sizing: border-box; padding: 12px 14px; border: 0; border-radius: 14px; background: var(--ta-card); color: var(--ta-text); font: inherit; resize: none; outline: none; }
1349
- .tcre-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
3618
+ :root[data-theme='light'] .tcre-input { box-shadow: inset 0 0 0 1px var(--tcre-line); }
3619
+ .tcre-series-edit { padding: 4px 8px 4px 14px; }
3620
+ .tcre-series-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
3621
+ .tcre-series-row + .tcre-series-row { border-top: 1px solid var(--tcre-line); }
3622
+ .tcre-series-row > i { flex: none; width: 4px; align-self: stretch; margin: 4px 0; border-radius: 2px; background: var(--tcre-c); }
3623
+ .tcre-series-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
3624
+ .tcre-field { width: 100%; box-sizing: border-box; padding: 3px 4px; border: 0; border-radius: 6px; background: transparent; color: var(--ta-secondary); font: inherit; font-size: calc(12.5px * var(--ta-font-scale)); outline: none; }
3625
+ .tcre-field:focus { background: var(--ta-hover); }
3626
+ .tcre-field-name { color: var(--ta-text); font-size: calc(14px * var(--ta-font-scale)); font-weight: 600; }
3627
+ .tcre-toggle { flex: none; height: 26px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--ta-muted); font: inherit; font-size: calc(12px * var(--ta-font-scale)); cursor: pointer; box-shadow: inset 0 0 0 1px var(--tcre-line); }
3628
+ .tcre-toggle[aria-pressed='true'] { background: color-mix(in oklab, var(--tcre-c) 15%, transparent); color: var(--tcre-c); box-shadow: none; font-weight: 600; }
3629
+ .tcre-series-add { display: flex; align-items: center; gap: 6px; width: 100%; padding: 10px 2px; border: 0; border-top: 1px solid var(--tcre-line); background: transparent; color: var(--ta-secondary); font: inherit; font-size: calc(13px * var(--ta-font-scale)); cursor: pointer; }
3630
+ .tcre-series-edit .tcre-series-add:first-child { border-top: 0; }
3631
+ .tcre-pick { display: flex; flex-wrap: wrap; gap: 8px; }
1350
3632
  .tcre-pick button { height: 34px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--ta-card); font: inherit; cursor: pointer; box-shadow: inset 0 0 0 1px var(--ta-border-muted, var(--ta-border)); }
1351
3633
  .tcre-pick button[aria-pressed='true'] { box-shadow: inset 0 0 0 1.5px var(--ta-text); }
1352
3634
  .tcre-pick button[aria-pressed='true'] .tcre-pf { color: var(--ta-text); font-weight: 600; }
3635
+ .tcre-setup .tcre-buttons { margin-top: 26px; }
3636
+
3637
+ @media (prefers-reduced-motion: reduce) { .tcre-body { animation: none; } .tcre-pipe li[data-state='now'] .tcre-pipe-dot, .tcre-pulse { animation: none; } }
3638
+ .tcre-pick .tcre-icon { height: 28px; width: 28px; padding: 0; background: transparent; box-shadow: none; }
3639
+ .tcre-rule-add .tcre-field, .tcre-inside-add .tcre-field { height: 32px; padding: 0 10px; border-radius: 9px; background: var(--ta-side); box-shadow: inset 0 0 0 1px var(--tcre-line); }
3640
+ .tcre-card .tcre-rule-add .tcre-field { background: transparent; }
1353
3641
  `;
1354
3642
  function injectStyle() {
1355
3643
  const element = document.createElement("style");
@@ -1381,7 +3669,8 @@ function activate(pi) {
1381
3669
  const words = CreatorWords.of(pi.ui.language);
1382
3670
  const columns = CreatorUtil.columns(store.state.items, Date.now());
1383
3671
  const waiting = columns.review.filter((one) => !one.approved).length;
1384
- const detail = waiting ? `${words.review} ${waiting}` : columns.topic[0] ? `${words.topic} · ${columns.topic[0].title}` : store.state.settings.niche || words.sub;
3672
+ const answers = drafts(store.state.comments).length;
3673
+ const detail = waiting ? `${words.review} ${waiting}` : answers ? CreatorWords.format(words.flowDrafts, { n: answers }) : columns.topic[0] ? `${words.topic} · ${columns.topic[0].title}` : store.state.settings.niche || words.sub;
1385
3674
  return [
1386
3675
  {
1387
3676
  id: "creator",
@@ -1389,7 +3678,7 @@ function activate(pi) {
1389
3678
  detail,
1390
3679
  icon: pi.ui.icons.Film,
1391
3680
  tint: "creator",
1392
- unseen: waiting > 0,
3681
+ unseen: waiting > 0 || answers > 0,
1393
3682
  place: "double",
1394
3683
  open: () => pi.ui.showView(PAGE)
1395
3684
  }