@openpresentation/opf 0.13.0 → 0.14.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 (417) hide show
  1. package/README.md +28 -23
  2. package/dist/{catalogs-ywCamd8C.d.ts → catalogs-D-yyQWCQ.d.ts} +86 -208
  3. package/dist/catalogs.d.ts +2 -2
  4. package/dist/catalogs.js +1 -1
  5. package/dist/{chart-data-Cdr6rRVV.d.ts → chart-data-B_3z9VTb.d.ts} +16 -5
  6. package/dist/chunk-4LDGKLUC.js +192 -0
  7. package/dist/{chunk-II5EYKZU.js → chunk-4VJDTF55.js} +2 -92
  8. package/dist/chunk-5ZU6JAPP.js +83 -0
  9. package/dist/{chunk-MPM7NRG7.js → chunk-6OXY2CP3.js} +1716 -744
  10. package/dist/{chunk-IS2CPNVJ.js → chunk-BFLVSVA7.js} +26 -26
  11. package/dist/chunk-CSQHPVGL.js +94 -0
  12. package/dist/{chunk-GJKJL4YY.js → chunk-D3TY4TT6.js} +34 -412
  13. package/dist/chunk-JDJBDYSR.js +4167 -0
  14. package/dist/{chunk-7QBCWNWL.js → chunk-LS2FMPI5.js} +1086 -1092
  15. package/dist/{chunk-ATGDDJPX.js → chunk-Q2TCMN56.js} +3 -3
  16. package/dist/chunk-UPQQD7MA.js +1840 -0
  17. package/dist/{chunk-RAYB46AB.js → chunk-XIZUK2XM.js} +32 -30
  18. package/dist/{chunk-E34DJ5LL.js → chunk-XOZ4KMSR.js} +2427 -10820
  19. package/dist/chunk-Z65B2B77.js +601 -0
  20. package/dist/{composition-D7we69Tr.d.ts → composition-_WEwBe2a.d.ts} +738 -27
  21. package/dist/composition.d.ts +2 -2
  22. package/dist/composition.js +2 -2
  23. package/dist/convert.d.ts +9 -7
  24. package/dist/convert.js +33 -19
  25. package/dist/data.d.ts +4 -4
  26. package/dist/data.js +3 -3
  27. package/dist/diff.d.ts +4 -4
  28. package/dist/diff.js +6 -604
  29. package/dist/docs.js +54 -42
  30. package/dist/examples.d.ts +1 -1
  31. package/dist/examples.js +1366 -2908
  32. package/dist/finding-C_por275.d.ts +212 -0
  33. package/dist/format.d.ts +4 -4
  34. package/dist/format.js +2 -83
  35. package/dist/index.d.ts +318 -284
  36. package/dist/index.js +530 -943
  37. package/dist/markdown.d.ts +28 -27
  38. package/dist/markdown.js +8 -1940
  39. package/dist/pagination-BZpXLvFL.d.ts +119 -0
  40. package/dist/pagination.d.ts +5 -61
  41. package/dist/pagination.js +5 -5
  42. package/dist/patch.d.ts +12 -23
  43. package/dist/patch.js +5 -5
  44. package/dist/{presentation-mG-IYErQ.d.ts → presentation-C5eHkevA.d.ts} +350 -506
  45. package/dist/repo-readme.js +1 -1
  46. package/dist/{schemas-BbPonsTz.d.ts → schemas-DDpqAgyS.d.ts} +31 -17
  47. package/dist/schemas.d.ts +1 -1
  48. package/dist/schemas.js +1 -1
  49. package/dist/spec/README.md +10 -5
  50. package/dist/spec/catalogs/audiences/index.json +2 -50
  51. package/dist/spec/catalogs/chart-types/100pct-stacked-area.json +21 -0
  52. package/dist/spec/catalogs/chart-types/100pct-stacked-bar.json +22 -0
  53. package/dist/spec/catalogs/chart-types/100pct-stacked-column.json +22 -0
  54. package/dist/spec/catalogs/chart-types/area.json +2 -60
  55. package/dist/spec/catalogs/chart-types/bar.json +2 -48
  56. package/dist/spec/catalogs/chart-types/box-and-whisker.json +2 -132
  57. package/dist/spec/catalogs/chart-types/column.json +2 -52
  58. package/dist/spec/catalogs/chart-types/combo.json +37 -0
  59. package/dist/spec/catalogs/chart-types/doughnut.json +2 -40
  60. package/dist/spec/catalogs/chart-types/filled-radar.json +2 -52
  61. package/dist/spec/catalogs/chart-types/funnel.json +2 -46
  62. package/dist/spec/catalogs/chart-types/histogram.json +2 -149
  63. package/dist/spec/catalogs/chart-types/index.json +50 -520
  64. package/dist/spec/catalogs/chart-types/line-with-markers.json +2 -60
  65. package/dist/spec/catalogs/chart-types/line.json +2 -60
  66. package/dist/spec/catalogs/chart-types/pareto.json +2 -50
  67. package/dist/spec/catalogs/chart-types/pie.json +2 -40
  68. package/dist/spec/catalogs/chart-types/radar-with-markers.json +2 -52
  69. package/dist/spec/catalogs/chart-types/radar.json +2 -52
  70. package/dist/spec/catalogs/chart-types/scatter.json +2 -73
  71. package/dist/spec/catalogs/chart-types/stacked-area.json +21 -0
  72. package/dist/spec/catalogs/chart-types/stacked-bar.json +22 -0
  73. package/dist/spec/catalogs/chart-types/stacked-column.json +22 -0
  74. package/dist/spec/catalogs/chart-types/stacked-line-with-markers.json +22 -0
  75. package/dist/spec/catalogs/chart-types/stacked-line.json +21 -0
  76. package/dist/spec/catalogs/chart-types/treemap.json +2 -48
  77. package/dist/spec/catalogs/chart-types/waterfall.json +2 -52
  78. package/dist/spec/catalogs/chart-types/world.json +2 -64
  79. package/dist/spec/catalogs/font-schemes/angsana-new.json +2 -2
  80. package/dist/spec/catalogs/font-schemes/aparajita.json +3 -3
  81. package/dist/spec/catalogs/font-schemes/aptos.json +1 -1
  82. package/dist/spec/catalogs/font-schemes/arabic-typesetting.json +2 -2
  83. package/dist/spec/catalogs/font-schemes/arial.json +1 -1
  84. package/dist/spec/catalogs/font-schemes/batang.json +2 -2
  85. package/dist/spec/catalogs/font-schemes/bookman.json +1 -1
  86. package/dist/spec/catalogs/font-schemes/calibri.json +1 -1
  87. package/dist/spec/catalogs/font-schemes/century-schoolbook.json +1 -1
  88. package/dist/spec/catalogs/font-schemes/consolas.json +2 -4
  89. package/dist/spec/catalogs/font-schemes/constantia.json +1 -1
  90. package/dist/spec/catalogs/font-schemes/courier-new.json +2 -4
  91. package/dist/spec/catalogs/font-schemes/daunpenh.json +2 -2
  92. package/dist/spec/catalogs/font-schemes/david.json +2 -2
  93. package/dist/spec/catalogs/font-schemes/dilleniaupc.json +2 -2
  94. package/dist/spec/catalogs/font-schemes/fangsong.json +2 -2
  95. package/dist/spec/catalogs/font-schemes/garamond.json +1 -1
  96. package/dist/spec/catalogs/font-schemes/gautami.json +2 -2
  97. package/dist/spec/catalogs/font-schemes/georgia.json +1 -1
  98. package/dist/spec/catalogs/font-schemes/gisha.json +3 -3
  99. package/dist/spec/catalogs/font-schemes/grandview.json +1 -1
  100. package/dist/spec/catalogs/font-schemes/gungsuh.json +2 -2
  101. package/dist/spec/catalogs/font-schemes/impact.json +1 -1
  102. package/dist/spec/catalogs/font-schemes/index.json +1 -1
  103. package/dist/spec/catalogs/font-schemes/kalinga.json +2 -2
  104. package/dist/spec/catalogs/font-schemes/kartika.json +2 -2
  105. package/dist/spec/catalogs/font-schemes/khmer-ui.json +2 -2
  106. package/dist/spec/catalogs/font-schemes/latha.json +2 -2
  107. package/dist/spec/catalogs/font-schemes/lucida-sans.json +1 -1
  108. package/dist/spec/catalogs/font-schemes/malgun-gothic.json +2 -2
  109. package/dist/spec/catalogs/font-schemes/mangal.json +4 -5
  110. package/dist/spec/catalogs/font-schemes/meiryo.json +2 -2
  111. package/dist/spec/catalogs/font-schemes/microsoft-jhenghei.json +2 -2
  112. package/dist/spec/catalogs/font-schemes/microsoft-yahei.json +5 -5
  113. package/dist/spec/catalogs/font-schemes/mingliu.json +2 -2
  114. package/dist/spec/catalogs/font-schemes/miriam.json +2 -2
  115. package/dist/spec/catalogs/font-schemes/montserrat.json +1 -1
  116. package/dist/spec/catalogs/font-schemes/ms-mincho.json +2 -2
  117. package/dist/spec/catalogs/font-schemes/nirmala-ui.json +2 -2
  118. package/dist/spec/catalogs/font-schemes/noto-naksh-arabic.json +2 -2
  119. package/dist/spec/catalogs/font-schemes/noto-nastaliq-urdu.json +3 -3
  120. package/dist/spec/catalogs/font-schemes/noto-sans-arabic.json +4 -4
  121. package/dist/spec/catalogs/font-schemes/noto-sans-armenian.json +2 -2
  122. package/dist/spec/catalogs/font-schemes/noto-sans-bengali.json +3 -3
  123. package/dist/spec/catalogs/font-schemes/noto-sans-devangari.json +3 -3
  124. package/dist/spec/catalogs/font-schemes/noto-sans-ethiopic.json +2 -2
  125. package/dist/spec/catalogs/font-schemes/noto-sans-georgian.json +2 -2
  126. package/dist/spec/catalogs/font-schemes/noto-sans-gujarati.json +2 -2
  127. package/dist/spec/catalogs/font-schemes/noto-sans-gurmukhi.json +2 -2
  128. package/dist/spec/catalogs/font-schemes/noto-sans-hebrew.json +2 -2
  129. package/dist/spec/catalogs/font-schemes/noto-sans-jp.json +2 -2
  130. package/dist/spec/catalogs/font-schemes/noto-sans-kannada.json +2 -2
  131. package/dist/spec/catalogs/font-schemes/noto-sans-khmer.json +2 -2
  132. package/dist/spec/catalogs/font-schemes/noto-sans-kr.json +2 -2
  133. package/dist/spec/catalogs/font-schemes/noto-sans-malayalam.json +2 -2
  134. package/dist/spec/catalogs/font-schemes/noto-sans-mongolian.json +2 -2
  135. package/dist/spec/catalogs/font-schemes/noto-sans-oriya.json +2 -2
  136. package/dist/spec/catalogs/font-schemes/noto-sans-sc.json +5 -5
  137. package/dist/spec/catalogs/font-schemes/noto-sans-tamil.json +2 -2
  138. package/dist/spec/catalogs/font-schemes/noto-sans-tc.json +2 -2
  139. package/dist/spec/catalogs/font-schemes/noto-sans-telugu.json +2 -2
  140. package/dist/spec/catalogs/font-schemes/noto-sans-thai.json +2 -2
  141. package/dist/spec/catalogs/font-schemes/noto-sans.json +5 -5
  142. package/dist/spec/catalogs/font-schemes/nyala.json +2 -2
  143. package/dist/spec/catalogs/font-schemes/open-sans.json +1 -1
  144. package/dist/spec/catalogs/font-schemes/pmingliu.json +2 -2
  145. package/dist/spec/catalogs/font-schemes/poppins.json +1 -1
  146. package/dist/spec/catalogs/font-schemes/pt-serif.json +1 -1
  147. package/dist/spec/catalogs/font-schemes/raavi.json +2 -2
  148. package/dist/spec/catalogs/font-schemes/raleway.json +1 -1
  149. package/dist/spec/catalogs/font-schemes/roboto.json +1 -1
  150. package/dist/spec/catalogs/font-schemes/rockwell.json +1 -1
  151. package/dist/spec/catalogs/font-schemes/sakkal-majalla.json +4 -4
  152. package/dist/spec/catalogs/font-schemes/seaford.json +1 -1
  153. package/dist/spec/catalogs/font-schemes/segoe-ui-light.json +1 -1
  154. package/dist/spec/catalogs/font-schemes/segoe-ui.json +1 -1
  155. package/dist/spec/catalogs/font-schemes/shonar-bangla.json +3 -3
  156. package/dist/spec/catalogs/font-schemes/shruti.json +2 -2
  157. package/dist/spec/catalogs/font-schemes/simsun.json +2 -2
  158. package/dist/spec/catalogs/font-schemes/skeena.json +1 -1
  159. package/dist/spec/catalogs/font-schemes/sylfaen.json +3 -3
  160. package/dist/spec/catalogs/font-schemes/tahoma.json +1 -1
  161. package/dist/spec/catalogs/font-schemes/tenorite.json +1 -1
  162. package/dist/spec/catalogs/font-schemes/times-new-roman.json +1 -1
  163. package/dist/spec/catalogs/font-schemes/traditional-arabic.json +4 -4
  164. package/dist/spec/catalogs/font-schemes/trebuchet-ms.json +1 -1
  165. package/dist/spec/catalogs/font-schemes/tunga.json +2 -2
  166. package/dist/spec/catalogs/font-schemes/verdana.json +1 -1
  167. package/dist/spec/catalogs/font-schemes/vrinda.json +2 -2
  168. package/dist/spec/catalogs/font-schemes/yu-gothic.json +2 -2
  169. package/dist/spec/catalogs/layouts/action-plan.json +9 -15
  170. package/dist/spec/catalogs/layouts/agenda.json +8 -15
  171. package/dist/spec/catalogs/layouts/appendix-index.json +7 -15
  172. package/dist/spec/catalogs/layouts/architecture-stack.json +9 -15
  173. package/dist/spec/catalogs/layouts/assumptions-dependencies.json +9 -15
  174. package/dist/spec/catalogs/layouts/before-after.json +9 -15
  175. package/dist/spec/catalogs/layouts/benchmark-target-table.json +9 -15
  176. package/dist/spec/catalogs/layouts/blank.json +11 -1
  177. package/dist/spec/catalogs/layouts/bullet-list.json +9 -15
  178. package/dist/spec/catalogs/layouts/business-model-canvas.json +9 -15
  179. package/dist/spec/catalogs/layouts/capability-map.json +14 -16
  180. package/dist/spec/catalogs/layouts/case-study.json +9 -15
  181. package/dist/spec/catalogs/layouts/chapter-recap.json +8 -15
  182. package/dist/spec/catalogs/layouts/chart-1x.json +15 -0
  183. package/dist/spec/catalogs/layouts/chart-2x.json +15 -0
  184. package/dist/spec/catalogs/layouts/chart-3x.json +15 -0
  185. package/dist/spec/catalogs/layouts/circular-lifecycle.json +9 -15
  186. package/dist/spec/catalogs/layouts/code-1x.json +10 -0
  187. package/dist/spec/catalogs/layouts/comparison.json +9 -15
  188. package/dist/spec/catalogs/layouts/competitive-landscape.json +14 -16
  189. package/dist/spec/catalogs/layouts/customer-journey.json +14 -16
  190. package/dist/spec/catalogs/layouts/customer-logos.json +9 -15
  191. package/dist/spec/catalogs/layouts/dashboard.json +9 -15
  192. package/dist/spec/catalogs/layouts/data-visualization.json +9 -15
  193. package/dist/spec/catalogs/layouts/decision-tree.json +14 -16
  194. package/dist/spec/catalogs/layouts/detailed-data-table.json +9 -15
  195. package/dist/spec/catalogs/layouts/ecosystem-map.json +14 -16
  196. package/dist/spec/catalogs/layouts/executive-decision.json +9 -15
  197. package/dist/spec/catalogs/layouts/executive-summary.json +9 -15
  198. package/dist/spec/catalogs/layouts/extract/canonical.json +8 -8
  199. package/dist/spec/catalogs/layouts/faq.json +9 -15
  200. package/dist/spec/catalogs/layouts/feature-comparison-matrix.json +9 -15
  201. package/dist/spec/catalogs/layouts/forecast-scenario.json +9 -15
  202. package/dist/spec/catalogs/layouts/funnel-pyramid.json +9 -15
  203. package/dist/spec/catalogs/layouts/gantt-project-plan.json +9 -15
  204. package/dist/spec/catalogs/layouts/geographic-map.json +13 -15
  205. package/dist/spec/catalogs/layouts/heatmap-cohort.json +9 -15
  206. package/dist/spec/catalogs/layouts/hub-and-spoke.json +9 -15
  207. package/dist/spec/catalogs/layouts/icon-grid.json +14 -16
  208. package/dist/spec/catalogs/layouts/image-1x.json +11 -1
  209. package/dist/spec/catalogs/layouts/image-2x.json +12 -2
  210. package/dist/spec/catalogs/layouts/image-3x.json +13 -3
  211. package/dist/spec/catalogs/layouts/image-bleed.json +12 -2
  212. package/dist/spec/catalogs/layouts/image-focus.json +14 -16
  213. package/dist/spec/catalogs/layouts/index.json +1 -1
  214. package/dist/spec/catalogs/layouts/key-takeaway.json +8 -15
  215. package/dist/spec/catalogs/layouts/kpi-scorecard.json +9 -15
  216. package/dist/spec/catalogs/layouts/list-1x.json +17 -1
  217. package/dist/spec/catalogs/layouts/list-2x.json +16 -0
  218. package/dist/spec/catalogs/layouts/list-3x.json +16 -0
  219. package/dist/spec/catalogs/layouts/list-4x.json +16 -0
  220. package/dist/spec/catalogs/layouts/list-5x.json +16 -0
  221. package/dist/spec/catalogs/layouts/list-6x.json +16 -0
  222. package/dist/spec/catalogs/layouts/logic-tree.json +9 -15
  223. package/dist/spec/catalogs/layouts/market-size.json +9 -15
  224. package/dist/spec/catalogs/layouts/matrix-quadrant.json +9 -15
  225. package/dist/spec/catalogs/layouts/media-1x.json +11 -1
  226. package/dist/spec/catalogs/layouts/network-dependency-map.json +13 -15
  227. package/dist/spec/catalogs/layouts/number-1x.json +16 -1
  228. package/dist/spec/catalogs/layouts/number-2x.json +15 -0
  229. package/dist/spec/catalogs/layouts/number-3x.json +15 -0
  230. package/dist/spec/catalogs/layouts/number-4x.json +15 -0
  231. package/dist/spec/catalogs/layouts/number-5x.json +15 -0
  232. package/dist/spec/catalogs/layouts/number-6x.json +15 -0
  233. package/dist/spec/catalogs/layouts/one-column-explainer.json +9 -15
  234. package/dist/spec/catalogs/layouts/org-chart.json +9 -15
  235. package/dist/spec/catalogs/layouts/persona-grid.json +14 -16
  236. package/dist/spec/catalogs/layouts/photo-grid.json +17 -19
  237. package/dist/spec/catalogs/layouts/pricing-table.json +9 -15
  238. package/dist/spec/catalogs/layouts/process-flow.json +9 -15
  239. package/dist/spec/catalogs/layouts/product-feature.json +14 -16
  240. package/dist/spec/catalogs/layouts/pros-cons.json +9 -15
  241. package/dist/spec/catalogs/layouts/qa-discussion.json +7 -15
  242. package/dist/spec/catalogs/layouts/quote-1x.json +11 -1
  243. package/dist/spec/catalogs/layouts/quote-highlight.json +9 -15
  244. package/dist/spec/catalogs/layouts/raci-matrix.json +9 -15
  245. package/dist/spec/catalogs/layouts/risk-heatmap.json +9 -15
  246. package/dist/spec/catalogs/layouts/roadmap.json +9 -15
  247. package/dist/spec/catalogs/layouts/screenshot-walkthrough.json +14 -16
  248. package/dist/spec/catalogs/layouts/section-divider.json +8 -15
  249. package/dist/spec/catalogs/layouts/single-message-statement.json +8 -15
  250. package/dist/spec/catalogs/layouts/stats-metrics.json +9 -15
  251. package/dist/spec/catalogs/layouts/status-rag.json +9 -15
  252. package/dist/spec/catalogs/layouts/swimlane-process.json +14 -16
  253. package/dist/spec/catalogs/layouts/swot-analysis.json +9 -15
  254. package/dist/spec/catalogs/layouts/table-1x.json +10 -0
  255. package/dist/spec/catalogs/layouts/team-bio.json +14 -16
  256. package/dist/spec/catalogs/layouts/testimonial-grid.json +9 -15
  257. package/dist/spec/catalogs/layouts/text-1x.json +11 -1
  258. package/dist/spec/catalogs/layouts/text-2x.json +10 -0
  259. package/dist/spec/catalogs/layouts/text-3x.json +10 -0
  260. package/dist/spec/catalogs/layouts/thank-you-cta.json +8 -15
  261. package/dist/spec/catalogs/layouts/three-column.json +9 -15
  262. package/dist/spec/catalogs/layouts/timeline-1x.json +11 -1
  263. package/dist/spec/catalogs/layouts/timeline.json +9 -15
  264. package/dist/spec/catalogs/layouts/title-slide.json +8 -15
  265. package/dist/spec/catalogs/layouts/title-subtitle.json +11 -1
  266. package/dist/spec/catalogs/layouts/title.json +11 -1
  267. package/dist/spec/catalogs/layouts/two-column.json +9 -15
  268. package/dist/spec/catalogs/layouts/venn-overlap.json +9 -15
  269. package/dist/spec/catalogs/layouts/waterfall-bridge.json +9 -15
  270. package/dist/spec/catalogs/layouts/wheel-radial.json +9 -15
  271. package/dist/spec/catalogs/manifest.json +8 -8
  272. package/dist/spec/catalogs/narratives/board-meeting.json +45 -45
  273. package/dist/spec/catalogs/narratives/business-narrative.json +19 -19
  274. package/dist/spec/catalogs/narratives/business-review.json +27 -27
  275. package/dist/spec/catalogs/narratives/capacity-planning.json +19 -19
  276. package/dist/spec/catalogs/narratives/challenge-resolution.json +17 -17
  277. package/dist/spec/catalogs/narratives/change-story.json +13 -13
  278. package/dist/spec/catalogs/narratives/classic-story.json +17 -17
  279. package/dist/spec/catalogs/narratives/company-intro.json +21 -21
  280. package/dist/spec/catalogs/narratives/conference-talk.json +4 -4
  281. package/dist/spec/catalogs/narratives/data-story.json +13 -14
  282. package/dist/spec/catalogs/narratives/early-startup-pitch.json +27 -27
  283. package/dist/spec/catalogs/narratives/educate.json +21 -21
  284. package/dist/spec/catalogs/narratives/employee-review.json +19 -19
  285. package/dist/spec/catalogs/narratives/failure-analysis.json +23 -23
  286. package/dist/spec/catalogs/narratives/focus.json +27 -27
  287. package/dist/spec/catalogs/narratives/golden-circle.json +4 -4
  288. package/dist/spec/catalogs/narratives/heros-journey.json +13 -13
  289. package/dist/spec/catalogs/narratives/index.json +145 -145
  290. package/dist/spec/catalogs/narratives/innovation.json +21 -21
  291. package/dist/spec/catalogs/narratives/justice.json +25 -25
  292. package/dist/spec/catalogs/narratives/marketing-strategy.json +25 -25
  293. package/dist/spec/catalogs/narratives/performance-improvement-plan.json +19 -19
  294. package/dist/spec/catalogs/narratives/performance-review.json +25 -25
  295. package/dist/spec/catalogs/narratives/persuade.json +17 -17
  296. package/dist/spec/catalogs/narratives/persuasive-sales.json +19 -19
  297. package/dist/spec/catalogs/narratives/pitch-deck.json +6 -6
  298. package/dist/spec/catalogs/narratives/problem-solution.json +5 -5
  299. package/dist/spec/catalogs/narratives/product-launch.json +23 -23
  300. package/dist/spec/catalogs/narratives/project-proposal.json +23 -23
  301. package/dist/spec/catalogs/narratives/pyramid-principle.json +9 -9
  302. package/dist/spec/catalogs/narratives/qbr.json +8 -8
  303. package/dist/spec/catalogs/narratives/rags-to-riches.json +17 -17
  304. package/dist/spec/catalogs/narratives/reveal.json +19 -19
  305. package/dist/spec/catalogs/narratives/scqa.json +4 -4
  306. package/dist/spec/catalogs/narratives/situation-complication-resolution.json +11 -11
  307. package/dist/spec/catalogs/narratives/sparkline.json +11 -11
  308. package/dist/spec/catalogs/narratives/star-method.json +11 -11
  309. package/dist/spec/catalogs/narratives/status-update.json +15 -15
  310. package/dist/spec/catalogs/narratives/strategic-advisory.json +17 -17
  311. package/dist/spec/catalogs/narratives/strategic-narrative.json +4 -4
  312. package/dist/spec/catalogs/narratives/survey-analysis.json +23 -23
  313. package/dist/spec/catalogs/narratives/survival-story.json +23 -23
  314. package/dist/spec/catalogs/narratives/transformation-arc.json +4 -4
  315. package/dist/spec/catalogs/narratives/trend-analysis.json +17 -17
  316. package/dist/spec/catalogs/narratives/underdog-victory.json +19 -19
  317. package/dist/spec/catalogs/narratives/venture-pitch.json +27 -27
  318. package/dist/spec/catalogs/narratives/vision-roadmap.json +13 -13
  319. package/dist/spec/catalogs/narratives/weekly-progress.json +23 -23
  320. package/dist/spec/catalogs/narratives/what-so-what-now-what.json +9 -9
  321. package/dist/spec/openapi.yaml +2 -5
  322. package/dist/spec/reference/engine-defaults.json +2 -2
  323. package/dist/spec/schemas/audience.schema.json +1 -1
  324. package/dist/spec/schemas/catalog-index.schema.json +2 -2
  325. package/dist/spec/schemas/chart-type.schema.json +19 -290
  326. package/dist/spec/schemas/color-scheme.schema.json +20 -12
  327. package/dist/spec/schemas/finding.schema.json +191 -0
  328. package/dist/spec/schemas/font-scheme.schema.json +19 -46
  329. package/dist/spec/schemas/layout.schema.json +100 -159
  330. package/dist/spec/schemas/narrative.schema.json +17 -25
  331. package/dist/spec/schemas/opf.schema.json +286 -340
  332. package/dist/spec/schemas/social-platform.schema.json +1 -26
  333. package/dist/spec/schemas/theme.schema.json +4 -1
  334. package/dist/spec-files.d.ts +1 -1
  335. package/dist/spec-files.js +1 -1
  336. package/dist/symbol-font-encodings.js +18448 -1
  337. package/dist/types.d.ts +4 -4
  338. package/dist/validation-types-zh03LeZy.d.ts +276 -0
  339. package/dist/validator.d.ts +60 -4
  340. package/dist/validator.js +4 -4
  341. package/dist/yaml.d.ts +87 -0
  342. package/dist/yaml.js +321 -0
  343. package/package.json +5 -9
  344. package/dist/audit.d.ts +0 -35
  345. package/dist/audit.js +0 -7
  346. package/dist/chunk-7N4VMAT4.js +0 -1694
  347. package/dist/chunk-FYLJVF7X.js +0 -18448
  348. package/dist/chunk-INU7ZNSB.js +0 -670
  349. package/dist/chunk-IYCJUKWD.js +0 -951
  350. package/dist/lint-B7azdiuE.d.ts +0 -197
  351. package/dist/lint.d.ts +0 -7
  352. package/dist/lint.js +0 -6
  353. package/dist/spec/catalogs/audiences/customers.json +0 -27
  354. package/dist/spec/catalogs/audiences/executives.json +0 -27
  355. package/dist/spec/catalogs/audiences/investors.json +0 -27
  356. package/dist/spec/catalogs/audiences/marketing-team.json +0 -27
  357. package/dist/spec/catalogs/audiences/regulators.json +0 -27
  358. package/dist/spec/catalogs/audiences/sales-team.json +0 -27
  359. package/dist/spec/catalogs/chart-types/100pct-bullet-bar-2x.json +0 -91
  360. package/dist/spec/catalogs/chart-types/100pct-bullet-bar-3x.json +0 -103
  361. package/dist/spec/catalogs/chart-types/100pct-bullet-bar.json +0 -79
  362. package/dist/spec/catalogs/chart-types/100pct-bullet-column-2x.json +0 -91
  363. package/dist/spec/catalogs/chart-types/100pct-bullet-column-3x.json +0 -103
  364. package/dist/spec/catalogs/chart-types/100pct-bullet-column.json +0 -79
  365. package/dist/spec/catalogs/chart-types/100pct-progress-bar.json +0 -105
  366. package/dist/spec/catalogs/chart-types/100pct-stacked-area-2x.json +0 -106
  367. package/dist/spec/catalogs/chart-types/100pct-stacked-area-3x.json +0 -123
  368. package/dist/spec/catalogs/chart-types/100pct-stacked-bar-2x.json +0 -89
  369. package/dist/spec/catalogs/chart-types/100pct-stacked-bar-3x.json +0 -100
  370. package/dist/spec/catalogs/chart-types/100pct-stacked-column-2x.json +0 -95
  371. package/dist/spec/catalogs/chart-types/100pct-stacked-column-3x.json +0 -108
  372. package/dist/spec/catalogs/chart-types/australia.json +0 -76
  373. package/dist/spec/catalogs/chart-types/box-and-whisker-2x.json +0 -136
  374. package/dist/spec/catalogs/chart-types/box-and-whisker-3x.json +0 -168
  375. package/dist/spec/catalogs/chart-types/bullet-bar-2x.json +0 -89
  376. package/dist/spec/catalogs/chart-types/bullet-bar-3x.json +0 -101
  377. package/dist/spec/catalogs/chart-types/bullet-bar.json +0 -77
  378. package/dist/spec/catalogs/chart-types/bullet-column-2x.json +0 -89
  379. package/dist/spec/catalogs/chart-types/bullet-column-3x.json +0 -101
  380. package/dist/spec/catalogs/chart-types/bullet-column.json +0 -77
  381. package/dist/spec/catalogs/chart-types/canada.json +0 -86
  382. package/dist/spec/catalogs/chart-types/clustered-bar-2x.json +0 -89
  383. package/dist/spec/catalogs/chart-types/clustered-column.json +0 -95
  384. package/dist/spec/catalogs/chart-types/dot-plot-2x.json +0 -99
  385. package/dist/spec/catalogs/chart-types/dot-plot-3x.json +0 -124
  386. package/dist/spec/catalogs/chart-types/dot-plot-4x.json +0 -149
  387. package/dist/spec/catalogs/chart-types/dot-plot-5x.json +0 -174
  388. package/dist/spec/catalogs/chart-types/dot-plot-6x.json +0 -199
  389. package/dist/spec/catalogs/chart-types/dot-plot.json +0 -74
  390. package/dist/spec/catalogs/chart-types/dumbbell.json +0 -120
  391. package/dist/spec/catalogs/chart-types/line-2x.json +0 -105
  392. package/dist/spec/catalogs/chart-types/line-3x.json +0 -127
  393. package/dist/spec/catalogs/chart-types/line-with-high-low-and-markers.json +0 -144
  394. package/dist/spec/catalogs/chart-types/line-with-high-low.json +0 -144
  395. package/dist/spec/catalogs/chart-types/line-with-markers-2x.json +0 -106
  396. package/dist/spec/catalogs/chart-types/line-with-markers-3x.json +0 -128
  397. package/dist/spec/catalogs/chart-types/sparkline-2x.json +0 -138
  398. package/dist/spec/catalogs/chart-types/sparkline-3x.json +0 -174
  399. package/dist/spec/catalogs/chart-types/sparkline-4x.json +0 -210
  400. package/dist/spec/catalogs/chart-types/sparkline-5x.json +0 -246
  401. package/dist/spec/catalogs/chart-types/sparkline-6x.json +0 -282
  402. package/dist/spec/catalogs/chart-types/sparkline.json +0 -102
  403. package/dist/spec/catalogs/chart-types/stacked-area-2x.json +0 -106
  404. package/dist/spec/catalogs/chart-types/stacked-area-3x.json +0 -123
  405. package/dist/spec/catalogs/chart-types/stacked-bar-2x.json +0 -89
  406. package/dist/spec/catalogs/chart-types/stacked-bar-3x.json +0 -100
  407. package/dist/spec/catalogs/chart-types/stacked-column-2x.json +0 -95
  408. package/dist/spec/catalogs/chart-types/stacked-column-3x.json +0 -108
  409. package/dist/spec/catalogs/chart-types/stacked-line-2x.json +0 -106
  410. package/dist/spec/catalogs/chart-types/stacked-line-3x.json +0 -123
  411. package/dist/spec/catalogs/chart-types/stacked-line-with-markers-2x.json +0 -107
  412. package/dist/spec/catalogs/chart-types/stacked-line-with-markers-3x.json +0 -124
  413. package/dist/spec/catalogs/chart-types/treemap-2x.json +0 -101
  414. package/dist/spec/catalogs/chart-types/treemap-3x.json +0 -122
  415. package/dist/spec/catalogs/chart-types/united-kingdom.json +0 -68
  416. package/dist/spec/catalogs/chart-types/united-states.json +0 -82
  417. package/dist/validator-CIylxoIm.d.ts +0 -172
@@ -1,951 +0,0 @@
1
- import { promotedRegionKeys, VARIABLE_KINDS, isRecord, collectCitations, hasContentVariables, isTemplate, instantiateForValidation, MAX_COMPOSITION_DEPTH, visitContentPayloads, datasetDiagnostics, pathFor, tableGrid, numberingFindings, walkCitationRuns, resolveChartData, resolveTableData, bareIdPattern, catalogIds, deprecatedCatalogIds, resolveChartOptions, chartOptionTarget } from './chunk-MPM7NRG7.js';
2
- import { catalogSchemaNames } from './chunk-E34DJ5LL.js';
3
- import { schemas, schemaEntries } from './chunk-7QBCWNWL.js';
4
- import Ajv2020 from 'ajv/dist/2020.js';
5
- import addFormats from 'ajv-formats';
6
-
7
- // src/annotation-validation.ts
8
- var issue = (path, message, params) => ({ path, message, keyword: "opf", schemaPath: "#/x-opf-semantics", params });
9
- var pointer = (dotted) => `/${dotted.split(".").map((part) => part.replaceAll("~", "~0").replaceAll("/", "~1")).join("/")}`;
10
- function markedRuns(value) {
11
- if (!Array.isArray(value)) return [];
12
- return value.flatMap((run, index) => isRecord(run) && (run.cite !== void 0 || run.footnote !== void 0) ? [index] : []);
13
- }
14
- function annotationIssues(value) {
15
- if (!isRecord(value) || !Array.isArray(value.slides)) return [];
16
- const issues = [];
17
- const ids = /* @__PURE__ */ new Set();
18
- if (Array.isArray(value.references)) value.references.forEach((reference, index) => {
19
- if (!isRecord(reference) || typeof reference.id !== "string") return;
20
- if (ids.has(reference.id)) issues.push(issue(`/references/${index}/id`, `reference id '${reference.id}' is used by an earlier references entry; ids must be unique`, { code: "reference-id-duplicate", id: reference.id }));
21
- ids.add(reference.id);
22
- for (const runIndex of markedRuns(reference.text)) issues.push(issue(`/references/${index}/text/${runIndex}`, "reference text cannot cite or carry a footnote", { code: "cite-unsupported-location" }));
23
- });
24
- const unsupported = (runs, path, where) => {
25
- for (const runIndex of markedRuns(runs)) issues.push(issue(`${path}/${runIndex}`, `cite and footnote are not supported in ${where}; markers are drawn only in text, bullets and list items`, { code: "cite-unsupported-location" }));
26
- };
27
- const cell = (entry, path) => {
28
- if (Array.isArray(entry)) unsupported(entry, path, "table cells");
29
- else if (isRecord(entry) && Array.isArray(entry.value)) unsupported(entry.value, pathFor(path, "value"), "table cells");
30
- };
31
- const payload = (node, path) => {
32
- if (isRecord(node.table)) {
33
- const table = node.table, tablePath = pathFor(path, "table");
34
- if (Array.isArray(table.columns)) table.columns.forEach((column, index) => {
35
- cell(column, `${pathFor(tablePath, "columns")}/${index}`);
36
- });
37
- if (Array.isArray(table.rows)) table.rows.forEach((row, rowIndex) => {
38
- if (Array.isArray(row)) row.forEach((entry, cellIndex) => {
39
- cell(entry, `${pathFor(tablePath, "rows")}/${rowIndex}/${cellIndex}`);
40
- });
41
- });
42
- }
43
- if (node.caption !== void 0) {
44
- const caption = node.caption, captionPath = pathFor(path, "caption");
45
- if (Array.isArray(caption)) unsupported(caption, captionPath, "captions");
46
- else if (isRecord(caption) && Array.isArray(caption.text)) unsupported(caption.text, pathFor(captionPath, "text"), "captions");
47
- }
48
- };
49
- value.slides.forEach((slide, index) => {
50
- if (!isRecord(slide)) return;
51
- const slidePath = `/slides/${index}`;
52
- payload(slide, slidePath);
53
- visitContentPayloads(slide, slidePath, payload);
54
- walkCitationRuns(slide, `slides.${index}`, (entry) => {
55
- const runPath = pointer(entry.path);
56
- const cite = entry.run.cite;
57
- if (typeof cite === "string") {
58
- if (!ids.has(cite)) issues.push(issue(`${runPath}/cite`, `unknown reference '${cite}'; add it to the top-level references list`, { code: "cite-unknown-reference", id: cite }));
59
- } else if (Array.isArray(cite)) cite.forEach((id, position) => {
60
- if (typeof id === "string" && !ids.has(id)) issues.push(issue(`${runPath}/cite/${position}`, `unknown reference '${id}'; add it to the top-level references list`, { code: "cite-unknown-reference", id }));
61
- });
62
- if (Array.isArray(entry.footnote)) unsupported(entry.footnote, `${runPath}/footnote`, "footnote text");
63
- });
64
- });
65
- return issues;
66
- }
67
- function unusedReferenceWarnings(value) {
68
- if (!isRecord(value) || !Array.isArray(value.references) || !Array.isArray(value.slides)) return [];
69
- const { unused } = collectCitations(value);
70
- return value.references.flatMap((reference, index) => isRecord(reference) && typeof reference.id === "string" && unused.includes(reference.id) ? [issue(`/references/${index}`, `reference '${reference.id}' is never cited; cite it with a run's cite field or remove it`, { code: "unused-reference", id: reference.id })] : []);
71
- }
72
-
73
- // src/validation-definitions.ts
74
- var schemaLocations;
75
- var issueLocations = /* @__PURE__ */ new WeakMap();
76
- function rememberValidationDefinition(issue2, parentSchema, keyword) {
77
- if (!parentSchema || typeof parentSchema !== "object") return;
78
- if (!schemaLocations) {
79
- schemaLocations = /* @__PURE__ */ new WeakMap();
80
- for (const entry of schemaEntries) {
81
- const stack = [
82
- { value: entry.schema, pointer: "" }
83
- ];
84
- while (stack.length) {
85
- const current = stack.pop();
86
- if (!current?.value || typeof current.value !== "object")
87
- continue;
88
- schemaLocations.set(current.value, {
89
- schemaName: entry.name,
90
- pointer: current.pointer,
91
- uri: `${entry.schema.$id}#${current.pointer}`
92
- });
93
- for (const [key, value] of Object.entries(current.value)) {
94
- const segment = key.replaceAll("~", "~0").replaceAll("/", "~1");
95
- stack.push({ value, pointer: `${current.pointer}/${segment}` });
96
- }
97
- }
98
- }
99
- }
100
- const parent = schemaLocations.get(parentSchema);
101
- if (!parent) return;
102
- const suffix = `/${keyword.replaceAll("~", "~0").replaceAll("/", "~1")}`;
103
- issueLocations.set(issue2, {
104
- ...parent,
105
- pointer: parent.pointer + suffix,
106
- uri: parent.uri + suffix
107
- });
108
- }
109
- function validationDefinition(issue2) {
110
- return issueLocations.get(issue2);
111
- }
112
-
113
- // src/validator.ts
114
- var OPFValidationError = class extends Error {
115
- issues;
116
- result;
117
- constructor(result) {
118
- const first = result.errors[0];
119
- super(first ? `OPF validation failed at ${first.path}: ${first.message}` : "OPF validation failed");
120
- this.name = "OPFValidationError";
121
- this.issues = result.errors;
122
- this.result = result;
123
- }
124
- };
125
- var schemaNameByCatalogKind = catalogSchemaNames;
126
- var ajv;
127
- var dynamicSchemaCache = /* @__PURE__ */ new WeakMap();
128
- var promotedRegionKeySet = new Set(promotedRegionKeys);
129
- var rootPayloadFields = [
130
- "type",
131
- "text",
132
- "items",
133
- "bullets",
134
- "image",
135
- "video",
136
- "chart",
137
- "table",
138
- "code",
139
- "metric",
140
- "quote",
141
- "timeline",
142
- "blocks"
143
- ];
144
- var contentKindSpecs = {
145
- text: {
146
- fields: ["text", "bullets"],
147
- required: [],
148
- requireAny: ["text", "bullets"]
149
- },
150
- list: {
151
- fields: ["items"],
152
- required: ["items"]
153
- },
154
- image: {
155
- fields: ["image"],
156
- required: ["image"]
157
- },
158
- chart: {
159
- fields: ["chart"],
160
- required: ["chart"]
161
- },
162
- table: {
163
- fields: ["table"],
164
- required: ["table"]
165
- },
166
- video: {
167
- fields: ["video"],
168
- required: ["video"]
169
- },
170
- code: {
171
- fields: ["code"],
172
- required: ["code"]
173
- },
174
- metric: {
175
- fields: ["metric"],
176
- required: ["metric"]
177
- },
178
- quote: {
179
- fields: ["quote"],
180
- required: ["quote"]
181
- },
182
- timeline: {
183
- fields: ["timeline"],
184
- required: ["timeline"]
185
- }
186
- };
187
- var captionableKinds = /* @__PURE__ */ new Set(["image", "chart", "table", "video"]);
188
- var columnSpans = {
189
- left: [0],
190
- center: [1],
191
- right: [2],
192
- "left+center": [0, 1],
193
- "center+right": [1, 2],
194
- "left+center+right": [0, 1, 2]
195
- };
196
- var rowSpans = {
197
- top: [0],
198
- middle: [1],
199
- bottom: [2],
200
- "top+middle": [0, 1],
201
- "middle+bottom": [1, 2],
202
- "top+middle+bottom": [0, 1, 2]
203
- };
204
- function getAjv() {
205
- if (ajv) {
206
- return ajv;
207
- }
208
- const instance = new Ajv2020({
209
- allErrors: true,
210
- verbose: true,
211
- strict: false,
212
- allowUnionTypes: true
213
- });
214
- addFormats(instance);
215
- for (const schema of Object.values(schemas)) {
216
- instance.addSchema(schema);
217
- }
218
- ajv = instance;
219
- return instance;
220
- }
221
- function isSchemaName(value) {
222
- return typeof value === "string" && value in schemas;
223
- }
224
- function isCatalogKind(value) {
225
- return typeof value === "string" && value in schemaNameByCatalogKind;
226
- }
227
- function resolveValidator(schemaOrKind) {
228
- const instance = getAjv();
229
- if (isSchemaName(schemaOrKind)) {
230
- const schema = schemas[schemaOrKind];
231
- const validator2 = instance.getSchema(schema.$id) ?? instance.compile(schema);
232
- return { validate: validator2, schemaName: schemaOrKind };
233
- }
234
- if (isCatalogKind(schemaOrKind)) {
235
- const schemaName = schemaNameByCatalogKind[schemaOrKind];
236
- const schema = schemas[schemaName];
237
- const validator2 = instance.getSchema(schema.$id) ?? instance.compile(schema);
238
- return { validate: validator2, schemaName, catalogKind: schemaOrKind };
239
- }
240
- const cached = dynamicSchemaCache.get(schemaOrKind);
241
- if (cached) {
242
- return { validate: cached };
243
- }
244
- const validator = instance.compile(schemaOrKind);
245
- dynamicSchemaCache.set(schemaOrKind, validator);
246
- return { validate: validator };
247
- }
248
- function toIssue(error) {
249
- const issue2 = {
250
- path: error.instancePath || "/",
251
- message: error.message ?? "failed validation",
252
- keyword: error.keyword,
253
- schemaPath: error.schemaPath,
254
- params: error.params
255
- };
256
- rememberValidationDefinition(issue2, error.parentSchema, error.keyword);
257
- return issue2;
258
- }
259
- function semanticIssue(path, message, params = {}) {
260
- return {
261
- path,
262
- message,
263
- keyword: "opf",
264
- schemaPath: "#/x-opf-semantics",
265
- params
266
- };
267
- }
268
- function hasOwn(value, key) {
269
- return Object.hasOwn(value, key);
270
- }
271
- function isEnUkTag(value) {
272
- return typeof value === "string" && value.toLowerCase() === "en-uk";
273
- }
274
- function presentFields(value, fields) {
275
- return fields.filter((field) => hasOwn(value, field));
276
- }
277
- function isContentKind(value) {
278
- return typeof value === "string" && value in contentKindSpecs;
279
- }
280
- function inferredKinds(value) {
281
- const kinds = [];
282
- if (presentFields(value, contentKindSpecs.text.fields).length > 0) kinds.push("text");
283
- if (hasOwn(value, "items")) kinds.push("list");
284
- if (hasOwn(value, "image")) kinds.push("image");
285
- if (hasOwn(value, "video")) kinds.push("video");
286
- if (hasOwn(value, "chart")) kinds.push("chart");
287
- if (hasOwn(value, "table")) kinds.push("table");
288
- if (hasOwn(value, "code")) kinds.push("code");
289
- if (hasOwn(value, "metric")) kinds.push("metric");
290
- if (hasOwn(value, "quote")) kinds.push("quote");
291
- if (hasOwn(value, "timeline")) kinds.push("timeline");
292
- return kinds;
293
- }
294
- function isImplicitBlocksComposition(value, inferred, options) {
295
- if (options.slideRoot !== true || hasOwn(value, "blocks")) {
296
- return false;
297
- }
298
- return inferred.length > 1;
299
- }
300
- function validateContentPayload(value, path, options = {}) {
301
- const issues = [];
302
- const explicitType = value.type;
303
- const payloadFields = presentFields(value, rootPayloadFields);
304
- const hasBlocks = hasOwn(value, "blocks");
305
- const captionIssue = (reason, params = {}) => semanticIssue(pathFor(path, "caption"), `caption is only valid on an image, chart, table or video payload; ${reason}`, { code: "caption-unsupported-payload", ...params });
306
- if (hasBlocks || explicitType === "group") {
307
- if (hasOwn(value, "caption")) issues.push(captionIssue("a group cannot carry one"));
308
- if (explicitType !== void 0 && explicitType !== "group") issues.push(semanticIssue(path, "a group must use type 'group' or omit type"));
309
- const incompatible2 = payloadFields.filter((field) => field !== "blocks" && field !== "type");
310
- if (incompatible2.length) issues.push(semanticIssue(path, "blocks cannot be mixed with leaf payload fields", { fields: incompatible2 }));
311
- if (!Array.isArray(value.blocks) || value.blocks.length === 0 && !options.slideRoot) issues.push(semanticIssue(pathFor(path, "blocks"), "a group requires at least one block"));
312
- if (Array.isArray(value.blocks)) value.blocks.forEach((block, index) => {
313
- if (isRecord(block)) issues.push(...validateContentPayload(block, `${pathFor(path, "blocks")}/${index}`));
314
- });
315
- return issues;
316
- }
317
- if (hasOwn(value, "composition") && !options.slideRoot) issues.push(semanticIssue(pathFor(path, "composition"), "composition is only valid on a group containing blocks"));
318
- if (explicitType !== void 0 && !isContentKind(explicitType)) {
319
- return issues;
320
- }
321
- const kind = isContentKind(explicitType) ? explicitType : void 0;
322
- const inferred = kind ? [kind] : inferredKinds(value);
323
- if (!kind && inferred.length === 0) {
324
- if (payloadFields.length > 0 || path !== "/") {
325
- issues.push(semanticIssue(path, "content payload must include concrete content fields", {
326
- fields: payloadFields
327
- }));
328
- }
329
- return issues;
330
- }
331
- if (!kind && inferred.length > 1) {
332
- if (isImplicitBlocksComposition(value, inferred, options)) {
333
- if (hasOwn(value, "caption")) issues.push(captionIssue("a slide root with several payloads cannot carry one; put the caption on a block", { inferredTypes: inferred }));
334
- return issues;
335
- }
336
- issues.push(semanticIssue(path, "content payload mixes fields from incompatible content types", {
337
- inferredTypes: inferred
338
- }));
339
- return issues;
340
- }
341
- const resolvedKind = inferred[0];
342
- if (!resolvedKind) {
343
- return issues;
344
- }
345
- const spec = contentKindSpecs[resolvedKind];
346
- if (hasOwn(value, "caption") && !captionableKinds.has(resolvedKind)) issues.push(captionIssue(`this payload is '${resolvedKind}'`, { type: resolvedKind }));
347
- const allowedFields = /* @__PURE__ */ new Set([
348
- "type",
349
- ...spec.fields
350
- ]);
351
- for (const required of spec.required) {
352
- if (!hasOwn(value, required)) {
353
- issues.push(semanticIssue(path, `content payload type '${resolvedKind}' requires '${required}'`, {
354
- type: resolvedKind,
355
- required
356
- }));
357
- }
358
- }
359
- if (spec.requireAny && presentFields(value, spec.requireAny).length === 0) {
360
- issues.push(semanticIssue(path, `content payload type '${resolvedKind}' requires one of: ${spec.requireAny.join(", ")}`, {
361
- type: resolvedKind,
362
- requiredAny: spec.requireAny
363
- }));
364
- }
365
- const incompatible = payloadFields.filter((field) => !allowedFields.has(field));
366
- if (incompatible.length > 0) {
367
- issues.push(semanticIssue(path, `content payload type '${resolvedKind}' cannot include incompatible fields: ${incompatible.join(", ")}`, {
368
- type: resolvedKind,
369
- incompatible
370
- }));
371
- }
372
- return issues;
373
- }
374
- function slideRegion(key) {
375
- if (key.includes(":")) {
376
- const [rowPart, columnPart] = key.split(":");
377
- if (!rowPart || !columnPart) return void 0;
378
- const rows = rowSpans[rowPart];
379
- const columns = columnSpans[columnPart];
380
- return rows && columns ? { rows, columns } : void 0;
381
- }
382
- if (key in columnSpans) {
383
- const columns = columnSpans[key];
384
- return columns ? { rows: [0, 1, 2], columns } : void 0;
385
- }
386
- if (key in rowSpans) {
387
- const rows = rowSpans[key];
388
- return rows ? { rows, columns: [0, 1, 2] } : void 0;
389
- }
390
- return void 0;
391
- }
392
- function intersects(left, right) {
393
- return left.some((value) => right.includes(value));
394
- }
395
- function regionsOverlap(left, right) {
396
- return intersects(left.rows, right.rows) && intersects(left.columns, right.columns);
397
- }
398
- function validateSlideRegions(slide, slidePath) {
399
- const issues = [];
400
- const regionKeys = Object.keys(slide).filter((key) => promotedRegionKeySet.has(key));
401
- const rootFields = presentFields(slide, rootPayloadFields);
402
- if (regionKeys.length > 0 && rootFields.length > 0) {
403
- issues.push(semanticIssue(slidePath, "root content payload fields cannot be mixed with promoted region keys", {
404
- rootFields,
405
- regionKeys
406
- }));
407
- }
408
- if (regionKeys.length === 0 && rootFields.length > 0) {
409
- issues.push(...validateContentPayload(slide, slidePath, { slideRoot: true }));
410
- }
411
- for (const key of regionKeys) {
412
- const value = slide[key];
413
- if (isRecord(value)) {
414
- issues.push(...validateContentPayload(value, pathFor(slidePath, key)));
415
- }
416
- }
417
- for (let leftIndex = 0; leftIndex < regionKeys.length; leftIndex += 1) {
418
- const leftKey = regionKeys[leftIndex];
419
- if (!leftKey) continue;
420
- const leftRegion = slideRegion(leftKey);
421
- if (!leftRegion) continue;
422
- for (let rightIndex = leftIndex + 1; rightIndex < regionKeys.length; rightIndex += 1) {
423
- const rightKey = regionKeys[rightIndex];
424
- if (!rightKey) continue;
425
- const rightRegion = slideRegion(rightKey);
426
- if (!rightRegion) continue;
427
- if (regionsOverlap(leftRegion, rightRegion)) {
428
- issues.push(semanticIssue(slidePath, `promoted region keys '${leftKey}' and '${rightKey}' overlap`, {
429
- regionKeys: [leftKey, rightKey]
430
- }));
431
- }
432
- }
433
- }
434
- return issues;
435
- }
436
- function validatePresentationSemantics(value) {
437
- if (!isRecord(value) || !Array.isArray(value.slides)) {
438
- return [];
439
- }
440
- const issues = [];
441
- if (isEnUkTag(value.language)) {
442
- issues.push(semanticIssue("/language", "Use 'en-GB' for UK English; 'en-UK' is not a valid BCP-47 region tag", {
443
- replacement: "en-GB"
444
- }));
445
- } else if (isRecord(value.language) && isEnUkTag(value.language.bcp47)) {
446
- issues.push(semanticIssue("/language/bcp47", "Use 'en-GB' for UK English; 'en-UK' is not a valid BCP-47 region tag", {
447
- replacement: "en-GB"
448
- }));
449
- }
450
- const documentIds = /* @__PURE__ */ new Map();
451
- value.slides.forEach((slide, index) => {
452
- if (isRecord(slide)) {
453
- const slidePath = `/slides/${index}`;
454
- if (typeof slide.id === "string") {
455
- const seen = documentIds.get(slide.id);
456
- if (seen === "slide") issues.push(semanticIssue(`${slidePath}/id`, "slide ids must be unique within a presentation", { id: slide.id }));
457
- else if (seen === "payload") issues.push(semanticIssue(`${slidePath}/id`, "slide id duplicates a content payload id; ids must be unique among slide and payload ids within a presentation", { id: slide.id }));
458
- else documentIds.set(slide.id, "slide");
459
- }
460
- visitContentPayloads(slide, slidePath, (payload, path) => {
461
- if (typeof payload.id === "string") {
462
- if (documentIds.has(payload.id)) issues.push(semanticIssue(`${path}/id`, "content payload ids must be unique among slide and payload ids within a presentation", { id: payload.id }));
463
- else documentIds.set(payload.id, "payload");
464
- }
465
- });
466
- issues.push(...validateSlideRegions(slide, slidePath));
467
- const payloadTableIssues = (payload, path) => {
468
- 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));
469
- };
470
- payloadTableIssues(slide, slidePath);
471
- visitContentPayloads(slide, slidePath, payloadTableIssues);
472
- const payloadNumberingIssues = (payload, path) => {
473
- for (const finding of numberingFindings(payload).errors) issues.push(semanticIssue(pathFor(path, finding.key), finding.message, finding.params));
474
- };
475
- payloadNumberingIssues(slide, slidePath);
476
- visitContentPayloads(slide, slidePath, payloadNumberingIssues);
477
- }
478
- });
479
- issues.push(...annotationIssues(value));
480
- return issues;
481
- }
482
- function inlineCatalogEntry(context, kind) {
483
- const catalogsField = context.document.catalogs;
484
- if (!isRecord(catalogsField)) {
485
- return void 0;
486
- }
487
- const entry = catalogsField[kind];
488
- return isRecord(entry) ? entry : void 0;
489
- }
490
- function unknownIdWarning(kind, value, path, context) {
491
- if (typeof value !== "string" || !bareIdPattern.test(value)) {
492
- return void 0;
493
- }
494
- if (context) {
495
- const entry = inlineCatalogEntry(context, kind);
496
- if (entry) {
497
- const inline = Array.isArray(entry.records) ? entry.records.find((record) => isRecord(record) && record.id === value) : void 0;
498
- if (isRecord(inline)) {
499
- const replacedBy = isRecord(inline.deprecation) ? inline.deprecation.replacedBy : void 0;
500
- return typeof replacedBy === "string" ? deprecatedIdWarning(kind, value, replacedBy, path) : void 0;
501
- }
502
- if (typeof entry.source === "string" || Array.isArray(entry.source) && entry.source.length > 0) {
503
- return void 0;
504
- }
505
- }
506
- }
507
- if (catalogIds[kind].includes(value)) {
508
- const replacedBy = deprecatedCatalogIds[`${kind}/${value}`];
509
- return replacedBy === void 0 ? void 0 : deprecatedIdWarning(kind, value, replacedBy, path);
510
- }
511
- return semanticIssue(path, `unknown ${kind} catalog id '${value}'`, { kind, id: value });
512
- }
513
- function deprecatedIdWarning(kind, id, replacedBy, path) {
514
- return semanticIssue(path, `deprecated ${kind} catalog id '${id}'; use '${replacedBy}'`, { kind, id, replacedBy });
515
- }
516
- function referenceObjectWarning(kind, value, path, context) {
517
- if (typeof value === "string") {
518
- return unknownIdWarning(kind, value, path, context);
519
- }
520
- if (isRecord(value)) {
521
- return unknownIdWarning(kind, value.id, pathFor(path, "id"), context);
522
- }
523
- return void 0;
524
- }
525
- function pushIfDefined(issues, issue2) {
526
- if (issue2) {
527
- issues.push(issue2);
528
- }
529
- }
530
- function designReferenceWarnings(design, path, context) {
531
- if (!isRecord(design)) {
532
- return [];
533
- }
534
- const issues = [];
535
- pushIfDefined(issues, referenceObjectWarning("themes", design.theme, pathFor(path, "theme"), context));
536
- pushIfDefined(issues, referenceObjectWarning("colorSchemes", design.colorScheme, pathFor(path, "colorScheme"), context));
537
- pushIfDefined(issues, referenceObjectWarning("fontSchemes", design.fontScheme, pathFor(path, "fontScheme"), context));
538
- if (isRecord(design.theme)) {
539
- const themePath = pathFor(path, "theme");
540
- pushIfDefined(issues, referenceObjectWarning("colorSchemes", design.theme.colorScheme, pathFor(themePath, "colorScheme"), context));
541
- pushIfDefined(issues, referenceObjectWarning("fontSchemes", design.theme.fontScheme, pathFor(themePath, "fontScheme"), context));
542
- }
543
- return issues;
544
- }
545
- function chartTypeWarnings(payload, path, context) {
546
- if (!isRecord(payload)) {
547
- return [];
548
- }
549
- const issues = [];
550
- if (isRecord(payload.chart)) {
551
- pushIfDefined(issues, unknownIdWarning("chartTypes", payload.chart.type, `${pathFor(path, "chart")}/type`, context));
552
- for (const diagnostic of resolveChartOptions(payload.chart, chartOptionTarget(payload.chart.type)).diagnostics) {
553
- issues.push(semanticIssue(diagnostic.option.split(".").reduce(pathFor, pathFor(path, "chart")), diagnostic.message, { code: diagnostic.code, option: diagnostic.option, reason: diagnostic.reason }));
554
- }
555
- }
556
- if (Array.isArray(payload.blocks)) {
557
- payload.blocks.forEach((block, index) => {
558
- issues.push(...chartTypeWarnings(block, `${pathFor(path, "blocks")}/${index}`, context));
559
- });
560
- }
561
- return issues;
562
- }
563
- function dataIssues(value) {
564
- const out = { errors: [], warnings: [] };
565
- if (!isRecord(value) || !Array.isArray(value.slides)) return out;
566
- const seen = /* @__PURE__ */ new Set();
567
- const add = (diagnostics) => {
568
- for (const diagnostic of diagnostics) {
569
- const key = `${diagnostic.code}|${diagnostic.path}`;
570
- if (seen.has(key)) continue;
571
- seen.add(key);
572
- (diagnostic.severity === "error" ? out.errors : out.warnings).push(semanticIssue(diagnostic.path, diagnostic.message, { code: diagnostic.code }));
573
- }
574
- };
575
- add(datasetDiagnostics(value));
576
- const payload = (node, path) => {
577
- if (isRecord(node.chart)) add(resolveChartData(node.chart, value, { path: pathFor(path, "chart") }).diagnostics);
578
- if (isRecord(node.table)) add(resolveTableData(node.table, value, { path: pathFor(path, "table") }).diagnostics);
579
- };
580
- value.slides.forEach((slide, index) => {
581
- if (!isRecord(slide)) return;
582
- const slidePath = `/slides/${index}`;
583
- payload(slide, slidePath);
584
- visitContentPayloads(slide, slidePath, payload);
585
- });
586
- return out;
587
- }
588
- var cellBorderEdges = ["top", "right", "bottom", "left"];
589
- var variableIdPattern = /^[a-z][a-z0-9-]*$/;
590
- var hexColorPattern = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;
591
- var schemeColorNames = /* @__PURE__ */ new Set([
592
- "accent1",
593
- "accent2",
594
- "accent3",
595
- "accent4",
596
- "accent5",
597
- "accent6",
598
- "dark1",
599
- "dark2",
600
- "light1",
601
- "light2",
602
- "hyperlink",
603
- "followedHyperlink",
604
- "primary",
605
- "secondary",
606
- "accent",
607
- "background",
608
- "surface",
609
- "text",
610
- "textSecondary"
611
- ]);
612
- function variableReferenceWarnings(value) {
613
- if (!Array.isArray(value.slides)) {
614
- return [];
615
- }
616
- const variables = isRecord(value.variables) ? value.variables : {};
617
- const issues = [];
618
- const colorRef = (entry, path) => {
619
- if (typeof entry !== "string" || !entry.startsWith("var:")) return;
620
- const id = entry.slice("var:".length);
621
- if (!variableIdPattern.test(id) || hasOwn(variables, id)) return;
622
- issues.push(semanticIssue(path, `unknown variable '${id}'; declare it in the top-level variables map`, { id }));
623
- };
624
- const runColor = (entry, path) => {
625
- if (typeof entry !== "string") return;
626
- if (hexColorPattern.test(entry) || schemeColorNames.has(entry)) return;
627
- if (entry.startsWith("var:") && variableIdPattern.test(entry.slice("var:".length))) {
628
- colorRef(entry, path);
629
- return;
630
- }
631
- issues.push(semanticIssue(
632
- path,
633
- `run color '${entry}' is not a hex color, a color-scheme name, or a 'var:' reference; renderers fall back to the theme color`,
634
- { color: entry }
635
- ));
636
- };
637
- const richText = (entry, path) => {
638
- if (!Array.isArray(entry)) return;
639
- entry.forEach((run, index) => {
640
- if (isRecord(run)) runColor(run.color, `${path}/${index}/color`);
641
- });
642
- };
643
- const cellStyle = (style, path) => {
644
- if (!isRecord(style)) return;
645
- colorRef(style.fill, pathFor(path, "fill"));
646
- colorRef(style.color, pathFor(path, "color"));
647
- if (!isRecord(style.borders)) return;
648
- const bordersPath = pathFor(path, "borders");
649
- for (const edge of cellBorderEdges) {
650
- const border = style.borders[edge];
651
- if (isRecord(border)) colorRef(border.color, `${pathFor(bordersPath, edge)}/color`);
652
- }
653
- };
654
- const tableCell = (cell, path) => {
655
- if (Array.isArray(cell)) {
656
- richText(cell, path);
657
- return;
658
- }
659
- if (!isRecord(cell)) return;
660
- richText(cell.value, pathFor(path, "value"));
661
- cellStyle(cell.style, pathFor(path, "style"));
662
- };
663
- const table = (node, path) => {
664
- if (!isRecord(node)) return;
665
- if (Array.isArray(node.columns)) {
666
- const columnsPath = pathFor(path, "columns");
667
- node.columns.forEach((column, index) => {
668
- tableCell(column, `${columnsPath}/${index}`);
669
- });
670
- }
671
- if (Array.isArray(node.rows)) {
672
- const rowsPath = pathFor(path, "rows");
673
- node.rows.forEach((row, rowIndex) => {
674
- if (!Array.isArray(row)) return;
675
- row.forEach((cell, cellIndex) => {
676
- tableCell(cell, `${rowsPath}/${rowIndex}/${cellIndex}`);
677
- });
678
- });
679
- }
680
- };
681
- const textEntries = (entries, path) => {
682
- if (!Array.isArray(entries)) return;
683
- entries.forEach((entry, index) => {
684
- const entryPath = `${path}/${index}`;
685
- if (Array.isArray(entry)) {
686
- richText(entry, entryPath);
687
- return;
688
- }
689
- if (!isRecord(entry)) return;
690
- richText(entry.text, pathFor(entryPath, "text"));
691
- richText(entry.description, pathFor(entryPath, "description"));
692
- });
693
- };
694
- const payload = (node, path) => {
695
- richText(node.text, pathFor(path, "text"));
696
- textEntries(node.items, pathFor(path, "items"));
697
- textEntries(node.bullets, pathFor(path, "bullets"));
698
- table(node.table, pathFor(path, "table"));
699
- };
700
- value.slides.forEach((slide, index) => {
701
- if (!isRecord(slide)) return;
702
- const slidePath = `/slides/${index}`;
703
- payload(slide, slidePath);
704
- visitContentPayloads(slide, slidePath, payload);
705
- });
706
- return issues;
707
- }
708
- function presentationReferenceWarnings(value) {
709
- if (!isRecord(value) || !Array.isArray(value.slides)) {
710
- return [];
711
- }
712
- const context = { document: value };
713
- const issues = [];
714
- if (typeof value.narrative === "string") {
715
- pushIfDefined(issues, unknownIdWarning("narratives", value.narrative, "/narrative", context));
716
- }
717
- if (Array.isArray(value.audience)) {
718
- value.audience.forEach((entry, index) => {
719
- pushIfDefined(issues, referenceObjectWarning("audiences", entry, `/audience/${index}`, context));
720
- });
721
- } else {
722
- pushIfDefined(issues, unknownIdWarning("audiences", value.audience, "/audience", context));
723
- }
724
- issues.push(...designReferenceWarnings(value.design, "/design", context));
725
- issues.push(...variableReferenceWarnings(value));
726
- value.slides.forEach((slide, index) => {
727
- if (!isRecord(slide)) {
728
- return;
729
- }
730
- const slidePath = `/slides/${index}`;
731
- issues.push(...designReferenceWarnings(slide.design, pathFor(slidePath, "design"), context));
732
- issues.push(...chartTypeWarnings(slide, slidePath, context));
733
- const numberingWarnings = (payload, path) => {
734
- for (const finding of numberingFindings(payload).warnings) issues.push(semanticIssue(pathFor(path, finding.key), finding.message, finding.params));
735
- };
736
- numberingWarnings(slide, slidePath);
737
- visitContentPayloads(slide, slidePath, numberingWarnings);
738
- for (const key of Object.keys(slide)) {
739
- if (promotedRegionKeySet.has(key)) {
740
- issues.push(...chartTypeWarnings(slide[key], pathFor(slidePath, key), context));
741
- }
742
- }
743
- });
744
- return issues;
745
- }
746
- var catalogCrossLinkFields = {
747
- audience: { recommendedNarratives: "narratives", recommendedTones: "tones" },
748
- purpose: { recommendedNarratives: "narratives", recommendedTones: "tones" },
749
- tone: { recommendedNarratives: "narratives" }
750
- };
751
- function catalogCrossLinkWarnings(schemaName, value) {
752
- const fields = catalogCrossLinkFields[schemaName];
753
- if (!fields || !isRecord(value)) {
754
- return [];
755
- }
756
- const issues = [];
757
- for (const [field, kind] of Object.entries(fields)) {
758
- const links = value[field];
759
- if (!Array.isArray(links)) {
760
- continue;
761
- }
762
- links.forEach((link, index) => {
763
- pushIfDefined(issues, unknownIdWarning(kind, link, `${pathFor("/", field)}/${index}`));
764
- });
765
- }
766
- return issues;
767
- }
768
- function validateLanguageSemantics(value) {
769
- if (!isRecord(value)) {
770
- return [];
771
- }
772
- if (isEnUkTag(value.bcp47)) {
773
- return [semanticIssue("/bcp47", "Use 'en-GB' for UK English; 'en-UK' is not a valid BCP-47 region tag", {
774
- replacement: "en-GB"
775
- })];
776
- }
777
- return [];
778
- }
779
- function contentDepthIssues(value) {
780
- if (!isRecord(value) || !Array.isArray(value.slides)) return [];
781
- const stack = [];
782
- value.slides.forEach((slide, index) => {
783
- if (!isRecord(slide)) return;
784
- if (Array.isArray(slide.blocks)) slide.blocks.forEach((block, i) => {
785
- stack.push({ value: block, path: `/slides/${index}/blocks/${i}`, depth: 0, ancestors: [] });
786
- });
787
- for (const key of promotedRegionKeys) if (hasOwn(slide, key)) stack.push({ value: slide[key], path: `/slides/${index}/${key}`, depth: 0, ancestors: [] });
788
- });
789
- while (stack.length) {
790
- const entry = stack.pop();
791
- if (!isRecord(entry.value) || !Array.isArray(entry.value.blocks)) continue;
792
- if (entry.ancestors.includes(entry.value) || entry.depth >= MAX_COMPOSITION_DEPTH) return [semanticIssue(entry.path, `content groups must be acyclic and nest at most ${MAX_COMPOSITION_DEPTH} levels`)];
793
- const ancestors = [...entry.ancestors, entry.value];
794
- entry.value.blocks.forEach((block, i) => {
795
- stack.push({ value: block, path: `${entry.path}/blocks/${i}`, depth: entry.depth + 1, ancestors });
796
- });
797
- }
798
- return [];
799
- }
800
- var variableTypeList = VARIABLE_KINDS.join(", ");
801
- function variableIssue(id, suffix, keyword, message, params) {
802
- return {
803
- instancePath: `/variables/${id.replaceAll("~", "~0").replaceAll("/", "~1")}${suffix}`,
804
- schemaPath: "#/$defs/Variable/oneOf",
805
- keyword,
806
- params,
807
- message
808
- };
809
- }
810
- function typedVariableErrors(errors, value) {
811
- if (!isRecord(value) || !isRecord(value.variables)) return errors;
812
- if (!errors.some((error) => error.instancePath.startsWith("/variables/"))) return errors;
813
- const variables = value.variables;
814
- const kept = errors.filter((error) => !error.instancePath.startsWith("/variables/"));
815
- const schemaId = schemas.presentation.$id;
816
- for (const [id, entry] of Object.entries(variables)) {
817
- if (typeof entry === "string") {
818
- if (!hexColorPattern.test(entry)) kept.push(variableIssue(id, "", "type", "must be a hex color string or a variable object", {}));
819
- continue;
820
- }
821
- if (!isRecord(entry)) {
822
- kept.push(variableIssue(id, "", "type", "must be a hex color string or a variable object", {}));
823
- continue;
824
- }
825
- const kind = entry.type;
826
- if (typeof kind !== "string" || !VARIABLE_KINDS.includes(kind)) {
827
- kept.push(variableIssue(id, "/type", "enum", `must be one of: ${variableTypeList} (a hex string is shorthand for a color variable)`, { allowedValues: [...VARIABLE_KINDS] }));
828
- continue;
829
- }
830
- const definition = `${kind.charAt(0).toUpperCase()}${kind.slice(1)}Variable`;
831
- const check = getAjv().getSchema(`${schemaId}#/$defs/${definition}`);
832
- if (!check || check(entry) === true) continue;
833
- for (const error of check.errors ?? []) {
834
- kept.push({ ...error, instancePath: `/variables/${id.replaceAll("~", "~0").replaceAll("/", "~1")}${error.instancePath}`, schemaPath: `#/$defs/${definition}${error.schemaPath.replace(/^#/, "")}` });
835
- }
836
- }
837
- return kept;
838
- }
839
- function pointerValue(root, pointer2) {
840
- let current = root;
841
- for (const token of pointer2.split("/").slice(1)) {
842
- const key = token.replaceAll("~1", "/").replaceAll("~0", "~");
843
- if (Array.isArray(current)) current = current[Number(key)];
844
- else if (isRecord(current) && hasOwn(current, key)) current = current[key];
845
- else return void 0;
846
- }
847
- return current;
848
- }
849
- var datasetTableMessage = (field) => `'${field}' is not allowed on a dataset-backed table: it takes its headers, rows and column formats from the dataset`;
850
- function dataUnionErrors(errors, value) {
851
- let kept = errors;
852
- const schemaId = schemas.presentation.$id;
853
- for (const union of errors) {
854
- if (union.keyword !== "oneOf") continue;
855
- const chartData = /\/chart\/data$/.test(union.instancePath) && /\/properties\/data\/oneOf$/.test(union.schemaPath);
856
- const header = /\/table\/columns\/\d+$/.test(union.instancePath) && /\/properties\/columns\/items\/oneOf$/.test(union.schemaPath);
857
- if (!chartData && !header) continue;
858
- const target = pointerValue(value, union.instancePath);
859
- if (!isRecord(target)) continue;
860
- const branch = chartData ? hasOwn(target, "dataset") ? "DatasetRef" : hasOwn(target, "src") ? "ChartDataSource" : hasOwn(target, "rows") ? "ChartData" : void 0 : hasOwn(target, "value") ? "StyledTableCell" : hasOwn(target, "name") ? "DataColumn" : void 0;
861
- const check = branch ? getAjv().getSchema(`${schemaId}#/$defs/${branch}`) : void 0;
862
- if (!check || check(target) === true) continue;
863
- const branchErrors = (check.errors ?? []).map((error) => ({ ...error, instancePath: `${union.instancePath}${error.instancePath}`, schemaPath: `#/$defs/${branch}${error.schemaPath.replace(/^#/, "")}` }));
864
- const prefix = `${union.instancePath}/`;
865
- kept = [...kept.filter((error) => error.instancePath !== union.instancePath && !error.instancePath.startsWith(prefix)), ...branchErrors];
866
- }
867
- const exclusions = kept.filter((error) => error.keyword === "false schema" && /\/table\/(rows|columns|fields)$/.test(error.instancePath) && /\/(then|else)\/properties\/(rows|columns|fields)\//.test(`${error.schemaPath}/`));
868
- if (!exclusions.length) return kept;
869
- const tables = new Set(exclusions.map((error) => error.instancePath.replace(/\/[^/]+$/, "")));
870
- return kept.filter((error) => !(error.keyword === "if" && tables.has(error.instancePath))).map((error) => {
871
- if (!exclusions.includes(error)) return error;
872
- const field = error.instancePath.slice(error.instancePath.lastIndexOf("/") + 1);
873
- return { ...error, message: field === "fields" ? "'fields' applies only to a dataset-backed table; add 'dataset' or remove 'fields'" : datasetTableMessage(field) };
874
- });
875
- }
876
- function validate(value, schemaOrKind = "presentation", options = {}) {
877
- const resolved = resolveValidator(schemaOrKind);
878
- if (resolved.schemaName === "presentation") {
879
- const errors2 = contentDepthIssues(value);
880
- if (errors2.length) return { valid: false, errors: errors2, warnings: [], schemaName: resolved.schemaName };
881
- }
882
- const variableIssues = { errors: [], warnings: [] };
883
- let subject = value;
884
- let template;
885
- let unfilledVariables;
886
- if (resolved.schemaName === "presentation" && isRecord(value) && (hasContentVariables(value) || options.values !== void 0 || options.template !== void 0)) {
887
- template = options.template ?? isTemplate(value);
888
- const view = instantiateForValidation(value, options.values ?? {}, template);
889
- subject = view.presentation;
890
- unfilledVariables = view.unfilled;
891
- for (const entry of view.diagnostics) {
892
- if (entry.code === "variable-example-used" || entry.code === "variable-rich-flattened" || entry.code === "variable-unfilled") continue;
893
- const issue2 = semanticIssue(entry.path, entry.message, { id: entry.id, code: entry.code });
894
- (entry.severity === "error" ? variableIssues.errors : variableIssues.warnings).push(issue2);
895
- }
896
- if (!template) {
897
- const declared = isRecord(value.variables) ? value.variables : {};
898
- for (const id of view.unfilled) {
899
- if (isRecord(declared[id]) && declared[id].value !== void 0) continue;
900
- variableIssues.errors.push(semanticIssue(`/variables/${id}`, `required variable '${id}' has no value; give it a value, fill it before use, or mark the document as a template ("template": true)`, { id, code: "variable-unfilled" }));
901
- }
902
- }
903
- }
904
- const valid = resolved.validate(subject) === true;
905
- const ajvErrors = valid ? [] : typedVariableErrors(resolved.validate.errors ?? [], subject);
906
- const errors = (resolved.schemaName === "presentation" ? dataUnionErrors(ajvErrors, subject) : ajvErrors).map(toIssue);
907
- const warnings = [];
908
- if (resolved.schemaName === "presentation") {
909
- errors.push(...validatePresentationSemantics(subject));
910
- errors.push(...variableIssues.errors);
911
- const data = dataIssues(subject);
912
- errors.push(...data.errors);
913
- warnings.push(...presentationReferenceWarnings(subject));
914
- warnings.push(...data.warnings);
915
- warnings.push(...variableIssues.warnings);
916
- } else if (resolved.schemaName === "language") {
917
- errors.push(...validateLanguageSemantics(value));
918
- }
919
- if (resolved.schemaName) {
920
- warnings.push(...catalogCrossLinkWarnings(resolved.schemaName, value));
921
- }
922
- return {
923
- valid: errors.length === 0,
924
- errors,
925
- warnings,
926
- schemaName: resolved.schemaName,
927
- catalogKind: resolved.catalogKind,
928
- ...template !== void 0 ? { template, unfilledVariables } : {}
929
- };
930
- }
931
- function assertValid(value, schemaOrKind = "presentation", options = {}) {
932
- const result = validate(value, schemaOrKind, options);
933
- if (!result.valid) {
934
- throw new OPFValidationError(result);
935
- }
936
- return value;
937
- }
938
- function validatePresentation(value, options = {}) {
939
- return validate(value, "presentation", options);
940
- }
941
- function assertValidPresentation(value, options = {}) {
942
- assertValid(value, "presentation", options);
943
- }
944
- function validateCatalogRecord(kind, value) {
945
- return validate(value, kind);
946
- }
947
- function assertValidCatalogRecord(kind, value) {
948
- assertValid(value, kind);
949
- }
950
-
951
- export { OPFValidationError, assertValid, assertValidCatalogRecord, assertValidPresentation, unusedReferenceWarnings, validate, validateCatalogRecord, validatePresentation, validationDefinition };