@celljs/ta-creator 4.32.1 → 4.34.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`;
@@ -15,11 +9,31 @@ var Keys;
15
9
  Keys.WEEKS = "weeks";
16
10
  Keys.TASKS = "tasks";
17
11
  Keys.INSIGHTS = "insights";
12
+ Keys.COMMENTS = "comments";
13
+ Keys.LESSONS = "lessons";
14
+ Keys.PHASES = "phases";
18
15
  })(Keys ||= {});
19
- var STAGES = ["topic", "making", "review", "published"];
20
- var FORMS = ["video", "post"];
21
- 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"];
22
25
  var STEPS = ["script", "visuals", "voice", "captions", "versions", "checks"];
26
+ var REACHES = ["public", "internal", "both"];
27
+ var TONES = {
28
+ humorous: "humorous: light and witty, a joke or a playful image where it helps, never at anyone's expense",
29
+ serious: "serious: plain and earnest, no jokes, no exaggeration, facts first",
30
+ rigorous: "rigorous: step by step, each claim with its reason or source, terms defined, no leaps",
31
+ warm: 'warm: like a friend explaining, "you" and "we", patient and encouraging',
32
+ lively: "lively: high energy, short punchy sentences, a strong hook and rhythm",
33
+ plain: "plain: everyday words, everyday examples, no jargon left unexplained",
34
+ story: "storytelling: a scene, a person or a moment first, the point drawn from it",
35
+ sharp: "sharp: a clear opinion, straight to the point, the counter-intuitive first, never rude"
36
+ };
23
37
  var SERIES_COLORS = ["#22c55e", "#f97316", "#3b82f6", "#a855f7", "#ec4899", "#14b8a6", "#eab308", "#64748b"];
24
38
  var ASPECTS = ["16:9", "9:16", "3:4", "1:1"];
25
39
  var PLATFORMS = [
@@ -28,6 +42,8 @@ var PLATFORMS = [
28
42
  name: "B站",
29
43
  color: "#fb7299",
30
44
  video: { aspect: "16:9" },
45
+ article: {},
46
+ note: { maxChars: 1000 },
31
47
  publish: "https://member.bilibili.com/platform/upload/video/frame",
32
48
  declare: "创作声明 → 该视频使用人工智能合成技术"
33
49
  },
@@ -37,6 +53,7 @@ var PLATFORMS = [
37
53
  color: "#ff2442",
38
54
  video: { aspect: "3:4", maxSeconds: 900 },
39
55
  post: { aspect: "3:4", maxImages: 18 },
56
+ article: {},
40
57
  publish: "https://creator.xiaohongshu.com",
41
58
  declare: "内容类型声明 → 笔记含 AI 合成内容"
42
59
  },
@@ -45,6 +62,7 @@ var PLATFORMS = [
45
62
  name: "视频号",
46
63
  color: "#fa9d3b",
47
64
  video: { aspect: "9:16" },
65
+ post: { aspect: "3:4", maxImages: 9 },
48
66
  publish: "https://channels.weixin.qq.com",
49
67
  declare: "声明 → 内容由 AI 生成"
50
68
  },
@@ -63,6 +81,7 @@ var PLATFORMS = [
63
81
  name: "YouTube",
64
82
  color: "#ff0033",
65
83
  video: { aspect: "16:9" },
84
+ note: { maxChars: 1500 },
66
85
  publish: "https://studio.youtube.com",
67
86
  declare: "Altered or synthetic content → Yes"
68
87
  },
@@ -70,9 +89,19 @@ var PLATFORMS = [
70
89
  id: "wechat-article",
71
90
  name: "公众号",
72
91
  color: "#07c160",
73
- post: { aspect: "16:9" },
92
+ article: {},
74
93
  publish: "https://mp.weixin.qq.com",
75
94
  declare: "创作来源 → 内容由 AI 生成"
95
+ },
96
+ {
97
+ id: "zhihu",
98
+ name: "知乎",
99
+ color: "#1772f6",
100
+ video: { aspect: "16:9" },
101
+ article: {},
102
+ note: { maxChars: 1000 },
103
+ publish: "https://www.zhihu.com/creator",
104
+ declare: "创作声明 → 包含 AI 辅助创作"
76
105
  }
77
106
  ];
78
107
  var SOURCES = [
@@ -81,85 +110,252 @@ var SOURCES = [
81
110
  { name: "Product Hunt", url: "https://www.producthunt.com" },
82
111
  { name: "Hugging Face Papers", url: "https://huggingface.co/papers" }
83
112
  ];
113
+ var COMMENT_CLASSES = ["question", "suggestion", "correction", "praise", "negative", "spam"];
114
+ var REPLY_CLASSES = ["question", "suggestion", "correction", "praise"];
115
+ var REPLY_STATES = ["draft", "approved", "sent", "dropped", "withdrawn", "removed"];
116
+
117
+ // web-src/publish-util.ts
118
+ var text = (value, max) => typeof value === "string" ? value.trim().slice(0, max) : "";
119
+ var time = (value) => typeof value === "number" && Number.isFinite(value) && value > 0 ? value : undefined;
120
+ var object = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
121
+ var PublishUtil;
122
+ ((PublishUtil) => {
123
+ function dayOf(at) {
124
+ const day = new Date(at);
125
+ const two = (n) => String(n).padStart(2, "0");
126
+ return `${day.getFullYear()}-${two(day.getMonth() + 1)}-${two(day.getDate())}`;
127
+ }
128
+ PublishUtil.dayOf = dayOf;
129
+ function publishQueue(items) {
130
+ const due = (item) => item.kind === "hot" && item.until ? item.until : Number.POSITIVE_INFINITY;
131
+ 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));
132
+ }
133
+ PublishUtil.publishQueue = publishQueue;
134
+ function ahead(items, id) {
135
+ const running = items.some((one) => one.publishing?.state === "running" && !one.dropped && one.id !== id) ? 1 : 0;
136
+ const at = publishQueue(items).findIndex((one) => one.id === id);
137
+ return at < 0 ? 0 : at + running;
138
+ }
139
+ PublishUtil.ahead = ahead;
140
+ function slots(items, item, now, hour = 12) {
141
+ const done = new Set((item.links ?? []).map((one) => one.platform));
142
+ const platforms = [
143
+ ...new Set((item.versions ?? []).filter((one) => one.files.length || ["article", "note"].includes(one.form ?? item.form) && !!one.text).map((one) => one.platform))
144
+ ].filter((one) => !done.has(one));
145
+ const others = items.filter((one) => one.id !== item.id && !one.dropped);
146
+ return platforms.map((platform) => {
147
+ const taken = new Set([
148
+ ...others.flatMap((one) => (one.links ?? []).filter((link) => link.platform === platform).map((link) => dayOf(link.scheduled ?? link.at))),
149
+ ...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)))
150
+ ]);
151
+ if (!taken.has(dayOf(now))) {
152
+ return { platform };
153
+ }
154
+ const day = new Date(now);
155
+ day.setHours(hour, 0, 0, 0);
156
+ do {
157
+ day.setDate(day.getDate() + 1);
158
+ } while (taken.has(dayOf(day.getTime())));
159
+ return { platform, at: day.getTime() };
160
+ });
161
+ }
162
+ PublishUtil.slots = slots;
163
+ function timeOf(value) {
164
+ if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/.test(value.trim())) {
165
+ const at = new Date(value.trim().replace(" ", "T")).getTime();
166
+ return Number.isFinite(at) ? at : undefined;
167
+ }
168
+ return time(value);
169
+ }
170
+ PublishUtil.timeOf = timeOf;
171
+ function of(piece) {
172
+ const approved = time(piece.approved);
173
+ return publishing(piece.publishing) ?? (piece.stage === "review" && approved && !piece.publishing ? { state: "queued", since: approved } : undefined);
174
+ }
175
+ PublishUtil.of = of;
176
+ function publishing(value) {
177
+ const kept = object(value);
178
+ const since = time(kept?.since);
179
+ const state = kept && ["queued", "running", "stopped"].find((one) => one === kept.state);
180
+ if (!kept || !since || !state) {
181
+ return;
182
+ }
183
+ 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;
184
+ return {
185
+ state,
186
+ since,
187
+ ...slots2 ? { slots: slots2 } : {},
188
+ ...text(kept.note, 300) ? { note: text(kept.note, 300) } : {},
189
+ ...text(kept.ask, 500) ? { ask: text(kept.ask, 500) } : {}
190
+ };
191
+ }
192
+ PublishUtil.publishing = publishing;
193
+ })(PublishUtil ||= {});
194
+
195
+ // web-src/react.ts
196
+ var React;
197
+ function bind(react) {
198
+ React = react;
199
+ }
200
+
201
+ // web-src/values.ts
202
+ var text2 = (value, max = 2000) => typeof value === "string" ? value.trim().slice(0, max) : "";
203
+ var texts = (value, max = 50) => Array.isArray(value) ? value.map((one) => text2(one, 200)).filter(Boolean).slice(0, max) : [];
204
+ var time2 = (value) => typeof value === "number" && Number.isFinite(value) && value > 0 ? value : undefined;
205
+ var oneOf = (all, value, fallback) => all.includes(value) ? value : fallback;
206
+ var object2 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
207
+ function hash(value) {
208
+ let h = 0;
209
+ for (const char of value) {
210
+ h = Math.imul(h, 31) + (char.codePointAt(0) ?? 0) | 0;
211
+ }
212
+ return (h >>> 0).toString(36);
213
+ }
214
+ function url(value) {
215
+ const raw = text2(value, 1000);
216
+ return /^https?:\/\/\S+$/i.test(raw) ? raw : undefined;
217
+ }
218
+ function count(value, fallback) {
219
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.round(value) : fallback;
220
+ }
84
221
 
85
222
  // web-src/creator-util.ts
86
223
  var DAY = 86400000;
87
224
  var MAX_TOPICS = 200;
88
225
  var HOT_FOR = 2 * DAY;
89
- var text = (value, max = 2000) => typeof value === "string" ? value.trim().slice(0, max) : "";
90
- var texts = (value, max = 50) => Array.isArray(value) ? value.map((one) => text(one, 200)).filter(Boolean).slice(0, max) : [];
91
- var time = (value) => typeof value === "number" && Number.isFinite(value) && value > 0 ? value : undefined;
92
- var oneOf = (all, value, fallback) => all.includes(value) ? value : fallback;
93
- var object = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
226
+ var MAX_TONES = 3;
94
227
  var CreatorUtil;
95
228
  ((CreatorUtil) => {
96
229
  function settings(value) {
97
- const kept = object(value) ?? {};
98
- const platforms = Array.isArray(kept.platforms) ? kept.platforms.map(platform).filter((one) => !!one) : [...PLATFORMS];
230
+ const kept = object2(value) ?? {};
231
+ const platforms = Array.isArray(kept.platforms) ? withBuiltins(kept.platforms.map(platform).filter((one) => !!one)) : [...PLATFORMS];
99
232
  const ids = new Set(platforms.map((one) => one.id));
100
- const goal = object(kept.goal);
233
+ const goal = object2(kept.goal);
101
234
  return {
102
- niche: text(kept.niche, 500),
235
+ niche: text2(kept.niche, 500),
103
236
  picked: texts(kept.picked).filter((id) => ids.has(id)),
104
237
  platforms,
105
238
  sources: Array.isArray(kept.sources) ? kept.sources.map(source).filter((one) => !!one) : [...SOURCES],
106
- ...goal && time(goal.from) ? { goal: { from: time(goal.from), days: count(goal.days, 30), videos: count(goal.videos, 0), posts: count(goal.posts, 0) } } : {},
239
+ ...goal && time2(goal.from) ? { goal: { from: time2(goal.from), days: count(goal.days, 30), videos: count(goal.videos, 0), posts: count(goal.posts, 0) } } : {},
107
240
  minutesCap: count(kept.minutesCap, 120),
108
- voice: text(kept.voice, 60) || "zh-CN-XiaoxiaoNeural",
109
- series: Array.isArray(kept.series) ? seriesOf(kept.series) : []
241
+ voice: text2(kept.voice, 60) || "zh-CN-XiaoxiaoNeural",
242
+ tone: tones(kept.tone),
243
+ series: Array.isArray(kept.series) ? seriesOf(kept.series) : [],
244
+ strategy: kept.strategy === "manual" ? "manual" : "auto",
245
+ phaseWeeks: typeof kept.phaseWeeks === "number" ? Math.min(26, count(kept.phaseWeeks, 4)) : 4,
246
+ commentsEvery: Math.min(72, count(kept.commentsEvery, 0)),
247
+ commentsDays: Math.max(1, Math.min(60, count(kept.commentsDays, 14)))
110
248
  };
111
249
  }
112
250
  CreatorUtil.settings = settings;
251
+ function withBuiltins(kept) {
252
+ const forms = (one) => ({ video: one.video, post: one.post, article: one.article, note: one.note });
253
+ const known = kept.map((one) => {
254
+ const builtin = PLATFORMS.find((it) => it.id === one.id);
255
+ if (!builtin) {
256
+ return one;
257
+ }
258
+ const { video: _v, post: _p, article: _a, note: _n, ...rest } = one;
259
+ return JSON.parse(JSON.stringify({ ...rest, ...forms(builtin) }));
260
+ });
261
+ return [...known, ...PLATFORMS.filter((one) => !kept.some((it) => it.id === one.id))];
262
+ }
263
+ CreatorUtil.withBuiltins = withBuiltins;
264
+ function tones(value) {
265
+ return [
266
+ ...new Set(texts(value).map((one) => text2(one, 20)).filter(Boolean))
267
+ ].slice(0, MAX_TONES);
268
+ }
269
+ CreatorUtil.tones = tones;
270
+ function toneOf(item2, settings2) {
271
+ const own = settings2.series.find((one) => one.id === item2?.series)?.tone;
272
+ return (own ? [own] : settings2.tone).map((one) => (one in TONES) ? TONES[one] : one);
273
+ }
274
+ CreatorUtil.toneOf = toneOf;
275
+ function reach(item2, settings2) {
276
+ return item2.reach ?? settings2.series.find((one) => one.id === item2.series)?.reach ?? "public";
277
+ }
278
+ CreatorUtil.reach = reach;
279
+ function platformsFor(settings2, item2) {
280
+ const to = reach(item2, settings2);
281
+ return picked(settings2).filter((platform2) => to === "both" || to === "internal" === !!platform2.internal).map((platform2) => ({ platform: platform2, form: formFor(platform2, item2.form) })).filter((one) => !!one.form);
282
+ }
283
+ CreatorUtil.platformsFor = platformsFor;
284
+ function takes(platform2, form) {
285
+ return !!platform2[form];
286
+ }
287
+ CreatorUtil.takes = takes;
288
+ function formFor(platform2, form) {
289
+ return FORM_FALLBACKS[form].find((one) => takes(platform2, one));
290
+ }
291
+ CreatorUtil.formFor = formFor;
292
+ function ready(version2, form) {
293
+ return version2.files.length > 0 || (version2.form ?? form) !== "video" && (version2.form ?? form) !== "post" && !!version2.text;
294
+ }
295
+ CreatorUtil.ready = ready;
113
296
  function seriesOf(values) {
114
297
  const all = [];
115
298
  for (const value of values) {
116
- const kept = object(value);
117
- const name = text(kept?.name, 40);
299
+ const kept = object2(value);
300
+ const name = text2(kept?.name, 40);
118
301
  if (!kept || !name) {
119
302
  continue;
120
303
  }
121
- const id = text(kept.id, 60) || `s${hash(name)}`;
304
+ const id = text2(kept.id, 60) || `s${hash(name)}`;
122
305
  if (all.some((one) => one.id === id)) {
123
306
  continue;
124
307
  }
125
- const about = text(kept.about, 200);
308
+ const about = text2(kept.about, 200);
126
309
  const perWeek = count(kept.perWeek, 0);
310
+ const tone = text2(kept.tone, 20);
127
311
  all.push({
128
312
  id,
129
313
  name,
130
314
  ...about ? { about } : {},
131
- color: text(kept.color, 40) || SERIES_COLORS[all.length % SERIES_COLORS.length],
315
+ color: text2(kept.color, 40) || SERIES_COLORS[all.length % SERIES_COLORS.length],
132
316
  ...kept.ordered === true ? { ordered: true } : {},
133
- ...perWeek ? { perWeek: Math.min(perWeek, 14) } : {}
317
+ ...perWeek ? { perWeek: Math.min(perWeek, 14) } : {},
318
+ ...kept.reach === "internal" || kept.reach === "both" ? { reach: kept.reach } : {},
319
+ ...tone ? { tone } : {}
134
320
  });
135
321
  }
136
322
  return all.slice(0, 12);
137
323
  }
138
324
  CreatorUtil.seriesOf = seriesOf;
139
325
  function platform(value) {
140
- const kept = object(value);
141
- const id = text(kept?.id, 60);
142
- const name = text(kept?.name, 60);
326
+ const kept = object2(value);
327
+ const id = text2(kept?.id, 60);
328
+ const name = text2(kept?.name, 60);
143
329
  if (!kept || !id || !name) {
144
330
  return;
145
331
  }
146
332
  const shape = (one) => {
147
- const it = object(one);
333
+ const it = object2(one);
148
334
  return it ? { aspect: oneOf(ASPECTS, it.aspect, "16:9"), ...count(it.maxSeconds, 0) ? { maxSeconds: count(it.maxSeconds, 0) } : {} } : undefined;
149
335
  };
150
336
  const video = shape(kept.video);
151
- const post = object(kept.post) ? {
152
- aspect: oneOf(ASPECTS, object(kept.post)?.aspect, "3:4"),
153
- ...count(object(kept.post)?.maxImages, 0) ? { maxImages: count(object(kept.post)?.maxImages, 0) } : {}
337
+ const post = object2(kept.post) ? {
338
+ aspect: oneOf(ASPECTS, object2(kept.post)?.aspect, "3:4"),
339
+ ...count(object2(kept.post)?.maxImages, 0) ? { maxImages: count(object2(kept.post)?.maxImages, 0) } : {}
154
340
  } : undefined;
341
+ const words = (one) => {
342
+ const it = object2(one);
343
+ return it ? count(it.maxChars, 0) ? { maxChars: count(it.maxChars, 0) } : {} : undefined;
344
+ };
345
+ const article = words(kept.article);
346
+ const note = words(kept.note);
155
347
  const publish = url(kept.publish);
156
- const declare = text(kept.declare, 200);
348
+ const declare = text2(kept.declare, 200);
349
+ const inside = kept.internal === true ? { internal: true } : {};
157
350
  return {
351
+ ...inside,
158
352
  id,
159
353
  name,
160
- color: text(kept.color, 40) || "#8e8e93",
354
+ color: text2(kept.color, 40) || "#8e8e93",
161
355
  ...video ? { video } : {},
162
356
  ...post ? { post } : {},
357
+ ...article ? { article } : {},
358
+ ...note ? { note } : {},
163
359
  ...publish ? { publish } : {},
164
360
  ...declare ? { declare } : {}
165
361
  };
@@ -170,14 +366,14 @@ var CreatorUtil;
170
366
  }
171
367
  CreatorUtil.items = items;
172
368
  function item(value) {
173
- const kept = object(value);
174
- const id = text(kept?.id, 80);
175
- const title = text(kept?.title, 200);
176
- const at = time(kept?.at);
369
+ const kept = object2(value);
370
+ const id = text2(kept?.id, 80);
371
+ const title = text2(kept?.title, 200);
372
+ const at = time2(kept?.at);
177
373
  if (!kept || !id || !title || !at) {
178
374
  return;
179
375
  }
180
- const origin = object(kept.origin);
376
+ const origin = object2(kept.origin);
181
377
  const originUrl = url(origin?.url);
182
378
  return {
183
379
  id,
@@ -185,31 +381,38 @@ var CreatorUtil;
185
381
  form: oneOf(FORMS, kept.form, "video"),
186
382
  kind: oneOf(KINDS, kept.kind, "howto"),
187
383
  stage: oneOf(STAGES, kept.stage, "topic"),
188
- ...text(kept.series, 60) ? { series: text(kept.series, 60) } : {},
384
+ ...text2(kept.series, 60) ? { series: text2(kept.series, 60) } : {},
189
385
  ...count(kept.number, 0) ? { number: count(kept.number, 0) } : {},
190
- ...text(kept.why, 300) ? { why: text(kept.why, 300) } : {},
386
+ ...REACHES.includes(kept.reach) ? { reach: kept.reach } : {},
387
+ ...text2(kept.why, 300) ? { why: text2(kept.why, 300) } : {},
191
388
  ...typeof kept.heat === "number" ? { heat: Math.max(0, Math.min(100, Math.round(kept.heat))) } : {},
192
- ...time(kept.until) ? { until: time(kept.until) } : {},
389
+ ...time2(kept.until) ? { until: time2(kept.until) } : {},
193
390
  ...texts(kept.seen, 10).length ? { seen: texts(kept.seen, 10) } : {},
194
391
  ...origin && originUrl ? {
195
392
  origin: {
196
393
  url: originUrl,
197
- ...text(origin.title, 200) ? { title: text(origin.title, 200) } : {},
198
- ...text(origin.author, 100) ? { author: text(origin.author, 100) } : {},
199
- ...text(origin.licence, 100) ? { licence: text(origin.licence, 100) } : {}
394
+ ...text2(origin.title, 200) ? { title: text2(origin.title, 200) } : {},
395
+ ...text2(origin.author, 100) ? { author: text2(origin.author, 100) } : {},
396
+ ...text2(origin.licence, 100) ? { licence: text2(origin.licence, 100) } : {}
200
397
  }
201
398
  } : {},
399
+ ...Array.isArray(kept.needs) ? {
400
+ needs: kept.needs.map(need).filter((one) => !!one).slice(0, 12)
401
+ } : {},
202
402
  ...Array.isArray(kept.done) ? { done: STEPS.filter((step) => kept.done.includes(step)) } : {},
203
- ...text(kept.script, 20000) ? { script: text(kept.script, 20000) } : {},
403
+ ...text2(kept.script, 20000) ? { script: text2(kept.script, 20000) } : {},
204
404
  ...Array.isArray(kept.versions) ? { versions: kept.versions.map(version).filter((one) => !!one) } : {},
205
405
  ...Array.isArray(kept.checks) ? { checks: kept.checks.map(check).filter((one) => !!one) } : {},
206
- ...text(kept.session, 1000) ? { session: text(kept.session, 1000) } : {},
207
- ...time(kept.approved) ? { approved: time(kept.approved) } : {},
406
+ ...text2(kept.session, 1000) ? { session: text2(kept.session, 1000) } : {},
407
+ ...time2(kept.approved) ? { approved: time2(kept.approved) } : {},
408
+ ...PublishUtil.of(kept) ? { publishing: PublishUtil.of(kept) } : {},
208
409
  ...Array.isArray(kept.links) ? { links: kept.links.map(link).filter((one) => !!one) } : {},
209
410
  ...Array.isArray(kept.stats) ? { stats: kept.stats.map(stat).filter((one) => !!one) } : {},
210
411
  ...kept.dropped === true ? { dropped: true } : {},
412
+ ...time2(kept.commentsAt) ? { commentsAt: time2(kept.commentsAt) } : {},
413
+ ...time2(kept.commentsGap) ? { commentsGap: time2(kept.commentsGap) } : {},
211
414
  at,
212
- changedAt: time(kept.changedAt) ?? at
415
+ changedAt: time2(kept.changedAt) ?? at
213
416
  };
214
417
  }
215
418
  CreatorUtil.item = item;
@@ -217,10 +420,10 @@ var CreatorUtil;
217
420
  if (!Array.isArray(value)) {
218
421
  return [];
219
422
  }
220
- return value.map((one) => object(one)).filter((one) => !!one && /^\d{4}-\d{2}-\d{2}$/.test(String(one.week))).map((one) => ({
423
+ return value.map((one) => object2(one)).filter((one) => !!one && /^\d{4}-\d{2}-\d{2}$/.test(String(one.week))).map((one) => ({
221
424
  week: String(one.week),
222
- platforms: (Array.isArray(one.platforms) ? one.platforms : []).map((it) => object(it)).filter((it) => !!it && !!text(it.platform, 60)).map((it) => ({
223
- platform: text(it.platform, 60),
425
+ platforms: (Array.isArray(one.platforms) ? one.platforms : []).map((it) => object2(it)).filter((it) => !!it && !!text2(it.platform, 60)).map((it) => ({
426
+ platform: text2(it.platform, 60),
224
427
  views: count(it.views, 0),
225
428
  ...typeof it.likes === "number" ? { likes: count(it.likes, 0) } : {},
226
429
  ...typeof it.follows === "number" ? { follows: count(it.follows, 0) } : {},
@@ -239,8 +442,10 @@ var CreatorUtil;
239
442
  const of = (stage) => items2.filter((one) => one.stage === stage && !one.dropped);
240
443
  return {
241
444
  topic: of("topic").filter((one) => !expired(one, now)).sort((a, b) => (b.heat ?? 0) - (a.heat ?? 0) || b.at - a.at),
445
+ materials: of("materials").sort(latest),
242
446
  making: of("making").sort(latest),
243
- review: of("review").sort(latest),
447
+ review: of("review").filter((one) => !one.approved).sort(latest),
448
+ publishing: of("review").filter((one) => !!one.approved).sort((a, b) => (a.approved ?? 0) - (b.approved ?? 0)),
244
449
  published: of("published").sort((a, b) => publishedAt(b) - publishedAt(a))
245
450
  };
246
451
  }
@@ -250,7 +455,7 @@ var CreatorUtil;
250
455
  }
251
456
  CreatorUtil.expired = expired;
252
457
  function publishedAt(item2) {
253
- return Math.min(...(item2.links ?? []).map((one) => one.at), item2.changedAt);
458
+ return Math.min(...(item2.links ?? []).map((one) => one.scheduled ?? one.at), item2.changedAt);
254
459
  }
255
460
  CreatorUtil.publishedAt = publishedAt;
256
461
  function addTopics(items2, topics, now, id, series = []) {
@@ -291,7 +496,7 @@ var CreatorUtil;
291
496
  }
292
497
  CreatorUtil.change = change;
293
498
  function seriesNamed(series, value) {
294
- const key = text(value, 60).toLowerCase();
499
+ const key = text2(value, 60).toLowerCase();
295
500
  return key ? series.find((one) => one.id.toLowerCase() === key || one.name.toLowerCase() === key) : undefined;
296
501
  }
297
502
  CreatorUtil.seriesNamed = seriesNamed;
@@ -317,47 +522,8 @@ var CreatorUtil;
317
522
  return item2.stats?.length ? item2.stats.reduce((all, one) => all + one.views, 0) : undefined;
318
523
  }
319
524
  CreatorUtil.views = views;
320
- function analysis(items2, settings2) {
321
- const published = items2.filter((one) => one.stage === "published" && !one.dropped);
322
- const measured = published.filter((one) => one.stats?.length);
323
- const group = (key, of) => {
324
- const read = of.filter((one) => one.stats?.length);
325
- const total = read.reduce((all, one) => all + (views(one) ?? 0), 0);
326
- const watched = read.flatMap((one) => (one.stats ?? []).filter((stat2) => stat2.completion !== undefined));
327
- const weight = watched.reduce((all, one) => all + Math.max(1, one.views), 0);
328
- return {
329
- key,
330
- count: of.length,
331
- measured: read.length,
332
- views: total,
333
- average: read.length ? Math.round(total / read.length) : 0,
334
- ...watched.length ? { completion: watched.reduce((all, one) => all + (one.completion ?? 0) * Math.max(1, one.views), 0) / weight } : {}
335
- };
336
- };
337
- const known = new Set(settings2.series.map((one) => one.id));
338
- const none = published.filter((one) => !one.series || !known.has(one.series));
339
- const platforms = [...new Set(measured.flatMap((one) => (one.stats ?? []).map((stat2) => stat2.platform)))].map((platform2) => {
340
- const stats = measured.flatMap((one) => (one.stats ?? []).filter((stat2) => stat2.platform === platform2));
341
- const total = stats.reduce((all, one) => all + one.views, 0);
342
- return { key: platform2, count: stats.length, measured: stats.length, views: total, average: stats.length ? Math.round(total / stats.length) : 0 };
343
- });
344
- return {
345
- published: published.length,
346
- measured: measured.length,
347
- views: measured.reduce((all, one) => all + (views(one) ?? 0), 0),
348
- series: [
349
- ...settings2.series.map((one) => group(one.id, published.filter((item2) => item2.series === one.id))),
350
- ...none.length ? [group("", none)] : []
351
- ],
352
- kinds: KINDS.map((kind) => group(kind, published.filter((one) => one.kind === kind))).filter((one) => one.count),
353
- forms: FORMS.map((form) => group(form, published.filter((one) => one.form === form))).filter((one) => one.count),
354
- platforms: platforms.sort((a, b) => b.views - a.views),
355
- top: measured.map((item2) => ({ item: item2, views: views(item2) ?? 0 })).sort((a, b) => b.views - a.views).slice(0, 5)
356
- };
357
- }
358
- CreatorUtil.analysis = analysis;
359
525
  function setStats(items2, id, stats, now) {
360
- const read = stats.map((one) => stat({ at: now, ...object(one) ?? {} })).filter((one) => !!one);
526
+ const read = stats.map((one) => stat({ at: now, ...object2(one) ?? {} })).filter((one) => !!one);
361
527
  const before = items2.find((one) => one.id === id);
362
528
  if (!before) {
363
529
  throw new Error(`No such piece: ${id}.`);
@@ -366,25 +532,6 @@ var CreatorUtil;
366
532
  return change(items2, id, { stats: [...kept, ...read] }, now);
367
533
  }
368
534
  CreatorUtil.setStats = setStats;
369
- function insights(value) {
370
- return (Array.isArray(value) ? value : []).map((one) => object(one)).filter((one) => !!one && !!text(one.text, 300) && !!time(one.at)).map((one) => ({
371
- text: text(one.text, 300),
372
- tone: oneOf(["good", "bad", "idea"], one.tone, "idea"),
373
- ...text(one.series, 60) ? { series: text(one.series, 60) } : {},
374
- at: time(one.at)
375
- })).sort((a, b) => b.at - a.at).slice(0, 30);
376
- }
377
- CreatorUtil.insights = insights;
378
- function addInsights(kept, added, series, now) {
379
- const read = added.map((one) => typeof one === "string" ? { text: one } : object(one)).filter((one) => !!one).map((one) => ({ ...one, series: seriesNamed(series, one.series)?.id, at: now }));
380
- return insights([...read, ...kept]);
381
- }
382
- CreatorUtil.addInsights = addInsights;
383
- function latestInsights(insights2) {
384
- const newest = insights2[0]?.at ?? 0;
385
- return insights2.filter((one) => newest - one.at < DAY);
386
- }
387
- CreatorUtil.latestInsights = latestInsights;
388
535
  function progress(items2, goal, now) {
389
536
  if (!goal) {
390
537
  return;
@@ -396,7 +543,7 @@ var CreatorUtil;
396
543
  });
397
544
  return {
398
545
  videos: published.filter((one) => one.form === "video").length,
399
- posts: published.filter((one) => one.form === "post").length,
546
+ posts: published.filter((one) => one.form !== "video").length,
400
547
  day: Math.max(1, Math.min(goal.days, Math.floor((now - goal.from) / DAY) + 1))
401
548
  };
402
549
  }
@@ -433,34 +580,45 @@ var CreatorUtil;
433
580
  return minutes(weeks2, now) >= settings2.minutesCap * 0.75 ? 2 : 6;
434
581
  }
435
582
  CreatorUtil.offer = offer;
583
+ function need(value) {
584
+ const kept = object2(value);
585
+ const words = text2(kept?.text, 300);
586
+ if (!kept || !words) {
587
+ return;
588
+ }
589
+ return { id: text2(kept.id, 60), text: words, ...kept.done === true ? { done: true } : {} };
590
+ }
591
+ CreatorUtil.need = need;
436
592
  function version(value) {
437
- const kept = object(value);
438
- const platform2 = text(kept?.platform, 60);
593
+ const kept = object2(value);
594
+ const platform2 = text2(kept?.platform, 60);
439
595
  if (!kept || !platform2) {
440
596
  return;
441
597
  }
442
- const cover = text(kept.cover, 500);
598
+ const cover = text2(kept.cover, 500);
443
599
  return {
444
600
  platform: platform2,
445
- title: text(kept.title, 200),
446
- text: text(kept.text, 5000),
601
+ ...FORMS.includes(kept.form) ? { form: kept.form } : {},
602
+ title: text2(kept.title, 200),
603
+ text: text2(kept.text, 20000),
447
604
  tags: texts(kept.tags, 20),
448
605
  files: texts(kept.files, 40),
449
606
  ...cover ? { cover } : {}
450
607
  };
451
608
  }
452
609
  function check(value) {
453
- const kept = object(value);
454
- return kept && text(kept.text, 200) ? { text: text(kept.text, 200), ok: kept.ok === true } : undefined;
610
+ const kept = object2(value);
611
+ return kept && text2(kept.text, 200) ? { text: text2(kept.text, 200), ok: kept.ok === true } : undefined;
455
612
  }
456
613
  function link(value) {
457
- const kept = object(value);
614
+ const kept = object2(value);
458
615
  const href = url(kept?.url);
459
- return kept && href && text(kept.platform, 60) ? { platform: text(kept.platform, 60), url: href, at: time(kept.at) ?? Date.now() } : undefined;
616
+ const scheduled = PublishUtil.timeOf(kept?.scheduled);
617
+ return kept && href && text2(kept.platform, 60) ? { platform: text2(kept.platform, 60), url: href, at: time2(kept.at) ?? Date.now(), ...scheduled ? { scheduled } : {} } : undefined;
460
618
  }
461
619
  function stat(value) {
462
- const kept = object(value);
463
- const platform2 = text(kept?.platform, 60);
620
+ const kept = object2(value);
621
+ const platform2 = text2(kept?.platform, 60);
464
622
  if (!kept || !platform2 || typeof kept.views !== "number") {
465
623
  return;
466
624
  }
@@ -472,27 +630,13 @@ var CreatorUtil;
472
630
  ...optional("comments"),
473
631
  ...optional("follows"),
474
632
  ...typeof kept.completion === "number" && Number.isFinite(kept.completion) ? { completion: Math.max(0, Math.min(1, kept.completion)) } : {},
475
- at: time(kept.at) ?? Date.now()
633
+ at: time2(kept.at) ?? Date.now()
476
634
  };
477
635
  }
478
- function hash(value) {
479
- let h = 0;
480
- for (const char of value) {
481
- h = Math.imul(h, 31) + (char.codePointAt(0) ?? 0) | 0;
482
- }
483
- return (h >>> 0).toString(36);
484
- }
485
636
  function source(value) {
486
- const kept = object(value);
637
+ const kept = object2(value);
487
638
  const href = url(kept?.url);
488
- return kept && href && text(kept.name, 80) ? { name: text(kept.name, 80), url: href } : undefined;
489
- }
490
- function url(value) {
491
- const raw = text(value, 1000);
492
- return /^https?:\/\/\S+$/i.test(raw) ? raw : undefined;
493
- }
494
- function count(value, fallback) {
495
- return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.round(value) : fallback;
639
+ return kept && href && text2(kept.name, 80) ? { name: text2(kept.name, 80), url: href } : undefined;
496
640
  }
497
641
  })(CreatorUtil ||= {});
498
642
 
@@ -605,6 +749,12 @@ var EN = {
605
749
  pass: "Pass, publish it",
606
750
  approved: "Passed: Ta publishes it on each platform",
607
751
  passPrompt: "Passed: publish {id} on each platform and keep the links",
752
+ queuedNext: "Passed: published next",
753
+ queuedAhead: "Passed: {n} to publish before it",
754
+ publishingNow: "Publishing now",
755
+ slotNow: "now",
756
+ stoppedNote: "Not published: {note}",
757
+ publishAgain: "Publish again",
608
758
  doingScript: "Writing the script: a hook in the first 3 seconds",
609
759
  doingVisuals: "Drawing the scenes: host, terminal, phone",
610
760
  doingVoice: "Recording the voice, scene by scene",
@@ -615,7 +765,9 @@ var EN = {
615
765
  flowSeries: "{n} series",
616
766
  flowNone: "None yet",
617
767
  flowWaiting: "{n} wait for you",
618
- flowPassed: "Passed, publishing",
768
+ flowPublishing: "{n} passed, publishing",
769
+ publishingHead: "Publishing",
770
+ publishingAbout: "Passed by you: Ta publishes them one at a time",
619
771
  flowWeek: "{n} this week",
620
772
  flowMonday: "Reviewed each Monday",
621
773
  showAll: "Show all {n}",
@@ -629,6 +781,7 @@ var EN = {
629
781
  byForm: "By form",
630
782
  byPlatform: "By platform",
631
783
  perPiece: "views a piece",
784
+ noViews: "no views yet",
632
785
  completion: "watched {n}%",
633
786
  pieces: "{n} pieces",
634
787
  weekly: "Views by week",
@@ -640,7 +793,98 @@ var EN = {
640
793
  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",
641
794
  viewsShort: "{n} views",
642
795
  cancel: "Cancel",
643
- noneYet: "Nothing published yet"
796
+ noneYet: "Nothing published yet",
797
+ article: "Article",
798
+ note: "Note",
799
+ original: "Your own",
800
+ talk: "Comments",
801
+ materials: "Materials",
802
+ needsTitle: "Waiting for your materials",
803
+ needsHint: "Ta looked in the working directory first; send the rest in its conversation",
804
+ giveNow: "Send them",
805
+ skipNeeds: "Go on without",
806
+ skipPrompt: "{id}: do not wait for the materials, make it with what there is",
807
+ flowMaterials: "{n} wait for materials",
808
+ public: "Public",
809
+ internal: "In-company",
810
+ both: "Both",
811
+ reachTip: "Who it is for: tap to change",
812
+ noInside: "For your company, but no in-company platform is picked: add one in Settings",
813
+ drafts: "Answers waiting for you",
814
+ autoSent: "Answered lately",
815
+ asked: "What the audience asks",
816
+ send: "Send",
817
+ dropReply: "Don’t answer",
818
+ withdraw: "Take back",
819
+ withdrawn: "Taken back",
820
+ sending: "Posting soon",
821
+ sent: "Posted",
822
+ autoTag: "by Ta",
823
+ replyLevels: "How comments are answered",
824
+ levelAct: "On its own",
825
+ levelAsk: "Show me first",
826
+ levelOff: "Not at all",
827
+ levelAuto: "Let Ta adjust",
828
+ 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”",
829
+ question: "Question",
830
+ suggestion: "Suggestion",
831
+ correction: "Correction",
832
+ praise: "Praise",
833
+ negative: "Negative",
834
+ spam: "Ad",
835
+ noComments: "No comments read yet",
836
+ commentsHint: "Read after publishing: more often while comments come, less while none do",
837
+ commentsPace: "Reading comments",
838
+ paceHow: "How often",
839
+ paceAuto: "Auto",
840
+ paceHours: "Every {n} h",
841
+ paceDaily: "Daily",
842
+ paceFor: "For how long",
843
+ paceDays: "{n} days",
844
+ 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",
845
+ paceNow: "Now about every {n} h",
846
+ paceFixedNote: "Each piece is read at this pace; Ta still learns, for when you go back to Auto",
847
+ flowDrafts: "{n} to answer",
848
+ flowComments: "{n} comments",
849
+ ledTo: "Made a topic",
850
+ strategy: "Strategy",
851
+ strategyAuto: "Learns itself",
852
+ strategyManual: "I decide",
853
+ strategyAutoHint: "Each review updates it; remove what you disagree with",
854
+ strategyManualHint: "Reviews only propose; it changes once you take them",
855
+ ruleMine: "Yours",
856
+ take: "Take",
857
+ decline: "No",
858
+ keepRule: "Keep",
859
+ addRule: "Add a rule",
860
+ ruleHint: "e.g. at least one article a week",
861
+ proposedRules: "Proposed",
862
+ phases: "Looking back",
863
+ phaseEvery: "Every {n} weeks",
864
+ phaseOff: "Off",
865
+ phaseNow: "Look back now",
866
+ 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",
867
+ noPhases: "Every few weeks Ta looks back on the stage; the look back can become a piece",
868
+ insideLabel: "In-company platforms",
869
+ insideHint: "They take only pieces for your company, such as an internal knowledge base",
870
+ insideName: "Name",
871
+ insideUrl: "Address of its publishing page",
872
+ addInside: "Add",
873
+ seriesInside: "In-company",
874
+ toneLabel: "Style of language",
875
+ toneHint: "Scripts, titles and replies follow it",
876
+ toneOwn: "Your own words, e.g. like chatting with a friend",
877
+ toneAdd: "Add",
878
+ seriesTone: "Style of language of the series",
879
+ seriesToneSame: "Channel style",
880
+ tone_humorous: "Humorous",
881
+ tone_serious: "Serious",
882
+ tone_rigorous: "Rigorous",
883
+ tone_warm: "Warm",
884
+ tone_lively: "Lively",
885
+ tone_plain: "Plain-spoken",
886
+ tone_story: "Storytelling",
887
+ tone_sharp: "Sharp"
644
888
  };
645
889
  var ZH = {
646
890
  title: "创作者",
@@ -711,6 +955,12 @@ var ZH = {
711
955
  pass: "通过,自动发布",
712
956
  approved: "已通过:Ta 正在各平台发布",
713
957
  passPrompt: "{id} 审过了:去各平台发布,发完记下链接",
958
+ queuedNext: "已通过:下一条就发它",
959
+ queuedAhead: "已通过:前面还有 {n} 条在发",
960
+ publishingNow: "正在发布",
961
+ slotNow: "立即",
962
+ stoppedNote: "没发出去:{note}",
963
+ publishAgain: "再发一次",
714
964
  doingScript: "写脚本:开头 3 秒抓住人",
715
965
  doingVisuals: "画画面:主播、终端、手机",
716
966
  doingVoice: "逐个场景配音",
@@ -721,7 +971,9 @@ var ZH = {
721
971
  flowSeries: "{n} 个系列",
722
972
  flowNone: "暂无",
723
973
  flowWaiting: "{n} 条等你审",
724
- flowPassed: "已通过,发布中",
974
+ flowPublishing: "{n} 条已通过,发布中",
975
+ publishingHead: "发布中",
976
+ publishingAbout: "你已通过,Ta 按顺序逐条发布",
725
977
  flowWeek: "本周 {n} 条",
726
978
  flowMonday: "每周一复盘",
727
979
  showAll: "展开全部 {n}",
@@ -735,6 +987,7 @@ var ZH = {
735
987
  byForm: "按形式",
736
988
  byPlatform: "按平台",
737
989
  perPiece: "条均播放",
990
+ noViews: "还没有播放数据",
738
991
  completion: "完播 {n}%",
739
992
  pieces: "{n} 条",
740
993
  weekly: "每周播放",
@@ -746,7 +999,98 @@ var ZH = {
746
999
  reviewPrompt: "现在复盘我的内容号:读各平台每条内容的数据,按系列、类型、形式对比,把结论记下来用于后面的选题",
747
1000
  viewsShort: "{n} 播放",
748
1001
  cancel: "取消",
749
- noneYet: "还没有发布"
1002
+ noneYet: "还没有发布",
1003
+ article: "长文",
1004
+ note: "动态",
1005
+ original: "原创",
1006
+ talk: "互动",
1007
+ materials: "等素材",
1008
+ needsTitle: "等你的素材",
1009
+ needsHint: "Ta 已先在工作目录里找过,剩下的在对话里发给 Ta",
1010
+ giveNow: "去发素材",
1011
+ skipNeeds: "不等了,先做",
1012
+ skipPrompt: "{id} 不等素材了,用现有的先做",
1013
+ flowMaterials: "{n} 条等素材",
1014
+ public: "公开",
1015
+ internal: "公司内",
1016
+ both: "内外都发",
1017
+ reachTip: "发布范围:点一下切换",
1018
+ noInside: "这条要发公司内,但还没选公司内平台:在设置里添加",
1019
+ drafts: "等你过目的回复",
1020
+ autoSent: "最近的回复",
1021
+ asked: "观众在问",
1022
+ send: "发送",
1023
+ dropReply: "不回",
1024
+ withdraw: "撤回",
1025
+ withdrawn: "已撤回",
1026
+ sending: "稍后发出",
1027
+ sent: "已发出",
1028
+ autoTag: "Ta 自动回",
1029
+ replyLevels: "回复方式",
1030
+ levelAct: "自动回",
1031
+ levelAsk: "先给我看",
1032
+ levelOff: "不回",
1033
+ levelAuto: "交给 Ta 调",
1034
+ levelLearn: "Ta 会跟着你学:照发多了改成自动回,常改常撤就退回先给你看",
1035
+ question: "提问",
1036
+ suggestion: "建议",
1037
+ correction: "纠错",
1038
+ praise: "夸奖",
1039
+ negative: "负面",
1040
+ spam: "广告",
1041
+ noComments: "还没有读到评论",
1042
+ commentsHint: "发布后自动读评论:评论多就读得勤,没有就放慢",
1043
+ commentsPace: "读评论",
1044
+ paceHow: "多久读一次",
1045
+ paceAuto: "自动",
1046
+ paceHours: "每 {n} 小时",
1047
+ paceDaily: "每天",
1048
+ paceFor: "读多久",
1049
+ paceDays: "{n} 天",
1050
+ paceAutoNote: "Ta 按评论多少自己调:新评论多就读得勤(最快 1 小时),没有就放慢(最慢 2 天);新发布的从最近几条摸出的节奏开始",
1051
+ paceNow: "现在约每 {n} 小时一次",
1052
+ paceFixedNote: "每条都按这个节奏读;Ta 仍在学,切回自动时直接用上",
1053
+ flowDrafts: "{n} 条待回",
1054
+ flowComments: "{n} 条评论",
1055
+ ledTo: "已成选题",
1056
+ strategy: "策略",
1057
+ strategyAuto: "自动进化",
1058
+ strategyManual: "我来定",
1059
+ strategyAutoHint: "每次复盘自动更新,不认同的删掉就行",
1060
+ strategyManualHint: "复盘只提建议,你采纳才生效",
1061
+ ruleMine: "你定的",
1062
+ take: "采纳",
1063
+ decline: "不要",
1064
+ keepRule: "固定",
1065
+ addRule: "加一条规则",
1066
+ ruleHint: "比如:每周至少一篇长文",
1067
+ proposedRules: "复盘建议",
1068
+ phases: "阶段回顾",
1069
+ phaseEvery: "每 {n} 周",
1070
+ phaseOff: "不回顾",
1071
+ phaseNow: "现在回顾",
1072
+ phasePrompt: "现在回顾我的内容号这一阶段:发了什么、数据和粉丝怎么变、策略是什么又改了什么、下一阶段改什么;记下来,并做成一期讲这个号自己经历的选题",
1073
+ noPhases: "每隔几周 Ta 回顾一次这一阶段,回顾可以做成一期内容",
1074
+ insideLabel: "公司内平台",
1075
+ insideHint: "只发给公司内看的内容,比如内部知识库",
1076
+ insideName: "平台名",
1077
+ insideUrl: "发布页地址",
1078
+ addInside: "添加",
1079
+ seriesInside: "公司内",
1080
+ toneLabel: "语言风格",
1081
+ toneHint: "脚本、文案、评论回复都照着写",
1082
+ toneOwn: "自己写一个,比如:像朋友聊天",
1083
+ toneAdd: "添加",
1084
+ seriesTone: "这个系列的语言风格",
1085
+ seriesToneSame: "同频道风格",
1086
+ tone_humorous: "幽默",
1087
+ tone_serious: "严肃",
1088
+ tone_rigorous: "逻辑缜密",
1089
+ tone_warm: "亲切",
1090
+ tone_lively: "活泼",
1091
+ tone_plain: "通俗易懂",
1092
+ tone_story: "讲故事",
1093
+ tone_sharp: "犀利"
750
1094
  };
751
1095
  var ZH_TW = {
752
1096
  title: "創作者",
@@ -817,6 +1161,12 @@ var ZH_TW = {
817
1161
  pass: "通過,自動發佈",
818
1162
  approved: "已通過:Ta 正在各平台發佈",
819
1163
  passPrompt: "{id} 審過了:去各平台發佈,發完記下連結",
1164
+ queuedNext: "已通過:下一條就發它",
1165
+ queuedAhead: "已通過:前面還有 {n} 條在發",
1166
+ publishingNow: "正在發佈",
1167
+ slotNow: "立即",
1168
+ stoppedNote: "沒發出去:{note}",
1169
+ publishAgain: "再發一次",
820
1170
  doingScript: "寫腳本:開頭 3 秒抓住人",
821
1171
  doingVisuals: "畫畫面:主播、終端、手機",
822
1172
  doingVoice: "逐個場景配音",
@@ -827,7 +1177,9 @@ var ZH_TW = {
827
1177
  flowSeries: "{n} 個系列",
828
1178
  flowNone: "暫無",
829
1179
  flowWaiting: "{n} 條等你審",
830
- flowPassed: "已通過,發佈中",
1180
+ flowPublishing: "{n} 條已通過,發佈中",
1181
+ publishingHead: "發佈中",
1182
+ publishingAbout: "你已通過,Ta 按順序逐條發佈",
831
1183
  flowWeek: "本週 {n} 條",
832
1184
  flowMonday: "每週一複盤",
833
1185
  showAll: "展開全部 {n}",
@@ -841,6 +1193,7 @@ var ZH_TW = {
841
1193
  byForm: "按形式",
842
1194
  byPlatform: "按平台",
843
1195
  perPiece: "條均播放",
1196
+ noViews: "還沒有播放數據",
844
1197
  completion: "完播 {n}%",
845
1198
  pieces: "{n} 條",
846
1199
  weekly: "每週播放",
@@ -852,7 +1205,98 @@ var ZH_TW = {
852
1205
  reviewPrompt: "現在複盤我的內容號:讀各平台每條內容的數據,按系列、類型、形式對比,把結論記下來用於後面的選題",
853
1206
  viewsShort: "{n} 播放",
854
1207
  cancel: "取消",
855
- noneYet: "還沒有發佈"
1208
+ noneYet: "還沒有發佈",
1209
+ article: "長文",
1210
+ note: "動態",
1211
+ original: "原創",
1212
+ talk: "互動",
1213
+ materials: "等素材",
1214
+ needsTitle: "等你的素材",
1215
+ needsHint: "Ta 已先在工作目錄裡找過,剩下的在對話裡發給 Ta",
1216
+ giveNow: "去發素材",
1217
+ skipNeeds: "不等了,先做",
1218
+ skipPrompt: "{id} 不等素材了,用現有的先做",
1219
+ flowMaterials: "{n} 條等素材",
1220
+ public: "公開",
1221
+ internal: "公司內",
1222
+ both: "內外都發",
1223
+ reachTip: "發佈範圍:點一下切換",
1224
+ noInside: "這條要發公司內,但還沒選公司內平台:在設定裡新增",
1225
+ drafts: "等你過目的回覆",
1226
+ autoSent: "最近的回覆",
1227
+ asked: "觀眾在問",
1228
+ send: "發送",
1229
+ dropReply: "不回",
1230
+ withdraw: "撤回",
1231
+ withdrawn: "已撤回",
1232
+ sending: "稍後發出",
1233
+ sent: "已發出",
1234
+ autoTag: "Ta 自動回",
1235
+ replyLevels: "回覆方式",
1236
+ levelAct: "自動回",
1237
+ levelAsk: "先給我看",
1238
+ levelOff: "不回",
1239
+ levelAuto: "交給 Ta 調",
1240
+ levelLearn: "Ta 會跟著你學:照發多了改成自動回,常改常撤就退回先給你看",
1241
+ question: "提問",
1242
+ suggestion: "建議",
1243
+ correction: "糾錯",
1244
+ praise: "稱讚",
1245
+ negative: "負面",
1246
+ spam: "廣告",
1247
+ noComments: "還沒有讀到留言",
1248
+ commentsHint: "發佈後自動讀評論:評論多就讀得勤,沒有就放慢",
1249
+ commentsPace: "讀評論",
1250
+ paceHow: "多久讀一次",
1251
+ paceAuto: "自動",
1252
+ paceHours: "每 {n} 小時",
1253
+ paceDaily: "每天",
1254
+ paceFor: "讀多久",
1255
+ paceDays: "{n} 天",
1256
+ paceAutoNote: "Ta 依評論多少自己調:新評論多就讀得勤(最快 1 小時),沒有就放慢(最慢 2 天);新發佈的從最近幾條摸出的節奏開始",
1257
+ paceNow: "現在約每 {n} 小時一次",
1258
+ paceFixedNote: "每條都照這個節奏讀;Ta 仍在學,切回自動時直接用上",
1259
+ flowDrafts: "{n} 條待回",
1260
+ flowComments: "{n} 條留言",
1261
+ ledTo: "已成選題",
1262
+ strategy: "策略",
1263
+ strategyAuto: "自動進化",
1264
+ strategyManual: "我來定",
1265
+ strategyAutoHint: "每次複盤自動更新,不認同的刪掉就行",
1266
+ strategyManualHint: "複盤只提建議,你採納才生效",
1267
+ ruleMine: "你定的",
1268
+ take: "採納",
1269
+ decline: "不要",
1270
+ keepRule: "固定",
1271
+ addRule: "加一條規則",
1272
+ ruleHint: "比如:每週至少一篇長文",
1273
+ proposedRules: "複盤建議",
1274
+ phases: "階段回顧",
1275
+ phaseEvery: "每 {n} 週",
1276
+ phaseOff: "不回顧",
1277
+ phaseNow: "現在回顧",
1278
+ phasePrompt: "現在回顧我的內容號這一階段:發了什麼、數據和粉絲怎麼變、策略是什麼又改了什麼、下一階段改什麼;記下來,並做成一期講這個號自己經歷的選題",
1279
+ noPhases: "每隔幾週 Ta 回顧一次這一階段,回顧可以做成一期內容",
1280
+ insideLabel: "公司內平台",
1281
+ insideHint: "只發給公司內看的內容,比如內部知識庫",
1282
+ insideName: "平台名",
1283
+ insideUrl: "發佈頁地址",
1284
+ addInside: "新增",
1285
+ seriesInside: "公司內",
1286
+ toneLabel: "語言風格",
1287
+ toneHint: "腳本、文案、評論回覆都照著寫",
1288
+ toneOwn: "自己寫一個,比如:像朋友聊天",
1289
+ toneAdd: "添加",
1290
+ seriesTone: "這個系列的語言風格",
1291
+ seriesToneSame: "同頻道風格",
1292
+ tone_humorous: "幽默",
1293
+ tone_serious: "嚴肅",
1294
+ tone_rigorous: "邏輯縝密",
1295
+ tone_warm: "親切",
1296
+ tone_lively: "活潑",
1297
+ tone_plain: "通俗易懂",
1298
+ tone_story: "講故事",
1299
+ tone_sharp: "犀利"
856
1300
  };
857
1301
  var JA = {
858
1302
  title: "クリエイター",
@@ -923,6 +1367,12 @@ var JA = {
923
1367
  pass: "OK、自動で投稿",
924
1368
  approved: "OK 済み:Ta が各プラットフォームに投稿中",
925
1369
  passPrompt: "{id} は確認済み:各プラットフォームに投稿し、リンクを記録して",
1370
+ queuedNext: "OK 済み:次に投稿します",
1371
+ queuedAhead: "OK 済み:先に {n} 件を投稿します",
1372
+ publishingNow: "投稿中",
1373
+ slotNow: "すぐ",
1374
+ stoppedNote: "投稿できませんでした:{note}",
1375
+ publishAgain: "もう一度投稿",
926
1376
  doingScript: "台本:最初の 3 秒でつかむ",
927
1377
  doingVisuals: "映像:ホスト、ターミナル、スマホ",
928
1378
  doingVoice: "シーンごとにナレーション",
@@ -933,7 +1383,9 @@ var JA = {
933
1383
  flowSeries: "{n} シリーズ",
934
1384
  flowNone: "なし",
935
1385
  flowWaiting: "{n} 件が確認待ち",
936
- flowPassed: "OK 済み、投稿中",
1386
+ flowPublishing: "OK 済み {n} 件、投稿中",
1387
+ publishingHead: "投稿中",
1388
+ publishingAbout: "OK 済み:Ta が順番に 1 件ずつ投稿します",
937
1389
  flowWeek: "今週 {n} 件",
938
1390
  flowMonday: "毎週月曜に振り返り",
939
1391
  showAll: "すべて表示 {n}",
@@ -947,6 +1399,7 @@ var JA = {
947
1399
  byForm: "形式別",
948
1400
  byPlatform: "プラットフォーム別",
949
1401
  perPiece: "1 件あたり再生",
1402
+ noViews: "まだ再生データなし",
950
1403
  completion: "完走 {n}%",
951
1404
  pieces: "{n} 件",
952
1405
  weekly: "週ごとの再生",
@@ -958,7 +1411,98 @@ var JA = {
958
1411
  reviewPrompt: "私のチャンネルを今すぐ振り返って:各プラットフォームの各コンテンツのデータを読み、シリーズ・種類・形式で比べ、結論を今後のネタ選びのために記録して",
959
1412
  viewsShort: "{n} 再生",
960
1413
  cancel: "キャンセル",
961
- noneYet: "まだ公開なし"
1414
+ noneYet: "まだ公開なし",
1415
+ article: "記事",
1416
+ note: "短文",
1417
+ original: "オリジナル",
1418
+ talk: "コメント",
1419
+ materials: "素材待ち",
1420
+ needsTitle: "あなたの素材待ち",
1421
+ needsHint: "Ta が先に作業ディレクトリを探しました。残りは会話で送ってください",
1422
+ giveNow: "素材を送る",
1423
+ skipNeeds: "待たずに作る",
1424
+ skipPrompt: "{id}:素材を待たず、今あるもので作って",
1425
+ flowMaterials: "{n} 件が素材待ち",
1426
+ public: "公開",
1427
+ internal: "社内",
1428
+ both: "社内外",
1429
+ reachTip: "公開範囲:タップで切り替え",
1430
+ noInside: "社内向けですが社内プラットフォームが未選択です:設定で追加",
1431
+ drafts: "確認待ちの返信",
1432
+ autoSent: "最近の返信",
1433
+ asked: "視聴者の声",
1434
+ send: "送信",
1435
+ dropReply: "返信しない",
1436
+ withdraw: "取り消す",
1437
+ withdrawn: "取り消し済み",
1438
+ sending: "まもなく投稿",
1439
+ sent: "投稿済み",
1440
+ autoTag: "Ta が自動返信",
1441
+ replyLevels: "返信のしかた",
1442
+ levelAct: "自動で返信",
1443
+ levelAsk: "先に見せる",
1444
+ levelOff: "返信しない",
1445
+ levelAuto: "Ta に任せる",
1446
+ levelLearn: "Ta はあなたから学びます:そのまま送ることが多ければ自動に、直したり取り消したりが多ければ確認に戻ります",
1447
+ question: "質問",
1448
+ suggestion: "提案",
1449
+ correction: "指摘",
1450
+ praise: "称賛",
1451
+ negative: "否定的",
1452
+ spam: "広告",
1453
+ noComments: "まだコメントを読んでいません",
1454
+ commentsHint: "公開後に自動で読みます。コメントが多いほど頻繁に、ないときは間隔を空けます",
1455
+ commentsPace: "コメントの確認",
1456
+ paceHow: "頻度",
1457
+ paceAuto: "自動",
1458
+ paceHours: "{n} 時間ごと",
1459
+ paceDaily: "毎日",
1460
+ paceFor: "期間",
1461
+ paceDays: "{n} 日",
1462
+ paceAutoNote: "新しいコメントが多ければ頻繁に(最短 1 時間)、なければ間隔を空けます(最長 2 日)。新しい投稿は直近の投稿で落ち着いた間隔から始めます",
1463
+ paceNow: "今はおよそ {n} 時間ごと",
1464
+ paceFixedNote: "どの投稿もこの頻度で読みます。Ta は学び続け、自動に戻すとすぐ使います",
1465
+ flowDrafts: "返信待ち {n}",
1466
+ flowComments: "{n} 件のコメント",
1467
+ ledTo: "ネタになった",
1468
+ strategy: "戦略",
1469
+ strategyAuto: "自動で進化",
1470
+ strategyManual: "自分で決める",
1471
+ strategyAutoHint: "振り返りのたびに更新。合わないものは削除",
1472
+ strategyManualHint: "振り返りは提案だけ。採用すると反映",
1473
+ ruleMine: "あなたのルール",
1474
+ take: "採用",
1475
+ decline: "不要",
1476
+ keepRule: "固定",
1477
+ addRule: "ルールを追加",
1478
+ ruleHint: "例:毎週少なくとも 1 本の記事",
1479
+ proposedRules: "振り返りの提案",
1480
+ phases: "段階の振り返り",
1481
+ phaseEvery: "{n} 週ごと",
1482
+ phaseOff: "しない",
1483
+ phaseNow: "今すぐ振り返る",
1484
+ phasePrompt: "私のチャンネルのこの段階を今すぐ振り返って:何を公開し、数字とフォロワーはどう動き、戦略は何で何を変えたか、次に何を変えるか。記録し、このチャンネル自身の話としてネタにして",
1485
+ noPhases: "数週間ごとに Ta が段階を振り返ります。振り返りは 1 本のコンテンツにもなります",
1486
+ insideLabel: "社内プラットフォーム",
1487
+ insideHint: "社内向けのコンテンツだけを投稿(社内ナレッジベースなど)",
1488
+ insideName: "名前",
1489
+ insideUrl: "投稿ページのアドレス",
1490
+ addInside: "追加",
1491
+ seriesInside: "社内",
1492
+ toneLabel: "語り口",
1493
+ toneHint: "台本・タイトル・返信をこの口調で",
1494
+ toneOwn: "自分の言葉で(例:友達と話すように)",
1495
+ toneAdd: "追加",
1496
+ seriesTone: "このシリーズの語り口",
1497
+ seriesToneSame: "チャンネルと同じ",
1498
+ tone_humorous: "ユーモア",
1499
+ tone_serious: "真面目",
1500
+ tone_rigorous: "論理的",
1501
+ tone_warm: "親しみやすい",
1502
+ tone_lively: "元気",
1503
+ tone_plain: "わかりやすい",
1504
+ tone_story: "ストーリー",
1505
+ tone_sharp: "鋭い"
962
1506
  };
963
1507
  var WORDS = { "zh-CN": ZH, "zh-TW": ZH_TW, "en-US": EN, "ja-JP": JA };
964
1508
  var CreatorWords;
@@ -967,8 +1511,8 @@ var CreatorWords;
967
1511
  return TaLanguageUtil.pick(language, WORDS);
968
1512
  }
969
1513
  CreatorWords.of = of;
970
- function format(text2, values) {
971
- return text2.replace(/\{(\w+)\}/g, (all, key) => (key in values) ? String(values[key]) : all);
1514
+ function format(text3, values) {
1515
+ return text3.replace(/\{(\w+)\}/g, (all, key) => (key in values) ? String(values[key]) : all);
972
1516
  }
973
1517
  CreatorWords.format = format;
974
1518
  })(CreatorWords ||= {});
@@ -1013,6 +1557,14 @@ async function openPiece(context, item) {
1013
1557
  }
1014
1558
  await talk(pi, item.title, format(useWordsOf(pi).makePrompt, { title: item.title, id: item.id }));
1015
1559
  }
1560
+ async function tell(context, item, text3) {
1561
+ const { pi } = context;
1562
+ if (item.session && await pi.openChat?.(item.session)) {
1563
+ await pi.sendUserMessage(text3);
1564
+ } else {
1565
+ await talk(pi, item.title, text3);
1566
+ }
1567
+ }
1016
1568
  function useWordsOf(pi) {
1017
1569
  return CreatorWords.of(pi.ui.language);
1018
1570
  }
@@ -1124,6 +1676,7 @@ function BusyButton({
1124
1676
  pi,
1125
1677
  className,
1126
1678
  disabled,
1679
+ pressed,
1127
1680
  onClick,
1128
1681
  children
1129
1682
  }) {
@@ -1132,6 +1685,7 @@ function BusyButton({
1132
1685
  type: "button",
1133
1686
  className: busy ? `${className} ta-busy` : className,
1134
1687
  disabled,
1688
+ "aria-pressed": pressed,
1135
1689
  onClick: () => void run(() => Promise.resolve().then(onClick).catch(failed(pi)))
1136
1690
  }, busy && /* @__PURE__ */ React.createElement("span", {
1137
1691
  className: "ta-spinner ta-busy-mark"
@@ -1140,14 +1694,15 @@ function BusyButton({
1140
1694
 
1141
1695
  // web-src/cards.tsx
1142
1696
  var VIDEO = /\.(mp4|mov|webm|m4v)$/i;
1697
+ var IMAGE = /\.(png|jpe?g|webp|gif)$/i;
1143
1698
  function useFileUrl(context, path) {
1144
- const [url, setUrl] = React.useState();
1699
+ const [url2, setUrl] = React.useState();
1145
1700
  React.useEffect(() => {
1146
1701
  let live = true;
1147
1702
  setUrl(undefined);
1148
1703
  if (path) {
1149
1704
  const { pi } = context;
1150
- pi.workspace.fileUrl(path).then((url2) => pi.files.loadable(url2)).then((got) => live && setUrl(got), () => {
1705
+ pi.workspace.fileUrl(path).then((url3) => pi.files.loadable(url3)).then((got) => live && setUrl(got), () => {
1151
1706
  return;
1152
1707
  });
1153
1708
  }
@@ -1155,25 +1710,27 @@ function useFileUrl(context, path) {
1155
1710
  live = false;
1156
1711
  };
1157
1712
  }, [path]);
1158
- return url;
1713
+ return url2;
1159
1714
  }
1160
1715
  function Preview({ context, version }) {
1161
- const file = version?.files[0];
1162
- const url = useFileUrl(context, file);
1716
+ const file = version?.files.find((one) => VIDEO.test(one) || IMAGE.test(one));
1717
+ const url2 = useFileUrl(context, file);
1163
1718
  const cover = useFileUrl(context, version?.cover);
1164
1719
  const words = useWords(context.pi);
1165
1720
  return /* @__PURE__ */ React.createElement("div", {
1166
1721
  className: "tcre-preview"
1167
- }, url && file && VIDEO.test(file) ? /* @__PURE__ */ React.createElement("video", {
1168
- src: url,
1722
+ }, url2 && file && VIDEO.test(file) ? /* @__PURE__ */ React.createElement("video", {
1723
+ src: url2,
1169
1724
  poster: cover,
1170
1725
  controls: true,
1171
1726
  playsInline: true,
1172
1727
  preload: "metadata"
1173
- }) : url ? /* @__PURE__ */ React.createElement("img", {
1174
- src: url,
1728
+ }) : url2 ? /* @__PURE__ */ React.createElement("img", {
1729
+ src: url2,
1175
1730
  alt: ""
1176
- }) : /* @__PURE__ */ React.createElement("div", {
1731
+ }) : version?.text && !file ? /* @__PURE__ */ React.createElement("div", {
1732
+ className: "tcre-preview-words"
1733
+ }, version.text) : /* @__PURE__ */ React.createElement("div", {
1177
1734
  className: "tcre-preview-empty"
1178
1735
  }, version ? "" : words.versions), /* @__PURE__ */ React.createElement("span", {
1179
1736
  className: "tcre-ai"
@@ -1195,15 +1752,12 @@ function ReviewCard({
1195
1752
  const opened = React.useRef(Date.now());
1196
1753
  const version = versions[Math.min(shown, versions.length - 1)];
1197
1754
  const minutes = () => Math.min(30, Math.max(1, Math.round((Date.now() - opened.current) / 60000)));
1198
- const say = async (text2) => {
1199
- if (send) {
1200
- await send(text2);
1201
- } else if (item.session && await pi.openChat?.(item.session)) {
1202
- await pi.sendUserMessage(text2);
1203
- } else {
1204
- await talk(pi, item.title, text2);
1205
- }
1206
- };
1755
+ const say = (text3) => send ? send(text3) : tell(context, item, text3);
1756
+ const state = useStore(store);
1757
+ const reach = CreatorUtil.reach(item, state.settings);
1758
+ const open = item.stage === "review" && !item.approved;
1759
+ const inside = CreatorUtil.picked(state.settings).some((one) => one.internal);
1760
+ const nextReach = () => store.call("update", item.id, { reach: REACHES[(REACHES.indexOf(reach) + 1) % REACHES.length] });
1207
1761
  const change = async () => {
1208
1762
  const note = (await pi.ui.input(words.changeAsk))?.trim();
1209
1763
  if (note) {
@@ -1212,12 +1766,11 @@ function ReviewCard({
1212
1766
  }
1213
1767
  };
1214
1768
  const pass = async () => {
1215
- await store.call("approve", item.id, minutes());
1216
- await say(format(words.passPrompt, { id: item.id }));
1769
+ await store.call("approve", item.id, minutes(), format(words.passPrompt, { id: item.id }));
1217
1770
  };
1218
1771
  return /* @__PURE__ */ React.createElement("div", {
1219
1772
  className: "tcre-card tcre-review"
1220
- }, (item.series || onRemove) && /* @__PURE__ */ React.createElement("div", {
1773
+ }, (item.series || onRemove || reach !== "public" || open) && /* @__PURE__ */ React.createElement("div", {
1221
1774
  className: "tcre-review-head"
1222
1775
  }, /* @__PURE__ */ React.createElement(SeriesTag, {
1223
1776
  series: seriesOf(context, item.series),
@@ -1225,7 +1778,17 @@ function ReviewCard({
1225
1778
  words
1226
1779
  }), /* @__PURE__ */ React.createElement("span", {
1227
1780
  className: "tcre-grow"
1228
- }), onRemove && /* @__PURE__ */ React.createElement(IconButton, {
1781
+ }), open ? /* @__PURE__ */ React.createElement(BusyButton, {
1782
+ pi,
1783
+ className: "tcre-reach",
1784
+ onClick: nextReach
1785
+ }, /* @__PURE__ */ React.createElement("span", {
1786
+ title: words.reachTip,
1787
+ "data-reach": reach
1788
+ }, words[reach])) : reach !== "public" && /* @__PURE__ */ React.createElement("span", {
1789
+ className: "tcre-reach",
1790
+ "data-reach": reach
1791
+ }, words[reach]), onRemove && /* @__PURE__ */ React.createElement(IconButton, {
1229
1792
  pi,
1230
1793
  icon: "Trash2",
1231
1794
  label: words.remove,
@@ -1245,7 +1808,9 @@ function ReviewCard({
1245
1808
  onClick: () => setShown(at)
1246
1809
  }, /* @__PURE__ */ React.createElement(PlatformName, {
1247
1810
  platform: platformOf(context, one.platform) ?? { id: one.platform, name: one.platform, color: "var(--ta-muted)" }
1248
- })))), /* @__PURE__ */ React.createElement("div", {
1811
+ }), one.form && one.form !== item.form && /* @__PURE__ */ React.createElement("em", {
1812
+ className: "tcre-tab-form"
1813
+ }, words[one.form])))), /* @__PURE__ */ React.createElement("div", {
1249
1814
  className: "tcre-review-title"
1250
1815
  }, version?.title || item.title), version?.text && /* @__PURE__ */ React.createElement("button", {
1251
1816
  type: "button",
@@ -1261,9 +1826,12 @@ function ReviewCard({
1261
1826
  }, item.checks.map((check) => /* @__PURE__ */ React.createElement("span", {
1262
1827
  key: check.text,
1263
1828
  "data-ok": check.ok || undefined
1264
- }, /* @__PURE__ */ React.createElement("i", null, check.ok ? "✓" : "!"), check.text))), item.approved ? /* @__PURE__ */ React.createElement("div", {
1265
- className: "tcre-approved"
1266
- }, words.approved) : item.stage === "review" && /* @__PURE__ */ React.createElement("div", {
1829
+ }, /* @__PURE__ */ React.createElement("i", null, check.ok ? "✓" : "!"), check.text))), open && reach !== "public" && !inside && /* @__PURE__ */ React.createElement("div", {
1830
+ className: "tcre-notice"
1831
+ }, words.noInside), item.approved ? /* @__PURE__ */ React.createElement(Publishing, {
1832
+ context,
1833
+ item
1834
+ }) : item.stage === "review" && /* @__PURE__ */ React.createElement("div", {
1267
1835
  className: "tcre-buttons"
1268
1836
  }, /* @__PURE__ */ React.createElement(BusyButton, {
1269
1837
  pi,
@@ -1275,6 +1843,43 @@ function ReviewCard({
1275
1843
  onClick: pass
1276
1844
  }, words.pass)));
1277
1845
  }
1846
+ function Publishing({ context, item }) {
1847
+ const { pi, store } = context;
1848
+ const words = useWords(pi);
1849
+ const state = useStore(store);
1850
+ const publishing = item.publishing;
1851
+ if (publishing?.state === "stopped") {
1852
+ return /* @__PURE__ */ React.createElement("div", {
1853
+ className: "tcre-approved",
1854
+ "data-tone": "warn"
1855
+ }, /* @__PURE__ */ React.createElement("span", null, format(words.stoppedNote, { note: publishing.note || "—" })), /* @__PURE__ */ React.createElement(BusyButton, {
1856
+ pi,
1857
+ className: "tcre-secondary",
1858
+ onClick: () => store.call("approve", item.id, 0, format(words.passPrompt, { id: item.id }))
1859
+ }, words.publishAgain));
1860
+ }
1861
+ if (publishing?.state === "running") {
1862
+ const two = (n) => String(n).padStart(2, "0");
1863
+ 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;
1864
+ return /* @__PURE__ */ React.createElement("div", {
1865
+ className: "tcre-approved"
1866
+ }, /* @__PURE__ */ React.createElement("span", null, words.publishingNow), (publishing.slots ?? []).map((slot) => /* @__PURE__ */ React.createElement("span", {
1867
+ key: slot.platform,
1868
+ className: "tcre-slot"
1869
+ }, /* @__PURE__ */ React.createElement(PlatformName, {
1870
+ platform: platformOf(context, slot.platform) ?? { id: slot.platform, name: slot.platform, color: "var(--ta-muted)" }
1871
+ }), when(slot.at))));
1872
+ }
1873
+ if (publishing?.state === "queued") {
1874
+ const n = PublishUtil.ahead(state.items, item.id);
1875
+ return /* @__PURE__ */ React.createElement("div", {
1876
+ className: "tcre-approved"
1877
+ }, n ? format(words.queuedAhead, { n }) : words.queuedNext);
1878
+ }
1879
+ return /* @__PURE__ */ React.createElement("div", {
1880
+ className: "tcre-approved"
1881
+ }, words.approved);
1882
+ }
1278
1883
  function reviewBlock(context) {
1279
1884
  return function Review({ code, closed, send, conversation }) {
1280
1885
  const state = useStore(context.store);
@@ -1314,12 +1919,282 @@ var ReviewCode;
1314
1919
  ReviewCode.id = id;
1315
1920
  })(ReviewCode ||= {});
1316
1921
 
1922
+ // web-src/channel-util.ts
1923
+ var HOUR = 3600000;
1924
+ var DAY2 = 24 * HOUR;
1925
+ var MAX_COMMENTS = 600;
1926
+ var COMMENTS_FOR = 60 * DAY2;
1927
+ var MAX_LESSONS = 40;
1928
+ var ChannelUtil;
1929
+ ((ChannelUtil) => {
1930
+ function analysis(items, settings) {
1931
+ const published = items.filter((one) => one.stage === "published" && !one.dropped);
1932
+ const measured = published.filter((one) => one.stats?.length);
1933
+ const group = (key, of) => {
1934
+ const read = of.filter((one) => one.stats?.length);
1935
+ const total = read.reduce((all, one) => all + (CreatorUtil.views(one) ?? 0), 0);
1936
+ const watched = read.flatMap((one) => (one.stats ?? []).filter((stat) => stat.completion !== undefined));
1937
+ const weight = watched.reduce((all, one) => all + Math.max(1, one.views), 0);
1938
+ return {
1939
+ key,
1940
+ count: of.length,
1941
+ measured: read.length,
1942
+ views: total,
1943
+ average: read.length ? Math.round(total / read.length) : 0,
1944
+ ...watched.length ? { completion: watched.reduce((all, one) => all + (one.completion ?? 0) * Math.max(1, one.views), 0) / weight } : {}
1945
+ };
1946
+ };
1947
+ const known = new Set(settings.series.map((one) => one.id));
1948
+ const none = published.filter((one) => !one.series || !known.has(one.series));
1949
+ const platforms = [...new Set(measured.flatMap((one) => (one.stats ?? []).map((stat) => stat.platform)))].map((platform) => {
1950
+ const stats = measured.flatMap((one) => (one.stats ?? []).filter((stat) => stat.platform === platform));
1951
+ const total = stats.reduce((all, one) => all + one.views, 0);
1952
+ return { key: platform, count: stats.length, measured: stats.length, views: total, average: stats.length ? Math.round(total / stats.length) : 0 };
1953
+ });
1954
+ return {
1955
+ published: published.length,
1956
+ measured: measured.length,
1957
+ views: measured.reduce((all, one) => all + (CreatorUtil.views(one) ?? 0), 0),
1958
+ series: [
1959
+ ...settings.series.map((one) => group(one.id, published.filter((item) => item.series === one.id))),
1960
+ ...none.length ? [group("", none)] : []
1961
+ ],
1962
+ kinds: KINDS.map((kind) => group(kind, published.filter((one) => one.kind === kind))).filter((one) => one.count),
1963
+ forms: FORMS.map((form) => group(form, published.filter((one) => one.form === form))).filter((one) => one.count),
1964
+ platforms: platforms.sort((a, b) => b.views - a.views),
1965
+ top: measured.map((item) => ({ item, views: CreatorUtil.views(item) ?? 0 })).sort((a, b) => b.views - a.views).slice(0, 5)
1966
+ };
1967
+ }
1968
+ ChannelUtil.analysis = analysis;
1969
+ function insights(value) {
1970
+ const all = (Array.isArray(value) ? value : []).map((one) => object2(one)).filter((one) => !!one && !!text2(one.text, 300) && !!time2(one.at)).map((one) => {
1971
+ const at = time2(one.at);
1972
+ const words = text2(one.text, 300);
1973
+ return {
1974
+ id: text2(one.id, 60) || `i${hash(words + at)}`,
1975
+ text: words,
1976
+ tone: oneOf(["good", "bad", "idea"], one.tone, "idea"),
1977
+ ...text2(one.series, 60) ? { series: text2(one.series, 60) } : {},
1978
+ ...one.by === "user" ? { by: "user" } : {},
1979
+ ...one.state === "proposed" || one.state === "declined" ? { state: one.state } : {},
1980
+ at
1981
+ };
1982
+ }).sort((a, b) => b.at - a.at);
1983
+ const mine = all.filter((one) => one.by === "user");
1984
+ const ta = all.filter((one) => one.by !== "user").slice(0, 30);
1985
+ return [...mine, ...ta].sort((a, b) => b.at - a.at);
1986
+ }
1987
+ ChannelUtil.insights = insights;
1988
+ function addInsights(kept, added, series, now, mode = "auto") {
1989
+ const read = added.map((one) => typeof one === "string" ? { text: one } : object2(one)).filter((one) => !!one).map((one, at) => ({
1990
+ ...one,
1991
+ id: `i${now.toString(36)}${at}`,
1992
+ by: undefined,
1993
+ series: CreatorUtil.seriesNamed(series, one.series)?.id,
1994
+ ...mode === "manual" ? { state: "proposed" } : { state: undefined },
1995
+ at: now
1996
+ }));
1997
+ return insights([...read, ...kept.filter((one) => one.state !== "proposed")]);
1998
+ }
1999
+ ChannelUtil.addInsights = addInsights;
2000
+ function addRule(kept, words, series, now, seriesId) {
2001
+ const rule = text2(words, 300);
2002
+ if (!rule) {
2003
+ throw new Error("A rule needs its words.");
2004
+ }
2005
+ return insights([
2006
+ { id: `u${now.toString(36)}`, text: rule, tone: "idea", by: "user", series: CreatorUtil.seriesNamed(series, seriesId)?.id, at: now },
2007
+ ...kept
2008
+ ]);
2009
+ }
2010
+ ChannelUtil.addRule = addRule;
2011
+ function decideRule(kept, id, action) {
2012
+ const rule = kept.find((one) => one.id === id);
2013
+ if (!rule) {
2014
+ throw new Error(`No such rule: ${id}.`);
2015
+ }
2016
+ const changed = (patch) => insights(kept.map((one) => one.id === id ? { ...one, ...patch, state: patch.state } : one));
2017
+ switch (action) {
2018
+ case "take":
2019
+ return changed({ state: undefined });
2020
+ case "decline":
2021
+ case "remove":
2022
+ return rule.by === "user" ? insights(kept.filter((one) => one.id !== id)) : changed({ state: "declined" });
2023
+ case "keep":
2024
+ return changed({ by: "user", state: undefined });
2025
+ default:
2026
+ throw new Error(`An answer to a rule is take, decline, keep or remove: ${action}.`);
2027
+ }
2028
+ }
2029
+ ChannelUtil.decideRule = decideRule;
2030
+ function latestInsights(insights2) {
2031
+ const ta = insights2.filter((one) => one.by !== "user" && !one.state);
2032
+ const newest = ta[0]?.at ?? 0;
2033
+ return insights2.filter((one) => one.by === "user" || !one.state && newest - one.at < DAY2);
2034
+ }
2035
+ ChannelUtil.latestInsights = latestInsights;
2036
+ function proposed(insights2) {
2037
+ return insights2.filter((one) => one.state === "proposed");
2038
+ }
2039
+ ChannelUtil.proposed = proposed;
2040
+ function phases(value) {
2041
+ 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) => ({
2042
+ from: time2(one.from),
2043
+ to: time2(one.to),
2044
+ summary: text2(one.summary, 2000),
2045
+ ...text2(one.topic, 80) ? { topic: text2(one.topic, 80) } : {},
2046
+ at: time2(one.at)
2047
+ })).sort((a, b) => b.at - a.at).slice(0, 24);
2048
+ }
2049
+ ChannelUtil.phases = phases;
2050
+ function phaseDue(settings, items, phases2, now) {
2051
+ if (!settings.phaseWeeks) {
2052
+ return;
2053
+ }
2054
+ const published = items.filter((one) => one.stage === "published" && !one.dropped).map(CreatorUtil.publishedAt);
2055
+ const from = phases2[0]?.to ?? (published.length ? Math.min(...published) : undefined);
2056
+ if (from === undefined || now - from < settings.phaseWeeks * 7 * DAY2 || !published.some((at) => at >= from)) {
2057
+ return;
2058
+ }
2059
+ return { from, to: now };
2060
+ }
2061
+ ChannelUtil.phaseDue = phaseDue;
2062
+ function needsOf(values, now) {
2063
+ 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);
2064
+ }
2065
+ ChannelUtil.needsOf = needsOf;
2066
+ function given(item) {
2067
+ return (item.needs ?? []).every((one) => one.done);
2068
+ }
2069
+ ChannelUtil.given = given;
2070
+ ChannelUtil.PACE = { start: 12 * HOUR, first: 24 * HOUR, min: 2 * HOUR, max: 2 * DAY2, many: 3, ride: 0.5 };
2071
+ function nextGap(gap, added) {
2072
+ if (added >= ChannelUtil.PACE.many) {
2073
+ return Math.max(ChannelUtil.PACE.min, Math.round(gap / 2));
2074
+ }
2075
+ return added ? gap : Math.min(ChannelUtil.PACE.max, gap * 2);
2076
+ }
2077
+ ChannelUtil.nextGap = nextGap;
2078
+ function firstGap(items) {
2079
+ 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);
2080
+ return gaps.length ? Math.max(ChannelUtil.PACE.min, Math.min(ChannelUtil.PACE.first, gaps[Math.floor(gaps.length / 2)])) : ChannelUtil.PACE.start;
2081
+ }
2082
+ ChannelUtil.firstGap = firstGap;
2083
+ function commentsGap(item, items, settings) {
2084
+ return settings.commentsEvery ? settings.commentsEvery * HOUR : item.commentsGap ?? firstGap(items);
2085
+ }
2086
+ ChannelUtil.commentsGap = commentsGap;
2087
+ function live(item, now) {
2088
+ return (item.links ?? []).filter((one) => (one.scheduled ?? one.at) <= now);
2089
+ }
2090
+ ChannelUtil.live = live;
2091
+ function due(items, settings, now, share = 1) {
2092
+ return items.filter((one) => {
2093
+ const out = live(one, now).map((link) => link.scheduled ?? link.at);
2094
+ if (one.stage !== "published" || one.dropped || !out.length) {
2095
+ return false;
2096
+ }
2097
+ const published = Math.min(...out);
2098
+ const since = now - Math.max(one.commentsAt ?? 0, published);
2099
+ return now - published < settings.commentsDays * DAY2 && since >= share * commentsGap(one, items, settings);
2100
+ });
2101
+ }
2102
+ ChannelUtil.due = due;
2103
+ function comments(value, now = Date.now()) {
2104
+ 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);
2105
+ }
2106
+ ChannelUtil.comments = comments;
2107
+ function addComments(kept, item, input, levels, now, id) {
2108
+ const all = [...kept];
2109
+ const added = [];
2110
+ for (const value of input) {
2111
+ const read = object2(value);
2112
+ const platform = text2(read?.platform, 60);
2113
+ const words = text2(read?.text, 1000);
2114
+ if (!read || !platform || !words) {
2115
+ continue;
2116
+ }
2117
+ const key = text2(read.key, 120) || `t${hash(words)}`;
2118
+ const cls = oneOf(COMMENT_CLASSES, read.class, "question");
2119
+ const level = REPLY_CLASSES.includes(cls) ? levels[cls] : "off";
2120
+ const answer = text2(read.reply, 500);
2121
+ 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;
2122
+ const at = all.findIndex((one) => one.item === item && one.platform === platform && one.key === key);
2123
+ if (at >= 0) {
2124
+ const before = all[at];
2125
+ const open = !before.reply || before.reply.state === "draft";
2126
+ all[at] = {
2127
+ ...before,
2128
+ ...typeof read.likes === "number" ? { likes: count(read.likes, 0) } : {},
2129
+ ...open && reply ? { reply } : {}
2130
+ };
2131
+ continue;
2132
+ }
2133
+ const made = {
2134
+ id: id(),
2135
+ item,
2136
+ platform,
2137
+ key,
2138
+ text: words,
2139
+ class: cls,
2140
+ ...typeof read.likes === "number" ? { likes: count(read.likes, 0) } : {},
2141
+ ...reply ? { reply } : {},
2142
+ at: now
2143
+ };
2144
+ all.push(made);
2145
+ added.push(made);
2146
+ }
2147
+ return { comments: comments(all, now), added };
2148
+ }
2149
+ ChannelUtil.addComments = addComments;
2150
+ function examples(comments2, max = 8) {
2151
+ 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 ?? "" }));
2152
+ }
2153
+ ChannelUtil.examples = examples;
2154
+ function lessons(value) {
2155
+ 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);
2156
+ }
2157
+ ChannelUtil.lessons = lessons;
2158
+ function comment(value) {
2159
+ const kept = object2(value);
2160
+ const id = text2(kept?.id, 80);
2161
+ const words = text2(kept?.text, 1000);
2162
+ const at = time2(kept?.at);
2163
+ if (!kept || !id || !words || !at || !text2(kept.item, 80) || !text2(kept.platform, 60)) {
2164
+ return;
2165
+ }
2166
+ const reply = object2(kept.reply);
2167
+ const answer = text2(reply?.text, 500);
2168
+ const draft = text2(reply?.draft, 500);
2169
+ return {
2170
+ id,
2171
+ item: text2(kept.item, 80),
2172
+ platform: text2(kept.platform, 60),
2173
+ key: text2(kept.key, 120) || `t${hash(words)}`,
2174
+ text: words,
2175
+ class: oneOf(COMMENT_CLASSES, kept.class, "question"),
2176
+ ...typeof kept.likes === "number" ? { likes: count(kept.likes, 0) } : {},
2177
+ ...reply && answer ? {
2178
+ reply: {
2179
+ text: answer,
2180
+ state: oneOf(REPLY_STATES, reply.state, "draft"),
2181
+ ...reply.auto === true ? { auto: true } : {},
2182
+ ...draft ? { draft } : {},
2183
+ at: time2(reply.at) ?? at
2184
+ }
2185
+ } : {},
2186
+ ...text2(kept.topic, 80) ? { topic: text2(kept.topic, 80) } : {},
2187
+ at
2188
+ };
2189
+ }
2190
+ })(ChannelUtil ||= {});
2191
+
1317
2192
  // web-src/creator-store.ts
1318
- var KEYS = [Keys.SETTINGS, Keys.ITEMS, Keys.WEEKS, Keys.INSIGHTS];
2193
+ var KEYS = [Keys.SETTINGS, Keys.ITEMS, Keys.WEEKS, Keys.INSIGHTS, Keys.COMMENTS, Keys.PHASES];
1319
2194
 
1320
2195
  class CreatorStore {
1321
2196
  pi;
1322
- current = { loaded: false, settings: CreatorUtil.settings(undefined), items: [], weeks: [], insights: [] };
2197
+ current = { loaded: false, settings: CreatorUtil.settings(undefined), items: [], weeks: [], insights: [], comments: [], phases: [] };
1323
2198
  listeners = new Set;
1324
2199
  constructor(pi) {
1325
2200
  this.pi = pi;
@@ -1340,13 +2215,15 @@ class CreatorStore {
1340
2215
  return this.pi.callHost(method, ...params);
1341
2216
  }
1342
2217
  read() {
1343
- Promise.all(KEYS.map((key) => this.pi.storage.get(key))).then(([settings, items, weeks, insights]) => {
2218
+ Promise.all(KEYS.map((key) => this.pi.storage.get(key))).then(([settings, items, weeks, insights, comments, phases]) => {
1344
2219
  const next = {
1345
2220
  loaded: true,
1346
2221
  settings: CreatorUtil.settings(settings),
1347
2222
  items: CreatorUtil.items(items),
1348
2223
  weeks: CreatorUtil.weeks(weeks),
1349
- insights: CreatorUtil.insights(insights)
2224
+ insights: ChannelUtil.insights(insights),
2225
+ comments: ChannelUtil.comments(comments),
2226
+ phases: ChannelUtil.phases(phases)
1350
2227
  };
1351
2228
  if (!this.current.loaded || JSON.stringify(next) !== JSON.stringify(this.current)) {
1352
2229
  this.set(next);
@@ -1361,6 +2238,163 @@ class CreatorStore {
1361
2238
  }
1362
2239
  }
1363
2240
 
2241
+ // web-src/strategy.tsx
2242
+ var PHASE_WEEKS = [2, 4, 8, 0];
2243
+ function Strategy({ context }) {
2244
+ const { pi, store } = context;
2245
+ const state = useStore(store);
2246
+ const words = useWords(pi);
2247
+ const [rule, setRule] = React.useState("");
2248
+ const mode = state.settings.strategy;
2249
+ const rules = ChannelUtil.latestInsights(state.insights);
2250
+ const proposed = ChannelUtil.proposed(state.insights);
2251
+ const { TrendingUp, TrendingDown, Lightbulb, User } = pi.ui.icons;
2252
+ const tones = { good: TrendingUp, bad: TrendingDown, idea: Lightbulb };
2253
+ const icon = (one) => one.by === "user" ? User : tones[one.tone];
2254
+ const add = async () => {
2255
+ await store.call("addRule", rule);
2256
+ setRule("");
2257
+ };
2258
+ return /* @__PURE__ */ React.createElement("div", {
2259
+ className: "tcre-card tcre-panel tcre-insights"
2260
+ }, /* @__PURE__ */ React.createElement("div", {
2261
+ className: "tcre-panel-title"
2262
+ }, words.strategy, /* @__PURE__ */ React.createElement("div", {
2263
+ className: "ta-segmented tcre-seg"
2264
+ }, ["auto", "manual"].map((one) => /* @__PURE__ */ React.createElement(BusyButton, {
2265
+ key: one,
2266
+ pi,
2267
+ pressed: mode === one,
2268
+ className: mode === one ? "ta-on" : "",
2269
+ onClick: () => store.call("setSettings", { strategy: one })
2270
+ }, one === "auto" ? words.strategyAuto : words.strategyManual))), /* @__PURE__ */ React.createElement("span", {
2271
+ className: "tcre-grow"
2272
+ }), /* @__PURE__ */ React.createElement(BusyButton, {
2273
+ pi,
2274
+ className: "tcre-secondary tcre-small",
2275
+ onClick: () => talk(pi, words.reviewNow, words.reviewPrompt)
2276
+ }, words.reviewNow)), /* @__PURE__ */ React.createElement("div", {
2277
+ className: "tcre-muted tcre-strategy-hint"
2278
+ }, mode === "auto" ? words.strategyAutoHint : words.strategyManualHint), proposed.map((one) => /* @__PURE__ */ React.createElement(Rule, {
2279
+ key: one.id,
2280
+ context,
2281
+ rule: one,
2282
+ Icon: tones[one.tone],
2283
+ proposed: true
2284
+ }, /* @__PURE__ */ React.createElement(BusyButton, {
2285
+ pi,
2286
+ className: "tcre-text tcre-small",
2287
+ onClick: () => store.call("rule", one.id, "decline")
2288
+ }, words.decline), /* @__PURE__ */ React.createElement(BusyButton, {
2289
+ pi,
2290
+ className: "tcre-secondary tcre-small",
2291
+ onClick: () => store.call("rule", one.id, "take")
2292
+ }, words.take))), rules.map((one) => /* @__PURE__ */ React.createElement(Rule, {
2293
+ key: one.id,
2294
+ context,
2295
+ rule: one,
2296
+ Icon: icon(one)
2297
+ }, one.by !== "user" && /* @__PURE__ */ React.createElement(IconButton, {
2298
+ pi,
2299
+ icon: "Pin",
2300
+ label: words.keepRule,
2301
+ onClick: () => store.call("rule", one.id, "keep")
2302
+ }), /* @__PURE__ */ React.createElement(IconButton, {
2303
+ pi,
2304
+ icon: "X",
2305
+ label: words.remove,
2306
+ onClick: () => store.call("rule", one.id, "remove")
2307
+ }))), !rules.length && !proposed.length && /* @__PURE__ */ React.createElement("div", {
2308
+ className: "tcre-muted tcre-pad"
2309
+ }, words.noInsights), /* @__PURE__ */ React.createElement("div", {
2310
+ className: "tcre-rule-add"
2311
+ }, /* @__PURE__ */ React.createElement("input", {
2312
+ className: "tcre-field",
2313
+ value: rule,
2314
+ placeholder: words.ruleHint,
2315
+ onChange: (event) => setRule(event.target.value),
2316
+ onKeyDown: (event) => {
2317
+ if (event.key === "Enter" && rule.trim() && !event.nativeEvent.isComposing) {
2318
+ add();
2319
+ }
2320
+ }
2321
+ }), /* @__PURE__ */ React.createElement(BusyButton, {
2322
+ pi,
2323
+ className: "tcre-secondary tcre-small",
2324
+ disabled: !rule.trim(),
2325
+ onClick: add
2326
+ }, words.addRule)));
2327
+ }
2328
+ function Rule({
2329
+ context,
2330
+ rule,
2331
+ Icon,
2332
+ proposed,
2333
+ children
2334
+ }) {
2335
+ const words = useWords(context.pi);
2336
+ const series = seriesOf(context, rule.series);
2337
+ return /* @__PURE__ */ React.createElement("div", {
2338
+ className: "tcre-insight",
2339
+ "data-tone": rule.by === "user" ? "user" : rule.tone,
2340
+ "data-proposed": proposed || undefined
2341
+ }, /* @__PURE__ */ React.createElement("span", {
2342
+ className: "tcre-insight-icon"
2343
+ }, Icon && /* @__PURE__ */ React.createElement(Icon, {
2344
+ size: 14
2345
+ })), /* @__PURE__ */ React.createElement("span", {
2346
+ className: "tcre-insight-text"
2347
+ }, proposed && /* @__PURE__ */ React.createElement("span", {
2348
+ className: "tcre-chip"
2349
+ }, words.proposedRules), rule.by === "user" && /* @__PURE__ */ React.createElement("span", {
2350
+ className: "tcre-chip"
2351
+ }, words.ruleMine), series && /* @__PURE__ */ React.createElement(SeriesTag, {
2352
+ series,
2353
+ words
2354
+ }), rule.text), /* @__PURE__ */ React.createElement("span", {
2355
+ className: "tcre-rule-actions"
2356
+ }, children));
2357
+ }
2358
+ function Phases({ context }) {
2359
+ const { pi, store } = context;
2360
+ const state = useStore(store);
2361
+ const words = useWords(pi);
2362
+ const every = state.settings.phaseWeeks;
2363
+ const day = (at) => new Date(at).toLocaleDateString(pi.ui.language, { month: "numeric", day: "numeric" });
2364
+ return /* @__PURE__ */ React.createElement("div", {
2365
+ className: "tcre-card tcre-panel tcre-wide"
2366
+ }, /* @__PURE__ */ React.createElement("div", {
2367
+ className: "tcre-panel-title"
2368
+ }, words.phases, /* @__PURE__ */ React.createElement("span", {
2369
+ className: "tcre-grow"
2370
+ }), /* @__PURE__ */ React.createElement(BusyButton, {
2371
+ pi,
2372
+ className: "tcre-secondary tcre-small",
2373
+ onClick: () => talk(pi, words.phaseNow, words.phasePrompt)
2374
+ }, words.phaseNow)), /* @__PURE__ */ React.createElement("div", {
2375
+ className: "tcre-phase-every"
2376
+ }, /* @__PURE__ */ React.createElement("div", {
2377
+ className: "ta-segmented tcre-seg"
2378
+ }, PHASE_WEEKS.map((n) => /* @__PURE__ */ React.createElement(BusyButton, {
2379
+ key: n,
2380
+ pi,
2381
+ pressed: every === n,
2382
+ className: every === n ? "ta-on" : "",
2383
+ onClick: () => store.call("setSettings", { phaseWeeks: n })
2384
+ }, n ? format(words.phaseEvery, { n }) : words.phaseOff)))), state.phases.length ? state.phases.slice(0, 6).map((one) => /* @__PURE__ */ React.createElement("div", {
2385
+ key: one.at,
2386
+ className: "tcre-phase"
2387
+ }, /* @__PURE__ */ React.createElement("span", {
2388
+ className: "tcre-phase-when"
2389
+ }, day(one.from), " – ", day(one.to)), /* @__PURE__ */ React.createElement("span", {
2390
+ className: "tcre-phase-text"
2391
+ }, one.summary), one.topic && /* @__PURE__ */ React.createElement("span", {
2392
+ className: "tcre-chip"
2393
+ }, words.ledTo))) : /* @__PURE__ */ React.createElement("div", {
2394
+ className: "tcre-muted tcre-pad"
2395
+ }, words.noPhases));
2396
+ }
2397
+
1364
2398
  // web-src/numbers.tsx
1365
2399
  function GroupBars({
1366
2400
  context,
@@ -1371,27 +2405,29 @@ function GroupBars({
1371
2405
  const { pi } = context;
1372
2406
  const words = useWords(pi);
1373
2407
  const most = Math.max(1, ...groups.map((one) => one.group.average));
2408
+ const measured = groups.some((one) => one.group.measured);
1374
2409
  return /* @__PURE__ */ React.createElement("div", {
1375
2410
  className: wide ? "tcre-card tcre-panel tcre-wide" : "tcre-card tcre-panel"
1376
2411
  }, /* @__PURE__ */ React.createElement("div", {
1377
2412
  className: "tcre-panel-title"
1378
2413
  }, label, /* @__PURE__ */ React.createElement("span", {
1379
2414
  className: "tcre-muted"
1380
- }, words.perPiece)), groups.map(({ group, name, color }) => /* @__PURE__ */ React.createElement("div", {
2415
+ }, measured ? words.perPiece : words.noViews)), groups.map(({ group, name, color }) => /* @__PURE__ */ React.createElement("div", {
1381
2416
  key: group.key || name,
1382
- className: "tcre-bar"
2417
+ className: "tcre-bar",
2418
+ "data-plain": !measured || undefined
1383
2419
  }, /* @__PURE__ */ React.createElement("span", {
1384
2420
  className: "tcre-bar-label",
1385
2421
  title: name
1386
2422
  }, color && /* @__PURE__ */ React.createElement("i", {
1387
2423
  style: { background: color }
1388
- }), name), /* @__PURE__ */ React.createElement("span", {
2424
+ }), name), measured && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
1389
2425
  className: "tcre-bar-track"
1390
2426
  }, group.average > 0 && /* @__PURE__ */ React.createElement("i", {
1391
2427
  style: { width: `${group.average / most * 100}%`, background: color }
1392
2428
  })), /* @__PURE__ */ React.createElement("span", {
1393
2429
  className: "tcre-bar-value"
1394
- }, group.measured ? short(group.average, pi.ui.language) : "—"), /* @__PURE__ */ React.createElement("span", {
2430
+ }, group.measured ? short(group.average, pi.ui.language) : "—")), /* @__PURE__ */ React.createElement("span", {
1395
2431
  className: "tcre-bar-note"
1396
2432
  }, group.count ? format(words.pieces, { n: group.count }) : words.noneYet, group.completion !== undefined ? ` · ${format(words.completion, { n: Math.round(group.completion * 100) })}` : ""))));
1397
2433
  }
@@ -1432,12 +2468,9 @@ function Numbers({ context }) {
1432
2468
  const before = weeks[weeks.length - 2];
1433
2469
  const sum = (week, key) => (week?.platforms ?? []).reduce((all, one) => all + (one[key] ?? 0), 0);
1434
2470
  const delta = (a, b) => b > 0 ? `${a >= b ? "+" : ""}${Math.round((a - b) / b * 100)}%` : "";
1435
- const analysis = CreatorUtil.analysis(state.items, state.settings);
2471
+ const analysis = ChannelUtil.analysis(state.items, state.settings);
1436
2472
  const progress = CreatorUtil.progress(state.items, state.settings.goal, now);
1437
2473
  const goal = state.settings.goal;
1438
- const insights = CreatorUtil.latestInsights(state.insights);
1439
- const { TrendingUp, TrendingDown, Lightbulb } = pi.ui.icons;
1440
- const tones = { good: TrendingUp, bad: TrendingDown, idea: Lightbulb };
1441
2474
  const stats = [
1442
2475
  [words.publishedCount, String(analysis.published)],
1443
2476
  [words.totalViews, analysis.measured ? short(analysis.views, pi.ui.language) : "—"],
@@ -1459,36 +2492,9 @@ function Numbers({ context }) {
1459
2492
  "data-none": value === "—" || undefined
1460
2493
  }, /* @__PURE__ */ React.createElement("b", null, value, change && /* @__PURE__ */ React.createElement("em", {
1461
2494
  "data-down": change.startsWith("-") || undefined
1462
- }, change)), /* @__PURE__ */ React.createElement("span", null, label)))), /* @__PURE__ */ React.createElement("div", {
1463
- className: "tcre-card tcre-panel tcre-insights"
1464
- }, /* @__PURE__ */ React.createElement("div", {
1465
- className: "tcre-panel-title"
1466
- }, words.insights, /* @__PURE__ */ React.createElement("span", {
1467
- className: "tcre-muted"
1468
- }, words.insightsHint), /* @__PURE__ */ React.createElement("span", {
1469
- className: "tcre-grow"
1470
- }), /* @__PURE__ */ React.createElement(BusyButton, {
1471
- pi,
1472
- className: "tcre-secondary tcre-small",
1473
- onClick: () => talk(pi, words.reviewNow, words.reviewPrompt)
1474
- }, words.reviewNow)), insights.length ? insights.map((one) => {
1475
- const Icon = tones[one.tone];
1476
- const series = seriesOf(context, one.series);
1477
- return /* @__PURE__ */ React.createElement("div", {
1478
- key: one.at + one.text,
1479
- className: "tcre-insight",
1480
- "data-tone": one.tone
1481
- }, /* @__PURE__ */ React.createElement("span", {
1482
- className: "tcre-insight-icon"
1483
- }, Icon && /* @__PURE__ */ React.createElement(Icon, {
1484
- size: 14
1485
- })), /* @__PURE__ */ React.createElement("span", null, series && /* @__PURE__ */ React.createElement(SeriesTag, {
1486
- series,
1487
- words
1488
- }), one.text));
1489
- }) : /* @__PURE__ */ React.createElement("div", {
1490
- className: "tcre-muted tcre-pad"
1491
- }, words.noInsights)), seriesGroups.length > 0 && /* @__PURE__ */ React.createElement(GroupBars, {
2495
+ }, change)), /* @__PURE__ */ React.createElement("span", null, label)))), /* @__PURE__ */ React.createElement(Strategy, {
2496
+ context
2497
+ }), seriesGroups.length > 0 && /* @__PURE__ */ React.createElement(GroupBars, {
1492
2498
  context,
1493
2499
  label: words.bySeries,
1494
2500
  groups: seriesGroups,
@@ -1524,7 +2530,9 @@ function Numbers({ context }) {
1524
2530
  words
1525
2531
  }), /* @__PURE__ */ React.createElement("span", {
1526
2532
  className: "tcre-bar-value"
1527
- }, short(views, pi.ui.language))))), goal && progress && /* @__PURE__ */ React.createElement("div", {
2533
+ }, short(views, pi.ui.language))))), /* @__PURE__ */ React.createElement(Phases, {
2534
+ context
2535
+ }), goal && progress && /* @__PURE__ */ React.createElement("div", {
1528
2536
  className: "tcre-card tcre-panel tcre-goal"
1529
2537
  }, /* @__PURE__ */ React.createElement("div", {
1530
2538
  className: "tcre-panel-title"
@@ -1558,11 +2566,20 @@ function Setup({ context, done }) {
1558
2566
  const [niche, setNiche] = React.useState(state.settings.niche);
1559
2567
  const [picked, setPicked] = React.useState(state.settings.picked);
1560
2568
  const [series, setSeries] = React.useState(state.settings.series);
2569
+ const [platforms, setPlatforms] = React.useState(state.settings.platforms);
2570
+ const [inside, setInside] = React.useState({ name: "", url: "" });
2571
+ const [tone, setTone] = React.useState(state.settings.tone);
2572
+ const [ownTone, setOwnTone] = React.useState("");
2573
+ const tones = [...Object.keys(TONES), ...tone.filter((one) => !(one in TONES))];
2574
+ const toneName = (one) => (one in TONES) ? words[`tone_${one}`] : one;
2575
+ const toggleTone = (one) => setTone(tone.includes(one) ? tone.filter((it) => it !== one) : [...tone, one].slice(-3));
1561
2576
  const { Trash2, Plus } = pi.ui.icons;
1562
2577
  const first = !state.settings.picked.length;
1563
2578
  const save = (goal) => store.call("setSettings", {
1564
2579
  niche: niche.trim(),
2580
+ tone,
1565
2581
  picked,
2582
+ platforms,
1566
2583
  series: series.map((one) => ({ ...one, name: one.name.trim(), about: one.about?.trim() })).filter((one) => one.name),
1567
2584
  ...goal ? { goal: { from: Date.now(), days: 30, videos: 8, posts: 12 } } : {}
1568
2585
  }).then(done);
@@ -1580,6 +2597,37 @@ function Setup({ context, done }) {
1580
2597
  onChange: (event) => setNiche(event.target.value)
1581
2598
  }), /* @__PURE__ */ React.createElement("div", {
1582
2599
  className: "tcre-setup-label"
2600
+ }, words.toneLabel, /* @__PURE__ */ React.createElement("span", null, words.toneHint)), /* @__PURE__ */ React.createElement("div", {
2601
+ className: "tcre-pick"
2602
+ }, tones.map((one) => /* @__PURE__ */ React.createElement("button", {
2603
+ key: one,
2604
+ type: "button",
2605
+ "aria-pressed": tone.includes(one),
2606
+ onClick: () => toggleTone(one)
2607
+ }, toneName(one)))), /* @__PURE__ */ React.createElement("div", {
2608
+ className: "tcre-inside-add"
2609
+ }, /* @__PURE__ */ React.createElement("input", {
2610
+ className: "tcre-field",
2611
+ value: ownTone,
2612
+ maxLength: 20,
2613
+ placeholder: words.toneOwn,
2614
+ onChange: (event) => setOwnTone(event.target.value),
2615
+ onKeyDown: (event) => {
2616
+ if (event.key === "Enter" && ownTone.trim()) {
2617
+ toggleTone(ownTone.trim());
2618
+ setOwnTone("");
2619
+ }
2620
+ }
2621
+ }), /* @__PURE__ */ React.createElement("button", {
2622
+ type: "button",
2623
+ className: "tcre-secondary tcre-small",
2624
+ disabled: !ownTone.trim() || tone.includes(ownTone.trim()),
2625
+ onClick: () => {
2626
+ toggleTone(ownTone.trim());
2627
+ setOwnTone("");
2628
+ }
2629
+ }, words.toneAdd)), /* @__PURE__ */ React.createElement("div", {
2630
+ className: "tcre-setup-label"
1583
2631
  }, words.seriesLabel, /* @__PURE__ */ React.createElement("span", null, words.seriesHint)), /* @__PURE__ */ React.createElement("div", {
1584
2632
  className: "tcre-card tcre-series-edit"
1585
2633
  }, series.map((one, at) => /* @__PURE__ */ React.createElement("div", {
@@ -1598,12 +2646,29 @@ function Setup({ context, done }) {
1598
2646
  value: one.about ?? "",
1599
2647
  placeholder: words.seriesAbout,
1600
2648
  onChange: (event) => set(at, { about: event.target.value })
1601
- })), /* @__PURE__ */ React.createElement("button", {
2649
+ })), /* @__PURE__ */ React.createElement("select", {
2650
+ className: "tcre-toggle tcre-tone-pick",
2651
+ "aria-label": words.seriesTone,
2652
+ title: words.seriesTone,
2653
+ "data-on": one.tone ? "true" : undefined,
2654
+ value: one.tone ?? "",
2655
+ onChange: (event) => set(at, { tone: event.target.value || undefined })
2656
+ }, /* @__PURE__ */ React.createElement("option", {
2657
+ value: ""
2658
+ }, words.seriesToneSame), [...tones, ...one.tone && !tones.includes(one.tone) ? [one.tone] : []].map((it) => /* @__PURE__ */ React.createElement("option", {
2659
+ key: it,
2660
+ value: it
2661
+ }, toneName(it)))), /* @__PURE__ */ React.createElement("button", {
1602
2662
  type: "button",
1603
2663
  className: "tcre-toggle",
1604
2664
  "aria-pressed": !!one.ordered,
1605
2665
  onClick: () => set(at, { ordered: !one.ordered })
1606
2666
  }, words.seriesOrdered), /* @__PURE__ */ React.createElement("button", {
2667
+ type: "button",
2668
+ className: "tcre-toggle",
2669
+ "aria-pressed": one.reach === "internal",
2670
+ onClick: () => set(at, { reach: one.reach === "internal" ? undefined : "internal" })
2671
+ }, words.seriesInside), /* @__PURE__ */ React.createElement("button", {
1607
2672
  type: "button",
1608
2673
  className: "tcre-icon",
1609
2674
  "aria-label": words.remove,
@@ -1621,7 +2686,7 @@ function Setup({ context, done }) {
1621
2686
  className: "tcre-setup-label"
1622
2687
  }, words.platformsLabel), /* @__PURE__ */ React.createElement("div", {
1623
2688
  className: "tcre-pick"
1624
- }, state.settings.platforms.map((platform) => {
2689
+ }, platforms.filter((platform) => !platform.internal).map((platform) => {
1625
2690
  const on = picked.includes(platform.id);
1626
2691
  return /* @__PURE__ */ React.createElement("button", {
1627
2692
  key: platform.id,
@@ -1632,6 +2697,58 @@ function Setup({ context, done }) {
1632
2697
  platform
1633
2698
  }));
1634
2699
  })), /* @__PURE__ */ React.createElement("div", {
2700
+ className: "tcre-setup-label"
2701
+ }, words.insideLabel, /* @__PURE__ */ React.createElement("span", null, words.insideHint)), /* @__PURE__ */ React.createElement("div", {
2702
+ className: "tcre-pick"
2703
+ }, platforms.filter((platform) => platform.internal).map((platform) => {
2704
+ const on = picked.includes(platform.id);
2705
+ return /* @__PURE__ */ React.createElement("span", {
2706
+ key: platform.id,
2707
+ className: "tcre-inside"
2708
+ }, /* @__PURE__ */ React.createElement("button", {
2709
+ type: "button",
2710
+ "aria-pressed": on,
2711
+ onClick: () => setPicked(on ? picked.filter((id) => id !== platform.id) : [...picked, platform.id])
2712
+ }, /* @__PURE__ */ React.createElement(PlatformName, {
2713
+ platform
2714
+ })), /* @__PURE__ */ React.createElement("button", {
2715
+ type: "button",
2716
+ className: "tcre-icon",
2717
+ "aria-label": words.remove,
2718
+ title: words.remove,
2719
+ onClick: () => {
2720
+ setPlatforms(platforms.filter((one) => one.id !== platform.id));
2721
+ setPicked(picked.filter((id) => id !== platform.id));
2722
+ }
2723
+ }, /* @__PURE__ */ React.createElement(Trash2, {
2724
+ size: 14
2725
+ })));
2726
+ })), /* @__PURE__ */ React.createElement("div", {
2727
+ className: "tcre-inside-add"
2728
+ }, /* @__PURE__ */ React.createElement("input", {
2729
+ className: "tcre-field tcre-field-name",
2730
+ value: inside.name,
2731
+ placeholder: words.insideName,
2732
+ onChange: (event) => setInside({ ...inside, name: event.target.value })
2733
+ }), /* @__PURE__ */ React.createElement("input", {
2734
+ className: "tcre-field",
2735
+ value: inside.url,
2736
+ placeholder: words.insideUrl,
2737
+ onChange: (event) => setInside({ ...inside, url: event.target.value })
2738
+ }), /* @__PURE__ */ React.createElement("button", {
2739
+ type: "button",
2740
+ className: "tcre-secondary tcre-small",
2741
+ disabled: !inside.name.trim() || !/^https?:\/\/\S+$/i.test(inside.url.trim()),
2742
+ onClick: () => {
2743
+ const id = `in-${Date.now().toString(36)}`;
2744
+ setPlatforms([
2745
+ ...platforms,
2746
+ { id, name: inside.name.trim(), color: "#0052d9", article: {}, internal: true, publish: inside.url.trim() }
2747
+ ]);
2748
+ setPicked([...picked, id]);
2749
+ setInside({ name: "", url: "" });
2750
+ }
2751
+ }, words.addInside)), /* @__PURE__ */ React.createElement("div", {
1635
2752
  className: "tcre-buttons"
1636
2753
  }, !first && /* @__PURE__ */ React.createElement("button", {
1637
2754
  type: "button",
@@ -1652,9 +2769,233 @@ function Setup({ context, done }) {
1652
2769
  }, first ? words.start : words.save)));
1653
2770
  }
1654
2771
 
2772
+ // web-src/talk.tsx
2773
+ var DAY3 = 86400000;
2774
+ var LEVELS = ["act", "ask", "off"];
2775
+ var LEVEL_WORDS = { act: "levelAct", ask: "levelAsk", off: "levelOff" };
2776
+ var HOUR2 = 3600000;
2777
+ var PACE_HOURS = [0, 2, 6, 24];
2778
+ var PACE_DAYS = [7, 14, 30];
2779
+ function drafts(comments) {
2780
+ return comments.filter((one) => one.reply?.state === "draft").sort((a, b) => b.at - a.at);
2781
+ }
2782
+ function Talk({ context }) {
2783
+ const { pi, store } = context;
2784
+ const state = useStore(store);
2785
+ const words = useWords(pi);
2786
+ const now = Date.now();
2787
+ const waiting = drafts(state.comments);
2788
+ 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);
2789
+ 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);
2790
+ return /* @__PURE__ */ React.createElement("div", {
2791
+ className: "tcre-talk"
2792
+ }, !state.comments.length && /* @__PURE__ */ React.createElement("div", {
2793
+ className: "tcre-empty"
2794
+ }, /* @__PURE__ */ React.createElement(pi.ui.Empty, {
2795
+ compact: true,
2796
+ title: words.noComments,
2797
+ hint: words.commentsHint
2798
+ })), waiting.length > 0 && /* @__PURE__ */ React.createElement("section", {
2799
+ className: "tcre-section"
2800
+ }, /* @__PURE__ */ React.createElement("div", {
2801
+ className: "tcre-h"
2802
+ }, /* @__PURE__ */ React.createElement("span", null, words.drafts)), /* @__PURE__ */ React.createElement("div", {
2803
+ className: "tcre-list"
2804
+ }, waiting.map((one) => /* @__PURE__ */ React.createElement(Draft, {
2805
+ key: one.id,
2806
+ context,
2807
+ comment: one
2808
+ })))), /* @__PURE__ */ React.createElement(Levels, {
2809
+ context
2810
+ }), /* @__PURE__ */ React.createElement(Pace, {
2811
+ context
2812
+ }), asked.length > 0 && /* @__PURE__ */ React.createElement("div", {
2813
+ className: "tcre-card tcre-panel"
2814
+ }, /* @__PURE__ */ React.createElement("div", {
2815
+ className: "tcre-panel-title"
2816
+ }, words.asked), asked.map((one) => /* @__PURE__ */ React.createElement("div", {
2817
+ key: one.id,
2818
+ className: "tcre-asked"
2819
+ }, /* @__PURE__ */ React.createElement("span", {
2820
+ className: "tcre-class",
2821
+ "data-class": one.class
2822
+ }, words[one.class]), /* @__PURE__ */ React.createElement("span", {
2823
+ className: "tcre-asked-text"
2824
+ }, one.text), one.topic ? /* @__PURE__ */ React.createElement("span", {
2825
+ className: "tcre-chip"
2826
+ }, words.ledTo) : one.likes ? /* @__PURE__ */ React.createElement("span", {
2827
+ className: "tcre-muted"
2828
+ }, "♥ ", one.likes) : null))), recent.length > 0 && /* @__PURE__ */ React.createElement("div", {
2829
+ className: "tcre-card tcre-panel"
2830
+ }, /* @__PURE__ */ React.createElement("div", {
2831
+ className: "tcre-panel-title"
2832
+ }, words.autoSent), recent.map((one) => /* @__PURE__ */ React.createElement(Answered, {
2833
+ key: one.id,
2834
+ context,
2835
+ comment: one
2836
+ }))));
2837
+ }
2838
+ function Meta({ context, comment }) {
2839
+ const state = useStore(context.store);
2840
+ const words = useWords(context.pi);
2841
+ const piece = state.items.find((one) => one.id === comment.item);
2842
+ return /* @__PURE__ */ React.createElement("div", {
2843
+ className: "tcre-comment-meta"
2844
+ }, /* @__PURE__ */ React.createElement("span", {
2845
+ className: "tcre-class",
2846
+ "data-class": comment.class
2847
+ }, words[comment.class]), /* @__PURE__ */ React.createElement(PlatformName, {
2848
+ platform: platformOf(context, comment.platform)
2849
+ }), piece && /* @__PURE__ */ React.createElement("span", {
2850
+ className: "tcre-comment-piece"
2851
+ }, piece.title));
2852
+ }
2853
+ function Draft({ context, comment }) {
2854
+ const { pi, store } = context;
2855
+ const words = useWords(pi);
2856
+ const [text3, setText] = React.useState(comment.reply?.text ?? "");
2857
+ return /* @__PURE__ */ React.createElement("div", {
2858
+ className: "tcre-card tcre-comment"
2859
+ }, /* @__PURE__ */ React.createElement(Meta, {
2860
+ context,
2861
+ comment
2862
+ }), /* @__PURE__ */ React.createElement("div", {
2863
+ className: "tcre-comment-text"
2864
+ }, comment.text), /* @__PURE__ */ React.createElement("textarea", {
2865
+ className: "tcre-input tcre-reply-input",
2866
+ rows: 2,
2867
+ value: text3,
2868
+ onChange: (event) => setText(event.target.value)
2869
+ }), /* @__PURE__ */ React.createElement("div", {
2870
+ className: "tcre-buttons"
2871
+ }, /* @__PURE__ */ React.createElement("span", {
2872
+ className: "tcre-grow"
2873
+ }), /* @__PURE__ */ React.createElement(BusyButton, {
2874
+ pi,
2875
+ className: "tcre-text",
2876
+ onClick: () => store.call("reply", comment.id, "drop")
2877
+ }, words.dropReply), /* @__PURE__ */ React.createElement(BusyButton, {
2878
+ pi,
2879
+ className: "tcre-primary tcre-small",
2880
+ disabled: !text3.trim(),
2881
+ onClick: () => store.call("reply", comment.id, "send", text3)
2882
+ }, words.send)));
2883
+ }
2884
+ function Answered({ context, comment }) {
2885
+ const { pi, store } = context;
2886
+ const words = useWords(pi);
2887
+ const reply = comment.reply;
2888
+ if (!reply) {
2889
+ return null;
2890
+ }
2891
+ const where = { approved: words.sending, sent: words.sent, withdrawn: words.withdrawn, removed: words.withdrawn, draft: "", dropped: "" }[reply.state];
2892
+ return /* @__PURE__ */ React.createElement("div", {
2893
+ className: "tcre-answered"
2894
+ }, /* @__PURE__ */ React.createElement(Meta, {
2895
+ context,
2896
+ comment
2897
+ }), /* @__PURE__ */ React.createElement("div", {
2898
+ className: "tcre-comment-text"
2899
+ }, comment.text), /* @__PURE__ */ React.createElement("div", {
2900
+ className: "tcre-answer"
2901
+ }, /* @__PURE__ */ React.createElement("span", null, reply.text), /* @__PURE__ */ React.createElement("span", {
2902
+ className: "tcre-grow"
2903
+ }), /* @__PURE__ */ React.createElement("span", {
2904
+ className: "tcre-muted"
2905
+ }, reply.auto ? `${words.autoTag} · ` : "", where), reply.state === "sent" && /* @__PURE__ */ React.createElement(BusyButton, {
2906
+ pi,
2907
+ className: "tcre-text",
2908
+ onClick: () => store.call("reply", comment.id, "withdraw")
2909
+ }, words.withdraw)));
2910
+ }
2911
+ function Pace({ context }) {
2912
+ const { pi, store } = context;
2913
+ const state = useStore(store);
2914
+ const words = useWords(pi);
2915
+ const { commentsEvery: every, commentsDays: days } = state.settings;
2916
+ const latest = state.items.filter((one) => one.stage === "published" && one.commentsGap).sort((a, b) => (b.commentsAt ?? 0) - (a.commentsAt ?? 0))[0];
2917
+ const now = latest?.commentsGap ? Math.max(1, Math.round(latest.commentsGap / HOUR2)) : undefined;
2918
+ const choice = (values, value, label, set) => /* @__PURE__ */ React.createElement("div", {
2919
+ className: "ta-segmented tcre-seg"
2920
+ }, values.map((n) => /* @__PURE__ */ React.createElement(BusyButton, {
2921
+ key: n,
2922
+ pi,
2923
+ pressed: value === n,
2924
+ className: value === n ? "ta-on" : "",
2925
+ onClick: () => store.call("setSettings", set(n))
2926
+ }, label(n))));
2927
+ return /* @__PURE__ */ React.createElement("div", {
2928
+ className: "tcre-card tcre-panel"
2929
+ }, /* @__PURE__ */ React.createElement("div", {
2930
+ className: "tcre-panel-title"
2931
+ }, words.commentsPace), /* @__PURE__ */ React.createElement("div", {
2932
+ className: "tcre-level-row"
2933
+ }, /* @__PURE__ */ React.createElement("span", null, words.paceHow), /* @__PURE__ */ React.createElement("span", {
2934
+ className: "tcre-grow"
2935
+ }), choice(PACE_HOURS, every, (n) => !n ? words.paceAuto : n === 24 ? words.paceDaily : format(words.paceHours, { n }), (n) => ({ commentsEvery: n }))), /* @__PURE__ */ React.createElement("div", {
2936
+ className: "tcre-level-row"
2937
+ }, /* @__PURE__ */ React.createElement("span", null, words.paceFor), /* @__PURE__ */ React.createElement("span", {
2938
+ className: "tcre-grow"
2939
+ }), choice(PACE_DAYS, days, (n) => format(words.paceDays, { n }), (n) => ({ commentsDays: n }))), /* @__PURE__ */ React.createElement("div", {
2940
+ className: "tcre-muted tcre-level-note"
2941
+ }, every ? words.paceFixedNote : now ? `${format(words.paceNow, { n: now })} · ${words.paceAutoNote}` : words.paceAutoNote));
2942
+ }
2943
+ function Levels({ context }) {
2944
+ const { pi, store } = context;
2945
+ const words = useWords(pi);
2946
+ const [levels, setLevels] = React.useState();
2947
+ React.useEffect(() => {
2948
+ let live = true;
2949
+ store.call("replyLevels").then((got) => live && setLevels(got), () => {
2950
+ return;
2951
+ });
2952
+ return () => {
2953
+ live = false;
2954
+ };
2955
+ }, [store]);
2956
+ if (!levels) {
2957
+ return null;
2958
+ }
2959
+ const set = (cls, level) => store.call("setReplyLevel", cls, level).then(setLevels);
2960
+ return /* @__PURE__ */ React.createElement("div", {
2961
+ className: "tcre-card tcre-panel"
2962
+ }, /* @__PURE__ */ React.createElement("div", {
2963
+ className: "tcre-panel-title"
2964
+ }, words.replyLevels), levels.map((one) => /* @__PURE__ */ React.createElement("div", {
2965
+ key: one.class,
2966
+ className: "tcre-level-row"
2967
+ }, /* @__PURE__ */ React.createElement("span", {
2968
+ className: "tcre-class",
2969
+ "data-class": one.class
2970
+ }, words[one.class]), /* @__PURE__ */ React.createElement("span", {
2971
+ className: "tcre-grow"
2972
+ }), one.locked && /* @__PURE__ */ React.createElement(BusyButton, {
2973
+ pi,
2974
+ className: "tcre-text tcre-small",
2975
+ onClick: () => set(one.class, null)
2976
+ }, words.levelAuto), /* @__PURE__ */ React.createElement("div", {
2977
+ className: "ta-segmented tcre-seg"
2978
+ }, LEVELS.map((level) => /* @__PURE__ */ React.createElement(BusyButton, {
2979
+ key: level,
2980
+ pi,
2981
+ pressed: one.level === level,
2982
+ className: one.level === level ? "ta-on" : "",
2983
+ onClick: () => set(one.class, level)
2984
+ }, words[LEVEL_WORDS[level]]))))), /* @__PURE__ */ React.createElement("div", {
2985
+ className: "tcre-muted tcre-level-note"
2986
+ }, words.levelLearn));
2987
+ }
2988
+
1655
2989
  // web-src/page.tsx
1656
- var COLUMNS = ["topic", "making", "review", "published", "data"];
1657
- var COLUMN_ICONS = { topic: "Lightbulb", making: "Film", review: "Eye", published: "Send", data: "ChartColumn" };
2990
+ var COLUMNS = ["topic", "making", "review", "published", "talk", "data"];
2991
+ var COLUMN_ICONS = {
2992
+ topic: "Lightbulb",
2993
+ making: "Film",
2994
+ review: "Eye",
2995
+ published: "Send",
2996
+ talk: "MessageCircle",
2997
+ data: "ChartColumn"
2998
+ };
1658
2999
  var FIRST = 6;
1659
3000
  function CreatorHead({ context }) {
1660
3001
  const state = useStore(context.store);
@@ -1689,11 +3030,11 @@ function CreatorPage({ context }) {
1689
3030
  }
1690
3031
  const now = Date.now();
1691
3032
  const all = CreatorUtil.columns(state.items, now);
1692
- const waiting = all.review.filter((one) => !one.approved).length;
1693
- const shown = column ?? (waiting ? "review" : "topic");
3033
+ const shown = column ?? (all.review.length ? "review" : "topic");
1694
3034
  const known = state.settings.series.some((one) => one.id === series);
1695
3035
  const of = (items) => known ? items.filter((one) => one.series === series) : items;
1696
- const columns = { topic: of(all.topic), making: of(all.making), review: of(all.review), published: of(all.published) };
3036
+ const columns = { topic: of(all.topic), making: of([...all.materials, ...all.making]), review: of(all.review), published: of(all.published) };
3037
+ const publishing = of(all.publishing);
1697
3038
  const body = () => {
1698
3039
  switch (shown) {
1699
3040
  case "topic":
@@ -1710,13 +3051,18 @@ function CreatorPage({ context }) {
1710
3051
  case "review":
1711
3052
  return /* @__PURE__ */ React.createElement(Reviews, {
1712
3053
  context,
1713
- items: columns.review
3054
+ items: columns.review,
3055
+ publishing
1714
3056
  });
1715
3057
  case "published":
1716
3058
  return /* @__PURE__ */ React.createElement(Published, {
1717
3059
  context,
1718
3060
  items: columns.published
1719
3061
  });
3062
+ case "talk":
3063
+ return /* @__PURE__ */ React.createElement(Talk, {
3064
+ context
3065
+ });
1720
3066
  case "data":
1721
3067
  return /* @__PURE__ */ React.createElement(Numbers, {
1722
3068
  context
@@ -1744,11 +3090,12 @@ function CreatorPage({ context }) {
1744
3090
  }, words.settings)), /* @__PURE__ */ React.createElement(Flow, {
1745
3091
  context,
1746
3092
  columns,
3093
+ publishing: publishing.length,
1747
3094
  shown,
1748
3095
  pick: setColumn
1749
- }), shown !== "data" && /* @__PURE__ */ React.createElement(SeriesBar, {
3096
+ }), shown !== "data" && shown !== "talk" && /* @__PURE__ */ React.createElement(SeriesBar, {
1750
3097
  context,
1751
- counts: all[shown],
3098
+ counts: shown === "making" ? [...all.materials, ...all.making] : all[shown],
1752
3099
  picked: known ? series : "",
1753
3100
  pick: setSeries,
1754
3101
  add: () => setEditing(true)
@@ -1760,6 +3107,7 @@ function CreatorPage({ context }) {
1760
3107
  function Flow({
1761
3108
  context,
1762
3109
  columns,
3110
+ publishing,
1763
3111
  shown,
1764
3112
  pick
1765
3113
  }) {
@@ -1767,18 +3115,22 @@ function Flow({
1767
3115
  const state = useStore(context.store);
1768
3116
  const words = useWords(pi);
1769
3117
  const now = Date.now();
1770
- const waiting = columns.review.filter((one) => !one.approved).length;
3118
+ const waiting = columns.review.length;
1771
3119
  const thisWeek = columns.published.filter((one) => CreatorUtil.publishedAt(one) >= new Date(`${CreatorUtil.weekOf(now)}T00:00:00`).getTime()).length;
1772
- const step = columns.making[0] && stepOf(columns.making[0]);
3120
+ const materials = columns.making.filter((one) => one.stage === "materials").length;
3121
+ const making = columns.making.filter((one) => one.stage === "making");
3122
+ const step = making[0] && stepOf(making[0]);
3123
+ const answers = drafts(state.comments).length;
1773
3124
  const last = state.weeks.filter((one) => one.week < CreatorUtil.weekOf(now) && one.platforms.length).pop();
1774
3125
  const hint = {
1775
3126
  topic: state.settings.series.length ? format(words.flowSeries, { n: state.settings.series.length }) : words.findNow,
1776
- making: step ? `${words[step]} · ${columns.making[0].title}` : columns.making.length ? words.doneAll : words.flowNone,
1777
- review: waiting ? format(words.flowWaiting, { n: waiting }) : columns.review.length ? words.flowPassed : words.flowNone,
3127
+ making: materials ? format(words.flowMaterials, { n: materials }) : step ? `${words[step]} · ${making[0].title}` : making.length ? words.doneAll : words.flowNone,
3128
+ review: waiting ? format(words.flowWaiting, { n: waiting }) : publishing ? format(words.flowPublishing, { n: publishing }) : words.flowNone,
1778
3129
  published: format(words.flowWeek, { n: thisWeek }),
3130
+ talk: answers ? format(words.flowDrafts, { n: answers }) : format(words.flowComments, { n: state.comments.length }),
1779
3131
  data: last ? `${words.lastWeek} ${short(last.platforms.reduce((all, one) => all + one.views, 0), pi.ui.language)}` : words.flowMonday
1780
3132
  };
1781
- const count = (one) => one === "data" ? undefined : columns[one].length;
3133
+ const count2 = (one) => one === "data" ? undefined : one === "talk" ? answers || undefined : columns[one].length;
1782
3134
  const { ChevronRight } = pi.ui.icons;
1783
3135
  return /* @__PURE__ */ React.createElement("div", {
1784
3136
  className: "tcre-flow",
@@ -1789,8 +3141,8 @@ function Flow({
1789
3141
  key: one
1790
3142
  }, at > 0 && /* @__PURE__ */ React.createElement("span", {
1791
3143
  className: "tcre-flow-arrow",
1792
- "data-gap": one === "data" || undefined
1793
- }, one !== "data" && /* @__PURE__ */ React.createElement(ChevronRight, {
3144
+ "data-gap": one === "talk" || undefined
3145
+ }, one !== "talk" && one !== "data" && /* @__PURE__ */ React.createElement(ChevronRight, {
1794
3146
  size: 14
1795
3147
  })), /* @__PURE__ */ React.createElement("button", {
1796
3148
  type: "button",
@@ -1798,7 +3150,7 @@ function Flow({
1798
3150
  "aria-selected": one === shown,
1799
3151
  className: "tcre-flow-node",
1800
3152
  "data-stage": one,
1801
- "data-attn": one === "review" && waiting > 0 || undefined,
3153
+ "data-attn": one === "review" && waiting > 0 || one === "talk" && answers > 0 || undefined,
1802
3154
  onClick: () => pick(one)
1803
3155
  }, /* @__PURE__ */ React.createElement("span", {
1804
3156
  className: "tcre-flow-icon"
@@ -1808,7 +3160,7 @@ function Flow({
1808
3160
  className: "tcre-flow-text"
1809
3161
  }, /* @__PURE__ */ React.createElement("span", {
1810
3162
  className: "tcre-flow-name"
1811
- }, words[one], count(one) !== undefined && /* @__PURE__ */ React.createElement("b", null, count(one))), /* @__PURE__ */ React.createElement("span", {
3163
+ }, words[one], count2(one) !== undefined && /* @__PURE__ */ React.createElement("b", null, count2(one))), /* @__PURE__ */ React.createElement("span", {
1812
3164
  className: "tcre-flow-hint"
1813
3165
  }, hint[one]))));
1814
3166
  }));
@@ -1844,17 +3196,17 @@ function SeriesBar({ context, counts, picked, pick, add }) {
1844
3196
  size: 14
1845
3197
  })));
1846
3198
  }
1847
- function Empty({ pi, text: text2, hint, children }) {
3199
+ function Empty({ pi, text: text3, hint, children }) {
1848
3200
  return /* @__PURE__ */ React.createElement("div", {
1849
3201
  className: "tcre-empty"
1850
3202
  }, /* @__PURE__ */ React.createElement(pi.ui.Empty, {
1851
3203
  compact: true,
1852
- title: text2,
3204
+ title: text3,
1853
3205
  hint
1854
3206
  }, children));
1855
3207
  }
1856
3208
  function kindLabel(item, words) {
1857
- return [words[item.form], words[item.kind]].join(" · ");
3209
+ return [words[item.form], words[item.kind], ...item.reach && item.reach !== "public" ? [words[item.reach]] : []].join(" · ");
1858
3210
  }
1859
3211
  function Removed({ context, stage }) {
1860
3212
  const { pi, store } = context;
@@ -1981,15 +3333,77 @@ function Topic({ context, item }) {
1981
3333
  onClick: () => make(context, item)
1982
3334
  }, words.make)));
1983
3335
  }
3336
+ function Waiting({ context, item }) {
3337
+ const { pi, store } = context;
3338
+ const words = useWords(pi);
3339
+ const { Check, Circle } = pi.ui.icons;
3340
+ const skip = async () => {
3341
+ await store.call("skip", item.id);
3342
+ await tell(context, item, format(words.skipPrompt, { id: item.id }));
3343
+ };
3344
+ return /* @__PURE__ */ React.createElement("div", {
3345
+ className: "tcre-card tcre-making tcre-waiting"
3346
+ }, /* @__PURE__ */ React.createElement("div", {
3347
+ className: "tcre-making-head"
3348
+ }, /* @__PURE__ */ React.createElement("div", {
3349
+ className: "tcre-making-main"
3350
+ }, /* @__PURE__ */ React.createElement(SeriesTag, {
3351
+ series: seriesOf(context, item.series),
3352
+ number: item.number,
3353
+ words
3354
+ }), /* @__PURE__ */ React.createElement("span", {
3355
+ className: "tcre-making-title"
3356
+ }, item.title)), /* @__PURE__ */ React.createElement(IconButton, {
3357
+ pi,
3358
+ icon: "Trash2",
3359
+ label: words.remove,
3360
+ onClick: () => remove(context, item)
3361
+ })), /* @__PURE__ */ React.createElement("ul", {
3362
+ className: "tcre-needs"
3363
+ }, (item.needs ?? []).map((need) => /* @__PURE__ */ React.createElement("li", {
3364
+ key: need.id,
3365
+ "data-done": need.done || undefined
3366
+ }, need.done ? /* @__PURE__ */ React.createElement(Check, {
3367
+ size: 14
3368
+ }) : /* @__PURE__ */ React.createElement(Circle, {
3369
+ size: 14
3370
+ }), need.text))), /* @__PURE__ */ React.createElement("div", {
3371
+ className: "tcre-buttons"
3372
+ }, /* @__PURE__ */ React.createElement("span", {
3373
+ className: "tcre-muted tcre-needs-hint"
3374
+ }, words.needsHint), /* @__PURE__ */ React.createElement("span", {
3375
+ className: "tcre-grow"
3376
+ }), /* @__PURE__ */ React.createElement(BusyButton, {
3377
+ pi,
3378
+ className: "tcre-text",
3379
+ onClick: skip
3380
+ }, words.skipNeeds), /* @__PURE__ */ React.createElement(BusyButton, {
3381
+ pi,
3382
+ className: "tcre-primary tcre-small",
3383
+ onClick: () => openPiece(context, item)
3384
+ }, words.giveNow)));
3385
+ }
1984
3386
  function Making({ context, items }) {
1985
3387
  const { pi } = context;
1986
3388
  const words = useWords(pi);
3389
+ const waiting = items.filter((one) => one.stage === "materials");
3390
+ const making = items.filter((one) => one.stage === "making");
1987
3391
  return /* @__PURE__ */ React.createElement(React.Fragment, null, !items.length && /* @__PURE__ */ React.createElement(Empty, {
1988
3392
  pi,
1989
3393
  text: words.makingEmpty
1990
- }), /* @__PURE__ */ React.createElement("div", {
3394
+ }), waiting.length > 0 && /* @__PURE__ */ React.createElement("section", {
3395
+ className: "tcre-section"
3396
+ }, /* @__PURE__ */ React.createElement("div", {
3397
+ className: "tcre-h"
3398
+ }, /* @__PURE__ */ React.createElement("span", null, words.needsTitle)), /* @__PURE__ */ React.createElement("div", {
1991
3399
  className: "tcre-list"
1992
- }, items.map((item) => {
3400
+ }, waiting.map((item) => /* @__PURE__ */ React.createElement(Waiting, {
3401
+ key: item.id,
3402
+ context,
3403
+ item
3404
+ })))), /* @__PURE__ */ React.createElement("div", {
3405
+ className: "tcre-list"
3406
+ }, making.map((item) => {
1993
3407
  const series = seriesOf(context, item.series);
1994
3408
  return /* @__PURE__ */ React.createElement("div", {
1995
3409
  key: item.id,
@@ -2022,9 +3436,12 @@ function Making({ context, items }) {
2022
3436
  })), /* @__PURE__ */ React.createElement(Removed, {
2023
3437
  context,
2024
3438
  stage: "making"
3439
+ }), /* @__PURE__ */ React.createElement(Removed, {
3440
+ context,
3441
+ stage: "materials"
2025
3442
  }));
2026
3443
  }
2027
- function Reviews({ context, items }) {
3444
+ function Reviews({ context, items, publishing }) {
2028
3445
  const { pi } = context;
2029
3446
  const words = useWords(pi);
2030
3447
  return /* @__PURE__ */ React.createElement(React.Fragment, null, !items.length && /* @__PURE__ */ React.createElement(Empty, {
@@ -2037,7 +3454,21 @@ function Reviews({ context, items }) {
2037
3454
  context,
2038
3455
  item,
2039
3456
  onRemove: () => remove(context, item)
2040
- }))), /* @__PURE__ */ React.createElement(Removed, {
3457
+ }))), !!publishing.length && /* @__PURE__ */ React.createElement("div", {
3458
+ className: "tcre-section"
3459
+ }, /* @__PURE__ */ React.createElement("div", {
3460
+ className: "tcre-section-head"
3461
+ }, /* @__PURE__ */ React.createElement("i", null), /* @__PURE__ */ React.createElement("span", {
3462
+ className: "tcre-section-name"
3463
+ }, words.publishingHead), /* @__PURE__ */ React.createElement("span", {
3464
+ className: "tcre-section-about"
3465
+ }, words.publishingAbout)), /* @__PURE__ */ React.createElement("div", {
3466
+ className: "tcre-grid tcre-grid-wide"
3467
+ }, publishing.map((item) => /* @__PURE__ */ React.createElement(ReviewCard, {
3468
+ key: item.id,
3469
+ context,
3470
+ item
3471
+ })))), /* @__PURE__ */ React.createElement(Removed, {
2041
3472
  context,
2042
3473
  stage: "review"
2043
3474
  }));
@@ -2097,7 +3528,8 @@ var STYLE = `
2097
3528
  /* The page: the top (bar, stations, series), then the station picked with room to read. */
2098
3529
  .tcre-home { padding: 0 0 calc(32px + env(safe-area-inset-bottom)); }
2099
3530
  .tcre-top { padding: 10px 28px 0; }
2100
- .tcre-body { max-width: var(--ta-page-wide); margin: 0 auto; padding: 18px 28px 0; animation: tcre-in 180ms var(--ta-ease); }
3531
+ .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); }
3532
+ .tcre-home[data-compact] .tcre-body { max-width: none; }
2101
3533
  .tcre-home[data-compact] .tcre-top { padding: 4px 14px 0; }
2102
3534
  .tcre-home[data-compact] .tcre-body { padding: 14px 14px 0; }
2103
3535
  @keyframes tcre-in { from { opacity: 0; transform: translateY(4px); } }
@@ -2239,7 +3671,10 @@ button.tcre-pill:hover { background: var(--ta-hover); }
2239
3671
  .tcre-buttons { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
2240
3672
  .tcre-review .tcre-buttons .tcre-secondary { flex: 1; }
2241
3673
  .tcre-review .tcre-buttons .tcre-primary { flex: 2; }
2242
- .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; }
3674
+ .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; }
3675
+ .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; }
3676
+ .tcre-approved[data-tone="warn"] > span { flex: 1; min-width: 0; }
3677
+ .tcre-slot { display: inline-flex; align-items: center; gap: 6px; color: var(--ta-muted); font-weight: 400; font-variant-numeric: tabular-nums; }
2243
3678
 
2244
3679
  /* Published, a row each. */
2245
3680
  .tcre-rows { padding: 4px 16px; }
@@ -2273,6 +3708,62 @@ button.tcre-pill:hover { background: var(--ta-hover); }
2273
3708
  .tcre-panel { padding: 14px 16px 12px; }
2274
3709
  .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; }
2275
3710
  .tcre-insights, .tcre-wide { grid-column: 1 / -1; }
3711
+ .tcre-flow-node[data-stage='talk'] { --tcre-s: #14b8a6; }
3712
+ .tcre-flow-node[data-attn][data-stage='talk'] .tcre-flow-hint { color: #14b8a6; }
3713
+ .tcre-talk { display: flex; flex-direction: column; gap: 14px; max-width: var(--ta-page-wide); margin: 0 auto; }
3714
+ .tcre-comment { padding: 14px 16px 12px; }
3715
+ .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)); }
3716
+ .tcre-comment-piece { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
3717
+ .tcre-comment-text { margin: 8px 0; font-size: calc(14px * var(--ta-font-scale)); line-height: 1.55; overflow-wrap: anywhere; }
3718
+ .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); }
3719
+ .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); }
3720
+ .tcre-class[data-class='question'] { --tcre-k: #3b82f6; }
3721
+ .tcre-class[data-class='suggestion'] { --tcre-k: #a855f7; }
3722
+ .tcre-class[data-class='correction'] { --tcre-k: #f97316; }
3723
+ .tcre-class[data-class='praise'] { --tcre-k: #22c55e; }
3724
+ .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)); }
3725
+ .tcre-asked:first-of-type { border-top: 0; }
3726
+ .tcre-asked-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
3727
+ .tcre-answered { padding: 10px 0; border-top: 1px solid var(--tcre-line); }
3728
+ .tcre-answered:first-of-type { border-top: 0; }
3729
+ .tcre-answered .tcre-comment-text { margin: 6px 0 4px; color: var(--ta-secondary); font-size: calc(13px * var(--ta-font-scale)); }
3730
+ .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)); }
3731
+ .tcre-answer > span:first-child { min-width: 0; overflow-wrap: anywhere; }
3732
+ .tcre-level-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--tcre-line); }
3733
+ .tcre-level-row:first-of-type { border-top: 0; }
3734
+ .tcre-level-note { margin-top: 6px; font-size: calc(12px * var(--ta-font-scale)); line-height: 1.5; }
3735
+ .tcre-seg { flex: none; font-size: calc(12px * var(--ta-font-scale)); }
3736
+ .tcre-panel-title .tcre-seg { margin-left: 10px; font-weight: 500; }
3737
+ .tcre-strategy-hint { margin: -2px 0 8px; font-size: calc(12px * var(--ta-font-scale)); }
3738
+ .tcre-insight-text { flex: 1; min-width: 0; }
3739
+ .tcre-insight-text .tcre-chip { margin-right: 6px; }
3740
+ .tcre-insight[data-proposed] { opacity: 0.85; }
3741
+ .tcre-insight[data-tone='user'] .tcre-insight-icon { color: #3b82f6; background: color-mix(in oklab, #3b82f6 15%, transparent); }
3742
+ .tcre-rule-actions { flex: none; display: flex; align-items: center; gap: 4px; }
3743
+ .tcre-rule-add { display: flex; gap: 8px; margin-top: 10px; }
3744
+ .tcre-rule-add .tcre-field { flex: 1; min-width: 0; }
3745
+ .tcre-phase-every { display: flex; margin: 0 0 10px; }
3746
+ .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)); }
3747
+ .tcre-phase:first-of-type { border-top: 0; }
3748
+ .tcre-phase-when { flex: none; color: var(--ta-muted); font-variant-numeric: tabular-nums; font-size: calc(12px * var(--ta-font-scale)); }
3749
+ .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; }
3750
+ .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)); }
3751
+ .tcre-needs li { display: flex; align-items: center; gap: 8px; }
3752
+ .tcre-needs li svg { flex: none; color: var(--ta-muted); }
3753
+ .tcre-needs li[data-done] { color: var(--ta-muted); text-decoration: line-through; }
3754
+ .tcre-needs li[data-done] svg { color: var(--tcre-ok); }
3755
+ .tcre-needs-hint { min-width: 0; font-size: calc(12px * var(--ta-font-scale)); }
3756
+ .tcre-home[data-compact] .tcre-needs-hint { display: none; }
3757
+ .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; }
3758
+ .tcre-reach [data-reach='internal'], .tcre-reach[data-reach='internal'] { color: #0052d9; }
3759
+ .tcre-reach [data-reach='both'], .tcre-reach[data-reach='both'] { color: #7c3aed; }
3760
+ .tcre-tab-form { margin-left: 4px; font-style: normal; color: var(--ta-muted); font-size: 0.9em; }
3761
+ .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); }
3762
+ .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)); }
3763
+ .tcre-inside { display: inline-flex; align-items: center; gap: 2px; }
3764
+ .tcre-inside-add { display: flex; gap: 8px; margin-top: 8px; }
3765
+ .tcre-inside-add .tcre-field { flex: 1; min-width: 0; }
3766
+ .tcre-inside-add .tcre-field-name { flex: 0 1 140px; }
2276
3767
  .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; }
2277
3768
  .tcre-insight + .tcre-insight { border-top: 1px solid var(--tcre-line); }
2278
3769
  .tcre-insight .tcre-series-tag { margin-right: 8px; }
@@ -2287,6 +3778,8 @@ button.tcre-pill:hover { background: var(--ta-hover); }
2287
3778
  .tcre-bar-track i { display: block; height: 100%; min-width: 2px; border-radius: 4px; background: var(--ta-text); }
2288
3779
  .tcre-bar-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
2289
3780
  .tcre-bar-note { grid-column: 2 / 4; color: var(--ta-muted); font-size: calc(11.5px * var(--ta-font-scale)); }
3781
+ .tcre-bar[data-plain], .tcre-home[data-compact] .tcre-bar[data-plain] { grid-template-columns: minmax(0, 1fr) auto; padding: 8px 0; }
3782
+ .tcre-bar[data-plain] .tcre-bar-note { grid-column: auto; font-size: inherit; font-variant-numeric: tabular-nums; }
2290
3783
  .tcre-line { display: block; width: 100%; height: 90px; overflow: visible; }
2291
3784
  .tcre-line polyline { fill: none; stroke: #a855f7; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
2292
3785
  .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; }
@@ -2312,7 +3805,7 @@ button.tcre-pill:hover { background: var(--ta-hover); }
2312
3805
  /* Settings. */
2313
3806
  .tcre-setup { max-width: var(--ta-page-width); margin: 22px auto; }
2314
3807
  .tcre-setup-title { font-size: calc(20px * var(--ta-font-scale)); font-weight: 650; margin: 0 2px 14px; }
2315
- .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; }
3808
+ .tcre-setup-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 22px 2px 8px; color: var(--ta-text); font-size: calc(13.5px * var(--ta-font-scale)); font-weight: 600; }
2316
3809
  .tcre-setup-label span { color: var(--ta-muted); font-weight: 400; font-size: calc(12px * var(--ta-font-scale)); }
2317
3810
  .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; }
2318
3811
  :root[data-theme='light'] .tcre-input { box-shadow: inset 0 0 0 1px var(--tcre-line); }
@@ -2326,6 +3819,12 @@ button.tcre-pill:hover { background: var(--ta-hover); }
2326
3819
  .tcre-field-name { color: var(--ta-text); font-size: calc(14px * var(--ta-font-scale)); font-weight: 600; }
2327
3820
  .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); }
2328
3821
  .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; }
3822
+ [data-layout='compact'] .tcre-series-row { flex-wrap: wrap; row-gap: 6px; }
3823
+ [data-layout='compact'] .tcre-series-fields { flex-basis: calc(100% - 14px); }
3824
+ [data-layout='compact'] .tcre-series-row > i { align-self: flex-start; height: 44px; }
3825
+ [data-layout='compact'] .tcre-series-row > .tcre-tone-pick { margin-left: 14px; }
3826
+ .tcre-tone-pick { appearance: none; -webkit-appearance: none; max-width: 92px; padding: 0 10px; text-overflow: ellipsis; text-align: center; }
3827
+ .tcre-tone-pick[data-on='true'] { background: color-mix(in oklab, var(--tcre-c) 15%, transparent); color: var(--tcre-c); box-shadow: none; font-weight: 600; }
2329
3828
  .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; }
2330
3829
  .tcre-series-edit .tcre-series-add:first-child { border-top: 0; }
2331
3830
  .tcre-pick { display: flex; flex-wrap: wrap; gap: 8px; }
@@ -2335,6 +3834,9 @@ button.tcre-pill:hover { background: var(--ta-hover); }
2335
3834
  .tcre-setup .tcre-buttons { margin-top: 26px; }
2336
3835
 
2337
3836
  @media (prefers-reduced-motion: reduce) { .tcre-body { animation: none; } .tcre-pipe li[data-state='now'] .tcre-pipe-dot, .tcre-pulse { animation: none; } }
3837
+ .tcre-pick .tcre-icon { height: 28px; width: 28px; padding: 0; background: transparent; box-shadow: none; }
3838
+ .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); }
3839
+ .tcre-card .tcre-rule-add .tcre-field { background: transparent; }
2338
3840
  `;
2339
3841
  function injectStyle() {
2340
3842
  const element = document.createElement("style");
@@ -2365,8 +3867,9 @@ function activate(pi) {
2365
3867
  items: () => {
2366
3868
  const words = CreatorWords.of(pi.ui.language);
2367
3869
  const columns = CreatorUtil.columns(store.state.items, Date.now());
2368
- const waiting = columns.review.filter((one) => !one.approved).length;
2369
- const detail = waiting ? `${words.review} ${waiting}` : columns.topic[0] ? `${words.topic} · ${columns.topic[0].title}` : store.state.settings.niche || words.sub;
3870
+ const waiting = columns.review.length;
3871
+ const answers = drafts(store.state.comments).length;
3872
+ 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;
2370
3873
  return [
2371
3874
  {
2372
3875
  id: "creator",
@@ -2374,7 +3877,7 @@ function activate(pi) {
2374
3877
  detail,
2375
3878
  icon: pi.ui.icons.Film,
2376
3879
  tint: "creator",
2377
- unseen: waiting > 0,
3880
+ unseen: waiting > 0 || answers > 0,
2378
3881
  place: "double",
2379
3882
  open: () => pi.ui.showView(PAGE)
2380
3883
  }