@utilix-tech/sdk 0.88.0 → 0.90.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/dist/index.cjs CHANGED
@@ -2319,6 +2319,7 @@ __export(text_exports, {
2319
2319
  applyOps: () => applyOps,
2320
2320
  calculateStringDistance: () => calculateStringDistance,
2321
2321
  centerText: () => centerText,
2322
+ checkAcronymExpansion: () => checkAcronymExpansion,
2322
2323
  checkDashUsage: () => checkDashUsage,
2323
2324
  checkOxfordCommaConsistency: () => checkOxfordCommaConsistency,
2324
2325
  convertAll: () => convertAll,
@@ -5568,6 +5569,68 @@ function checkDashUsage(text) {
5568
5569
  issues
5569
5570
  };
5570
5571
  }
5572
+ var ACRONYM_TOKEN_RE = /\b[A-Z][A-Z0-9]{1,9}\b/g;
5573
+ var ACRONYM_IN_PARENS_RE = /\(([A-Z][A-Z0-9]{1,9})\)/g;
5574
+ var ACRONYM_THEN_EXPANSION_RE = /\b([A-Z][A-Z0-9]{1,9})\b\s*\(([a-zA-Z][^()]{1,100})\)/g;
5575
+ function acronymContextSnippet(text, index, matchLen) {
5576
+ const start = Math.max(0, index - 25);
5577
+ const end = Math.min(text.length, index + matchLen + 25);
5578
+ const body = text.slice(start, end).replace(/\s+/g, " ").trim();
5579
+ return (start > 0 ? "\u2026" : "") + body + (end < text.length ? "\u2026" : "");
5580
+ }
5581
+ function checkAcronymExpansion(text) {
5582
+ const definedAt = /* @__PURE__ */ new Map();
5583
+ for (const m of text.matchAll(ACRONYM_IN_PARENS_RE)) {
5584
+ const acronym = m[1];
5585
+ const idx = (m.index ?? 0) + 1;
5586
+ const existing = definedAt.get(acronym);
5587
+ if (existing === void 0 || idx < existing) definedAt.set(acronym, idx);
5588
+ }
5589
+ for (const m of text.matchAll(ACRONYM_THEN_EXPANSION_RE)) {
5590
+ const acronym = m[1];
5591
+ const idx = m.index ?? 0;
5592
+ const existing = definedAt.get(acronym);
5593
+ if (existing === void 0 || idx < existing) definedAt.set(acronym, idx);
5594
+ }
5595
+ const occurrencesByAcronym = /* @__PURE__ */ new Map();
5596
+ for (const m of text.matchAll(ACRONYM_TOKEN_RE)) {
5597
+ const acronym = m[0];
5598
+ const idx = m.index ?? 0;
5599
+ const list = occurrencesByAcronym.get(acronym);
5600
+ if (list) list.push(idx);
5601
+ else occurrencesByAcronym.set(acronym, [idx]);
5602
+ }
5603
+ const acronyms = [];
5604
+ const issues = [];
5605
+ for (const [acronym, indicesUnsorted] of occurrencesByAcronym) {
5606
+ const indices = [...indicesUnsorted].sort((a, b) => a - b);
5607
+ const firstUsedAt = indices[0];
5608
+ const expandedAt = definedAt.has(acronym) ? definedAt.get(acronym) : null;
5609
+ const earlyUse = expandedAt !== null ? indices.find((i) => i < expandedAt) : void 0;
5610
+ const usedBeforeExpansion = earlyUse !== void 0;
5611
+ acronyms.push({ acronym, occurrences: indices.length, firstUsedAt, expandedAt, usedBeforeExpansion });
5612
+ if (usedBeforeExpansion) {
5613
+ issues.push({
5614
+ type: "used-before-expansion",
5615
+ acronym,
5616
+ index: earlyUse,
5617
+ context: acronymContextSnippet(text, earlyUse, acronym.length),
5618
+ message: `"${acronym}" is used here before it's expanded later in the document (at character ${expandedAt}).`
5619
+ });
5620
+ } else if (expandedAt === null) {
5621
+ issues.push({
5622
+ type: "never-expanded",
5623
+ acronym,
5624
+ index: firstUsedAt,
5625
+ context: acronymContextSnippet(text, firstUsedAt, acronym.length),
5626
+ message: `"${acronym}" is never expanded anywhere in this document.`
5627
+ });
5628
+ }
5629
+ }
5630
+ acronyms.sort((a, b) => a.firstUsedAt - b.firstUsedAt);
5631
+ issues.sort((a, b) => a.index - b.index);
5632
+ return { acronyms, issues };
5633
+ }
5571
5634
 
5572
5635
  // src/tools/data.ts
5573
5636
  var data_exports = {};
@@ -5575,6 +5638,7 @@ __export(data_exports, {
5575
5638
  alignMarkdownTables: () => alignMarkdownTables,
5576
5639
  analyzeCaptionSpeed: () => analyzeCaptionSpeed,
5577
5640
  calculateMarkdownTaskListProgress: () => calculateMarkdownTaskListProgress,
5641
+ checkMarkdownInternalLinks: () => checkMarkdownInternalLinks,
5578
5642
  convertSubtitles: () => convertSubtitles,
5579
5643
  csvToJson: () => csvToJson2,
5580
5644
  csvToSqlInsert: () => csvToSqlInsert,
@@ -7226,6 +7290,63 @@ function validateMarkdownHeadingHierarchy(markdown) {
7226
7290
  });
7227
7291
  return { headings, issues, h1Count };
7228
7292
  }
7293
+ var ANCHOR_LINK_RE = /\[([^\]]*)\]\(#([^)\s]+)\)/g;
7294
+ function checkMarkdownInternalLinks(markdown) {
7295
+ if (typeof markdown !== "string" || markdown.trim() === "") {
7296
+ return { error: "markdown is required" };
7297
+ }
7298
+ const lines = markdown.replace(/\r\n/g, "\n").split("\n");
7299
+ const headings = [];
7300
+ const seen = /* @__PURE__ */ new Map();
7301
+ let inFence = false;
7302
+ let fenceMarker = "";
7303
+ for (let i = 0; i < lines.length; i++) {
7304
+ const line = lines[i];
7305
+ const fenceMatch = line.match(/^\s*(```+|~~~+)/);
7306
+ if (fenceMatch) {
7307
+ if (!inFence) {
7308
+ inFence = true;
7309
+ fenceMarker = fenceMatch[1][0];
7310
+ } else if (fenceMatch[1][0] === fenceMarker) {
7311
+ inFence = false;
7312
+ }
7313
+ continue;
7314
+ }
7315
+ if (inFence) continue;
7316
+ const headingMatch = line.match(/^(#{1,6})\s+(.+?)\s*#*\s*$/);
7317
+ if (!headingMatch) continue;
7318
+ const level = headingMatch[1].length;
7319
+ const text = stripInlineMarkdown(headingMatch[2]);
7320
+ if (text === "") continue;
7321
+ const slug = slugifyHeading(text, seen);
7322
+ headings.push({ level, text, slug, line: i + 1 });
7323
+ }
7324
+ const validSlugs = new Set(headings.map((h) => h.slug));
7325
+ const links = [];
7326
+ inFence = false;
7327
+ fenceMarker = "";
7328
+ for (let i = 0; i < lines.length; i++) {
7329
+ const line = lines[i];
7330
+ const fenceMatch = line.match(/^\s*(```+|~~~+)/);
7331
+ if (fenceMatch) {
7332
+ if (!inFence) {
7333
+ inFence = true;
7334
+ fenceMarker = fenceMatch[1][0];
7335
+ } else if (fenceMatch[1][0] === fenceMarker) {
7336
+ inFence = false;
7337
+ }
7338
+ continue;
7339
+ }
7340
+ if (inFence) continue;
7341
+ const re = new RegExp(ANCHOR_LINK_RE);
7342
+ let m;
7343
+ while ((m = re.exec(line)) !== null) {
7344
+ const target = m[2];
7345
+ links.push({ text: m[1], target, line: i + 1, valid: validSlugs.has(target) });
7346
+ }
7347
+ }
7348
+ return { headings, links, brokenLinks: links.filter((l) => !l.valid) };
7349
+ }
7229
7350
  function quoteSqlIdentifier(name, dialect) {
7230
7351
  if (dialect === "mysql") return "`" + name.replace(/`/g, "``") + "`";
7231
7352
  return '"' + name.replace(/"/g, '""') + '"';
@@ -9145,6 +9266,7 @@ __export(units_exports, {
9145
9266
  formatVwValue: () => formatVwValue,
9146
9267
  formatWithSeparator: () => formatWithSeparator,
9147
9268
  gcd: () => gcd,
9269
+ intersectSemverRanges: () => intersectSemverRanges,
9148
9270
  ipFromBinary: () => ipFromBinary,
9149
9271
  ipFromDecimal: () => ipFromDecimal,
9150
9272
  ipFromHex: () => ipFromHex,
@@ -10016,6 +10138,133 @@ function sortVersions(versions, order = "asc") {
10016
10138
  return order === "asc" ? cmp : -cmp;
10017
10139
  });
10018
10140
  }
10141
+ function tightenLower(a, b) {
10142
+ if (a.value === null) return b;
10143
+ if (b.value === null) return a;
10144
+ const cmp = compareVersionObjects(a.value, b.value);
10145
+ if (cmp > 0) return a;
10146
+ if (cmp < 0) return b;
10147
+ return { value: a.value, inclusive: a.inclusive && b.inclusive };
10148
+ }
10149
+ function tightenUpper(a, b) {
10150
+ if (a.value === null) return b;
10151
+ if (b.value === null) return a;
10152
+ const cmp = compareVersionObjects(a.value, b.value);
10153
+ if (cmp < 0) return a;
10154
+ if (cmp > 0) return b;
10155
+ return { value: a.value, inclusive: a.inclusive && b.inclusive };
10156
+ }
10157
+ function isValidInterval(lower, upper) {
10158
+ if (lower.value === null || upper.value === null) return true;
10159
+ const cmp = compareVersionObjects(lower.value, upper.value);
10160
+ if (cmp < 0) return true;
10161
+ if (cmp > 0) return false;
10162
+ return lower.inclusive && upper.inclusive;
10163
+ }
10164
+ function formatVersionBound(v) {
10165
+ let s = `${v.major}.${v.minor}.${v.patch}`;
10166
+ if (v.prerelease) s += `-${v.prerelease}`;
10167
+ if (v.build) s += `+${v.build}`;
10168
+ return s;
10169
+ }
10170
+ function intervalToRangeString(interval) {
10171
+ const { lower, upper } = interval;
10172
+ if (lower.value === null && upper.value === null) return "*";
10173
+ if (lower.value !== null && upper.value !== null) {
10174
+ const cmp = compareVersionObjects(lower.value, upper.value);
10175
+ if (cmp === 0 && lower.inclusive && upper.inclusive) return formatVersionBound(lower.value);
10176
+ }
10177
+ const parts = [];
10178
+ if (lower.value !== null) parts.push(`${lower.inclusive ? ">=" : ">"}${formatVersionBound(lower.value)}`);
10179
+ if (upper.value !== null) parts.push(`${upper.inclusive ? "<=" : "<"}${formatVersionBound(upper.value)}`);
10180
+ return parts.length ? parts.join(" ") : "*";
10181
+ }
10182
+ function parseSingleConstraintToInterval(range) {
10183
+ if (range === "*" || range === "") {
10184
+ return { lower: { value: null, inclusive: true }, upper: { value: null, inclusive: true } };
10185
+ }
10186
+ const caretMatch = range.match(/^\^v?(\d+)\.(\d+)\.(\d+)(?:-([a-zA-Z0-9._-]+))?$/);
10187
+ if (caretMatch) {
10188
+ const major = parseInt(caretMatch[1], 10);
10189
+ const minor = parseInt(caretMatch[2], 10);
10190
+ const patch = parseInt(caretMatch[3], 10);
10191
+ const pre = caretMatch[4];
10192
+ const lowerVal = { major, minor, patch, prerelease: pre, raw: range };
10193
+ let upperVal;
10194
+ if (major !== 0) upperVal = { major: major + 1, minor: 0, patch: 0, raw: "" };
10195
+ else if (minor !== 0) upperVal = { major: 0, minor: minor + 1, patch: 0, raw: "" };
10196
+ else upperVal = { major: 0, minor: 0, patch: patch + 1, raw: "" };
10197
+ return { lower: { value: lowerVal, inclusive: true }, upper: { value: upperVal, inclusive: false } };
10198
+ }
10199
+ const tildeMatch = range.match(/^~v?(\d+)\.(\d+)\.(\d+)(?:-([a-zA-Z0-9._-]+))?$/);
10200
+ if (tildeMatch) {
10201
+ const major = parseInt(tildeMatch[1], 10);
10202
+ const minor = parseInt(tildeMatch[2], 10);
10203
+ const patch = parseInt(tildeMatch[3], 10);
10204
+ const pre = tildeMatch[4];
10205
+ const lowerVal = { major, minor, patch, prerelease: pre, raw: range };
10206
+ const upperVal = { major, minor: minor + 1, patch: 0, raw: "" };
10207
+ return { lower: { value: lowerVal, inclusive: true }, upper: { value: upperVal, inclusive: false } };
10208
+ }
10209
+ const opMatch = range.match(/^(>=|<=|>|<|=)v?(.+)$/);
10210
+ if (opMatch) {
10211
+ const op = opMatch[1];
10212
+ const parsed = parseSemver(opMatch[2]);
10213
+ if ("error" in parsed) return parsed;
10214
+ if (op === ">=") return { lower: { value: parsed, inclusive: true }, upper: { value: null, inclusive: true } };
10215
+ if (op === "<=") return { lower: { value: null, inclusive: true }, upper: { value: parsed, inclusive: true } };
10216
+ if (op === ">") return { lower: { value: parsed, inclusive: false }, upper: { value: null, inclusive: true } };
10217
+ if (op === "<") return { lower: { value: null, inclusive: true }, upper: { value: parsed, inclusive: false } };
10218
+ return { lower: { value: parsed, inclusive: true }, upper: { value: parsed, inclusive: true } };
10219
+ }
10220
+ const plain = parseSemver(range);
10221
+ if (!("error" in plain)) {
10222
+ return { lower: { value: plain, inclusive: true }, upper: { value: plain, inclusive: true } };
10223
+ }
10224
+ return { error: `Unsupported range: '${range}'` };
10225
+ }
10226
+ function rangeToIntervals(range) {
10227
+ const trimmed = range.trim();
10228
+ if (trimmed === "") {
10229
+ return [{ lower: { value: null, inclusive: true }, upper: { value: null, inclusive: true } }];
10230
+ }
10231
+ const orParts = trimmed.split("||").map((s) => s.trim());
10232
+ const intervals = [];
10233
+ for (const orPart of orParts) {
10234
+ const andTokens = orPart.split(/\s+/).filter(Boolean);
10235
+ let combined = {
10236
+ lower: { value: null, inclusive: true },
10237
+ upper: { value: null, inclusive: true }
10238
+ };
10239
+ for (const token of andTokens) {
10240
+ const parsed = parseSingleConstraintToInterval(token);
10241
+ if ("error" in parsed) return parsed;
10242
+ combined = {
10243
+ lower: tightenLower(combined.lower, parsed.lower),
10244
+ upper: tightenUpper(combined.upper, parsed.upper)
10245
+ };
10246
+ }
10247
+ intervals.push(combined);
10248
+ }
10249
+ return intervals;
10250
+ }
10251
+ function intersectSemverRanges(rangeA, rangeB) {
10252
+ const intervalsA = rangeToIntervals(rangeA);
10253
+ if (!Array.isArray(intervalsA)) return intervalsA;
10254
+ const intervalsB = rangeToIntervals(rangeB);
10255
+ if (!Array.isArray(intervalsB)) return intervalsB;
10256
+ const results = [];
10257
+ for (const a of intervalsA) {
10258
+ for (const b of intervalsB) {
10259
+ const lower = tightenLower(a.lower, b.lower);
10260
+ const upper = tightenUpper(a.upper, b.upper);
10261
+ if (isValidInterval(lower, upper)) results.push({ lower, upper });
10262
+ }
10263
+ }
10264
+ if (results.length === 0) return { overlaps: false, intersection: null };
10265
+ const formatted = Array.from(new Set(results.map(intervalToRangeString)));
10266
+ return { overlaps: true, intersection: formatted.join(" || ") };
10267
+ }
10019
10268
  var CARD_NETWORK_RULES = [
10020
10269
  { name: "American Express", lengths: [15], test: (d) => /^3[47]/.test(d) },
10021
10270
  { name: "Diners Club", lengths: [14], test: (d) => /^3(?:0[0-5]|[68])/.test(d) },
package/dist/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
1
  export { j as json } from './json-Ca6gZCNB.cjs';
2
2
  export { e as encoding } from './encoding-Dk3wpmb3.cjs';
3
3
  export { h as hashing } from './hashing-CJjlvqS_.cjs';
4
- export { t as text } from './text-xY5MJwr0.cjs';
5
- export { d as data } from './data-Cz1Q0sg0.cjs';
4
+ export { t as text } from './text-DOopHoK3.cjs';
5
+ export { d as data } from './data-DuOxffMx.cjs';
6
6
  export { g as generators } from './generators-DAXXrMvG.cjs';
7
7
  export { t as time } from './time-VMAy_SrV.cjs';
8
- export { u as units } from './units-B6aXeGr6.cjs';
8
+ export { u as units } from './units-D8_JluTD.cjs';
9
9
  export { n as network } from './network-ylRtLPEs.cjs';
10
10
  export { a as api } from './api-CQnIUrVB.cjs';
11
11
  export { c as code } from './code-DvJYYTea.cjs';
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  export { j as json } from './json-Ca6gZCNB.js';
2
2
  export { e as encoding } from './encoding-Dk3wpmb3.js';
3
3
  export { h as hashing } from './hashing-CJjlvqS_.js';
4
- export { t as text } from './text-xY5MJwr0.js';
5
- export { d as data } from './data-Cz1Q0sg0.js';
4
+ export { t as text } from './text-DOopHoK3.js';
5
+ export { d as data } from './data-DuOxffMx.js';
6
6
  export { g as generators } from './generators-DAXXrMvG.js';
7
7
  export { t as time } from './time-VMAy_SrV.js';
8
- export { u as units } from './units-B6aXeGr6.js';
8
+ export { u as units } from './units-D8_JluTD.js';
9
9
  export { n as network } from './network-ylRtLPEs.js';
10
10
  export { a as api } from './api-CQnIUrVB.js';
11
11
  export { c as code } from './code-DvJYYTea.js';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { media_exports as media } from './chunk-ZWFZRDQ4.js';
2
- export { units_exports as units } from './chunk-LKFMBUJZ.js';
2
+ export { units_exports as units } from './chunk-X3UAAMXF.js';
3
3
  export { network_exports as network } from './chunk-SW3J5CAI.js';
4
4
  export { api_exports as api } from './chunk-U2HREMZU.js';
5
5
  export { code_exports as code } from './chunk-KYBI62YY.js';
@@ -10,8 +10,8 @@ export { ai_agent_exports as ai_agent } from './chunk-5VVC7BHS.js';
10
10
  export { json_exports as json } from './chunk-WUOZHCIC.js';
11
11
  export { encoding_exports as encoding } from './chunk-DOWQZUTP.js';
12
12
  export { hashing_exports as hashing } from './chunk-PET2CGTH.js';
13
- export { text_exports as text } from './chunk-FB6CCFR5.js';
14
- export { data_exports as data } from './chunk-CUQDHXUX.js';
13
+ export { text_exports as text } from './chunk-YQJ7CEUL.js';
14
+ export { data_exports as data } from './chunk-AHNBR25A.js';
15
15
  export { generators_exports as generators } from './chunk-422ICOZX.js';
16
16
  export { time_exports as time } from './chunk-6EJVNQSY.js';
17
17
  import './chunk-MLKGABMK.js';
@@ -26,6 +26,7 @@
26
26
  * - keyword-density-analyzer: analyzeKeywordDensity
27
27
  * - emoji-lookup : searchEmoji, getEmojiByShortcode, getEmojiByChar, getEmojiByCategory, getEmojiCategories, EMOJI_TABLE
28
28
  * - em-dash-usage-checker: checkDashUsage
29
+ * - acronym-expansion-checker: checkAcronymExpansion
29
30
  */
30
31
  interface WordCountResult {
31
32
  words: number;
@@ -484,7 +485,43 @@ interface DashUsageResult {
484
485
  * pasted alongside prose can occasionally be flagged.
485
486
  */
486
487
  declare function checkDashUsage(text: string): DashUsageResult;
488
+ type AcronymIssueType = 'used-before-expansion' | 'never-expanded';
489
+ interface AcronymIssue {
490
+ type: AcronymIssueType;
491
+ acronym: string;
492
+ index: number;
493
+ context: string;
494
+ message: string;
495
+ }
496
+ interface AcronymUsage {
497
+ acronym: string;
498
+ occurrences: number;
499
+ firstUsedAt: number;
500
+ expandedAt: number | null;
501
+ usedBeforeExpansion: boolean;
502
+ }
503
+ interface AcronymCheckResult {
504
+ acronyms: AcronymUsage[];
505
+ issues: AcronymIssue[];
506
+ }
507
+ /**
508
+ * Scan text for acronyms (2-10 character all-caps tokens) and flag any that
509
+ * are used before being expanded on first mention, per standard technical
510
+ * writing style guides. Recognizes both expansion conventions: the full term
511
+ * followed by the acronym in parentheses ("Application Programming Interface
512
+ * (API)"), and the acronym followed by its expansion in parentheses ("API
513
+ * (Application Programming Interface)"). An acronym with no expansion found
514
+ * anywhere in the text is reported separately as never expanded, rather than
515
+ * as used too early. Pure regex heuristic, not a dictionary of real acronyms:
516
+ * a proper noun styled in all caps, a Roman numeral, or a pluralized acronym
517
+ * like "APIs" can be missed or misread.
518
+ */
519
+ declare function checkAcronymExpansion(text: string): AcronymCheckResult;
487
520
 
521
+ type text_AcronymCheckResult = AcronymCheckResult;
522
+ type text_AcronymIssue = AcronymIssue;
523
+ type text_AcronymIssueType = AcronymIssueType;
524
+ type text_AcronymUsage = AcronymUsage;
488
525
  type text_AsciiFont = AsciiFont;
489
526
  type text_AsciiOptions = AsciiOptions;
490
527
  declare const text_CASE_FORMATS: typeof CASE_FORMATS;
@@ -544,6 +581,7 @@ declare const text_applyOp: typeof applyOp;
544
581
  declare const text_applyOps: typeof applyOps;
545
582
  declare const text_calculateStringDistance: typeof calculateStringDistance;
546
583
  declare const text_centerText: typeof centerText;
584
+ declare const text_checkAcronymExpansion: typeof checkAcronymExpansion;
547
585
  declare const text_checkDashUsage: typeof checkDashUsage;
548
586
  declare const text_checkOxfordCommaConsistency: typeof checkOxfordCommaConsistency;
549
587
  declare const text_convertAll: typeof convertAll;
@@ -600,7 +638,7 @@ declare const text_textToMorse: typeof textToMorse;
600
638
  declare const text_unescapeString: typeof unescapeString;
601
639
  declare const text_wordFrequency: typeof wordFrequency;
602
640
  declare namespace text {
603
- export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DashIssue as DashIssue, type text_DashIssueType as DashIssueType, type text_DashUsageResult as DashUsageResult, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_EMOJI_TABLE as EMOJI_TABLE, text_ESCAPE_MODES as ESCAPE_MODES, type text_EmojiEntry as EmojiEntry, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, type text_KeywordDensityEntry as KeywordDensityEntry, type text_KeywordDensityOptions as KeywordDensityOptions, type text_KeywordDensityResult as KeywordDensityResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_OxfordCommaInstance as OxfordCommaInstance, type text_OxfordCommaResult as OxfordCommaResult, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SentenceLengthBucket as SentenceLengthBucket, type text_SentenceLengthDistribution as SentenceLengthDistribution, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, type text_WordyPhraseMatch as WordyPhraseMatch, type text_WordyPhraseResult as WordyPhraseResult, text_addBorder as addBorder, text_analyzeKeywordDensity as analyzeKeywordDensity, text_analyzeSentenceLengths as analyzeSentenceLengths, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_checkDashUsage as checkDashUsage, text_checkOxfordCommaConsistency as checkOxfordCommaConsistency, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_detectWordyPhrases as detectWordyPhrases, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getEmojiByCategory as getEmojiByCategory, text_getEmojiByChar as getEmojiByChar, text_getEmojiByShortcode as getEmojiByShortcode, text_getEmojiCategories as getEmojiCategories, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_searchEmoji as searchEmoji, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
641
+ export { type text_AcronymCheckResult as AcronymCheckResult, type text_AcronymIssue as AcronymIssue, type text_AcronymIssueType as AcronymIssueType, type text_AcronymUsage as AcronymUsage, type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DashIssue as DashIssue, type text_DashIssueType as DashIssueType, type text_DashUsageResult as DashUsageResult, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_EMOJI_TABLE as EMOJI_TABLE, text_ESCAPE_MODES as ESCAPE_MODES, type text_EmojiEntry as EmojiEntry, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, type text_KeywordDensityEntry as KeywordDensityEntry, type text_KeywordDensityOptions as KeywordDensityOptions, type text_KeywordDensityResult as KeywordDensityResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_OxfordCommaInstance as OxfordCommaInstance, type text_OxfordCommaResult as OxfordCommaResult, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SentenceLengthBucket as SentenceLengthBucket, type text_SentenceLengthDistribution as SentenceLengthDistribution, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, type text_WordyPhraseMatch as WordyPhraseMatch, type text_WordyPhraseResult as WordyPhraseResult, text_addBorder as addBorder, text_analyzeKeywordDensity as analyzeKeywordDensity, text_analyzeSentenceLengths as analyzeSentenceLengths, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_checkAcronymExpansion as checkAcronymExpansion, text_checkDashUsage as checkDashUsage, text_checkOxfordCommaConsistency as checkOxfordCommaConsistency, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_detectWordyPhrases as detectWordyPhrases, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getEmojiByCategory as getEmojiByCategory, text_getEmojiByChar as getEmojiByChar, text_getEmojiByShortcode as getEmojiByShortcode, text_getEmojiCategories as getEmojiCategories, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_searchEmoji as searchEmoji, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
604
642
  }
605
643
 
606
- export { analyzeKeywordDensity as $, type AsciiFont as A, type ParsedTable as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, EMOJI_TABLE as E, type FillerCategory as F, type PassiveVoiceMatch as G, type PassiveVoiceResult as H, type PassiveVoiceSentence as I, type ReadabilityScore as J, type KeywordDensityEntry as K, LINE_OPS as L, MORSE_CODE as M, type SentenceLengthDistribution as N, type OxfordCommaInstance as O, type ParsedDiff as P, type SlugSeparator as Q, type ReadabilityResult as R, type SentenceLengthBucket as S, type StringDistanceMode as T, type StringDistanceResult as U, type TableOptions as V, type TextAnalysis as W, type WordCountResult as X, type WordyPhraseMatch as Y, type WordyPhraseResult as Z, addBorder as _, type AsciiOptions as a, analyzeSentenceLengths as a0, analyzeText as a1, applyOp as a2, applyOps as a3, calculateStringDistance as a4, centerText as a5, checkDashUsage as a6, checkOxfordCommaConsistency as a7, convertAll as a8, convertCase as a9, getMorseForChar as aA, getMorseTiming as aB, htmlToMarkdown as aC, isValidMorse as aD, markdownToHtml as aE, morseToText as aF, numberToOrdinal as aG, numberToRoman as aH, numberToWords as aI, ordinalWords as aJ, parseDiff as aK, parseTableData as aL, readabilityScore as aM, renderMarkdown as aN, romanToNumber as aO, scoreReadability as aP, searchEmoji as aQ, sentenceCount as aR, slugify as aS, slugifyAll as aT, syllableCount as aU, textToAscii as aV, textToMorse as aW, unescapeString as aX, wordFrequency as aY, countWords as aa, csvToHtml as ab, csvToMarkdown as ac, detectDelimiter as ad, detectFillerWords as ae, detectPassiveVoice as af, detectWordyPhrases as ag, diffLines as ah, diffLinesSimple as ai, diffStats as aj, escapeAll as ak, escapeString as al, extractHeadings as am, formatReadingTime as an, generate as ao, generateDiff as ap, generateHtmlTable as aq, generateMarkdownTable as ar, generateParagraphs as as, generateSentences as at, generateWords as au, getAvailableFonts as av, getEmojiByCategory as aw, getEmojiByChar as ax, getEmojiByShortcode as ay, getEmojiCategories as az, type CaseFormat as b, type ConvertOptions as c, type DashIssue as d, type DashIssueType as e, type DashUsageResult as f, type DiffFile as g, type DiffHunk as h, type DiffLine as i, type DiffResult as j, type DiffType as k, type DiffViewerLine as l, ESCAPE_MODES as m, type EmojiEntry as n, type EscapeMode as o, type FillerMatch as p, type FillerWordResult as q, type KeywordDensityOptions as r, type KeywordDensityResult as s, text as t, type LineOp as u, type LineType as v, type LoremUnit as w, type MarkdownResult as x, type MorseOptions as y, type OxfordCommaResult as z };
644
+ export { type WordCountResult as $, type AcronymCheckResult as A, type LoremUnit as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, EMOJI_TABLE as E, type FillerCategory as F, type MarkdownResult as G, type MorseOptions as H, type OxfordCommaResult as I, type ParsedTable as J, type KeywordDensityEntry as K, LINE_OPS as L, MORSE_CODE as M, type PassiveVoiceMatch as N, type OxfordCommaInstance as O, type ParsedDiff as P, type PassiveVoiceResult as Q, type PassiveVoiceSentence as R, type ReadabilityResult as S, type ReadabilityScore as T, type SentenceLengthBucket as U, type SentenceLengthDistribution as V, type SlugSeparator as W, type StringDistanceMode as X, type StringDistanceResult as Y, type TableOptions as Z, type TextAnalysis as _, type AcronymIssue as a, textToMorse as a$, type WordyPhraseMatch as a0, type WordyPhraseResult as a1, addBorder as a2, analyzeKeywordDensity as a3, analyzeSentenceLengths as a4, analyzeText as a5, applyOp as a6, applyOps as a7, calculateStringDistance as a8, centerText as a9, getAvailableFonts as aA, getEmojiByCategory as aB, getEmojiByChar as aC, getEmojiByShortcode as aD, getEmojiCategories as aE, getMorseForChar as aF, getMorseTiming as aG, htmlToMarkdown as aH, isValidMorse as aI, markdownToHtml as aJ, morseToText as aK, numberToOrdinal as aL, numberToRoman as aM, numberToWords as aN, ordinalWords as aO, parseDiff as aP, parseTableData as aQ, readabilityScore as aR, renderMarkdown as aS, romanToNumber as aT, scoreReadability as aU, searchEmoji as aV, sentenceCount as aW, slugify as aX, slugifyAll as aY, syllableCount as aZ, textToAscii as a_, checkAcronymExpansion as aa, checkDashUsage as ab, checkOxfordCommaConsistency as ac, convertAll as ad, convertCase as ae, countWords as af, csvToHtml as ag, csvToMarkdown as ah, detectDelimiter as ai, detectFillerWords as aj, detectPassiveVoice as ak, detectWordyPhrases as al, diffLines as am, diffLinesSimple as an, diffStats as ao, escapeAll as ap, escapeString as aq, extractHeadings as ar, formatReadingTime as as, generate as at, generateDiff as au, generateHtmlTable as av, generateMarkdownTable as aw, generateParagraphs as ax, generateSentences as ay, generateWords as az, type AcronymIssueType as b, unescapeString as b0, wordFrequency as b1, type AcronymUsage as c, type AsciiFont as d, type AsciiOptions as e, type CaseFormat as f, type ConvertOptions as g, type DashIssue as h, type DashIssueType as i, type DashUsageResult as j, type DiffFile as k, type DiffHunk as l, type DiffLine as m, type DiffResult as n, type DiffType as o, type DiffViewerLine as p, ESCAPE_MODES as q, type EmojiEntry as r, type EscapeMode as s, text as t, type FillerMatch as u, type FillerWordResult as v, type KeywordDensityOptions as w, type KeywordDensityResult as x, type LineOp as y, type LineType as z };
@@ -26,6 +26,7 @@
26
26
  * - keyword-density-analyzer: analyzeKeywordDensity
27
27
  * - emoji-lookup : searchEmoji, getEmojiByShortcode, getEmojiByChar, getEmojiByCategory, getEmojiCategories, EMOJI_TABLE
28
28
  * - em-dash-usage-checker: checkDashUsage
29
+ * - acronym-expansion-checker: checkAcronymExpansion
29
30
  */
30
31
  interface WordCountResult {
31
32
  words: number;
@@ -484,7 +485,43 @@ interface DashUsageResult {
484
485
  * pasted alongside prose can occasionally be flagged.
485
486
  */
486
487
  declare function checkDashUsage(text: string): DashUsageResult;
488
+ type AcronymIssueType = 'used-before-expansion' | 'never-expanded';
489
+ interface AcronymIssue {
490
+ type: AcronymIssueType;
491
+ acronym: string;
492
+ index: number;
493
+ context: string;
494
+ message: string;
495
+ }
496
+ interface AcronymUsage {
497
+ acronym: string;
498
+ occurrences: number;
499
+ firstUsedAt: number;
500
+ expandedAt: number | null;
501
+ usedBeforeExpansion: boolean;
502
+ }
503
+ interface AcronymCheckResult {
504
+ acronyms: AcronymUsage[];
505
+ issues: AcronymIssue[];
506
+ }
507
+ /**
508
+ * Scan text for acronyms (2-10 character all-caps tokens) and flag any that
509
+ * are used before being expanded on first mention, per standard technical
510
+ * writing style guides. Recognizes both expansion conventions: the full term
511
+ * followed by the acronym in parentheses ("Application Programming Interface
512
+ * (API)"), and the acronym followed by its expansion in parentheses ("API
513
+ * (Application Programming Interface)"). An acronym with no expansion found
514
+ * anywhere in the text is reported separately as never expanded, rather than
515
+ * as used too early. Pure regex heuristic, not a dictionary of real acronyms:
516
+ * a proper noun styled in all caps, a Roman numeral, or a pluralized acronym
517
+ * like "APIs" can be missed or misread.
518
+ */
519
+ declare function checkAcronymExpansion(text: string): AcronymCheckResult;
487
520
 
521
+ type text_AcronymCheckResult = AcronymCheckResult;
522
+ type text_AcronymIssue = AcronymIssue;
523
+ type text_AcronymIssueType = AcronymIssueType;
524
+ type text_AcronymUsage = AcronymUsage;
488
525
  type text_AsciiFont = AsciiFont;
489
526
  type text_AsciiOptions = AsciiOptions;
490
527
  declare const text_CASE_FORMATS: typeof CASE_FORMATS;
@@ -544,6 +581,7 @@ declare const text_applyOp: typeof applyOp;
544
581
  declare const text_applyOps: typeof applyOps;
545
582
  declare const text_calculateStringDistance: typeof calculateStringDistance;
546
583
  declare const text_centerText: typeof centerText;
584
+ declare const text_checkAcronymExpansion: typeof checkAcronymExpansion;
547
585
  declare const text_checkDashUsage: typeof checkDashUsage;
548
586
  declare const text_checkOxfordCommaConsistency: typeof checkOxfordCommaConsistency;
549
587
  declare const text_convertAll: typeof convertAll;
@@ -600,7 +638,7 @@ declare const text_textToMorse: typeof textToMorse;
600
638
  declare const text_unescapeString: typeof unescapeString;
601
639
  declare const text_wordFrequency: typeof wordFrequency;
602
640
  declare namespace text {
603
- export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DashIssue as DashIssue, type text_DashIssueType as DashIssueType, type text_DashUsageResult as DashUsageResult, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_EMOJI_TABLE as EMOJI_TABLE, text_ESCAPE_MODES as ESCAPE_MODES, type text_EmojiEntry as EmojiEntry, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, type text_KeywordDensityEntry as KeywordDensityEntry, type text_KeywordDensityOptions as KeywordDensityOptions, type text_KeywordDensityResult as KeywordDensityResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_OxfordCommaInstance as OxfordCommaInstance, type text_OxfordCommaResult as OxfordCommaResult, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SentenceLengthBucket as SentenceLengthBucket, type text_SentenceLengthDistribution as SentenceLengthDistribution, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, type text_WordyPhraseMatch as WordyPhraseMatch, type text_WordyPhraseResult as WordyPhraseResult, text_addBorder as addBorder, text_analyzeKeywordDensity as analyzeKeywordDensity, text_analyzeSentenceLengths as analyzeSentenceLengths, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_checkDashUsage as checkDashUsage, text_checkOxfordCommaConsistency as checkOxfordCommaConsistency, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_detectWordyPhrases as detectWordyPhrases, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getEmojiByCategory as getEmojiByCategory, text_getEmojiByChar as getEmojiByChar, text_getEmojiByShortcode as getEmojiByShortcode, text_getEmojiCategories as getEmojiCategories, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_searchEmoji as searchEmoji, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
641
+ export { type text_AcronymCheckResult as AcronymCheckResult, type text_AcronymIssue as AcronymIssue, type text_AcronymIssueType as AcronymIssueType, type text_AcronymUsage as AcronymUsage, type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DashIssue as DashIssue, type text_DashIssueType as DashIssueType, type text_DashUsageResult as DashUsageResult, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_EMOJI_TABLE as EMOJI_TABLE, text_ESCAPE_MODES as ESCAPE_MODES, type text_EmojiEntry as EmojiEntry, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, type text_KeywordDensityEntry as KeywordDensityEntry, type text_KeywordDensityOptions as KeywordDensityOptions, type text_KeywordDensityResult as KeywordDensityResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_OxfordCommaInstance as OxfordCommaInstance, type text_OxfordCommaResult as OxfordCommaResult, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SentenceLengthBucket as SentenceLengthBucket, type text_SentenceLengthDistribution as SentenceLengthDistribution, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, type text_WordyPhraseMatch as WordyPhraseMatch, type text_WordyPhraseResult as WordyPhraseResult, text_addBorder as addBorder, text_analyzeKeywordDensity as analyzeKeywordDensity, text_analyzeSentenceLengths as analyzeSentenceLengths, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_checkAcronymExpansion as checkAcronymExpansion, text_checkDashUsage as checkDashUsage, text_checkOxfordCommaConsistency as checkOxfordCommaConsistency, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_detectWordyPhrases as detectWordyPhrases, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getEmojiByCategory as getEmojiByCategory, text_getEmojiByChar as getEmojiByChar, text_getEmojiByShortcode as getEmojiByShortcode, text_getEmojiCategories as getEmojiCategories, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_searchEmoji as searchEmoji, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
604
642
  }
605
643
 
606
- export { analyzeKeywordDensity as $, type AsciiFont as A, type ParsedTable as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, EMOJI_TABLE as E, type FillerCategory as F, type PassiveVoiceMatch as G, type PassiveVoiceResult as H, type PassiveVoiceSentence as I, type ReadabilityScore as J, type KeywordDensityEntry as K, LINE_OPS as L, MORSE_CODE as M, type SentenceLengthDistribution as N, type OxfordCommaInstance as O, type ParsedDiff as P, type SlugSeparator as Q, type ReadabilityResult as R, type SentenceLengthBucket as S, type StringDistanceMode as T, type StringDistanceResult as U, type TableOptions as V, type TextAnalysis as W, type WordCountResult as X, type WordyPhraseMatch as Y, type WordyPhraseResult as Z, addBorder as _, type AsciiOptions as a, analyzeSentenceLengths as a0, analyzeText as a1, applyOp as a2, applyOps as a3, calculateStringDistance as a4, centerText as a5, checkDashUsage as a6, checkOxfordCommaConsistency as a7, convertAll as a8, convertCase as a9, getMorseForChar as aA, getMorseTiming as aB, htmlToMarkdown as aC, isValidMorse as aD, markdownToHtml as aE, morseToText as aF, numberToOrdinal as aG, numberToRoman as aH, numberToWords as aI, ordinalWords as aJ, parseDiff as aK, parseTableData as aL, readabilityScore as aM, renderMarkdown as aN, romanToNumber as aO, scoreReadability as aP, searchEmoji as aQ, sentenceCount as aR, slugify as aS, slugifyAll as aT, syllableCount as aU, textToAscii as aV, textToMorse as aW, unescapeString as aX, wordFrequency as aY, countWords as aa, csvToHtml as ab, csvToMarkdown as ac, detectDelimiter as ad, detectFillerWords as ae, detectPassiveVoice as af, detectWordyPhrases as ag, diffLines as ah, diffLinesSimple as ai, diffStats as aj, escapeAll as ak, escapeString as al, extractHeadings as am, formatReadingTime as an, generate as ao, generateDiff as ap, generateHtmlTable as aq, generateMarkdownTable as ar, generateParagraphs as as, generateSentences as at, generateWords as au, getAvailableFonts as av, getEmojiByCategory as aw, getEmojiByChar as ax, getEmojiByShortcode as ay, getEmojiCategories as az, type CaseFormat as b, type ConvertOptions as c, type DashIssue as d, type DashIssueType as e, type DashUsageResult as f, type DiffFile as g, type DiffHunk as h, type DiffLine as i, type DiffResult as j, type DiffType as k, type DiffViewerLine as l, ESCAPE_MODES as m, type EmojiEntry as n, type EscapeMode as o, type FillerMatch as p, type FillerWordResult as q, type KeywordDensityOptions as r, type KeywordDensityResult as s, text as t, type LineOp as u, type LineType as v, type LoremUnit as w, type MarkdownResult as x, type MorseOptions as y, type OxfordCommaResult as z };
644
+ export { type WordCountResult as $, type AcronymCheckResult as A, type LoremUnit as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, EMOJI_TABLE as E, type FillerCategory as F, type MarkdownResult as G, type MorseOptions as H, type OxfordCommaResult as I, type ParsedTable as J, type KeywordDensityEntry as K, LINE_OPS as L, MORSE_CODE as M, type PassiveVoiceMatch as N, type OxfordCommaInstance as O, type ParsedDiff as P, type PassiveVoiceResult as Q, type PassiveVoiceSentence as R, type ReadabilityResult as S, type ReadabilityScore as T, type SentenceLengthBucket as U, type SentenceLengthDistribution as V, type SlugSeparator as W, type StringDistanceMode as X, type StringDistanceResult as Y, type TableOptions as Z, type TextAnalysis as _, type AcronymIssue as a, textToMorse as a$, type WordyPhraseMatch as a0, type WordyPhraseResult as a1, addBorder as a2, analyzeKeywordDensity as a3, analyzeSentenceLengths as a4, analyzeText as a5, applyOp as a6, applyOps as a7, calculateStringDistance as a8, centerText as a9, getAvailableFonts as aA, getEmojiByCategory as aB, getEmojiByChar as aC, getEmojiByShortcode as aD, getEmojiCategories as aE, getMorseForChar as aF, getMorseTiming as aG, htmlToMarkdown as aH, isValidMorse as aI, markdownToHtml as aJ, morseToText as aK, numberToOrdinal as aL, numberToRoman as aM, numberToWords as aN, ordinalWords as aO, parseDiff as aP, parseTableData as aQ, readabilityScore as aR, renderMarkdown as aS, romanToNumber as aT, scoreReadability as aU, searchEmoji as aV, sentenceCount as aW, slugify as aX, slugifyAll as aY, syllableCount as aZ, textToAscii as a_, checkAcronymExpansion as aa, checkDashUsage as ab, checkOxfordCommaConsistency as ac, convertAll as ad, convertCase as ae, countWords as af, csvToHtml as ag, csvToMarkdown as ah, detectDelimiter as ai, detectFillerWords as aj, detectPassiveVoice as ak, detectWordyPhrases as al, diffLines as am, diffLinesSimple as an, diffStats as ao, escapeAll as ap, escapeString as aq, extractHeadings as ar, formatReadingTime as as, generate as at, generateDiff as au, generateHtmlTable as av, generateMarkdownTable as aw, generateParagraphs as ax, generateSentences as ay, generateWords as az, type AcronymIssueType as b, unescapeString as b0, wordFrequency as b1, type AcronymUsage as c, type AsciiFont as d, type AsciiOptions as e, type CaseFormat as f, type ConvertOptions as g, type DashIssue as h, type DashIssueType as i, type DashUsageResult as j, type DiffFile as k, type DiffHunk as l, type DiffLine as m, type DiffResult as n, type DiffType as o, type DiffViewerLine as p, ESCAPE_MODES as q, type EmojiEntry as r, type EscapeMode as s, text as t, type FillerMatch as u, type FillerWordResult as v, type KeywordDensityOptions as w, type KeywordDensityResult as x, type LineOp as y, type LineType as z };
@@ -1622,6 +1622,63 @@ function validateMarkdownHeadingHierarchy(markdown) {
1622
1622
  });
1623
1623
  return { headings, issues, h1Count };
1624
1624
  }
1625
+ var ANCHOR_LINK_RE = /\[([^\]]*)\]\(#([^)\s]+)\)/g;
1626
+ function checkMarkdownInternalLinks(markdown) {
1627
+ if (typeof markdown !== "string" || markdown.trim() === "") {
1628
+ return { error: "markdown is required" };
1629
+ }
1630
+ const lines = markdown.replace(/\r\n/g, "\n").split("\n");
1631
+ const headings = [];
1632
+ const seen = /* @__PURE__ */ new Map();
1633
+ let inFence = false;
1634
+ let fenceMarker = "";
1635
+ for (let i = 0; i < lines.length; i++) {
1636
+ const line = lines[i];
1637
+ const fenceMatch = line.match(/^\s*(```+|~~~+)/);
1638
+ if (fenceMatch) {
1639
+ if (!inFence) {
1640
+ inFence = true;
1641
+ fenceMarker = fenceMatch[1][0];
1642
+ } else if (fenceMatch[1][0] === fenceMarker) {
1643
+ inFence = false;
1644
+ }
1645
+ continue;
1646
+ }
1647
+ if (inFence) continue;
1648
+ const headingMatch = line.match(/^(#{1,6})\s+(.+?)\s*#*\s*$/);
1649
+ if (!headingMatch) continue;
1650
+ const level = headingMatch[1].length;
1651
+ const text = stripInlineMarkdown(headingMatch[2]);
1652
+ if (text === "") continue;
1653
+ const slug = slugifyHeading(text, seen);
1654
+ headings.push({ level, text, slug, line: i + 1 });
1655
+ }
1656
+ const validSlugs = new Set(headings.map((h) => h.slug));
1657
+ const links = [];
1658
+ inFence = false;
1659
+ fenceMarker = "";
1660
+ for (let i = 0; i < lines.length; i++) {
1661
+ const line = lines[i];
1662
+ const fenceMatch = line.match(/^\s*(```+|~~~+)/);
1663
+ if (fenceMatch) {
1664
+ if (!inFence) {
1665
+ inFence = true;
1666
+ fenceMarker = fenceMatch[1][0];
1667
+ } else if (fenceMatch[1][0] === fenceMarker) {
1668
+ inFence = false;
1669
+ }
1670
+ continue;
1671
+ }
1672
+ if (inFence) continue;
1673
+ const re = new RegExp(ANCHOR_LINK_RE);
1674
+ let m;
1675
+ while ((m = re.exec(line)) !== null) {
1676
+ const target = m[2];
1677
+ links.push({ text: m[1], target, line: i + 1, valid: validSlugs.has(target) });
1678
+ }
1679
+ }
1680
+ return { headings, links, brokenLinks: links.filter((l) => !l.valid) };
1681
+ }
1625
1682
  function quoteSqlIdentifier(name, dialect) {
1626
1683
  if (dialect === "mysql") return "`" + name.replace(/`/g, "``") + "`";
1627
1684
  return '"' + name.replace(/"/g, '""') + '"';
@@ -2021,6 +2078,7 @@ function alignMarkdownTables(markdown) {
2021
2078
  exports.alignMarkdownTables = alignMarkdownTables;
2022
2079
  exports.analyzeCaptionSpeed = analyzeCaptionSpeed;
2023
2080
  exports.calculateMarkdownTaskListProgress = calculateMarkdownTaskListProgress;
2081
+ exports.checkMarkdownInternalLinks = checkMarkdownInternalLinks;
2024
2082
  exports.convertSubtitles = convertSubtitles;
2025
2083
  exports.csvToJson = csvToJson;
2026
2084
  exports.csvToSqlInsert = csvToSqlInsert;
@@ -1 +1 @@
1
- export { C as CaptionSpeedCue, a as CaptionSpeedResult, b as ConvertedSubtitles, c as CsvColumnType, e as CsvColumnTypeInfo, f as CsvColumnTypeOptions, g as CsvColumnTypeResult, h as CsvDuplicateGroup, i as CsvDuplicateOptions, j as CsvDuplicateResult, k as CsvParseResult, l as CsvToSqlOptions, m as CsvToSqlResult, E as EnvDiffError, n as EnvDiffResult, o as EnvEntry, p as EnvParseResult, F as FrontMatterError, q as FrontMatterResult, H as HeadingEntry, r as HeadingHierarchyResult, s as HeadingIssue, t as HeadingIssueType, I as IniSection, M as MarkdownTableAlignResult, u as MarkdownTableColumnAlignment, v as MarkdownTableInfo, w as MarkdownTaskListItem, x as MarkdownTaskListProgressResult, y as MarkdownTaskListSectionSummary, z as MarkdownTocEntry, A as MarkdownTocOptions, B as MarkdownTocResult, N as NdjsonDedupeResult, D as NdjsonLineResult, G as NdjsonValidateResult, P as ParseOptions, J as ParsedIni, K as ParsedSubtitles, S as SubtitleCue, L as SubtitleFormat, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, O as XmlToJsonOptions, Y as YamlAnchorInfo, Q as YamlAnchorResolveError, R as YamlAnchorResolveResult, U as alignMarkdownTables, W as analyzeCaptionSpeed, Z as calculateMarkdownTaskListProgress, _ as convertSubtitles, $ as csvToJson, a0 as csvToSqlInsert, a1 as dedupeNdjson, a2 as detectDelimiter, a3 as detectSubtitleFormat, a4 as diffEnvExample, a5 as envToExport, a6 as envToJson, a7 as findCsvDuplicateRows, a8 as formatNdjson, a9 as formatSubtitleTimestamp, aa as formatToml, ab as formatXml, ac as generateMarkdownToc, ad as getSection, ae as getSectionNames, af as getTomlStats, ag as getXmlStats, ah as getYamlStats, ai as inferCsvColumnTypes, aj as iniToJson, ak as jsonArrayToNdjson, al as jsonToIni, am as jsonToToml, an as jsonToXml, ao as minifyNdjson, ap as minifyToml, aq as minifyXml, ar as ndjsonToCsv, as as ndjsonToJsonArray, at as parseCsv, au as parseEnv, av as parseFrontMatter, aw as parseIni, ax as parseSubtitleTimestamp, ay as parseSubtitles, az as parseXmlToObject, aA as resolveYamlAnchors, aB as serializeSubtitles, aC as shiftSubtitles, aD as stringifyIni, aE as toCsvString, aF as tomlToJson, aG as validateEnvKey, aH as validateIni, aI as validateMarkdownHeadingHierarchy, aJ as validateNdjson, aK as validateToml, aL as validateXml, aM as validateYaml, aN as xmlToJson } from '../data-Cz1Q0sg0.cjs';
1
+ export { C as CaptionSpeedCue, a as CaptionSpeedResult, b as ConvertedSubtitles, c as CsvColumnType, e as CsvColumnTypeInfo, f as CsvColumnTypeOptions, g as CsvColumnTypeResult, h as CsvDuplicateGroup, i as CsvDuplicateOptions, j as CsvDuplicateResult, k as CsvParseResult, l as CsvToSqlOptions, m as CsvToSqlResult, E as EnvDiffError, n as EnvDiffResult, o as EnvEntry, p as EnvParseResult, F as FrontMatterError, q as FrontMatterResult, H as HeadingEntry, r as HeadingHierarchyResult, s as HeadingIssue, t as HeadingIssueType, I as IniSection, M as MarkdownAnchorHeading, u as MarkdownAnchorLink, v as MarkdownInternalLinkCheckResult, w as MarkdownTableAlignResult, x as MarkdownTableColumnAlignment, y as MarkdownTableInfo, z as MarkdownTaskListItem, A as MarkdownTaskListProgressResult, B as MarkdownTaskListSectionSummary, D as MarkdownTocEntry, G as MarkdownTocOptions, J as MarkdownTocResult, N as NdjsonDedupeResult, K as NdjsonLineResult, L as NdjsonValidateResult, P as ParseOptions, O as ParsedIni, Q as ParsedSubtitles, S as SubtitleCue, R as SubtitleFormat, T as TomlFormatResult, V as ValidationResult, X as XmlFormatResult, U as XmlToJsonOptions, Y as YamlAnchorInfo, W as YamlAnchorResolveError, Z as YamlAnchorResolveResult, _ as alignMarkdownTables, $ as analyzeCaptionSpeed, a0 as calculateMarkdownTaskListProgress, a1 as checkMarkdownInternalLinks, a2 as convertSubtitles, a3 as csvToJson, a4 as csvToSqlInsert, a5 as dedupeNdjson, a6 as detectDelimiter, a7 as detectSubtitleFormat, a8 as diffEnvExample, a9 as envToExport, aa as envToJson, ab as findCsvDuplicateRows, ac as formatNdjson, ad as formatSubtitleTimestamp, ae as formatToml, af as formatXml, ag as generateMarkdownToc, ah as getSection, ai as getSectionNames, aj as getTomlStats, ak as getXmlStats, al as getYamlStats, am as inferCsvColumnTypes, an as iniToJson, ao as jsonArrayToNdjson, ap as jsonToIni, aq as jsonToToml, ar as jsonToXml, as as minifyNdjson, at as minifyToml, au as minifyXml, av as ndjsonToCsv, aw as ndjsonToJsonArray, ax as parseCsv, ay as parseEnv, az as parseFrontMatter, aA as parseIni, aB as parseSubtitleTimestamp, aC as parseSubtitles, aD as parseXmlToObject, aE as resolveYamlAnchors, aF as serializeSubtitles, aG as shiftSubtitles, aH as stringifyIni, aI as toCsvString, aJ as tomlToJson, aK as validateEnvKey, aL as validateIni, aM as validateMarkdownHeadingHierarchy, aN as validateNdjson, aO as validateToml, aP as validateXml, aQ as validateYaml, aR as xmlToJson } from '../data-DuOxffMx.cjs';