@diafunc/cli 0.29.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -132,7 +132,7 @@ diafunc config set defaults.output json
132
132
  Most commands accept a compact entity reference instead of four separate arguments:
133
133
 
134
134
  ```bash
135
- # Just entity ID (uses default project + branch)
135
+ # Entity ID only (uses default project + branch)
136
136
  diafunc entity get my-table
137
137
 
138
138
  # Entity with branch override
@@ -189,7 +189,7 @@ Nothing is asked when stdin or stdout is not a terminal, with `--output json`, o
189
189
  | `diafunc auth` | Login (OIDC device-code or API token), logout, status, API token management |
190
190
  | `diafunc whoami` | Show the currently authenticated user |
191
191
  | `diafunc config` | Configuration and profile management |
192
- | `diafunc project` | Project CRUD (`create`/`update` take `--licence` for a public project), `recent`, `update`, lock/unlock, member management, and `tags get/add/remove/set` for the tags Explore and the search filter by (see [doc/tags.md](./doc/tags.md)) |
192
+ | `diafunc project` | Project CRUD (`create`/`update` take `--license` for a public project), `recent`, `update`, lock/unlock, member management, and `tags get/add/remove/set` for the tags Explore and the search filter by (see [doc/tags.md](./doc/tags.md)) |
193
193
  | `diafunc team` | Team management: `list`/`get`/`use`, `usage`, `create`, `portal`, `cancel`, `leave`, plus `members`, `invitations`, `seats`, `packs`, and `transfer` |
194
194
  | `diafunc entity` | Entity CRUD, content upload/download, history, revert, and `tags get/add/remove/set` (see [doc/tags.md](./doc/tags.md)) |
195
195
  | `diafunc entity-branch` | List and create parallel branches of a single entity |
@@ -197,15 +197,15 @@ Nothing is asked when stdin or stdout is not a terminal, with `--output json`, o
197
197
  | `diafunc event` | Create and manage events |
198
198
  | `diafunc branch` | Branch management, merge, fork |
199
199
  | `diafunc table` | View data, import CSV/Excel, export, row/column/cell operations |
200
- | `diafunc function` | Execute functions and develop them: `call`, `create`, `source get/set`, `edit` (opens `$EDITOR`), `evaluations`, `last-evaluation`, `outputs`, `logs`, `stop`, `engines` |
200
+ | `diafunc function` | Execute functions and develop them: `call`, `create`, `source get/set`, `edit` (opens `$EDITOR`), `evaluations`, `last-evaluation`, `outputs`, `logs`, `stop`, `languages` |
201
201
  | `diafunc shell` | Interactive REPL for evaluating function code (multi-line editor, language switching) |
202
202
  | `diafunc trigger` | Create, list, inspect, and delete function triggers |
203
203
  | `diafunc schedule` | Schedule function execution and list/stop scheduled runs |
204
204
  | `diafunc chat` | AI chat REPL (default), plus `send` / `stream` / `upload`, `usage`, and `session list/show/rename/delete` |
205
205
  | `diafunc search` | Search entities across projects; equally relevant results lead with the project whose model has the better quality, or the newest with `--sort newest` |
206
- | `diafunc analyze` | Run an automatic analysis on a data file and follow it live (interactive when run from a terminal), plus `list`, `get`, `watch`, `open`, `runs`, `cancel`, `upload`, `stop-import`, `visibility` (`--licence` to publish), `presets`, `triggers` (see [doc/analyze.md](./doc/analyze.md)) |
207
- | `diafunc public` | Read the analyses their owners made public, without signing in: `list` (paged, `--all`, `--changed-since`, with each one's licence) and `show` (see [doc/public.md](./doc/public.md)) |
208
- | `diafunc licence` | The licences a public project can be published under, without signing in: `list` and `show`; `project create`, `analyze` and `analyze visibility` take `--licence <id>` (see [doc/licences.md](./doc/licences.md)) |
206
+ | `diafunc analyze` | Run an automatic analysis on a data file and follow it live (interactive when run from a terminal), plus `list`, `get`, `watch`, `open`, `report` (the report as Markdown), `export-model` (the model as code or a formula), `runs`, `cancel`, `upload`, `stop-import`, `visibility` (`--license` to publish), `presets`, `triggers`, and your private notes with `intent` (read into proposals that apply only when you confirm them), `expectations`, `charts` and `focus` (see [doc/analyze.md](./doc/analyze.md)) |
207
+ | `diafunc public` | Read the analyses their owners made public, without signing in: `list` (paged, `--all`, `--changed-since`, with each one's license) and `show` (see [doc/public.md](./doc/public.md)) |
208
+ | `diafunc license` | The licenses a public project can be published under, without signing in: `list` and `show`; `project create`, `analyze` and `analyze visibility` take `--license <id>` (see [doc/licenses.md](./doc/licenses.md)) |
209
209
  | `diafunc subscription` | View your current and upcoming subscription, plus available plans |
210
210
  | `diafunc invoice` | List and download invoices |
211
211
  | `diafunc utilization` | Show current credit utilization, and with `history` what each day of the billing cycle cost |
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  EXIT_CANCELLED,
4
- PromptCancelled,
4
+ PromptCanceled,
5
5
  createProgram,
6
6
  handleError
7
- } from "../chunk-T7BPK4LW.js";
7
+ } from "../chunk-5AB7E3K4.js";
8
8
  import {
9
9
  getUpdateNotice
10
- } from "../chunk-Z5XCMRDG.js";
10
+ } from "../chunk-CL2LMFXH.js";
11
11
  import {
12
12
  package_default
13
- } from "../chunk-CWZPEFGN.js";
13
+ } from "../chunk-GZI6AECR.js";
14
14
 
15
15
  // bin/diafunc.ts
16
16
  import chalk2 from "chalk";
@@ -154,9 +154,9 @@ async function main() {
154
154
  try {
155
155
  await program.parseAsync(process.argv);
156
156
  } catch (error) {
157
- if (error instanceof PromptCancelled) {
157
+ if (error instanceof PromptCanceled) {
158
158
  console.log();
159
- console.log(chalk2.dim("Cancelled."));
159
+ console.log(chalk2.dim("Canceled."));
160
160
  process.exit(EXIT_CANCELLED);
161
161
  }
162
162
  handleError(error);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../bin/diafunc.ts","../../src/splash.ts","../../src/output/console.ts"],"sourcesContent":["import chalk from 'chalk';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { createProgram } from '../src/index.js';\nimport { showSplash } from '../src/splash.js';\nimport { getUpdateNotice } from '../src/util/update-check.js';\nimport { PromptCancelled } from '../src/prompting/prompter.js';\nimport { EXIT_CANCELLED, handleError } from '../src/util/errors.js';\nimport { routeConsoleThroughStreams } from '../src/output/console.js';\n\nrouteConsoleThroughStreams();\n\n// On Windows the installer renames the previous diafunc.exe to <path>.old (or\n// to <path>.<guid>.old if a prior .old still exists) since the running .exe\n// can't be replaced in place. Clean those up at startup. Best-effort — they\n// may still be locked by another running diafunc, in which case the next\n// launch picks them up.\nif (process.platform === 'win32') {\n try {\n const dir = path.dirname(process.execPath);\n for (const name of fs.readdirSync(dir)) {\n if (name.startsWith('diafunc.exe') && name.endsWith('.old')) {\n try { fs.unlinkSync(path.join(dir, name)); } catch {}\n }\n }\n } catch {}\n}\n\nif (process.argv.length <= 2 && process.stdout.isTTY) {\n showSplash();\n process.exit(0);\n}\n\nasync function main(): Promise<void> {\n const program = createProgram();\n // Kick off the update check in the background so it doesn't block real work.\n // It only does anything for TTY runs and is heavily cached, so the network\n // round-trip is rare; even when it fires, we wait at most a hair after the\n // command completes before printing.\n const noticePromise = getUpdateNotice();\n try {\n await program.parseAsync(process.argv);\n } catch (error) {\n // A prompt can be interrupted before any action runs (the missing-input questions are asked in\n // a hook), so the one outcome that is not an error is handled here, once, for every command.\n if (error instanceof PromptCancelled) {\n console.log();\n console.log(chalk.dim('Cancelled.'));\n process.exit(EXIT_CANCELLED);\n }\n handleError(error);\n }\n try {\n const notice = await Promise.race([\n noticePromise,\n new Promise<null>((resolve) => setTimeout(() => resolve(null), 100)),\n ]);\n if (notice) console.error(chalk.dim(notice));\n } catch {}\n}\n\nmain();\n","import chalk from 'chalk';\nimport pkg from '../package.json' with { type: 'json' };\n\n// Diafunc gem logo rendered with a pixel mask + vertical gradient.\n//\n// The silhouette approximates app/src/assets/images/logos/icon.svg: flat top at\n// ~60% width, widening to shoulder points, tapering to a bottom tip.\n//\n// Each character cell packs two vertical pixels. By using ▀ with an independent\n// foreground (upper pixel) and background (lower pixel) color, we get 2×\n// vertical color resolution — enough for a smooth gradient across 14 pixel\n// rows in only 7 character rows. The gradient mirrors the SVG's linearGradient\n// stops: lighter at the top and bottom, darker in the middle (polished-gem\n// highlight effect).\n\n// 14 rows × 20 cols pixel mask. true = filled, false = empty.\n// Silhouette: flat top (60% wide), widening to shoulders (row 3, full width),\n// then tapering to a single-pixel tip.\nconst MASK: readonly (readonly boolean[])[] = [\n row(' ████████████ '), // 0 flat top\n row(' ██████████████ '), // 1\n row(' ██████████████████ '), // 2\n row('████████████████████'), // 3 shoulder (max width)\n row('████████████████████'), // 4 shoulder\n row(' ██████████████████ '), // 5\n row(' ████████████████ '), // 6\n row(' ██████████████ '), // 7\n row(' ████████████ '), // 8\n row(' ██████████ '), // 9\n row(' ████████ '), // 10\n row(' ██████ '), // 11\n row(' ████ '), // 12\n row(' ██ '), // 13 tip\n];\n\nfunction row(s: string): boolean[] {\n // Any non-space character counts as filled.\n return Array.from(s).map((c) => c !== ' ');\n}\n\n// Gradient endpoints: light blue from the SVG stops, dark blue in the middle.\nconst LIGHT: readonly [number, number, number] = [0x47, 0x75, 0xb8]; // #4775B8\nconst DARK: readonly [number, number, number] = [0x2d, 0x2d, 0x5d]; // #2D2D5D\n\nfunction gradientHex(pixelRow: number, pixelRows: number): string {\n // t = 0 at vertical center, 1 at top/bottom edges.\n const center = (pixelRows - 1) / 2;\n const t = Math.abs(pixelRow - center) / center;\n const r = Math.round(DARK[0] + (LIGHT[0] - DARK[0]) * t);\n const g = Math.round(DARK[1] + (LIGHT[1] - DARK[1]) * t);\n const b = Math.round(DARK[2] + (LIGHT[2] - DARK[2]) * t);\n return '#' + [r, g, b].map((v) => v.toString(16).padStart(2, '0')).join('');\n}\n\nfunction renderGem(): string[] {\n const pixelRows = MASK.length;\n const cols = MASK[0].length;\n const charRows = pixelRows / 2;\n const lines: string[] = [];\n\n for (let c = 0; c < charRows; c++) {\n let line = '';\n for (let x = 0; x < cols; x++) {\n const top = MASK[2 * c][x];\n const bot = MASK[2 * c + 1][x];\n const topHex = gradientHex(2 * c, pixelRows);\n const botHex = gradientHex(2 * c + 1, pixelRows);\n\n if (top && bot) {\n line += chalk.hex(topHex).bgHex(botHex)('▀');\n } else if (top) {\n line += chalk.hex(topHex)('▀');\n } else if (bot) {\n line += chalk.hex(botHex)('▄');\n } else {\n line += ' ';\n }\n }\n lines.push(line);\n }\n return lines;\n}\n\n// \"Diafunc\" in figlet \"standard\" font, rendered in a single brand color\n// alongside the gem (a gradient on thin text glyphs would look noisy).\nconst WORDMARK: readonly string[] = [\n ' ____ _ __ ',\n '| _ \\\\(_) __ _ / _|_ _ _ __ ___ ',\n \"| | | | |/ _` | |_| | | | '_ \\\\ / __|\",\n '| |_| | | (_| | _| |_| | | | | (__ ',\n '|____/|_|\\\\__,_|_| \\\\__,_|_| |_|\\\\___|',\n];\n\nconst GAP = ' ';\n\nexport function showSplash(): void {\n const brand = chalk.hex('#4775B8');\n const gem = renderGem();\n\n // Center the 5-row wordmark vertically against the 7-row gem.\n const wordmarkOffset = Math.floor((gem.length - WORDMARK.length) / 2);\n\n console.log();\n for (let i = 0; i < gem.length; i++) {\n const w = i - wordmarkOffset;\n const text = w >= 0 && w < WORDMARK.length ? WORDMARK[w] : '';\n console.log(gem[i] + GAP + brand.bold(text));\n }\n console.log();\n console.log(\n ' ' +\n chalk.bold('CLI') +\n chalk.dim(` v${pkg.version}`) +\n chalk.dim(' · https://diafunc.com'),\n );\n console.log();\n console.log(\n chalk.dim(\" Run 'diafunc --help' for usage, or 'diafunc auth login' to get started.\"),\n );\n console.log();\n}\n","import { format } from 'node:util';\n\n/**\n * Sends `console.log` and `console.error` through the process streams.\n *\n * The released binary is compiled with Bun. There, once `process.stdout` has been touched (asking\n * whether it is a terminal is enough), a `console.log` larger than a pipe's buffer is cut at exactly\n * 65,536 bytes when the output goes to a pipe: `diafunc analyze list -o json | jq` received the first\n * 64 KiB of a 140 KiB document and failed on the cut-off JSON, while the same command into a file\n * was complete. A write through the stream itself waits for the pipe and loses nothing, so every\n * line the CLI prints takes that way. Formatting is `util.format`, which is what `console.log` uses.\n */\nexport function routeConsoleThroughStreams(): void {\n console.log = (...args: unknown[]): void => {\n process.stdout.write(format(...args) + '\\n');\n };\n console.error = (...args: unknown[]): void => {\n process.stderr.write(format(...args) + '\\n');\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,YAAW;AAClB,YAAY,QAAQ;AACpB,YAAY,UAAU;;;ACFtB,OAAO,WAAW;AAkBlB,IAAM,OAAwC;AAAA,E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MAAM,QAAQ,KAAK;AAAA,MAChC;AAAA,MACA,IAAI,QAAc,CAAC,YAAY,WAAW,MAAM,QAAQ,IAAI,GAAG,GAAG,CAAC;AAAA,IACrE,CAAC;AACD,QAAI,OAAQ,SAAQ,MAAMA,OAAM,IAAI,MAAM,CAAC;AAAA,EAC7C,QAAQ;AAAA,EAAC;AACX;AAEA,KAAK;","names":["chalk","chalk"]}
1
+ {"version":3,"sources":["../../bin/diafunc.ts","../../src/splash.ts","../../src/output/console.ts"],"sourcesContent":["import chalk from 'chalk';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { createProgram } from '../src/index.js';\nimport { showSplash } from '../src/splash.js';\nimport { getUpdateNotice } from '../src/util/update-check.js';\nimport { PromptCanceled } from '../src/prompting/prompter.js';\nimport { EXIT_CANCELLED, handleError } from '../src/util/errors.js';\nimport { routeConsoleThroughStreams } from '../src/output/console.js';\n\nrouteConsoleThroughStreams();\n\n// On Windows the installer renames the previous diafunc.exe to <path>.old (or\n// to <path>.<guid>.old if a prior .old still exists) since the running .exe\n// can't be replaced in place. Clean those up at startup. Best-effort — they\n// may still be locked by another running diafunc, in which case the next\n// launch picks them up.\nif (process.platform === 'win32') {\n try {\n const dir = path.dirname(process.execPath);\n for (const name of fs.readdirSync(dir)) {\n if (name.startsWith('diafunc.exe') && name.endsWith('.old')) {\n try { fs.unlinkSync(path.join(dir, name)); } catch {}\n }\n }\n } catch {}\n}\n\nif (process.argv.length <= 2 && process.stdout.isTTY) {\n showSplash();\n process.exit(0);\n}\n\nasync function main(): Promise<void> {\n const program = createProgram();\n // Kick off the update check in the background so it doesn't block real work.\n // It only does anything for TTY runs and is heavily cached, so the network\n // round-trip is rare; even when it fires, we wait at most a hair after the\n // command completes before printing.\n const noticePromise = getUpdateNotice();\n try {\n await program.parseAsync(process.argv);\n } catch (error) {\n // A prompt can be interrupted before any action runs (the missing-input questions are asked in\n // a hook), so the one outcome that is not an error is handled here, once, for every command.\n if (error instanceof PromptCanceled) {\n console.log();\n console.log(chalk.dim('Canceled.'));\n process.exit(EXIT_CANCELLED);\n }\n handleError(error);\n }\n try {\n const notice = await Promise.race([\n noticePromise,\n new Promise<null>((resolve) => setTimeout(() => resolve(null), 100)),\n ]);\n if (notice) console.error(chalk.dim(notice));\n } catch {}\n}\n\nmain();\n","import chalk from 'chalk';\nimport pkg from '../package.json' with { type: 'json' };\n\n// Diafunc gem logo rendered with a pixel mask + vertical gradient.\n//\n// The silhouette approximates app/src/assets/images/logos/icon.svg: flat top at\n// ~60% width, widening to shoulder points, tapering to a bottom tip.\n//\n// Each character cell packs two vertical pixels. By using ▀ with an independent\n// foreground (upper pixel) and background (lower pixel) color, we get 2×\n// vertical color resolution — enough for a smooth gradient across 14 pixel\n// rows in only 7 character rows. The gradient mirrors the SVG's linearGradient\n// stops: lighter at the top and bottom, darker in the middle (polished-gem\n// highlight effect).\n\n// 14 rows × 20 cols pixel mask. true = filled, false = empty.\n// Silhouette: flat top (60% wide), widening to shoulders (row 3, full width),\n// then tapering to a single-pixel tip.\nconst MASK: readonly (readonly boolean[])[] = [\n row(' ████████████ '), // 0 flat top\n row(' ██████████████ '), // 1\n row(' ██████████████████ '), // 2\n row('████████████████████'), // 3 shoulder (max width)\n row('████████████████████'), // 4 shoulder\n row(' ██████████████████ '), // 5\n row(' ████████████████ '), // 6\n row(' ██████████████ '), // 7\n row(' ████████████ '), // 8\n row(' ██████████ '), // 9\n row(' ████████ '), // 10\n row(' ██████ '), // 11\n row(' ████ '), // 12\n row(' ██ '), // 13 tip\n];\n\nfunction row(s: string): boolean[] {\n // Any non-space character counts as filled.\n return Array.from(s).map((c) => c !== ' ');\n}\n\n// Gradient endpoints: light blue from the SVG stops, dark blue in the middle.\nconst LIGHT: readonly [number, number, number] = [0x47, 0x75, 0xb8]; // #4775B8\nconst DARK: readonly [number, number, number] = [0x2d, 0x2d, 0x5d]; // #2D2D5D\n\nfunction gradientHex(pixelRow: number, pixelRows: number): string {\n // t = 0 at vertical center, 1 at top/bottom edges.\n const center = (pixelRows - 1) / 2;\n const t = Math.abs(pixelRow - center) / center;\n const r = Math.round(DARK[0] + (LIGHT[0] - DARK[0]) * t);\n const g = Math.round(DARK[1] + (LIGHT[1] - DARK[1]) * t);\n const b = Math.round(DARK[2] + (LIGHT[2] - DARK[2]) * t);\n return '#' + [r, g, b].map((v) => v.toString(16).padStart(2, '0')).join('');\n}\n\nfunction renderGem(): string[] {\n const pixelRows = MASK.length;\n const cols = MASK[0].length;\n const charRows = pixelRows / 2;\n const lines: string[] = [];\n\n for (let c = 0; c < charRows; c++) {\n let line = '';\n for (let x = 0; x < cols; x++) {\n const top = MASK[2 * c][x];\n const bot = MASK[2 * c + 1][x];\n const topHex = gradientHex(2 * c, pixelRows);\n const botHex = gradientHex(2 * c + 1, pixelRows);\n\n if (top && bot) {\n line += chalk.hex(topHex).bgHex(botHex)('▀');\n } else if (top) {\n line += chalk.hex(topHex)('▀');\n } else if (bot) {\n line += chalk.hex(botHex)('▄');\n } else {\n line += ' ';\n }\n }\n lines.push(line);\n }\n return lines;\n}\n\n// \"Diafunc\" in figlet \"standard\" font, rendered in a single brand color\n// alongside the gem (a gradient on thin text glyphs would look noisy).\nconst WORDMARK: readonly string[] = [\n ' ____ _ __ ',\n '| _ \\\\(_) __ _ / _|_ _ _ __ ___ ',\n \"| | | | |/ _` | |_| | | | '_ \\\\ / __|\",\n '| |_| | | (_| | _| |_| | | | | (__ ',\n '|____/|_|\\\\__,_|_| \\\\__,_|_| |_|\\\\___|',\n];\n\nconst GAP = ' ';\n\nexport function showSplash(): void {\n const brand = chalk.hex('#4775B8');\n const gem = renderGem();\n\n // Center the 5-row wordmark vertically against the 7-row gem.\n const wordmarkOffset = Math.floor((gem.length - WORDMARK.length) / 2);\n\n console.log();\n for (let i = 0; i < gem.length; i++) {\n const w = i - wordmarkOffset;\n const text = w >= 0 && w < WORDMARK.length ? WORDMARK[w] : '';\n console.log(gem[i] + GAP + brand.bold(text));\n }\n console.log();\n console.log(\n ' ' +\n chalk.bold('CLI') +\n chalk.dim(` v${pkg.version}`) +\n chalk.dim(' · https://diafunc.com'),\n );\n console.log();\n console.log(\n chalk.dim(\" Run 'diafunc --help' for usage, or 'diafunc auth login' to get started.\"),\n );\n console.log();\n}\n","import { format } from 'node:util';\n\n/**\n * Sends `console.log` and `console.error` through the process streams.\n *\n * The released binary is compiled with Bun. There, once `process.stdout` has been touched (asking\n * whether it is a terminal is enough), a `console.log` larger than a pipe's buffer is cut at exactly\n * 65,536 bytes when the output goes to a pipe: `diafunc analyze list -o json | jq` received the first\n * 64 KiB of a 140 KiB document and failed on the cut-off JSON, while the same command into a file\n * was complete. A write through the stream itself waits for the pipe and loses nothing, so every\n * line the CLI prints takes that way. Formatting is `util.format`, which is what `console.log` uses.\n */\nexport function routeConsoleThroughStreams(): void {\n console.log = (...args: unknown[]): void => {\n process.stdout.write(format(...args) + '\\n');\n };\n console.error = (...args: unknown[]): void => {\n process.stderr.write(format(...args) + '\\n');\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,OAAOA,YAAW;AAClB,YAAY,QAAQ;AACpB,YAAY,UAAU;;;ACFtB,OAAO,WAAW;AAkBlB,IAAM,OAAwC;AAAA,EAC5C,IAAI,kFAAsB;AAAA;AAAA,EAC1B,IAAI,4FAAsB;AAAA;AAAA,EAC1B,IAAI,gHAAsB;AAAA;AAAA,EAC1B,IAAI,0HAAsB;AAAA;AAAA,EAC1B,IAAI,0HAAsB;AAAA;AAAA,EAC1B,IAAI,gHAAsB;AAAA;AAAA,EAC1B,IAAI,sGAAsB;AAAA;AAAA,EAC1B,IAAI,4FAAsB;AAAA;AAAA,EAC1B,IAAI,kFAAsB;AAAA;AAAA,EAC1B,IAAI,wEAAsB;AAAA;AAAA,EAC1B,IAAI,8DAAsB;AAAA;AAAA,EAC1B,IAAI,oDAAsB;AAAA;AAAA,EAC1B,IAAI,0CAAsB;AAAA;AAAA,EAC1B,IAAI,gCAAsB;AAAA;AAC5B;AAEA,SAAS,IA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