@openpresentation/opf 0.32.1 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/README.md +9 -0
  2. package/dist/browser.js +22 -21
  3. package/dist/catalog-refs-CoIrOdAw.d.ts +937 -0
  4. package/dist/{catalog-schemas-LdqOPebq.d.ts → catalog-schemas-FjLRPtjB.d.ts} +10 -4
  5. package/dist/{chart-data-oIZQlFGi.d.ts → chart-data-B_k-WTex.d.ts} +7 -4
  6. package/dist/{chunk-PB7ME64J.js → chunk-244OPLAV.js} +1 -1
  7. package/dist/{chunk-IT7FQKED.js → chunk-2HX4BGAS.js} +6 -6
  8. package/dist/{chunk-2E6CDYL2.js → chunk-36DLVJGW.js} +19 -16
  9. package/dist/{chunk-XQO2CT6Q.js → chunk-3THGTDL2.js} +2 -2
  10. package/dist/{chunk-CLRYHWQN.js → chunk-42JBXJKW.js} +187 -25
  11. package/dist/chunk-BLCDUM7B.js +7 -0
  12. package/dist/{chunk-NVAJASOD.js → chunk-CJVKOJ6B.js} +10195 -2036
  13. package/dist/{chunk-XFHXQCXL.js → chunk-DQ7QYOUV.js} +99 -13
  14. package/dist/{chunk-NEJ32O7X.js → chunk-F6BXO4AI.js} +1 -1
  15. package/dist/{chunk-OXLA4HXQ.js → chunk-FAXO3SUE.js} +1196 -313
  16. package/dist/{chunk-J63CIRIV.js → chunk-FIQMAIZV.js} +4 -4
  17. package/dist/{chunk-PJSPHHRK.js → chunk-FK5XG742.js} +3 -16
  18. package/dist/{chunk-HKUV7NEN.js → chunk-HHVQ2SDT.js} +1 -1
  19. package/dist/{chunk-SZFO3MAJ.js → chunk-HUGVYHZ2.js} +4 -4
  20. package/dist/{chunk-LEF4X4KI.js → chunk-LCT5ZV3Q.js} +2400 -222
  21. package/dist/chunk-NLJFNCZ4.js +1560 -0
  22. package/dist/{chunk-GM7WFPGG.js → chunk-PRXZD2II.js} +6 -1
  23. package/dist/{chunk-YFJIIIOL.js → chunk-QGJVOPLG.js} +3 -3
  24. package/dist/{chunk-F7DN33UL.js → chunk-QGTJF7HV.js} +16 -14
  25. package/dist/{chunk-ONVFUVQ5.js → chunk-RUV7CCE6.js} +136 -31
  26. package/dist/{chunk-SW676APJ.js → chunk-U7TYSPYM.js} +2 -2
  27. package/dist/chunk-UJZN2ZH6.js +1 -0
  28. package/dist/chunk-VDZXNNZF.js +221 -0
  29. package/dist/{chunk-UJSAR6GF.js → chunk-W4DYDRV2.js} +21 -0
  30. package/dist/chunk-WCPDN7AY.js +642 -0
  31. package/dist/{chunk-BBVW5ZC2.js → chunk-WMFT5R7I.js} +2 -2
  32. package/dist/{chunk-AQEAZDL2.js → chunk-XJUMFH33.js} +2 -1
  33. package/dist/{composition-Ds6WHyO7.d.ts → composition-CvtvgBDE.d.ts} +2783 -873
  34. package/dist/composition.d.ts +4 -3
  35. package/dist/composition.js +3 -2
  36. package/dist/{conversion-CdzrTxib.d.ts → conversion-B_5AKTYQ.d.ts} +39 -10
  37. package/dist/conversion-CMBGOTAC.js +25 -0
  38. package/dist/convert.d.ts +5 -4
  39. package/dist/convert.js +17 -13
  40. package/dist/data.d.ts +2 -2
  41. package/dist/data.js +4 -3
  42. package/dist/{deck-report-CKDNQ2t4.d.ts → deck-report-BVlQZ42f.d.ts} +3 -3
  43. package/dist/deck.d.ts +7 -6
  44. package/dist/deck.js +13 -12
  45. package/dist/diagram-engine-eager.js +6 -2
  46. package/dist/diagram-engine-lazy.js +14 -1
  47. package/dist/diagram-plantuml-XRZ6VAOL.js +3 -0
  48. package/dist/diff.js +6 -5
  49. package/dist/docs.js +88 -52
  50. package/dist/examples.js +28745 -18393
  51. package/dist/font-policy.js +2 -2
  52. package/dist/format.js +3 -3
  53. package/dist/ids.js +6 -5
  54. package/dist/index.d.ts +19 -16
  55. package/dist/index.js +37 -26
  56. package/dist/markdown.d.ts +3 -2
  57. package/dist/markdown.js +10 -9
  58. package/dist/node-engine.d.ts +44 -11
  59. package/dist/node-engine.js +47 -28
  60. package/dist/{pagination-DRZ_JNFY.d.ts → pagination-CZQQYk7L.d.ts} +22 -4
  61. package/dist/pagination.d.ts +5 -4
  62. package/dist/pagination.js +6 -5
  63. package/dist/patch.js +5 -4
  64. package/dist/precompiled.js +3 -3
  65. package/dist/{presentation-DnD7mfmf.d.ts → presentation-s9262acV.d.ts} +1172 -208
  66. package/dist/repo-readme.js +2 -2
  67. package/dist/schema-engine-ajv.js +2 -2
  68. package/dist/schema-engine-precompiled.js +3 -3
  69. package/dist/schema.d.ts +3 -3
  70. package/dist/schema.js +5 -4
  71. package/dist/schemas.d.ts +56 -4
  72. package/dist/schemas.js +2 -2
  73. package/dist/shape-catalog.d.ts +98 -0
  74. package/dist/shape-catalog.js +302 -0
  75. package/dist/shape-engine-eager.js +9 -0
  76. package/dist/shape-engine-lazy.js +12 -0
  77. package/dist/shape-engine-module-N74FCHGY.js +3 -0
  78. package/dist/shape-geometry.d.ts +126 -0
  79. package/dist/shape-geometry.js +2 -0
  80. package/dist/source.d.ts +10 -5
  81. package/dist/source.js +12 -11
  82. package/dist/spec/README.md +1 -1
  83. package/dist/spec/reference/engine-vocabularies.json +135 -0
  84. package/dist/spec/reference/font-policy.json +3 -16
  85. package/dist/spec/reference/preset-geometry.json +10699 -0
  86. package/dist/spec/reference/preset-geometry.schema.json +126 -0
  87. package/dist/spec/schemas/catalog-index.schema.json +1 -0
  88. package/dist/spec/schemas/chart-type.schema.json +4 -4
  89. package/dist/spec/schemas/icon-set.schema.json +75 -0
  90. package/dist/spec/schemas/layout.schema.json +82 -23
  91. package/dist/spec/schemas/opf.schema.json +1616 -296
  92. package/dist/spec/schemas/theme.schema.json +11 -5
  93. package/dist/spec-files.d.ts +1 -1
  94. package/dist/spec-files.js +2 -2
  95. package/dist/symbol-font-encodings.js +1 -1
  96. package/dist/types.d.ts +83 -71
  97. package/dist/{validation-types-DxyYPebs.d.ts → validation-types-CYbsUuZ9.d.ts} +8 -5
  98. package/dist/validator.d.ts +35 -7
  99. package/dist/validator.js +5 -4
  100. package/dist/yaml.d.ts +3 -2
  101. package/dist/yaml.js +9 -8
  102. package/package.json +22 -6
  103. package/dist/catalog-refs-kAefsZWT.d.ts +0 -129
  104. package/dist/chunk-DGS47ONG.js +0 -1
  105. package/dist/conversion-5FUDQPED.js +0 -24
@@ -1,12 +1,13 @@
1
1
  import { original } from './chunk-JBARNYFR.js';
2
- import { schemas, schemaEntries } from './chunk-LEF4X4KI.js';
3
- import { promotedRegionKeys, VARIABLE_KINDS, resolveChartData, chartPaletteForFill, chartSeriesPalette, chartSchemeSeries, CHART_SERIES_MIN_LIGHTNESS_STEP, normalizeHexColor, resolveChartColors, colorContrast, imageBackground, CODE_NOMINAL_SIZE, QUOTE_NOMINAL_SIZE, TABLE_NOMINAL_SIZE, LIST_NOMINAL_SIZE, PROSE_NOMINAL_SIZE, quoteMarksFor, quoteLanguage, emphasisSurface, textInkBox, tableGrid, metricValueColor, timelineTextColor, LOGO_SHAPES, visitContentPayloads, readingRows, visualReadingOrder, intrinsicImageSize, resolveReference, layoutTable, resolveColorRef, resolveDesignRecords, resolveFontFamilies, checkCatalogsOption, provenanceOf, unresolvedReference, OPFUnresolvedReferenceError, resolveColorRoles, layoutVariantApplies, resolveCanvasDimensions, resolveSlideVariables, layoutColorVariant, deckBackgroundIsFixed, normalizeColorVariant, isRecord, hasContentVariables, isTemplate, instantiateForValidation, layoutTemplateIssues, resolveScriptFonts, defaultSlideBackground, catalogReferenceSites, parseReference, catalogGroupDeclared, pointerPath, unusedDatasets, MAX_COMPOSITION_DEPTH, datasetDiagnostics, pathFor, catalogRecords, collectCitations, numberingFindings, walkCitationRuns, chartDrawDiagnostics, resolveTableData, resolveChartOptions, chartOptionTarget, codeHighlightLines, chartNumberFixesByCell, catalogKinds, catalogGroupSource, registeredCatalog, OPFCompositionError, composeSlide } from './chunk-NVAJASOD.js';
2
+ import { schemas, schemaEntries } from './chunk-LCT5ZV3Q.js';
3
+ import { promotedRegionKeys, SHAPE_BLOCK_KEYS, VARIABLE_KINDS, resolveChartData, chartPaletteForFill, chartSeriesPalette, chartSchemeSeries, chartSlicePlan, CHART_SERIES_MIN_LIGHTNESS_STEP, normalizeHexColor, resolveChartColors, colorContrast, imageBackground, CODE_NOMINAL_SIZE, QUOTE_NOMINAL_SIZE, TABLE_NOMINAL_SIZE, LIST_NOMINAL_SIZE, PROSE_NOMINAL_SIZE, quoteMarksFor, quoteLanguage, emphasisSurface, textInkBox, tableGrid, metricValueColor, timelineTextColor, LOGO_SHAPES, visitContentPayloads, intrinsicImageSize, resolveReference, layoutTable, colorTransform, applyColorTransform, resolveColorRef, readingRows, visualReadingOrder, numberingSystemExtension, isSupportedNumberingSystem, plainLanguageTag, supportedNumberingSystems, resolveDesignRecords, resolveFontFamilies, checkCatalogsOption, provenanceOf, unresolvedReference, OPFUnresolvedReferenceError, composeSlide, resolveColorRoles, layoutVariantApplies, resolveCanvasDimensions, resolveSlideVariables, layoutVariantKind, deckBackgroundIsChosen, LONE_DISPLAY_SIZES, normalizeColorVariant, layoutColorVariant, inlineDatasets, hasBuiltinDependency, isRecord, hasContentVariables, isTemplate, instantiateForValidation, layoutTemplateIssues, deckBackgroundIsFixed, resolveScriptFonts, lonePayload, annotationText, isLayoutTemplate, layoutTemplate, statementMessage, messageWords, SHORT_MESSAGE_WORDS, catalogReferenceSites, parseReference, catalogGroupDeclared, pointerPath, unusedDatasets, documentIcons, iconIssue, walkCitationRuns, HALF_STEPPED, MAX_COMPOSITION_DEPTH, isOverlayConnector, connectorAdjustPreset, shapeIssues, pathFor, overlayIssues, datasetDiagnostics, defaultSlideBackground, catalogRecords, collectCitations, resolveSlideDirection, numberingFindings, chartDrawDiagnostics, resolveTableData, resolveChartOptions, chartOptionTarget, codeHighlightLines, chartNumberFixesByCell, catalogKinds, catalogGroupSource, registeredCatalog, representablePositionBox, PositionRangeError, isShapeBlock, OPFCompositionError } from './chunk-CJVKOJ6B.js';
4
4
  import { schemaEngine } from '#schema-engine';
5
5
  import { parseTree, printParseErrorCode, getNodePath } from 'jsonc-parser';
6
6
 
7
7
  // src/catalog-schemas.ts
8
8
  var CATALOG_SCHEMA = 4;
9
9
  var catalogDisplayKinds = ["chartTypes", "languages", "socialPlatforms"];
10
+ var catalogIconKinds = ["iconSets"];
10
11
  var catalogSchemaNames = {
11
12
  layouts: "layout",
12
13
  themes: "theme",
@@ -18,7 +19,8 @@ var catalogSchemaNames = {
18
19
  tones: "tone",
19
20
  chartTypes: "chartType",
20
21
  languages: "language",
21
- socialPlatforms: "socialPlatform"
22
+ socialPlatforms: "socialPlatform",
23
+ iconSets: "iconSet"
22
24
  };
23
25
 
24
26
  // src/annotation-validation.ts
@@ -198,8 +200,8 @@ function rememberValidationDefinition(issue2, parentSchema, keyword) {
198
200
  pointer: current.pointer,
199
201
  uri: `${entry2.schema.$id}#${current.pointer}`
200
202
  });
201
- for (const [key2, value] of Object.entries(current.value)) {
202
- const segment = key2.replaceAll("~", "~0").replaceAll("/", "~1");
203
+ for (const [key3, value] of Object.entries(current.value)) {
204
+ const segment = key3.replaceAll("~", "~0").replaceAll("/", "~1");
203
205
  stack.push({ value, pointer: `${current.pointer}/${segment}` });
204
206
  }
205
207
  }
@@ -234,6 +236,8 @@ var rootPayloadFields = [
234
236
  "metric",
235
237
  "quote",
236
238
  "timeline",
239
+ "shape",
240
+ "path",
237
241
  "blocks"
238
242
  ];
239
243
  var contentKindSpecs = {
@@ -247,7 +251,8 @@ var contentKindSpecs = {
247
251
  required: ["items"]
248
252
  },
249
253
  image: {
250
- fields: ["image"],
254
+ // SH-02: an image block's `shape` is its frame's mask.
255
+ fields: ["image", "shape"],
251
256
  required: ["image"]
252
257
  },
253
258
  chart: {
@@ -281,17 +286,25 @@ var contentKindSpecs = {
281
286
  diagram: {
282
287
  fields: ["diagram"],
283
288
  required: ["diagram"]
289
+ },
290
+ // SH-02: a preset (`shape` without `image`) or a custom `path`, with its `text` inside.
291
+ shape: {
292
+ fields: ["shape", "path", "text"],
293
+ required: [],
294
+ requireAny: ["shape", "path"]
284
295
  }
285
296
  };
286
297
  var captionableKinds = /* @__PURE__ */ new Set(["image", "chart", "table", "video", "diagram"]);
287
- var imageOptionFields = ["fit", "focus", "aspectRatio", "shape", "cornerRadius", "border", "opacity", "recolor", "overlay", "placement"];
298
+ var imageOptionFields = ["fit", "focus", "aspectRatio", "shape", "adjust", "stroke", "opacity", "recolor", "overlay", "placement", "portrait"];
299
+ var shapeImageFields = /* @__PURE__ */ new Set(["aspectRatio", "shape", "adjust", "stroke", "opacity"]);
300
+ var shapeOptionFields = SHAPE_BLOCK_KEYS.filter((field) => field !== "path");
288
301
  var columnSpans = {
289
- left: [0],
302
+ start: [0],
290
303
  center: [1],
291
- right: [2],
292
- "left+center": [0, 1],
293
- "center+right": [1, 2],
294
- "left+center+right": [0, 1, 2]
304
+ end: [2],
305
+ "start+center": [0, 1],
306
+ "center+end": [1, 2],
307
+ "start+center+end": [0, 1, 2]
295
308
  };
296
309
  var rowSpans = {
297
310
  top: [0],
@@ -341,12 +354,31 @@ function semanticIssue(path, message, params2 = {}) {
341
354
  params: params2
342
355
  };
343
356
  }
344
- function hasOwn(value, key2) {
345
- return Object.hasOwn(value, key2);
357
+ function hasOwn(value, key3) {
358
+ return Object.hasOwn(value, key3);
346
359
  }
347
360
  function isEnUkTag(value) {
348
361
  return typeof value === "string" && value.toLowerCase() === "en-uk";
349
362
  }
363
+ var EN_UK_MESSAGE = "Use 'en-GB' for UK English; 'en-UK' is not a valid BCP-47 region tag";
364
+ function enUkIssues(language, path) {
365
+ const at2 = isEnUkTag(language) ? path : isRecord(language) && isEnUkTag(language.bcp47) ? `${path}/bcp47` : void 0;
366
+ return at2 ? [semanticIssue(at2, EN_UK_MESSAGE, { replacement: "en-GB" })] : [];
367
+ }
368
+ function overlayAnchorSizeWarnings(value) {
369
+ const issues = [];
370
+ if (isRecord(value) && Array.isArray(value.slides)) value.slides.forEach((slide, index) => {
371
+ if (isRecord(slide) && Array.isArray(slide.shapes)) slide.shapes.forEach((entry2, shapeIndex) => {
372
+ const at2 = isRecord(entry2) ? entry2.at : void 0;
373
+ if (isRecord(at2)) for (const key3 of ["width", "height"]) {
374
+ const size = at2[key3];
375
+ if (typeof size === "number" && size > 4 && size <= 8 && !hasOwn(at2, `${key3}Px`))
376
+ issues.push(semanticIssue(`/slides/${index}/shapes/${shapeIndex}/at/${key3}`, `at.${key3} is ${size}, a fraction; pixels are ${key3}Px`, { code: "shape-anchor-size-unit", key: key3, size }));
377
+ }
378
+ });
379
+ });
380
+ return issues;
381
+ }
350
382
  function presentFields(value, fields2) {
351
383
  return fields2.filter((field) => hasOwn(value, field));
352
384
  }
@@ -355,7 +387,9 @@ function isContentKind(value) {
355
387
  }
356
388
  function inferredKinds(value) {
357
389
  const kinds = [];
358
- if (presentFields(value, contentKindSpecs.text.fields).length > 0) kinds.push("text");
390
+ const shape = isShapeBlock(value);
391
+ if (shape) kinds.push("shape");
392
+ if (presentFields(value, shape ? ["bullets"] : contentKindSpecs.text.fields).length > 0) kinds.push("text");
359
393
  if (hasOwn(value, "items")) kinds.push("list");
360
394
  if (hasOwn(value, "image")) kinds.push("image");
361
395
  if (hasOwn(value, "video")) kinds.push("video");
@@ -379,9 +413,12 @@ function validateContentPayload(value, path, options2 = {}) {
379
413
  const explicitType = value.type;
380
414
  const payloadFields = presentFields(value, rootPayloadFields);
381
415
  const hasBlocks = hasOwn(value, "blocks");
382
- const captionIssue = (reason, params2 = {}) => semanticIssue(pathFor(path, "caption"), `caption is only valid on an image, chart, table or video payload; ${reason}`, { code: "caption-unsupported-payload", ...params2 });
383
- const imageOptionIssues = (reason, params2 = {}) => {
384
- for (const field of imageOptionFields) if (hasOwn(value, field)) issues.push(semanticIssue(pathFor(path, field), `${field} is only valid on an image payload; ${reason}`, { code: "image-option-unsupported-payload", field, ...params2 }));
416
+ const captionIssue = (reason, params2 = {}) => semanticIssue(pathFor(path, "caption"), `caption is only valid on an image, chart, table, video or diagram payload; ${reason}`, { code: "caption-unsupported-payload", ...params2 });
417
+ const imageOptionIssues = (reason, params2 = {}, except = /* @__PURE__ */ new Set()) => {
418
+ for (const field of imageOptionFields) if (hasOwn(value, field) && !except.has(field)) issues.push(semanticIssue(pathFor(path, field), `${field} is only valid on an image payload; ${reason}`, { code: "image-option-unsupported-payload", field, ...params2 }));
419
+ };
420
+ const shapeOptionIssues = (reason, params2 = {}) => {
421
+ for (const field of shapeOptionFields) if (hasOwn(value, field) && !(field === "hidden" && options2.slideRoot)) issues.push(semanticIssue(pathFor(path, field), `${field} is only valid on a shape block; ${reason}`, { code: "shape-option-unsupported-payload", field, ...params2 }));
385
422
  };
386
423
  if (hasOwn(value, "placement") && !options2.topLevel && !hasBlocks && explicitType !== "group" && inferredKinds(value).includes("image")) {
387
424
  issues.push(semanticIssue(pathFor(path, "placement"), "placement is only valid on a top-level block (slides.N.blocks.I); a block inside a group or a promoted region cannot bleed to a slide edge", { code: "image-placement-invalid" }));
@@ -389,12 +426,13 @@ function validateContentPayload(value, path, options2 = {}) {
389
426
  if (hasBlocks || explicitType === "group") {
390
427
  if (hasOwn(value, "caption")) issues.push(captionIssue("a group cannot carry one"));
391
428
  imageOptionIssues("a group cannot carry them");
429
+ shapeOptionIssues("a group cannot carry them");
392
430
  if (explicitType !== void 0 && explicitType !== "group") issues.push(semanticIssue(path, "a group must use type 'group' or omit type"));
393
- const incompatible2 = payloadFields.filter((field) => field !== "blocks" && field !== "type");
431
+ const incompatible2 = payloadFields.filter((field) => field !== "blocks" && field !== "type" && field !== "shape");
394
432
  if (incompatible2.length) issues.push(semanticIssue(path, "blocks cannot be mixed with leaf payload fields", { fields: incompatible2 }));
395
433
  if (!Array.isArray(value.blocks) || value.blocks.length === 0 && !options2.slideRoot) issues.push(semanticIssue(pathFor(path, "blocks"), "a group requires at least one block"));
396
434
  if (Array.isArray(value.blocks)) value.blocks.forEach((block, index) => {
397
- if (isRecord(block)) issues.push(...validateContentPayload(block, `${pathFor(path, "blocks")}/${index}`, { topLevel: options2.slideRoot === true }));
435
+ if (isRecord(block)) issues.push(...validateContentPayload(block, `${pathFor(path, "blocks")}/${index}`, { topLevel: options2.slideRoot === true, ...options2.canvas ? { canvas: options2.canvas } : {} }));
398
436
  });
399
437
  if (options2.slideRoot && Array.isArray(value.blocks)) {
400
438
  const edges = /* @__PURE__ */ new Map();
@@ -437,13 +475,33 @@ function validateContentPayload(value, path, options2 = {}) {
437
475
  }
438
476
  const spec = contentKindSpecs[resolvedKind];
439
477
  if (hasOwn(value, "caption") && !captionableKinds.has(resolvedKind)) issues.push(captionIssue(`this payload is '${resolvedKind}'`, { type: resolvedKind }));
440
- if (resolvedKind !== "image") imageOptionIssues(`this payload is '${resolvedKind}'`, { type: resolvedKind });
478
+ if (resolvedKind !== "image") imageOptionIssues(`this payload is '${resolvedKind}'`, { type: resolvedKind }, resolvedKind === "shape" ? shapeImageFields : void 0);
479
+ if (resolvedKind !== "shape") shapeOptionIssues(`this payload is '${resolvedKind}'`, { type: resolvedKind });
480
+ if (resolvedKind === "shape" || resolvedKind === "image")
481
+ for (const issue2 of shapeIssues(value, (...keys) => keys.reduce((at2, key3) => pathFor(at2, key3), path))) issues.push(semanticIssue(issue2.path, issue2.message, { code: issue2.code, ...issue2.params }));
482
+ if (resolvedKind === "image" && isRecord(value.image) && Array.isArray(value.image.callouts)) {
483
+ value.image.callouts.forEach((callout, index) => {
484
+ if (!isRecord(callout)) return;
485
+ for (const key3 of ["x", "y"]) if (typeof callout[key3] === "number" && !Number.isFinite(callout[key3])) issues.push(semanticIssue(`${pathFor(path, "image")}/callouts/${index}/${key3}`, "an image callout origin must be a finite signed fraction", { key: key3 }));
486
+ const canvas = options2.canvas;
487
+ if (canvas && ["x", "y", "width", "height"].every((key3) => typeof callout[key3] === "number" && Number.isFinite(callout[key3]))) {
488
+ const at2 = `${pathFor(path, "image")}/callouts/${index}`, frame = callout;
489
+ try {
490
+ representablePositionBox({ x: frame.x * canvas.width, y: frame.y * canvas.height, width: frame.width * canvas.width, height: frame.height * canvas.height }, at2.replace(/^\//, "").replaceAll("/", "."));
491
+ } catch (error) {
492
+ if (!(error instanceof PositionRangeError)) throw error;
493
+ issues.push(semanticIssue(`${at2}/${error.coordinate}`, error.message, { key: error.coordinate }));
494
+ }
495
+ }
496
+ });
497
+ }
441
498
  const allowedFields = /* @__PURE__ */ new Set([
442
499
  "type",
443
500
  ...spec.fields
444
501
  ]);
502
+ const listOfBullets = resolvedKind === "list" && hasOwn(value, "bullets") && !hasOwn(value, "items");
445
503
  for (const required of spec.required) {
446
- if (!hasOwn(value, required)) {
504
+ if (!hasOwn(value, required) && !listOfBullets) {
447
505
  issues.push(semanticIssue(path, `content payload type '${resolvedKind}' requires '${required}'`, {
448
506
  type: resolvedKind,
449
507
  required
@@ -458,27 +516,27 @@ function validateContentPayload(value, path, options2 = {}) {
458
516
  }
459
517
  const incompatible = payloadFields.filter((field) => !allowedFields.has(field));
460
518
  if (incompatible.length > 0) {
461
- issues.push(semanticIssue(path, `content payload type '${resolvedKind}' cannot include incompatible fields: ${incompatible.join(", ")}`, {
519
+ issues.push(semanticIssue(path, listOfBullets && incompatible.length === 1 ? "'bullets' belongs to a text payload, so it cannot be a 'list': write the entries under 'items', or remove 'type'" : `content payload type '${resolvedKind}' cannot include incompatible fields: ${incompatible.join(", ")}`, {
462
520
  type: resolvedKind,
463
521
  incompatible
464
522
  }));
465
523
  }
466
524
  return issues;
467
525
  }
468
- function slideRegion(key2) {
469
- if (key2.includes(":")) {
470
- const [rowPart, columnPart] = key2.split(":");
526
+ function slideRegion(key3) {
527
+ if (key3.includes(":")) {
528
+ const [rowPart, columnPart] = key3.split(":");
471
529
  if (!rowPart || !columnPart) return void 0;
472
530
  const rows = rowSpans[rowPart];
473
531
  const columns = columnSpans[columnPart];
474
532
  return rows && columns ? { rows, columns } : void 0;
475
533
  }
476
- if (key2 in columnSpans) {
477
- const columns = columnSpans[key2];
534
+ if (key3 in columnSpans) {
535
+ const columns = columnSpans[key3];
478
536
  return columns ? { rows: [0, 1, 2], columns } : void 0;
479
537
  }
480
- if (key2 in rowSpans) {
481
- const rows = rowSpans[key2];
538
+ if (key3 in rowSpans) {
539
+ const rows = rowSpans[key3];
482
540
  return rows ? { rows, columns: [0, 1, 2] } : void 0;
483
541
  }
484
542
  return void 0;
@@ -489,9 +547,9 @@ function intersects(left, right) {
489
547
  function regionsOverlap(left, right) {
490
548
  return intersects(left.rows, right.rows) && intersects(left.columns, right.columns);
491
549
  }
492
- function validateSlideRegions(slide, slidePath) {
550
+ function validateSlideRegions(slide, slidePath, canvas) {
493
551
  const issues = [];
494
- const regionKeys = Object.keys(slide).filter((key2) => promotedRegionKeySet.has(key2));
552
+ const regionKeys = Object.keys(slide).filter((key3) => promotedRegionKeySet.has(key3));
495
553
  const rootFields = presentFields(slide, rootPayloadFields);
496
554
  if (regionKeys.length > 0 && rootFields.length > 0) {
497
555
  issues.push(semanticIssue(slidePath, "root content payload fields cannot be mixed with promoted region keys", {
@@ -500,12 +558,12 @@ function validateSlideRegions(slide, slidePath) {
500
558
  }));
501
559
  }
502
560
  if (regionKeys.length === 0 && rootFields.length > 0) {
503
- issues.push(...validateContentPayload(slide, slidePath, { slideRoot: true }));
561
+ issues.push(...validateContentPayload(slide, slidePath, { slideRoot: true, ...canvas ? { canvas } : {} }));
504
562
  }
505
- for (const key2 of regionKeys) {
506
- const value = slide[key2];
563
+ for (const key3 of regionKeys) {
564
+ const value = slide[key3];
507
565
  if (isRecord(value)) {
508
- issues.push(...validateContentPayload(value, pathFor(slidePath, key2)));
566
+ issues.push(...validateContentPayload(value, pathFor(slidePath, key3), canvas ? { canvas } : {}));
509
567
  }
510
568
  }
511
569
  for (let leftIndex = 0; leftIndex < regionKeys.length; leftIndex += 1) {
@@ -529,19 +587,19 @@ function validateSlideRegions(slide, slidePath) {
529
587
  }
530
588
  function deckMetadataIssues(value) {
531
589
  const issues = [];
532
- const entries = (key2) => {
533
- const field = value[key2];
534
- if (Array.isArray(field)) return field.flatMap((entry2, index) => isRecord(entry2) ? [{ entry: entry2, path: `/${key2}/${index}` }] : []);
535
- return isRecord(field) ? [{ entry: field, path: `/${key2}` }] : [];
590
+ const entries = (key3) => {
591
+ const field = value[key3];
592
+ if (Array.isArray(field)) return field.flatMap((entry2, index) => isRecord(entry2) ? [{ entry: entry2, path: `/${key3}/${index}` }] : []);
593
+ return isRecord(field) ? [{ entry: field, path: `/${key3}` }] : [];
536
594
  };
537
595
  const organizationIds = /* @__PURE__ */ new Set();
538
- for (const key2 of ["organization", "speaker"]) {
596
+ for (const key3 of ["organization", "speaker"]) {
539
597
  const seen = /* @__PURE__ */ new Set();
540
- for (const { entry: entry2, path } of entries(key2)) {
598
+ for (const { entry: entry2, path } of entries(key3)) {
541
599
  if (typeof entry2.id !== "string") continue;
542
- if (seen.has(entry2.id)) issues.push(semanticIssue(`${path}/id`, `${key2} ids must be unique within a presentation`, { id: entry2.id }));
600
+ if (seen.has(entry2.id)) issues.push(semanticIssue(`${path}/id`, `${key3} ids must be unique within a presentation`, { id: entry2.id }));
543
601
  seen.add(entry2.id);
544
- if (key2 === "organization") organizationIds.add(entry2.id);
602
+ if (key3 === "organization") organizationIds.add(entry2.id);
545
603
  }
546
604
  }
547
605
  for (const { entry: entry2, path } of entries("speaker")) {
@@ -551,25 +609,36 @@ function deckMetadataIssues(value) {
551
609
  }
552
610
  return issues;
553
611
  }
554
- function presentationSemanticIssues(value) {
612
+ function presentationSemanticIssues(value, catalogs) {
555
613
  if (!isRecord(value) || !Array.isArray(value.slides)) {
556
614
  return [];
557
615
  }
558
616
  const issues = [];
559
- if (isEnUkTag(value.language)) {
560
- issues.push(semanticIssue("/language", "Use 'en-GB' for UK English; 'en-UK' is not a valid BCP-47 region tag", {
561
- replacement: "en-GB"
562
- }));
563
- } else if (isRecord(value.language) && isEnUkTag(value.language.bcp47)) {
564
- issues.push(semanticIssue("/language/bcp47", "Use 'en-GB' for UK English; 'en-UK' is not a valid BCP-47 region tag", {
565
- replacement: "en-GB"
566
- }));
567
- }
617
+ issues.push(...enUkIssues(value.language, "/language"));
568
618
  issues.push(...deckMetadataIssues(value));
569
619
  if (isRecord(value.variables) && hasOwn(value.variables, "speakers")) {
570
620
  issues.push(semanticIssue("/variables/speakers", "'speakers' is reserved for the built-in list of speaker names; choose another variable id", { id: "speakers" }));
571
621
  }
572
622
  const documentIds = /* @__PURE__ */ new Map();
623
+ let overlayCanvas, overlayCanvasResolved = false;
624
+ const deckCanvas = () => {
625
+ if (!overlayCanvasResolved) {
626
+ overlayCanvasResolved = true;
627
+ const design = isRecord(value.design) ? value.design : {};
628
+ const dimensions = design.dimensions ?? resolveDesignRecords(value, void 0, { catalogs: catalogs ?? [] }).theme.dimensions;
629
+ try {
630
+ overlayCanvas = resolveCanvasDimensions(dimensions);
631
+ } catch {
632
+ }
633
+ }
634
+ return overlayCanvas;
635
+ };
636
+ const canvasForOverlays = (slide, index) => {
637
+ if (!Array.isArray(slide.shapes) || !slide.shapes.some((shape) => isRecord(shape) && shape.connector === void 0 && ["x", "y", "width", "height"].every((key3) => typeof shape[key3] === "number" && Number.isFinite(shape[key3])))) return void 0;
638
+ const canvas = deckCanvas();
639
+ return canvas ? { ...canvas, rtl: resolveSlideDirection(value, index) === "rtl" } : void 0;
640
+ };
641
+ const hasCallouts = (node, depth2 = 0) => isRecord(node) && depth2 <= 34 && Object.entries(node).some(([key3, entry2]) => key3 === "callouts" ? Array.isArray(entry2) && entry2.length > 0 : key3 === "image" || key3 === "blocks" || promotedRegionKeySet.has(key3) ? Array.isArray(entry2) ? entry2.some((item) => hasCallouts(item, depth2 + 1)) : hasCallouts(entry2, depth2 + 1) : false);
573
642
  value.slides.forEach((slide, index) => {
574
643
  if (isRecord(slide)) {
575
644
  const slidePath = `/slides/${index}`;
@@ -585,7 +654,19 @@ function presentationSemanticIssues(value) {
585
654
  else documentIds.set(payload.id, "payload");
586
655
  }
587
656
  });
588
- issues.push(...validateSlideRegions(slide, slidePath));
657
+ if (Array.isArray(slide.shapes)) slide.shapes.forEach((entry2, shapeIndex) => {
658
+ if (!isRecord(entry2)) return;
659
+ const entryPath = `${slidePath}/shapes/${shapeIndex}`;
660
+ if (typeof entry2.id === "string") {
661
+ if (documentIds.has(entry2.id)) issues.push(semanticIssue(`${entryPath}/id`, "overlay ids must be unique among slide, payload and overlay ids within a presentation", { id: entry2.id }));
662
+ else documentIds.set(entry2.id, "payload");
663
+ }
664
+ const checked = isOverlayConnector(entry2) ? isRecord(entry2.adjust) ? { shape: connectorAdjustPreset(entry2), adjust: entry2.adjust } : void 0 : entry2;
665
+ if (checked) for (const issue2 of shapeIssues(checked, (...keys) => keys.reduce((at2, key3) => pathFor(at2, key3), entryPath))) issues.push(semanticIssue(issue2.path, issue2.message, { code: issue2.code, ...issue2.params }));
666
+ });
667
+ for (const issue2 of overlayIssues(slide, slidePath, value, canvasForOverlays(slide, index))) issues.push(semanticIssue(issue2.path, issue2.message, { ...issue2.code ? { code: issue2.code } : {}, ...issue2.params }));
668
+ issues.push(...enUkIssues(slide.language, `${slidePath}/language`));
669
+ issues.push(...validateSlideRegions(slide, slidePath, hasCallouts(slide) ? deckCanvas() : void 0));
589
670
  const payloadTableIssues = (payload, path) => {
590
671
  if (isRecord(payload.table)) for (const issue2 of tableGrid(payload.table).issues) issues.push(semanticIssue(pathFor(path, "table") + issue2.path.slice(5).replaceAll(".", "/"), issue2.message));
591
672
  };
@@ -695,9 +776,9 @@ function dataIssues(value) {
695
776
  const seen = /* @__PURE__ */ new Set();
696
777
  const add = (diagnostics) => {
697
778
  for (const diagnostic of diagnostics) {
698
- const key2 = `${diagnostic.code}|${diagnostic.path}`;
699
- if (seen.has(key2)) continue;
700
- seen.add(key2);
779
+ const key3 = `${diagnostic.code}|${diagnostic.path}`;
780
+ if (seen.has(key3)) continue;
781
+ seen.add(key3);
701
782
  (diagnostic.severity === "error" ? out.errors : out.warnings).push(semanticIssue(diagnostic.path, diagnostic.message, { code: diagnostic.code }));
702
783
  }
703
784
  };
@@ -749,12 +830,20 @@ function variableReferenceWarnings(value) {
749
830
  const variables = isRecord(value.variables) ? value.variables : {};
750
831
  const issues = [];
751
832
  const colorRef = (entry2, path) => {
833
+ if (isRecord(entry2) && entry2.color !== void 0) {
834
+ colorRef(entry2.color, pathFor(path, "color"));
835
+ return;
836
+ }
752
837
  if (typeof entry2 !== "string" || !entry2.startsWith("var:")) return;
753
838
  const id = entry2.slice("var:".length);
754
839
  if (!variableIdPattern.test(id) || hasOwn(variables, id)) return;
755
840
  issues.push(semanticIssue(path, `unknown variable '${id}'; declare it in the top-level variables map`, { id, code: "variable-reference-unknown" }));
756
841
  };
757
842
  const runColor = (entry2, path) => {
843
+ if (isRecord(entry2)) {
844
+ colorRef(entry2, path);
845
+ return;
846
+ }
758
847
  if (typeof entry2 !== "string") return;
759
848
  if (hexColorPattern.test(entry2) || schemeColorNames.has(entry2)) return;
760
849
  if (entry2.startsWith("var:") && variableIdPattern.test(entry2.slice("var:".length))) {
@@ -847,6 +936,9 @@ function variableReferenceWarnings(value) {
847
936
  textEntries(node.items, pathFor(path, "items"));
848
937
  textEntries(node.bullets, pathFor(path, "bullets"));
849
938
  table(node.table, pathFor(path, "table"));
939
+ if (isRecord(node.chart) && Array.isArray(node.chart.referenceLines)) node.chart.referenceLines.forEach((line2, index) => {
940
+ if (isRecord(line2) && isRecord(line2.stroke)) colorRef(line2.stroke.color, `${path}/chart/referenceLines/${index}/stroke/color`);
941
+ });
850
942
  };
851
943
  value.slides.forEach((slide, index) => {
852
944
  if (!isRecord(slide)) return;
@@ -886,24 +978,16 @@ function presentationReferenceWarnings(value, catalogs) {
886
978
  };
887
979
  highlightWarnings(slide, slidePath);
888
980
  visitContentPayloads(slide, slidePath, highlightWarnings);
889
- for (const key2 of Object.keys(slide)) {
890
- if (promotedRegionKeySet.has(key2)) {
891
- issues.push(...chartTypeWarnings(slide[key2], pathFor(slidePath, key2)));
981
+ for (const key3 of Object.keys(slide)) {
982
+ if (promotedRegionKeySet.has(key3)) {
983
+ issues.push(...chartTypeWarnings(slide[key3], pathFor(slidePath, key3)));
892
984
  }
893
985
  }
894
986
  });
895
987
  return issues;
896
988
  }
897
989
  function validateLanguageSemantics(value) {
898
- if (!isRecord(value)) {
899
- return [];
900
- }
901
- if (isEnUkTag(value.bcp47)) {
902
- return [semanticIssue("/bcp47", "Use 'en-GB' for UK English; 'en-UK' is not a valid BCP-47 region tag", {
903
- replacement: "en-GB"
904
- })];
905
- }
906
- return [];
990
+ return isRecord(value) ? enUkIssues(value.bcp47, "/bcp47") : [];
907
991
  }
908
992
  function contentDepthIssues(value) {
909
993
  if (!isRecord(value) || !Array.isArray(value.slides)) return [];
@@ -913,7 +997,7 @@ function contentDepthIssues(value) {
913
997
  if (Array.isArray(slide.blocks)) slide.blocks.forEach((block, i) => {
914
998
  stack.push({ value: block, path: `/slides/${index}/blocks/${i}`, depth: 0, ancestors: [] });
915
999
  });
916
- for (const key2 of promotedRegionKeys) if (hasOwn(slide, key2)) stack.push({ value: slide[key2], path: `/slides/${index}/${key2}`, depth: 0, ancestors: [] });
1000
+ for (const key3 of promotedRegionKeys) if (hasOwn(slide, key3)) stack.push({ value: slide[key3], path: `/slides/${index}/${key3}`, depth: 0, ancestors: [] });
917
1001
  });
918
1002
  while (stack.length) {
919
1003
  const entry2 = stack.pop();
@@ -967,9 +1051,9 @@ function typedVariableErrors(errors, value) {
967
1051
  function pointerValue(root, pointer4) {
968
1052
  let current = root;
969
1053
  for (const token of pointer4.split("/").slice(1)) {
970
- const key2 = token.replaceAll("~1", "/").replaceAll("~0", "~");
971
- if (Array.isArray(current)) current = current[Number(key2)];
972
- else if (isRecord(current) && hasOwn(current, key2)) current = current[key2];
1054
+ const key3 = token.replaceAll("~1", "/").replaceAll("~0", "~");
1055
+ if (Array.isArray(current)) current = current[Number(key3)];
1056
+ else if (isRecord(current) && hasOwn(current, key3)) current = current[key3];
973
1057
  else return void 0;
974
1058
  }
975
1059
  return current;
@@ -1037,12 +1121,13 @@ function validateAgainstSchema(value, schemaOrKind = "presentation", options2 =
1037
1121
  if (resolved.schemaName === "layout" && valid) for (const issue2 of layoutTemplateIssues(subject)) errors.push(semanticIssue(issue2.path, issue2.message, { code: issue2.code }));
1038
1122
  const warnings = [];
1039
1123
  if (resolved.schemaName === "presentation") {
1040
- errors.push(...presentationSemanticIssues(subject));
1124
+ errors.push(...presentationSemanticIssues(subject, options2.catalogs));
1041
1125
  errors.push(...variableIssues.errors);
1042
1126
  const data = dataIssues(subject);
1043
1127
  errors.push(...data.errors);
1044
1128
  warnings.push(...presentationReferenceWarnings(subject, options2.catalogs));
1045
1129
  warnings.push(...data.warnings);
1130
+ warnings.push(...overlayAnchorSizeWarnings(subject));
1046
1131
  warnings.push(...variableIssues.warnings);
1047
1132
  } else if (resolved.schemaName === "language") {
1048
1133
  errors.push(...validateLanguageSemantics(value));
@@ -1226,6 +1311,8 @@ function backdropOf(definition, scheme, text2, variables, canvasColor) {
1226
1311
  }
1227
1312
  }
1228
1313
  function backgroundColorRef(value, scheme, variables, fallback) {
1314
+ const transform = colorTransform(value);
1315
+ if (transform) return applyColorTransform(backgroundColorRef(transform.color, scheme, variables, fallback), transform);
1229
1316
  if (typeof value !== "string") return fallback;
1230
1317
  const literal = normalizeHexColor(value);
1231
1318
  if (literal) return literal;
@@ -1256,6 +1343,31 @@ function decisionColor(definition, scheme, variables = {}) {
1256
1343
  }
1257
1344
  }
1258
1345
  var THEME_SLOTS = /* @__PURE__ */ new Set(["light1", "light2", "dark1", "dark2"]);
1346
+ var PICTURE_STEPS = [0, 32, 64, 96, 128, 160, 192, 224, 255];
1347
+ var TONE_MARGIN = 1.2;
1348
+ function pictureColors(definition, scheme, variables = {}, grays) {
1349
+ const picture = imageBackground(definition);
1350
+ if (!picture) return [];
1351
+ const resolve2 = (value, fallback) => backgroundColorRef(value, scheme, variables, fallback);
1352
+ const recolor = rec(picture.recolor);
1353
+ const steps = PICTURE_STEPS;
1354
+ const duotone = recolor.dark !== void 0 && recolor.light !== void 0;
1355
+ const dark = duotone ? resolve2(recolor.dark, "#000000") : "#000000", light = duotone ? resolve2(recolor.light, "#FFFFFF") : "#FFFFFF";
1356
+ const base = defaultSlideBackground(scheme), opacity = picture.opacity ?? 1;
1357
+ const pixels = steps.map((step) => blend(blend(light, dark, step / 255), base, opacity));
1358
+ const overlay = rec(picture.overlay), alpha = typeof overlay.opacity === "number" ? Math.max(0, Math.min(1, overlay.opacity)) : void 0;
1359
+ if (overlay.color === void 0 || alpha === void 0) return pixels;
1360
+ const color = resolve2(overlay.color, "#000000"), covered = pixels.map((pixel) => blend(color, pixel, alpha));
1361
+ return overlay.edge === void 0 ? covered : [...pixels, ...covered];
1362
+ }
1363
+ function pictureTone(definition, scheme, variables = {}, grays) {
1364
+ const picture = imageBackground(definition);
1365
+ if (!picture || picture.recolor === void 0 && picture.overlay === void 0 && picture.opacity === void 0 && true) return void 0;
1366
+ const colors = pictureColors(definition, scheme, variables);
1367
+ const worst = (text2) => Math.min(...colors.map((color) => contrastRatio(text2, color)));
1368
+ const onDark = worst(resolveColorRoles(scheme, { variant: { background: "dark1" } }).text), onLight = worst(resolveColorRoles(scheme, { variant: { background: "light1" } }).text);
1369
+ return onDark >= onLight * TONE_MARGIN ? "dark" : onLight >= onDark * TONE_MARGIN ? "light" : void 0;
1370
+ }
1259
1371
  function colorChoice(levels, scheme, variables = {}) {
1260
1372
  let variantOnly = false;
1261
1373
  let picture;
@@ -1273,7 +1385,7 @@ function colorChoice(levels, scheme, variables = {}) {
1273
1385
  if (variantOnly || definition === void 0 || definition === null || definition === false) continue;
1274
1386
  if (themeSlot) return { variant: { background: themeSlot } };
1275
1387
  if (isPicture) {
1276
- const tone = rec(definition).tone;
1388
+ const tone = rec(definition).tone ?? pictureTone(definition, scheme, variables);
1277
1389
  if (tone === "dark" || tone === "light") return { variant: { background: tone === "dark" ? "dark1" : "light1" } };
1278
1390
  variantOnly = true;
1279
1391
  picture = { definition };
@@ -1283,11 +1395,11 @@ function colorChoice(levels, scheme, variables = {}) {
1283
1395
  }
1284
1396
  return {};
1285
1397
  }
1286
- function colorLevels(slideDesign, layout, deckDesign, theme, scheme, variables = {}) {
1287
- if (!layoutColorVariant(layout) || deckBackgroundIsFixed(deckDesign, theme.background)) return [slideDesign, deckDesign, theme];
1398
+ function colorLevels(slideDesign, layout, deckDesign, theme, scheme, variables = {}, surface) {
1399
+ if (!(surface ?? layoutColorVariant(layout)) || deckBackgroundIsFixed(deckDesign, theme.background) || surface && !layoutColorVariant(layout) && deckBackgroundIsChosen(deckDesign, theme.background)) return [slideDesign, deckDesign, theme];
1288
1400
  const below = colorChoice([deckDesign, theme], scheme, variables);
1289
1401
  const deck = resolveColorRoles(scheme, { background: below.background, variant: below.variant });
1290
- const variant = layoutColorVariant(layout, { background: deck.map.bg1, dark: deck.dark });
1402
+ const variant = surface ?? layoutColorVariant(layout, { background: deck.map.bg1, dark: deck.dark });
1291
1403
  const accents = variant.accents ?? below.variant?.accents;
1292
1404
  return [slideDesign, { variant: accents ? { ...variant, accents } : variant }, deckDesign, theme];
1293
1405
  }
@@ -1299,7 +1411,7 @@ function resolveDesign(document, index, context) {
1299
1411
  const fontDiagnostic = diagnostics.find((diagnostic) => diagnostic.kind === "fontSchemes");
1300
1412
  const dimensions = { width: options2.width, height: options2.height };
1301
1413
  const variables = rec(document.variables);
1302
- const choice = colorChoice(colorLevels(own4, resolved.layout, deck, theme, colorScheme, variables), colorScheme, variables);
1414
+ const choice = colorChoice(colorLevels(own4, resolved.layout, deck, theme, colorScheme, variables, resolved.messageSurface?.variant), colorScheme, variables);
1303
1415
  const roles = resolveColorRoles(colorScheme, { background: choice.background, variant: choice.variant });
1304
1416
  const dark = roles.dark;
1305
1417
  const text2 = roles.text;
@@ -1334,6 +1446,11 @@ function resolveDesign(document, index, context) {
1334
1446
  };
1335
1447
  }
1336
1448
  function resolveTextColor(reference, design, fallback) {
1449
+ const transform = colorTransform(reference);
1450
+ if (transform) {
1451
+ const base = resolveTextColor(transform.color, design, fallback);
1452
+ return base === void 0 ? void 0 : applyColorTransform(base, transform);
1453
+ }
1337
1454
  if (typeof reference !== "string" || !reference.trim()) return void 0;
1338
1455
  const literal = normalizeHexColor(reference);
1339
1456
  if (literal) return literal;
@@ -1381,10 +1498,13 @@ function backdropColors(backdrop, box, size, layer) {
1381
1498
  const opacity = layer?.opacity ?? backdrop.opacity;
1382
1499
  const ramp = layer?.grays ? [.../* @__PURE__ */ new Set([layer.grays[0], ...[0, 32, 64, 96, 128, 160, 192, 224, 255].filter((v) => v > layer.grays[0] && v < layer.grays[1]), layer.grays[1]])].map((v) => toHex([v, v, v])) : GREY_RAMP;
1383
1500
  const colors = ramp.map((grey) => {
1384
- let color = blend(grey, backdrop.base, opacity);
1501
+ const pixel = layer?.duotone ? blend(layer.duotone[1], layer.duotone[0], toRgb(grey)[0] / 255) : grey;
1502
+ let color = blend(pixel, backdrop.base, opacity);
1385
1503
  if (layer?.overlay) color = blend(layer.overlay.color, color, layer.overlay.opacity);
1386
1504
  return color;
1387
1505
  });
1506
+ const band = layer?.band;
1507
+ if (band) return { colors: [...band.whole ? [] : colors, ...colors.map((color) => blend(band.color, color, band.opacity))], unknown: true };
1388
1508
  return { colors, unknown: true };
1389
1509
  }
1390
1510
  }
@@ -1450,6 +1570,10 @@ function textValues(slide, slidePath) {
1450
1570
  push(at2("table", "rows", r, c, ...Object.hasOwn(styled, "value") ? ["value"] : []), value, "table", "table");
1451
1571
  });
1452
1572
  });
1573
+ const callouts = rec(node.image).callouts;
1574
+ if (Array.isArray(callouts)) callouts.forEach((callout, index) => {
1575
+ push(at2("image", "callouts", index, "text"), rec(callout).text, "callout", "image");
1576
+ });
1453
1577
  const quote = node.quote;
1454
1578
  if (typeof quote === "string") push(at2("quote"), quote, "quote", "quote");
1455
1579
  else if (quote && typeof quote === "object") {
@@ -1461,9 +1585,9 @@ function textValues(slide, slidePath) {
1461
1585
  const metric = node.metric;
1462
1586
  if (typeof metric === "string") push(at2("metric"), metric, "metric", "metric");
1463
1587
  else if (metric && typeof metric === "object")
1464
- for (const key2 of ["value", "label", "unit", "delta"]) {
1465
- const value = metric[key2];
1466
- if (typeof value === "string") push(at2("metric", key2), value, "metric", "metric");
1588
+ for (const key3 of ["value", "label", "unit", "delta"]) {
1589
+ const value = metric[key3];
1590
+ if (typeof value === "string") push(at2("metric", key3), value, "metric", "metric");
1467
1591
  }
1468
1592
  const timeline = node.timeline, events = Array.isArray(timeline) ? timeline : Array.isArray(rec(timeline).events) ? rec(timeline).events : [];
1469
1593
  if (typeof rec(timeline).name === "string") push(at2("timeline", "name"), rec(timeline).name, "timeline", "timeline");
@@ -1489,7 +1613,12 @@ function runsOf(tv) {
1489
1613
  valuePath: tv.path
1490
1614
  }));
1491
1615
  }
1492
- function altOf(value, assets) {
1616
+ function altOf(value, assets, variables, template) {
1617
+ if (typeof value === "string" && value.startsWith("var:")) {
1618
+ const variable = rec(rec(variables)[value.slice(4)]);
1619
+ const resolved = variable.type === "image" ? variable.value ?? (template === true ? variable.example : void 0) : void 0;
1620
+ return resolved === void 0 || typeof resolved === "string" && resolved.startsWith("var:") ? void 0 : altOf(resolved, assets);
1621
+ }
1493
1622
  const own4 = typeof value === "object" && value !== null ? value.alt : void 0;
1494
1623
  if (typeof own4 === "string") return own4;
1495
1624
  let source = typeof value === "string" ? value : rec(value).src;
@@ -1515,7 +1644,7 @@ function assetRefs(document, slide, slidePath, includeDeck) {
1515
1644
  }
1516
1645
  const designRefs = (design, base) => {
1517
1646
  for (const kind of ["header", "footer"])
1518
- for (const zone of ["left", "center", "right"]) {
1647
+ for (const zone of ["start", "center", "end"]) {
1519
1648
  const item = rec(rec(design[kind])[zone]);
1520
1649
  if (item.image !== void 0 && !isLogoReference(item.image)) out.push({ path: `${base}/${kind}/${zone}/image`, value: item.image, kind: "furniture" });
1521
1650
  }
@@ -1598,14 +1727,23 @@ var formatRules = [
1598
1727
  rule("reference-id-duplicate", "format", "error", "Two references share an id.", "A citation names a reference by id; a repeated id makes it ambiguous which entry is cited.", { standard: SCHEMA }),
1599
1728
  rule("cite-unknown-reference", "format", "error", "A citation names a reference that does not exist.", "A cited id with no entry in `references` has nothing to show in the footnote area.", { standard: SCHEMA }),
1600
1729
  rule("cite-unsupported-location", "format", "error", "A citation or footnote sits where no engine draws it.", "`cite` and `footnote` apply to runs in text, bullets and list items; table cells, captions, and reference and footnote texts have no marker.", { standard: SCHEMA }),
1601
- rule("caption-unsupported-payload", "format", "error", "A caption is on a payload that cannot carry one.", "A caption belongs to exactly one image, chart, table or video; a group, text or code block has no place to draw it.", { standard: SCHEMA }),
1602
- rule("image-option-unsupported-payload", "format", "error", "An image option is on a payload that is not an image.", "`fit`, `focus`, the image treatments (`shape`, `cornerRadius`, `border`, `opacity`, `recolor`, `overlay`, `aspectRatio`) and `placement` describe how a picture is drawn; a group, text or chart block has no picture for them to apply to.", { standard: SCHEMA }),
1730
+ rule("caption-unsupported-payload", "format", "error", "A caption is on a payload that cannot carry one.", "A caption belongs to exactly one image, chart, table, video or diagram; a group, text or code block has no place to draw it.", { standard: SCHEMA }),
1731
+ rule("image-option-unsupported-payload", "format", "error", "An image option is on a payload that is not an image.", "`fit`, `focus`, the image treatments (`shape`, `adjust`, `stroke`, `opacity`, `recolor`, `overlay`, `aspectRatio`), `placement` and `portrait` describe how a picture is drawn; a group, text or chart block has no picture for them to apply to. A shape block takes `shape`, `adjust`, `stroke`, `opacity` and `aspectRatio` too.", { standard: SCHEMA }),
1732
+ rule("shape-option-unsupported-payload", "format", "error", "A shape option is on a payload that is not a shape block.", "`fill`, `style`, `rotate`, `flip`, `anchor`, `padding`, `textDirection`, `alt`, `decorative`, `hidden`, `link` and the effects (`shadow`, `innerShadow`, `glow`, `softEdge`, `reflection`, `blur`) describe how a shape block is drawn; a text, chart or image block, or a group, has no shape for them to apply to.", { standard: SCHEMA }),
1733
+ rule("shape-adjust-unknown", "format", "warning", "An adjust value names a guide the preset does not have.", "Each preset has its own adjust handles (DrawingML's avLst guides: `adj`, `adj1`, `adj2`, ...); a name the preset does not have changes nothing, and a custom `path` has none. The preset's default is drawn.", { standard: "ECMA-376 Part 1, 20.1.10.56 (ST_ShapeType) and presetShapeDefinitions.xml" }),
1734
+ rule("shape-adjust-range", "format", "warning", "An adjust value is outside the range of the preset's handle.", "An adjust value outside the range its handle allows is pinned by the preset's own formulas, so the shape is not drawn as the value says; core draws the preset's default instead and both engines agree.", { standard: "ECMA-376 Part 1, 20.1.10.56 (ST_ShapeType) and presetShapeDefinitions.xml", approximations: "Ranges are checked at a square shape of the default size; a handle whose range depends on the shape's proportions is checked at those proportions when the shape is drawn." }),
1735
+ rule("shape-link-hidden", "format", "warning", "A hidden shape carries a link.", "A hidden shape (`hidden: true`) is not drawn, so its `link` can never be clicked in a slide show.", { standard: SCHEMA }),
1736
+ rule("shape-anchor-missing", "format", "error", "An overlay shape has no resolvable block or qualified plotted chart point.", "An overlay shape placed with `at` sits against a composed block of its slide, named by the block's `id`. A chart point also requires a unique plotted category and series in a qualified shared plot. When an identity or geometry is missing, the shape is not drawn.", { standard: SCHEMA }),
1737
+ rule("shape-anchor-size-unit", "format", "warning", "A pixel size is under a fraction key.", "In `at`, `width` and `height` are fractions of the block (up to 8); pixels are `widthPx` and `heightPx`. A value above 4 and up to 8 is reported here; above 8 it is a schema error that offers the same rename.", { standard: SCHEMA }),
1738
+ rule("connector-end-missing", "format", "error", "A connector end names no block or overlay shape on the slide.", "A connector joins two shapes of its slide, each named by the `id` of a block or an overlay shape. With an end that names nothing (or names a connector) there is nothing to glue it to, so it is not drawn.", { standard: SCHEMA }),
1603
1739
  rule("image-placement-invalid", "format", "error", "An image placement cannot be honoured.", "A placed image bleeds to a slide edge and the rest of the slide composes beside it. Only a top-level block (slides.N.blocks.I) can do that, and a slide edge holds one placed image; a block in a group or a promoted region, or a second block on the same edge, has nowhere to go.", { standard: SCHEMA }),
1604
1740
  rule("layout-placeholder-group", "format", "error", "A layout record's placeholder group breaks a nesting rule.", "A placeholder group arranges body regions inside one cell of its layout record. Groups nest at most three levels inside a record, and a group holds body regions and groups only: the headings (title, subtitle, tag) stay at the record's top level, where the engine places them. Composition cannot use a record that breaks either rule.", { standard: SCHEMA }),
1605
1741
  rule("dataset-unknown", "format", "error", "A chart or table names a dataset that does not exist.", "The data cannot be drawn without the dataset it refers to.", { standard: SCHEMA }),
1606
1742
  rule("dataset-field-unknown", "format", "error", "A table asks a dataset for a column it does not have.", "The column cannot be shown when the dataset has no column of that name.", { standard: SCHEMA }),
1607
1743
  rule("data-column-duplicate", "format", "error", "A dataset or table has two columns with the same name.", "Series, mappings and fields address columns by name, so a repeated name makes them ambiguous.", { standard: SCHEMA }),
1608
1744
  rule("chart-mapping-unknown-column", "format", "error", "A chart mapping names a column the data does not have.", "The series cannot be built from a column that is not there.", { standard: SCHEMA }),
1745
+ rule("chart-reference-axis-unavailable", "format", "error", "A reference names a value axis the chart does not have.", "Secondary references require an actual secondary line series on a combo chart.", { standard: SCHEMA }),
1746
+ rule("chart-reference-unsupported-type", "format", "error", "A chart has reference lines but its type has no single value axis to draw them on.", "An explicit reference line is never dropped silently, so a chart type that cannot draw it is an error. Column, bar, line, line-with-markers, area and combo charts draw references; the stacked, 100% stacked and every other type do not.", { standard: SCHEMA }),
1609
1747
  rule("number-format-invalid", "format", "error", "A number format cannot be read.", "A format code that no engine can parse is drawn as the plain number or fails to export.", { standard: "Excel number format codes, as far as OPF supports them" }),
1610
1748
  rule("variable-invalid-value", "format", "error", "A variable value does not match its declared type.", "A number variable given text, or a date given a non-date, cannot be filled into the deck.", { standard: SCHEMA }),
1611
1749
  rule("variable-unknown-builtin", "format", "error", "A token names a built-in variable that does not exist.", "The `deck.`, `speaker.`, `organization.` and `slide.` names (and `speakers`) are reserved for built-in variables; a name under them that is not a built-in can never be filled, so the token would show literally. The slide-scoped `slide.number`, `slide.section` and `deck.slideCount` are inline tokens only, so `var:slide.*` and `var:deck.slideCount` are reported too; organization logos are whole-field references only (`var:organization.logo.icon`), so a `{{organization.logo}}` token, an unknown logo shape or an unknown organization id is reported.", { standard: SCHEMA }),
@@ -1667,7 +1805,7 @@ var referenceRules = [
1667
1805
  "references",
1668
1806
  "error",
1669
1807
  "A layout template's regions are not valid.",
1670
- "Region names are unique across the whole record and may not be tag, auto or a promoted-region word (left, center, right, top, middle, bottom), so a Markdown block's region= stays unambiguous; title and subtitle name the heading regions, which take only a size, an anchor and (the title) a rule; a subtitle region needs a title region; a region accepts at least one content kind; a region with flow 'none' holds one block; overflowRegion must name a body region. composeSlide refuses such a record.",
1808
+ "Region names are unique across the whole record and may not be tag, auto or a promoted-region word (start, center, end, top, middle, bottom), so a Markdown block's region= stays unambiguous; title and subtitle name the heading regions, which take only a size, an anchor and (the title) a rule; a subtitle region needs a title region; a region accepts at least one content kind; a region with flow 'none' holds one block; overflowRegion must name a body region. composeSlide refuses such a record.",
1671
1809
  { standard: "spec/schemas/layout.schema.json and the region rules (docs/layout-templates.md)" }
1672
1810
  ),
1673
1811
  rule(
@@ -1689,6 +1827,8 @@ var referenceRules = [
1689
1827
  rule("undeclared-catalog", "format", "error", "A reference names a catalog group the document does not declare.", "The prefix of a `name:id` reference names the group of `catalogs` it resolves in. A prefix with no group can never resolve, whatever the host registers, so it is a format error: engines reject the document at their format check instead of drawing a fallback.", { standard: SCHEMA }),
1690
1828
  rule("unused-reference", "references", "warning", "A reference is never cited.", "A listed reference that no run cites is not drawn anywhere.", { standard: SCHEMA }),
1691
1829
  rule("unused-dataset", "references", "warning", "A dataset is never used.", "A dataset no chart or table references is not drawn anywhere.", { standard: SCHEMA }),
1830
+ rule("icon-unknown", "references", "warning", "An icon names a set or an icon that does not exist.", 'An `icon` is "<set>:<name>" (a set the document embeds or a registered catalog defines, such as lucide and tabler of the gallery), a name of the `icons` of the deck, or an SVG source. One that resolves nowhere is not drawn: the entry, metric or group keeps its text and has no chip.', { standard: SCHEMA, approximations: "A set a host registers as a loader is checked once it is loaded (ensureIcons): the CLI, the MCP and the Node file API load the sets a deck names before they validate it; the synchronous validate alone checks only the set ids and the sets the document embeds. Suggestions are the nearest names of the set (or of the icons of the deck)." }),
1831
+ rule("icon-invalid", "references", "warning", "The SVG of an icon cannot be drawn as an icon.", "The SVG of an icon is read, never run: a script, an event handler, an external reference (an href or url() that is not a fragment) or a raster image makes it unusable, as does SVG text that is not well formed or has no size. It is not drawn.", { standard: SCHEMA }),
1692
1832
  rule("unknown-beat", "references", "warning", "A slide names a beat its narrative does not define.", "`slides[].beat` links a slide to a step of the narrative plan. A beat id the narrative does not have links to nothing; nothing is drawn from a beat.", { standard: SCHEMA, approximations: "The narrative resolves like every content reference: the document's catalogs groups, then the registered catalogs. A narrative that resolves nowhere is not checked." }),
1693
1833
  rule("slide-theme-dimensions", "references", "warning", "A slide theme sets a slide size that differs from the deck.", "A PPTX has one slide size. The size a slide-level theme carries is never used: design.dimensions of the deck (or of its theme) wins in every engine, and without them the exporter stops with mixed slide sizes.", { standard: SCHEMA }),
1694
1834
  rule("variable-unknown", "references", "warning", "A `{{token}}` names a variable that is not declared.", "An undeclared token is shown literally.", { standard: SCHEMA }),
@@ -1718,10 +1858,11 @@ var dataRules = [
1718
1858
  ),
1719
1859
  rule("chart-mapping-adapted", "content", "warning", "A chart mapping entry is ignored.", "A mapping that names a column the chart type cannot use is left out of the chart.", { standard: SCHEMA }),
1720
1860
  rule("chart-highlight-adapted", "content", "warning", "A chart highlight is adapted by the chart type.", "A highlight the chart type cannot show as authored (a category highlight on a chart without categories, for example) is adapted by every engine, so the emphasis is not exactly what was written.", { standard: SCHEMA }),
1721
- rule("chart-series-dropped", "content", "warning", "A chart series is not drawn by the chart type.", "A treemap, histogram, Pareto, waterfall, funnel, map or single-series pie plots one value series, and a scatter plots no X column without numbers. Every engine leaves the same columns out (LH-60), so the warning names them instead of losing them silently.", { standard: SCHEMA, approximations: "Read from the drawn chart (chartDrawPlan): a world chart over categories that are mostly not places is drawn as columns, a box-and-whisker chart with one value per category as one box per series and a pie or doughnut of several series as nested rings, and none of those drops a series." }),
1861
+ rule("chart-series-dropped", "content", "warning", "A chart series is not drawn by the chart type.", "A treemap, histogram, one-series Pareto, waterfall, funnel, map or single-series pie plots one value series, and a scatter plots no X column without numbers. Every engine leaves the same columns out (LH-60), so the warning names them instead of losing them silently.", { standard: SCHEMA, approximations: "Read from the drawn chart (chartDrawPlan): a world chart over categories that are mostly not places and a Pareto chart of several series are drawn as columns, a box-and-whisker chart with one value per category as one box per series and a pie or doughnut of several series as nested rings, and none of those drops a series." }),
1722
1862
  rule("code-highlight-out-of-range", "content", "warning", "A code highlight marks a line the code does not have.", "Marked lines count from 1 by line break in code.source; an entry past the last line marks nothing.", { standard: SCHEMA }),
1723
1863
  rule("code-highlight-range-reversed", "content", "warning", "A code highlight range ends before it starts.", "A range written end before start marks nothing; write the smaller line number first.", { standard: SCHEMA }),
1724
1864
  rule("variable-builtin-missing", "content", "warning", "A built-in variable has no value in this document.", "A `{{deck.*}}`, `{{speaker.*}}` or `{{organization.*}}` token whose field the document does not set resolves to nothing, so the text shows a gap; a `var:organization.logo` reference to an organization without a logo draws no image. `{{slide.section}}` is checked per slide: a slide without a `section` that uses it, in its own text or in the header or footer it inherits, is reported at that slide.", { standard: SCHEMA }),
1865
+ rule("variable-group-omitted", "content", "info", "A group is drawn only when one of its optional variables has a value.", "A group (a block or promoted region with `blocks`) whose content variables are all optional (`required: false`) and all unfilled is left out whole when the deck is filled: its pictures, cards and other text go with the fields the variables would fill, so a slide never draws a card around a picture with no text. Validation fills every variable with its example or a sample, so it reports the group here instead.", { standard: SCHEMA, approximations: "Counts the declared text, number, date, image, url and list variables the group uses as `{{id}}` or `var:id`, at any depth; color variables and built-ins do not count. A group that uses none, or any required or filled one, is kept and not reported." }),
1725
1866
  rule("duration-outside-narrative", "content", "warning", "The target duration is outside the range the narrative suits.", "A narrative records the talk lengths it suits. A deck whose duration is outside that range probably needs a different narrative or a different length; nothing is drawn or exported differently.", { standard: SCHEMA }),
1726
1867
  rule("narrative-duration-range", "content", "warning", "An inline narrative duration range has min greater than max.", "A range with its bounds swapped matches no duration, so the duration check cannot help.", { standard: "spec/schemas/narrative.schema.json" })
1727
1868
  ];
@@ -1742,13 +1883,13 @@ var onImageRule = rule(
1742
1883
  "text-on-image",
1743
1884
  "accessibility",
1744
1885
  "info",
1745
- "Text sits on a background picture: a note when core draws its automatic scrim behind it, otherwise its contrast cannot be guaranteed.",
1746
- "Contrast over a photograph depends on the photograph. Core draws an automatic scrim behind text on a picture background that has no overlay, at the lowest opacity that keeps it at 4.5:1 over any picture, and this note names it. With an edge-band overlay, or the scrim turned off (overlay: false), only a full-frame overlay that guarantees readability for every possible image certifies the result from the document.",
1886
+ "Text sits on a background picture: a note when core draws its automatic scrim behind it, a warning when the text is too faint over every color the picture can show, otherwise its contrast cannot be guaranteed.",
1887
+ "Contrast over a photograph depends on the photograph. Core draws an automatic scrim behind text on a picture background that has no overlay, at the lowest opacity that keeps it at 4.5:1 over any picture, and this note names it. With an edge-band overlay, or the scrim turned off (overlay: false), only a full-frame overlay that guarantees readability for every possible image certifies the result from the document. Text that stays below the threshold over every color the picture can show (a duotone in dark colors under dark text, for one) is a warning: it is low contrast whatever the picture.",
1747
1888
  {
1748
1889
  standard: "WCAG 2.2 SC 1.4.3 Contrast (Minimum), level AA",
1749
1890
  thresholds: ["contrastNormal", "contrastLarge"],
1750
1891
  cost: "composition",
1751
- approximations: "Core reads picture pixels only through a host that measures them (ComposeSlideOptions.pictureLuminance). Otherwise the picture is bounded by a gray ramp from black to white, composited through the image opacity and a full-frame design.background overlay or the automatic scrim over the text it covers; the text passes only when every step of that ramp passes. An edge-banded overlay is not counted."
1892
+ approximations: "Core reads picture pixels only through a host that measures them (ComposeSlideOptions.pictureLuminance). Otherwise the picture is bounded by a gray ramp from black to white, composited through the image opacity and a full-frame design.background overlay or the automatic scrim over the text it covers; the text passes only when every step of that ramp passes. A duotone recolor bounds the ramp to its own two colors, and an edge-banded overlay counts over the text it reaches, beside the uncovered picture where the text reaches past it."
1752
1893
  }
1753
1894
  );
1754
1895
  var altRule = rule(
@@ -1759,7 +1900,7 @@ var altRule = rule(
1759
1900
  'People using a screen reader get nothing for a picture without alternative text. A picture that is purely decorative should say so with an empty alt (alt: ""), which is an explicit, reviewed choice instead of an omission.',
1760
1901
  {
1761
1902
  standard: "WCAG 2.2 SC 1.1.1 Non-text Content, level A",
1762
- approximations: "Checks the alt field of images (image blocks, Slide.image and region images, placed or not), video, organization logos (each shape and background), header/footer images (a logo reference such as var:organization.logo.icon is checked on the organization), quote photos and speaker photos, following asset: references to the assets registry. Whether the text describes the picture well is not judged here (see opf/poor-alt-text). Charts carry `chart.alt` and are checked by opf/chart-text-alternative. Picture backgrounds are decorative unless they carry their own alt, and watermarks are decorative, so neither is checked."
1903
+ approximations: "Checks the alt field of images (image blocks, Slide.image and region images, placed or not), video, organization logos (each shape and background), header/footer images (a logo reference such as var:organization.logo.icon is checked on the organization), quote photos and speaker photos, following asset: references to the assets registry and image variables (var:<id>, RR-105) to their value (a template's unfilled variable to its example). Whether the text describes the picture well is not judged here (see opf/poor-alt-text). Charts carry `chart.alt` and are checked by opf/chart-text-alternative. Picture backgrounds are decorative unless they carry their own alt, and watermarks are decorative, so neither is checked."
1763
1904
  }
1764
1905
  );
1765
1906
  var poorAltRule = rule(
@@ -1795,7 +1936,7 @@ var readingOrderRule = rule(
1795
1936
  {
1796
1937
  standard: 'WCAG 2.2 SC 1.3.2 Meaningful Sequence, level A (PowerPoint: "Check reading order")',
1797
1938
  cost: "composition",
1798
- approximations: "Compares the composed content order with a visual order recomputed from the composed boxes: items whose vertical centres fall in the same row are ordered along the reading direction (a right-to-left deck is checked by rows only), rows from top to bottom. Headings are expected first. Content drawn entirely above the title, over the columns of the title, is reported; content in a column beside the title is read after it. Free-form overlap is not analysed. On a slide with a template layout (OPF 0.19) the expected order is the binding order instead (the regions in reading order, then the blocks of each region), and items outside a region (placed images, the row below the grid) are not compared."
1939
+ approximations: "Compares the composed content order with a visual order recomputed from the composed boxes: items whose vertical centres fall in the same row are ordered along the reading direction (a right-to-left deck is checked by rows only), rows from top to bottom. A block is one unit (RR-105): blocks are ordered by the boxes that hold them, and a group's own items are read, in their own visual order, before the next block, so cards side by side (a picture over a name) read card by card. Headings are expected first. Content drawn entirely above the title, over the columns of the title, is reported; content in a column beside the title is read after it. Free-form overlap is not analysed. On a slide with a template layout (OPF 0.19) the expected order is the binding order instead (the regions in reading order, then the blocks of each region), and items outside a region (placed images, the row below the grid) are not compared."
1799
1940
  }
1800
1941
  );
1801
1942
  var linkRule = rule(
@@ -1815,7 +1956,7 @@ var chartColorRule = rule(
1815
1956
  {
1816
1957
  standard: "WCAG 2.2 SC 1.4.1 Use of Color, level A",
1817
1958
  thresholds: ["minSeriesColorDifference"],
1818
- approximations: "Uses the engine's series palette (ValidateOptions.chartPalette; default chartSeriesPalette of each slide color scheme (accent1 to accent6, then their tints), adjusted for the slide background and softened like the engines draw them, LH-105) in series order: series i takes colour i, pie/doughnut/treemap/funnel slices take colours per category. Pairs are compared by CIE76 distance after simulating protanopia, deuteranopia, tritanopia (Machado 2009, severity 1) and greyscale. Neighbouring series (and neighbouring slices, the last beside the first) must also differ by at least 11 in CIE L* (the lightness step the engines keep when they adjust a palette), since lightness is the cue left without hue (LH-35); a pair under it is reported as a lightness pair. Single-series charts and chart types without a series legend are skipped."
1959
+ approximations: "Uses the engine's series palette (ValidateOptions.chartPalette; default chartSeriesPalette of each slide color scheme (accent1 to accent6, then their tints), adjusted for the slide background and softened like the engines draw them, LH-105) in series order: series i takes color i, pie/doughnut/treemap/funnel slices take colours per category. Pairs are compared by CIE76 distance after simulating protanopia, deuteranopia, tritanopia (Machado 2009, severity 1) and greyscale. Neighbouring series (and neighbouring slices, on a pie or doughnut the last beside the first, which the engines move off the first by at most 20 L* or, where that is not enough, separate with a surface-colored slice border that this rule accepts, LH-161) must also differ by at least 11 in CIE L* (the lightness step the engines keep when they adjust a palette), since lightness is the cue left without hue (LH-35); a pair under it is reported as a lightness pair. Single-series charts and chart types without a series legend are skipped."
1819
1960
  }
1820
1961
  );
1821
1962
  var chartAltRule = rule(
@@ -1843,7 +1984,7 @@ var languageRule = rule(
1843
1984
  "info",
1844
1985
  "The presentation does not declare its language.",
1845
1986
  "Screen readers and text-to-speech choose pronunciation and hyphenation from the declared language; spell checkers and translation tools use it too.",
1846
- { standard: "WCAG 2.2 SC 3.1.1 Language of Page, level A", approximations: "Only the presentation-level `language` is checked, not the language of individual runs (`TextRun.lang`; opf/language-tag checks how those tags are written)." }
1987
+ { standard: "WCAG 2.2 SC 3.1.1 Language of Page, level A", approximations: "Only the presentation-level `language` is checked, not the language of individual runs (`TextRun.language`; opf/language-tag checks how those tags are written)." }
1847
1988
  );
1848
1989
  var MAX_FURNITURE_LINES = 2;
1849
1990
  var overflowRule = rule(
@@ -1851,7 +1992,7 @@ var overflowRule = rule(
1851
1992
  "layout",
1852
1993
  "warning",
1853
1994
  "Text or a table does not fit its space at the smallest allowed size.",
1854
- "Core composition shrinks text to the readable minimum and then reports what still does not fit. Overflowing text is clipped or runs over other content in the preview and in PowerPoint.",
1995
+ "Core composition changes the arrangement (columns, the automatic grid, another design) before it sets text smaller, fits dense content that no arrangement holds down the type scale to the readable minimum, never below it, and then reports what still does not fit. Overflowing text is clipped or runs over other content in the preview and in PowerPoint.",
1855
1996
  {
1856
1997
  cost: "composition",
1857
1998
  approximations: "Uses composeSlide at the deck's slide size with the fonts of the resolved font scheme. Without a host-supplied text measurement (ValidateOptions.fonts.textMeasurement) widths are core's portable estimate, which can differ from the real font by a few percent; pass the renderer's measurement for font-exact results. A composition that sets overflow: \"error\" is reported as a warning here, so that `valid` never depends on font metrics; rendering and export still refuse such a slide when it does not fit."
@@ -1910,6 +2051,46 @@ var regionFullRule = rule(
1910
2051
  "A region holds at most `max` blocks on one slide. A pin to a full region is ignored and the block is placed by its kind.",
1911
2052
  { cost: "composition" }
1912
2053
  );
2054
+ var iconDroppedRule = rule(
2055
+ "icon-dropped",
2056
+ "layout",
2057
+ "warning",
2058
+ "An icon is not drawn.",
2059
+ "An icon is decoration: it never costs text its size. When the chips would set any block smaller than the slide sets it without them, the slide is drawn without its icons, and an icon on something icons do not mark (a nested or numbered list entry) is not drawn either. The text is always drawn.",
2060
+ { cost: "composition" }
2061
+ );
2062
+ var arrangementAdaptedRule = rule(
2063
+ "arrangement-adapted",
2064
+ "layout",
2065
+ "info",
2066
+ "A pyramid, matrix, cycle, row of chevrons or flow is drawn another way.",
2067
+ "A `pyramid`, `matrix`, `cycle`, `chevrons`, `flow` or `vertical-flow` region draws a list of one level of short entries as that diagram (docs/smartart.md). A matrix needs exactly four entries for its quadrants; with another count its entries are drawn as a grid of cards. A list the arrangement does not draw (nested entries, descriptions, icons, numbering, too many entries), or whose entries fit neither PowerPoint's design nor OPF's at the list's size, is drawn as a list.",
2068
+ { cost: "composition" }
2069
+ );
2070
+ var shapeOffSlideRule = rule(
2071
+ "shape-off-slide",
2072
+ "layout",
2073
+ "warning",
2074
+ "A shape or image callout lies wholly outside the slide.",
2075
+ "Overlay shapes and image callouts may straddle or leave the slide on purpose, so a position outside it is valid. One with no part on the slide draws nothing, which is nearly always a percent or a pixel written where a fraction belongs.",
2076
+ { cost: "composition" }
2077
+ );
2078
+ var chartLabelCollisionRule = rule(
2079
+ "chart-label-collision",
2080
+ "layout",
2081
+ "warning",
2082
+ "A reference label meets another label, a data line or a mark at both ends of its line.",
2083
+ "A reference label is tried above and below its line (beside it on a bar chart), at its own end and then at the other end of the line. When all four places meet another reference label, a data line, a bar or an area, it is drawn at the first and reported; its text and value are kept, and on a bar or an area it stands on a plate of the chart background.",
2084
+ { cost: "composition" }
2085
+ );
2086
+ var timelinePeriodShortRule = rule(
2087
+ "timeline-period-short",
2088
+ "layout",
2089
+ "warning",
2090
+ "A timeline period is too short to read.",
2091
+ 'A timeline period keeps the proportion its `duration` gives it, whatever the size. A period shorter than its marker is drawn as it is and reported; it is not text overflow, so a strict composition (`overflow: "error"`) does not refuse the slide.',
2092
+ { cost: "composition" }
2093
+ );
1913
2094
  var unplacedRule = rule(
1914
2095
  "layout-unplaced",
1915
2096
  "layout",
@@ -1985,11 +2166,11 @@ var languageTagRule = rule(
1985
2166
  "language-tag",
1986
2167
  "content",
1987
2168
  "warning",
1988
- "A language tag is malformed, uses an unassigned region or is not in canonical case.",
1989
- "Engines read the deck language and each run's `lang` as BCP 47 tags to choose script fonts, text direction, proofing language and the PowerPoint `lang` attribute. A tag such as `en-a`, or a region that does not exist (`en-UK`; the United Kingdom is `GB`), is guessed at or dropped, and a wrong-case tag (`EN-us`) is not what a locale lookup expects.",
2169
+ "A language tag is malformed, uses an unassigned region, is not in canonical case or names a numbering system OPF does not draw.",
2170
+ "Engines read the deck and slide language and each run's `language` as BCP 47 tags to choose script fonts, text direction, proofing language and the PowerPoint `lang` attribute. A tag such as `en-a`, or a region that does not exist (`en-UK`; the United Kingdom is `GB`), is guessed at or dropped, and a wrong-case tag (`EN-us`) is not what a locale lookup expects.",
1990
2171
  {
1991
2172
  standard: "BCP 47 (RFC 5646, section 2.1) and the platform locale data (Intl.getCanonicalLocales, Intl.DisplayNames)",
1992
- approximations: "Checks the root `language` (a tag string, or the `bcp47` of an inline Language object) and `lang` on the TextRun objects of titles, subtitles, tags, text, lists, tables, quotes, metrics and timelines. A region is assigned when the runtime's CLDR data names it (ISO 3166-1 codes and UN M.49 areas such as 419); private-use regions (`AA`, `QM`-`QZ`, `XA`-`XZ`) and `ZZ` are accepted, as are private-use (`x-...`) tags. Only the spelling of a tag is checked, not whether the language subtag is assigned or whether the language suits the text. The schema rejects tags with characters other than letters, digits and hyphens (`en_US` is a schema error, with no suggestion), and `en-UK` as the deck language is already an error of the schema rule, so those are not reported twice."
2173
+ approximations: "Checks the root and slide `language` (a tag string, or the `bcp47` of an inline Language object) and `language` on the TextRun objects of titles, subtitles, tags, text, lists, tables, quotes, metrics and timelines. A region is assigned when the runtime's CLDR data names it (ISO 3166-1 codes and UN M.49 areas such as 419); private-use regions (`AA`, `QM`-`QZ`, `XA`-`XZ`) and `ZZ` are accepted, as are private-use (`x-...`) tags. Only the spelling of a tag is checked, not whether the language subtag is assigned or whether the language suits the text. The schema rejects tags with characters other than letters, digits and hyphens (`en_US` is a schema error, with no suggestion), and `en-UK` as the deck language is already an error of the schema rule, so those are not reported twice."
1993
2174
  }
1994
2175
  );
1995
2176
  var SHRUNK_RATIO = 0.7;
@@ -2101,6 +2282,11 @@ var implementedRules = [
2101
2282
  regionKindRule,
2102
2283
  regionFullRule,
2103
2284
  unplacedRule,
2285
+ iconDroppedRule,
2286
+ arrangementAdaptedRule,
2287
+ chartLabelCollisionRule,
2288
+ timelinePeriodShortRule,
2289
+ shapeOffSlideRule,
2104
2290
  furnitureWrapsRule,
2105
2291
  outsideRule,
2106
2292
  resolutionRule,
@@ -2147,13 +2333,17 @@ var isLarge = (sizePx, bold) => {
2147
2333
  return pt >= 18 || bold && pt >= 14;
2148
2334
  };
2149
2335
  var within = (box, area) => box.x >= area.x - 0.5 && box.y >= area.y - 0.5 && box.x + box.width <= area.x + area.width + 0.5 && box.y + box.height <= area.y + area.height + 0.5;
2336
+ var overlaps = (box, area) => box.x < area.x + area.width && area.x < box.x + box.width && box.y < area.y + area.height && area.y < box.y + box.height;
2150
2337
  function slideBackdrop(context, box) {
2151
2338
  const { design, composition } = context;
2152
2339
  const image = composition?.backgroundImage;
2153
2340
  if (image) {
2154
2341
  const scrim = box ? image.scrims?.find((entry2) => within(box, entry2.text)) : void 0;
2155
2342
  const overlay = image.overlay && !image.overlay.edge ? { color: resolveTextColor(image.overlay.color, design, "#000000") ?? "#000000", opacity: image.overlay.opacity } : scrim ? { color: scrim.color, opacity: scrim.opacity } : void 0;
2156
- return backdropColors({ kind: "image", opacity: image.opacity ?? 1, base: "#FFFFFF" }, box, design.dimensions, { overlay, ...scrim?.grays ? { grays: scrim.grays } : {} });
2343
+ const duotone = image.recolor?.type === "duotone" ? [resolveTextColor(image.recolor.dark, design, "#000000") ?? "#000000", resolveTextColor(image.recolor.light, design, "#FFFFFF") ?? "#FFFFFF"] : void 0;
2344
+ const edge = image.overlay?.edge ? image.overlay : void 0, reach = box ?? { x: 0, y: 0, ...design.dimensions };
2345
+ const band = edge && overlaps(reach, edge.box) ? { color: resolveTextColor(edge.color, design, "#000000") ?? "#000000", opacity: edge.opacity, whole: within(reach, edge.box) } : void 0;
2346
+ return backdropColors({ kind: "image", opacity: image.opacity ?? 1, base: "#FFFFFF" }, box, design.dimensions, { overlay, ...scrim?.grays ? { grays: scrim.grays } : {}, ...duotone ? { duotone } : {}, ...band ? { band } : {} });
2157
2347
  }
2158
2348
  return backdropColors(design.backdrop, box, design.dimensions);
2159
2349
  }
@@ -2192,7 +2382,7 @@ function collectSamples(context) {
2192
2382
  if (Array.isArray(cell.value))
2193
2383
  cell.value.forEach((run, index) => {
2194
2384
  const colorRef = rec(run).color;
2195
- if (typeof colorRef !== "string") return;
2385
+ if (colorRef == null || colorRef === "") return;
2196
2386
  const color = resolveTextColor(colorRef, itemDesign, itemDesign.colors.text);
2197
2387
  if (color) samples.push({ path: `${cellPath}/${index}/color`, color, sizePx: rec(run).fontSize ? Number(rec(run).fontSize) / PX_TO_PT : 15, bold: Boolean(rec(run).bold) || cell.header, backdrop: cellBackdrop, source: "override", colorPath: `${cellPath}/${index}/color`, label: "Table cell text" });
2198
2388
  });
@@ -2222,7 +2412,7 @@ function collectSamples(context) {
2222
2412
  const relative = splitPointer(owner.path).slice(1);
2223
2413
  const base = pointer2(...splitPointer(itemPath), ...relative);
2224
2414
  for (const run of runsOf({ ...owner, path: base })) {
2225
- if (typeof run.style.color !== "string") continue;
2415
+ if (run.style.color == null || run.style.color === "") continue;
2226
2416
  const color = resolveTextColor(run.style.color, itemDesign, itemDesign.colors.text);
2227
2417
  if (!color) continue;
2228
2418
  const size = typeof run.style.fontSize === "number" ? run.style.fontSize / PX_TO_PT : baseSize;
@@ -2249,6 +2439,18 @@ var contrastRules = [
2249
2439
  const worst = worstContrast(sample.color, sample.backdrop);
2250
2440
  if (worst.ratio >= needed) continue;
2251
2441
  if (sample.backdrop.unknown) {
2442
+ const best = Math.max(...sample.backdrop.colors.map((color) => contrastRatio(sample.color, color)));
2443
+ if (best < needed) {
2444
+ context.report(onImageRule, {
2445
+ path: sample.path,
2446
+ slide,
2447
+ severity: "warning",
2448
+ message: `${sample.label} colour ${sample.color} is too faint on this background picture: over every colour the picture can show here its contrast is at most ${best.toFixed(1)}:1, and ${needed}:1 is needed at this size.`,
2449
+ help: "Set the background's tone (dark or light) so the text color follows the picture, give the text a readable color, or make the overlay strong enough for the text to read.",
2450
+ measured: { ratio: round(worst.ratio), best: round(best), needed, textColor: sample.color }
2451
+ });
2452
+ continue;
2453
+ }
2252
2454
  if (!imageReported.done) {
2253
2455
  imageReported.done = true;
2254
2456
  context.report(onImageRule, {
@@ -2261,8 +2463,8 @@ var contrastRules = [
2261
2463
  }
2262
2464
  continue;
2263
2465
  }
2264
- const key2 = `${sample.source === "default" ? "default" : sample.path}|${sample.color}|${worst.against}|${large}`;
2265
- const known = aggregated.get(key2);
2466
+ const key3 = `${sample.source === "default" ? "default" : sample.path}|${sample.color}|${worst.against}|${large}`;
2467
+ const known = aggregated.get(key3);
2266
2468
  if (known && sample.source === "default") {
2267
2469
  known.extra++;
2268
2470
  continue;
@@ -2283,7 +2485,7 @@ var contrastRules = [
2283
2485
  measured: { ratio: round(worst.ratio), needed, large, sizePt: round(sample.sizePx * PX_TO_PT), textColor: sample.color, backgroundColor: worst.against },
2284
2486
  fixes
2285
2487
  });
2286
- if (sample.source === "default") aggregated.set(key2, { diagnostic, extra: 0 });
2488
+ if (sample.source === "default") aggregated.set(key3, { diagnostic, extra: 0 });
2287
2489
  }
2288
2490
  const scrim = slide.composition?.backgroundImage?.scrims?.[0];
2289
2491
  if (scrim && !imageReported.done) {
@@ -2323,7 +2525,7 @@ var altRules = [
2323
2525
  for (const ref of assetRefs(context.document, slide.slide, slide.path, index === 0)) {
2324
2526
  if (seen.has(ref.path)) continue;
2325
2527
  seen.add(ref.path);
2326
- let alt = altOf(ref.value, context.document.assets);
2528
+ let alt = altOf(ref.value, context.document.assets, context.document.variables, context.document.template === true);
2327
2529
  if (ref.kind === "video" && !alt) alt = typeof rec(ref.value).title === "string" ? rec(ref.value).title : void 0;
2328
2530
  if (alt !== void 0 && alt.trim() !== "") continue;
2329
2531
  if (alt === "") continue;
@@ -2348,7 +2550,7 @@ var altRules = [
2348
2550
  for (const ref of assetRefs(context.document, slide.slide, slide.path, index === 0)) {
2349
2551
  if (seen.has(ref.path)) continue;
2350
2552
  seen.add(ref.path);
2351
- const alt = altOf(ref.value, context.document.assets)?.trim();
2553
+ const alt = altOf(ref.value, context.document.assets, context.document.variables, context.document.template === true)?.trim();
2352
2554
  if (!alt) continue;
2353
2555
  const source = sourceOfAsset(ref.value);
2354
2556
  const problem = GENERIC_ALT.test(alt) ? "is a generic word" : FILE_ALT.test(alt) ? "looks like a file name" : /^(https?:\/\/|data:|www\.)/i.test(alt) || source && alt === source ? "is a URL" : /^(image|picture|photo|graphic) of\b/i.test(alt) ? 'starts with "image of", which a screen reader already announces' : alt.length > 250 ? `is ${alt.length} characters long; aim for a sentence or two` : void 0;
@@ -2469,7 +2671,27 @@ function bindingOrder(items, regions) {
2469
2671
  };
2470
2672
  return items.map((item, index) => ({ item, index, region: rank.get(item.region ?? "") ?? regions.length, block: blockRank(item) })).sort((a, b) => a.region - b.region || a.block - b.block || a.index - b.index).map((entry2) => entry2.item.path);
2471
2673
  }
2472
- function visualOrder(items, rtl) {
2674
+ function visualOrder(items, rtl, base = items[0]?.path.match(/^slides\.\d+/)?.[0] ?? "") {
2675
+ const units = /* @__PURE__ */ new Map();
2676
+ for (const item of items) {
2677
+ const rest = item.path.startsWith(`${base}.`) ? item.path.slice(base.length + 1) : "";
2678
+ const key3 = /^blocks\.\d+/.exec(rest)?.[0] ?? rest.split(".")[0] ?? "";
2679
+ (units.get(key3) ?? units.set(key3, []).get(key3)).push(item);
2680
+ }
2681
+ if (units.has("")) return flatOrder(items, rtl);
2682
+ if (units.size === 1) return visualOrder(items, rtl, `${base}.${[...units.keys()][0]}`);
2683
+ const placed = [...units].map(([key3, members]) => {
2684
+ const left = Math.min(...members.map((item) => item.box.x)), top = Math.min(...members.map((item) => item.box.y));
2685
+ const right = Math.max(...members.map((item) => item.box.x + item.box.width)), bottom = Math.max(...members.map((item) => item.box.y + item.box.height));
2686
+ return { path: key3, members, box: { x: left, y: top, width: right - left, height: bottom - top } };
2687
+ });
2688
+ const order2 = flatOrder(placed, rtl);
2689
+ return order2.flatMap((key3) => {
2690
+ const unit = placed.find((entry2) => entry2.path === key3);
2691
+ return unit.members.length > 1 ? visualOrder(unit.members, rtl, `${base}.${key3}`) : unit.members.map((item) => item.path);
2692
+ });
2693
+ }
2694
+ function flatOrder(items, rtl) {
2473
2695
  if (rtl) return readingRows(items).flatMap((row) => row.map((item) => item.path));
2474
2696
  return visualReadingOrder(items).map((item) => item.path);
2475
2697
  }
@@ -2513,6 +2735,7 @@ var chartColorContext = (design) => ({
2513
2735
  });
2514
2736
  var chartSkip = /(histogram|box|pareto|waterfall|world|map)/;
2515
2737
  var perCategory = /(pie|doughnut|treemap|funnel)/;
2738
+ var circular = /(pie|doughnut)/;
2516
2739
  var chartRules = [
2517
2740
  {
2518
2741
  info: chartColorRule,
@@ -2532,7 +2755,9 @@ var chartRules = [
2532
2755
  const paletteContext = chartColorContext(slide.design);
2533
2756
  const palette = chartPaletteForFill(surface, context.chartPalette ?? chartSeriesPalette(slide.design.colorScheme, chart.colors, paletteContext), { legible: context.chartPalette === void 0 ? chartSchemeSeries(chart.colors, slide.design.colorScheme, paletteContext) : void 0, soften: context.chartPalette === void 0 });
2534
2757
  if (!palette.length) continue;
2535
- const used = Array.from({ length: Math.min(count, 24) }, (_, i) => palette[i % palette.length]);
2758
+ const slicePlan = circular.test(type) && context.chartPalette === void 0 ? chartSlicePlan(surface, palette, count, { legible: chartSchemeSeries(chart.colors, slide.design.colorScheme, paletteContext) }) : void 0;
2759
+ const drawn = slicePlan?.colors ?? palette;
2760
+ const used = Array.from({ length: Math.min(count, 24) }, (_, i) => drawn[i % drawn.length]);
2536
2761
  const pairs = [];
2537
2762
  for (let a = 0; a < used.length; a++)
2538
2763
  for (let b = a + 1; b < used.length; b++) {
@@ -2542,7 +2767,7 @@ var chartRules = [
2542
2767
  if (difference < worst.difference) worst = { model, difference };
2543
2768
  }
2544
2769
  if (worst.difference < context.thresholds.minSeriesColorDifference) pairs.push({ a, b, ...worst });
2545
- else if (b === a + 1 || slices && a === 0 && b === used.length - 1 && used.length > 2) {
2770
+ else if (b === a + 1 || circular.test(type) && !slicePlan?.bordered && a === 0 && b === used.length - 1 && used.length > 2) {
2546
2771
  const lightness = lightnessDifference(used[a], used[b]);
2547
2772
  if (lightness < CHART_SERIES_MIN_LIGHTNESS_STEP) pairs.push({ a, b, model: "lightness", difference: lightness });
2548
2773
  }
@@ -2706,6 +2931,15 @@ function languageTagProblem(tag) {
2706
2931
  };
2707
2932
  }
2708
2933
  }
2934
+ const system = numberingSystemExtension(tag);
2935
+ if (system !== void 0 && !isSupportedNumberingSystem(system)) {
2936
+ const only = /-u-nu-[a-z0-9]+$/i.test(tag) && tag.toLowerCase().split("-u-").length === 2;
2937
+ return {
2938
+ message: `'${tag}' names the numbering system '${system}', which OPF does not draw; generated numbers use the language's own digits, or Latin ones. OPF draws only the systems PowerPoint also draws in a native chart: ${supportedNumberingSystems().map((name) => `'${name}'`).join(", ")}.`,
2939
+ ...only ? { suggestion: plainLanguageTag(tag) } : {},
2940
+ caseOnly: false
2941
+ };
2942
+ }
2709
2943
  if (parsed === tag) return void 0;
2710
2944
  if (parsed.toLowerCase() === tag.toLowerCase())
2711
2945
  return { message: `'${tag}' is not in canonical case; the canonical form is '${parsed}' (language lower case, script title case, region upper case).`, suggestion: parsed, caseOnly: true };
@@ -2719,30 +2953,35 @@ function languageTagProblem(tag) {
2719
2953
  }
2720
2954
 
2721
2955
  // src/rules-language.ts
2722
- var report = (context, tag, path, slide) => {
2723
- if (typeof tag !== "string") return;
2956
+ var isEnUk = (tag) => typeof tag === "string" && tag.toLowerCase() === "en-uk";
2957
+ var report = (context, tag, path, slide, owned = false) => {
2958
+ if (typeof tag !== "string" || owned && isEnUk(tag)) return;
2724
2959
  const problem = languageTagProblem(tag);
2725
2960
  if (!problem) return;
2726
2961
  context.report(languageTagRule, {
2727
2962
  path,
2728
2963
  slide,
2729
2964
  message: problem.message,
2965
+ ...isEnUk(tag) ? { severity: "error" } : {},
2730
2966
  help: problem.suggestion ? `Write '${problem.suggestion}'.` : 'Write a well-formed BCP 47 tag with an assigned region, such as "en-US", "pt-BR" or "es-419".',
2731
2967
  ...problem.suggestion ? { fixes: [{ id: "use-canonical-tag", title: `Use '${problem.suggestion}'`, kind: "patch", safe: problem.caseOnly, patch: [{ op: "replace", path, value: problem.suggestion }] }] } : {}
2732
2968
  });
2733
2969
  };
2734
- var isEnUk = (tag) => typeof tag === "string" && tag.toLowerCase() === "en-uk";
2735
2970
  var languageTagRules = [
2736
2971
  {
2737
2972
  info: languageTagRule,
2738
2973
  run(context) {
2739
2974
  const language = context.document.language;
2740
- if (typeof language === "string") {
2741
- if (!isEnUk(language)) report(context, language, "/language");
2742
- } else if (language !== void 0 && !isEnUk(rec(language).bcp47)) report(context, rec(language).bcp47, "/language/bcp47");
2975
+ if (typeof language === "string") report(context, language, "/language", void 0, true);
2976
+ else if (language !== void 0) report(context, rec(language).bcp47, "/language/bcp47", void 0, true);
2977
+ for (const slide of context.slides) {
2978
+ const language2 = slide.slide.language;
2979
+ if (typeof language2 === "string") report(context, language2, `${slide.path}/language`, slide, true);
2980
+ else if (language2 !== void 0) report(context, rec(language2).bcp47, `${slide.path}/language/bcp47`, slide, true);
2981
+ }
2743
2982
  for (const slide of context.slides)
2744
2983
  for (const tv of slide.texts)
2745
- if (typeof tv.value !== "string") for (const run of runsOf(tv)) report(context, run.style.lang, `${run.path}/lang`, slide);
2984
+ if (typeof tv.value !== "string") for (const run of runsOf(tv)) report(context, run.style.language, `${run.path}/language`, slide);
2746
2985
  }
2747
2986
  }
2748
2987
  ];
@@ -2750,11 +2989,14 @@ var languageTagRules = [
2750
2989
  // src/rules-layout-content.ts
2751
2990
  var PX_TO_PT2 = 0.75;
2752
2991
  var round2 = (value, places = 1) => Math.round(value * 10 ** places) / 10 ** places;
2992
+ var pointAnchorRule = ruleInfo("opf/shape-anchor-missing");
2753
2993
  var REGION_RULES = { "region-unknown": regionUnknownRule, "region-kind": regionKindRule, "region-full": regionFullRule, "layout-unplaced": unplacedRule };
2754
2994
  var layoutRules = [
2755
2995
  {
2756
2996
  info: overflowRule,
2757
- also: [unresolvedRule, layoutFailedRule, minFontRule, regionUnknownRule, regionKindRule, regionFullRule, unplacedRule],
2997
+ // Format validates anchor identities in schema-check without composition. Geometry may add
2998
+ // the same located finding during an enabled layout audit, but must not trigger one.
2999
+ also: [unresolvedRule, layoutFailedRule, minFontRule, regionUnknownRule, regionKindRule, regionFullRule, unplacedRule, iconDroppedRule, arrangementAdaptedRule, chartLabelCollisionRule, timelinePeriodShortRule, shapeOffSlideRule],
2758
3000
  run(context) {
2759
3001
  const deckLevel = /* @__PURE__ */ new Set();
2760
3002
  for (const slide of context.slides) {
@@ -2763,15 +3005,28 @@ var layoutRules = [
2763
3005
  for (const { diagnostic } of slide.layoutDiagnostics) {
2764
3006
  const path = pointerOfDotted(diagnostic.path);
2765
3007
  if (!path.startsWith("/slides/")) {
2766
- const key2 = `${diagnostic.code}|${path}|${diagnostic.message}`;
2767
- if (deckLevel.has(key2)) continue;
2768
- deckLevel.add(key2);
3008
+ const key3 = `${diagnostic.code}|${path}|${diagnostic.message}`;
3009
+ if (deckLevel.has(key3)) continue;
3010
+ deckLevel.add(key3);
2769
3011
  }
2770
3012
  if (diagnostic.code === "text-overflow")
2771
3013
  context.report(overflowRule, { path, slide, message: diagnostic.message, help: "Shorten the text, give it more space (fewer blocks, a different composition) or split the slide (paginate); raising the readable minimum makes it worse." });
3014
+ else if (diagnostic.code === "shape-anchor-missing") context.report(pointAnchorRule, { path, slide, message: diagnostic.message, help: "Choose a plotted point in a qualified classic chart, or use a whole-block anchor." });
2772
3015
  else if (diagnostic.code === "small-cell") continue;
3016
+ else if (diagnostic.code === "icon-dropped")
3017
+ context.report(iconDroppedRule, { path, slide, message: diagnostic.message, help: "Shorten the text or give the slide more room so the chips fit at the same text size, or remove the icon. An icon draws on the first-level entries of an unnumbered list, on a metric and on a group." });
3018
+ else if (diagnostic.code === "arrangement-adapted")
3019
+ context.report(arrangementAdaptedRule, { path, slide, message: diagnostic.message, help: /four entries/.test(diagnostic.message) ? "Write four entries for the quadrants, or choose another layout for this many." : "Shorten the entries, write one level without descriptions, or choose another layout." });
3020
+ else if (diagnostic.code === "shape-off-slide")
3021
+ context.report(shapeOffSlideRule, { path, slide, message: diagnostic.message, help: "Write the position as fractions (0.2 for 20%), move the shape so part of it is on the slide, or remove it. A shape may hang over an edge; only one with nothing on the slide is reported." });
3022
+ else if (diagnostic.code === "chart-label-collision")
3023
+ context.report(chartLabelCollisionRule, { path, slide, message: diagnostic.message, help: "Put the label at the other end of its line (labelPosition 'start' or 'end'), shorten it, or give the chart more room. Its text and value are kept." });
3024
+ else if (diagnostic.code === "timeline-period-short")
3025
+ context.report(timelinePeriodShortRule, { path, slide, message: diagnostic.message, help: "Give the timeline more room, or make its shortest period longer relative to the others." });
2773
3026
  else if (Object.hasOwn(REGION_RULES, diagnostic.code))
2774
3027
  context.report(REGION_RULES[diagnostic.code], { path, slide, message: diagnostic.message, help: diagnostic.code === "layout-unplaced" ? "Paginate the slide, choose a layout with more room, pin the block to a region with room, or remove a block." : "Pin the block to a region of the layout that accepts it and has room, or remove the pin." });
3028
+ else if (diagnostic.message.startsWith("The diagram cannot be drawn"))
3029
+ context.report(unresolvedRule, { path, slide: path.startsWith("/slides/") ? slide : void 0, message: diagnostic.message, help: "Fix the diagram source where the message points. OPF refuses what it does not draw: write it in the form the diagrams guide lists for that syntax, or remove it." });
2775
3030
  else context.report(unresolvedRule, { path, slide: path.startsWith("/slides/") ? slide : void 0, message: diagnostic.message, help: "Supply what the message asks for, or remove the setting that cannot be honoured." });
2776
3031
  }
2777
3032
  for (const tv of slide.texts)
@@ -2922,7 +3177,7 @@ var contentRules = [
2922
3177
  run(context) {
2923
3178
  for (const slide of context.slides)
2924
3179
  for (const tv of slide.texts) {
2925
- if (["table", "table-header", "list-description"].includes(tv.role)) continue;
3180
+ if (["table", "table-header", "list-description", "callout"].includes(tv.role)) continue;
2926
3181
  if (plainText(tv.value).trim() !== "") continue;
2927
3182
  context.report(emptyTextRule, {
2928
3183
  path: tv.path,
@@ -2983,7 +3238,7 @@ function setsRunSize(value, depth2 = 0) {
2983
3238
  if (Array.isArray(value)) return value.some((entry2) => setsRunSize(entry2, depth2 + 1));
2984
3239
  const object2 = value;
2985
3240
  if (typeof object2.fontSize === "number") return true;
2986
- return ["text", "description", "rows", "columns", "value"].some((key2) => setsRunSize(object2[key2], depth2 + 1));
3241
+ return ["text", "description", "rows", "columns", "value"].some((key3) => setsRunSize(object2[key3], depth2 + 1));
2987
3242
  }
2988
3243
  var ROLE_SIZE = { text: PROSE_NOMINAL_SIZE, items: LIST_NOMINAL_SIZE, bullets: LIST_NOMINAL_SIZE, table: TABLE_NOMINAL_SIZE, quote: QUOTE_NOMINAL_SIZE, code: CODE_NOMINAL_SIZE };
2989
3244
  function fittedSize(item, slide, document) {
@@ -3073,7 +3328,7 @@ var centeredBody = {
3073
3328
  path: pointerOfDotted(item.path),
3074
3329
  slide,
3075
3330
  message: `A centered ${item.field === "text" ? "paragraph" : "list"} of ${lines} line${lines === 1 ? "" : "s"} (${characters} characters); every line starts at a different place, which is harder to read.${others}`,
3076
- help: 'Align body text to the start (contentAlignment "left" on the slide or block design), or shorten it to a statement of one or two lines.',
3331
+ help: 'Align body text to the start (contentAlignment "start" on the slide or block design), or shorten it to a statement of one or two lines.',
3077
3332
  measured: { lines, characters, maximumLines: CENTERED_BODY_LINES, maximumCharacters: CENTERED_BODY_CHARACTERS, blocks: count }
3078
3333
  });
3079
3334
  }
@@ -3291,7 +3546,7 @@ var isRecord2 = (value) => value !== null && typeof value === "object" && !Array
3291
3546
  var isCell = (value) => value === null || ["string", "number", "boolean"].includes(typeof value);
3292
3547
  function foreignChartKeys(chart) {
3293
3548
  if (!isRecord2(chart) || Object.hasOwn(chart, "data")) return [];
3294
- return FOREIGN_CHART_KEYS.filter((key2) => Object.hasOwn(chart, key2));
3549
+ return FOREIGN_CHART_KEYS.filter((key3) => Object.hasOwn(chart, key3));
3295
3550
  }
3296
3551
  function convertChartData(chart) {
3297
3552
  const labels = chart.categories ?? chart.labels;
@@ -3315,7 +3570,7 @@ function chartShapePatch(chart, path) {
3315
3570
  const data = convertChartData(chart);
3316
3571
  const keys = foreignChartKeys(chart);
3317
3572
  if (!data || !keys.length) return void 0;
3318
- return [{ op: "add", path: `${path}/data`, value: data }, ...keys.map((key2) => ({ op: "remove", path: `${path}/${key2}` }))];
3573
+ return [{ op: "add", path: `${path}/data`, value: data }, ...keys.map((key3) => ({ op: "remove", path: `${path}/${key3}` }))];
3319
3574
  }
3320
3575
  var SHOWN_ROWS = 3;
3321
3576
  var json = (value) => JSON.stringify(value);
@@ -3328,7 +3583,7 @@ function dataExample(chart) {
3328
3583
  function chartShapeHelp(chart) {
3329
3584
  const keys = foreignChartKeys(chart);
3330
3585
  if (!keys.length || !isRecord2(chart)) return void 0;
3331
- const names2 = keys.map((key2) => `"${key2}"`).join(" and ");
3586
+ const names2 = keys.map((key3) => `"${key3}"`).join(" and ");
3332
3587
  const example = dataExample(chart);
3333
3588
  const next = `replace ${names2} with ${example}. The first column holds the category labels and each further column is one series.`;
3334
3589
  return {
@@ -3339,7 +3594,7 @@ function chartShapeHelp(chart) {
3339
3594
  }
3340
3595
 
3341
3596
  // src/check-document.ts
3342
- var own = (value, key2) => Object.hasOwn(value, key2);
3597
+ var own = (value, key3) => Object.hasOwn(value, key3);
3343
3598
  var object = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3344
3599
  var primitive = (value) => value === null || typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value);
3345
3600
  var pointer3 = (parts2) => parts2.length ? "/" + parts2.map((part) => String(part).replaceAll("~", "~0").replaceAll("/", "~1")).join("/") : "";
@@ -3351,7 +3606,7 @@ function parts(path) {
3351
3606
  }
3352
3607
  function at(value, path) {
3353
3608
  return parts(path).reduce(
3354
- (current, key2) => object(current) || Array.isArray(current) ? own(current, key2) ? current[key2] : void 0 : void 0,
3609
+ (current, key3) => object(current) || Array.isArray(current) ? own(current, key3) ? current[key3] : void 0 : void 0,
3355
3610
  value
3356
3611
  );
3357
3612
  }
@@ -3361,13 +3616,13 @@ function checkDocumentOptions(options2) {
3361
3616
  throw new TypeError("Validate contracts must be an array.");
3362
3617
  for (const contract2 of options2.contracts ?? []) {
3363
3618
  if (!object(contract2) || Object.keys(contract2).some(
3364
- (key2) => ![
3619
+ (key3) => ![
3365
3620
  "path",
3366
3621
  "allowedValues",
3367
3622
  "severity",
3368
3623
  "message",
3369
3624
  "documentation"
3370
- ].includes(key2)
3625
+ ].includes(key3)
3371
3626
  ) || typeof contract2.path !== "string" || !Array.isArray(contract2.allowedValues) || !contract2.allowedValues.every(primitive) || contract2.severity !== void 0 && (typeof contract2.severity !== "string" || !["error", "warning", "info"].includes(contract2.severity)) || contract2.message !== void 0 && typeof contract2.message !== "string" || contract2.documentation !== void 0 && typeof contract2.documentation !== "string")
3372
3627
  throw new TypeError(
3373
3628
  "Invalid contract: provide a path and primitive allowedValues, with optional severity, message and documentation."
@@ -3397,12 +3652,19 @@ function issueFinding(issue2, ruleId = issueRuleId(issue2), schemaName = "presen
3397
3652
  help = `Add the required ${JSON.stringify(issue2.params.missingProperty)} field in this object, using the intended schema form.`;
3398
3653
  else if (issue2.keyword === "additionalProperties")
3399
3654
  help = `Review ${JSON.stringify(issue2.params.additionalProperty)} against this object's schema. Preserve custom metadata in document.extensions where appropriate; do not delete authored content to clear this error.`;
3400
- else if (issue2.keyword === "enum")
3401
- help = "Choose one of this schema branch\u2019s allowed values; inspect the other alternatives if the field uses another form.";
3402
- else if (issue2.keyword === "opf")
3403
- help = "Resolve the reported structural conflict while preserving every content field. Preview the result after editing.";
3655
+ else if (issue2.keyword === "enum") {
3656
+ const values = Array.isArray(issue2.params.allowedValues) ? issue2.params.allowedValues.filter(primitive) : [];
3657
+ help = values.length > 0 && values.length <= 12 ? `Use one of: ${values.map((value) => JSON.stringify(value)).join(", ")}.` : "Choose one of this schema branch\u2019s allowed values; inspect the other alternatives if the field uses another form.";
3658
+ } else if (issue2.keyword === "dependentRequired")
3659
+ help = `${JSON.stringify(issue2.params.property)} only applies together with ${JSON.stringify(issue2.params.missingProperty)}: add ${JSON.stringify(issue2.params.missingProperty)}, or remove ${JSON.stringify(issue2.params.property)}.`;
3660
+ else if (issue2.keyword === "opf") help = semanticHelp(issue2);
3404
3661
  const allowed = Array.isArray(issue2.params.allowedValues) ? issue2.params.allowedValues.filter(primitive) : [];
3405
3662
  const nearest2 = issue2.keyword === "additionalProperties" ? nearestProperties(issue2, entry2.schema, precise?.pointer, precise?.schemaName) : [];
3663
+ const typedName = issue2.keyword === "additionalProperties" && typeof issue2.params.additionalProperty === "string" ? issue2.params.additionalProperty : void 0;
3664
+ if (typedName !== void 0 && nearest2[0]?.value === logicalName(typedName) && nearest2[0].value !== typedName)
3665
+ help = `Write ${JSON.stringify(nearest2[0].value)}: layout words follow the deck's direction, so the sides are "start" and "end", not "left" and "right".`;
3666
+ else if (typedName !== void 0 && typeof nearest2[0]?.value === "string" && nearest2[0].value.startsWith(typedName))
3667
+ help = `Write ${JSON.stringify(nearest2[0].value)} instead; ${JSON.stringify(typedName)} is not a field of this object.`;
3406
3668
  return finding(ruleId, {
3407
3669
  ...severity ? { severity } : {},
3408
3670
  path,
@@ -3423,6 +3685,7 @@ function issueFinding(issue2, ruleId = issueRuleId(issue2), schemaName = "presen
3423
3685
  });
3424
3686
  }
3425
3687
  var NEAREST_PROPERTIES = 3;
3688
+ var logicalName = (name) => name.split(":").map((part) => part.split("+").map((word) => word === "left" ? "start" : word === "right" ? "end" : word).join("+")).join(":");
3426
3689
  function nearestProperties(issue2, fallbackRoot, pointerToKeyword, schemaName) {
3427
3690
  const typed = issue2.params.additionalProperty;
3428
3691
  if (typeof typed !== "string" || pointerToKeyword === void 0) return [];
@@ -3430,12 +3693,15 @@ function nearestProperties(issue2, fallbackRoot, pointerToKeyword, schemaName) {
3430
3693
  let node = rootEntry?.schema ?? fallbackRoot;
3431
3694
  const base = pointerToKeyword.split("/").slice(0, -1);
3432
3695
  for (const token of base.slice(1)) {
3433
- if (!isRecord(node)) return [];
3434
- node = node[token.replaceAll("~1", "/").replaceAll("~0", "~")];
3696
+ if (Array.isArray(node)) node = /^\d+$/.test(token) ? node[Number(token)] : void 0;
3697
+ else if (isRecord(node)) node = node[token.replaceAll("~1", "/").replaceAll("~0", "~")];
3698
+ else return [];
3435
3699
  }
3436
3700
  if (!isRecord(node) || !isRecord(node.properties)) return [];
3437
3701
  const root = rootEntry?.schema ?? fallbackRoot, limit = typed.length <= 3 ? 1 : 2, lower = typed.toLowerCase();
3438
- return Object.keys(node.properties).map((name) => ({ name, away: distance(lower, name.toLowerCase()) })).filter(({ name, away }) => name !== typed && away <= limit).sort((a, b) => a.away - b.away || (a.name < b.name ? -1 : a.name > b.name ? 1 : 0)).slice(0, NEAREST_PROPERTIES).map(({ name }) => ({
3702
+ const declared = Object.keys(node.properties), logical = logicalName(typed), longer = typed.length >= 3 ? declared.filter((name) => name !== typed && name.toLowerCase().startsWith(lower)) : [], exact = logical !== typed && declared.includes(logical) ? [logical] : longer.length === 1 ? longer : [];
3703
+ const near = declared.map((name) => ({ name, away: distance(lower, name.toLowerCase()) })).filter(({ name, away }) => name !== typed && away <= limit && !exact.includes(name)).sort((a, b) => a.away - b.away || (a.name < b.name ? -1 : a.name > b.name ? 1 : 0)).map(({ name }) => name);
3704
+ return [...exact, ...near].slice(0, NEAREST_PROPERTIES).map((name) => ({
3439
3705
  value: name,
3440
3706
  label: name,
3441
3707
  origin: "schema",
@@ -3466,13 +3732,13 @@ function score(schema, value) {
3466
3732
  if (own(schema, "const")) return schema.const === value ? 100 : -1e4;
3467
3733
  let result = 1;
3468
3734
  if (object(value) && object(schema.properties)) {
3469
- for (const [key2, child] of Object.entries(schema.properties))
3470
- if (own(value, key2) && object(child))
3471
- result += own(child, "const") ? child.const === value[key2] ? 100 : -1e3 : 1;
3735
+ for (const [key3, child] of Object.entries(schema.properties))
3736
+ if (own(value, key3) && object(child))
3737
+ result += own(child, "const") ? child.const === value[key3] ? 100 : -1e3 : 1;
3472
3738
  }
3473
3739
  if (Array.isArray(schema.required)) {
3474
- for (const key2 of schema.required)
3475
- if (typeof key2 === "string" && (!object(value) || !own(value, key2)))
3740
+ for (const key3 of schema.required)
3741
+ if (typeof key3 === "string" && (!object(value) || !own(value, key3)))
3476
3742
  result -= 2;
3477
3743
  }
3478
3744
  return result;
@@ -3494,7 +3760,7 @@ function active(cursor, value) {
3494
3760
  const selected = candidates.sort((a, b) => score(b.schema, value) - score(a.schema, value))[0];
3495
3761
  return selected ? { ...selected, baseSchemas: [...selected.baseSchemas ?? [], resolved] } : resolved;
3496
3762
  }
3497
- function childCursor(cursors, key2) {
3763
+ function childCursor(cursors, key3) {
3498
3764
  for (const keyword of [
3499
3765
  "properties",
3500
3766
  "patternProperties",
@@ -3503,8 +3769,8 @@ function childCursor(cursors, key2) {
3503
3769
  for (const cursor of cursors) {
3504
3770
  const declarations = cursor.schema[keyword];
3505
3771
  if (!object(declarations)) continue;
3506
- const name = keyword === "properties" ? key2 : keyword === "patternProperties" ? Object.keys(declarations).find(
3507
- (pattern) => new RegExp(pattern).test(key2)
3772
+ const name = keyword === "properties" ? key3 : keyword === "patternProperties" ? Object.keys(declarations).find(
3773
+ (pattern) => new RegExp(pattern).test(key3)
3508
3774
  ) : void 0;
3509
3775
  const schema = keyword === "additionalProperties" ? declarations : name === void 0 ? void 0 : declarations[name];
3510
3776
  if (object(schema))
@@ -3563,13 +3829,13 @@ function fields(document) {
3563
3829
  });
3564
3830
  });
3565
3831
  else if (object(entry2.value))
3566
- for (const [key2, value] of Object.entries(entry2.value)) {
3567
- if (entry2.path.length === 0 && key2 === "catalogs") continue;
3568
- const cursor = childCursor(cursors, key2);
3832
+ for (const [key3, value] of Object.entries(entry2.value)) {
3833
+ if (entry2.path.length === 0 && key3 === "catalogs") continue;
3834
+ const cursor = childCursor(cursors, key3);
3569
3835
  if (!cursor) continue;
3570
3836
  stack.push({
3571
3837
  value,
3572
- path: [...entry2.path, key2],
3838
+ path: [...entry2.path, key3],
3573
3839
  cursor,
3574
3840
  ancestors
3575
3841
  });
@@ -3588,6 +3854,11 @@ function embeddedRecordFindings(document, options2, findings) {
3588
3854
  if (!object(document) || !object(document.catalogs)) return invalid;
3589
3855
  for (const [group, value] of Object.entries(document.catalogs)) {
3590
3856
  if (!object(value)) continue;
3857
+ for (const [id, record] of Object.entries(object(value.iconSets) ? value.iconSets : {})) {
3858
+ if (object(record) && (Object.hasOwn(record, "$schema") || Object.hasOwn(record, "id"))) continue;
3859
+ const validation = validateAgainstSchema(object(record) ? { $schema: schemas.iconSet.$id, id, ...record } : record, "iconSets");
3860
+ for (const issue2 of validation.errors) findings.push(issueFinding(issue2, "opf/catalog-record", "iconSet", pointer3(["catalogs", group, "iconSets", id]), "document"));
3861
+ }
3591
3862
  for (const kind of catalogKinds)
3592
3863
  for (const [id, record] of Object.entries(object(value[kind]) ? value[kind] : {})) {
3593
3864
  const path = pointer3(["catalogs", group, kind, id]);
@@ -3646,7 +3917,7 @@ function chartNumberFixPaths(document) {
3646
3917
  }
3647
3918
  var HELP = {
3648
3919
  "chart-value-not-numeric": 'Write chart values as numbers (or strict decimal strings such as "12.5" or "1e6"); put currency, percent and units in the column format ({ "name": "Revenue", "format": "$#,##0" }). The value is plotted as a gap.',
3649
- "chart-mapping-adapted": "The mapping entry is ignored. Remove it, or name a different column.",
3920
+ "chart-mapping-adapted": "Choose a compatible chart type or mapping for the selected data. The message explains how the mapping or drawing was adapted.",
3650
3921
  "chart-series-dropped": "The chart type plots one series. Use a chart type that plots every series (column, bar, line), or one chart per series.",
3651
3922
  "chart-highlight-adapted": "The highlight is adapted by every engine. Name a series or category the chart type can emphasise, or remove the entry.",
3652
3923
  "slide-theme-dimensions": "A PPTX has one slide size. Set design.dimensions on the deck, or give every slide the same theme dimensions.",
@@ -3656,11 +3927,123 @@ var HELP = {
3656
3927
  "variable-unknown": "Declare the variable in the top-level variables map, or write '\\{{' for literal braces.",
3657
3928
  "variable-unknown-value": "Remove the supplied value, or declare the variable it belongs to.",
3658
3929
  "variable-unused": "Reference the variable as {{id}} or var:id where it belongs, or remove its declaration.",
3930
+ "variable-group-omitted": "Give one of the variables a value to draw the group, make one of them required, or move the content that should always show out of the group.",
3659
3931
  "variable-reference-unknown": "Declare the variable in the top-level variables map, or use another colour.",
3660
3932
  "run-color-unrecognized": "Use a #RRGGBB hex colour, a colour-scheme name or a var: reference to a declared colour variable.",
3661
3933
  "numbering-start-ignored": "Add a 'numbering' field to the payload, or remove 'start'.",
3662
3934
  "slide-size-out-of-range": "Use a custom widthInches and heightInches between 1 and 56, or a preset. PowerPoint stores the slide size in 914400 to 51206400 EMU per side."
3663
3935
  };
3936
+ function semanticHelp(issue2) {
3937
+ const params2 = issue2.params ?? {}, field = typeof params2.field === "string" ? params2.field : void 0, quoted2 = JSON.stringify(field);
3938
+ if (params2.code === "image-option-unsupported-payload" && field) return `Remove ${quoted2}, or put it on an image block ({ "image": ... }); it has no meaning on another kind of content.`;
3939
+ if (params2.code === "shape-option-unsupported-payload" && field === "alt" && params2.type === "image") return `A picture's alt text goes inside its image object: { "image": { "src": "...", "alt": "..." } }.`;
3940
+ if (params2.code === "shape-option-unsupported-payload" && field) return `Remove ${quoted2}, or draw this as a shape: a shape block ({ "shape": ... } with no "image") or an overlay shape in the slide's "shapes".`;
3941
+ if (params2.code === "caption-unsupported-payload") return "Put the caption on the image, chart, table, video or diagram it describes, or write it as a text block of its own.";
3942
+ if (Array.isArray(params2.incompatible) && params2.incompatible.includes("bullets") && params2.type === "list") return 'For a list, write the entries under "items". To keep "bullets" (talking points, which belong to a text payload), remove "type" or write "type": "text".';
3943
+ return "Resolve the reported structural conflict while preserving every content field. Preview the result after editing.";
3944
+ }
3945
+ var BACKGROUND_TYPES = ["theme", "solid", "gradient", "image", "pattern"];
3946
+ var BACKGROUND_HELP = `A background is a string (a theme slot such as "light1", a hex color, or an image source such as "asset:hero" or "./photo.jpg") or an object with "type": ${BACKGROUND_TYPES.map((type) => JSON.stringify(type)).join(", ")}, for example { "type": "solid", "color": "accent1" }.`;
3947
+ function collapseAuthoringShapes(document, findings) {
3948
+ const valueAt = (path) => {
3949
+ let node = document;
3950
+ for (const segment of splitPointer(path)) node = Array.isArray(node) ? node[Number(segment)] : isRecord(node) ? node[segment] : void 0;
3951
+ return node;
3952
+ };
3953
+ const schema = (entry2) => entry2?.ruleId === "opf/schema";
3954
+ const fills = /* @__PURE__ */ new Map();
3955
+ for (const entry2 of findings) {
3956
+ if (!schema(entry2)) continue;
3957
+ const at2 = /^(.*\/fill)(?:\/[^/]+)?$/.exec(entry2.path)?.[1];
3958
+ if (!at2 || fills.has(at2) || at2.endsWith("/style/fill")) continue;
3959
+ const fill = valueAt(at2);
3960
+ if (!isRecord(fill) || Object.hasOwn(fill, "lighten") || Object.hasOwn(fill, "darken")) continue;
3961
+ const solid = (fill.type === "solid" || fill.type === void 0) && fill.color !== void 0 && !Object.hasOwn(fill, "gradient") && !Object.hasOwn(fill, "pattern");
3962
+ const typed = fill.type === "gradient" && isRecord(fill.gradient) || fill.type === "pattern" && isRecord(fill.pattern);
3963
+ if (!solid && !typed) continue;
3964
+ const color = typeof fill.color === "string" ? JSON.stringify(fill.color) : '"accent1"';
3965
+ fills.set(at2, {
3966
+ ...entry2,
3967
+ path: at2,
3968
+ message: solid ? `A shape's solid fill is the color itself, not an object: write "fill": ${color}.` : `A shape's fill has no "type": write "fill": { ${JSON.stringify(fill.type)}: { ... } }.`,
3969
+ help: solid ? `Write "fill": ${color}. A fill is "none", a color ("accent1", "#1E40AF", or { "color": "accent1", "lighten": 0.4 }), { "gradient": { ... } } or { "pattern": { ... } }; only a slide background takes { "type": "solid", ... }.` : `Remove "type": a fill is told apart by its key, { "gradient": { ... } } or { "pattern": { ... } }; only a slide background takes "type".`,
3970
+ fixes: [solid && typeof fill.color === "string" ? { id: "fill-color", title: `Write the fill as ${color}`, kind: "patch", safe: false, patch: [{ op: "replace", path: at2, value: fill.color }] } : { id: "fill-remove-type", title: 'Remove "type"', kind: "patch", safe: false, patch: [{ op: "remove", path: `${at2}/type` }] }]
3971
+ });
3972
+ }
3973
+ if (fills.size) {
3974
+ const seen = /* @__PURE__ */ new Set();
3975
+ for (let index = 0; index < findings.length; index++) {
3976
+ const entry2 = findings[index];
3977
+ if (!schema(entry2)) continue;
3978
+ const at2 = [...fills.keys()].find((path) => entry2.path === path || entry2.path.startsWith(`${path}/`));
3979
+ if (!at2) continue;
3980
+ if (seen.has(at2)) {
3981
+ findings.splice(index--, 1);
3982
+ continue;
3983
+ }
3984
+ seen.add(at2);
3985
+ findings[index] = fills.get(at2);
3986
+ }
3987
+ }
3988
+ const backgrounds = /* @__PURE__ */ new Set();
3989
+ for (const entry2 of findings) {
3990
+ if (!schema(entry2)) continue;
3991
+ const at2 = /^((?:.*\/)?design\/background)(?:\/.*)?$/.exec(entry2.path)?.[1];
3992
+ if (!at2 || backgrounds.has(at2)) continue;
3993
+ const background = valueAt(at2), type = isRecord(background) ? background.type : void 0;
3994
+ if (typeof background === "string" || isRecord(background) && typeof type === "string" && BACKGROUND_TYPES.includes(type)) continue;
3995
+ backgrounds.add(at2);
3996
+ }
3997
+ for (const at2 of backgrounds) {
3998
+ const background = valueAt(at2), type = isRecord(background) ? background.type : void 0;
3999
+ const first = findings.findIndex((entry2) => schema(entry2) && (entry2.path === at2 || entry2.path.startsWith(`${at2}/`)));
4000
+ const { fixes: _fixes, suggestions: _suggestions, ...kept } = findings[first];
4001
+ const one = {
4002
+ ...kept,
4003
+ path: at2,
4004
+ message: isRecord(background) ? type === void 0 ? 'A background object needs a "type".' : `${JSON.stringify(type)} is not a background type.` : "This is not a background OPF can read.",
4005
+ help: BACKGROUND_HELP
4006
+ };
4007
+ for (let index = findings.length - 1; index >= 0; index--) {
4008
+ const entry2 = findings[index];
4009
+ if (schema(entry2) && (entry2.path === at2 || entry2.path.startsWith(`${at2}/`))) findings.splice(index, 1);
4010
+ }
4011
+ findings.splice(first, 0, one);
4012
+ }
4013
+ for (let index = findings.length - 1; index >= 0; index--) {
4014
+ const entry2 = findings[index];
4015
+ if (!schema(entry2) || entry2.validation?.keyword !== "if") continue;
4016
+ const stem = entry2.validation.schemaPath.replace(/if$/, "");
4017
+ if (findings.some((other) => other !== entry2 && schema(other) && other.path.startsWith(entry2.path) && typeof other.validation?.schemaPath === "string" && (other.validation.schemaPath.startsWith(`${stem}then`) || other.validation.schemaPath.startsWith(`${stem}else`)))) findings.splice(index, 1);
4018
+ }
4019
+ for (const [index, entry2] of findings.entries()) {
4020
+ if (!schema(entry2) || entry2.validation?.keyword !== "maximum") continue;
4021
+ const match2 = /^(\/slides\/\d+\/shapes\/\d+\/at)\/(width|height)$/.exec(entry2.path);
4022
+ const at2 = match2?.[1] ? valueAt(match2[1]) : void 0, key3 = match2?.[2], size = key3 && isRecord(at2) ? at2[key3] : void 0;
4023
+ if (!key3 || !isRecord(at2) || typeof size !== "number" || !(size > 8 && size <= 1280) || Object.hasOwn(at2, `${key3}Px`)) continue;
4024
+ const px = `${key3}Px`;
4025
+ findings[index] = {
4026
+ ...entry2,
4027
+ message: `at.${key3} is ${size}, but it is a fraction of the block, at most 8: did you mean "${px}"?`,
4028
+ help: `Did you mean "${px}"? "${key3}" is a fraction of the block (1 is its own size, up to 8); a size in pixels is "${px}". A 0.33 deck wrote pixels under "${key3}".`,
4029
+ fixes: [{ id: "rename", title: `Rename ${key3} to ${px}`, kind: "patch", safe: false, patch: [{ op: "move", from: entry2.path, path: `${entry2.path}Px` }] }]
4030
+ };
4031
+ }
4032
+ for (let index = findings.length - 1; index >= 0; index--) {
4033
+ const entry2 = findings[index];
4034
+ if (!schema(entry2) || entry2.validation?.keyword !== "required" || entry2.validation.params.missingProperty !== "items") continue;
4035
+ const payload = valueAt(entry2.path);
4036
+ if (isRecord(payload) && payload.type === "list" && Object.hasOwn(payload, "bullets")) findings.splice(index, 1);
4037
+ }
4038
+ const OPTION_RULES = ["opf/image-option-unsupported-payload", "opf/shape-option-unsupported-payload", "opf/caption-unsupported-payload"];
4039
+ const optionDefinition = (entry2) => entry2.validation?.keyword === "required" && /^must have required property '(?:image|shape|path|chart|table|video|diagram)'/.test(entry2.message) || entry2.validation?.keyword === "not" && entry2.message === "must NOT be valid" || (entry2.validation?.keyword === "anyOf" || entry2.validation?.keyword === "oneOf") && /must match a schema in anyOf|must match exactly one schema/.test(entry2.message);
4040
+ for (let index = findings.length - 1; index >= 0; index--) {
4041
+ const entry2 = findings[index];
4042
+ if (!schema(entry2) || !optionDefinition(entry2)) continue;
4043
+ const prefix = `${entry2.path}/`;
4044
+ if (findings.some((other) => other !== entry2 && other.path.startsWith(prefix) && !other.path.slice(prefix.length).includes("/") && OPTION_RULES.includes(other.ruleId))) findings.splice(index, 1);
4045
+ }
4046
+ }
3664
4047
  function collapseChartShape(document, findings) {
3665
4048
  const chartAt = (path) => {
3666
4049
  let node = document;
@@ -3694,9 +4077,11 @@ function engineFindings(document, engine, enabled) {
3694
4077
  const findings = [];
3695
4078
  for (const issue2 of engine.errors) {
3696
4079
  const ruleId = issueRuleId(issue2);
3697
- if (enabled(ruleId)) findings.push(issueFinding(issue2, ruleId));
4080
+ if (!enabled(ruleId)) continue;
4081
+ findings.push(issueFinding(issue2, ruleId));
3698
4082
  }
3699
4083
  collapseChartShape(document, findings);
4084
+ collapseAuthoringShapes(document, findings);
3700
4085
  let numberFixes;
3701
4086
  for (const issue2 of engine.warnings) {
3702
4087
  const code2 = issue2.params.code;
@@ -3715,9 +4100,14 @@ function engineFindings(document, engine, enabled) {
3715
4100
  continue;
3716
4101
  }
3717
4102
  }
3718
- const found = issueFinding(issue2, ruleId, "presentation", "", "document", "warning");
4103
+ const found = issueFinding(issue2, ruleId, "presentation", "", "document", code2 === "variable-group-omitted" ? "info" : "warning");
3719
4104
  const help = HELP[code2];
3720
4105
  if (help) found.help = help;
4106
+ if (code2 === "shape-anchor-size-unit") {
4107
+ const key3 = String(issue2.params.key), px = `${key3}Px`;
4108
+ found.help = `Did you mean "${px}"? "${key3}" is a fraction of the block.`;
4109
+ found.fixes = [{ id: "rename", title: `Rename ${key3} to ${px}`, kind: "patch", safe: false, patch: [{ op: "move", from: found.path, path: `${found.path}Px` }] }];
4110
+ }
3721
4111
  findings.push(found);
3722
4112
  }
3723
4113
  return findings;
@@ -3769,9 +4159,9 @@ function variableFindings(document, engine, schemaValid) {
3769
4159
  return;
3770
4160
  }
3771
4161
  if (value && typeof value === "object")
3772
- for (const [key2, entry2] of Object.entries(value)) {
3773
- if (path.length === 0 && ["variables", "extensions", "catalogs", "assets"].includes(key2)) continue;
3774
- walk2(entry2, [...path, key2], depth2 + 1);
4162
+ for (const [key3, entry2] of Object.entries(value)) {
4163
+ if (path.length === 0 && ["variables", "extensions", "catalogs", "assets"].includes(key3)) continue;
4164
+ walk2(entry2, [...path, key3], depth2 + 1);
3775
4165
  }
3776
4166
  };
3777
4167
  walk2(document, [], 0);
@@ -3908,6 +4298,21 @@ function referenceFindings(document, engine, options2) {
3908
4298
  lookup: ["opf", "schema", "presentation", "/$defs/Dataset"]
3909
4299
  })
3910
4300
  );
4301
+ for (const { path, value } of documentIcons(document)) {
4302
+ const issue2 = iconIssue(document, value, catalogs);
4303
+ if (!issue2) continue;
4304
+ const unknown = issue2.code === "icon-unknown";
4305
+ findings.push(
4306
+ finding(unknown ? "opf/icon-unknown" : "opf/icon-invalid", {
4307
+ path: pointerPath(path.split(".")),
4308
+ message: issue2.message,
4309
+ help: unknown ? `${issue2.suggestions?.length ? `Did you mean ${issue2.suggestions.slice(0, 3).map((name) => `'${name}'`).join(", ")}? ` : ""}Use an icon the set has (the MCP's search_icons finds names by keyword), add the name to the deck's icons, or remove the icon. Nothing else changes: the text is drawn without the chip.` : "Give the icon SVG text with only shapes (path, circle, rect, line, polyline, polygon and groups), no script, event handler, external reference or raster, or remove the icon.",
4310
+ definition: `${schemas.presentation.$id}#/$defs/IconReference`,
4311
+ lookup: ["opf", "schema", "presentation", "/$defs/IconReference"],
4312
+ ...issue2.suggestions?.length ? { suggestions: issue2.suggestions.map((value2) => ({ value: value2, label: value2, origin: "registered", definition: `${schemas.presentation.$id}#/$defs/IconReference` })) } : {}
4313
+ })
4314
+ );
4315
+ }
3911
4316
  return findings;
3912
4317
  }
3913
4318
  function narrativeFindings(document, options2) {
@@ -3973,7 +4378,7 @@ function contractFindings(document, contracts) {
3973
4378
  };
3974
4379
  const message = (contract2.message ?? "This value is outside the allowed values for {{path}}.").replace(
3975
4380
  /\{\{(path|value|allowed|file)\}\}/g,
3976
- (_, key2) => values[key2] ?? ""
4381
+ (_, key3) => values[key3] ?? ""
3977
4382
  );
3978
4383
  findings.push(
3979
4384
  finding("opf/contract", {
@@ -3991,9 +4396,9 @@ function contractFindings(document, contracts) {
3991
4396
  })
3992
4397
  );
3993
4398
  } else if (object(entry2.value) || Array.isArray(entry2.value)) {
3994
- const key2 = pattern[entry2.depth];
4399
+ const key3 = pattern[entry2.depth];
3995
4400
  for (const [name, value] of Object.entries(entry2.value))
3996
- if (key2 === "*" || key2 === name)
4401
+ if (key3 === "*" || key3 === name)
3997
4402
  stack.push({
3998
4403
  value,
3999
4404
  path: [...entry2.path, name],
@@ -4021,9 +4426,9 @@ function canonicalJson(value) {
4021
4426
  } else {
4022
4427
  const record = item;
4023
4428
  const members = [];
4024
- for (const key2 of Object.keys(record).sort()) {
4025
- const member = write(record[key2]);
4026
- if (member !== void 0) members.push(`${JSON.stringify(key2)}:${member}`);
4429
+ for (const key3 of Object.keys(record).sort()) {
4430
+ const member = write(record[key3]);
4431
+ if (member !== void 0) members.push(`${JSON.stringify(key3)}:${member}`);
4027
4432
  }
4028
4433
  text2 = `{${members.join(",")}}`;
4029
4434
  }
@@ -4194,7 +4599,7 @@ var OPFPatchHashError = class extends OPFPatchError {
4194
4599
  this.actual = actual;
4195
4600
  }
4196
4601
  };
4197
- var own2 = (value, key2) => Object.prototype.hasOwnProperty.call(value, key2);
4602
+ var own2 = (value, key3) => Object.prototype.hasOwnProperty.call(value, key3);
4198
4603
  var isObject = (value) => !!value && typeof value === "object" && !Array.isArray(value);
4199
4604
  var clone = (value) => structuredClone(value);
4200
4605
  function jsonEqual(a, b) {
@@ -4207,7 +4612,7 @@ function jsonEqual(a, b) {
4207
4612
  }
4208
4613
  const left = a, right = b;
4209
4614
  const keys = Object.keys(left);
4210
- return keys.length === Object.keys(right).length && keys.every((key2) => own2(right, key2) && jsonEqual(left[key2], right[key2]));
4615
+ return keys.length === Object.keys(right).length && keys.every((key3) => own2(right, key3) && jsonEqual(left[key3], right[key3]));
4211
4616
  }
4212
4617
  function escapePointerToken(token) {
4213
4618
  return String(token).replaceAll("~", "~0").replaceAll("/", "~1");
@@ -4370,65 +4775,65 @@ function normalizeOperation(operation, index) {
4370
4775
  return { op, path: operation.path, value: clone(operation.value) };
4371
4776
  }
4372
4777
  function parentOf(document, tokens, path) {
4373
- const key2 = tokens[tokens.length - 1];
4778
+ const key3 = tokens[tokens.length - 1];
4374
4779
  const found = readPointer(document, tokens.slice(0, -1));
4375
4780
  if (!found.found || !found.value || typeof found.value !== "object") {
4376
4781
  throw new OPFPatchError("patch-parent-missing", `Patch parent does not exist for ${path}.`, { path });
4377
4782
  }
4378
- return { parent: found.value, key: key2 };
4783
+ return { parent: found.value, key: key3 };
4379
4784
  }
4380
4785
  var NONE = /* @__PURE__ */ Symbol("none");
4381
4786
  function addAt(document, path, value) {
4382
4787
  const tokens = resolveTokens(document, parsePointer(path), path);
4383
4788
  if (!tokens.length) return { document: clone(value), inverse: { op: "replace", path: "", value: clone(document) }, pointer: "" };
4384
- const { parent, key: key2 } = parentOf(document, tokens, path);
4789
+ const { parent, key: key3 } = parentOf(document, tokens, path);
4385
4790
  if (Array.isArray(parent)) {
4386
- const at2 = arrayIndex(key2, parent.length, true, path);
4791
+ const at2 = arrayIndex(key3, parent.length, true, path);
4387
4792
  parent.splice(at2, 0, clone(value));
4388
4793
  const pointer5 = formatPointer([...tokens.slice(0, -1), at2]);
4389
4794
  return { document, inverse: { op: "remove", path: pointer5 }, pointer: pointer5 };
4390
4795
  }
4391
4796
  const record = parent;
4392
- const previous = own2(record, key2) ? record[key2] : NONE;
4393
- Object.defineProperty(record, key2, { value: clone(value), enumerable: true, configurable: true, writable: true });
4797
+ const previous = own2(record, key3) ? record[key3] : NONE;
4798
+ Object.defineProperty(record, key3, { value: clone(value), enumerable: true, configurable: true, writable: true });
4394
4799
  const pointer4 = formatPointer(tokens);
4395
4800
  return { document, inverse: previous === NONE ? { op: "remove", path: pointer4 } : { op: "replace", path: pointer4, value: clone(previous) }, pointer: pointer4 };
4396
4801
  }
4397
4802
  function replaceAt(document, path, value) {
4398
4803
  const tokens = resolveTokens(document, parsePointer(path), path);
4399
4804
  if (!tokens.length) return { document: clone(value), inverse: { op: "replace", path: "", value: clone(document) }, pointer: "" };
4400
- const { parent, key: key2 } = parentOf(document, tokens, path);
4805
+ const { parent, key: key3 } = parentOf(document, tokens, path);
4401
4806
  let previous;
4402
4807
  let pointer4 = formatPointer(tokens);
4403
4808
  if (Array.isArray(parent)) {
4404
- const at2 = arrayIndex(key2, parent.length, false, path);
4809
+ const at2 = arrayIndex(key3, parent.length, false, path);
4405
4810
  previous = parent[at2];
4406
4811
  parent[at2] = clone(value);
4407
4812
  pointer4 = formatPointer([...tokens.slice(0, -1), at2]);
4408
4813
  } else {
4409
4814
  const record = parent;
4410
- if (!own2(record, key2)) throw new OPFPatchError("patch-path-missing", `Patch path does not exist: ${path}.`, { path });
4411
- previous = record[key2];
4412
- Object.defineProperty(record, key2, { value: clone(value), enumerable: true, configurable: true, writable: true });
4815
+ if (!own2(record, key3)) throw new OPFPatchError("patch-path-missing", `Patch path does not exist: ${path}.`, { path });
4816
+ previous = record[key3];
4817
+ Object.defineProperty(record, key3, { value: clone(value), enumerable: true, configurable: true, writable: true });
4413
4818
  }
4414
4819
  return { document, inverse: { op: "replace", path: pointer4, value: clone(previous) }, pointer: pointer4 };
4415
4820
  }
4416
4821
  function removeAt(document, path) {
4417
4822
  const tokens = resolveTokens(document, parsePointer(path), path);
4418
4823
  if (!tokens.length) throw new OPFPatchError("patch-root-remove", "The document root cannot be removed.", { path });
4419
- const { parent, key: key2 } = parentOf(document, tokens, path);
4824
+ const { parent, key: key3 } = parentOf(document, tokens, path);
4420
4825
  let previous;
4421
4826
  if (Array.isArray(parent)) {
4422
- const at2 = arrayIndex(key2, parent.length, false, path);
4827
+ const at2 = arrayIndex(key3, parent.length, false, path);
4423
4828
  previous = parent[at2];
4424
4829
  parent.splice(at2, 1);
4425
4830
  const pointer5 = formatPointer([...tokens.slice(0, -1), at2]);
4426
4831
  return { document, inverse: { op: "add", path: pointer5, value: clone(previous) }, pointer: pointer5 };
4427
4832
  }
4428
4833
  const record = parent;
4429
- if (!own2(record, key2)) throw new OPFPatchError("patch-path-missing", `Patch path does not exist: ${path}.`, { path });
4430
- previous = record[key2];
4431
- delete record[key2];
4834
+ if (!own2(record, key3)) throw new OPFPatchError("patch-path-missing", `Patch path does not exist: ${path}.`, { path });
4835
+ previous = record[key3];
4836
+ delete record[key3];
4432
4837
  const pointer4 = formatPointer(tokens);
4433
4838
  return { document, inverse: { op: "add", path: pointer4, value: clone(previous) }, pointer: pointer4 };
4434
4839
  }
@@ -4589,7 +4994,7 @@ var schemaCatalogKinds = {
4589
4994
  };
4590
4995
 
4591
4996
  // src/schema-navigation.ts
4592
- var own3 = (object2, key2) => object2 !== null && typeof object2 === "object" && Object.hasOwn(object2, key2);
4997
+ var own3 = (object2, key3) => object2 !== null && typeof object2 === "object" && Object.hasOwn(object2, key3);
4593
4998
  var documents = new Map(Object.values(schemas).map((schema) => [schema.$id, schema]));
4594
4999
  var presentationSchema = schemas.presentation;
4595
5000
  var CATALOG_KIND = /* @__PURE__ */ Symbol.for("@openpresentation/opf:catalog-kind");
@@ -4610,10 +5015,10 @@ function readSchemaPointer(target, pointer4) {
4610
5015
  }
4611
5016
  return current;
4612
5017
  }
4613
- for (const [key2, kind] of Object.entries(schemaCatalogKinds)) {
4614
- const [name = "", pointer4 = ""] = key2.split("#");
5018
+ for (const [key3, kind] of Object.entries(schemaCatalogKinds)) {
5019
+ const [name = "", pointer4 = ""] = key3.split("#");
4615
5020
  const node = readSchemaPointer(schemas[name], pointer4);
4616
- if (node === void 0 || node === null || typeof node !== "object") throw new Error(`schemaCatalogKinds: ${key2} is not a schema node.`);
5021
+ if (node === void 0 || node === null || typeof node !== "object") throw new Error(`schemaCatalogKinds: ${key3} is not a schema node.`);
4617
5022
  catalogKindOfNode.set(node, kind);
4618
5023
  }
4619
5024
  function absolutize(schema, id) {
@@ -4622,7 +5027,7 @@ function absolutize(schema, id) {
4622
5027
  const copy = {};
4623
5028
  const kind = kindOfNode(schema);
4624
5029
  if (kind !== void 0) copy[CATALOG_KIND] = kind;
4625
- for (const [key2, value] of Object.entries(schema)) copy[key2] = key2 === "$ref" && typeof value === "string" && value.startsWith("#") ? `${id}${value}` : absolutize(value, id);
5030
+ for (const [key3, value] of Object.entries(schema)) copy[key3] = key3 === "$ref" && typeof value === "string" && value.startsWith("#") ? `${id}${value}` : absolutize(value, id);
4626
5031
  return copy;
4627
5032
  }
4628
5033
  function mergeAllOf(schema, root, seen) {
@@ -4689,36 +5094,36 @@ function score2(schema, value) {
4689
5094
  if (schema.enum && !schema.enum.includes(value)) return -100;
4690
5095
  let result = 1;
4691
5096
  const record = value;
4692
- for (const [key2, child] of Object.entries(schema.properties ?? {})) {
4693
- if (!record || !own3(record, key2)) continue;
4694
- if (own3(child, "const")) result += record[key2] === child.const ? 100 : -1e3;
5097
+ for (const [key3, child] of Object.entries(schema.properties ?? {})) {
5098
+ if (!record || !own3(record, key3)) continue;
5099
+ if (own3(child, "const")) result += record[key3] === child.const ? 100 : -1e3;
4695
5100
  else result += 1;
4696
5101
  }
4697
- for (const key2 of schema.required ?? []) if (!record || !own3(record, key2)) result -= 2;
5102
+ for (const key3 of schema.required ?? []) if (!record || !own3(record, key3)) result -= 2;
4698
5103
  return result;
4699
5104
  }
4700
5105
  function activeSchema(schema, value, root = presentationSchema) {
4701
5106
  return schemaVariants(schema, root).sort((a, b) => score2(b, value) - score2(a, value))[0] ?? {};
4702
5107
  }
4703
5108
  var INDEX = /^(?:0|[1-9][0-9]*|-)$/;
4704
- function patternChild(schema, key2) {
5109
+ function patternChild(schema, key3) {
4705
5110
  for (const [pattern, child] of Object.entries(schema.patternProperties ?? {})) {
4706
5111
  try {
4707
- if (new RegExp(pattern).test(key2)) return child;
5112
+ if (new RegExp(pattern).test(key3)) return child;
4708
5113
  } catch {
4709
5114
  }
4710
5115
  }
4711
5116
  return void 0;
4712
5117
  }
4713
- function childSchema(schema, key2, value) {
5118
+ function childSchema(schema, key3, value) {
4714
5119
  if (Array.isArray(value) || schema.type === "array") return schema.items ?? void 0;
4715
- return schema.properties?.[key2] ?? patternChild(schema, key2) ?? (typeof schema.additionalProperties === "object" ? schema.additionalProperties : void 0);
5120
+ return schema.properties?.[key3] ?? patternChild(schema, key3) ?? (typeof schema.additionalProperties === "object" ? schema.additionalProperties : void 0);
4716
5121
  }
4717
- function stepSchema(schema, value, key2, root) {
5122
+ function stepSchema(schema, value, key3, root) {
4718
5123
  const variants = schemaVariants(schema, root).sort((a, b) => score2(b, value) - score2(a, value));
4719
5124
  const first = variants[0] ?? {};
4720
- if (value !== void 0 || variants.length < 2 || childSchema(first, key2, value) !== void 0) return first;
4721
- return variants.find((variant) => variant.type === "array" ? INDEX.test(key2) && childSchema(variant, key2, value) !== void 0 : childSchema(variant, key2, value) !== void 0) ?? first;
5125
+ if (value !== void 0 || variants.length < 2 || childSchema(first, key3, value) !== void 0) return first;
5126
+ return variants.find((variant) => variant.type === "array" ? INDEX.test(key3) && childSchema(variant, key3, value) !== void 0 : childSchema(variant, key3, value) !== void 0) ?? first;
4722
5127
  }
4723
5128
  function walk(presentation, parts2, rootSchema) {
4724
5129
  let current = rootSchema;
@@ -4727,21 +5132,21 @@ function walk(presentation, parts2, rootSchema) {
4727
5132
  let parent;
4728
5133
  let known = true;
4729
5134
  for (let index = 0; index < parts2.length; index++) {
4730
- const key2 = parts2[index];
4731
- const resolved = stepSchema(current, value, key2, root);
5135
+ const key3 = parts2[index];
5136
+ const resolved = stepSchema(current, value, key3, root);
4732
5137
  parent = resolved;
4733
5138
  let next;
4734
5139
  const recordSchema = parts2[0] === "catalogs" && index === 3 ? catalogSchemaNames[parts2[2]] : void 0;
4735
5140
  if (recordSchema) {
4736
5141
  next = schemas[recordSchema] ?? {};
4737
5142
  root = next;
4738
- } else next = childSchema(resolved, key2, value);
5143
+ } else next = childSchema(resolved, key3, value);
4739
5144
  if (next === void 0) {
4740
5145
  known = false;
4741
5146
  next = {};
4742
5147
  }
4743
5148
  current = next;
4744
- value = value !== null && typeof value === "object" ? value[key2] : void 0;
5149
+ value = value !== null && typeof value === "object" ? value[key3] : void 0;
4745
5150
  }
4746
5151
  return { raw: current, schema: resolveSchema(current, root), root, parent, value, known };
4747
5152
  }
@@ -4763,7 +5168,7 @@ function createSchemaValue(schema, root = presentationSchema, depth2 = 0) {
4763
5168
  if (type === "object") {
4764
5169
  const value = {};
4765
5170
  const properties = s.properties ?? {};
4766
- for (const key2 of /* @__PURE__ */ new Set([...s.required ?? [], ...Object.keys(properties).filter((name) => own3(properties[name], "const"))])) value[key2] = createSchemaValue(properties[key2] ?? {}, root, depth2 + 1);
5171
+ for (const key3 of /* @__PURE__ */ new Set([...s.required ?? [], ...Object.keys(properties).filter((name) => own3(properties[name], "const"))])) value[key3] = createSchemaValue(properties[key3] ?? {}, root, depth2 + 1);
4767
5172
  return value;
4768
5173
  }
4769
5174
  if (type === "array") return Array.from({ length: Math.min(s.minItems ?? 0, 100) }, () => createSchemaValue(s.items ?? {}, root, depth2 + 1));
@@ -4780,26 +5185,26 @@ function listSchemaFields() {
4780
5185
  for (const [name, root] of Object.entries(schemas)) {
4781
5186
  const visit = (schema, path) => {
4782
5187
  if (!schema || typeof schema !== "object") return;
4783
- for (const [key2, child] of Object.entries(schema.properties ?? {})) {
5188
+ for (const [key3, child] of Object.entries(schema.properties ?? {})) {
4784
5189
  result.push({
4785
5190
  schema: name,
4786
- path: formatPointer([...path, "properties", key2]),
4787
- name: key2,
5191
+ path: formatPointer([...path, "properties", key3]),
5192
+ name: key3,
4788
5193
  description: child.description ?? "",
4789
5194
  reference: child.$ref ?? null,
4790
5195
  type: child.type ?? null,
4791
5196
  values: child.enum ?? (own3(child, "const") ? [child.const] : null)
4792
5197
  });
4793
- visit(child, [...path, "properties", key2]);
5198
+ visit(child, [...path, "properties", key3]);
4794
5199
  }
4795
- for (const [key2, child] of Object.entries(schema.$defs ?? {})) visit(child, [...path, "$defs", key2]);
5200
+ for (const [key3, child] of Object.entries(schema.$defs ?? {})) visit(child, [...path, "$defs", key3]);
4796
5201
  for (const keyword of ["oneOf", "anyOf", "allOf"]) {
4797
5202
  const members = schema[keyword] ?? [];
4798
5203
  for (let index = 0; index < members.length; index++) visit(members[index], [...path, keyword, String(index)]);
4799
5204
  }
4800
5205
  if (schema.items) visit(schema.items, [...path, "items"]);
4801
5206
  if (typeof schema.additionalProperties === "object") visit(schema.additionalProperties, [...path, "additionalProperties"]);
4802
- for (const [key2, child] of Object.entries(schema.patternProperties ?? {})) visit(child, [...path, "patternProperties", key2]);
5207
+ for (const [key3, child] of Object.entries(schema.patternProperties ?? {})) visit(child, [...path, "patternProperties", key3]);
4803
5208
  };
4804
5209
  visit(root, []);
4805
5210
  }
@@ -4809,16 +5214,16 @@ var COMMON_KEYS = Object.freeze({
4809
5214
  /** The root of a document. */
4810
5215
  deck: Object.freeze(["name", "slides", "design", "language", "audience", "purpose", "tone", "narrative", "organization", "speaker"]),
4811
5216
  /** A slide (`slides[n]`). */
4812
- slide: Object.freeze(["title", "subtitle", "layout", "items", "text", "notes", "image", "chart", "table", "quote", "code", "metric", "timeline", "diagram", "blocks", "design", "id", "section", "tag", "hidden", "beat"]),
5217
+ slide: Object.freeze(["title", "subtitle", "layout", "items", "text", "notes", "image", "chart", "table", "quote", "code", "metric", "timeline", "diagram", "blocks", "design", "id", "section", "tag", "hidden", "beat", "language"]),
4813
5218
  /** `design`, on the deck and on a slide. */
4814
5219
  design: Object.freeze(["theme", "colorScheme", "fontScheme", "dimensions", "background", "header", "footer"])
4815
5220
  });
4816
5221
  var UNRANKED_PRIORITY = 1e6;
4817
5222
  var DEFINITION_LISTS = { Slide: COMMON_KEYS.slide, Design: COMMON_KEYS.design, SlideDesign: COMMON_KEYS.design };
4818
5223
  var ADVANCED_KEYS = /* @__PURE__ */ new Set(["extensions", "$schema"]);
4819
- var REGION_KEY = /^(?:(?:top|middle|bottom)(?:\+(?:top|middle|bottom))*)?(?::)?(?:(?:left|center|right)(?:\+(?:left|center|right))*)?$/;
4820
- function isPromotedRegionKey(key2) {
4821
- return key2 !== "" && key2 !== ":" && REGION_KEY.test(key2);
5224
+ var REGION_KEY = /^(?:(?:top|middle|bottom)(?:\+(?:top|middle|bottom))*)?(?::)?(?:(?:start|center|end)(?:\+(?:start|center|end))*)?$/;
5225
+ function isPromotedRegionKey(key3) {
5226
+ return key3 !== "" && key3 !== ":" && REGION_KEY.test(key3);
4822
5227
  }
4823
5228
  var uniq = (items) => [...new Set(items)];
4824
5229
  function variantType(variant) {
@@ -4877,8 +5282,8 @@ function typeLabelOf(raw, variants, root) {
4877
5282
  if (type === "object") return definitionOf(raw) ?? "object";
4878
5283
  return type;
4879
5284
  }
4880
- function priorityOf(list, key2) {
4881
- const index = list ? list.indexOf(key2) : -1;
5285
+ function priorityOf(list, key3) {
5286
+ const index = list ? list.indexOf(key3) : -1;
4882
5287
  return index < 0 ? UNRANKED_PRIORITY : index;
4883
5288
  }
4884
5289
  function objectForm(variants, value) {
@@ -4889,24 +5294,24 @@ function objectForm(variants, value) {
4889
5294
  if (best) used = [best];
4890
5295
  }
4891
5296
  const properties = /* @__PURE__ */ new Map();
4892
- for (const variant of used) for (const [key2, child] of Object.entries(variant.properties ?? {})) if (!properties.has(key2)) properties.set(key2, child);
4893
- const required = used.length ? (used[0]?.required ?? []).filter((key2) => used.every((variant) => (variant.required ?? []).includes(key2))) : [];
5297
+ for (const variant of used) for (const [key3, child] of Object.entries(variant.properties ?? {})) if (!properties.has(key3)) properties.set(key3, child);
5298
+ const required = used.length ? (used[0]?.required ?? []).filter((key3) => used.every((variant) => (variant.required ?? []).includes(key3))) : [];
4894
5299
  return { properties, required };
4895
5300
  }
4896
5301
  function childrenOf(form, list, isSlide, root) {
4897
5302
  const children = [];
4898
- for (const [key2, raw] of form.properties) {
5303
+ for (const [key3, raw] of form.properties) {
4899
5304
  const resolved = resolveSchema(raw, root);
4900
5305
  const variants = schemaVariants(raw, root);
4901
5306
  const description = firstParagraph(resolved.description);
4902
5307
  const catalogKind = catalogKindOf(resolved, variants);
4903
5308
  children.push({
4904
- key: key2,
5309
+ key: key3,
4905
5310
  types: uniq(variants.map(variantType)),
4906
5311
  typeLabel: typeLabelOf(raw, variants, root),
4907
- required: form.required.includes(key2),
4908
- advanced: ADVANCED_KEYS.has(key2) || isSlide && isPromotedRegionKey(key2),
4909
- priority: priorityOf(list, key2),
5312
+ required: form.required.includes(key3),
5313
+ advanced: ADVANCED_KEYS.has(key3) || isSlide && isPromotedRegionKey(key3),
5314
+ priority: priorityOf(list, key3),
4910
5315
  ...description ? { description } : {},
4911
5316
  ...catalogKind ? { catalogKind } : {},
4912
5317
  ...resolved.deprecated === true ? { deprecated: true } : {},
@@ -4939,7 +5344,7 @@ function describeAt(presentation, path, depth2) {
4939
5344
  const inherited = schema.description;
4940
5345
  const last = parts2.at(-1);
4941
5346
  const parentIsArray = parent !== void 0 && variantType(parent) === "array";
4942
- const key2 = last !== void 0 && !parentIsArray ? last : void 0;
5347
+ const key3 = last !== void 0 && !parentIsArray ? last : void 0;
4943
5348
  const definition = definitionOf(raw);
4944
5349
  const description = firstParagraph(schema.description);
4945
5350
  const enumList = enumValues(variants, inherited);
@@ -4969,12 +5374,12 @@ function describeAt(presentation, path, depth2) {
4969
5374
  known: true,
4970
5375
  path: shown,
4971
5376
  pointer: pointer4,
4972
- ...key2 !== void 0 ? { key: key2 } : {},
5377
+ ...key3 !== void 0 ? { key: key3 } : {},
4973
5378
  types: uniq(infos2.map((variant) => variant.type)),
4974
5379
  ...description ? { description } : {},
4975
5380
  ...typeof schema.description === "string" && schema.description.trim() ? { fullDescription: schema.description.trim() } : {},
4976
5381
  ...definition ? { definition } : {},
4977
- required: key2 !== void 0 && Array.isArray(parent?.required) && parent.required.includes(key2),
5382
+ required: key3 !== void 0 && Array.isArray(parent?.required) && parent.required.includes(key3),
4978
5383
  ...schema.deprecated === true ? { deprecated: true } : {},
4979
5384
  examples: Array.isArray(schema.examples) ? [...schema.examples] : [],
4980
5385
  ...own3(schema, "default") ? { default: schema.default } : {},
@@ -5553,7 +5958,7 @@ var Analyzer = class {
5553
5958
  });
5554
5959
  }
5555
5960
  // -- values --
5556
- parseValue(path, key2) {
5961
+ parseValue(path, key3) {
5557
5962
  const token = this.peek();
5558
5963
  switch (token.kind) {
5559
5964
  case "lbrace":
@@ -5572,7 +5977,7 @@ var Analyzer = class {
5572
5977
  return { start: token.start, end: token.end, kind: "scalar" };
5573
5978
  case "word":
5574
5979
  this.take();
5575
- this.bareWord(token, path, key2);
5980
+ this.bareWord(token, path, key3);
5576
5981
  return { start: token.start, end: token.end, kind: "scalar" };
5577
5982
  case "unknown":
5578
5983
  this.take();
@@ -5581,7 +5986,7 @@ var Analyzer = class {
5581
5986
  return void 0;
5582
5987
  }
5583
5988
  }
5584
- bareWord(token, path, key2) {
5989
+ bareWord(token, path, key3) {
5585
5990
  const word = token.text;
5586
5991
  const lower = word.toLowerCase();
5587
5992
  const edit = (insert) => [{ offset: token.start, length: token.end - token.start, insert }];
@@ -5597,7 +6002,7 @@ var Analyzer = class {
5597
6002
  next = "write null, or put it in quotes if it is text. JSON has no NaN, Infinity or undefined.";
5598
6003
  fixes.push({ id: "use-null", title: "Use null", safe: lower === "null", edits: edit("null") });
5599
6004
  } else {
5600
- message = key2 !== void 0 ? `\`${key2}\` needs a quoted string: ${JSON.stringify(word)}.` : `\`${clip(word, 24)}\` needs quotes to be text: ${JSON.stringify(word)}.`;
6005
+ message = key3 !== void 0 ? `\`${key3}\` needs a quoted string: ${JSON.stringify(word)}.` : `\`${clip(word, 24)}\` needs quotes to be text: ${JSON.stringify(word)}.`;
5601
6006
  next = `put it in double quotes: ${JSON.stringify(word)}.`;
5602
6007
  }
5603
6008
  fixes.push({ id: "quote-value", title: "Quote the value", safe: false, edits: edit(JSON.stringify(word)) });
@@ -5821,23 +6226,23 @@ var Analyzer = class {
5821
6226
  fixes: [{ id: "remove-token", title: `Remove ${clip(token.text, 12)}`, safe: false, edits: [{ offset: token.start, length: token.end - token.start, insert: "" }] }]
5822
6227
  });
5823
6228
  }
5824
- missingColon(keyToken, key2, path, valueFollows, container) {
6229
+ missingColon(keyToken, key3, path, valueFollows, container) {
5825
6230
  const keyEnd = keyToken.end;
5826
- const shown = clip(key2, 30);
6231
+ const shown = clip(key3, 30);
5827
6232
  const removal = this.removeEntry(keyToken.start, keyEnd);
5828
6233
  this.structural({
5829
6234
  code: "missing-colon",
5830
6235
  range: this.range(keyToken.start, keyToken.end),
5831
6236
  path,
5832
6237
  message: valueFollows ? `\`${shown}\` is missing a colon.` : `\`${shown}\` has no colon and value.`,
5833
- next: valueFollows ? "add `:` after the property name." : `write ${JSON.stringify(key2)}: and a value, or remove the property.`,
6238
+ next: valueFollows ? "add `:` after the property name." : `write ${JSON.stringify(key3)}: and a value, or remove the property.`,
5834
6239
  fixes: [
5835
6240
  { id: "insert-colon", title: "Add colon", safe: valueFollows, edits: [{ offset: keyEnd, length: 0, insert: valueFollows ? ":" : ": " }], caret: keyEnd + (valueFollows ? 1 : 2) },
5836
- ...valueFollows ? [] : [{ id: "remove-key", title: `Remove ${JSON.stringify(key2)}`, safe: false, edits: removal }]
6241
+ ...valueFollows ? [] : [{ id: "remove-key", title: `Remove ${JSON.stringify(key3)}`, safe: false, edits: removal }]
5837
6242
  ]
5838
6243
  });
5839
6244
  }
5840
- missingValue(keyToken, colon, key2, path) {
6245
+ missingValue(keyToken, colon, key3, path) {
5841
6246
  const needsComma = (() => {
5842
6247
  const next = this.peek();
5843
6248
  return (next.kind === "string" || next.kind === "word") && this.peek(1).kind === "colon";
@@ -5848,12 +6253,12 @@ var Analyzer = class {
5848
6253
  const edits = [{ offset: at2, length: 0, insert: `${gap ? " " : ""}${hint.insert}` }];
5849
6254
  if (needsComma) edits.push({ offset: at2, length: 0, insert: "," });
5850
6255
  const fixes = [{ id: "add-value", title: hint.title, safe: false, edits, caret: at2 + (gap ? 1 : 0) + hint.caret }];
5851
- fixes.push({ id: "remove-key", title: `Remove ${JSON.stringify(key2)}`, safe: false, edits: this.removeEntry(keyToken.start, colon.end) });
6256
+ fixes.push({ id: "remove-key", title: `Remove ${JSON.stringify(key3)}`, safe: false, edits: this.removeEntry(keyToken.start, colon.end) });
5852
6257
  this.structural({
5853
6258
  code: "missing-value",
5854
6259
  range: this.range(keyToken.start, colon.end),
5855
6260
  path,
5856
- message: `\`${key2}\` needs a value.`,
6261
+ message: `\`${key3}\` needs a value.`,
5857
6262
  next: `${hint.next} Press Ctrl+Space after the colon for options.`,
5858
6263
  fixes
5859
6264
  });
@@ -5910,8 +6315,8 @@ ${indentOf(text2, open.start)}${closer}`;
5910
6315
  const insert = inner.join("") + own4;
5911
6316
  this.cascade = { last: this.last, inserts: [...inner, own4] };
5912
6317
  const closers = insert.replace(/\s/g, "");
5913
- const key2 = container.path.at(-1);
5914
- const entry2 = typeof key2 === "string" ? `"${key2}": ${open.text}` : open.text;
6318
+ const key3 = container.path.at(-1);
6319
+ const entry2 = typeof key3 === "string" ? `"${key3}": ${open.text}` : open.text;
5915
6320
  const context = container.type === "{" ? firstEntryOf(text2, open) : void 0;
5916
6321
  const what = container.type === "{" ? "property" : "item";
5917
6322
  this.add({
@@ -6122,18 +6527,18 @@ function parseSource(source) {
6122
6527
  if (node.type === "object") {
6123
6528
  const keys = /* @__PURE__ */ new Set();
6124
6529
  for (const property of node.children ?? []) {
6125
- const key2 = property.children?.[0];
6126
- if (!key2) continue;
6127
- if (keys.has(key2.value))
6530
+ const key3 = property.children?.[0];
6531
+ if (!key3) continue;
6532
+ if (keys.has(key3.value))
6128
6533
  duplicates.push(
6129
6534
  finding("opf/duplicate-key", {
6130
- path: pointer3(getNodePath(key2)),
6131
- message: `Duplicate JSON property ${JSON.stringify(key2.value)}.`,
6535
+ path: pointer3(getNodePath(key3)),
6536
+ message: `Duplicate JSON property ${JSON.stringify(key3.value)}.`,
6132
6537
  help: "Resolve the duplicate explicitly, preserving the intended content from both occurrences. JSON.parse would otherwise hide an earlier value.",
6133
- location: location(key2.offset, key2.length)
6538
+ location: location(key3.offset, key3.length)
6134
6539
  })
6135
6540
  );
6136
- keys.add(key2.value);
6541
+ keys.add(key3.value);
6137
6542
  }
6138
6543
  }
6139
6544
  stack.push(...node.children ?? []);
@@ -6168,7 +6573,7 @@ function parseSource(source) {
6168
6573
  var WORDS = { object: "an object", array: "a list", string: "text", number: "a number", integer: "a whole number", boolean: "true or false", null: "null" };
6169
6574
  var KIND_WORDS = { layouts: "layout", themes: "theme", colorSchemes: "color scheme", fontSchemes: "font scheme", narratives: "narrative", audiences: "audience", purposes: "purpose", tones: "tone", languages: "language" };
6170
6575
  var KIND_EXAMPLES = { layouts: "`pillars` or `acme:hero`", themes: "`minimal` or `acme:bold`", colorSchemes: "`boost` or `acme:night`", fontSchemes: "`aptos` or `acme:brand`", narratives: "`classic-story`", audiences: "`board`", purposes: "`inform`", tones: "`formal`" };
6171
- var ALIASES = { middle: "center", centre: "center", centered: "center", centred: "center", justify: "left", col: "column", cols: "column", pic: "image", picture: "image", photo: "image", paragraph: "text", bullets: "list", bullet: "list" };
6576
+ var ALIASES = { middle: "center", centre: "center", centered: "center", centred: "center", justify: "start", left: "start", right: "end", col: "column", cols: "column", pic: "image", picture: "image", photo: "image", paragraph: "text", bullets: "list", bullet: "list" };
6172
6577
  function segmentsOf(path) {
6173
6578
  if (Array.isArray(path)) return path.map(String);
6174
6579
  if (typeof path !== "string" || path === "" || path === "/") return [];
@@ -6357,7 +6762,7 @@ function chooseNext(value, candidates, alternative = "", max = 3) {
6357
6762
  return alternative ? sentence(alternative) : "choose a different value.";
6358
6763
  }
6359
6764
  function kindPhrase(kind) {
6360
- const phrases = { text: "text", code: "code", list: "a list", chart: "a chart", table: "a table", image: "an image", video: "a video", metric: "a metric", quote: "a quote", timeline: "a timeline", group: "a group" };
6765
+ const phrases = { text: "text", code: "code", list: "a list", chart: "a chart", table: "a table", image: "an image", video: "a video", metric: "a metric", quote: "a quote", timeline: "a timeline", shape: "a shape", group: "a group" };
6361
6766
  return phrases[kind] ?? `${/^[aeiou]/i.test(kind) ? "an" : "a"} ${kind}`;
6362
6767
  }
6363
6768
  function freshName(base, taken = []) {
@@ -6372,7 +6777,7 @@ var BLOCK_KINDS = ["chart", "image", "video", "table", "code", "metric", "quote"
6372
6777
  function blockKind(node) {
6373
6778
  if (!isRecord3(node)) return void 0;
6374
6779
  if (typeof node.type === "string" && node.type !== "group") return node.type;
6375
- const found = BLOCK_KINDS.find((key2) => node[key2] !== void 0);
6780
+ const found = BLOCK_KINDS.find((key3) => node[key3] !== void 0);
6376
6781
  if (found === "items" || found === "bullets") return "list";
6377
6782
  return found;
6378
6783
  }
@@ -6387,12 +6792,12 @@ function brief(text2, max = 40) {
6387
6792
  }
6388
6793
 
6389
6794
  // src/finding-text-audit.ts
6390
- var measuredNumber = (finding2, key2) => {
6391
- const value = finding2.measured?.[key2];
6795
+ var measuredNumber = (finding2, key3) => {
6796
+ const value = finding2.measured?.[key3];
6392
6797
  return typeof value === "number" ? value : void 0;
6393
6798
  };
6394
- var measuredText = (finding2, key2) => {
6395
- const value = finding2.measured?.[key2];
6799
+ var measuredText = (finding2, key3) => {
6800
+ const value = finding2.measured?.[key3];
6396
6801
  return typeof value === "string" ? value : void 0;
6397
6802
  };
6398
6803
  var num = (value, digits = 2) => String(Math.round(value * 10 ** digits) / 10 ** digits);
@@ -6419,6 +6824,12 @@ var textOnImage = (finding2) => {
6419
6824
  const ratio = measuredNumber(finding2, "ratio");
6420
6825
  const needed = measuredNumber(finding2, "needed");
6421
6826
  const scrim = measuredNumber(finding2, "scrimOpacity");
6827
+ const best = measuredNumber(finding2, "best");
6828
+ if (best !== void 0)
6829
+ return {
6830
+ message: `This text is too faint on the picture: at most ${num(best, 1)}:1 over any part of it here${needed !== void 0 ? `, and ${num(needed)}:1 is needed` : ""}.`,
6831
+ next: `set the background's ${code("tone")} so the text color follows the picture, or give the text a readable color.`
6832
+ };
6422
6833
  if (scrim !== void 0)
6423
6834
  return {
6424
6835
  message: `Text sits on this picture, so a scrim at ${num(scrim * 100)}% is drawn behind it to keep it readable${needed !== void 0 ? ` at ${num(needed)}:1` : ""}.`,
@@ -6618,6 +7029,32 @@ var regionKind = (finding2) => {
6618
7029
  next: `remove ${code("region")} so OPF places the block by its kind, or pin it to a region that takes ${found[2]}.`
6619
7030
  };
6620
7031
  };
7032
+ var iconDropped = (finding2) => {
7033
+ const room = /no room for its chip/.test(finding2.message);
7034
+ return {
7035
+ message: room ? "An icon is not drawn: its chip would set the slide's text smaller." : "An icon is not drawn: icons mark first-level entries of an unnumbered list, metrics and groups.",
7036
+ next: room ? "shorten the text or give the slide more room, or remove the icon." : "move the icon to an entry, metric or group it can mark, or remove it."
7037
+ };
7038
+ };
7039
+ var shapeOffSlide = (finding2) => ({
7040
+ message: /callout/.test(finding2.message) ? "An image callout lies wholly outside the slide, so it is not drawn." : "A shape lies wholly outside the slide, so it is not drawn.",
7041
+ next: "write its position as fractions (0.2 for 20%), or move it so part of it is on the slide."
7042
+ });
7043
+ var chartLabelCollision = () => ({
7044
+ message: "A reference label meets another label, a data line or a mark at both ends of its line.",
7045
+ next: "shorten the label, give the chart more room, or set the line where a bar or the area leaves room beside it."
7046
+ });
7047
+ var timelinePeriodShort = () => ({
7048
+ message: "A timeline period is too short to read: its duration gives it less room than its marker.",
7049
+ next: "give the timeline more room, or make its shortest period longer."
7050
+ });
7051
+ var arrangementAdapted = (finding2) => {
7052
+ const cards = /needs four entries/.test(finding2.message);
7053
+ return {
7054
+ message: cards ? "A matrix needs four entries, so this one is drawn as a grid of cards." : "This arrangement (a pyramid, matrix, cycle, row of chevrons or flow) is drawn as a list.",
7055
+ next: cards ? "write four entries for the quadrants, or choose another layout." : "shorten the entries, keep one level without descriptions, or choose another layout."
7056
+ };
7057
+ };
6621
7058
  var regionFull = (finding2) => {
6622
7059
  const found = match(finding2.message, /^Region '(.+?)' already holds its (\d+) block/);
6623
7060
  if (!found) return void 0;
@@ -6688,7 +7125,7 @@ var centeredBody2 = (finding2) => {
6688
7125
  const blocks = measuredNumber(finding2, "blocks") ?? 1;
6689
7126
  return {
6690
7127
  message: `A centered ${what}${onSlide(finding2)} runs ${lines} line${lines === 1 ? "" : "s"} (${characters} characters)${blocks > 1 ? `, with ${blocks - 1} more like it` : ""}; each line starts at a different place, which is harder to read.`,
6691
- next: `set ${code('contentAlignment: "left"')} in the slide's design, or cut it to a line or two.`
7128
+ next: `set ${code('contentAlignment: "start"')} in the slide's design, or cut it to a line or two.`
6692
7129
  };
6693
7130
  };
6694
7131
  var tightSpacing2 = (finding2) => {
@@ -6789,6 +7226,17 @@ var codeHighlightRangeReversed = (finding2) => {
6789
7226
  next: `write [${found[3]}, ${found[4]}].`
6790
7227
  };
6791
7228
  };
7229
+ var variableGroupOmitted = (finding2) => {
7230
+ const ids = [...finding2.message.matchAll(/'([a-z][a-z0-9-]*)'/g)].map((found) => found[1]);
7231
+ const idParam = isRecord3(finding2.validation?.params) ? finding2.validation.params.id : void 0;
7232
+ const names2 = [...new Set(ids.length ? ids : typeof idParam === "string" ? [idParam] : [])];
7233
+ if (!names2.length) return void 0;
7234
+ const list = names2.length === 1 ? code(names2[0]) : `${names2.slice(0, -1).map((id) => code(id)).join(", ")} and ${code(names2.at(-1))}`;
7235
+ return {
7236
+ message: `A group${onSlide(finding2)} is left out when ${list} ${names2.length === 1 ? "has" : "have"} no value, with its pictures, cards and other text.`,
7237
+ next: `give ${names2.length === 1 ? "it" : "one of them"} a value to draw the group, or move what should always show out of the group.`
7238
+ };
7239
+ };
6792
7240
  var variableBuiltinMissing = (finding2, _context, helpers) => {
6793
7241
  const idParam = isRecord3(finding2.validation?.params) ? finding2.validation.params.id : void 0;
6794
7242
  const id = (typeof idParam === "string" ? idParam : void 0) ?? match(finding2.message, /^Built-in '(.+?)' has no value/)?.[1] ?? match(finding2.message, /'\{\{(.+?)\}\}'/)?.[1];
@@ -6885,6 +7333,11 @@ var AUDIT_TEXT = {
6885
7333
  "opf/region-unknown": regionUnknown,
6886
7334
  "opf/region-kind": regionKind,
6887
7335
  "opf/region-full": regionFull,
7336
+ "opf/icon-dropped": iconDropped,
7337
+ "opf/arrangement-adapted": arrangementAdapted,
7338
+ "opf/chart-label-collision": chartLabelCollision,
7339
+ "opf/shape-off-slide": shapeOffSlide,
7340
+ "opf/timeline-period-short": timelinePeriodShort,
6888
7341
  "opf/layout-unplaced": layoutUnplaced,
6889
7342
  "opf/furniture-wraps": furnitureWraps,
6890
7343
  "opf/font-outside-scheme": fontOutsideScheme,
@@ -6896,6 +7349,7 @@ var AUDIT_TEXT = {
6896
7349
  "opf/code-highlight-out-of-range": codeHighlightOutOfRange,
6897
7350
  "opf/code-highlight-range-reversed": codeHighlightRangeReversed,
6898
7351
  "opf/variable-builtin-missing": variableBuiltinMissing,
7352
+ "opf/variable-group-omitted": variableGroupOmitted,
6899
7353
  "opf/duration-outside-narrative": durationOutsideNarrative2,
6900
7354
  "opf/narrative-duration-range": narrativeDurationRange,
6901
7355
  "opf/placeholder-text": placeholderText,
@@ -6920,10 +7374,10 @@ var jsonSyntax = (finding2) => ({
6920
7374
  next: helpAsNext(finding2, "fix the syntax error at the marked position.")
6921
7375
  });
6922
7376
  var duplicateKey = (finding2, _context, helpers) => {
6923
- const key2 = helpers.segments.at(-1) ?? unquote(match(finding2.message, /^Duplicate JSON property (".*")\.$/)?.[1]);
7377
+ const key3 = helpers.segments.at(-1) ?? unquote(match(finding2.message, /^Duplicate JSON property (".*")\.$/)?.[1]);
6924
7378
  const owner = placeWords(helpers.segments.slice(0, -1));
6925
7379
  return {
6926
- message: `${code(key2)} appears twice ${owner}. JSON keeps only the last value, so the earlier one is ignored.`,
7380
+ message: `${code(key3)} appears twice ${owner}. JSON keeps only the last value, so the earlier one is ignored.`,
6927
7381
  next: "keep one of them, or merge their values into one."
6928
7382
  };
6929
7383
  };
@@ -6966,8 +7420,8 @@ var captionUnsupportedPayload = (finding2) => {
6966
7420
  const kind = type ?? (/a group cannot carry one/.test(finding2.message) ? "group" : void 0);
6967
7421
  const is = kind ? kindPhrase(kind) : "not one of those";
6968
7422
  return {
6969
- message: `A ${code("caption")} belongs to one image, chart, table or video; this block is ${is}.`,
6970
- next: `put the ${code("caption")} on the image, chart, table or video it describes, or remove it.`
7423
+ message: `A ${code("caption")} belongs to one image, chart, table, video or diagram; this block is ${is}.`,
7424
+ next: `put the ${code("caption")} on the image, chart, table, video or diagram it describes, or remove it.`
6971
7425
  };
6972
7426
  };
6973
7427
  var imageOptionUnsupportedPayload = (finding2) => {
@@ -6980,6 +7434,62 @@ var imageOptionUnsupportedPayload = (finding2) => {
6980
7434
  next: `remove ${code(field)}, or move it onto an image.`
6981
7435
  };
6982
7436
  };
7437
+ var shapeOptionUnsupportedPayload = (finding2) => {
7438
+ const field = text(params(finding2).field) ?? match(finding2.message, /^(\w+) is only valid on a shape block/)?.[1];
7439
+ const type = text(params(finding2).type) ?? match(finding2.message, /; this payload is '(.+?)'/)?.[1];
7440
+ const kind = type ?? (/a group cannot carry them/.test(finding2.message) ? "group" : void 0);
7441
+ if (!field) return void 0;
7442
+ return {
7443
+ message: `${code(field)} only applies to shapes; this block is ${kind ? kindPhrase(kind) : "not a shape"}.`,
7444
+ next: `remove ${code(field)}, or make the block a shape with \`shape\` (a preset such as roundRect) or \`path\`.`
7445
+ };
7446
+ };
7447
+ var shapeAdjustUnknown = (finding2) => {
7448
+ const { name, shape, known } = params(finding2);
7449
+ if (typeof name !== "string") return void 0;
7450
+ const names2 = Array.isArray(known) ? known.filter((entry2) => typeof entry2 === "string") : [];
7451
+ if (shape === "path") return { message: `${code(`adjust.${name}`)} has no effect on a custom \`path\`: adjust values belong to presets.`, next: `remove ${code(`adjust.${name}`)}.` };
7452
+ return {
7453
+ message: `${text(shape) ?? "This preset"} has no adjust value ${code(name)}${names2.length ? `; it has ${names2.map(code).join(", ")}` : "; it has none"}.`,
7454
+ next: names2.length ? `use ${names2.map(code).join(" or ")}, or remove ${code(name)}.` : `remove ${code(`adjust.${name}`)}.`
7455
+ };
7456
+ };
7457
+ var shapeAdjustRange = (finding2) => {
7458
+ const { name, shape, value, min, max, unit } = params(finding2);
7459
+ if (typeof name !== "string" || typeof value !== "number") return void 0;
7460
+ const range = `${typeof min === "number" ? min : "no minimum"} to ${typeof max === "number" ? max : "no maximum"}`;
7461
+ return {
7462
+ message: `${code(`adjust.${name}`)} of ${text(shape) ?? "this preset"} is ${value}, outside ${range}${unit === "degrees" ? " degrees" : ""}, so the preset's default is drawn.`,
7463
+ next: `set it between ${range}.`
7464
+ };
7465
+ };
7466
+ var shapeLinkHidden = () => ({
7467
+ message: "This shape is hidden, so its `link` can never be clicked.",
7468
+ next: "remove `hidden`, or remove the `link`."
7469
+ });
7470
+ var shapeAnchorSizeUnit = (finding2) => {
7471
+ const { key: key3, size } = params(finding2);
7472
+ return typeof key3 === "string" ? { message: `${code(`at.${key3}: ${String(size)}`)} is a fraction, not pixels.`, next: `rename ${code(key3)} to ${code(`${key3}Px`)} if it is pixels.` } : void 0;
7473
+ };
7474
+ var shapeAnchorMissing = (finding2) => {
7475
+ const { id, known } = params(finding2);
7476
+ if (typeof id !== "string") return void 0;
7477
+ const ids = Array.isArray(known) ? known.filter((entry2) => typeof entry2 === "string") : [];
7478
+ return {
7479
+ message: `${code(`at.block: "${id}"`)} names no block on this slide, so the shape is not drawn.${ids.length ? ` Block ids on this slide: ${plainList(ids)}.` : " No block on this slide has an id."}`,
7480
+ next: chooseNext(id, ids, `give the block the shape belongs to ${code(`id: "${id}"`)}`)
7481
+ };
7482
+ };
7483
+ var connectorEndMissing = (finding2) => {
7484
+ const { id, side, known } = params(finding2);
7485
+ if (typeof id !== "string" || side !== "from" && side !== "to") return void 0;
7486
+ const ids = Array.isArray(known) ? known.filter((entry2) => typeof entry2 === "string") : [];
7487
+ if (/names a connector/.test(finding2.message)) return { message: `The connector's ${code(side)} names the connector ${code(id)}; a connector joins blocks and overlay shapes.`, next: `name a block or an overlay shape in ${code(side)}.` };
7488
+ return {
7489
+ message: `The connector's ${code(`${side}: "${id}"`)} names no block or overlay shape on this slide, so the connector is not drawn.${ids.length ? ` Ids on this slide: ${plainList(ids)}.` : " Nothing on this slide has an id."}`,
7490
+ next: chooseNext(id, ids, `give the block or shape it should join ${code(`id: "${id}"`)}`)
7491
+ };
7492
+ };
6983
7493
  var imagePlacementInvalid = (finding2) => {
6984
7494
  const { edge, blocks } = params(finding2);
6985
7495
  if (typeof edge === "string" && Array.isArray(blocks) && blocks.length === 2) {
@@ -7050,6 +7560,17 @@ var chartMappingUnknownColumn = (finding2) => {
7050
7560
  next: chooseNext(name, columns)
7051
7561
  };
7052
7562
  };
7563
+ var chartReferenceAxisUnavailable = () => ({
7564
+ message: "This reference uses a secondary value axis that the chart does not have.",
7565
+ next: "use the value axis, or put a line series on a combo chart's secondary axis."
7566
+ });
7567
+ var chartReferenceUnsupportedType = (finding2) => {
7568
+ const type = match(finding2.message, /a '(.+?)' chart has none/)?.[1];
7569
+ return {
7570
+ message: type ? `A ${code(type)} chart cannot draw reference lines: it has no single value axis.` : "This chart type cannot draw reference lines: it has no single value axis.",
7571
+ next: "remove `referenceLines`, or use a column, bar, line, line-with-markers, area or combo chart."
7572
+ };
7573
+ };
7053
7574
  var numberFormatInvalid = (finding2, _context, helpers) => {
7054
7575
  const value = helpers.valueAt(helpers.segments);
7055
7576
  const reason = match(finding2.message, /^Number format '.*?' ((?:needs|scales|has|uses|asks|allows|is)\b.+)$/)?.[1];
@@ -7270,7 +7791,7 @@ function layoutSpot(finding2) {
7270
7791
  if (parts2[0] === "catalogs" && parts2[2] === "layouts") return { id: parts2[3], spot: dotted(parts2.slice(4)) };
7271
7792
  return { spot: dotted(parts2) };
7272
7793
  }
7273
- var layoutTemplate = (finding2) => {
7794
+ var layoutTemplate2 = (finding2) => {
7274
7795
  const { id, spot } = layoutSpot(finding2);
7275
7796
  const detail = finding2.message.trim().replace(/\.$/, "");
7276
7797
  return {
@@ -7356,6 +7877,25 @@ var unusedReference = (finding2, _context, helpers) => {
7356
7877
  next: `cite it from a text, bullet or list item (${code(`cite: "${id}"`)}), or remove it.`
7357
7878
  };
7358
7879
  };
7880
+ var iconUnknown = (finding2, _context, helpers) => {
7881
+ const value = helpers.valueAt(helpers.segments);
7882
+ if (typeof value !== "string") return void 0;
7883
+ const near = (finding2.suggestions ?? []).slice(0, 3).map((entry2) => String(entry2.value));
7884
+ const set = /^No icon set ([a-z][a-z0-9-]*) /.exec(finding2.message)?.[1];
7885
+ return {
7886
+ message: set ? `Icon set ${code(set)} is not embedded or registered, so ${code(value)} is not drawn.` : `${code(value)} is not an icon of its set or of the deck's ${code("icons")}, so it is not drawn.`,
7887
+ next: near.length ? `did you mean ${near.map((name) => code(name)).join(" or ")}?` : `pick a name the set has (search_icons finds them by keyword), add it to the deck's ${code("icons")}, or remove the icon.`
7888
+ };
7889
+ };
7890
+ var iconInvalid = (finding2, _context, helpers) => {
7891
+ const value = helpers.valueAt(helpers.segments);
7892
+ if (typeof value !== "string") return void 0;
7893
+ const why = /has (.+?); an icon draws only/.exec(finding2.message)?.[1];
7894
+ return {
7895
+ message: why ? `The SVG of ${code(value)} has ${why}, so it is not drawn.` : `${code(value)} cannot be drawn as an icon.`,
7896
+ next: "keep only shapes in its SVG (paths, circles, rectangles, lines, polygons), with no script, link or raster, or remove the icon."
7897
+ };
7898
+ };
7359
7899
  var unusedDataset = (finding2, _context, helpers) => {
7360
7900
  const id = helpers.segments.at(-1) ?? unquote(match(finding2.message, /^Dataset ("(?:[^"\\]|\\.)*") is never referenced/)?.[1]);
7361
7901
  if (!id) return void 0;
@@ -7411,11 +7951,20 @@ var FORMAT_TEXT = {
7411
7951
  "opf/caption-unsupported-payload": captionUnsupportedPayload,
7412
7952
  "opf/image-option-unsupported-payload": imageOptionUnsupportedPayload,
7413
7953
  "opf/image-placement-invalid": imagePlacementInvalid,
7954
+ "opf/shape-option-unsupported-payload": shapeOptionUnsupportedPayload,
7955
+ "opf/shape-adjust-unknown": shapeAdjustUnknown,
7956
+ "opf/shape-adjust-range": shapeAdjustRange,
7957
+ "opf/shape-link-hidden": shapeLinkHidden,
7958
+ "opf/shape-anchor-size-unit": shapeAnchorSizeUnit,
7959
+ "opf/shape-anchor-missing": shapeAnchorMissing,
7960
+ "opf/connector-end-missing": connectorEndMissing,
7414
7961
  "opf/layout-placeholder-group": layoutPlaceholderGroup,
7415
7962
  "opf/dataset-unknown": datasetUnknown,
7416
7963
  "opf/dataset-field-unknown": datasetFieldUnknown,
7417
7964
  "opf/data-column-duplicate": dataColumnDuplicate,
7418
7965
  "opf/chart-mapping-unknown-column": chartMappingUnknownColumn,
7966
+ "opf/chart-reference-axis-unavailable": chartReferenceAxisUnavailable,
7967
+ "opf/chart-reference-unsupported-type": chartReferenceUnsupportedType,
7419
7968
  "opf/number-format-invalid": numberFormatInvalid,
7420
7969
  "opf/variable-invalid-value": variableInvalidValue,
7421
7970
  "opf/variable-unknown-builtin": variableUnknownBuiltin,
@@ -7430,12 +7979,14 @@ var FORMAT_TEXT = {
7430
7979
  "opf/asset-reference": assetReference,
7431
7980
  "opf/asset-cycle": assetCycle,
7432
7981
  "opf/catalog-record": catalogRecord,
7433
- "opf/layout-template": layoutTemplate,
7982
+ "opf/layout-template": layoutTemplate2,
7434
7983
  "opf/layout-region": layoutRegion,
7435
7984
  "opf/unresolved-reference": unresolvedReference2,
7436
7985
  "opf/catalog-record-not-in-source": catalogRecordNotInSource,
7437
7986
  "opf/unused-reference": unusedReference,
7438
7987
  "opf/unused-dataset": unusedDataset,
7988
+ "opf/icon-unknown": iconUnknown,
7989
+ "opf/icon-invalid": iconInvalid,
7439
7990
  "opf/unknown-beat": unknownBeat,
7440
7991
  "opf/slide-theme-dimensions": slideThemeDimensions,
7441
7992
  "opf/variable-unknown": variableUnknown,
@@ -7462,12 +8013,12 @@ var RULE_TEXT = Object.freeze(
7462
8013
  );
7463
8014
 
7464
8015
  // src/markdown/dialect.ts
7465
- var SLIDE_OPTION_KEYS = ["id", "type", "layout", "section", "tag", "hidden", "beat"];
8016
+ var SLIDE_OPTION_KEYS = ["id", "type", "layout", "section", "tag", "hidden", "beat", "language"];
7466
8017
  var BLOCK_OPTION_KEYS = ["id", "type", "as", "region"];
7467
8018
  var BLOCK_AS_VALUES = ["bullets", "video"];
7468
- var FENCE_KINDS = ["chart", "metric", "timeline", "mermaid", "opf-block", "opf-slide"];
8019
+ var FENCE_KINDS = ["chart", "metric", "timeline", "mermaid", "dot", "plantuml", "opf-block", "opf-slide"];
7469
8020
  var METRIC_KEYS = ["value", "label", "description", "unit", "delta", "trend", "sentiment"];
7470
- var FENCE_ATTRIBUTES = { chart: ["alt"], mermaid: ["alt"], timeline: ["name", "description"], code: ["title"] };
8021
+ var FENCE_ATTRIBUTES = { chart: ["alt"], mermaid: ["alt"], dot: ["alt"], plantuml: ["alt"], timeline: ["name", "description"], code: ["title"] };
7471
8022
  var SPAN_FLAGS = ["bold", "italic", "underline", "strike", "sup", "sub"];
7472
8023
  var SPAN_VALUES = ["color", "size", "font", "lang"];
7473
8024
  var LINE_KEYWORDS = ["Note:", "Notes:"];
@@ -7481,25 +8032,25 @@ var optionKeys = (kind) => kind === "block" ? BLOCK_OPTION_KEYS : SLIDE_OPTION_K
7481
8032
  var options = {
7482
8033
  "markdown/options-unknown-key": (finding2) => {
7483
8034
  const kind = quoted(finding2.message, /^Unknown (slide|block) option/) ?? "slide";
7484
- const key2 = quoted(finding2.message, /option "(.*)"\.$/) ?? "";
8035
+ const key3 = quoted(finding2.message, /option "(.*)"\.$/) ?? "";
7485
8036
  const guess = finding2.suggestions?.[0]?.value;
7486
8037
  const keys = optionKeys(kind).join(", ");
7487
8038
  return {
7488
- message: `${code(key2)} is not a ${kind} option.`,
8039
+ message: `${code(key3)} is not a ${kind} option.`,
7489
8040
  next: guess !== void 0 ? `did you mean ${code(guess)}? The keys are ${keys}. Anything else goes in an \`opf-${kind}\` fence.` : `use one of ${keys}. Anything else goes in an \`opf-${kind}\` fence.`
7490
8041
  };
7491
8042
  },
7492
8043
  "markdown/options-value": (finding2) => {
7493
8044
  if (/^hidden takes/.test(finding2.message)) return keep2(finding2, "write `hidden=true`, `hidden=false` or just `hidden`.");
7494
- const key2 = quoted(finding2.message, /^Option (\w+) needs a value/);
7495
- if (key2) return keep2(finding2, `write ${code(`${key2}=value`)}, for example ${code(key2 === "layout" ? "layout=title" : key2 === "id" ? "id=cover" : `${key2}=name`)}.`);
8045
+ const key3 = quoted(finding2.message, /^Option (\w+) needs a value/);
8046
+ if (key3) return keep2(finding2, `write ${code(`${key3}=value`)}, for example ${code(key3 === "layout" ? "layout=title" : key3 === "id" ? "id=cover" : `${key3}=name`)}.`);
7496
8047
  if (/^as takes/.test(finding2.message)) return keep2(finding2, "write `as=bullets` before a list or `as=video` before an image line.");
7497
8048
  return keep2(finding2, "put `as=bullets` before a list and `as=video` before an image line, or remove `as`.");
7498
8049
  },
7499
8050
  "markdown/options-syntax": (finding2) => keep2(finding2, `write options as ${code("key=value")} pairs, with text in double quotes: ${code('<!-- slide: layout=title section="Part 1" -->')}.`),
7500
8051
  "markdown/options-duplicate": (finding2) => {
7501
- const key2 = quoted(finding2.message, /^Option (\w+) is given twice/);
7502
- if (key2) return keep2(finding2, `keep one ${code(`${key2}=`)} in the comment.`);
8052
+ const key3 = quoted(finding2.message, /^Option (\w+) is given twice/);
8053
+ if (key3) return keep2(finding2, `keep one ${code(`${key3}=`)} in the comment.`);
7503
8054
  return keep2(finding2, "merge them into one.");
7504
8055
  },
7505
8056
  "markdown/options-orphan": (finding2) => keep2(finding2, "put the `<!-- block: \u2026 -->` comment directly before the block it describes, or remove it."),
@@ -7524,7 +8075,7 @@ var markdown = {
7524
8075
  "markdown/chart-attributes": (finding2) => keep2(finding2, 'write ```chart column alt="What the data shows" (`alt` is optional).'),
7525
8076
  "markdown/chart-data": wholeHelp,
7526
8077
  "markdown/chart-ragged": (finding2) => keep2(finding2, "give every row one value per column."),
7527
- "markdown/diagram-attributes": (finding2) => keep2(finding2, 'write ```mermaid alt="What the diagram shows" (`alt` is optional).'),
8078
+ "markdown/diagram-attributes": (finding2) => keep2(finding2, `write \`\`\`${/\b(dot|plantuml) fence/.exec(finding2.help ?? "")?.[1] ?? "mermaid"} alt="What the diagram shows" (\`alt\` is optional).`),
7528
8079
  "markdown/diagram-source": wholeHelp,
7529
8080
  "markdown/metric-block": (finding2) => keep2(finding2, `write ${code("key: value")} lines using ${METRIC_KEYS.join(", ")}; a value is plain text or a JSON string in double quotes.`),
7530
8081
  "markdown/timeline-attributes": (finding2) => keep2(finding2, 'write ```timeline name="Roadmap" description="\u2026" (both are optional).'),
@@ -7599,8 +8150,8 @@ var SOURCE_EXPLAIN = {
7599
8150
  "markdown/chart-attributes": entry("format", "error", "A chart fence has an attribute it cannot take.", "A chart fence takes `alt`, a text alternative in double quotes.", 'Write ```chart column alt="What the data shows".'),
7600
8151
  "markdown/chart-data": entry("format", "error", "A chart fence has no usable data.", "The chart is drawn from CSV with a header row, or a JSON object with `columns` and `rows`.", "Write CSV with a header row and at least one data row."),
7601
8152
  "markdown/chart-ragged": entry("format", "warning", "A chart row has a different number of values than the header.", "Missing cells plot as gaps.", "Give every row one value per column."),
7602
- "markdown/diagram-attributes": entry("format", "error", "A mermaid fence has an attribute it cannot take.", "A mermaid fence takes `alt`, a text alternative in double quotes.", 'Write ```mermaid alt="What the diagram shows".'),
7603
- "markdown/diagram-source": entry("format", "error", "A mermaid fence has no source.", "A diagram is drawn from its Mermaid source.", "Write the diagram between the fences, starting with its type (`flowchart LR`, `sequenceDiagram`, `mindmap`, ...)."),
8153
+ "markdown/diagram-attributes": entry("format", "error", "A diagram fence (mermaid, dot or plantuml) has an attribute it cannot take.", "A diagram fence takes `alt`, a text alternative in double quotes.", 'Write ```mermaid alt="What the diagram shows" (or ```dot alt=...).'),
8154
+ "markdown/diagram-source": entry("format", "error", "A diagram fence (mermaid, dot or plantuml) has no source.", "A diagram is drawn from its Mermaid, DOT or PlantUML source.", "Write the diagram between the fences: Mermaid starting with its type (`flowchart LR`, `sequenceDiagram`, `mindmap`, ...), DOT as one graph (`digraph { a -> b }`), PlantUML from `@startuml` to `@enduml`."),
7604
8155
  "markdown/metric-block": entry("format", "error", "A metric fence is malformed.", "A metric is `key: value` lines using a fixed set of keys.", "Write `value:` and, if you like, `label:`, `unit:`, `delta:`, `trend:` and `sentiment:`.", "```metric\nlabel: Revenue\n```", "```metric\nvalue: 42\nlabel: Revenue\n```"),
7605
8156
  "markdown/timeline-attributes": entry("format", "error", "A timeline fence has an attribute it cannot take.", "A timeline fence takes `name` and `description`.", "Remove the attribute, or use `name=` or `description=`."),
7606
8157
  "markdown/timeline-description": entry("format", "error", "An indented line has no event above it.", "A description belongs to the event before it.", "Put the event first, then its description indented below it."),
@@ -7627,6 +8178,7 @@ var ID = "an id of lowercase letters, digits and hyphens that starts with a lett
7627
8178
  var ID_NEXT = "use lowercase letters, digits and hyphens, and start with a letter.";
7628
8179
  var LANGUAGE = "a language tag like `en-US` or `de`";
7629
8180
  var PATTERN_PHRASES = Object.freeze({
8181
+ "\\S": { what: "a label with at least one non-whitespace character", next: "write a nonblank label, or omit it." },
7630
8182
  "^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$": { what: "a hex color like `#1F4E79` (3, 6 or 8 hex digits)", next: "write the color as #RRGGBB." },
7631
8183
  "^[a-z][a-z0-9-]*$": { what: ID, next: ID_NEXT },
7632
8184
  "^[a-z0-9][a-z0-9-]*$": { what: "an id of lowercase letters, digits and hyphens, like `my-chart`", next: ID_NEXT },
@@ -7635,9 +8187,12 @@ var PATTERN_PHRASES = Object.freeze({
7635
8187
  "^[a-zA-Z0-9_-]+$": { what: "an id of letters, digits, hyphens and underscores, like `hero_1`", next: "remove spaces and other punctuation." },
7636
8188
  "^var:[a-z][a-z0-9-]*$": { what: "a variable reference like `var:brand`", next: "write `var:` and the id of a variable under `variables`." },
7637
8189
  "^var:organization(\\.[A-Za-z0-9_-]+)?\\.logo(\\.(full|stacked|icon|wordmark))?$": { what: "an organization logo reference like `var:organization.logo.full`", next: "write `var:organization.logo` and, if you want, `.full`, `.stacked`, `.icon` or `.wordmark`." },
8190
+ "^\\s*-?[0-9.]+([ ,]+-?[0-9.]+){3}\\s*$": { what: "a viewBox of four numbers, `minX minY width height`, like `0 0 24 24`", next: "write four numbers separated by spaces." },
8191
+ "^[a-z][A-Za-z0-9]*$": { what: "an adjust value name like `adj` or `adj1` (a letter, then letters and digits)", next: "use the name of one of the preset's adjust values (docs/shapes.md lists them)." },
7638
8192
  "^\\d{4}-\\d{2}-\\d{2}$": { what: "a date written year-month-day, like `2026-10-24`", next: "write the date as YYYY-MM-DD." },
7639
8193
  "^(?:https?://|mailto:|tel:)\\S+$": { what: "a web, email or phone address (`https://\u2026`, `mailto:\u2026` or `tel:\u2026`)", next: "start with https://, mailto: or tel:, and leave out spaces." },
7640
8194
  "^(https?://|mailto:|tel:)\\S+$": { what: "a web, email or phone address (`https://\u2026`, `mailto:\u2026` or `tel:\u2026`)", next: "start with https://, mailto: or tel:, and leave out spaces." },
8195
+ "^(?:[a-z][a-z0-9-]*:[a-z0-9][a-z0-9-]*|[a-z][a-z0-9-]*|(?:asset:|https://|data:|\\./|\\.\\./)\\S+)$": { what: "an icon like `lucide:truck` (a set and a name), the name of one of the deck's `icons`, or an SVG source (`asset:`, `https://`, `data:`, `./`)", next: "write the set and the icon name, such as lucide:truck (search_icons finds names), or the name of one of the deck's icons." },
7641
8196
  "^(asset:|https://|data:|\\./|\\.\\./)": { what: "a source that starts with `asset:`, `https://`, `data:`, `./` or `../`", next: "register the file under `assets` and write `asset:` and its id, or give an https:// address." },
7642
8197
  "^(?:https://[^\\s]+|pkg:[^\\s]+)$": { what: "an `https://` address or a `pkg:` reference", next: "write an address that starts with https:// or pkg:, without spaces." },
7643
8198
  "^(?:[A-Za-z]{2,3}|[iIxX])(?:-[A-Za-z0-9]{1,8})*$": { what: LANGUAGE, next: "write a language and, if needed, a region: `en-US`, `pt-BR`, `de`." },
@@ -7775,6 +8330,9 @@ function describeSchema(finding2, context, helpers) {
7775
8330
  case "exclusiveMinimum":
7776
8331
  case "maximum":
7777
8332
  case "exclusiveMaximum": {
8333
+ const key3 = segments.at(-1);
8334
+ if (keyword === "maximum" && segments.at(-2) === "at" && (key3 === "width" || key3 === "height") && finding2.fixes?.some((fix) => fix.id === "rename"))
8335
+ return { message: `${cap(label)} is a fraction of the block, at most ${params2.limit}, but is ${describeValue(actual)}.`, next: `did you mean ${code(`${key3}Px`)}? Rename the key to keep the size in pixels.` };
7778
8336
  const bound = /minimum/i.test(keyword) ? "at least" : "at most";
7779
8337
  return {
7780
8338
  message: `${cap(label)} must be ${keyword.startsWith("exclusive") ? bound === "at least" ? "greater than" : "less than" : bound} ${params2.limit}, but is ${describeValue(actual)}.`,
@@ -7819,9 +8377,9 @@ function starterValue(document, segments, property) {
7819
8377
  // src/schema-fixes.ts
7820
8378
  var MAX_CHANGES = 5;
7821
8379
  var patch = (id, title, operations, safe2 = false) => ({ id, title, kind: "patch", safe: safe2, patch: operations });
7822
- var allowsKey = (document, segments, key2) => {
8380
+ var allowsKey = (document, segments, key3) => {
7823
8381
  try {
7824
- return schemaVariants(schemaAtPath(document, segments)).some((variant) => Object.hasOwn(variant.properties ?? {}, key2));
8382
+ return schemaVariants(schemaAtPath(document, segments)).some((variant) => Object.hasOwn(variant.properties ?? {}, key3));
7825
8383
  } catch {
7826
8384
  return false;
7827
8385
  }
@@ -7919,7 +8477,7 @@ function scriptProfile(presentation, slideIndex, options2, language) {
7919
8477
  }
7920
8478
  const slots = (role) => {
7921
8479
  const latin = options2.fontFamilies[role];
7922
- const slot = (key2) => !resolved || resolved.sources[key2] === "latin" || resolved.sources[key2] === "schemeFamily" ? latin : resolved[role][key2] ?? latin;
8480
+ const slot = (key3) => !resolved || resolved.sources[key3] === "latin" || resolved.sources[key3] === "schemeFamily" ? latin : resolved[role][key3] ?? latin;
7923
8481
  return { latin, eastAsian: slot("eastAsian"), complexScript: slot("complexScript") };
7924
8482
  };
7925
8483
  return {
@@ -7970,18 +8528,85 @@ function resolveSlideScriptMeasurement(presentation, slideIndex, measurement, op
7970
8528
  return slideScriptMeasurement(presentation, slideIndex, measurement, { ...options2.catalogs !== void 0 ? { catalogs: options2.catalogs } : {}, fontFamilies, serif: fontScheme.type === "serif" });
7971
8529
  }
7972
8530
 
7973
- // src/slide-context.ts
8531
+ // src/message-surface.ts
7974
8532
  var rec2 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
8533
+ var MESSAGE_SURFACE_SLOT = "accent1";
8534
+ var MESSAGE_SURFACE_CONTRAST = 4.5;
8535
+ function messageKind(slide, layout) {
8536
+ const lone = lonePayload(slide);
8537
+ if (lone?.field !== "text" || annotationText(slide.subtitle).trim()) return void 0;
8538
+ let plan;
8539
+ try {
8540
+ plan = isLayoutTemplate(layout) ? layoutTemplate(layout) : void 0;
8541
+ } catch {
8542
+ return void 0;
8543
+ }
8544
+ if (plan?.stack !== void 0 && statementMessage(slide, plan) !== void 0) return "statement-message";
8545
+ if (plan && (plan.regions.length > 1 || plan.regions.some((region) => region.role === "media" || region.flow === "grid"))) return void 0;
8546
+ const value = lone.host.text;
8547
+ const cited = Array.isArray(value) && value.some((run) => run && typeof run === "object" && (run.cite !== void 0 || run.footnote !== void 0));
8548
+ return !cited && messageWords(value) > 0 && messageWords(value) <= SHORT_MESSAGE_WORDS ? "display-message" : void 0;
8549
+ }
8550
+ function lchOf(hex) {
8551
+ const lin = (at2) => {
8552
+ const value = Number.parseInt(hex.slice(at2, at2 + 2), 16) / 255;
8553
+ return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
8554
+ };
8555
+ const [r, g, b] = [lin(1), lin(3), lin(5)];
8556
+ const x = (0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / 0.95047, y = 0.2126729 * r + 0.7151522 * g + 0.072175 * b, z = (0.0193339 * r + 0.119192 * g + 0.9503041 * b) / 1.08883;
8557
+ const f = (t) => t > 216 / 24389 ? Math.cbrt(t) : (24389 / 27 * t + 16) / 116;
8558
+ const [fx, fy, fz] = [f(x), f(y), f(z)];
8559
+ return { L: 116 * fy - 16, C: Math.hypot(500 * (fx - fy), 200 * (fy - fz)) };
8560
+ }
8561
+ var MESSAGE_SURFACE_MAX_LIGHTNESS = 60;
8562
+ var MESSAGE_SURFACE_MAX_CHROMA = 80;
8563
+ function resolveMessageSurface(presentation, slide, layout, context) {
8564
+ const deckDesign = rec2(rec2(presentation).design);
8565
+ const kind = messageKind(slide, layout), named = layoutVariantKind(layout);
8566
+ if (kind === void 0 || !(named === void 0 || named === "surface") || deckBackgroundIsChosen(deckDesign, context.theme.background) || !layoutVariantApplies(slide.design, layout, deckDesign, context.theme.background, true)) return void 0;
8567
+ const below = colorChoice([deckDesign, context.theme], context.colorScheme, context.variables);
8568
+ const variant = { background: MESSAGE_SURFACE_SLOT, ...below.variant?.accents ? { accents: below.variant.accents } : {} };
8569
+ const plain = resolveColorRoles(context.colorScheme, { background: below.background, variant: below.variant });
8570
+ const deliberate = [deckDesign, ...context.themeChosen ? [context.theme] : []].some((level) => level.background !== void 0 || level.variant !== void 0);
8571
+ if (plain.dark && deliberate) return void 0;
8572
+ const accent = resolveColorRoles(context.colorScheme, { variant }), shade = lchOf(accent.background.slice(0, 7).toUpperCase());
8573
+ if (accent.background.toUpperCase() === plain.background.toUpperCase() || (colorContrast(accent.text, accent.background) ?? 0) < MESSAGE_SURFACE_CONTRAST || shade.L > MESSAGE_SURFACE_MAX_LIGHTNESS || shade.C > MESSAGE_SURFACE_MAX_CHROMA) return void 0;
8574
+ return { kind, variant };
8575
+ }
8576
+ function drawsAccentByDesign(presentation, host, record, theme) {
8577
+ const deckDesign = rec2(rec2(presentation).design), own4 = normalizeColorVariant(rec2(host.design).variant), named = layoutColorVariant(record);
8578
+ if (own4) return own4.background.startsWith("accent");
8579
+ return named !== void 0 && layoutVariantApplies(host.design, record, deckDesign, theme.background) && named.background.startsWith("accent");
8580
+ }
8581
+ function messageDisplayed(result, kind) {
8582
+ const scale = Math.min(result.width, result.height) / 720, size = (field) => result.items.find((item) => item.field === field)?.text?.fontSize;
8583
+ const text2 = size("text"), title = size("title");
8584
+ if (kind === "statement-message") return text2 !== void 0 && text2 / scale >= LONE_DISPLAY_SIZES.text - 1e-6 || title !== void 0 && title / scale > 54 + 1e-6;
8585
+ return text2 !== void 0 && text2 / scale > LONE_DISPLAY_SIZES.text + 1e-6;
8586
+ }
8587
+
8588
+ // src/slide-context.ts
8589
+ var rec3 = (value) => value && typeof value === "object" && !Array.isArray(value) ? value : {};
8590
+ function unpathed(measurement) {
8591
+ const bare = (style) => ({ ...style, path: void 0 });
8592
+ return {
8593
+ ...measurement,
8594
+ measure: (text2, size, style) => measurement.measure(text2, size, bare(style)),
8595
+ ...measurement.resolveStyle ? { resolveStyle: (style) => measurement.resolveStyle(bare(style)) } : {},
8596
+ ...measurement.outlineBounds ? { outlineBounds: (text2, size, style) => measurement.outlineBounds(text2, size, bare(style)) } : {},
8597
+ ...measurement.forScripts ? { forScripts: (profile) => unpathed(measurement.forScripts(profile)) } : {}
8598
+ };
8599
+ }
7975
8600
  function resolveSlideContext(presentation, index, options2 = {}) {
7976
- const deck = rec2(presentation);
8601
+ const deck = rec3(presentation);
7977
8602
  const slides = Array.isArray(deck.slides) ? deck.slides : [];
7978
8603
  if (!Number.isInteger(index) || index < 0 || index >= slides.length) throw new RangeError(`Slide index ${String(index)} is outside the presentation's ${slides.length} slides.`);
7979
- const slide = rec2(slides[index]);
8604
+ const slide = rec3(slides[index]);
7980
8605
  const catalogs = { catalogs: checkCatalogsOption(options2.catalogs, "resolveSlideContext") };
7981
8606
  const records = resolveDesignRecords(presentation, index, catalogs);
7982
8607
  const diagnostics = [...records.diagnostics];
7983
8608
  const { theme, colorScheme, fontScheme } = records;
7984
- const design = { ...rec2(deck.design), ...rec2(slide.design) };
8609
+ const design = { ...rec3(deck.design), ...rec3(slide.design) };
7985
8610
  let layout;
7986
8611
  let layoutProvenance;
7987
8612
  if (typeof slide.layout === "string" && slide.layout !== "auto") {
@@ -7992,28 +8617,55 @@ function resolveSlideContext(presentation, index, options2 = {}) {
7992
8617
  } else diagnostics.push(unresolvedReference(presentation, "layouts", slide.layout, `slides.${index}.layout`, catalogs));
7993
8618
  }
7994
8619
  if (options2.strictReferences && diagnostics.length) throw new OPFUnresolvedReferenceError(diagnostics);
7995
- const levels = colorLevels(rec2(slide.design), layout, rec2(deck.design), theme, colorScheme, rec2(deck.variables));
7996
- const roles = resolveColorRoles(colorScheme, colorChoice(levels, colorScheme, rec2(deck.variables)));
7997
- const layoutVariant = levels.length > 3 && layoutVariantApplies(slide.design, layout, deck.design, theme.background) ? levels[1].variant : void 0;
7998
- const composeOptions = {
7999
- ...resolveCanvasDimensions(design.dimensions ?? theme.dimensions),
8000
- ...layout ? { layout } : {},
8001
- presentation,
8002
- slideIndex: index,
8003
- slideNumber: options2.slideNumber ?? index + 1,
8004
- slideCount: options2.slideCount ?? slides.length,
8005
- fontFamilies: resolveFontFamilies(fontScheme),
8006
- darkBackground: roles.dark,
8007
- // LH-02: the colors the automatic scrim of a picture background is sized for.
8008
- roles: { text: roles.text, textSecondary: roles.textSecondary, primary: roles.primary, background: roles.background },
8009
- ...theme.background !== void 0 ? { themeBackground: theme.background } : {},
8010
- // OPF 0.19: a theme may carry the shared design keys (between the deck's design and the layout record's).
8011
- ...theme.design !== void 0 && rec2(theme.design) === theme.design ? { themeDesign: theme.design } : {},
8012
- ...options2.fonts?.textMeasurement ? { textMeasurement: options2.fonts.textMeasurement } : {},
8013
- ...options2.date !== void 0 ? { date: options2.date } : {}
8014
- };
8015
- const resolvedSlide = resolveSlideVariables(slide, { slideNumber: composeOptions.slideNumber, slideCount: composeOptions.slideCount, presentation, darkBackground: composeOptions.darkBackground === true });
8016
- return { slide: resolvedSlide, options: composeOptions, diagnostics, resolved: { theme, colorScheme, roles, fontScheme, fontSchemePath: records.fontSchemePath, ...layout ? { layout } : {}, ...layoutVariant ? { layoutVariant } : {}, provenance: { ...layoutProvenance ? { layout: layoutProvenance } : {}, ...records.provenance } } };
8620
+ const candidate = resolveMessageSurface(presentation, slide, layout, { theme, colorScheme, variables: rec3(deck.variables), themeChosen: records.provenance.theme !== void 0 });
8621
+ const build = (surface) => {
8622
+ const levels = colorLevels(rec3(slide.design), layout, rec3(deck.design), theme, colorScheme, rec3(deck.variables), surface?.variant);
8623
+ const roles2 = resolveColorRoles(colorScheme, colorChoice(levels, colorScheme, rec3(deck.variables)));
8624
+ const layoutVariant2 = levels.length > 3 && layoutVariantApplies(slide.design, layout, deck.design, theme.background, surface) ? levels[1].variant : void 0;
8625
+ const composeOptions2 = {
8626
+ ...resolveCanvasDimensions(design.dimensions ?? theme.dimensions),
8627
+ ...layout ? { layout } : {},
8628
+ presentation,
8629
+ slideIndex: index,
8630
+ slideNumber: options2.slideNumber ?? index + 1,
8631
+ slideCount: options2.slideCount ?? slides.length,
8632
+ fontFamilies: resolveFontFamilies(fontScheme),
8633
+ darkBackground: roles2.dark,
8634
+ ...surface ? { messageSurface: surface, resolveRunColor: (reference) => resolveColorRef(reference, { colorScheme, roles: roles2, variables: rec3(deck.variables), fallback: "" }) || void 0 } : {},
8635
+ // LH-02: the colors the automatic scrim of a picture background is sized for.
8636
+ roles: { text: roles2.text, textSecondary: roles2.textSecondary, primary: roles2.primary, background: roles2.background },
8637
+ ...theme.background !== void 0 ? { themeBackground: theme.background } : {},
8638
+ // OPF 0.19: a theme may carry the shared design keys (between the deck's design and the layout record's).
8639
+ ...theme.design !== void 0 && rec3(theme.design) === theme.design ? { themeDesign: theme.design } : {},
8640
+ ...options2.fonts?.textMeasurement ? { textMeasurement: options2.fonts.textMeasurement } : {},
8641
+ ...options2.date !== void 0 ? { date: options2.date } : {}
8642
+ };
8643
+ return { levels, roles: roles2, layoutVariant: layoutVariant2, composeOptions: composeOptions2 };
8644
+ };
8645
+ const variablesOf = (made) => resolveSlideVariables(slide, { slideNumber: made.composeOptions.slideNumber, slideCount: made.composeOptions.slideCount, presentation, darkBackground: made.composeOptions.darkBackground === true });
8646
+ let messageSurface = candidate, built = build(candidate);
8647
+ if (candidate) {
8648
+ const plain = build(void 0);
8649
+ const host = plain.composeOptions.textMeasurement;
8650
+ const measurement = host ? unpathed(slideScriptMeasurement(presentation, index, host, { ...catalogs, fontFamilies: resolveFontFamilies(fontScheme), serif: fontScheme.type === "serif" })) : host;
8651
+ let displayed = false;
8652
+ try {
8653
+ displayed = messageDisplayed(composeSlide(variablesOf(plain), { ...plain.composeOptions, ...measurement ? { textMeasurement: measurement } : {} }), candidate.kind);
8654
+ } catch {
8655
+ displayed = false;
8656
+ }
8657
+ if (displayed && index > 0) {
8658
+ const before = rec3(slides[index - 1]), record = typeof before.layout === "string" && before.layout !== "auto" ? resolveReference(presentation, "layouts", before.layout, catalogs)?.record : void 0;
8659
+ if (drawsAccentByDesign(presentation, before, record, theme) || resolveSlideContext(presentation, index - 1, { ...options2, slideNumber: void 0 }).resolved.messageSurface !== void 0) displayed = false;
8660
+ }
8661
+ if (!displayed) {
8662
+ messageSurface = void 0;
8663
+ built = plain;
8664
+ }
8665
+ }
8666
+ const { roles, layoutVariant, composeOptions } = built;
8667
+ const resolvedSlide = variablesOf(built);
8668
+ return { slide: resolvedSlide, options: composeOptions, diagnostics, resolved: { theme, colorScheme, roles, fontScheme, fontSchemePath: records.fontSchemePath, ...layout ? { layout } : {}, ...layoutVariant ? { layoutVariant } : {}, ...messageSurface ? { messageSurface } : {}, provenance: { ...layoutProvenance ? { layout: layoutProvenance } : {}, ...records.provenance } } };
8017
8669
  }
8018
8670
 
8019
8671
  // src/rule-slides.ts
@@ -8045,7 +8697,7 @@ function relax(value) {
8045
8697
  walk2(copy);
8046
8698
  return copy;
8047
8699
  }
8048
- function buildSlides(document, options2) {
8700
+ function buildSlides(document, options2, memo) {
8049
8701
  const slides = Array.isArray(document.slides) ? document.slides : [];
8050
8702
  return slides.map((slide, index) => {
8051
8703
  const path = pointer2("slides", index);
@@ -8063,7 +8715,7 @@ function buildSlides(document, options2) {
8063
8715
  });
8064
8716
  const design = lazy(() => resolveDesign(document, index, resolved()));
8065
8717
  const layout = lazy(() => resolved().options.layout);
8066
- const composed = lazy(() => {
8718
+ const compute = () => {
8067
8719
  const result = { layoutDiagnostics: [] };
8068
8720
  let fontFamilies;
8069
8721
  const compose = (input, withLayout) => {
@@ -8086,7 +8738,8 @@ function buildSlides(document, options2) {
8086
8738
  } else result.layoutError = error instanceof Error ? error.message : String(error);
8087
8739
  }
8088
8740
  return result;
8089
- });
8741
+ };
8742
+ const composed = lazy(() => memo ? memo(index, compute) : compute());
8090
8743
  const payloads = lazy(() => slidePayloads(slide, path));
8091
8744
  const texts = lazy(() => textValues(slide, path));
8092
8745
  const rtl = lazy(() => {
@@ -8111,6 +8764,214 @@ function buildSlides(document, options2) {
8111
8764
  });
8112
8765
  }
8113
8766
 
8767
+ // src/validation-cache.ts
8768
+ var MAX_ENTRIES = 64;
8769
+ var MAX_BYTES = 8 * 1024 * 1024;
8770
+ var MAX_KEY_BYTES = 2 * 1024 * 1024;
8771
+ function key2(value, opaque) {
8772
+ let bytes = 0;
8773
+ const seen = /* @__PURE__ */ new Set();
8774
+ const part = (text2) => {
8775
+ bytes += text2.length * 2;
8776
+ if (bytes > MAX_KEY_BYTES) throw new RangeError("Review cache key budget exceeded.");
8777
+ return text2;
8778
+ };
8779
+ const walk2 = (node, depth2) => {
8780
+ if (depth2 > 128) throw new RangeError("Review cache key depth exceeded.");
8781
+ if (node === null) return part("null;");
8782
+ if (node === void 0) return part("undefined;");
8783
+ if (typeof node === "string") return part(`s${JSON.stringify(node)}`);
8784
+ if (typeof node === "boolean") return part(node ? "true;" : "false;");
8785
+ if (typeof node === "number" && Number.isFinite(node)) return part(`n${Object.is(node, -0) ? "-0" : node};`);
8786
+ if (typeof node === "function" && opaque) {
8787
+ opaque.push(node);
8788
+ return part(`f${opaque.length};`);
8789
+ }
8790
+ if (typeof node !== "object" || seen.has(node) || !Array.isArray(node) && ![Object.prototype, null].includes(Object.getPrototypeOf(node))) throw new TypeError("Opaque review cache input.");
8791
+ seen.add(node);
8792
+ const descriptors = Object.getOwnPropertyDescriptors(node);
8793
+ if (Array.isArray(node) ? Reflect.ownKeys(node).length !== node.length + 1 || Object.keys(node).some((name, i) => name !== String(i)) : Object.values(descriptors).some((descriptor) => !descriptor.enumerable)) throw new TypeError("Non-JSON review cache input.");
8794
+ if (Reflect.ownKeys(node).some((name) => typeof name === "symbol") || Object.values(descriptors).some((descriptor) => !("value" in descriptor))) throw new TypeError("Opaque review cache input.");
8795
+ const result = Array.isArray(node) ? part("a[") + Array.from({ length: node.length }, (_, i) => Object.hasOwn(node, i) ? walk2(node[i], depth2 + 1) : part("hole;")).join("") + part("]") : part("o{") + Object.keys(node).map((name) => part(JSON.stringify(name)) + walk2(node[name], depth2 + 1)).join("") + part("}");
8796
+ seen.delete(node);
8797
+ return result;
8798
+ };
8799
+ return walk2(value, 0);
8800
+ }
8801
+ var hasCallable = (value) => typeof value === "function" || !!value && typeof value === "object" && Object.values(value).some(hasCallable);
8802
+ function boundedDependencyInput(value) {
8803
+ let bytes = 0;
8804
+ const seen = /* @__PURE__ */ new Set();
8805
+ const charge = (count) => {
8806
+ bytes += count;
8807
+ if (bytes > MAX_KEY_BYTES) throw new RangeError("Dependency input budget exceeded.");
8808
+ };
8809
+ const walk2 = (node, depth2) => {
8810
+ if (depth2 > 128) throw new RangeError("Dependency input depth exceeded.");
8811
+ if (typeof node === "string") {
8812
+ charge(node.length * 2 + 8);
8813
+ return;
8814
+ }
8815
+ if (node === null || node === void 0 || typeof node === "boolean" || typeof node === "number" && Number.isFinite(node)) {
8816
+ charge(16);
8817
+ return;
8818
+ }
8819
+ if (typeof node !== "object" || seen.has(node)) throw new TypeError("Opaque dependency input.");
8820
+ const array = Array.isArray(node);
8821
+ if (array ? Object.getPrototypeOf(node) !== Array.prototype : ![Object.prototype, null].includes(Object.getPrototypeOf(node))) throw new TypeError("Opaque dependency prototype.");
8822
+ seen.add(node);
8823
+ charge(16);
8824
+ const length = array ? Object.getOwnPropertyDescriptor(node, "length")?.value : 0;
8825
+ if (array && (!Number.isSafeInteger(length) || length < 0 || length * 8 > MAX_KEY_BYTES - bytes)) throw new RangeError("Dependency input count exceeded.");
8826
+ const names2 = Reflect.ownKeys(node);
8827
+ if (names2.length * 8 > MAX_KEY_BYTES - bytes || array && names2.length !== length + 1) throw new RangeError("Dependency input count exceeded.");
8828
+ let index = 0;
8829
+ for (const name of names2) {
8830
+ if (typeof name !== "string") throw new TypeError("Opaque dependency key.");
8831
+ const descriptor = Object.getOwnPropertyDescriptor(node, name);
8832
+ if (!descriptor || !("value" in descriptor)) throw new TypeError("Accessor dependency input.");
8833
+ if (array && name === "length") continue;
8834
+ if (!descriptor.enumerable || array && name !== String(index++)) throw new TypeError("Non-JSON dependency input.");
8835
+ charge(name.length * 2 + 8);
8836
+ walk2(descriptor.value, depth2 + 1);
8837
+ }
8838
+ seen.delete(node);
8839
+ };
8840
+ try {
8841
+ walk2(value, 0);
8842
+ return true;
8843
+ } catch {
8844
+ return false;
8845
+ }
8846
+ }
8847
+ function upstreamKey(slide, raw, conservative) {
8848
+ try {
8849
+ if (conservative || lonePayload(slide)?.field === "text") return raw;
8850
+ const notes = [];
8851
+ walkCitationRuns(slide, "", (entry2) => {
8852
+ notes.push([entry2.path, entry2.cite, entry2.footnote]);
8853
+ });
8854
+ return key2(["non-message-upstream", slide.section, slide.design, slide.layout, notes]);
8855
+ } catch {
8856
+ return raw;
8857
+ }
8858
+ }
8859
+ function snapshotValue(value) {
8860
+ try {
8861
+ let candidate = value;
8862
+ const rootDescriptors = Object.getOwnPropertyDescriptors(value);
8863
+ const composition = rootDescriptors.composition;
8864
+ if (composition && "value" in composition && composition.value && Object.hasOwn(composition.value, HALF_STEPPED)) {
8865
+ const marker = Object.getOwnPropertyDescriptor(composition.value, HALF_STEPPED);
8866
+ const paths = marker && "value" in marker ? marker.value : void 0;
8867
+ if (marker?.enumerable && paths && typeof paths === "object" && Object.getPrototypeOf(paths) === Set.prototype && Reflect.ownKeys(paths).length === 0 && Array.from(Set.prototype.values.call(paths)).every((path) => typeof path === "string")) {
8868
+ const descriptors = Object.getOwnPropertyDescriptors(composition.value);
8869
+ Reflect.deleteProperty(descriptors, HALF_STEPPED);
8870
+ rootDescriptors.composition = { ...composition, value: Object.create(Object.getPrototypeOf(composition.value), descriptors) };
8871
+ candidate = Object.create(Object.getPrototypeOf(value), rootDescriptors);
8872
+ }
8873
+ }
8874
+ const encoded = key2(candidate);
8875
+ return { value: structuredClone(candidate), bytes: encoded.length * 4 + 256 };
8876
+ } catch {
8877
+ return void 0;
8878
+ }
8879
+ }
8880
+ var ValidationCompositionCache = class {
8881
+ snapshot;
8882
+ entries = /* @__PURE__ */ new Map();
8883
+ valueBytes = 0;
8884
+ get info() {
8885
+ return { entries: this.entries.size, bytes: (this.snapshot?.bytes ?? 0) + this.valueBytes, maxEntries: MAX_ENTRIES, maxBytes: MAX_BYTES };
8886
+ }
8887
+ clear() {
8888
+ this.snapshot = void 0;
8889
+ this.entries.clear();
8890
+ this.valueBytes = 0;
8891
+ }
8892
+ drop(index) {
8893
+ const entry2 = this.entries.get(index);
8894
+ if (entry2) this.valueBytes -= entry2.bytes;
8895
+ this.entries.delete(index);
8896
+ }
8897
+ trim() {
8898
+ while (this.entries.size > MAX_ENTRIES || this.info.bytes > MAX_BYTES) {
8899
+ const oldest = this.entries.keys().next().value;
8900
+ if (oldest === void 0) break;
8901
+ this.drop(oldest);
8902
+ }
8903
+ }
8904
+ begin(document, options2) {
8905
+ let next;
8906
+ try {
8907
+ if (![Object.prototype, null].includes(Object.getPrototypeOf(document)) || Reflect.ownKeys(document).length !== Object.keys(document).length || Object.values(Object.getOwnPropertyDescriptors(document)).some((descriptor) => !("value" in descriptor))) throw new TypeError("Non-JSON review document.");
8908
+ const { slides, datasets, ...metadata } = document;
8909
+ const opaque = [];
8910
+ const ids = slides.map((slide) => slide.id);
8911
+ const rawContext = key2([metadata, ids, options2], opaque);
8912
+ const raw = slides.map((slide) => key2(slide));
8913
+ const inlined = datasets ? inlineDatasets({ datasets, slides }).slides : slides;
8914
+ const data = datasets ? inlined.map((slide) => key2(slide)) : raw;
8915
+ const otherOptions = Object.fromEntries(Object.entries(options2).filter(([name]) => name !== "fonts"));
8916
+ const conservative = metadata.variables !== void 0 || metadata.template === true || options2.values !== void 0 || options2.template !== void 0 || hasCallable(metadata) || hasCallable(otherOptions);
8917
+ const upstream = slides.map((slide, i) => upstreamKey(slide, raw[i], conservative));
8918
+ const bytes = 256 + rawContext.length * 2 + raw.reduce((sum, text2) => sum + text2.length * 2 + 32, 0) + (data === raw ? 0 : data.reduce((sum, text2) => sum + text2.length * 2 + 16, 0)) + upstream.reduce((sum, text2, i) => sum + (text2 === raw[i] ? 16 : text2.length * 2 + 16), 0) + opaque.length * 16;
8919
+ if (bytes > MAX_KEY_BYTES) throw new RangeError("Review cache shared key budget exceeded.");
8920
+ let context = rawContext;
8921
+ if (!conservative && metadata.template === void 0) {
8922
+ let nameUnused = false;
8923
+ try {
8924
+ if (boundedDependencyInput(document)) {
8925
+ key2(document);
8926
+ nameUnused = !hasBuiltinDependency(document, "deck.name");
8927
+ }
8928
+ } catch {
8929
+ }
8930
+ if (nameUnused) {
8931
+ const { name: _name, ...geometryMetadata } = metadata;
8932
+ context = key2([geometryMetadata, ids, options2], []);
8933
+ }
8934
+ }
8935
+ const previous = this.snapshot;
8936
+ const same = previous?.context === context && previous.opaque.length === opaque.length && opaque.every((value, i) => value === previous.opaque[i]);
8937
+ if (!same) this.clear();
8938
+ let prefixEqual = !!same;
8939
+ const prefix = upstream.map((text2, i) => {
8940
+ prefixEqual = prefixEqual && text2 === previous?.upstream[i];
8941
+ return prefixEqual && previous?.prefix[i] || /* @__PURE__ */ Symbol();
8942
+ });
8943
+ next = { context, opaque, raw, data, upstream, prefix, bytes };
8944
+ } catch {
8945
+ this.clear();
8946
+ return void 0;
8947
+ }
8948
+ this.snapshot = next;
8949
+ for (const [i, entry2] of this.entries) if (entry2.prefix !== next.prefix[i] || entry2.data !== next.data[i]) this.drop(i);
8950
+ this.trim();
8951
+ return (index, compute) => {
8952
+ if (this.snapshot !== next) return compute();
8953
+ const hit = this.entries.get(index);
8954
+ if (hit) {
8955
+ this.entries.delete(index);
8956
+ this.entries.set(index, hit);
8957
+ return structuredClone(hit.value);
8958
+ }
8959
+ const value = compute();
8960
+ const saved = !value.layoutError && !value.layoutDiagnostics.some((entry2) => entry2.strict) && snapshotValue(value);
8961
+ const data = next.data[index], prefix = next.prefix[index];
8962
+ if (saved && data !== void 0 && prefix !== void 0 && this.snapshot === next) {
8963
+ const bytes = saved.bytes + data.length * 2 + 64;
8964
+ if (bytes + next.bytes <= MAX_BYTES) {
8965
+ this.entries.set(index, { prefix, data, value: saved.value, bytes });
8966
+ this.valueBytes += bytes;
8967
+ this.trim();
8968
+ }
8969
+ }
8970
+ return value;
8971
+ };
8972
+ }
8973
+ };
8974
+
8114
8975
  // src/validator.ts
8115
8976
  var SEVERITIES = ["error", "warning", "info"];
8116
8977
  var OPTION_KEYS = ["only", "ignore", "severity", "ignorePaths", "catalogs", "contracts", "thresholds", "fonts", "chartPalette", "template", "values"];
@@ -8148,7 +9009,7 @@ function names(list, what) {
8148
9009
  }
8149
9010
  function resolveOptions(options2) {
8150
9011
  if (!isObject2(options2)) throw new TypeError("Validate options must be an object.");
8151
- for (const key2 of Object.keys(options2)) if (!OPTION_KEYS.includes(key2)) throw new TypeError(`Unknown validate option ${JSON.stringify(key2)}. Options: ${OPTION_KEYS.join(", ")}.`);
9012
+ for (const key3 of Object.keys(options2)) if (!OPTION_KEYS.includes(key3)) throw new TypeError(`Unknown validate option ${JSON.stringify(key3)}. Options: ${OPTION_KEYS.join(", ")}.`);
8152
9013
  checkDocumentOptions(options2);
8153
9014
  const only = names(options2.only, "only");
8154
9015
  const ignore = names(options2.ignore, "ignore");
@@ -8177,10 +9038,10 @@ function resolveOptions(options2) {
8177
9038
  const thresholds = { ...DEFAULT_VALIDATION_THRESHOLDS };
8178
9039
  if (options2.thresholds !== void 0) {
8179
9040
  if (!isObject2(options2.thresholds)) throw new TypeError("Validate thresholds must be an object.");
8180
- for (const [key2, value] of Object.entries(options2.thresholds)) {
8181
- if (!(key2 in DEFAULT_VALIDATION_THRESHOLDS)) throw new TypeError(`Unknown validate threshold ${JSON.stringify(key2)}. Thresholds: ${Object.keys(DEFAULT_VALIDATION_THRESHOLDS).join(", ")}.`);
8182
- if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) throw new TypeError(`Validate threshold ${key2} must be a positive number.`);
8183
- thresholds[key2] = value;
9041
+ for (const [key3, value] of Object.entries(options2.thresholds)) {
9042
+ if (!(key3 in DEFAULT_VALIDATION_THRESHOLDS)) throw new TypeError(`Unknown validate threshold ${JSON.stringify(key3)}. Thresholds: ${Object.keys(DEFAULT_VALIDATION_THRESHOLDS).join(", ")}.`);
9043
+ if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) throw new TypeError(`Validate threshold ${key3} must be a positive number.`);
9044
+ thresholds[key3] = value;
8184
9045
  }
8185
9046
  }
8186
9047
  if (options2.fonts !== void 0) {
@@ -8245,7 +9106,7 @@ function syntaxReport(parsed, run) {
8245
9106
  const tally = counts(findings);
8246
9107
  return { valid: tally.error === 0, schemaValid: null, findings, counts: tally, checks };
8247
9108
  }
8248
- function validateDocument(document, run, parsed) {
9109
+ function validateDocument(document, run, parsed, cache) {
8249
9110
  const engine = validateAgainstSchema(document, "presentation", { template: run.options.template, values: run.options.values, ...run.options.catalogs ? { catalogs: run.options.catalogs } : {} });
8250
9111
  const schemaValid = engine.errors.length === 0;
8251
9112
  const slides = isObject2(document) && Array.isArray(document.slides) ? document.slides : [];
@@ -8274,7 +9135,7 @@ function validateDocument(document, run, parsed) {
8274
9135
  const doc = document;
8275
9136
  const context = {
8276
9137
  document: doc,
8277
- slides: buildSlides(doc, run.options),
9138
+ slides: buildSlides(doc, run.options, cache?.begin(doc, run.options)),
8278
9139
  thresholds: run.thresholds,
8279
9140
  options: run.options,
8280
9141
  chartPalette: run.chartPalette,
@@ -8353,12 +9214,34 @@ function validateDocument(document, run, parsed) {
8353
9214
  };
8354
9215
  }
8355
9216
  function validate(input, options2 = {}) {
9217
+ return validateInput(input, options2);
9218
+ }
9219
+ function validateInput(input, options2, cache) {
8356
9220
  const run = resolveOptions(options2);
8357
9221
  if (typeof input === "string") {
8358
9222
  const parsed = parseSource(input);
8359
- return parsed.syntax.length ? syntaxReport(parsed, run) : validateDocument(parsed.value, run, parsed);
9223
+ return parsed.syntax.length ? syntaxReport(parsed, run) : validateDocument(parsed.value, run, parsed, cache);
8360
9224
  }
8361
- return validateDocument(input, run);
9225
+ return validateDocument(input, run, void 0, cache);
9226
+ }
9227
+ function createValidator() {
9228
+ const cache = new ValidationCompositionCache();
9229
+ return {
9230
+ validate(input, options2 = {}) {
9231
+ try {
9232
+ const report2 = validateInput(input, options2, cache);
9233
+ if (!report2.schemaValid) cache.clear();
9234
+ return report2;
9235
+ } catch (error) {
9236
+ cache.clear();
9237
+ throw error;
9238
+ }
9239
+ },
9240
+ clear: () => cache.clear(),
9241
+ get cache() {
9242
+ return cache.info;
9243
+ }
9244
+ };
8362
9245
  }
8363
9246
  function assertValid(value, options2 = {}) {
8364
9247
  if (typeof value === "string") throw new TypeError("assertValid takes a parsed presentation. Use validate(text) for JSON text.");
@@ -8388,4 +9271,4 @@ function assertValidCatalogRecord(kind, value) {
8388
9271
  if (!report2.valid) throw new OPFValidationError(report2);
8389
9272
  }
8390
9273
 
8391
- export { BLOCK_AS_VALUES, BLOCK_OPTION_KEYS, CATALOG_SCHEMA, COMMON_KEYS, DEFAULT_VALIDATION_THRESHOLDS, FENCE_ATTRIBUTES, FENCE_KINDS, LINE_KEYWORDS, METRIC_KEYS, OPFPatchError, OPFPatchHashError, OPFPatchValidationError, OPFValidationError, PATTERN_PHRASES, SLIDE_OPTION_KEYS, SOURCE_EXPLAIN, SPAN_FLAGS, SPAN_VALUES, UNRANKED_PRIORITY, activeSchema, analyzeJsonSyntax, applyPatch, applyPatchWithInverse, applyTextEdits, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogKindAt, catalogSchemaNames, createLocator, createSchemaValue, describeField, describeFinding, distance2 as distance, documentHash, escapePointerToken, findValidationRule, formatPointer, getAtPointer, hasPointer, idToken, invertPatch, isIdToken, isPromotedRegionKey, jsonEqual, listSchemaFields, nearest, normalizePatch, parsePointer, parseSource, pointerFromPath, readPointer, rememberByText, resolveDrawnFontFamilies, resolveIdPatch, resolveIdPointer, resolveSchema, resolveSlideContext, resolveSlideScriptMeasurement, ruleDocumentation, schemaAtPath, schemaCatalogKinds, schemaLabel, schemaType, schemaVariants, segmentsOf, splitOpfPath, splitPointer2 as splitPointer, starterValue, toIdPatch, toIdPointer, unescapePointerToken, us, validate, validateCatalogRecord, validationCategories, validationRules, walkPatch };
9274
+ export { BLOCK_AS_VALUES, BLOCK_OPTION_KEYS, CATALOG_SCHEMA, COMMON_KEYS, DEFAULT_VALIDATION_THRESHOLDS, FENCE_ATTRIBUTES, FENCE_KINDS, LINE_KEYWORDS, METRIC_KEYS, OPFPatchError, OPFPatchHashError, OPFPatchValidationError, OPFValidationError, PATTERN_PHRASES, SLIDE_OPTION_KEYS, SOURCE_EXPLAIN, SPAN_FLAGS, SPAN_VALUES, UNRANKED_PRIORITY, activeSchema, analyzeJsonSyntax, applyPatch, applyPatchWithInverse, applyTextEdits, assertValid, assertValidCatalogRecord, catalogDisplayKinds, catalogIconKinds, catalogKindAt, catalogSchemaNames, createLocator, createSchemaValue, createValidator, describeField, describeFinding, distance2 as distance, documentHash, escapePointerToken, findValidationRule, formatPointer, getAtPointer, hasPointer, idToken, invertPatch, isIdToken, isPromotedRegionKey, jsonEqual, listSchemaFields, nearest, normalizePatch, parsePointer, parseSource, pointerFromPath, readPointer, rememberByText, resolveDrawnFontFamilies, resolveIdPatch, resolveIdPointer, resolveSchema, resolveSlideContext, resolveSlideScriptMeasurement, ruleDocumentation, schemaAtPath, schemaCatalogKinds, schemaLabel, schemaType, schemaVariants, segmentsOf, splitOpfPath, splitPointer2 as splitPointer, starterValue, toIdPatch, toIdPointer, unescapePointerToken, us, validate, validateCatalogRecord, validationCategories, validationRules, walkPatch };