@aglyn/aglyn 1.2.0 → 1.4.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.
Files changed (33) hide show
  1. package/package.json +11 -11
  2. package/src/lib/app-utils/author-html.js +3 -1
  3. package/src/lib/app-utils/author-html.js.map +1 -1
  4. package/src/lib/app-utils/docs-help.generated.d.ts +1 -1
  5. package/src/lib/app-utils/docs-help.generated.js +2 -0
  6. package/src/lib/app-utils/docs-help.generated.js.map +1 -1
  7. package/src/lib/app-utils/docs-index.generated.js +33 -12
  8. package/src/lib/app-utils/docs-index.generated.js.map +1 -1
  9. package/src/lib/app-utils/lockdown.js +4 -1
  10. package/src/lib/app-utils/lockdown.js.map +1 -1
  11. package/src/lib/app-utils/plan-entitlements.d.ts +5 -0
  12. package/src/lib/app-utils/plan-entitlements.js +6 -0
  13. package/src/lib/app-utils/plan-entitlements.js.map +1 -1
  14. package/src/lib/app-utils/plugin-sale.d.ts +36 -0
  15. package/src/lib/app-utils/plugin-sale.js +37 -0
  16. package/src/lib/app-utils/plugin-sale.js.map +1 -0
  17. package/src/lib/app-utils/site-starter-pick.d.ts +11 -0
  18. package/src/lib/app-utils/site-starter-pick.js +17 -1
  19. package/src/lib/app-utils/site-starter-pick.js.map +1 -1
  20. package/src/lib/app-utils/site-starter-theme.d.ts +28 -1
  21. package/src/lib/app-utils/site-starter-theme.js +78 -4
  22. package/src/lib/app-utils/site-starter-theme.js.map +1 -1
  23. package/src/lib/app-utils/site-styles.d.ts +11 -0
  24. package/src/lib/app-utils/site-styles.js +11 -0
  25. package/src/lib/app-utils/site-styles.js.map +1 -1
  26. package/src/lib/app-utils/site-unavailable.d.ts +22 -2
  27. package/src/lib/app-utils/site-unavailable.js +19 -3
  28. package/src/lib/app-utils/site-unavailable.js.map +1 -1
  29. package/src/lib/app-utils/weekly-summary.d.ts +48 -0
  30. package/src/lib/app-utils/weekly-summary.js +83 -12
  31. package/src/lib/app-utils/weekly-summary.js.map +1 -1
  32. package/src/lib/plugin-manager/feature-plugins.d.ts +6 -1
  33. package/src/lib/plugin-manager/feature-plugins.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/site-unavailable.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The site's 503 answer, sent as a 503 (AGL-4110).\n *\n * Maintenance mode (AGL-131) and preview (AGL-4086) answer a visitor who is\n * not let through with the site's designed 503 page, or the built-in notice,\n * at every address. The body was right and the status was not: every address\n * said `200 OK`, which tells a crawler the notice IS the page. A live site\n * that spent a weekend in maintenance could be re-indexed as \"Temporarily\n * unavailable\" and drop out of search. `503` with `Retry-After` is the answer\n * that means \"this site is briefly down, come back\".\n *\n * The body still comes from the ISR-cached catch-all, exactly as before; only\n * the tenant middleware can set the status, because an App Router page has no\n * status lever and the middleware is the one layer that runs ahead of the\n * cache on every request. It asks {@link siteUnavailableForRequest} and\n * rewrites with the status, so a cached page body never decides it.\n *\n * DEPENDENCY-FREE ON PURPOSE, like `site-preview.ts`: the middleware runs on\n * the edge and deep-imports this leaf, so it imports nothing.\n */\n\n/**\n * How long a crawler or uptime check is told to wait before asking again, in\n * seconds: an hour.\n *\n * The bandwidth cap's figure (`BANDWIDTH_CAP_RETRY_AFTER_SECONDS`), for the\n * same reason. Both states end the moment the owner flips a switch, and the\n * site is back within about a minute, so no longer value is ever \"correct\".\n * Too long is wrong in the direction that costs the site: a crawler staying\n * away after the site came back. An hour is short enough to be wrong in the\n * recoverable direction, and long enough that a crawler does not spend its\n * visits re-reading \"not yet\".\n */\nexport const SITE_UNAVAILABLE_RETRY_AFTER_SECONDS = 3600\n\n/**\n * Is the site in maintenance mode (AGL-131)?\n *\n * The loader's own test, shared with the verdict the middleware reads, so the\n * status and the body are decided by one predicate: a field the loader reads as\n * \"in maintenance\" is a field the middleware reads the same way.\n */\nexport function isHostInMaintenance(\n host: { maintenance?: unknown } | null | undefined,\n): boolean {\n return Boolean(host?.maintenance)\n}\n\n/** What the middleware knows about a site, from its verdict. */\nexport interface SiteUnavailableVerdict {\n /** Maintenance mode is on. */\n maintenance?: boolean\n /** The WHOLE site is in preview. One page in preview is not this. */\n preview?: boolean\n}\n\n/** How the middleware is routing this request. */\nexport interface SiteUnavailableRouting {\n /** An entry preview link (`?aglyn_preview=`) is being opened. */\n entryPreview: boolean\n /**\n * A team cookie sent this request around the cache to the uncached preview\n * route, which shows the team the site.\n */\n teamPreview: boolean\n}\n\n/**\n * Does this page request get the site's 503 answer as an HTTP 503?\n *\n * - **Maintenance: yes, for everyone**, the site's team included. It is the\n * switch that means \"nobody\", and the loader serves the 503 page to every\n * request, the team's preview route included, so every status says so.\n * - **A site in preview: yes, for the public**, the requests answered from the\n * shared cache. A request carrying a team cookie goes to the uncached\n * preview route instead, which shows the team the whole site.\n * - **An entry preview link: no.** When the site is unavailable its route\n * redirects to the plain address, which answers 503 by the rules above; a\n * 503 set here would only argue with that redirect.\n * - **One page in preview: no.** The public gets the site's 404 there, and the\n * render's own 404 decides that status.\n *\n * Nothing here is a permission. The body is the loader's decision, and a\n * request this answers `false` for is one whose body is already the site, or\n * an answer with a status of its own.\n */\nexport function siteUnavailableForRequest(\n verdict: SiteUnavailableVerdict | null | undefined,\n routing: SiteUnavailableRouting,\n): boolean {\n if (!verdict || routing.entryPreview) return false\n if (verdict.maintenance === true) return true\n return verdict.preview === true && !routing.teamPreview\n}\n"],"names":["SITE_UNAVAILABLE_RETRY_AFTER_SECONDS","isHostInMaintenance","host","Boolean","maintenance","siteUnavailableForRequest","verdict","routing","entryPreview","preview","teamPreview"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;CAmBC,GAED;;;;;;;;;;;CAWC,GACD,OAAO,MAAMA,uCAAuC,KAAI;AAExD;;;;;;CAMC,GACD,OAAO,SAASC,oBACdC,IAAkD;IAElD,OAAOC,QAAQD,wBAAAA,KAAME,WAAW;AAClC;AAqBA;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASC,0BACdC,OAAkD,EAClDC,OAA+B;IAE/B,IAAI,CAACD,WAAWC,QAAQC,YAAY,EAAE,OAAO;IAC7C,IAAIF,QAAQF,WAAW,KAAK,MAAM,OAAO;IACzC,OAAOE,QAAQG,OAAO,KAAK,QAAQ,CAACF,QAAQG,WAAW;AACzD"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/site-unavailable.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The site's 503 answer, sent as a 503 (AGL-4110).\n *\n * Maintenance mode (AGL-131) and preview (AGL-4086) answer a visitor who is\n * not let through with the site's designed 503 page, or the built-in notice,\n * at every address. The body was right and the status was not: every address\n * said `200 OK`, which tells a crawler the notice IS the page. A live site\n * that spent a weekend in maintenance could be re-indexed as \"Temporarily\n * unavailable\" and drop out of search. `503` with `Retry-After` is the answer\n * that means \"this site is briefly down, come back\".\n *\n * The body still comes from the ISR-cached catch-all, exactly as before; only\n * the tenant middleware can set the status, because an App Router page has no\n * status lever and the middleware is the one layer that runs ahead of the\n * cache on every request. It asks {@link siteUnavailableForRequest}, reads the\n * page, and sends it as a 503, so a cached page body never decides the status.\n * Why it reads the page rather than putting the status on its rewrite is the\n * note beside that code: on Vercel that rewrite loses the page.\n *\n * DEPENDENCY-FREE ON PURPOSE, like `site-preview.ts`: the middleware runs on\n * the edge and deep-imports this leaf, so it imports nothing.\n */\n\n/**\n * How long a crawler or uptime check is told to wait before asking again, in\n * seconds: an hour.\n *\n * The bandwidth cap's figure (`BANDWIDTH_CAP_RETRY_AFTER_SECONDS`), for the\n * same reason. Both states end the moment the owner flips a switch, and the\n * site is back within about a minute, so no longer value is ever \"correct\".\n * Too long is wrong in the direction that costs the site: a crawler staying\n * away after the site came back. An hour is short enough to be wrong in the\n * recoverable direction, and long enough that a crawler does not spend its\n * visits re-reading \"not yet\".\n */\nexport const SITE_UNAVAILABLE_RETRY_AFTER_SECONDS = 3600\n\n/**\n * Marks the middleware's own read of the notice page, which comes back through\n * the middleware and must take the plain rewrite rather than read it again.\n *\n * Not a secret, and nothing is withheld behind it: a stranger who sends it gets\n * the same notice with a 200.\n */\nexport const SITE_NOTICE_REQUEST_HEADER = 'x-aglyn-site-notice'\n\n/**\n * How long a visitor waits on that read, in milliseconds, before being served\n * the plain rewrite. Generous, as the verdict's deadline is: a cold render\n * answers inside it, and the page still arrives if it does not.\n */\nexport const SITE_NOTICE_DEADLINE_MS = 8_000\n\n/**\n * Is the site in maintenance mode (AGL-131)?\n *\n * The loader's own test, shared with the verdict the middleware reads, so the\n * status and the body are decided by one predicate: a field the loader reads as\n * \"in maintenance\" is a field the middleware reads the same way.\n */\nexport function isHostInMaintenance(\n host: { maintenance?: unknown } | null | undefined,\n): boolean {\n return Boolean(host?.maintenance)\n}\n\n/** What the middleware knows about a site, from its verdict. */\nexport interface SiteUnavailableVerdict {\n /** Maintenance mode is on. */\n maintenance?: boolean\n /** The WHOLE site is in preview. One page in preview is not this. */\n preview?: boolean\n}\n\n/** How the middleware is routing this request. */\nexport interface SiteUnavailableRouting {\n /** An entry preview link (`?aglyn_preview=`) is being opened. */\n entryPreview: boolean\n /**\n * A team cookie sent this request around the cache to the uncached preview\n * route, which shows the team the site.\n */\n teamPreview: boolean\n /** The middleware's own read of the notice page, not a visitor. */\n noticeRequest?: boolean\n}\n\n/**\n * Does this page request get the site's 503 answer as an HTTP 503?\n *\n * - **Maintenance: yes, for everyone**, the site's team included. It is the\n * switch that means \"nobody\", and the loader serves the 503 page to every\n * request, the team's preview route included, so every status says so.\n * - **A site in preview: yes, for the public**, the requests answered from the\n * shared cache. A request carrying a team cookie goes to the uncached\n * preview route instead, which shows the team the whole site.\n * - **An entry preview link: no.** When the site is unavailable its route\n * redirects to the plain address, which answers 503 by the rules above; a\n * 503 set here would only argue with that redirect.\n * - **One page in preview: no.** The public gets the site's 404 there, and the\n * render's own 404 decides that status.\n * - **The middleware's own read of the page: no.** That is how the body of the\n * 503 is fetched, and it would otherwise fetch itself.\n *\n * Nothing here is a permission. The body is the loader's decision, and a\n * request this answers `false` for is one whose body is already the site, or\n * an answer with a status of its own.\n */\nexport function siteUnavailableForRequest(\n verdict: SiteUnavailableVerdict | null | undefined,\n routing: SiteUnavailableRouting,\n): boolean {\n if (!verdict || routing.entryPreview || routing.noticeRequest) return false\n if (verdict.maintenance === true) return true\n return verdict.preview === true && !routing.teamPreview\n}\n"],"names":["SITE_UNAVAILABLE_RETRY_AFTER_SECONDS","SITE_NOTICE_REQUEST_HEADER","SITE_NOTICE_DEADLINE_MS","isHostInMaintenance","host","Boolean","maintenance","siteUnavailableForRequest","verdict","routing","entryPreview","noticeRequest","preview","teamPreview"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;CAqBC,GAED;;;;;;;;;;;CAWC,GACD,OAAO,MAAMA,uCAAuC,KAAI;AAExD;;;;;;CAMC,GACD,OAAO,MAAMC,6BAA6B,sBAAqB;AAE/D;;;;CAIC,GACD,OAAO,MAAMC,0BAA0B,KAAK;AAE5C;;;;;;CAMC,GACD,OAAO,SAASC,oBACdC,IAAkD;IAElD,OAAOC,QAAQD,wBAAAA,KAAME,WAAW;AAClC;AAuBA;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,SAASC,0BACdC,OAAkD,EAClDC,OAA+B;IAE/B,IAAI,CAACD,WAAWC,QAAQC,YAAY,IAAID,QAAQE,aAAa,EAAE,OAAO;IACtE,IAAIH,QAAQF,WAAW,KAAK,MAAM,OAAO;IACzC,OAAOE,QAAQI,OAAO,KAAK,QAAQ,CAACH,QAAQI,WAAW;AACzD"}
@@ -55,6 +55,13 @@ export declare function weeklySummaryPeriod(runAt: Date): {
55
55
  };
56
56
  /** `2026-10-05` as "Oct 5". */
57
57
  export declare function weeklySummaryDay(day: string): string;
58
+ /** `2026-10-26` as "Mon, Oct 26". */
59
+ export declare function weeklySummaryWeekday(day: string): string;
60
+ /**
61
+ * A sentence's dates as a person says them: "Monday 2026-10-26" as "Monday,
62
+ * Oct 26". Tables hand the model their dates in ISO form, and it copies them.
63
+ */
64
+ export declare function weeklySummaryPlainDates(text: string): string;
58
65
  /** A cell as a number, `0` for anything that is not one. */
59
66
  export declare function figureCount(value: PluginFigureCell | undefined): number;
60
67
  /** The row whose `key` cell is `label`: "Visitors" in a table of figures. */
@@ -126,6 +133,47 @@ export declare function weeklySummaryChange(change: number | null | undefined):
126
133
  * beside two tiles.
127
134
  */
128
135
  export declare function weeklySummaryTileRows(count: number): number[];
136
+ /** A figure a digest section lists: a page and its views. */
137
+ export interface WeeklySummarySectionRow {
138
+ label: string;
139
+ /** Where the label goes: the page itself. */
140
+ url?: string | null;
141
+ value: string;
142
+ change?: number | null;
143
+ }
144
+ /** One day of a section's chart; `marked` when it is a day the section is about. */
145
+ export interface WeeklySummarySectionBar {
146
+ label: string;
147
+ value: number;
148
+ /** The value as a person reads it. */
149
+ display: string;
150
+ marked: boolean;
151
+ }
152
+ /** One topic of an AI digest, told once: what stood out, and the figures behind it. */
153
+ export interface WeeklySummarySection {
154
+ title: string;
155
+ /** Where the figures can be seen in full. */
156
+ link?: {
157
+ label: string;
158
+ url: string;
159
+ } | null;
160
+ /** What was said about it: a line to scan and, if it needs one, the sentence behind it. */
161
+ points: ReadonlyArray<{
162
+ headline: string | null;
163
+ text: string | null;
164
+ }>;
165
+ rows?: readonly WeeklySummarySectionRow[];
166
+ bars?: readonly WeeklySummarySectionBar[];
167
+ }
168
+ /** Tiles on their own, for an email that leads with its headline figures. */
169
+ export declare function weeklySummaryTilesHtml(stats: readonly PluginFigureSummaryStat[], colors: WeeklySummaryColors): string;
170
+ /** An AI digest's topics, a hairline between them. */
171
+ export declare function weeklySummarySectionsHtml(sections: readonly WeeklySummarySection[], colors: WeeklySummaryColors): string;
172
+ /** The small print under the button, with its one link. */
173
+ export declare function weeklySummaryFootnoteHtml(text: string, link: {
174
+ label: string;
175
+ url: string;
176
+ } | null, colors: WeeklySummaryColors): string;
129
177
  /** What a send fills a weekly summary email's tokens with. */
130
178
  export interface WeeklySummaryEmail {
131
179
  subject: string;
@@ -61,6 +61,26 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
61
61
  timeZone: 'UTC'
62
62
  });
63
63
  }
64
+ /** `2026-10-26` as "Mon, Oct 26". */ export function weeklySummaryWeekday(day) {
65
+ const at = new Date(`${day}T00:00:00Z`);
66
+ return at.toLocaleDateString('en-US', {
67
+ weekday: 'short',
68
+ month: 'short',
69
+ day: 'numeric',
70
+ timeZone: 'UTC'
71
+ });
72
+ }
73
+ const ISO_DAY = /\b\d{4}-\d{2}-\d{2}\b/g;
74
+ /**
75
+ * A sentence's dates as a person says them: "Monday 2026-10-26" as "Monday,
76
+ * Oct 26". Tables hand the model their dates in ISO form, and it copies them.
77
+ */ export function weeklySummaryPlainDates(text) {
78
+ const said = (day)=>{
79
+ const words = weeklySummaryDay(day);
80
+ return words === 'Invalid Date' ? day : words;
81
+ };
82
+ return text.replace(/\b((?:Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day),? (\d{4}-\d{2}-\d{2})\b/g, (_, weekday, day)=>`${weekday}, ${said(day)}`).replace(ISO_DAY, said);
83
+ }
64
84
  // ── Helpers the readers word their parts with ──────────────────────────────
65
85
  /** A cell as a number, `0` for anything that is not one. */ export function figureCount(value) {
66
86
  return typeof value === 'number' && Number.isFinite(value) ? value : 0;
@@ -171,26 +191,32 @@ function changeHtml(change, colors) {
171
191
  for(let left = count; left > 0; left -= TILES_PER_ROW)rows.push(Math.min(TILES_PER_ROW, left));
172
192
  return rows;
173
193
  }
174
- /** Tiles, each a value, its label and its change, filling the width of their row. */ function tilesHtml(stats, colors) {
194
+ /** The gap between tiles, across and down. */ const TILE_GAP_PX = 8;
195
+ /** A cell that is only a gap: nothing in it may hold it open. */ const TILE_GAP = 'font-size:0;line-height:0;padding:0;';
196
+ /**
197
+ * Tiles, each a value, its label and its change, filling the width of their
198
+ * row. The tile is the table cell itself, so a row's tiles are one height
199
+ * whichever of them wraps, in every mail client; the gaps are cells of their own.
200
+ */ function tilesHtml(stats, colors) {
201
+ const sizes = weeklySummaryTileRows(stats.length);
175
202
  const rows = [];
176
203
  let at = 0;
177
- for (const size of weeklySummaryTileRows(stats.length)){
204
+ sizes.forEach((size)=>{
178
205
  const cells = stats.slice(at, at + size);
179
206
  at += size;
180
207
  // A tile alone takes half the row, not all of it, so it reads as a tile.
181
208
  const columns = Math.max(size, 2);
182
209
  const width = `${Math.floor(100 / columns)}%`;
183
- const tds = cells.map((stat, index)=>{
184
- // The gutter is split between neighbours, so the row's outer tiles sit
185
- // flush with the column's edges.
186
- const left = index === 0 ? 0 : 4;
187
- const right = index === cells.length - 1 ? 0 : 4;
188
- return `<td style="width:${width};padding:0 ${right}px 8px ${left}px;vertical-align:top;">` + `<div style="background-color:${colors.surface};border:1px solid ${colors.border};border-radius:8px;padding:12px 14px;">` + `<div style="font-family:${FONT};font-size:24px;line-height:1.2;font-weight:700;color:${colors.text};">${esc(stat.value)}</div>` + `<div style="font-family:${FONT};font-size:13px;line-height:1.4;color:${colors.muted};">${esc(stat.label)}</div>` + changeHtml(stat.change, colors) + `</div></td>`;
189
- });
190
- while(tds.length < columns)tds.push(`<td style="width:${width};padding:0 0 8px 4px;"></td>`);
210
+ const tds = [];
211
+ for(let index = 0; index < columns; index += 1){
212
+ if (index > 0) tds.push(`<td style="width:${TILE_GAP_PX}px;${TILE_GAP}">&nbsp;</td>`);
213
+ const stat = cells[index];
214
+ tds.push(stat ? `<td style="width:${width};background-color:${colors.surface};border:1px solid ${colors.border};border-radius:8px;padding:12px 14px;vertical-align:top;">` + `<div style="font-family:${FONT};font-size:24px;line-height:1.2;font-weight:700;color:${colors.text};">${esc(stat.value)}</div>` + `<div style="font-family:${FONT};font-size:13px;line-height:1.4;color:${colors.muted};">${esc(stat.label)}</div>` + changeHtml(stat.change, colors) + `</td>` : `<td style="width:${width};"></td>`);
215
+ }
191
216
  rows.push(`<tr>${tds.join('')}</tr>`);
192
- }
193
- return `<table role="presentation" style="width:100%;border-collapse:collapse;table-layout:fixed;">${rows.join('')}</table>`;
217
+ rows.push(`<tr><td colspan="${columns * 2 - 1}" style="height:${TILE_GAP_PX}px;${TILE_GAP}">&nbsp;</td></tr>`);
218
+ });
219
+ return `<table role="presentation" style="width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed;">${rows.join('')}</table>`;
194
220
  }
195
221
  /** A ranked list: the label left, its figure right, a hairline between. */ function rowsHtml(rows, colors) {
196
222
  const trs = rows.map((row, index)=>`<tr>` + `<td style="font-family:${FONT};font-size:14px;line-height:1.4;color:${colors.text};padding:8px 12px 8px 0;` + `${index < rows.length - 1 ? `border-bottom:1px solid ${colors.border};` : ''}word-break:break-word;">${unlinked(row.label)}</td>` + `<td style="font-family:${FONT};font-size:14px;line-height:1.4;font-weight:600;color:${colors.text};padding:8px 0;text-align:right;white-space:nowrap;` + `${index < rows.length - 1 ? `border-bottom:1px solid ${colors.border};` : ''}">${esc(row.value)}</td>` + `</tr>`);
@@ -199,6 +225,51 @@ function changeHtml(change, colors) {
199
225
  function sectionTitleHtml(title, colors) {
200
226
  return `<div style="font-family:${FONT};font-size:12px;line-height:1.4;font-weight:700;letter-spacing:0.06em;` + `text-transform:uppercase;color:${colors.muted};padding:0 0 8px;">${esc(title)}</div>`;
201
227
  }
228
+ /** A figure in a sentence: a count, a sum or a percent, never the digits in a path or a date. */ const FIGURE = RegExp("(?<![\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376-\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E-\\u066F\\u0671-\\u06D3\\u06D5\\u06E5-\\u06E6\\u06EE-\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4-\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088F\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC-\\u09DD\\u09DF-\\u09E1\\u09F0-\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F-\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32-\\u0A33\\u0A35-\\u0A36\\u0A38-\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0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-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE-\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C8A\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5-\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183-\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3006\\u3031-\\u3035\\u303B-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A-\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7DC\\uA7F1-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD-\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5-\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40-\\uFB41\\uFB43-\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u{10000}-\\u{1000B}\\u{1000D}-\\u{10026}\\u{10028}-\\u{1003A}\\u{1003C}-\\u{1003D}\\u{1003F}-\\u{1004D}\\u{10050}-\\u{1005D}\\u{10080}-\\u{100FA}\\u{10280}-\\u{1029C}\\u{102A0}-\\u{102D0}\\u{10300}-\\u{1031F}\\u{1032D}-\\u{10340}\\u{10342}-\\u{10349}\\u{10350}-\\u{10375}\\u{10380}-\\u{1039D}\\u{103A0}-\\u{103C3}\\u{103C8}-\\u{103CF}\\u{10400}-\\u{1049D}\\u{104B0}-\\u{104D3}\\u{104D8}-\\u{104FB}\\u{10500}-\\u{10527}\\u{10530}-\\u{10563}\\u{10570}-\\u{1057A}\\u{1057C}-\\u{1058A}\\u{1058C}-\\u{10592}\\u{10594}-\\u{10595}\\u{10597}-\\u{105A1}\\u{105A3}-\\u{105B1}\\u{105B3}-\\u{105B9}\\u{105BB}-\\u{105BC}\\u{105C0}-\\u{105F3}\\u{10600}-\\u{10736}\\u{10740}-\\u{10755}\\u{10760}-\\u{10767}\\u{10780}-\\u{10785}\\u{10787}-\\u{107B0}\\u{107B2}-\\u{107BA}\\u{10800}-\\u{10805}\\u{10808}\\u{1080A}-\\u{10835}\\u{10837}-\\u{10838}\\u{1083C}\\u{1083F}-\\u{10855}\\u{10860}-\\u{10876}\\u{10880}-\\u{1089E}\\u{108E0}-\\u{108F2}\\u{108F4}-\\u{108F5}\\u{10900}-\\u{10915}\\u{10920}-\\u{10939}\\u{10940}-\\u{10959}\\u{10980}-\\u{109B7}\\u{109BE}-\\u{109BF}\\u{10A00}\\u{10A10}-\\u{10A13}\\u{10A15}-\\u{10A17}\\u{10A19}-\\u{10A35}\\u{10A60}-\\u{10A7C}\\u{10A80}-\\u{10A9C}\\u{10AC0}-\\u{10AC7}\\u{10AC9}-\\u{10AE4}\\u{10B00}-\\u{10B35}\\u{10B40}-\\u{10B55}\\u{10B60}-\\u{10B72}\\u{10B80}-\\u{10B91}\\u{10C00}-\\u{10C48}\\u{10C80}-\\u{10CB2}\\u{10CC0}-\\u{10CF2}\\u{10D00}-\\u{10D23}\\u{10D4A}-\\u{10D65}\\u{10D6F}-\\u{10D85}\\u{10E80}-\\u{10EA9}\\u{10EB0}-\\u{10EB1}\\u{10EC2}-\\u{10EC7}\\u{10F00}-\\u{10F1C}\\u{10F27}\\u{10F30}-\\u{10F45}\\u{10F70}-\\u{10F81}\\u{10FB0}-\\u{10FC4}\\u{10FE0}-\\u{10FF6}\\u{11003}-\\u{11037}\\u{11071}-\\u{11072}\\u{11075}\\u{11083}-\\u{110AF}\\u{110D0}-\\u{110E8}\\u{11103}-\\u{11126}\\u{11144}\\u{11147}\\u{11150}-\\u{11172}\\u{11176}\\u{11183}-\\u{111B2}\\u{111C1}-\\u{111C4}\\u{111DA}\\u{111DC}\\u{11200}-\\u{11211}\\u{11213}-\\u{1122B}\\u{1123F}-\\u{11240}\\u{11280}-\\u{11286}\\u{11288}\\u{1128A}-\\u{1128D}\\u{1128F}-\\u{1129D}\\u{1129F}-\\u{112A8}\\u{112B0}-\\u{112DE}\\u{11305}-\\u{1130C}\\u{1130F}-\\u{11310}\\u{11313}-\\u{11328}\\u{1132A}-\\u{11330}\\u{11332}-\\u{11333}\\u{11335}-\\u{11339}\\u{1133D}\\u{11350}\\u{1135D}-\\u{11361}\\u{11380}-\\u{11389}\\u{1138B}\\u{1138E}\\u{11390}-\\u{113B5}\\u{113B7}\\u{113D1}\\u{113D3}\\u{11400}-\\u{11434}\\u{11447}-\\u{1144A}\\u{1145F}-\\u{11461}\\u{11480}-\\u{114AF}\\u{114C4}-\\u{114C5}\\u{114C7}\\u{11580}-\\u{115AE}\\u{115D8}-\\u{115DB}\\u{11600}-\\u{1162F}\\u{11644}\\u{11680}-\\u{116AA}\\u{116B8}\\u{11700}-\\u{1171A}\\u{11740}-\\u{11746}\\u{11800}-\\u{1182B}\\u{118A0}-\\u{118DF}\\u{118FF}-\\u{11906}\\u{11909}\\u{1190C}-\\u{11913}\\u{11915}-\\u{11916}\\u{11918}-\\u{1192F}\\u{1193F}\\u{11941}\\u{119A0}-\\u{119A7}\\u{119AA}-\\u{119D0}\\u{119E1}\\u{119E3}\\u{11A00}\\u{11A0B}-\\u{11A32}\\u{11A3A}\\u{11A50}\\u{11A5C}-\\u{11A89}\\u{11A9D}\\u{11AB0}-\\u{11AF8}\\u{11BC0}-\\u{11BE0}\\u{11C00}-\\u{11C08}\\u{11C0A}-\\u{11C2E}\\u{11C40}\\u{11C72}-\\u{11C8F}\\u{11D00}-\\u{11D06}\\u{11D08}-\\u{11D09}\\u{11D0B}-\\u{11D30}\\u{11D46}\\u{11D60}-\\u{11D65}\\u{11D67}-\\u{11D68}\\u{11D6A}-\\u{11D89}\\u{11D98}\\u{11DB0}-\\u{11DDB}\\u{11EE0}-\\u{11EF2}\\u{11F02}\\u{11F04}-\\u{11F10}\\u{11F12}-\\u{11F33}\\u{11FB0}\\u{12000}-\\u{12399}\\u{12480}-\\u{12543}\\u{12F90}-\\u{12FF0}\\u{13000}-\\u{1342F}\\u{13441}-\\u{13446}\\u{13460}-\\u{143FA}\\u{14400}-\\u{14646}\\u{16100}-\\u{1611D}\\u{16800}-\\u{16A38}\\u{16A40}-\\u{16A5E}\\u{16A70}-\\u{16ABE}\\u{16AD0}-\\u{16AED}\\u{16B00}-\\u{16B2F}\\u{16B40}-\\u{16B43}\\u{16B63}-\\u{16B77}\\u{16B7D}-\\u{16B8F}\\u{16D40}-\\u{16D6C}\\u{16E40}-\\u{16E7F}\\u{16EA0}-\\u{16EB8}\\u{16EBB}-\\u{16ED3}\\u{16F00}-\\u{16F4A}\\u{16F50}\\u{16F93}-\\u{16F9F}\\u{16FE0}-\\u{16FE1}\\u{16FE3}\\u{16FF2}-\\u{16FF3}\\u{17000}-\\u{18CD5}\\u{18CFF}-\\u{18D1E}\\u{18D80}-\\u{18DF2}\\u{1AFF0}-\\u{1AFF3}\\u{1AFF5}-\\u{1AFFB}\\u{1AFFD}-\\u{1AFFE}\\u{1B000}-\\u{1B122}\\u{1B132}\\u{1B150}-\\u{1B152}\\u{1B155}\\u{1B164}-\\u{1B167}\\u{1B170}-\\u{1B2FB}\\u{1BC00}-\\u{1BC6A}\\u{1BC70}-\\u{1BC7C}\\u{1BC80}-\\u{1BC88}\\u{1BC90}-\\u{1BC99}\\u{1D400}-\\u{1D454}\\u{1D456}-\\u{1D49C}\\u{1D49E}-\\u{1D49F}\\u{1D4A2}\\u{1D4A5}-\\u{1D4A6}\\u{1D4A9}-\\u{1D4AC}\\u{1D4AE}-\\u{1D4B9}\\u{1D4BB}\\u{1D4BD}-\\u{1D4C3}\\u{1D4C5}-\\u{1D505}\\u{1D507}-\\u{1D50A}\\u{1D50D}-\\u{1D514}\\u{1D516}-\\u{1D51C}\\u{1D51E}-\\u{1D539}\\u{1D53B}-\\u{1D53E}\\u{1D540}-\\u{1D544}\\u{1D546}\\u{1D54A}-\\u{1D550}\\u{1D552}-\\u{1D6A5}\\u{1D6A8}-\\u{1D6C0}\\u{1D6C2}-\\u{1D6DA}\\u{1D6DC}-\\u{1D6FA}\\u{1D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EEA1}-\\u{1EEA3}\\u{1EEA5}-\\u{1EEA9}\\u{1EEAB}-\\u{1EEBB}\\u{20000}-\\u{2A6DF}\\u{2A700}-\\u{2B81D}\\u{2B820}-\\u{2CEAD}\\u{2CEB0}-\\u{2EBE0}\\u{2EBF0}-\\u{2EE5D}\\u{2F800}-\\u{2FA1D}\\u{30000}-\\u{3134A}\\u{31350}-\\u{33479}\\u0030-\\u0039\\u00B2-\\u00B3\\u00B9\\u00BC-\\u00BE\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u09F4-\\u09F9\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0B72-\\u0B77\\u0BE6-\\u0BF2\\u0C66-\\u0C6F\\u0C78-\\u0C7E\\u0CE6-\\u0CEF\\u0D58-\\u0D5E\\u0D66-\\u0D78\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F33\\u1040-\\u1049\\u1090-\\u1099\\u1369-\\u137C\\u16EE-\\u16F0\\u17E0-\\u17E9\\u17F0-\\u17F9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19DA\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\u2070\\u2074-\\u2079\\u2080-\\u2089\\u2150-\\u2182\\u2185-\\u2189\\u2460-\\u249B\\u24EA-\\u24FF\\u2776-\\u2793\\u2CFD\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u3192-\\u3195\\u3220-\\u3229\\u3248-\\u324F\\u3251-\\u325F\\u3280-\\u3289\\u32B1-\\u32BF\\uA620-\\uA629\\uA6E6-\\uA6EF\\uA830-\\uA835\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19\\u{10107}-\\u{10133}\\u{10140}-\\u{10178}\\u{1018A}-\\u{1018B}\\u{102E1}-\\u{102FB}\\u{10320}-\\u{10323}\\u{10341}\\u{1034A}\\u{103D1}-\\u{103D5}\\u{104A0}-\\u{104A9}\\u{10858}-\\u{1085F}\\u{10879}-\\u{1087F}\\u{108A7}-\\u{108AF}\\u{108FB}-\\u{108FF}\\u{10916}-\\u{1091B}\\u{109BC}-\\u{109BD}\\u{109C0}-\\u{109CF}\\u{109D2}-\\u{109FF}\\u{10A40}-\\u{10A48}\\u{10A7D}-\\u{10A7E}\\u{10A9D}-\\u{10A9F}\\u{10AEB}-\\u{10AEF}\\u{10B58}-\\u{10B5F}\\u{10B78}-\\u{10B7F}\\u{10BA9}-\\u{10BAF}\\u{10CFA}-\\u{10CFF}\\u{10D30}-\\u{10D39}\\u{10D40}-\\u{10D49}\\u{10E60}-\\u{10E7E}\\u{10F1D}-\\u{10F26}\\u{10F51}-\\u{10F54}\\u{10FC5}-\\u{10FCB}\\u{11052}-\\u{1106F}\\u{110F0}-\\u{110F9}\\u{11136}-\\u{1113F}\\u{111D0}-\\u{111D9}\\u{111E1}-\\u{111F4}\\u{112F0}-\\u{112F9}\\u{11450}-\\u{11459}\\u{114D0}-\\u{114D9}\\u{11650}-\\u{11659}\\u{116C0}-\\u{116C9}\\u{116D0}-\\u{116E3}\\u{11730}-\\u{1173B}\\u{118E0}-\\u{118F2}\\u{11950}-\\u{11959}\\u{11BF0}-\\u{11BF9}\\u{11C50}-\\u{11C6C}\\u{11D50}-\\u{11D59}\\u{11DA0}-\\u{11DA9}\\u{11DE0}-\\u{11DE9}\\u{11F50}-\\u{11F59}\\u{11FC0}-\\u{11FD4}\\u{12400}-\\u{1246E}\\u{16130}-\\u{16139}\\u{16A60}-\\u{16A69}\\u{16AC0}-\\u{16AC9}\\u{16B50}-\\u{16B59}\\u{16B5B}-\\u{16B61}\\u{16D70}-\\u{16D79}\\u{16E80}-\\u{16E96}\\u{16FF4}-\\u{16FF6}\\u{1CCF0}-\\u{1CCF9}\\u{1D2C0}-\\u{1D2D3}\\u{1D2E0}-\\u{1D2F3}\\u{1D360}-\\u{1D378}\\u{1D7CE}-\\u{1D7FF}\\u{1E140}-\\u{1E149}\\u{1E2F0}-\\u{1E2F9}\\u{1E4F0}-\\u{1E4F9}\\u{1E5F1}-\\u{1E5FA}\\u{1E8C7}-\\u{1E8CF}\\u{1E950}-\\u{1E959}\\u{1EC71}-\\u{1ECAB}\\u{1ECAD}-\\u{1ECAF}\\u{1ECB1}-\\u{1ECB4}\\u{1ED01}-\\u{1ED2D}\\u{1ED2F}-\\u{1ED3D}\\u{1F100}-\\u{1F10C}\\u{1FBF0}-\\u{1FBF9}_./-])(?<!(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) )[+\\-−]?[$€£¥]?(?:\\d{1,3}(?:,\\d{3})+|\\d+)(?:\\.\\d+)?%?(?![\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376-\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E-\\u066F\\u0671-\\u06D3\\u06D5\\u06E5-\\u06E6\\u06EE-\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4-\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088F\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u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DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32-\\u0E33\\u0E40-\\u0E46\\u0E81-\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2-\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065-\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE-\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C8A\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5-\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183-\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3006\\u3031-\\u3035\\u303B-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A-\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7DC\\uA7F1-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD-\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5-\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40-\\uFB41\\uFB43-\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u{10000}-\\u{1000B}\\u{1000D}-\\u{10026}\\u{10028}-\\u{1003A}\\u{1003C}-\\u{1003D}\\u{1003F}-\\u{1004D}\\u{10050}-\\u{1005D}\\u{10080}-\\u{100FA}\\u{10280}-\\u{1029C}\\u{102A0}-\\u{102D0}\\u{10300}-\\u{1031F}\\u{1032D}-\\u{10340}\\u{10342}-\\u{10349}\\u{10350}-\\u{10375}\\u{10380}-\\u{1039D}\\u{103A0}-\\u{103C3}\\u{103C8}-\\u{103CF}\\u{10400}-\\u{1049D}\\u{104B0}-\\u{104D3}\\u{104D8}-\\u{104FB}\\u{10500}-\\u{10527}\\u{10530}-\\u{10563}\\u{10570}-\\u{1057A}\\u{1057C}-\\u{1058A}\\u{1058C}-\\u{10592}\\u{10594}-\\u{10595}\\u{10597}-\\u{105A1}\\u{105A3}-\\u{105B1}\\u{105B3}-\\u{105B9}\\u{105BB}-\\u{105BC}\\u{105C0}-\\u{105F3}\\u{10600}-\\u{10736}\\u{10740}-\\u{10755}\\u{10760}-\\u{10767}\\u{10780}-\\u{10785}\\u{10787}-\\u{107B0}\\u{107B2}-\\u{107BA}\\u{10800}-\\u{10805}\\u{10808}\\u{1080A}-\\u{10835}\\u{10837}-\\u{10838}\\u{1083C}\\u{1083F}-\\u{10855}\\u{10860}-\\u{10876}\\u{10880}-\\u{1089E}\\u{108E0}-\\u{108F2}\\u{108F4}-\\u{108F5}\\u{10900}-\\u{10915}\\u{10920}-\\u{10939}\\u{10940}-\\u{10959}\\u{10980}-\\u{109B7}\\u{109BE}-\\u{109BF}\\u{10A00}\\u{10A10}-\\u{10A13}\\u{10A15}-\\u{10A17}\\u{10A19}-\\u{10A35}\\u{10A60}-\\u{10A7C}\\u{10A80}-\\u{10A9C}\\u{10AC0}-\\u{10AC7}\\u{10AC9}-\\u{10AE4}\\u{10B00}-\\u{10B35}\\u{10B40}-\\u{10B55}\\u{10B60}-\\u{10B72}\\u{10B80}-\\u{10B91}\\u{10C00}-\\u{10C48}\\u{10C80}-\\u{10CB2}\\u{10CC0}-\\u{10CF2}\\u{10D00}-\\u{10D23}\\u{10D4A}-\\u{10D65}\\u{10D6F}-\\u{10D85}\\u{10E80}-\\u{10EA9}\\u{10EB0}-\\u{10EB1}\\u{10EC2}-\\u{10EC7}\\u{10F00}-\\u{10F1C}\\u{10F27}\\u{10F30}-\\u{10F45}\\u{10F70}-\\u{10F81}\\u{10FB0}-\\u{10FC4}\\u{10FE0}-\\u{10FF6}\\u{11003}-\\u{11037}\\u{11071}-\\u{11072}\\u{11075}\\u{11083}-\\u{110AF}\\u{110D0}-\\u{110E8}\\u{11103}-\\u{11126}\\u{11144}\\u{11147}\\u{11150}-\\u{11172}\\u{11176}\\u{11183}-\\u{111B2}\\u{111C1}-\\u{111C4}\\u{111DA}\\u{111DC}\\u{11200}-\\u{11211}\\u{11213}-\\u{1122B}\\u{1123F}-\\u{11240}\\u{11280}-\\u{11286}\\u{11288}\\u{1128A}-\\u{1128D}\\u{1128F}-\\u{1129D}\\u{1129F}-\\u{112A8}\\u{112B0}-\\u{112DE}\\u{11305}-\\u{1130C}\\u{1130F}-\\u{11310}\\u{11313}-\\u{11328}\\u{1132A}-\\u{11330}\\u{11332}-\\u{11333}\\u{11335}-\\u{11339}\\u{1133D}\\u{11350}\\u{1135D}-\\u{11361}\\u{11380}-\\u{11389}\\u{1138B}\\u{1138E}\\u{11390}-\\u{113B5}\\u{113B7}\\u{113D1}\\u{113D3}\\u{11400}-\\u{11434}\\u{11447}-\\u{1144A}\\u{1145F}-\\u{11461}\\u{11480}-\\u{114AF}\\u{114C4}-\\u{114C5}\\u{114C7}\\u{11580}-\\u{115AE}\\u{115D8}-\\u{115DB}\\u{11600}-\\u{1162F}\\u{11644}\\u{11680}-\\u{116AA}\\u{116B8}\\u{11700}-\\u{1171A}\\u{11740}-\\u{11746}\\u{11800}-\\u{1182B}\\u{118A0}-\\u{118DF}\\u{118FF}-\\u{11906}\\u{11909}\\u{1190C}-\\u{11913}\\u{11915}-\\u{11916}\\u{11918}-\\u{1192F}\\u{1193F}\\u{11941}\\u{119A0}-\\u{119A7}\\u{119AA}-\\u{119D0}\\u{119E1}\\u{119E3}\\u{11A00}\\u{11A0B}-\\u{11A32}\\u{11A3A}\\u{11A50}\\u{11A5C}-\\u{11A89}\\u{11A9D}\\u{11AB0}-\\u{11AF8}\\u{11BC0}-\\u{11BE0}\\u{11C00}-\\u{11C08}\\u{11C0A}-\\u{11C2E}\\u{11C40}\\u{11C72}-\\u{11C8F}\\u{11D00}-\\u{11D06}\\u{11D08}-\\u{11D09}\\u{11D0B}-\\u{11D30}\\u{11D46}\\u{11D60}-\\u{11D65}\\u{11D67}-\\u{11D68}\\u{11D6A}-\\u{11D89}\\u{11D98}\\u{11DB0}-\\u{11DDB}\\u{11EE0}-\\u{11EF2}\\u{11F02}\\u{11F04}-\\u{11F10}\\u{11F12}-\\u{11F33}\\u{11FB0}\\u{12000}-\\u{12399}\\u{12480}-\\u{12543}\\u{12F90}-\\u{12FF0}\\u{13000}-\\u{1342F}\\u{13441}-\\u{13446}\\u{13460}-\\u{143FA}\\u{14400}-\\u{14646}\\u{16100}-\\u{1611D}\\u{16800}-\\u{16A38}\\u{16A40}-\\u{16A5E}\\u{16A70}-\\u{16ABE}\\u{16AD0}-\\u{16AED}\\u{16B00}-\\u{16B2F}\\u{16B40}-\\u{16B43}\\u{16B63}-\\u{16B77}\\u{16B7D}-\\u{16B8F}\\u{16D40}-\\u{16D6C}\\u{16E40}-\\u{16E7F}\\u{16EA0}-\\u{16EB8}\\u{16EBB}-\\u{16ED3}\\u{16F00}-\\u{16F4A}\\u{16F50}\\u{16F93}-\\u{16F9F}\\u{16FE0}-\\u{16FE1}\\u{16FE3}\\u{16FF2}-\\u{16FF3}\\u{17000}-\\u{18CD5}\\u{18CFF}-\\u{18D1E}\\u{18D80}-\\u{18DF2}\\u{1AFF0}-\\u{1AFF3}\\u{1AFF5}-\\u{1AFFB}\\u{1AFFD}-\\u{1AFFE}\\u{1B000}-\\u{1B122}\\u{1B132}\\u{1B150}-\\u{1B152}\\u{1B155}\\u{1B164}-\\u{1B167}\\u{1B170}-\\u{1B2FB}\\u{1BC00}-\\u{1BC6A}\\u{1BC70}-\\u{1BC7C}\\u{1BC80}-\\u{1BC88}\\u{1BC90}-\\u{1BC99}\\u{1D400}-\\u{1D454}\\u{1D456}-\\u{1D49C}\\u{1D49E}-\\u{1D49F}\\u{1D4A2}\\u{1D4A5}-\\u{1D4A6}\\u{1D4A9}-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{1EE3B}\\u{1EE42}\\u{1EE47}\\u{1EE49}\\u{1EE4B}\\u{1EE4D}-\\u{1EE4F}\\u{1EE51}-\\u{1EE52}\\u{1EE54}\\u{1EE57}\\u{1EE59}\\u{1EE5B}\\u{1EE5D}\\u{1EE5F}\\u{1EE61}-\\u{1EE62}\\u{1EE64}\\u{1EE67}-\\u{1EE6A}\\u{1EE6C}-\\u{1EE72}\\u{1EE74}-\\u{1EE77}\\u{1EE79}-\\u{1EE7C}\\u{1EE7E}\\u{1EE80}-\\u{1EE89}\\u{1EE8B}-\\u{1EE9B}\\u{1EEA1}-\\u{1EEA3}\\u{1EEA5}-\\u{1EEA9}\\u{1EEAB}-\\u{1EEBB}\\u{20000}-\\u{2A6DF}\\u{2A700}-\\u{2B81D}\\u{2B820}-\\u{2CEAD}\\u{2CEB0}-\\u{2EBE0}\\u{2EBF0}-\\u{2EE5D}\\u{2F800}-\\u{2FA1D}\\u{30000}-\\u{3134A}\\u{31350}-\\u{33479}\\u0030-\\u0039\\u00B2-\\u00B3\\u00B9\\u00BC-\\u00BE\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u09F4-\\u09F9\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0B72-\\u0B77\\u0BE6-\\u0BF2\\u0C66-\\u0C6F\\u0C78-\\u0C7E\\u0CE6-\\u0CEF\\u0D58-\\u0D5E\\u0D66-\\u0D78\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F33\\u1040-\\u1049\\u1090-\\u1099\\u1369-\\u137C\\u16EE-\\u16F0\\u17E0-\\u17E9\\u17F0-\\u17F9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19DA\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\u2070\\u2074-\\u2079\\u2080-\\u2089\\u2150-\\u2182\\u2185-\\u2189\\u2460-\\u249B\\u24EA-\\u24FF\\u2776-\\u2793\\u2CFD\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u3192-\\u3195\\u3220-\\u3229\\u3248-\\u324F\\u3251-\\u325F\\u3280-\\u3289\\u32B1-\\u32BF\\uA620-\\uA629\\uA6E6-\\uA6EF\\uA830-\\uA835\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19\\u{10107}-\\u{10133}\\u{10140}-\\u{10178}\\u{1018A}-\\u{1018B}\\u{102E1}-\\u{102FB}\\u{10320}-\\u{10323}\\u{10341}\\u{1034A}\\u{103D1}-\\u{103D5}\\u{104A0}-\\u{104A9}\\u{10858}-\\u{1085F}\\u{10879}-\\u{1087F}\\u{108A7}-\\u{108AF}\\u{108FB}-\\u{108FF}\\u{10916}-\\u{1091B}\\u{109BC}-\\u{109BD}\\u{109C0}-\\u{109CF}\\u{109D2}-\\u{109FF}\\u{10A40}-\\u{10A48}\\u{10A7D}-\\u{10A7E}\\u{10A9D}-\\u{10A9F}\\u{10AEB}-\\u{10AEF}\\u{10B58}-\\u{10B5F}\\u{10B78}-\\u{10B7F}\\u{10BA9}-\\u{10BAF}\\u{10CFA}-\\u{10CFF}\\u{10D30}-\\u{10D39}\\u{10D40}-\\u{10D49}\\u{10E60}-\\u{10E7E}\\u{10F1D}-\\u{10F26}\\u{10F51}-\\u{10F54}\\u{10FC5}-\\u{10FCB}\\u{11052}-\\u{1106F}\\u{110F0}-\\u{110F9}\\u{11136}-\\u{1113F}\\u{111D0}-\\u{111D9}\\u{111E1}-\\u{111F4}\\u{112F0}-\\u{112F9}\\u{11450}-\\u{11459}\\u{114D0}-\\u{114D9}\\u{11650}-\\u{11659}\\u{116C0}-\\u{116C9}\\u{116D0}-\\u{116E3}\\u{11730}-\\u{1173B}\\u{118E0}-\\u{118F2}\\u{11950}-\\u{11959}\\u{11BF0}-\\u{11BF9}\\u{11C50}-\\u{11C6C}\\u{11D50}-\\u{11D59}\\u{11DA0}-\\u{11DA9}\\u{11DE0}-\\u{11DE9}\\u{11F50}-\\u{11F59}\\u{11FC0}-\\u{11FD4}\\u{12400}-\\u{1246E}\\u{16130}-\\u{16139}\\u{16A60}-\\u{16A69}\\u{16AC0}-\\u{16AC9}\\u{16B50}-\\u{16B59}\\u{16B5B}-\\u{16B61}\\u{16D70}-\\u{16D79}\\u{16E80}-\\u{16E96}\\u{16FF4}-\\u{16FF6}\\u{1CCF0}-\\u{1CCF9}\\u{1D2C0}-\\u{1D2D3}\\u{1D2E0}-\\u{1D2F3}\\u{1D360}-\\u{1D378}\\u{1D7CE}-\\u{1D7FF}\\u{1E140}-\\u{1E149}\\u{1E2F0}-\\u{1E2F9}\\u{1E4F0}-\\u{1E4F9}\\u{1E5F1}-\\u{1E5FA}\\u{1E8C7}-\\u{1E8CF}\\u{1E950}-\\u{1E959}\\u{1EC71}-\\u{1ECAB}\\u{1ECAD}-\\u{1ECAF}\\u{1ECB1}-\\u{1ECB4}\\u{1ED01}-\\u{1ED2D}\\u{1ED2F}-\\u{1ED3D}\\u{1F100}-\\u{1F10C}\\u{1FBF0}-\\u{1FBF9}_/-])", "gu");
229
+ /** A sentence with its figures in bold, so an eye running down the email lands on them. */ function figuresHtml(text, colors) {
230
+ let html = '';
231
+ let at = 0;
232
+ for (const match of text.matchAll(FIGURE)){
233
+ html += `${unlinked(text.slice(at, match.index))}<strong style="font-weight:700;color:${colors.text};">${esc(match[0])}</strong>`;
234
+ at = match.index + match[0].length;
235
+ }
236
+ return html + unlinked(text.slice(at));
237
+ }
238
+ /** Tiles on their own, for an email that leads with its headline figures. */ export function weeklySummaryTilesHtml(stats, colors) {
239
+ return stats.length ? `<div style="padding:12px 0 8px;">${tilesHtml(stats, colors)}</div>` : '';
240
+ }
241
+ function sectionRowsHtml(rows, colors) {
242
+ const cell = `font-family:${FONT};font-size:14px;line-height:1.4;padding:7px 0;`;
243
+ // No column for a change no row has, so the figures reach the edge.
244
+ const changes = rows.some((row)=>weeklySummaryChange(row.change));
245
+ const trs = rows.map((row, index)=>{
246
+ const border = index > 0 ? `border-top:1px solid ${colors.border};` : '';
247
+ const label = row.url ? `<a href="${esc(row.url)}" style="color:${colors.link};text-decoration:none;font-weight:600;">${unlinked(row.label)}</a>` : unlinked(row.label);
248
+ return `<tr>` + `<td style="${cell}${border}color:${colors.text};word-break:break-word;">${label}</td>` + `<td style="${cell}${border}color:${colors.text};font-weight:600;padding-left:12px;text-align:right;white-space:nowrap;">${esc(row.value)}</td>` + (changes ? `<td style="${cell}${border}padding-left:12px;text-align:right;white-space:nowrap;">${changeHtml(row.change, colors)}</td>` : '') + `</tr>`;
249
+ });
250
+ return `<table role="presentation" style="width:100%;border-collapse:collapse;margin-top:8px;">${trs.join('')}</table>`;
251
+ }
252
+ /** Horizontal bars, drawn in table cells so every mail client keeps them. */ function sectionBarsHtml(bars, colors) {
253
+ const most = Math.max(...bars.map((bar)=>bar.value), 1);
254
+ const trs = bars.map((bar)=>{
255
+ const text = `font-family:${FONT};font-size:13px;line-height:1.3;color:${bar.marked ? colors.text : colors.muted};white-space:nowrap;`;
256
+ const weight = bar.marked ? 'font-weight:700;' : '';
257
+ return `<tr>` + `<td style="${text}${weight}padding:3px 10px 3px 0;width:1%;">${esc(bar.label)}</td>` + `<td style="padding:3px 0;"><div style="background-color:${bar.marked ? colors.accent : colors.border};border-radius:2px;font-size:0;height:10px;line-height:0;width:${Math.max(1, Math.round(bar.value / most * 100))}%;">&nbsp;</div></td>` + `<td style="${text}${weight}padding:3px 0 3px 10px;text-align:right;width:1%;">${esc(bar.display)}</td>` + `</tr>`;
258
+ });
259
+ return `<table role="presentation" style="width:100%;border-collapse:collapse;margin-top:8px;">${trs.join('')}</table>`;
260
+ }
261
+ function sectionHtml(section, colors, first) {
262
+ var _section_rows, _section_bars;
263
+ const link = section.link ? `<td style="padding:0;text-align:right;vertical-align:baseline;white-space:nowrap;">` + `<a href="${esc(section.link.url)}" style="font-family:${FONT};font-size:13px;line-height:1.4;font-weight:600;color:${colors.link};text-decoration:none;">${esc(section.link.label)}&nbsp;→</a>` + `</td>` : '';
264
+ const points = section.points.map((point)=>`<div style="padding:6px 0 0;">` + (point.headline ? `<div style="font-family:${FONT};font-size:16px;line-height:1.35;font-weight:700;color:${colors.text};">${unlinked(point.headline)}</div>` : '') + (point.text ? `<div style="font-family:${FONT};font-size:14px;line-height:1.5;color:${colors.muted};">${figuresHtml(point.text, colors)}</div>` : '') + `</div>`);
265
+ return `<div style="padding:${first ? '8px' : '18px'} 0 18px;${first ? '' : `border-top:1px solid ${colors.border};`}">` + `<table role="presentation" style="width:100%;border-collapse:collapse;"><tr>` + `<td style="font-family:${FONT};font-size:12px;line-height:1.4;font-weight:700;letter-spacing:0.06em;text-transform:uppercase;color:${colors.muted};padding:0;">${esc(section.title)}</td>` + link + `</tr></table>` + points.join('') + (((_section_rows = section.rows) == null ? void 0 : _section_rows.length) ? sectionRowsHtml(section.rows, colors) : '') + (((_section_bars = section.bars) == null ? void 0 : _section_bars.length) ? sectionBarsHtml(section.bars, colors) : '') + `</div>`;
266
+ }
267
+ /** An AI digest's topics, a hairline between them. */ export function weeklySummarySectionsHtml(sections, colors) {
268
+ return sections.map((section, index)=>sectionHtml(section, colors, index === 0)).join('');
269
+ }
270
+ /** The small print under the button, with its one link. */ export function weeklySummaryFootnoteHtml(text, link, colors) {
271
+ return `<div style="font-family:${FONT};font-size:12px;line-height:1.5;color:${colors.muted};padding:12px 0 0;">` + esc(text) + (link ? ` <a href="${esc(link.url)}" style="color:${colors.link};text-decoration:underline;">${esc(link.label)}</a>` : '') + `</div>`;
272
+ }
202
273
  function partHtml(part, colors) {
203
274
  var _part_stats, _part_rows;
204
275
  return `<div style="padding:16px 0 8px;">` + sectionTitleHtml(part.title, colors) + (part.note ? `<div style="font-family:${FONT};font-size:13px;line-height:1.5;color:${colors.muted};padding:0 0 8px;">${esc(part.note)}</div>` : '') + (((_part_stats = part.stats) == null ? void 0 : _part_stats.length) ? tilesHtml(part.stats, colors) : '') + (((_part_rows = part.rows) == null ? void 0 : _part_rows.length) ? rowsHtml(part.rows, colors) : '') + `</div>`;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/weekly-summary.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n pluginFigureCellText,\n pluginFigureIsoWeek,\n pluginFigureWindows,\n type PluginFigureCell,\n type PluginFigureRow,\n type PluginFigureSummaryPart,\n type PluginFigureSummaryStat,\n type PluginFigureTable,\n} from '../plugin-manager/plugin-figures'\n\n/**\n * THE WEEKLY SUMMARY (AGL-3867): the free Monday emails that say how a\n * workspace did the week before — one for each site that had something to\n * report, and an overview of the workspace that adds the sites up.\n *\n * They spend nothing. Every figure comes from a `plugin-figures` reader that\n * declares a `weeklySummary`, and that reader's owner says what its table\n * means as tiles and ranked rows, so each plugin's counting rules decide what\n * a figure is and nothing here names one. AI weekly insights (AGL-2915) are\n * the paid version that explains the figures, and stay opt-in because each\n * one spends the workspace's AI credits.\n *\n * This module is the period, the wording helpers the readers use, and both\n * emails' words and layout; the reads and the sends are\n * `@aglyn/tenant-data-admin/server/weekly-summary`. The layout is drawn as\n * email-safe tables with inline styles, in colors the caller resolves from\n * the email theme.\n */\n\n/** The key a person's switch is stored under in `users/{uid}.digestPrefs`; on until turned off. */\nexport const WEEKLY_SUMMARY_DIGEST_KEY = 'weeklySummary'\n\n/** The window every figure is read over. */\nexport const WEEKLY_SUMMARY_DAYS = 7\n\n/** Rows a ranked list names. */\nexport const WEEKLY_SUMMARY_TOP_ROWS = 5\n\n/** Counts a subject line or the overview's tiles lead with, at most. */\nexport const WEEKLY_SUMMARY_HEADLINE_COUNTS = 3\n\n/** Tiles in one row of an email. */\nconst TILES_PER_ROW = 3\n\n/**\n * The week a run reports on: the seven whole UTC days before the day it runs,\n * so a Monday run covers Monday to Sunday and never a part-day of today.\n * `now` is what each reader is handed; `week` keys the run's marker.\n */\nexport function weeklySummaryPeriod(runAt: Date): {\n now: Date\n week: string\n from: string\n to: string\n label: string\n} {\n const startOfToday = Date.UTC(runAt.getUTCFullYear(), runAt.getUTCMonth(), runAt.getUTCDate())\n const now = new Date(startOfToday - 1)\n const { current } = pluginFigureWindows(now, WEEKLY_SUMMARY_DAYS)\n return {\n now,\n week: pluginFigureIsoWeek(now),\n from: current.from,\n to: current.to,\n label: `${weeklySummaryDay(current.from)} – ${weeklySummaryDay(current.to)}`,\n }\n}\n\n/** `2026-10-05` as \"Oct 5\". */\nexport function weeklySummaryDay(day: string): string {\n const at = new Date(`${day}T00:00:00Z`)\n return at.toLocaleDateString('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' })\n}\n\n// ── Helpers the readers word their parts with ──────────────────────────────\n\n/** A cell as a number, `0` for anything that is not one. */\nexport function figureCount(value: PluginFigureCell | undefined): number {\n return typeof value === 'number' && Number.isFinite(value) ? value : 0\n}\n\n/** The row whose `key` cell is `label`: \"Visitors\" in a table of figures. */\nexport function figureRow(table: PluginFigureTable, key: string, label: string): PluginFigureRow | undefined {\n return table.rows.find((row) => row[key] === label)\n}\n\n/** Whether a table carries a column, so a reader that changed shape is noticed rather than misread. */\nexport function figureHasColumn(table: PluginFigureTable, key: string): boolean {\n return table.columns.some((column) => column.key === key)\n}\n\n/** A cell as a tile, with its change when the table has one. */\nexport function figureStat(\n table: PluginFigureTable,\n row: PluginFigureRow,\n key: string,\n label: string,\n options: { change?: string; total?: { one: string; many: string } } = {},\n): PluginFigureSummaryStat {\n const change = options.change ? row[options.change] : undefined\n return {\n label,\n value: pluginFigureCellText(table, key, row[key] ?? 0),\n ...(typeof change === 'number' ? { change } : {}),\n ...(options.total ? { total: { count: figureCount(row[key]), ...options.total } } : {}),\n }\n}\n\n/** The named rows with the most of `key`, as ranked rows; `[]` when none has any. */\nexport function figureRanked(\n table: PluginFigureTable,\n nameKey: string,\n key: string,\n rows: readonly PluginFigureRow[] = table.rows,\n): Array<{ label: string; value: string }> {\n return rows\n .filter((row) => typeof row[nameKey] === 'string' && figureCount(row[key]) > 0)\n .slice(0, WEEKLY_SUMMARY_TOP_ROWS)\n .map((row) => ({ label: String(row[nameKey]), value: pluginFigureCellText(table, key, row[key] ?? 0) }))\n}\n\n/** \"1 order\", \"18 orders\". */\nexport function figurePlural(count: number, one: string, many: string): string {\n return `${count.toLocaleString('en-US')} ${count === 1 ? one : many}`\n}\n\n// ── The emails ─────────────────────────────────────────────────────────────\n\n/** One site's figures for the week. */\nexport interface WeeklySummarySite {\n name: string\n /** The site's dashboard in the console, absolute; `null` with no origin to build it from. */\n url: string | null\n /**\n * Where the site itself is, so a reader knows which site this is: its\n * custom domain when it serves on one, else its platform address. `null`\n * for a site with no address yet.\n */\n address?: { label: string; url: string } | null\n parts: readonly PluginFigureSummaryPart[]\n}\n\n/** The colors an email is drawn in, resolved from its theme by the caller. */\nexport interface WeeklySummaryColors {\n text: string\n muted: string\n border: string\n /** A tile's ground. */\n surface: string\n /** The accent rule beside a callout. */\n accent: string\n /** Links: the email theme's own link color, the one every other link in the email wears. */\n link: string\n /** A rise and a fall. */\n up: string\n down: string\n}\n\n/** A site with anything to say. */\nexport function weeklySummaryHasNews(site: Pick<WeeklySummarySite, 'parts'>): boolean {\n return site.parts.length > 0\n}\n\n/** The counts the readers offered for adding up, summed by noun, in the order they were first given. */\nexport function weeklySummaryTotals(\n sites: ReadonlyArray<Pick<WeeklySummarySite, 'parts'>>,\n): Array<{ count: number; one: string; many: string }> {\n const sums = new Map<string, { count: number; one: string; many: string }>()\n for (const site of sites) {\n for (const part of site.parts) {\n for (const stat of part.stats ?? []) {\n if (!stat.total || stat.total.count <= 0) continue\n const sum = sums.get(stat.total.one)\n sums.set(stat.total.one, sum ? { ...sum, count: sum.count + stat.total.count } : { ...stat.total })\n }\n }\n }\n return [...sums.values()]\n}\n\nfunction headline(sites: ReadonlyArray<Pick<WeeklySummarySite, 'parts'>>): string {\n return weeklySummaryTotals(sites)\n .slice(0, WEEKLY_SUMMARY_HEADLINE_COUNTS)\n .map(({ count, one, many }) => figurePlural(count, one, many))\n .join(', ')\n}\n\n/** \"+12.5%\", \"−27.9%\", \"no change\"; `null` with nothing to compare with. */\nexport function weeklySummaryChange(change: number | null | undefined): { text: string; sign: 1 | -1 | 0 } | null {\n if (typeof change !== 'number' || !Number.isFinite(change)) return null\n if (change === 0) return { text: 'no change', sign: 0 }\n const amount = Math.abs(change).toLocaleString('en-US', { maximumFractionDigits: 1 })\n return change > 0 ? { text: `+${amount}%`, sign: 1 } : { text: `−${amount}%`, sign: -1 }\n}\n\nconst esc = (value: string): string =>\n value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;')\n\nconst FONT = 'Helvetica, Arial, sans-serif'\n\nconst capitalized = (value: string): string => value.charAt(0).toUpperCase() + value.slice(1)\n\n/**\n * A label that reads like an address — `www.google.com` — kept from being\n * turned into a link by the inbox, which would draw it in the inbox's own\n * blue beside the theme's links. A zero-width space after each dot breaks\n * the detection and nothing a reader sees.\n */\nconst unlinked = (value: string): string => esc(value).replace(/\\./g, '.\\u200b')\n\nfunction changeHtml(change: number | null | undefined, colors: WeeklySummaryColors): string {\n const said = weeklySummaryChange(change)\n if (!said) return ''\n const color = said.sign > 0 ? colors.up : said.sign < 0 ? colors.down : colors.muted\n const arrow = said.sign > 0 ? '▲ ' : said.sign < 0 ? '▼ ' : ''\n return `<div style=\"font-family:${FONT};font-size:13px;line-height:1.4;font-weight:600;color:${color};\">${arrow}${esc(said.text)}</div>`\n}\n\n/**\n * How many tiles share each row: one row of up to three, two rows of two for\n * four, then rows of three — so a row is never left with an empty slot\n * beside two tiles.\n */\nexport function weeklySummaryTileRows(count: number): number[] {\n if (count <= 0) return []\n if (count <= TILES_PER_ROW) return [count]\n if (count === 4) return [2, 2]\n const rows: number[] = []\n for (let left = count; left > 0; left -= TILES_PER_ROW) rows.push(Math.min(TILES_PER_ROW, left))\n return rows\n}\n\n/** Tiles, each a value, its label and its change, filling the width of their row. */\nfunction tilesHtml(stats: readonly PluginFigureSummaryStat[], colors: WeeklySummaryColors): string {\n const rows: string[] = []\n let at = 0\n for (const size of weeklySummaryTileRows(stats.length)) {\n const cells = stats.slice(at, at + size)\n at += size\n // A tile alone takes half the row, not all of it, so it reads as a tile.\n const columns = Math.max(size, 2)\n const width = `${Math.floor(100 / columns)}%`\n const tds = cells.map((stat, index) => {\n // The gutter is split between neighbours, so the row's outer tiles sit\n // flush with the column's edges.\n const left = index === 0 ? 0 : 4\n const right = index === cells.length - 1 ? 0 : 4\n return (\n `<td style=\"width:${width};padding:0 ${right}px 8px ${left}px;vertical-align:top;\">` +\n `<div style=\"background-color:${colors.surface};border:1px solid ${colors.border};border-radius:8px;padding:12px 14px;\">` +\n `<div style=\"font-family:${FONT};font-size:24px;line-height:1.2;font-weight:700;color:${colors.text};\">${esc(stat.value)}</div>` +\n `<div style=\"font-family:${FONT};font-size:13px;line-height:1.4;color:${colors.muted};\">${esc(stat.label)}</div>` +\n changeHtml(stat.change, colors) +\n `</div></td>`\n )\n })\n while (tds.length < columns) tds.push(`<td style=\"width:${width};padding:0 0 8px 4px;\"></td>`)\n rows.push(`<tr>${tds.join('')}</tr>`)\n }\n return `<table role=\"presentation\" style=\"width:100%;border-collapse:collapse;table-layout:fixed;\">${rows.join('')}</table>`\n}\n\n/** A ranked list: the label left, its figure right, a hairline between. */\nfunction rowsHtml(rows: ReadonlyArray<{ label: string; value: string }>, colors: WeeklySummaryColors): string {\n const trs = rows.map(\n (row, index) =>\n `<tr>` +\n `<td style=\"font-family:${FONT};font-size:14px;line-height:1.4;color:${colors.text};padding:8px 12px 8px 0;` +\n `${index < rows.length - 1 ? `border-bottom:1px solid ${colors.border};` : ''}word-break:break-word;\">${unlinked(row.label)}</td>` +\n `<td style=\"font-family:${FONT};font-size:14px;line-height:1.4;font-weight:600;color:${colors.text};padding:8px 0;text-align:right;white-space:nowrap;` +\n `${index < rows.length - 1 ? `border-bottom:1px solid ${colors.border};` : ''}\">${esc(row.value)}</td>` +\n `</tr>`,\n )\n return `<table role=\"presentation\" style=\"width:100%;border-collapse:collapse;\">${trs.join('')}</table>`\n}\n\nfunction sectionTitleHtml(title: string, colors: WeeklySummaryColors): string {\n return (\n `<div style=\"font-family:${FONT};font-size:12px;line-height:1.4;font-weight:700;letter-spacing:0.06em;` +\n `text-transform:uppercase;color:${colors.muted};padding:0 0 8px;\">${esc(title)}</div>`\n )\n}\n\nfunction partHtml(part: PluginFigureSummaryPart, colors: WeeklySummaryColors): string {\n return (\n `<div style=\"padding:16px 0 8px;\">` +\n sectionTitleHtml(part.title, colors) +\n (part.note\n ? `<div style=\"font-family:${FONT};font-size:13px;line-height:1.5;color:${colors.muted};padding:0 0 8px;\">${esc(part.note)}</div>`\n : '') +\n (part.stats?.length ? tilesHtml(part.stats, colors) : '') +\n (part.rows?.length ? rowsHtml(part.rows, colors) : '') +\n `</div>`\n )\n}\n\n/** \"aglyn.com · Aglyn LLC\": which site, linked, and whose. */\nfunction addressHtml(site: WeeklySummarySite, workspaceName: string, colors: WeeklySummaryColors): string {\n const address = site.address\n ? `<a href=\"${esc(site.address.url)}\" style=\"color:${colors.link};text-decoration:underline;font-weight:600;\">${esc(site.address.label)}</a>`\n : `<span style=\"font-weight:600;\">${esc(site.name)}</span>`\n return (\n `<div style=\"font-family:${FONT};font-size:14px;line-height:1.5;color:${colors.muted};padding:0 0 4px;\">` +\n `${address} · ${esc(workspaceName)}</div>`\n )\n}\n\nfunction insightsHtml(url: string, colors: WeeklySummaryColors): string {\n return (\n `<div style=\"margin:16px 0 0;background-color:${colors.surface};border-left:3px solid ${colors.accent};border-radius:4px;padding:14px 16px;\">` +\n `<div style=\"font-family:${FONT};font-size:14px;line-height:1.5;font-weight:700;color:${colors.text};\">Want to know why the numbers moved?</div>` +\n `<div style=\"font-family:${FONT};font-size:14px;line-height:1.5;color:${colors.text};\">` +\n `AI weekly insights explain each site's week in a few plain sentences. ` +\n `<a href=\"${esc(url)}\" style=\"color:${colors.link};text-decoration:underline;\">Turn them on from Ask about your numbers</a>.` +\n `</div></div>`\n )\n}\n\nfunction partText(part: PluginFigureSummaryPart): string[] {\n const lines = [part.title.toUpperCase()]\n if (part.note) lines.push(part.note)\n for (const stat of part.stats ?? []) {\n const said = weeklySummaryChange(stat.change)\n lines.push(`${stat.label}: ${stat.value}${said ? ` (${said.text})` : ''}`)\n }\n for (const row of part.rows ?? []) lines.push(`- ${row.label}: ${row.value}`)\n return lines\n}\n\n/** What a send fills a weekly summary email's tokens with. */\nexport interface WeeklySummaryEmail {\n subject: string\n /** The heading: \"Aglyn last week\". */\n title: string\n /** \"Oct 5 – Oct 11, compared with the week before\". */\n period: string\n /** The figures, drawn. */\n html: string\n /** The whole email as plain text, closing line included. */\n text: string\n buttonLabel: string\n /** Where the button goes; `''` when there is no console origin to link to. */\n url: string\n}\n\ninterface CommonInput {\n workspaceName: string\n productName: string\n periodLabel: string\n colors: WeeklySummaryColors\n /** Where AI weekly insights are turned on, when the plan includes them and this person has not; else `null`. */\n aiInsightsUrl: string | null\n settingsUrl: string\n}\n\nfunction closing(input: CommonInput): string[] {\n return [\n '',\n `You get this summary because you manage ${input.workspaceName}. Turn it off in Notifications: ${input.settingsUrl}`,\n ]\n}\n\n/**\n * One site's email, or `null` for a site with nothing to report. `workspace`\n * carries the workspace's own parts when this site's email stands in for the\n * overview, in a workspace with one active site.\n */\nexport function composeWeeklySummarySiteEmail(\n input: CommonInput & { site: WeeklySummarySite; workspace?: readonly PluginFigureSummaryPart[] },\n): WeeklySummaryEmail | null {\n const workspace = input.workspace ?? []\n if (!weeklySummaryHasNews(input.site) && !workspace.length) return null\n const lead = headline([input.site])\n const subject = lead ? `${input.site.name} last week: ${lead}` : `${input.site.name} last week`\n const html =\n addressHtml(input.site, input.workspaceName, input.colors) +\n input.site.parts.map((part) => partHtml(part, input.colors)).join('') +\n (workspace.length\n ? `<div style=\"border-top:1px solid ${input.colors.border};margin:16px 0 0;\"></div>` +\n workspace.map((part) => partHtml({ ...part, title: `${input.workspaceName} · ${part.title}` }, input.colors)).join('')\n : '') +\n (input.aiInsightsUrl ? insightsHtml(input.aiInsightsUrl, input.colors) : '')\n const text = [\n `${input.site.name} last week, ${input.periodLabel}. A change in brackets is against the week before.`,\n `Site: ${input.site.address ? `${input.site.address.label} (${input.site.address.url})` : input.site.name} · ${input.workspaceName}`,\n ...input.site.parts.flatMap((part) => ['', ...partText(part)]),\n ...workspace.flatMap((part) => ['', ...partText({ ...part, title: `${input.workspaceName} · ${part.title}` })]),\n ...(input.site.url ? ['', `Open ${input.site.name} in ${input.productName}: ${input.site.url}`] : []),\n ...(input.aiInsightsUrl\n ? ['', `Want to know why the numbers moved? Turn on AI weekly insights from Ask about your numbers: ${input.aiInsightsUrl}`]\n : []),\n ...closing(input),\n ].join('\\n')\n return {\n subject,\n title: `${input.site.name} last week`,\n period: `${input.periodLabel}, compared with the week before`,\n html,\n text,\n buttonLabel: `Open ${input.site.name}`,\n url: input.site.url ?? '',\n }\n}\n\n/**\n * The workspace overview: the week's totals across its sites, a line for each\n * site, and the workspace's own figures, or `null` when nothing anywhere has\n * anything to report.\n */\nexport function composeWeeklySummaryOverviewEmail(\n input: CommonInput & {\n sites: readonly WeeklySummarySite[]\n workspace: readonly PluginFigureSummaryPart[]\n /** The workspace's home in the console, absolute; `''` with no origin. */\n url: string\n },\n): WeeklySummaryEmail | null {\n const active = input.sites.filter(weeklySummaryHasNews)\n if (!active.length && !input.workspace.length) return null\n const totals = weeklySummaryTotals(active)\n const lead = totals\n .slice(0, WEEKLY_SUMMARY_HEADLINE_COUNTS)\n .map(({ count, one, many }) => figurePlural(count, one, many))\n .join(', ')\n const subject = lead ? `Your week at ${input.workspaceName}: ${lead}` : `Your week at ${input.workspaceName}`\n const { colors } = input\n const totalsPart: PluginFigureSummaryPart | null = totals.length\n ? {\n title: active.length === 1 ? 'At a glance' : `Across ${active.length} sites`,\n stats: totals.slice(0, TILES_PER_ROW * 2).map(({ count, one, many }) => ({\n label: capitalized(count === 1 ? one : many),\n value: count.toLocaleString('en-US'),\n })),\n }\n : null\n const siteLine = (site: WeeklySummarySite): string =>\n site.parts\n .flatMap((part) => part.stats ?? [])\n .filter((stat) => stat.total && stat.total.count > 0)\n .slice(0, WEEKLY_SUMMARY_HEADLINE_COUNTS)\n .map((stat) => {\n const total = stat.total as NonNullable<PluginFigureSummaryStat['total']>\n const said = weeklySummaryChange(stat.change)\n return `${figurePlural(total.count, total.one, total.many)}${said ? ` (${said.text})` : ''}`\n })\n .join(' · ')\n const quietCount = input.sites.length - active.length\n const quiet = quietCount\n ? `${figurePlural(quietCount, 'other site', 'other sites')} had nothing to report.`\n : ''\n const sitesHtml = active.length\n ? `<div style=\"padding:16px 0 8px;\">` +\n sectionTitleHtml('Your sites', colors) +\n `<table role=\"presentation\" style=\"width:100%;border-collapse:collapse;\">` +\n active\n .map((site, index) => {\n const border = index < active.length - 1 ? `border-bottom:1px solid ${colors.border};` : ''\n const name = site.url\n ? `<a href=\"${esc(site.url)}\" style=\"color:${colors.link};text-decoration:none;font-weight:700;\">${esc(site.name)}</a>`\n : `<span style=\"font-weight:700;\">${esc(site.name)}</span>`\n const line = siteLine(site)\n const address = site.address\n ? ` <a href=\"${esc(site.address.url)}\" style=\"color:${colors.muted};text-decoration:underline;font-size:13px;font-weight:400;\">${esc(site.address.label)}</a>`\n : ''\n return (\n `<tr><td style=\"font-family:${FONT};font-size:15px;line-height:1.4;color:${colors.text};padding:10px 0;${border}\">` +\n name +\n address +\n (line ? `<div style=\"font-size:13px;line-height:1.5;color:${colors.muted};\">${esc(line)}</div>` : '') +\n `</td></tr>`\n )\n })\n .join('') +\n `</table>` +\n (quiet\n ? `<div style=\"font-family:${FONT};font-size:13px;line-height:1.5;color:${colors.muted};padding:4px 0 0;\">${esc(quiet)}</div>`\n : '') +\n `</div>`\n : ''\n const html =\n (totalsPart ? partHtml(totalsPart, colors) : '') +\n sitesHtml +\n input.workspace.map((part) => partHtml(part, colors)).join('') +\n (active.length > 1\n ? `<div style=\"font-family:${FONT};font-size:13px;line-height:1.5;color:${colors.muted};padding:8px 0 0;\">Each site's own summary arrives beside this one.</div>`\n : '') +\n (input.aiInsightsUrl ? insightsHtml(input.aiInsightsUrl, colors) : '')\n const text = [\n `Here is how ${input.workspaceName} did last week, ${input.periodLabel}. A change in brackets is against the week before.`,\n ...(totalsPart ? ['', ...partText(totalsPart)] : []),\n ...(active.length\n ? [\n '',\n 'YOUR SITES',\n ...active.map(\n (site) =>\n `- ${site.name}${site.address ? ` (${site.address.label})` : ''}: ${siteLine(site) || 'see its summary'}` +\n (site.url ? ` · ${site.url}` : ''),\n ),\n ...(quiet ? [quiet] : []),\n ]\n : []),\n ...input.workspace.flatMap((part) => ['', ...partText(part)]),\n ...(input.aiInsightsUrl\n ? ['', `Want to know why the numbers moved? Turn on AI weekly insights from Ask about your numbers: ${input.aiInsightsUrl}`]\n : []),\n ...closing(input),\n ].join('\\n')\n return {\n subject,\n title: `${input.workspaceName} last week`,\n period: `${input.periodLabel}, compared with the week before`,\n html,\n text,\n buttonLabel: `Open ${input.workspaceName}`,\n url: input.url,\n }\n}\n"],"names":["pluginFigureCellText","pluginFigureIsoWeek","pluginFigureWindows","WEEKLY_SUMMARY_DIGEST_KEY","WEEKLY_SUMMARY_DAYS","WEEKLY_SUMMARY_TOP_ROWS","WEEKLY_SUMMARY_HEADLINE_COUNTS","TILES_PER_ROW","weeklySummaryPeriod","runAt","startOfToday","Date","UTC","getUTCFullYear","getUTCMonth","getUTCDate","now","current","week","from","to","label","weeklySummaryDay","day","at","toLocaleDateString","month","timeZone","figureCount","value","Number","isFinite","figureRow","table","key","rows","find","row","figureHasColumn","columns","some","column","figureStat","options","change","undefined","total","count","figureRanked","nameKey","filter","slice","map","String","figurePlural","one","many","toLocaleString","weeklySummaryHasNews","site","parts","length","weeklySummaryTotals","sites","sums","Map","part","stat","stats","sum","get","set","values","headline","join","weeklySummaryChange","text","sign","amount","Math","abs","maximumFractionDigits","esc","replace","FONT","capitalized","charAt","toUpperCase","unlinked","changeHtml","colors","said","color","up","down","muted","arrow","weeklySummaryTileRows","left","push","min","tilesHtml","size","cells","max","width","floor","tds","index","right","surface","border","rowsHtml","trs","sectionTitleHtml","title","partHtml","note","addressHtml","workspaceName","address","url","link","name","insightsHtml","accent","partText","lines","closing","input","settingsUrl","composeWeeklySummarySiteEmail","workspace","lead","subject","html","aiInsightsUrl","periodLabel","flatMap","productName","period","buttonLabel","composeWeeklySummaryOverviewEmail","active","totals","totalsPart","siteLine","quietCount","quiet","sitesHtml","line"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,oBAAoB,EACpBC,mBAAmB,EACnBC,mBAAmB,QAMd,sCAAkC;AAEzC;;;;;;;;;;;;;;;;;CAiBC,GAED,iGAAiG,GACjG,OAAO,MAAMC,4BAA4B,gBAAe;AAExD,0CAA0C,GAC1C,OAAO,MAAMC,sBAAsB,EAAC;AAEpC,8BAA8B,GAC9B,OAAO,MAAMC,0BAA0B,EAAC;AAExC,sEAAsE,GACtE,OAAO,MAAMC,iCAAiC,EAAC;AAE/C,kCAAkC,GAClC,MAAMC,gBAAgB;AAEtB;;;;CAIC,GACD,OAAO,SAASC,oBAAoBC,KAAW;IAO7C,MAAMC,eAAeC,KAAKC,GAAG,CAACH,MAAMI,cAAc,IAAIJ,MAAMK,WAAW,IAAIL,MAAMM,UAAU;IAC3F,MAAMC,MAAM,IAAIL,K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AEqD,MAAMV,aAAa,CAAC,gBAAgB,EAAEU,MAAMQ,WAAW,CAAC,kDAAkD,CAAC;WACtHQ,aAAa;YAAC;eAAOnB,SAASmB;SAAY,GAAG,EAAE;WAC/CF,OAAOlF,MAAM,GACb;YACE;YACA;eACGkF,OAAO3F,GAAG,CACX,CAACO,OACC,CAAC,EAAE,EAAEA,KAAKgE,IAAI,GAAGhE,KAAK6D,OAAO,GAAG,CAAC,EAAE,EAAE7D,KAAK6D,OAAO,CAACnG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE6H,SAASvF,SAAS,mBAAmB,GACxGA,CAAAA,KAAK8D,GAAG,GAAG,CAAC,GAAG,EAAE9D,KAAK8D,GAAG,EAAE,GAAG,EAAC;eAEhC2B,QAAQ;gBAACA;aAAM,GAAG,EAAE;SACzB,GACD,EAAE;WACHnB,MAAMG,SAAS,CAACM,OAAO,CAAC,CAACxE,OAAS;gBAAC;mBAAO4D,SAAS5D;aAAM;WACxD+D,MAAMO,aAAa,GACnB;YAAC;YAAI,CAAC,4FAA4F,EAAEP,MAAMO,aAAa,EAAE;SAAC,GAC1H,EAAE;WACHR,QAAQC;KACZ,CAACvD,IAAI,CAAC;IACP,OAAO;QACL4D;QACAnB,OAAO,GAAGc,MAAMV,aAAa,CAAC,UAAU,CAAC;QACzCqB,QAAQ,GAAGX,MAAMQ,WAAW,CAAC,+BAA+B,CAAC;QAC7DF;QACA3D;QACAiE,aAAa,CAAC,KAAK,EAAEZ,MAAMV,aAAa,EAAE;QAC1CE,KAAKQ,MAAMR,GAAG;IAChB;AACF"}
1
+ {"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/weekly-summary.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n pluginFigureCellText,\n pluginFigureIsoWeek,\n pluginFigureWindows,\n type PluginFigureCell,\n type PluginFigureRow,\n type PluginFigureSummaryPart,\n type PluginFigureSummaryStat,\n type PluginFigureTable,\n} from '../plugin-manager/plugin-figures'\n\n/**\n * THE WEEKLY SUMMARY (AGL-3867): the free Monday emails that say how a\n * workspace did the week before — one for each site that had something to\n * report, and an overview of the workspace that adds the sites up.\n *\n * They spend nothing. Every figure comes from a `plugin-figures` reader that\n * declares a `weeklySummary`, and that reader's owner says what its table\n * means as tiles and ranked rows, so each plugin's counting rules decide what\n * a figure is and nothing here names one. AI weekly insights (AGL-2915) are\n * the paid version that explains the figures, and stay opt-in because each\n * one spends the workspace's AI credits.\n *\n * This module is the period, the wording helpers the readers use, and both\n * emails' words and layout; the reads and the sends are\n * `@aglyn/tenant-data-admin/server/weekly-summary`. The layout is drawn as\n * email-safe tables with inline styles, in colors the caller resolves from\n * the email theme.\n */\n\n/** The key a person's switch is stored under in `users/{uid}.digestPrefs`; on until turned off. */\nexport const WEEKLY_SUMMARY_DIGEST_KEY = 'weeklySummary'\n\n/** The window every figure is read over. */\nexport const WEEKLY_SUMMARY_DAYS = 7\n\n/** Rows a ranked list names. */\nexport const WEEKLY_SUMMARY_TOP_ROWS = 5\n\n/** Counts a subject line or the overview's tiles lead with, at most. */\nexport const WEEKLY_SUMMARY_HEADLINE_COUNTS = 3\n\n/** Tiles in one row of an email. */\nconst TILES_PER_ROW = 3\n\n/**\n * The week a run reports on: the seven whole UTC days before the day it runs,\n * so a Monday run covers Monday to Sunday and never a part-day of today.\n * `now` is what each reader is handed; `week` keys the run's marker.\n */\nexport function weeklySummaryPeriod(runAt: Date): {\n now: Date\n week: string\n from: string\n to: string\n label: string\n} {\n const startOfToday = Date.UTC(runAt.getUTCFullYear(), runAt.getUTCMonth(), runAt.getUTCDate())\n const now = new Date(startOfToday - 1)\n const { current } = pluginFigureWindows(now, WEEKLY_SUMMARY_DAYS)\n return {\n now,\n week: pluginFigureIsoWeek(now),\n from: current.from,\n to: current.to,\n label: `${weeklySummaryDay(current.from)} – ${weeklySummaryDay(current.to)}`,\n }\n}\n\n/** `2026-10-05` as \"Oct 5\". */\nexport function weeklySummaryDay(day: string): string {\n const at = new Date(`${day}T00:00:00Z`)\n return at.toLocaleDateString('en-US', { month: 'short', day: 'numeric', timeZone: 'UTC' })\n}\n\n/** `2026-10-26` as \"Mon, Oct 26\". */\nexport function weeklySummaryWeekday(day: string): string {\n const at = new Date(`${day}T00:00:00Z`)\n return at.toLocaleDateString('en-US', { weekday: 'short', month: 'short', day: 'numeric', timeZone: 'UTC' })\n}\n\nconst ISO_DAY = /\\b\\d{4}-\\d{2}-\\d{2}\\b/g\n\n/**\n * A sentence's dates as a person says them: \"Monday 2026-10-26\" as \"Monday,\n * Oct 26\". Tables hand the model their dates in ISO form, and it copies them.\n */\nexport function weeklySummaryPlainDates(text: string): string {\n const said = (day: string) => {\n const words = weeklySummaryDay(day)\n return words === 'Invalid Date' ? day : words\n }\n return text\n .replace(/\\b((?:Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day),? (\\d{4}-\\d{2}-\\d{2})\\b/g, (_, weekday: string, day: string) => `${weekday}, ${said(day)}`)\n .replace(ISO_DAY, said)\n}\n\n// ── Helpers the readers word their parts with ──────────────────────────────\n\n/** A cell as a number, `0` for anything that is not one. */\nexport function figureCount(value: PluginFigureCell | undefined): number {\n return typeof value === 'number' && Number.isFinite(value) ? value : 0\n}\n\n/** The row whose `key` cell is `label`: \"Visitors\" in a table of figures. */\nexport function figureRow(table: PluginFigureTable, key: string, label: string): PluginFigureRow | undefined {\n return table.rows.find((row) => row[key] === label)\n}\n\n/** Whether a table carries a column, so a reader that changed shape is noticed rather than misread. */\nexport function figureHasColumn(table: PluginFigureTable, key: string): boolean {\n return table.columns.some((column) => column.key === key)\n}\n\n/** A cell as a tile, with its change when the table has one. */\nexport function figureStat(\n table: PluginFigureTable,\n row: PluginFigureRow,\n key: string,\n label: string,\n options: { change?: string; total?: { one: string; many: string } } = {},\n): PluginFigureSummaryStat {\n const change = options.change ? row[options.change] : undefined\n return {\n label,\n value: pluginFigureCellText(table, key, row[key] ?? 0),\n ...(typeof change === 'number' ? { change } : {}),\n ...(options.total ? { total: { count: figureCount(row[key]), ...options.total } } : {}),\n }\n}\n\n/** The named rows with the most of `key`, as ranked rows; `[]` when none has any. */\nexport function figureRanked(\n table: PluginFigureTable,\n nameKey: string,\n key: string,\n rows: readonly PluginFigureRow[] = table.rows,\n): Array<{ label: string; value: string }> {\n return rows\n .filter((row) => typeof row[nameKey] === 'string' && figureCount(row[key]) > 0)\n .slice(0, WEEKLY_SUMMARY_TOP_ROWS)\n .map((row) => ({ label: String(row[nameKey]), value: pluginFigureCellText(table, key, row[key] ?? 0) }))\n}\n\n/** \"1 order\", \"18 orders\". */\nexport function figurePlural(count: number, one: string, many: string): string {\n return `${count.toLocaleString('en-US')} ${count === 1 ? one : many}`\n}\n\n// ── The emails ─────────────────────────────────────────────────────────────\n\n/** One site's figures for the week. */\nexport interface WeeklySummarySite {\n name: string\n /** The site's dashboard in the console, absolute; `null` with no origin to build it from. */\n url: string | null\n /**\n * Where the site itself is, so a reader knows which site this is: its\n * custom domain when it serves on one, else its platform address. `null`\n * for a site with no address yet.\n */\n address?: { label: string; url: string } | null\n parts: readonly PluginFigureSummaryPart[]\n}\n\n/** The colors an email is drawn in, resolved from its theme by the caller. */\nexport interface WeeklySummaryColors {\n text: string\n muted: string\n border: string\n /** A tile's ground. */\n surface: string\n /** The accent rule beside a callout. */\n accent: string\n /** Links: the email theme's own link color, the one every other link in the email wears. */\n link: string\n /** A rise and a fall. */\n up: string\n down: string\n}\n\n/** A site with anything to say. */\nexport function weeklySummaryHasNews(site: Pick<WeeklySummarySite, 'parts'>): boolean {\n return site.parts.length > 0\n}\n\n/** The counts the readers offered for adding up, summed by noun, in the order they were first given. */\nexport function weeklySummaryTotals(\n sites: ReadonlyArray<Pick<WeeklySummarySite, 'parts'>>,\n): Array<{ count: number; one: string; many: string }> {\n const sums = new Map<string, { count: number; one: string; many: string }>()\n for (const site of sites) {\n for (const part of site.parts) {\n for (const stat of part.stats ?? []) {\n if (!stat.total || stat.total.count <= 0) continue\n const sum = sums.get(stat.total.one)\n sums.set(stat.total.one, sum ? { ...sum, count: sum.count + stat.total.count } : { ...stat.total })\n }\n }\n }\n return [...sums.values()]\n}\n\nfunction headline(sites: ReadonlyArray<Pick<WeeklySummarySite, 'parts'>>): string {\n return weeklySummaryTotals(sites)\n .slice(0, WEEKLY_SUMMARY_HEADLINE_COUNTS)\n .map(({ count, one, many }) => figurePlural(count, one, many))\n .join(', ')\n}\n\n/** \"+12.5%\", \"−27.9%\", \"no change\"; `null` with nothing to compare with. */\nexport function weeklySummaryChange(change: number | null | undefined): { text: string; sign: 1 | -1 | 0 } | null {\n if (typeof change !== 'number' || !Number.isFinite(change)) return null\n if (change === 0) return { text: 'no change', sign: 0 }\n const amount = Math.abs(change).toLocaleString('en-US', { maximumFractionDigits: 1 })\n return change > 0 ? { text: `+${amount}%`, sign: 1 } : { text: `−${amount}%`, sign: -1 }\n}\n\nconst esc = (value: string): string =>\n value.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;')\n\nconst FONT = 'Helvetica, Arial, sans-serif'\n\nconst capitalized = (value: string): string => value.charAt(0).toUpperCase() + value.slice(1)\n\n/**\n * A label that reads like an address — `www.google.com` — kept from being\n * turned into a link by the inbox, which would draw it in the inbox's own\n * blue beside the theme's links. A zero-width space after each dot breaks\n * the detection and nothing a reader sees.\n */\nconst unlinked = (value: string): string => esc(value).replace(/\\./g, '.\\u200b')\n\nfunction changeHtml(change: number | null | undefined, colors: WeeklySummaryColors): string {\n const said = weeklySummaryChange(change)\n if (!said) return ''\n const color = said.sign > 0 ? colors.up : said.sign < 0 ? colors.down : colors.muted\n const arrow = said.sign > 0 ? '▲ ' : said.sign < 0 ? '▼ ' : ''\n return `<div style=\"font-family:${FONT};font-size:13px;line-height:1.4;font-weight:600;color:${color};\">${arrow}${esc(said.text)}</div>`\n}\n\n/**\n * How many tiles share each row: one row of up to three, two rows of two for\n * four, then rows of three — so a row is never left with an empty slot\n * beside two tiles.\n */\nexport function weeklySummaryTileRows(count: number): number[] {\n if (count <= 0) return []\n if (count <= TILES_PER_ROW) return [count]\n if (count === 4) return [2, 2]\n const rows: number[] = []\n for (let left = count; left > 0; left -= TILES_PER_ROW) rows.push(Math.min(TILES_PER_ROW, left))\n return rows\n}\n\n/** The gap between tiles, across and down. */\nconst TILE_GAP_PX = 8\n\n/** A cell that is only a gap: nothing in it may hold it open. */\nconst TILE_GAP = 'font-size:0;line-height:0;padding:0;'\n\n/**\n * Tiles, each a value, its label and its change, filling the width of their\n * row. The tile is the table cell itself, so a row's tiles are one height\n * whichever of them wraps, in every mail client; the gaps are cells of their own.\n */\nfunction tilesHtml(stats: readonly PluginFigureSummaryStat[], colors: WeeklySummaryColors): string {\n const sizes = weeklySummaryTileRows(stats.length)\n const rows: string[] = []\n let at = 0\n sizes.forEach((size) => {\n const cells = stats.slice(at, at + size)\n at += size\n // A tile alone takes half the row, not all of it, so it reads as a tile.\n const columns = Math.max(size, 2)\n const width = `${Math.floor(100 / columns)}%`\n const tds: string[] = []\n for (let index = 0; index < columns; index += 1) {\n if (index > 0) tds.push(`<td style=\"width:${TILE_GAP_PX}px;${TILE_GAP}\">&nbsp;</td>`)\n const stat = cells[index]\n tds.push(\n stat\n ? `<td style=\"width:${width};background-color:${colors.surface};border:1px solid ${colors.border};border-radius:8px;padding:12px 14px;vertical-align:top;\">` +\n `<div style=\"font-family:${FONT};font-size:24px;line-height:1.2;font-weight:700;color:${colors.text};\">${esc(stat.value)}</div>` +\n `<div style=\"font-family:${FONT};font-size:13px;line-height:1.4;color:${colors.muted};\">${esc(stat.label)}</div>` +\n changeHtml(stat.change, colors) +\n `</td>`\n : `<td style=\"width:${width};\"></td>`,\n )\n }\n rows.push(`<tr>${tds.join('')}</tr>`)\n rows.push(`<tr><td colspan=\"${columns * 2 - 1}\" style=\"height:${TILE_GAP_PX}px;${TILE_GAP}\">&nbsp;</td></tr>`)\n })\n return `<table role=\"presentation\" style=\"width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed;\">${rows.join('')}</table>`\n}\n\n/** A ranked list: the label left, its figure right, a hairline between. */\nfunction rowsHtml(rows: ReadonlyArray<{ label: string; value: string }>, colors: WeeklySummaryColors): string {\n const trs = rows.map(\n (row, index) =>\n `<tr>` +\n `<td style=\"font-family:${FONT};font-size:14px;line-height:1.4;color:${colors.text};padding:8px 12px 8px 0;` +\n `${index < rows.length - 1 ? `border-bottom:1px solid ${colors.border};` : ''}word-break:break-word;\">${unlinked(row.label)}</td>` +\n `<td style=\"font-family:${FONT};font-size:14px;line-height:1.4;font-weight:600;color:${colors.text};padding:8px 0;text-align:right;white-space:nowrap;` +\n `${index < rows.length - 1 ? `border-bottom:1px solid ${colors.border};` : ''}\">${esc(row.value)}</td>` +\n `</tr>`,\n )\n return `<table role=\"presentation\" style=\"width:100%;border-collapse:collapse;\">${trs.join('')}</table>`\n}\n\nfunction sectionTitleHtml(title: string, colors: WeeklySummaryColors): string {\n return (\n `<div style=\"font-family:${FONT};font-size:12px;line-height:1.4;font-weight:700;letter-spacing:0.06em;` +\n `text-transform:uppercase;color:${colors.muted};padding:0 0 8px;\">${esc(title)}</div>`\n )\n}\n\n/** A figure in a sentence: a count, a sum or a percent, never the digits in a path or a date. */\nconst FIGURE =\n /(?<![\\p{L}\\p{N}_./-])(?<!(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) )[+\\-−]?[$€£¥]?(?:\\d{1,3}(?:,\\d{3})+|\\d+)(?:\\.\\d+)?%?(?![\\p{L}\\p{N}_/-])/gu\n\n/** A sentence with its figures in bold, so an eye running down the email lands on them. */\nfunction figuresHtml(text: string, colors: WeeklySummaryColors): string {\n let html = ''\n let at = 0\n for (const match of text.matchAll(FIGURE)) {\n html += `${unlinked(text.slice(at, match.index))}<strong style=\"font-weight:700;color:${colors.text};\">${esc(match[0])}</strong>`\n at = match.index + match[0].length\n }\n return html + unlinked(text.slice(at))\n}\n\n/** A figure a digest section lists: a page and its views. */\nexport interface WeeklySummarySectionRow {\n label: string\n /** Where the label goes: the page itself. */\n url?: string | null\n value: string\n change?: number | null\n}\n\n/** One day of a section's chart; `marked` when it is a day the section is about. */\nexport interface WeeklySummarySectionBar {\n label: string\n value: number\n /** The value as a person reads it. */\n display: string\n marked: boolean\n}\n\n/** One topic of an AI digest, told once: what stood out, and the figures behind it. */\nexport interface WeeklySummarySection {\n title: string\n /** Where the figures can be seen in full. */\n link?: { label: string; url: string } | null\n /** What was said about it: a line to scan and, if it needs one, the sentence behind it. */\n points: ReadonlyArray<{ headline: string | null; text: string | null }>\n rows?: readonly WeeklySummarySectionRow[]\n bars?: readonly WeeklySummarySectionBar[]\n}\n\n/** Tiles on their own, for an email that leads with its headline figures. */\nexport function weeklySummaryTilesHtml(stats: readonly PluginFigureSummaryStat[], colors: WeeklySummaryColors): string {\n return stats.length ? `<div style=\"padding:12px 0 8px;\">${tilesHtml(stats, colors)}</div>` : ''\n}\n\nfunction sectionRowsHtml(rows: readonly WeeklySummarySectionRow[], colors: WeeklySummaryColors): string {\n const cell = `font-family:${FONT};font-size:14px;line-height:1.4;padding:7px 0;`\n // No column for a change no row has, so the figures reach the edge.\n const changes = rows.some((row) => weeklySummaryChange(row.change))\n const trs = rows.map((row, index) => {\n const border = index > 0 ? `border-top:1px solid ${colors.border};` : ''\n const label = row.url\n ? `<a href=\"${esc(row.url)}\" style=\"color:${colors.link};text-decoration:none;font-weight:600;\">${unlinked(row.label)}</a>`\n : unlinked(row.label)\n return (\n `<tr>` +\n `<td style=\"${cell}${border}color:${colors.text};word-break:break-word;\">${label}</td>` +\n `<td style=\"${cell}${border}color:${colors.text};font-weight:600;padding-left:12px;text-align:right;white-space:nowrap;\">${esc(row.value)}</td>` +\n (changes\n ? `<td style=\"${cell}${border}padding-left:12px;text-align:right;white-space:nowrap;\">${changeHtml(row.change, colors)}</td>`\n : '') +\n `</tr>`\n )\n })\n return `<table role=\"presentation\" style=\"width:100%;border-collapse:collapse;margin-top:8px;\">${trs.join('')}</table>`\n}\n\n/** Horizontal bars, drawn in table cells so every mail client keeps them. */\nfunction sectionBarsHtml(bars: readonly WeeklySummarySectionBar[], colors: WeeklySummaryColors): string {\n const most = Math.max(...bars.map((bar) => bar.value), 1)\n const trs = bars.map((bar) => {\n const text = `font-family:${FONT};font-size:13px;line-height:1.3;color:${bar.marked ? colors.text : colors.muted};white-space:nowrap;`\n const weight = bar.marked ? 'font-weight:700;' : ''\n return (\n `<tr>` +\n `<td style=\"${text}${weight}padding:3px 10px 3px 0;width:1%;\">${esc(bar.label)}</td>` +\n `<td style=\"padding:3px 0;\"><div style=\"background-color:${bar.marked ? colors.accent : colors.border};border-radius:2px;font-size:0;height:10px;line-height:0;width:${Math.max(1, Math.round((bar.value / most) * 100))}%;\">&nbsp;</div></td>` +\n `<td style=\"${text}${weight}padding:3px 0 3px 10px;text-align:right;width:1%;\">${esc(bar.display)}</td>` +\n `</tr>`\n )\n })\n return `<table role=\"presentation\" style=\"width:100%;border-collapse:collapse;margin-top:8px;\">${trs.join('')}</table>`\n}\n\nfunction sectionHtml(section: WeeklySummarySection, colors: WeeklySummaryColors, first: boolean): string {\n const link = section.link\n ? `<td style=\"padding:0;text-align:right;vertical-align:baseline;white-space:nowrap;\">` +\n `<a href=\"${esc(section.link.url)}\" style=\"font-family:${FONT};font-size:13px;line-height:1.4;font-weight:600;color:${colors.link};text-decoration:none;\">${esc(section.link.label)}&nbsp;→</a>` +\n `</td>`\n : ''\n const points = section.points.map(\n (point) =>\n `<div style=\"padding:6px 0 0;\">` +\n (point.headline\n ? `<div style=\"font-family:${FONT};font-size:16px;line-height:1.35;font-weight:700;color:${colors.text};\">${unlinked(point.headline)}</div>`\n : '') +\n (point.text\n ? `<div style=\"font-family:${FONT};font-size:14px;line-height:1.5;color:${colors.muted};\">${figuresHtml(point.text, colors)}</div>`\n : '') +\n `</div>`,\n )\n return (\n `<div style=\"padding:${first ? '8px' : '18px'} 0 18px;${first ? '' : `border-top:1px solid ${colors.border};`}\">` +\n `<table role=\"presentation\" style=\"width:100%;border-collapse:collapse;\"><tr>` +\n `<td style=\"font-family:${FONT};font-size:12px;line-height:1.4;font-weight:700;letter-spacing:0.06em;text-transform:uppercase;color:${colors.muted};padding:0;\">${esc(section.title)}</td>` +\n link +\n `</tr></table>` +\n points.join('') +\n (section.rows?.length ? sectionRowsHtml(section.rows, colors) : '') +\n (section.bars?.length ? sectionBarsHtml(section.bars, colors) : '') +\n `</div>`\n )\n}\n\n/** An AI digest's topics, a hairline between them. */\nexport function weeklySummarySectionsHtml(sections: readonly WeeklySummarySection[], colors: WeeklySummaryColors): string {\n return sections.map((section, index) => sectionHtml(section, colors, index === 0)).join('')\n}\n\n/** The small print under the button, with its one link. */\nexport function weeklySummaryFootnoteHtml(\n text: string,\n link: { label: string; url: string } | null,\n colors: WeeklySummaryColors,\n): string {\n return (\n `<div style=\"font-family:${FONT};font-size:12px;line-height:1.5;color:${colors.muted};padding:12px 0 0;\">` +\n esc(text) +\n (link ? ` <a href=\"${esc(link.url)}\" style=\"color:${colors.link};text-decoration:underline;\">${esc(link.label)}</a>` : '') +\n `</div>`\n )\n}\n\nfunction partHtml(part: PluginFigureSummaryPart, colors: WeeklySummaryColors): string {\n return (\n `<div style=\"padding:16px 0 8px;\">` +\n sectionTitleHtml(part.title, colors) +\n (part.note\n ? `<div style=\"font-family:${FONT};font-size:13px;line-height:1.5;color:${colors.muted};padding:0 0 8px;\">${esc(part.note)}</div>`\n : '') +\n (part.stats?.length ? tilesHtml(part.stats, colors) : '') +\n (part.rows?.length ? rowsHtml(part.rows, colors) : '') +\n `</div>`\n )\n}\n\n/** \"aglyn.com · Aglyn LLC\": which site, linked, and whose. */\nfunction addressHtml(site: WeeklySummarySite, workspaceName: string, colors: WeeklySummaryColors): string {\n const address = site.address\n ? `<a href=\"${esc(site.address.url)}\" style=\"color:${colors.link};text-decoration:underline;font-weight:600;\">${esc(site.address.label)}</a>`\n : `<span style=\"font-weight:600;\">${esc(site.name)}</span>`\n return (\n `<div style=\"font-family:${FONT};font-size:14px;line-height:1.5;color:${colors.muted};padding:0 0 4px;\">` +\n `${address} · ${esc(workspaceName)}</div>`\n )\n}\n\nfunction insightsHtml(url: string, colors: WeeklySummaryColors): string {\n return (\n `<div style=\"margin:16px 0 0;background-color:${colors.surface};border-left:3px solid ${colors.accent};border-radius:4px;padding:14px 16px;\">` +\n `<div style=\"font-family:${FONT};font-size:14px;line-height:1.5;font-weight:700;color:${colors.text};\">Want to know why the numbers moved?</div>` +\n `<div style=\"font-family:${FONT};font-size:14px;line-height:1.5;color:${colors.text};\">` +\n `AI weekly insights explain each site's week in a few plain sentences. ` +\n `<a href=\"${esc(url)}\" style=\"color:${colors.link};text-decoration:underline;\">Turn them on from Ask about your numbers</a>.` +\n `</div></div>`\n )\n}\n\nfunction partText(part: PluginFigureSummaryPart): string[] {\n const lines = [part.title.toUpperCase()]\n if (part.note) lines.push(part.note)\n for (const stat of part.stats ?? []) {\n const said = weeklySummaryChange(stat.change)\n lines.push(`${stat.label}: ${stat.value}${said ? ` (${said.text})` : ''}`)\n }\n for (const row of part.rows ?? []) lines.push(`- ${row.label}: ${row.value}`)\n return lines\n}\n\n/** What a send fills a weekly summary email's tokens with. */\nexport interface WeeklySummaryEmail {\n subject: string\n /** The heading: \"Aglyn last week\". */\n title: string\n /** \"Oct 5 – Oct 11, compared with the week before\". */\n period: string\n /** The figures, drawn. */\n html: string\n /** The whole email as plain text, closing line included. */\n text: string\n buttonLabel: string\n /** Where the button goes; `''` when there is no console origin to link to. */\n url: string\n}\n\ninterface CommonInput {\n workspaceName: string\n productName: string\n periodLabel: string\n colors: WeeklySummaryColors\n /** Where AI weekly insights are turned on, when the plan includes them and this person has not; else `null`. */\n aiInsightsUrl: string | null\n settingsUrl: string\n}\n\nfunction closing(input: CommonInput): string[] {\n return [\n '',\n `You get this summary because you manage ${input.workspaceName}. Turn it off in Notifications: ${input.settingsUrl}`,\n ]\n}\n\n/**\n * One site's email, or `null` for a site with nothing to report. `workspace`\n * carries the workspace's own parts when this site's email stands in for the\n * overview, in a workspace with one active site.\n */\nexport function composeWeeklySummarySiteEmail(\n input: CommonInput & { site: WeeklySummarySite; workspace?: readonly PluginFigureSummaryPart[] },\n): WeeklySummaryEmail | null {\n const workspace = input.workspace ?? []\n if (!weeklySummaryHasNews(input.site) && !workspace.length) return null\n const lead = headline([input.site])\n const subject = lead ? `${input.site.name} last week: ${lead}` : `${input.site.name} last week`\n const html =\n addressHtml(input.site, input.workspaceName, input.colors) +\n input.site.parts.map((part) => partHtml(part, input.colors)).join('') +\n (workspace.length\n ? `<div style=\"border-top:1px solid ${input.colors.border};margin:16px 0 0;\"></div>` +\n workspace.map((part) => partHtml({ ...part, title: `${input.workspaceName} · ${part.title}` }, input.colors)).join('')\n : '') +\n (input.aiInsightsUrl ? insightsHtml(input.aiInsightsUrl, input.colors) : '')\n const text = [\n `${input.site.name} last week, ${input.periodLabel}. A change in brackets is against the week before.`,\n `Site: ${input.site.address ? `${input.site.address.label} (${input.site.address.url})` : input.site.name} · ${input.workspaceName}`,\n ...input.site.parts.flatMap((part) => ['', ...partText(part)]),\n ...workspace.flatMap((part) => ['', ...partText({ ...part, title: `${input.workspaceName} · ${part.title}` })]),\n ...(input.site.url ? ['', `Open ${input.site.name} in ${input.productName}: ${input.site.url}`] : []),\n ...(input.aiInsightsUrl\n ? ['', `Want to know why the numbers moved? Turn on AI weekly insights from Ask about your numbers: ${input.aiInsightsUrl}`]\n : []),\n ...closing(input),\n ].join('\\n')\n return {\n subject,\n title: `${input.site.name} last week`,\n period: `${input.periodLabel}, compared with the week before`,\n html,\n text,\n buttonLabel: `Open ${input.site.name}`,\n url: input.site.url ?? '',\n }\n}\n\n/**\n * The workspace overview: the week's totals across its sites, a line for each\n * site, and the workspace's own figures, or `null` when nothing anywhere has\n * anything to report.\n */\nexport function composeWeeklySummaryOverviewEmail(\n input: CommonInput & {\n sites: readonly WeeklySummarySite[]\n workspace: readonly PluginFigureSummaryPart[]\n /** The workspace's home in the console, absolute; `''` with no origin. */\n url: string\n },\n): WeeklySummaryEmail | null {\n const active = input.sites.filter(weeklySummaryHasNews)\n if (!active.length && !input.workspace.length) return null\n const totals = weeklySummaryTotals(active)\n const lead = totals\n .slice(0, WEEKLY_SUMMARY_HEADLINE_COUNTS)\n .map(({ count, one, many }) => figurePlural(count, one, many))\n .join(', ')\n const subject = lead ? `Your week at ${input.workspaceName}: ${lead}` : `Your week at ${input.workspaceName}`\n const { colors } = input\n const totalsPart: PluginFigureSummaryPart | null = totals.length\n ? {\n title: active.length === 1 ? 'At a glance' : `Across ${active.length} sites`,\n stats: totals.slice(0, TILES_PER_ROW * 2).map(({ count, one, many }) => ({\n label: capitalized(count === 1 ? one : many),\n value: count.toLocaleString('en-US'),\n })),\n }\n : null\n const siteLine = (site: WeeklySummarySite): string =>\n site.parts\n .flatMap((part) => part.stats ?? [])\n .filter((stat) => stat.total && stat.total.count > 0)\n .slice(0, WEEKLY_SUMMARY_HEADLINE_COUNTS)\n .map((stat) => {\n const total = stat.total as NonNullable<PluginFigureSummaryStat['total']>\n const said = weeklySummaryChange(stat.change)\n return `${figurePlural(total.count, total.one, total.many)}${said ? ` (${said.text})` : ''}`\n })\n .join(' · ')\n const quietCount = input.sites.length - active.length\n const quiet = quietCount\n ? `${figurePlural(quietCount, 'other site', 'other sites')} had nothing to report.`\n : ''\n const sitesHtml = active.length\n ? `<div style=\"padding:16px 0 8px;\">` +\n sectionTitleHtml('Your sites', colors) +\n `<table role=\"presentation\" style=\"width:100%;border-collapse:collapse;\">` +\n active\n .map((site, index) => {\n const border = index < active.length - 1 ? `border-bottom:1px solid ${colors.border};` : ''\n const name = site.url\n ? `<a href=\"${esc(site.url)}\" style=\"color:${colors.link};text-decoration:none;font-weight:700;\">${esc(site.name)}</a>`\n : `<span style=\"font-weight:700;\">${esc(site.name)}</span>`\n const line = siteLine(site)\n const address = site.address\n ? ` <a href=\"${esc(site.address.url)}\" style=\"color:${colors.muted};text-decoration:underline;font-size:13px;font-weight:400;\">${esc(site.address.label)}</a>`\n : ''\n return (\n `<tr><td style=\"font-family:${FONT};font-size:15px;line-height:1.4;color:${colors.text};padding:10px 0;${border}\">` +\n name +\n address +\n (line ? `<div style=\"font-size:13px;line-height:1.5;color:${colors.muted};\">${esc(line)}</div>` : '') +\n `</td></tr>`\n )\n })\n .join('') +\n `</table>` +\n (quiet\n ? `<div style=\"font-family:${FONT};font-size:13px;line-height:1.5;color:${colors.muted};padding:4px 0 0;\">${esc(quiet)}</div>`\n : '') +\n `</div>`\n : ''\n const html =\n (totalsPart ? partHtml(totalsPart, colors) : '') +\n sitesHtml +\n input.workspace.map((part) => partHtml(part, colors)).join('') +\n (active.length > 1\n ? `<div style=\"font-family:${FONT};font-size:13px;line-height:1.5;color:${colors.muted};padding:8px 0 0;\">Each site's own summary arrives beside this one.</div>`\n : '') +\n (input.aiInsightsUrl ? insightsHtml(input.aiInsightsUrl, colors) : '')\n const text = [\n `Here is how ${input.workspaceName} did last week, ${input.periodLabel}. A change in brackets is against the week before.`,\n ...(totalsPart ? ['', ...partText(totalsPart)] : []),\n ...(active.length\n ? [\n '',\n 'YOUR SITES',\n ...active.map(\n (site) =>\n `- ${site.name}${site.address ? ` (${site.address.label})` : ''}: ${siteLine(site) || 'see its summary'}` +\n (site.url ? ` · ${site.url}` : ''),\n ),\n ...(quiet ? [quiet] : []),\n ]\n : []),\n ...input.workspace.flatMap((part) => ['', ...partText(part)]),\n ...(input.aiInsightsUrl\n ? ['', `Want to know why the numbers moved? Turn on AI weekly insights from Ask about your numbers: ${input.aiInsightsUrl}`]\n : []),\n ...closing(input),\n ].join('\\n')\n return {\n subject,\n title: `${input.workspaceName} last week`,\n period: `${input.periodLabel}, compared with the week before`,\n html,\n text,\n buttonLabel: `Open ${input.workspaceName}`,\n url: input.url,\n }\n}\n"],"names":["pluginFigureCellText","pluginFigureIsoWeek","pluginFigureWindows","WEEKLY_SUMMARY_DIGEST_KEY","WEEKLY_SUMMARY_DAYS","WEEKLY_SUMMARY_TOP_ROWS","WEEKLY_SUMMARY_HEADLINE_COUNTS","TILES_PER_ROW","weeklySummaryPeriod","runAt","startOfToday","Date","UTC","getUTCFullYear","getUTCMonth","getUTCDate","now","current","week","from","to","label","weeklySummaryDay","day","at","toLocaleDateString","month","timeZone","weeklySummaryWeekday","weekday","ISO_DAY","weeklySummaryPlainDates","text","said","words","replace","_","figureCount","value","Number","isFinite","figureRow","table","key","rows","find","row","figureHasColumn","columns","some","column","figureStat","options","change","undefined","total","count","figureRanked","nameKey","filter","slice","map","String","figurePlural","one","many","toLocaleString","weeklySummaryHasNews","site","parts","length","weeklySummaryTotals","sites","sums","Map","part","stat","stats","sum","get","set","values","headline","join","weeklySummaryChange","sign","amount","Math","abs","maximumFractionDigits","esc","FONT","capitalized","charAt","toUpperCase","unlinked","changeHtml","colors","color","up","down","muted","arrow","weeklySummaryTileRows","left","push","min","TILE_GAP_PX","TILE_GAP","tilesHtml","sizes","forEach","size","cells","max","width","floor","tds","index","surface","border","rowsHtml","trs","sectionTitleHtml","title","FIGURE","figuresHtml","html","match","matchAll","weeklySummaryTilesHtml","sectionRowsHtml","cell","changes","url","link","sectionBarsHtml","bars","most","bar","marked","weight","accent","round","display","sectionHtml","section","first","points","point","weeklySummarySectionsHtml","sections","weeklySummaryFootnoteHtml","partHtml","note","addressHtml","workspaceName","address","name","insightsHtml","partText","lines","closing","input","settingsUrl","composeWeeklySummarySiteEmail","workspace","lead","subject","aiInsightsUrl","periodLabel","flatMap","productName","period","buttonLabel","composeWeeklySummaryOverviewEmail","active","totals","totalsPart","site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MAAM,GACb;YACE;YACA;eACG0G,OAAOnH,GAAG,CACX,CAACO,OACC,CAAC,EAAE,EAAEA,KAAK0F,IAAI,GAAG1F,KAAKyF,OAAO,GAAG,CAAC,EAAE,EAAEzF,KAAKyF,OAAO,CAACxI,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE8J,SAAS/G,SAAS,mBAAmB,GACxGA,CAAAA,KAAKkE,GAAG,GAAG,CAAC,GAAG,EAAElE,KAAKkE,GAAG,EAAE,GAAG,EAAC;eAEhC+C,QAAQ;gBAACA;aAAM,GAAG,EAAE;SACzB,GACD,EAAE;WACHlB,MAAMG,SAAS,CAACK,OAAO,CAAC,CAAChG,OAAS;gBAAC;mBAAOqF,SAASrF;aAAM;WACxDwF,MAAMM,aAAa,GACnB;YAAC;YAAI,CAAC,4FAA4F,EAAEN,MAAMM,aAAa,EAAE;SAAC,GAC1H,EAAE;WACHP,QAAQC;KACZ,CAAChF,IAAI,CAAC;IACP,OAAO;QACLqF;QACA5C,OAAO,GAAGuC,MAAMP,aAAa,CAAC,UAAU,CAAC;QACzCiB,QAAQ,GAAGV,MAAMO,WAAW,CAAC,+BAA+B,CAAC;QAC7D3C;QACA/F;QACA8I,aAAa,CAAC,KAAK,EAAEX,MAAMP,aAAa,EAAE;QAC1CtB,KAAK6B,MAAM7B,GAAG;IAChB;AACF"}
@@ -1407,7 +1407,12 @@ export interface ConsoleClientBuildStart {
1407
1407
  * widget that does not publish a kind draws nothing for it.
1408
1408
  */
1409
1409
  export interface ConsolePublishableArtifact {
1410
- /** What the thing is: `layout`, `component`, `theme`, `site`, … */
1410
+ /**
1411
+ * What the thing is: `layout`, `component`, `theme`, `site`, … A whole
1412
+ * site as a site starter people create a new site from is `siteStarter`
1413
+ * (AGL-4049), with the `hostId` it is, and the site's name and description
1414
+ * to seed the listing.
1415
+ */
1411
1416
  kind: string;
1412
1417
  /** The site it belongs to, where the kind belongs to one. */
1413
1418
  hostId?: string | null;