@opengeni/artifact-tool 0.2.2

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 (203) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +104 -0
  3. package/dist/bounded-zip.d.ts +28 -0
  4. package/dist/chunk-4BSENMAE.js +39 -0
  5. package/dist/chunk-4BSENMAE.js.map +1 -0
  6. package/dist/chunk-4FRFNNBM.js +276 -0
  7. package/dist/chunk-4FRFNNBM.js.map +1 -0
  8. package/dist/chunk-5XIA6KHZ.js +49 -0
  9. package/dist/chunk-5XIA6KHZ.js.map +1 -0
  10. package/dist/chunk-66CT2ZRP.js +2229 -0
  11. package/dist/chunk-66CT2ZRP.js.map +1 -0
  12. package/dist/chunk-72SYDU4O.js +319 -0
  13. package/dist/chunk-72SYDU4O.js.map +1 -0
  14. package/dist/chunk-B2ZJRZDA.js +279 -0
  15. package/dist/chunk-B2ZJRZDA.js.map +1 -0
  16. package/dist/chunk-DCTLTNPW.js +2458 -0
  17. package/dist/chunk-DCTLTNPW.js.map +1 -0
  18. package/dist/chunk-FGZM4FQ6.js +473 -0
  19. package/dist/chunk-FGZM4FQ6.js.map +1 -0
  20. package/dist/chunk-HTJBLBDE.js +591 -0
  21. package/dist/chunk-HTJBLBDE.js.map +1 -0
  22. package/dist/chunk-IYFXZQ34.js +5306 -0
  23. package/dist/chunk-IYFXZQ34.js.map +1 -0
  24. package/dist/chunk-J6N7IR44.js +172 -0
  25. package/dist/chunk-J6N7IR44.js.map +1 -0
  26. package/dist/chunk-N2IHNWBS.js +1002 -0
  27. package/dist/chunk-N2IHNWBS.js.map +1 -0
  28. package/dist/chunk-NAG44K67.js +549 -0
  29. package/dist/chunk-NAG44K67.js.map +1 -0
  30. package/dist/chunk-O24KTEGP.js +33 -0
  31. package/dist/chunk-O24KTEGP.js.map +1 -0
  32. package/dist/chunk-PI2AZVGK.js +2074 -0
  33. package/dist/chunk-PI2AZVGK.js.map +1 -0
  34. package/dist/chunk-Q2FFHEY7.js +40 -0
  35. package/dist/chunk-Q2FFHEY7.js.map +1 -0
  36. package/dist/chunk-RBGQADXA.js +57 -0
  37. package/dist/chunk-RBGQADXA.js.map +1 -0
  38. package/dist/chunk-U5G2BKM2.js +613 -0
  39. package/dist/chunk-U5G2BKM2.js.map +1 -0
  40. package/dist/chunk-VOJHMSM3.js +39 -0
  41. package/dist/chunk-VOJHMSM3.js.map +1 -0
  42. package/dist/chunk-VUNV25KB.js +16 -0
  43. package/dist/chunk-VUNV25KB.js.map +1 -0
  44. package/dist/chunk-XIFUNVBO.js +101 -0
  45. package/dist/chunk-XIFUNVBO.js.map +1 -0
  46. package/dist/chunk-ZCJYRJGB.js +489 -0
  47. package/dist/chunk-ZCJYRJGB.js.map +1 -0
  48. package/dist/chunk-ZZXPEE4S.js +2260 -0
  49. package/dist/chunk-ZZXPEE4S.js.map +1 -0
  50. package/dist/document-docx-api.d.ts +49 -0
  51. package/dist/document-docx-codec.d.ts +9 -0
  52. package/dist/document-docx-codec.js +4765 -0
  53. package/dist/document-docx-codec.js.map +1 -0
  54. package/dist/document-docx-import.d.ts +261 -0
  55. package/dist/document-docx-packer.d.ts +18 -0
  56. package/dist/document-docx-state.d.ts +12 -0
  57. package/dist/document-render.d.ts +3 -0
  58. package/dist/document-render.js +492 -0
  59. package/dist/document-render.js.map +1 -0
  60. package/dist/document.d.ts +432 -0
  61. package/dist/document.js +37 -0
  62. package/dist/document.js.map +1 -0
  63. package/dist/errors.d.ts +23 -0
  64. package/dist/file-blob.d.ts +11 -0
  65. package/dist/index.d.ts +4 -0
  66. package/dist/index.js +186 -0
  67. package/dist/index.js.map +1 -0
  68. package/dist/inspection.d.ts +12 -0
  69. package/dist/kernel.d.ts +101 -0
  70. package/dist/lib-GQLPACFK.js +9746 -0
  71. package/dist/lib-GQLPACFK.js.map +1 -0
  72. package/dist/materializer-cli-entry.d.ts +2 -0
  73. package/dist/materializer-cli-entry.js +29 -0
  74. package/dist/materializer-cli-entry.js.map +1 -0
  75. package/dist/materializer-cli.d.ts +24 -0
  76. package/dist/materializer-cli.js +24 -0
  77. package/dist/materializer-cli.js.map +1 -0
  78. package/dist/native-raster.d.ts +10 -0
  79. package/dist/native.d.ts +129 -0
  80. package/dist/native.js +31 -0
  81. package/dist/native.js.map +1 -0
  82. package/dist/office-import.d.ts +48 -0
  83. package/dist/office-import.js +154 -0
  84. package/dist/office-import.js.map +1 -0
  85. package/dist/presentation-pptx-api.d.ts +60 -0
  86. package/dist/presentation-pptx-import.d.ts +5 -0
  87. package/dist/presentation-pptx-state-digest-765CZZED.js +10 -0
  88. package/dist/presentation-pptx-state-digest-765CZZED.js.map +1 -0
  89. package/dist/presentation-pptx-state-digest.d.ts +3 -0
  90. package/dist/presentation-pptx-state.d.ts +4 -0
  91. package/dist/presentation-pptx-xml.d.ts +29 -0
  92. package/dist/presentation-pptx.d.ts +5 -0
  93. package/dist/presentation-pptx.js +2365 -0
  94. package/dist/presentation-pptx.js.map +1 -0
  95. package/dist/presentation-render.d.ts +29 -0
  96. package/dist/presentation-render.js +375 -0
  97. package/dist/presentation-render.js.map +1 -0
  98. package/dist/presentation.d.ts +565 -0
  99. package/dist/presentation.js +71 -0
  100. package/dist/presentation.js.map +1 -0
  101. package/dist/production-composite.d.ts +68 -0
  102. package/dist/production-document.d.ts +2 -0
  103. package/dist/production-document.js +176 -0
  104. package/dist/production-document.js.map +1 -0
  105. package/dist/production-native-codecs.d.ts +94 -0
  106. package/dist/production-presentation.d.ts +2 -0
  107. package/dist/production-presentation.js +176 -0
  108. package/dist/production-presentation.js.map +1 -0
  109. package/dist/production-sha256.d.ts +2 -0
  110. package/dist/production-spreadsheet-native.d.ts +12 -0
  111. package/dist/production-spreadsheet.d.ts +2 -0
  112. package/dist/production-spreadsheet.js +176 -0
  113. package/dist/production-spreadsheet.js.map +1 -0
  114. package/dist/production.d.ts +96 -0
  115. package/dist/raster-image.d.ts +34 -0
  116. package/dist/reference.d.ts +17 -0
  117. package/dist/reference.js +574 -0
  118. package/dist/reference.js.map +1 -0
  119. package/dist/runtime-cli-entry.d.ts +2 -0
  120. package/dist/runtime-cli-entry.js +21 -0
  121. package/dist/runtime-cli-entry.js.map +1 -0
  122. package/dist/runtime-cli.d.ts +76 -0
  123. package/dist/runtime-cli.js +26 -0
  124. package/dist/runtime-cli.js.map +1 -0
  125. package/dist/runtime-development.d.ts +73 -0
  126. package/dist/runtime-development.js +30 -0
  127. package/dist/runtime-development.js.map +1 -0
  128. package/dist/runtime-receipt.d.ts +19 -0
  129. package/dist/runtime.d.ts +355 -0
  130. package/dist/runtime.js +42 -0
  131. package/dist/runtime.js.map +1 -0
  132. package/dist/snapshot.d.ts +26 -0
  133. package/dist/snapshot.js +61 -0
  134. package/dist/snapshot.js.map +1 -0
  135. package/dist/spreadsheet-address.d.ts +18 -0
  136. package/dist/spreadsheet-file.d.ts +17 -0
  137. package/dist/spreadsheet-formula.d.ts +67 -0
  138. package/dist/spreadsheet-image.d.ts +17 -0
  139. package/dist/spreadsheet-render.d.ts +5 -0
  140. package/dist/spreadsheet-render.js +752 -0
  141. package/dist/spreadsheet-render.js.map +1 -0
  142. package/dist/spreadsheet-types.d.ts +155 -0
  143. package/dist/spreadsheet-xlsx-api.d.ts +88 -0
  144. package/dist/spreadsheet-xlsx-codec.d.ts +16 -0
  145. package/dist/spreadsheet-xlsx-codec.js +16 -0
  146. package/dist/spreadsheet-xlsx-codec.js.map +1 -0
  147. package/dist/spreadsheet-xlsx-state.d.ts +16 -0
  148. package/dist/spreadsheet.d.ts +724 -0
  149. package/dist/spreadsheet.js +67 -0
  150. package/dist/spreadsheet.js.map +1 -0
  151. package/package.json +129 -0
  152. package/src/bounded-zip.ts +450 -0
  153. package/src/document-docx-api.ts +64 -0
  154. package/src/document-docx-codec.ts +2253 -0
  155. package/src/document-docx-import.ts +3814 -0
  156. package/src/document-docx-packer.ts +72 -0
  157. package/src/document-docx-state.ts +59 -0
  158. package/src/document-render.ts +615 -0
  159. package/src/document.ts +2800 -0
  160. package/src/errors.ts +45 -0
  161. package/src/file-blob.ts +43 -0
  162. package/src/index.ts +4 -0
  163. package/src/inspection.ts +50 -0
  164. package/src/kernel.ts +525 -0
  165. package/src/materializer-cli-entry.ts +11 -0
  166. package/src/materializer-cli.ts +743 -0
  167. package/src/native-raster.ts +141 -0
  168. package/src/native.ts +390 -0
  169. package/src/office-import.ts +243 -0
  170. package/src/presentation-pptx-api.ts +107 -0
  171. package/src/presentation-pptx-import.ts +2065 -0
  172. package/src/presentation-pptx-state-digest.ts +46 -0
  173. package/src/presentation-pptx-state.ts +18 -0
  174. package/src/presentation-pptx-xml.ts +473 -0
  175. package/src/presentation-pptx.ts +447 -0
  176. package/src/presentation-render.ts +532 -0
  177. package/src/presentation.ts +2599 -0
  178. package/src/production-composite.ts +805 -0
  179. package/src/production-document.ts +2 -0
  180. package/src/production-native-codecs.ts +1141 -0
  181. package/src/production-presentation.ts +2 -0
  182. package/src/production-sha256.ts +150 -0
  183. package/src/production-spreadsheet-native.ts +686 -0
  184. package/src/production-spreadsheet.ts +2 -0
  185. package/src/production.ts +1022 -0
  186. package/src/raster-image.ts +586 -0
  187. package/src/reference.ts +17 -0
  188. package/src/runtime-cli-entry.ts +13 -0
  189. package/src/runtime-cli.ts +670 -0
  190. package/src/runtime-development.ts +689 -0
  191. package/src/runtime-receipt.ts +169 -0
  192. package/src/runtime.ts +1463 -0
  193. package/src/snapshot.ts +88 -0
  194. package/src/spreadsheet-address.ts +90 -0
  195. package/src/spreadsheet-file.ts +71 -0
  196. package/src/spreadsheet-formula.ts +1212 -0
  197. package/src/spreadsheet-image.ts +242 -0
  198. package/src/spreadsheet-render.ts +985 -0
  199. package/src/spreadsheet-types.ts +171 -0
  200. package/src/spreadsheet-xlsx-api.ts +123 -0
  201. package/src/spreadsheet-xlsx-codec.ts +3063 -0
  202. package/src/spreadsheet-xlsx-state.ts +191 -0
  203. package/src/spreadsheet.ts +5195 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/presentation-pptx-state.ts","../src/presentation-pptx-api.ts","../src/presentation.ts"],"sourcesContent":["import type { Presentation } from \"./presentation\";\nimport type { PresentationLossPreservationEnvelope } from \"./presentation-pptx-api\";\n\nconst lossState = new WeakMap<Presentation, PresentationLossPreservationEnvelope>();\n\nexport function presentationLossState(\n presentation: Presentation,\n): PresentationLossPreservationEnvelope | undefined {\n return lossState.get(presentation);\n}\n\nexport function setPresentationLossState(\n presentation: Presentation,\n envelope: PresentationLossPreservationEnvelope | undefined,\n): void {\n if (envelope) lossState.set(presentation, envelope);\n else lossState.delete(presentation);\n}\n","export const PPTX_MEDIA_TYPE =\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation\" as const;\n\nexport type PresentationPptxFeature =\n | \"animation\"\n | \"audio\"\n | \"custom-geometry\"\n | \"connector\"\n | \"embedded-object\"\n | \"group\"\n | \"hyperlink\"\n | \"master\"\n | \"layout\"\n | \"media\"\n | \"placeholder\"\n | \"source-only\"\n | \"smart-art\"\n | \"table-style\"\n | \"theme\"\n | \"transition\"\n | \"unsupported-chart\"\n | \"video\";\n\nexport type PresentationFidelityIssue = {\n code:\n | \"content-preserved-in-source\"\n | \"content-will-be-discarded\"\n | \"group-will-be-flattened\"\n | \"style-approximated\";\n severity: \"warning\" | \"error\";\n feature: PresentationPptxFeature;\n message: string;\n parts?: readonly string[];\n};\n\nexport type PresentationPptxImportLimits = {\n compressedBytes: number;\n expandedBytes: number;\n entryBytes: number;\n entries: number;\n compressionRatio: number;\n totalXmlBytes: number;\n xmlBytes: number;\n xmlDepth: number;\n xmlNodes: number;\n xmlAttributesPerElement: number;\n relationshipsPerPart: number;\n relationships: number;\n slides: number;\n elements: number;\n textCharacters: number;\n imageBytes: number;\n chartPoints: number;\n nestedPackageBytes: number;\n nestedExpandedBytes: number;\n nestedEntries: number;\n retainedBytes: number;\n};\n\nexport type PresentationPptxImportOptions = {\n /** Preserve unsupported, inert content in the original package or reject it. */\n unsupportedContent?: \"preserve\" | \"error\";\n /** Every limit is applied before or while allocating decoded package state. */\n limits?: Partial<PresentationPptxImportLimits>;\n};\n\nexport type PresentationPptxExportOptions = {\n fileName?: string;\n /** Explicitly acknowledge content the editable model cannot regenerate. */\n unsupportedContent?: \"error\" | \"discard\";\n};\n\nexport type PresentationLossPreservationEnvelope = {\n version: 1;\n mediaType: typeof PPTX_MEDIA_TYPE;\n sourceBytes: Uint8Array;\n sourceDigest: string;\n unsupportedParts: readonly string[];\n modelDigest: string;\n};\n\nexport class PresentationFidelityError extends Error {\n readonly issues: readonly PresentationFidelityIssue[];\n\n constructor(message: string, issues: readonly PresentationFidelityIssue[]) {\n super(message);\n this.name = \"PresentationFidelityError\";\n this.issues = issues;\n }\n}\n\nexport class PresentationSecurityError extends Error {\n constructor(\n message: string,\n readonly code:\n | \"active-content\"\n | \"encrypted-content\"\n | \"external-relationship\"\n | \"invalid-package\"\n | \"limit-exceeded\"\n | \"unsafe-xml\",\n readonly entryName?: string,\n ) {\n super(message);\n this.name = \"PresentationSecurityError\";\n }\n}\n","import { FileBlob } from \"./file-blob\";\nimport { boundInspectionRecords, defineHelpEntries, filterHelpEntries } from \"./inspection\";\nimport type { HelpOptions } from \"./spreadsheet-types\";\nimport { presentationLossState } from \"./presentation-pptx-state\";\nimport {\n canonicalizeRasterDataUrl,\n encodeRasterBase64,\n normalizeRasterContentType,\n RasterImageValidationError,\n validateRasterImageBytes,\n} from \"./raster-image\";\nexport {\n PPTX_MEDIA_TYPE,\n PresentationFidelityError,\n PresentationSecurityError,\n type PresentationFidelityIssue,\n type PresentationLossPreservationEnvelope,\n type PresentationPptxExportOptions,\n type PresentationPptxFeature,\n type PresentationPptxImportLimits,\n type PresentationPptxImportOptions,\n} from \"./presentation-pptx-api\";\nimport type {\n PresentationFidelityIssue,\n PresentationLossPreservationEnvelope,\n PresentationPptxExportOptions,\n PresentationPptxImportOptions,\n} from \"./presentation-pptx-api\";\n\nexport type PresentationPosition = {\n left: number;\n top: number;\n width: number;\n height: number;\n};\n\nexport type PresentationFill = string | { type?: \"solid\"; color: string };\n\nexport type PresentationLine = {\n style?: \"solid\" | \"dash\" | \"dot\" | \"none\";\n fill?: PresentationFill;\n width?: number;\n};\n\nexport type PresentationTextStyle = {\n fontFamily?: string;\n fontSize?: number;\n bold?: boolean;\n italic?: boolean;\n underline?: boolean;\n color?: string;\n alignment?: \"left\" | \"center\" | \"right\" | \"justify\";\n verticalAlignment?: \"top\" | \"middle\" | \"bottom\";\n};\n\nexport type PresentationShapeGeometry =\n | \"textbox\"\n | \"rect\"\n | \"roundRect\"\n | \"ellipse\"\n | \"triangle\"\n | \"rightArrow\"\n | \"line\";\n\nexport type PresentationShapeConfig = {\n geometry: PresentationShapeGeometry;\n name?: string;\n position?: Partial<PresentationPosition>;\n fill?: PresentationFill;\n line?: PresentationLine;\n text?: string;\n textStyle?: PresentationTextStyle;\n rotation?: number;\n borderRadius?: number | string;\n placeholder?: { type: string; index?: number };\n};\n\nexport type PresentationChartType =\n | \"bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"doughnut\"\n | \"scatter\"\n | \"bubble\"\n | \"radar\";\n\nexport type PresentationChartSeriesConfig = {\n name: string;\n categories?: string[];\n values?: number[];\n xValues?: number[];\n bubbleSizes?: number[];\n fill?: PresentationFill;\n line?: PresentationLine;\n};\n\nexport type PresentationChartConfig = {\n name?: string;\n position?: Partial<PresentationPosition>;\n title?: string;\n categories?: string[];\n series?: PresentationChartSeriesConfig[];\n hasLegend?: boolean;\n legend?: { position?: \"left\" | \"top\" | \"topRight\" | \"right\" | \"bottom\"; overlay?: boolean };\n xAxis?: { visible?: boolean; title?: string; min?: number; max?: number };\n yAxis?: { visible?: boolean; title?: string; min?: number; max?: number };\n dataLabels?: {\n showValue?: boolean;\n showSeriesName?: boolean;\n showCategoryName?: boolean;\n showPercent?: boolean;\n position?: \"center\" | \"inEnd\" | \"outEnd\";\n };\n};\n\nexport type PresentationTableCellConfig = {\n text: string;\n fill?: PresentationFill;\n textStyle?: PresentationTextStyle;\n rowSpan?: number;\n colSpan?: number;\n};\n\nexport type PresentationTableCellInput = string | PresentationTableCellConfig | null;\n\nexport type PresentationTableConfig = {\n name?: string;\n position?: Partial<PresentationPosition>;\n /** null marks a grid position covered by an earlier rowSpan/colSpan anchor. */\n rows: ReadonlyArray<ReadonlyArray<PresentationTableCellInput>>;\n columnWidths?: readonly number[];\n rowHeights?: readonly number[];\n fill?: PresentationFill;\n line?: PresentationLine;\n textStyle?: PresentationTextStyle;\n};\n\nexport type PresentationGroupChildConfig =\n | { kind: \"shape\"; config: PresentationShapeConfig }\n | { kind: \"chart\"; type: PresentationChartType; config?: PresentationChartConfig }\n | { kind: \"image\"; config: PresentationImageConfig }\n | { kind: \"table\"; config: PresentationTableConfig }\n | { kind: \"group\"; config: PresentationGroupConfig };\n\nexport type PresentationGroupConfig = {\n name?: string;\n position?: Partial<PresentationPosition>;\n childOffset?: { left: number; top: number };\n childExtent?: { width: number; height: number };\n rotation?: number;\n flipHorizontal?: boolean;\n flipVertical?: boolean;\n children?: readonly PresentationGroupChildConfig[];\n};\n\nexport type PresentationTemplateElement = Exclude<PresentationGroupChildConfig, { kind: \"group\" }>;\n\nexport type PresentationMasterConfig = {\n name?: string;\n background?: PresentationFill;\n elements?: readonly PresentationTemplateElement[];\n};\n\nexport type PresentationLayoutConfig = PresentationMasterConfig & {\n masterId?: string;\n /** Skill-compatible alias for masterId. */\n parentLayoutId?: string;\n};\n\ntype ConcreteImageSource =\n | { blob: ArrayBuffer | Uint8Array; dataUrl?: never; uri?: never }\n | { dataUrl: string; blob?: never; uri?: never }\n | { uri: string; blob?: never; dataUrl?: never };\n\nexport type PresentationRasterImageContentType =\n | \"image/png\"\n | \"image/jpeg\"\n | \"image/gif\"\n | \"image/webp\";\n\nexport type PresentationImageResolution = {\n blob: ArrayBuffer | Uint8Array;\n contentType?: PresentationRasterImageContentType;\n};\n\nexport type PresentationImageResolver = (reference: {\n uri: string;\n imageId: string;\n name: string;\n}) => Promise<PresentationImageResolution> | PresentationImageResolution;\n\nexport type PresentationCreateOptions = {\n slideSize?: { width: number; height: number };\n /** Host-owned resolver; it is invoked only by an explicit image.resolveUri() call. */\n imageResolver?: PresentationImageResolver;\n /** URI schemes the host resolver owns, for example `[\"asset\"]`. Empty by default. */\n allowedImageUriSchemes?: readonly string[];\n};\n\nexport type PresentationImageConfig =\n | (ConcreteImageSource & PresentationImageMetadata)\n | ({ prompt: string; blob?: never; dataUrl?: never; uri?: never } & PresentationImageMetadata);\n\ntype PresentationImageMetadata = {\n name?: string;\n prompt?: string;\n contentType?: string;\n alt?: string;\n fit?: \"contain\" | \"cover\";\n position?: Partial<PresentationPosition>;\n frame?: Partial<PresentationPosition>;\n crop?: { left: number; top: number; right: number; bottom: number };\n geometry?: \"rect\" | \"roundRect\" | \"ellipse\";\n borderRadius?: number | string;\n rotation?: number;\n flipHorizontal?: boolean;\n flipVertical?: boolean;\n lockAspectRatio?: boolean;\n};\n\nexport type PresentationInspectOptions = {\n target?: { id: string; beforeLines?: number; afterLines?: number };\n kind?: string;\n include?: string;\n exclude?: string;\n search?: string;\n maxChars?: number;\n};\n\nexport type PresentationInspectResult = {\n ndjson: string;\n records: Array<Record<string, unknown>>;\n truncated: boolean;\n};\n\nexport type PresentationResolvedObject =\n | Presentation\n | Slide\n | PresentationShape\n | PresentationChart\n | PresentationImage\n | PresentationTable\n | PresentationGroup\n | PresentationMaster\n | PresentationLayout;\n\nexport type PresentationElement =\n | PresentationShape\n | PresentationChart\n | PresentationImage\n | PresentationTable\n | PresentationGroup;\n\nexport type PresentationExportOptions = {\n slide?: Slide;\n format: \"svg\" | \"png\" | \"layout\" | \"webp\";\n scale?: number;\n montage?: boolean;\n columns?: number;\n gap?: number;\n};\n\nexport class UnsupportedPresentationFeatureError extends Error {\n readonly code = \"UNSUPPORTED_PRESENTATION_FEATURE\";\n\n constructor(feature: string, detail?: string) {\n super(`Unsupported presentation feature: ${feature}${detail ? `. ${detail}` : \"\"}`);\n this.name = \"UnsupportedPresentationFeatureError\";\n }\n}\n\n/** Untrusted presentation input was rejected before reaching a renderer or file codec. */\nexport class InvalidPresentationInputError extends Error {\n readonly code = \"INVALID_PRESENTATION_INPUT\";\n\n constructor(\n readonly field: string,\n detail: string,\n ) {\n super(`Invalid presentation ${field}: ${detail}`);\n this.name = \"InvalidPresentationInputError\";\n }\n}\n\nconst PRESENTATION_HELP_ENTRIES = defineHelpEntries([\n [\"Presentation.create\", \"Create editable deck\", \"Presentation.create()\"],\n [\"deck.slides.add\", \"Add slide\", \"deck.slides.add()\"],\n [\n \"slide.shapes.add\",\n \"Add positioned text or shape\",\n 'slide.shapes.add({ geometry: \"textbox\", text, position })',\n ],\n [\n \"slide.charts.add\",\n \"Add chart data\",\n 'slide.charts.add(\"bar\", { categories, series: [{ name, values }] })',\n ],\n [\"slide.tables.add\", \"Add table\", \"slide.tables.add({ rows, position })\"],\n [\"slide.images.add\", \"Add image\", \"slide.images.add({ dataUrl, name, position })\"],\n [\n \"deck.inspect\",\n \"Inspect deck records\",\n 'await deck.inspect({ kind: \"slide,textbox,chart,table\" })',\n ],\n [\n \"deck.export\",\n \"Export SVG, PNG, WebP, or layout\",\n 'await deck.export({ format: \"png\", montage: true })',\n ],\n [\n \"PresentationFile.importPptx\",\n \"Import editable PPTX\",\n \"await PresentationFile.importPptx(blob)\",\n ],\n [\"PresentationFile.exportPptx\", \"Export PPTX\", \"await PresentationFile.exportPptx(deck)\"],\n]);\n\n/**\n * Skill-compatible TypeScript reference presentation. Native production\n * presentation editing remains unsupported and must fail closed until the\n * Rust modality is feature-complete.\n */\nexport class Presentation {\n readonly slides: SlideCollection;\n readonly masters: PresentationMasterCollection;\n readonly layouts: PresentationLayoutCollection;\n readonly slideSize: { width: number; height: number };\n private readonly objects = new Map<string, unknown>();\n private readonly imageResolver: PresentationImageResolver | undefined;\n private readonly allowedImageUriSchemes: ReadonlySet<string>;\n private nextId = 1;\n\n private constructor(options: PresentationCreateOptions = {}) {\n this.slideSize = options.slideSize ?? { width: 1280, height: 720 };\n validatePosition(\n { left: 0, top: 0, width: this.slideSize.width, height: this.slideSize.height },\n \"slideSize\",\n );\n this.imageResolver = options.imageResolver;\n this.allowedImageUriSchemes = validateImageUriPolicy(\n options.imageResolver,\n options.allowedImageUriSchemes,\n );\n this.slides = new SlideCollection(this);\n this.masters = new PresentationMasterCollection(this);\n this.layouts = new PresentationLayoutCollection(this);\n this.register(\"pr\", this);\n }\n\n static create(options: PresentationCreateOptions = {}): Presentation {\n return new Presentation(options);\n }\n\n assertImageUriAccepted(uri: string): void {\n assertSafeText(uri, \"image uri\", MAX_IMAGE_URI_LENGTH);\n const scheme = imageUriScheme(uri);\n if (!this.imageResolver || !this.allowedImageUriSchemes.has(scheme)) {\n throw new InvalidPresentationInputError(\n \"image uri\",\n \"requires an injected resolver and an explicitly allowed URI scheme\",\n );\n }\n }\n\n async resolveImageUri(reference: {\n uri: string;\n imageId: string;\n name: string;\n }): Promise<PresentationImageResolution> {\n this.assertImageUriAccepted(reference.uri);\n if (!this.imageResolver) {\n throw new InvalidPresentationInputError(\"image resolver\", \"is not configured\");\n }\n return await this.imageResolver(reference);\n }\n\n allocateId(\n prefix: \"sl\" | \"sh\" | \"ch\" | \"im\" | \"tb\" | \"gp\" | \"mt\" | \"ly\",\n value: unknown,\n ): string {\n return this.register(prefix, value);\n }\n\n resolve<T extends PresentationResolvedObject = PresentationResolvedObject>(id: string): T {\n const value = this.objects.get(id);\n if (value === undefined) throw new Error(`Unknown presentation object id: ${id}`);\n return value as T;\n }\n\n async inspect(options: PresentationInspectOptions = {}): Promise<PresentationInspectResult> {\n const requested = new Set(\n (options.kind ?? \"deck,master,layout,slide,textbox,shape,image,chart,table,group,notes\")\n .split(\",\")\n .map((value) => value.trim())\n .filter(Boolean)\n .map((value) => (value === \"comments\" ? \"thread\" : value)),\n );\n const records: Array<Record<string, unknown>> = [];\n if (requested.has(\"deck\")) {\n records.push({\n kind: \"deck\",\n id: \"pr/1\",\n slides: this.slides.items.length,\n width: this.slideSize.width,\n height: this.slideSize.height,\n });\n }\n if (requested.has(\"master\")) {\n for (const master of this.masters.items) records.push(master.inspectRecord());\n }\n if (requested.has(\"layout\")) {\n for (const layout of this.layouts.items) records.push(layout.inspectRecord());\n }\n for (const [index, slide] of this.slides.items.entries()) {\n if (requested.has(\"slide\")) records.push(slide.inspectRecord(index));\n for (const shape of slide.shapes.items) {\n const kind = shape.geometry === \"textbox\" ? \"textbox\" : \"shape\";\n if (requested.has(kind) || (kind === \"textbox\" && requested.has(\"shape\"))) {\n records.push(shape.inspectRecord(index));\n }\n }\n if (requested.has(\"chart\")) {\n for (const chart of slide.charts.items) records.push(chart.inspectRecord(index));\n }\n if (requested.has(\"image\")) {\n for (const image of slide.images.items) records.push(image.inspectRecord(index));\n }\n if (requested.has(\"table\")) {\n for (const table of slide.tables.items) records.push(table.inspectRecord(index));\n }\n if (requested.has(\"group\")) {\n for (const group of slide.groups.items) records.push(group.inspectRecord(index));\n }\n if (requested.has(\"notes\") && slide.notes.toString().length > 0) {\n records.push({\n kind: \"notes\",\n id: `${slide.id}/notes`,\n slide: index + 1,\n text: slide.notes.toString(),\n });\n }\n }\n\n const search = options.search?.toLocaleLowerCase();\n let filtered = search\n ? records.filter((record) => JSON.stringify(record).toLocaleLowerCase().includes(search))\n : records;\n if (options.target) filtered = filtered.filter((record) => record.id === options.target!.id);\n filtered = filtered.map((record) => projectRecord(record, options.include, options.exclude));\n return boundPresentationRecords(filtered, options.maxChars ?? 20_000);\n }\n\n help(query: string, options: HelpOptions = {}): PresentationInspectResult {\n if (typeof query !== \"string\") {\n throw new InvalidPresentationInputError(\"help query\", \"must be a string\");\n }\n const records = filterHelpEntries(PRESENTATION_HELP_ENTRIES, query, options.search);\n return boundPresentationRecords(records, options.maxChars ?? 6_000);\n }\n\n async export(options: PresentationExportOptions): Promise<FileBlob> {\n if (!options || typeof options !== \"object\") {\n throw new InvalidPresentationInputError(\"export options\", \"must be an object\");\n }\n if (!([\"svg\", \"png\", \"layout\", \"webp\"] as const).includes(options.format)) {\n throw new InvalidPresentationInputError(\"export format\", \"is not supported\");\n }\n validatePresentation(this, options.format !== \"layout\");\n if (options.format === \"layout\") {\n if (options.slide) {\n this.assertOwns(options.slide);\n return jsonBlob(\n options.slide.layoutSnapshot(this.slides.items.indexOf(options.slide)),\n `slide-${this.slides.items.indexOf(options.slide) + 1}.layout.json`,\n );\n }\n return jsonBlob(this.layoutSnapshot(), \"presentation.layout.json\");\n }\n const scale = options.scale ?? 1;\n validateRenderScale(scale);\n if (options.montage) {\n const dimensions = montageDimensions(this, options.columns, options.gap);\n if (options.format !== \"svg\") {\n assertRenderPixelBudget(dimensions.width, dimensions.height, scale);\n }\n const { executePresentationRender } =\n await import(\"@opengeni/artifact-tool/presentation/render\");\n return await executePresentationRender({\n kind: \"montage\",\n presentation: this,\n format: options.format,\n scale,\n name: `presentation-montage.${options.format}`,\n dimensions,\n });\n }\n const slide =\n options.slide ?? (this.slides.items.length === 1 ? this.slides.items[0] : undefined);\n if (!slide) {\n throw new Error(\n \"A slide is required when exporting a multi-slide presentation without montage: true\",\n );\n }\n this.assertOwns(slide);\n if (options.format !== \"svg\") {\n assertRenderPixelBudget(this.slideSize.width, this.slideSize.height, scale);\n }\n const { executePresentationRender } =\n await import(\"@opengeni/artifact-tool/presentation/render\");\n return await executePresentationRender({\n kind: \"slide\",\n slide,\n format: options.format,\n scale,\n name: `slide-${this.slides.items.indexOf(slide) + 1}.${options.format}`,\n dimensions: this.slideSize,\n });\n }\n\n layoutSnapshot(): Record<string, unknown> {\n return {\n kind: \"presentation-layout\",\n slideSize: { ...this.slideSize },\n masters: this.masters.items.map((master) => master.toProto()),\n layouts: this.layouts.items.map((layout) => layout.toProto()),\n slides: this.slides.items.map((slide, index) => slide.layoutSnapshot(index)),\n };\n }\n\n private register(prefix: string, value: unknown): string {\n const id = `${prefix}/${this.nextId++}`;\n this.objects.set(id, value);\n return id;\n }\n\n private assertOwns(slide: Slide): void {\n if (slide.presentation !== this) throw new Error(\"Slide belongs to another presentation\");\n }\n}\n\nclass PresentationPlaceholderCollection {\n constructor(private readonly elements: readonly PresentationTemplateElement[]) {}\n\n summary(): { count: number; names: string[] } {\n const names = this.elements\n .filter(\n (element): element is Extract<PresentationTemplateElement, { kind: \"shape\" }> =>\n element.kind === \"shape\" && element.config.placeholder !== undefined,\n )\n .map((element) => element.config.name ?? element.config.placeholder?.type ?? \"Placeholder\");\n return { count: names.length, names };\n }\n}\n\nexport class PresentationMaster {\n readonly id: string;\n name: string;\n background: PresentationFill;\n readonly elements: PresentationTemplateElement[];\n readonly placeholders: PresentationPlaceholderCollection;\n\n constructor(\n readonly presentation: Presentation,\n config: PresentationMasterConfig = {},\n ) {\n this.id = presentation.allocateId(\"mt\", this);\n this.name = config.name ?? this.id;\n assertSafeText(this.name, \"master name\", 512);\n this.background = config.background ?? \"white\";\n colorValue(this.background);\n this.elements = (config.elements ?? []).map(cloneTemplateElement);\n this.placeholders = new PresentationPlaceholderCollection(this.elements);\n }\n\n inspectRecord(): Record<string, unknown> {\n return {\n kind: \"master\",\n id: this.id,\n name: this.name,\n elements: this.elements.length,\n placeholders: this.placeholders.summary(),\n };\n }\n\n toProto(): Record<string, unknown> {\n return {\n id: this.id,\n type: \"master\",\n name: this.name,\n background: this.background,\n elements: this.elements.map(cloneTemplateElement),\n };\n }\n}\n\nexport class PresentationLayout {\n readonly id: string;\n name: string;\n masterId: string | undefined;\n background: PresentationFill;\n readonly elements: PresentationTemplateElement[];\n readonly placeholders: PresentationPlaceholderCollection;\n\n get parentLayoutId(): string | undefined {\n return this.masterId;\n }\n\n constructor(\n readonly presentation: Presentation,\n config: PresentationLayoutConfig = {},\n ) {\n this.id = presentation.allocateId(\"ly\", this);\n this.name = config.name ?? this.id;\n assertSafeText(this.name, \"layout name\", 512);\n if (\n config.masterId !== undefined &&\n config.parentLayoutId !== undefined &&\n config.masterId !== config.parentLayoutId\n ) {\n throw new InvalidPresentationInputError(\n \"layout masterId\",\n \"conflicts with the parentLayoutId compatibility alias\",\n );\n }\n this.masterId = config.masterId ?? config.parentLayoutId;\n if (this.masterId !== undefined) assertSafeText(this.masterId, \"layout master id\", 512);\n this.background = config.background ?? \"white\";\n colorValue(this.background);\n this.elements = (config.elements ?? []).map(cloneTemplateElement);\n this.placeholders = new PresentationPlaceholderCollection(this.elements);\n }\n\n inspectRecord(): Record<string, unknown> {\n return {\n kind: \"layout\",\n id: this.id,\n name: this.name,\n masterId: this.masterId,\n parentLayoutId: this.masterId,\n elements: this.elements.length,\n placeholders: this.placeholders.summary(),\n };\n }\n\n toProto(): Record<string, unknown> {\n return {\n id: this.id,\n type: \"layout\",\n name: this.name,\n masterId: this.masterId,\n parentLayoutId: this.masterId,\n background: this.background,\n elements: this.elements.map(cloneTemplateElement),\n };\n }\n}\n\nexport class PresentationMasterCollection {\n readonly items: PresentationMaster[] = [];\n\n constructor(private readonly presentation: Presentation) {}\n\n add(config: PresentationMasterConfig = {}): PresentationMaster {\n const master = new PresentationMaster(this.presentation, config);\n this.items.push(master);\n return master;\n }\n\n getItem(index: number): PresentationMaster {\n const master = this.items[index];\n if (!master) throw new Error(`Presentation master index out of range: ${index}`);\n return master;\n }\n}\n\nexport class PresentationLayoutCollection {\n readonly items: PresentationLayout[] = [];\n\n constructor(private readonly presentation: Presentation) {}\n\n add(config: PresentationLayoutConfig = {}): PresentationLayout {\n if (\n (config.masterId ?? config.parentLayoutId) !== undefined &&\n !this.presentation.masters.items.some(\n (master) => master.id === (config.masterId ?? config.parentLayoutId),\n )\n ) {\n throw new InvalidPresentationInputError(\n \"layout parentLayoutId\",\n \"must reference a master in the same presentation\",\n );\n }\n const layout = new PresentationLayout(this.presentation, config);\n this.items.push(layout);\n return layout;\n }\n\n getItem(index: number): PresentationLayout {\n const layout = this.items[index];\n if (!layout) throw new Error(`Presentation layout index out of range: ${index}`);\n return layout;\n }\n}\n\nexport class SlideCollection {\n readonly items: Slide[] = [];\n\n constructor(private readonly presentation: Presentation) {}\n\n add(): Slide {\n const slide = new Slide(this.presentation);\n this.items.push(slide);\n return slide;\n }\n\n getItem(index: number): Slide {\n const slide = this.items[index];\n if (!slide) throw new Error(`Slide index out of range: ${index}`);\n return slide;\n }\n}\n\nexport class Slide {\n readonly id: string;\n readonly shapes: PresentationShapeCollection;\n readonly charts: PresentationChartCollection;\n readonly images: PresentationImageCollection;\n readonly tables: PresentationTableCollection;\n readonly groups: PresentationGroupCollection;\n readonly notes = new PresentationText();\n readonly placeholders: SlidePlaceholderCollection;\n /** Canonical cross-type z-order. Typed collections are filtered indexes over this list. */\n readonly elements: PresentationElement[] = [];\n readonly background: { fill: PresentationFill } = { fill: \"white\" };\n title = \"\";\n layout: PresentationLayout | undefined;\n\n constructor(readonly presentation: Presentation) {\n this.id = presentation.allocateId(\"sl\", this);\n this.shapes = new PresentationShapeCollection(this);\n this.charts = new PresentationChartCollection(this);\n this.images = new PresentationImageCollection(this);\n this.tables = new PresentationTableCollection(this);\n this.groups = new PresentationGroupCollection(this);\n this.placeholders = new SlidePlaceholderCollection(this);\n }\n\n get speakerNotes(): PresentationText {\n return this.notes;\n }\n\n setLayout(layout: PresentationLayout | undefined): void {\n if (layout && layout.presentation !== this.presentation) {\n throw new InvalidPresentationInputError(\"slide layout\", \"belongs to another presentation\");\n }\n this.layout = layout;\n }\n\n appendElement(element: PresentationElement): void {\n if (element.slide !== this) {\n throw new InvalidPresentationInputError(\"slide element\", \"belongs to another slide\");\n }\n this.elements.push(element);\n }\n\n async export(options: Omit<PresentationExportOptions, \"slide\" | \"montage\">): Promise<FileBlob> {\n return await this.presentation.export({ ...options, slide: this });\n }\n\n inspectRecord(index: number): Record<string, unknown> {\n const textShapes = this.shapes.items.filter((shape) => shape.text.toString().length > 0);\n return {\n kind: \"slide\",\n id: this.id,\n slide: index + 1,\n title: this.title,\n textShapes: textShapes.length,\n charts: this.charts.items.length,\n images: this.images.items.length,\n tables: this.tables.items.length,\n groups: this.groups.items.length,\n layoutId: this.layout?.id,\n notesChars: this.notes.toString().length,\n };\n }\n\n layoutSnapshot(index: number): Record<string, unknown> {\n return {\n id: this.id,\n slide: index + 1,\n background: { ...this.background },\n layoutId: this.layout?.id,\n notes: this.notes.toString(),\n elements: [...this.elements.map((element) => element.layoutSnapshot())],\n };\n }\n}\n\nexport class SlidePlaceholderCollection {\n constructor(private readonly slide: Slide) {}\n\n get items(): PresentationShape[] {\n return this.slide.shapes.items.filter((shape) => shape.placeholder !== undefined);\n }\n\n summary(): { count: number; types: Record<string, number> } {\n const types: Record<string, number> = {};\n for (const shape of this.items) {\n const type = shape.placeholder?.type ?? \"unknown\";\n types[type] = (types[type] ?? 0) + 1;\n }\n return { count: this.items.length, types };\n }\n}\n\nexport class PresentationText {\n private value = \"\";\n private styleValue: PresentationTextStyle = {};\n\n constructor(initialValue = \"\", style: PresentationTextStyle = {}) {\n this.set(initialValue);\n this.style = style;\n }\n\n get style(): PresentationTextStyle {\n return this.styleValue;\n }\n\n set style(value: PresentationTextStyle) {\n validateTextStyle(value, \"textStyle\");\n this.styleValue = { ...value };\n }\n\n set(value: string): void {\n assertSafeText(value, \"text\");\n this.value = value;\n }\n\n replace(searchValue: string | RegExp, replaceValue: string): number {\n const before = this.value;\n let next: string;\n if (typeof searchValue === \"string\") {\n if (searchValue.length === 0) throw new Error(\"Text replacement search cannot be empty\");\n next = this.value.split(searchValue).join(replaceValue);\n } else {\n next = this.value.replace(searchValue, replaceValue);\n }\n assertSafeText(next, \"text\");\n this.value = next;\n return before === next ? 0 : 1;\n }\n\n toString(): string {\n return this.value;\n }\n\n toJSON(): string {\n return this.value;\n }\n}\n\nexport class PresentationShape {\n readonly id: string;\n readonly geometry: PresentationShapeGeometry;\n name: string;\n position: PresentationPosition;\n fill: PresentationFill;\n line: PresentationLine;\n rotation: number;\n borderRadius: number | string | undefined;\n placeholder: { type: string; index?: number } | undefined;\n private readonly textValue: PresentationText;\n\n constructor(\n readonly slide: Slide,\n config: PresentationShapeConfig,\n ) {\n if (!PRESENTATION_GEOMETRIES.has(config.geometry)) {\n throw new InvalidPresentationInputError(\"shape geometry\", \"is not supported\");\n }\n this.id = slide.presentation.allocateId(\"sh\", this);\n this.geometry = config.geometry;\n this.name = config.name ?? this.id;\n assertSafeText(this.name, \"shape name\");\n this.position = normalizePosition(config.position);\n this.fill =\n config.fill ??\n (config.geometry === \"textbox\" || config.geometry === \"line\" ? \"none\" : \"white\");\n this.line = {\n style: \"solid\",\n fill: config.geometry === \"textbox\" ? \"none\" : \"slate-900\",\n width: 1,\n ...config.line,\n };\n colorValue(this.fill);\n validateLine(this.line, \"shape line\");\n this.rotation = finiteOr(config.rotation, 0);\n validateRotation(this.rotation, \"shape rotation\");\n this.borderRadius = config.borderRadius;\n validateBorderRadius(this.borderRadius, \"shape borderRadius\");\n this.placeholder = normalizePlaceholder(config.placeholder);\n this.textValue = new PresentationText(config.text, config.textStyle);\n }\n\n get text(): PresentationText {\n return this.textValue;\n }\n\n set text(value: string | PresentationText) {\n this.textValue.set(value.toString());\n if (value instanceof PresentationText) this.textValue.style = value.style;\n }\n\n inspectRecord(slideIndex: number): Record<string, unknown> {\n const text = this.text.toString();\n return {\n kind: this.geometry === \"textbox\" ? \"textbox\" : \"shape\",\n id: this.id,\n slide: slideIndex + 1,\n name: this.name,\n geometry: this.geometry,\n text,\n textPreview: truncate(text, 240),\n textChars: text.length,\n textLines: text.length === 0 ? 0 : text.split(\"\\n\").length,\n bbox: positionTuple(this.position),\n bboxUnit: \"px\",\n };\n }\n\n layoutSnapshot(): Record<string, unknown> {\n return {\n kind: this.geometry === \"textbox\" ? \"textbox\" : \"shape\",\n id: this.id,\n name: this.name,\n geometry: this.geometry,\n position: { ...this.position },\n fill: this.fill,\n line: { ...this.line },\n rotation: this.rotation,\n text: this.text.toString(),\n textStyle: { ...this.text.style },\n placeholder: this.placeholder ? { ...this.placeholder } : undefined,\n };\n }\n}\n\nexport class PresentationShapeCollection {\n readonly items: PresentationShape[] = [];\n\n constructor(private readonly slide: Slide) {}\n\n add(config: PresentationShapeConfig): PresentationShape {\n const shape = new PresentationShape(this.slide, config);\n this.items.push(shape);\n this.slide.appendElement(shape);\n return shape;\n }\n}\n\nexport class PresentationChartSeries {\n name: string;\n categories: string[];\n values: number[];\n xValues: number[];\n bubbleSizes: number[];\n fill: PresentationFill | undefined;\n line: PresentationLine | undefined;\n\n constructor(config: PresentationChartSeriesConfig) {\n this.name = config.name;\n assertSafeText(this.name, \"chart series name\");\n this.categories = [...(config.categories ?? [])];\n for (const category of this.categories) assertSafeText(category, \"chart series category\");\n this.values = [...(config.values ?? [])];\n this.xValues = [...(config.xValues ?? [])];\n this.bubbleSizes = [...(config.bubbleSizes ?? [])];\n this.fill = config.fill;\n this.line = config.line ? { ...config.line } : undefined;\n validateFiniteArray(this.values, \"chart series values\");\n validateFiniteArray(this.xValues, \"chart series xValues\");\n validateFiniteArray(this.bubbleSizes, \"chart series bubbleSizes\");\n if (this.fill !== undefined) colorValue(this.fill);\n if (this.line !== undefined) validateLine(this.line, \"chart series line\");\n }\n}\n\nexport class PresentationChartSeriesCollection {\n readonly items: PresentationChartSeries[];\n\n constructor(series: PresentationChartSeriesConfig[]) {\n this.items = series.map((config) => new PresentationChartSeries(config));\n }\n\n getItemAt(index: number): PresentationChartSeries {\n const series = this.items[index];\n if (!series) throw new Error(`Chart series index out of range: ${index}`);\n return series;\n }\n}\n\nexport class PresentationChart {\n readonly id: string;\n readonly type: PresentationChartType;\n name: string;\n position: PresentationPosition;\n title: string;\n categories: string[];\n readonly series: PresentationChartSeriesCollection;\n hasLegend: boolean;\n legend: PresentationChartConfig[\"legend\"];\n xAxis: PresentationChartConfig[\"xAxis\"];\n yAxis: PresentationChartConfig[\"yAxis\"];\n dataLabels: PresentationChartConfig[\"dataLabels\"];\n\n constructor(\n readonly slide: Slide,\n type: PresentationChartType,\n config: PresentationChartConfig,\n ) {\n if (!CHART_TYPES.has(type)) {\n throw new InvalidPresentationInputError(\"chart type\", \"is not supported\");\n }\n this.id = slide.presentation.allocateId(\"ch\", this);\n this.type = type;\n this.name = config.name ?? this.id;\n assertSafeText(this.name, \"chart name\");\n this.position = normalizePosition(config.position, {\n left: 72,\n top: 120,\n width: 640,\n height: 360,\n });\n this.title = config.title ?? \"\";\n assertSafeText(this.title, \"chart title\");\n this.categories = [...(config.categories ?? [])];\n for (const category of this.categories) assertSafeText(category, \"chart category\");\n this.series = new PresentationChartSeriesCollection(config.series ?? []);\n this.hasLegend = config.hasLegend ?? this.series.items.length > 1;\n this.legend = config.legend ? { ...config.legend } : undefined;\n this.xAxis = config.xAxis ? { ...config.xAxis } : undefined;\n this.yAxis = config.yAxis ? { ...config.yAxis } : undefined;\n validateOptionalFinite(this.xAxis?.min, \"chart xAxis.min\");\n validateOptionalFinite(this.xAxis?.max, \"chart xAxis.max\");\n validateOptionalFinite(this.yAxis?.min, \"chart yAxis.min\");\n validateOptionalFinite(this.yAxis?.max, \"chart yAxis.max\");\n this.dataLabels = config.dataLabels ? { ...config.dataLabels } : undefined;\n }\n\n inspectRecord(slideIndex: number): Record<string, unknown> {\n return {\n kind: \"chart\",\n id: this.id,\n slide: slideIndex + 1,\n name: this.name,\n chartType: this.type,\n title: this.title,\n series: this.series.items.map((series) => ({ name: series.name, values: series.values })),\n bbox: positionTuple(this.position),\n bboxUnit: \"px\",\n };\n }\n\n layoutSnapshot(): Record<string, unknown> {\n return {\n kind: \"chart\",\n id: this.id,\n name: this.name,\n chartType: this.type,\n title: this.title,\n position: { ...this.position },\n categories: [...this.categories],\n series: this.series.items.map((series) => ({\n name: series.name,\n categories: [...series.categories],\n values: [...series.values],\n xValues: [...series.xValues],\n bubbleSizes: [...series.bubbleSizes],\n fill: series.fill,\n line: series.line,\n })),\n };\n }\n}\n\nexport class PresentationChartCollection {\n readonly items: PresentationChart[] = [];\n\n constructor(private readonly slide: Slide) {}\n\n add(type: PresentationChartType, config: PresentationChartConfig = {}): PresentationChart {\n const chart = new PresentationChart(this.slide, type, config);\n this.items.push(chart);\n this.slide.appendElement(chart);\n return chart;\n }\n}\n\nexport class PresentationTableCell {\n readonly text: PresentationText;\n fill: PresentationFill;\n rowSpan: number;\n colSpan: number;\n\n constructor(\n config: string | PresentationTableCellConfig,\n defaults: Pick<PresentationTableConfig, \"fill\" | \"textStyle\">,\n ) {\n const normalized = typeof config === \"string\" ? { text: config } : config;\n this.text = new PresentationText(normalized.text, normalized.textStyle ?? defaults.textStyle);\n this.fill = normalized.fill ?? defaults.fill ?? \"white\";\n colorValue(this.fill);\n this.rowSpan = normalized.rowSpan ?? 1;\n this.colSpan = normalized.colSpan ?? 1;\n for (const [field, value] of [\n [\"rowSpan\", this.rowSpan],\n [\"colSpan\", this.colSpan],\n ] as const) {\n if (!Number.isSafeInteger(value) || value <= 0 || value > MAX_TABLE_SPAN) {\n throw new InvalidPresentationInputError(\n `table cell ${field}`,\n `must be 1-${MAX_TABLE_SPAN}`,\n );\n }\n }\n }\n\n toConfig(): PresentationTableCellConfig {\n return {\n text: this.text.toString(),\n fill: this.fill,\n textStyle: { ...this.text.style },\n rowSpan: this.rowSpan,\n colSpan: this.colSpan,\n };\n }\n}\n\nexport class PresentationTable {\n readonly id: string;\n name: string;\n position: PresentationPosition;\n rows: Array<Array<PresentationTableCell | null>>;\n columnWidths: number[];\n rowHeights: number[];\n fill: PresentationFill;\n line: PresentationLine;\n textStyle: PresentationTextStyle;\n\n constructor(\n readonly slide: Slide,\n config: PresentationTableConfig,\n ) {\n if (\n !Array.isArray(config.rows) ||\n config.rows.length === 0 ||\n config.rows.length > MAX_TABLE_ROWS\n ) {\n throw new InvalidPresentationInputError(\n \"table rows\",\n `must contain 1-${MAX_TABLE_ROWS} rows`,\n );\n }\n const columns = config.rows[0]?.length ?? 0;\n if (columns === 0 || columns > MAX_TABLE_COLUMNS) {\n throw new InvalidPresentationInputError(\n \"table columns\",\n `must contain 1-${MAX_TABLE_COLUMNS} columns`,\n );\n }\n if (config.rows.some((row) => !Array.isArray(row) || row.length !== columns)) {\n throw new InvalidPresentationInputError(\"table rows\", \"must form a rectangular matrix\");\n }\n this.id = slide.presentation.allocateId(\"tb\", this);\n this.name = config.name ?? this.id;\n assertSafeText(this.name, \"table name\", 512);\n this.position = normalizePosition(config.position, {\n left: 72,\n top: 120,\n width: 640,\n height: Math.max(48, config.rows.length * 36),\n });\n this.fill = config.fill ?? \"white\";\n colorValue(this.fill);\n this.line = { style: \"solid\", fill: \"slate-300\", width: 1, ...config.line };\n validateLine(this.line, \"table line\");\n this.textStyle = { fontSize: 16, ...config.textStyle };\n validateTextStyle(this.textStyle, \"table textStyle\");\n this.rows = config.rows.map((row: readonly PresentationTableCellInput[]) =>\n row.map((cell: PresentationTableCellInput) =>\n cell === null ? null : new PresentationTableCell(cell, this),\n ),\n );\n validateTableOccupancy(this.rows);\n this.columnWidths = normalizeTableDimensions(config.columnWidths, columns, \"columnWidths\");\n this.rowHeights = normalizeTableDimensions(config.rowHeights, config.rows.length, \"rowHeights\");\n }\n\n inspectRecord(slideIndex: number): Record<string, unknown> {\n return {\n kind: \"table\",\n id: this.id,\n slide: slideIndex + 1,\n name: this.name,\n rows: this.rows.length,\n columns: this.rows[0]?.length ?? 0,\n textPreview: truncate(\n this.rows\n .map((row) => row.map((cell) => cell?.text.toString() ?? \"\").join(\" | \"))\n .join(\"\\n\"),\n 240,\n ),\n bbox: positionTuple(this.position),\n bboxUnit: \"px\",\n };\n }\n\n layoutSnapshot(): Record<string, unknown> {\n return {\n kind: \"table\",\n id: this.id,\n name: this.name,\n position: { ...this.position },\n rows: this.rows.map((row) => row.map((cell) => cell?.toConfig() ?? null)),\n columnWidths: [...this.columnWidths],\n rowHeights: [...this.rowHeights],\n fill: this.fill,\n line: { ...this.line },\n textStyle: { ...this.textStyle },\n };\n }\n}\n\nexport class PresentationTableCollection {\n readonly items: PresentationTable[] = [];\n\n constructor(private readonly slide: Slide) {}\n\n add(config: PresentationTableConfig): PresentationTable {\n const table = new PresentationTable(this.slide, config);\n this.items.push(table);\n this.slide.appendElement(table);\n return table;\n }\n}\n\nexport type PresentationGroupChild =\n | PresentationShape\n | PresentationChart\n | PresentationImage\n | PresentationTable\n | PresentationGroup;\n\nexport class PresentationGroup {\n readonly id: string;\n name: string;\n position: PresentationPosition;\n childOffset: { left: number; top: number };\n childExtent: { width: number; height: number };\n rotation: number;\n flipHorizontal: boolean;\n flipVertical: boolean;\n readonly children: PresentationGroupChild[] = [];\n\n constructor(\n readonly slide: Slide,\n config: PresentationGroupConfig = {},\n depth = 1,\n ) {\n if (depth > MAX_GROUP_DEPTH) {\n throw new InvalidPresentationInputError(\"group nesting\", `exceeds ${MAX_GROUP_DEPTH} levels`);\n }\n this.id = slide.presentation.allocateId(\"gp\", this);\n this.name = config.name ?? this.id;\n assertSafeText(this.name, \"group name\", 512);\n this.position = normalizePosition(config.position);\n this.childOffset = config.childOffset\n ? { ...config.childOffset }\n : { left: this.position.left, top: this.position.top };\n this.childExtent = config.childExtent\n ? { ...config.childExtent }\n : { width: this.position.width, height: this.position.height };\n validatePosition(\n {\n left: this.childOffset.left,\n top: this.childOffset.top,\n width: this.childExtent.width,\n height: this.childExtent.height,\n },\n \"group child coordinate system\",\n );\n this.rotation = finiteOr(config.rotation, 0);\n validateRotation(this.rotation, \"group rotation\");\n this.flipHorizontal = config.flipHorizontal ?? false;\n this.flipVertical = config.flipVertical ?? false;\n for (const child of config.children ?? []) {\n if (this.children.length >= MAX_GROUP_CHILDREN) {\n throw new InvalidPresentationInputError(\n \"group children\",\n `exceeds ${MAX_GROUP_CHILDREN} children`,\n );\n }\n switch (child.kind) {\n case \"shape\":\n this.children.push(new PresentationShape(slide, child.config));\n break;\n case \"chart\":\n this.children.push(new PresentationChart(slide, child.type, child.config ?? {}));\n break;\n case \"image\":\n this.children.push(new PresentationImage(slide, child.config));\n break;\n case \"table\":\n this.children.push(new PresentationTable(slide, child.config));\n break;\n case \"group\":\n this.children.push(new PresentationGroup(slide, child.config, depth + 1));\n break;\n }\n }\n }\n\n inspectRecord(slideIndex: number): Record<string, unknown> {\n return {\n kind: \"group\",\n id: this.id,\n slide: slideIndex + 1,\n name: this.name,\n children: this.children.length,\n bbox: positionTuple(this.position),\n bboxUnit: \"px\",\n };\n }\n\n layoutSnapshot(): Record<string, unknown> {\n return {\n kind: \"group\",\n id: this.id,\n name: this.name,\n position: { ...this.position },\n childOffset: { ...this.childOffset },\n childExtent: { ...this.childExtent },\n rotation: this.rotation,\n flipHorizontal: this.flipHorizontal,\n flipVertical: this.flipVertical,\n children: this.children.map((child) => child.layoutSnapshot()),\n };\n }\n}\n\nexport class PresentationGroupCollection {\n readonly items: PresentationGroup[] = [];\n\n constructor(private readonly slide: Slide) {}\n\n add(config: PresentationGroupConfig = {}): PresentationGroup {\n const group = new PresentationGroup(this.slide, config);\n this.items.push(group);\n this.slide.appendElement(group);\n return group;\n }\n}\n\nexport class PresentationImage {\n readonly id: string;\n name: string;\n position: PresentationPosition;\n fit: \"contain\" | \"cover\";\n contentType: string | undefined;\n alt: string;\n prompt: string | undefined;\n crop: { left: number; top: number; right: number; bottom: number } | undefined;\n geometry: \"rect\" | \"roundRect\" | \"ellipse\";\n borderRadius: number | string | undefined;\n rotation: number;\n flipHorizontal: boolean;\n flipVertical: boolean;\n lockAspectRatio: boolean;\n private blob: Uint8Array | undefined;\n private dataUrl: string | undefined;\n private uri: string | undefined;\n private validatedContentType: PresentationRasterImageContentType | undefined;\n private cachedCanonicalDataUrl: string | undefined;\n\n constructor(\n readonly slide: Slide,\n config: PresentationImageConfig,\n ) {\n this.id = slide.presentation.allocateId(\"im\", this);\n this.name = config.name ?? this.id;\n assertSafeText(this.name, \"image name\");\n this.position = normalizePosition(config.position ?? config.frame, {\n left: 72,\n top: 120,\n width: 480,\n height: 270,\n });\n this.fit = config.fit ?? \"contain\";\n if (this.fit !== \"contain\" && this.fit !== \"cover\") {\n throw new InvalidPresentationInputError(\"image fit\", \"must be contain or cover\");\n }\n this.contentType = config.contentType;\n this.alt = config.alt ?? \"\";\n assertSafeText(this.alt, \"image alt\");\n this.prompt = config.prompt;\n if (this.prompt !== undefined) assertSafeText(this.prompt, \"image prompt\");\n this.crop = config.crop ? normalizeCrop(config.crop) : undefined;\n this.geometry = config.geometry ?? \"rect\";\n if (!([\"rect\", \"roundRect\", \"ellipse\"] as const).includes(this.geometry)) {\n throw new InvalidPresentationInputError(\"image geometry\", \"is not supported\");\n }\n this.borderRadius = config.borderRadius;\n validateBorderRadius(this.borderRadius, \"image borderRadius\");\n this.rotation = finiteOr(config.rotation, 0);\n validateRotation(this.rotation, \"image rotation\");\n this.flipHorizontal = config.flipHorizontal ?? false;\n this.flipVertical = config.flipVertical ?? false;\n this.lockAspectRatio = config.lockAspectRatio ?? false;\n this.assignSource(config);\n }\n\n get frame(): PresentationPosition {\n return this.position;\n }\n\n set frame(value: PresentationPosition) {\n this.position = normalizePosition(value);\n }\n\n replace(config: PresentationImageConfig): void {\n if (config.alt !== undefined) assertSafeText(config.alt, \"image alt\");\n if (config.prompt !== undefined) assertSafeText(config.prompt, \"image prompt\");\n if (config.fit !== undefined && config.fit !== \"contain\" && config.fit !== \"cover\") {\n throw new InvalidPresentationInputError(\"image fit\", \"must be contain or cover\");\n }\n this.assignSource(config);\n if (config.alt !== undefined) this.alt = config.alt;\n if (config.fit !== undefined) this.fit = config.fit;\n if (config.prompt !== undefined) this.prompt = config.prompt;\n }\n\n /**\n * Explicitly materializes a host-owned URI into trusted raster bytes.\n *\n * Render and file export never invoke resolvers, fetch, or read files. A host\n * must call this method deliberately, and returned bytes still pass the same\n * MIME/signature validation as direct `blob` input.\n */\n async resolveUri(): Promise<void> {\n if (!this.uri) {\n throw new InvalidPresentationInputError(\n \"image uri\",\n `Image ${this.id} has no URI to resolve`,\n );\n }\n const uri = this.uri;\n assertSafeText(this.name, `image ${this.id} name`);\n let resolution: PresentationImageResolution;\n try {\n resolution = await this.slide.presentation.resolveImageUri({\n uri,\n imageId: this.id,\n name: this.name,\n });\n } catch (error) {\n const failure = new InvalidPresentationInputError(\n \"image resolver\",\n `failed to resolve image ${this.id}`,\n );\n Object.defineProperty(failure, \"cause\", { value: error, enumerable: false });\n throw failure;\n }\n if (!resolution || typeof resolution !== \"object\" || !(\"blob\" in resolution)) {\n throw new InvalidPresentationInputError(\n \"image resolver\",\n \"must return { blob, contentType? }\",\n );\n }\n this.assignSource({\n blob: resolution.blob,\n ...(resolution.contentType ? { contentType: resolution.contentType } : {}),\n });\n }\n\n sourceForSvg(): string | undefined {\n if (this.uri) throw unresolvedImageUriError(this.id);\n if (this.dataUrl) {\n if (!this.contentType) {\n throw new InvalidPresentationInputError(\n \"image contentType\",\n `Image ${this.id} has no validated raster MIME type`,\n );\n }\n const contentType = normalizeRasterMime(this.contentType);\n if (\n contentType !== this.validatedContentType ||\n !this.dataUrl.startsWith(`data:${contentType};base64,`)\n ) {\n throw new InvalidPresentationInputError(\n \"image contentType\",\n `Image ${this.id} MIME type no longer matches its data URL`,\n );\n }\n return (this.cachedCanonicalDataUrl ??= this.dataUrl);\n }\n if (this.blob) {\n if (!this.contentType) {\n throw new InvalidPresentationInputError(\n \"image contentType\",\n `Image ${this.id} has no validated raster MIME type`,\n );\n }\n const contentType = normalizeRasterMime(this.contentType);\n if (contentType !== this.validatedContentType) {\n throw new InvalidPresentationInputError(\n \"image contentType\",\n `Image ${this.id} MIME type no longer matches its validated bytes`,\n );\n }\n return (this.cachedCanonicalDataUrl ??= `data:${contentType};base64,${encodeRasterBase64(this.blob)}`);\n }\n return undefined;\n }\n\n sourceForPptx(): { data: string } {\n const source = this.sourceForSvg();\n if (!source) {\n throw new UnsupportedPresentationFeatureError(\n \"prompt-only image PPTX export\",\n `Image ${this.id} must be regenerated to validated raster bytes or a raster data URL before export`,\n );\n }\n return { data: source };\n }\n\n inspectRecord(slideIndex: number): Record<string, unknown> {\n return {\n kind: \"image\",\n id: this.id,\n slide: slideIndex + 1,\n name: this.name,\n alt: this.alt,\n prompt: this.prompt,\n fit: this.fit,\n geometry: this.geometry,\n source: this.blob ? \"blob\" : this.dataUrl ? \"dataUrl\" : this.uri ? \"uri\" : \"prompt\",\n bbox: positionTuple(this.position),\n bboxUnit: \"px\",\n };\n }\n\n layoutSnapshot(): Record<string, unknown> {\n return {\n kind: \"image\",\n id: this.id,\n name: this.name,\n alt: this.alt,\n prompt: this.prompt,\n fit: this.fit,\n geometry: this.geometry,\n position: { ...this.position },\n crop: this.crop ? { ...this.crop } : undefined,\n rotation: this.rotation,\n };\n }\n\n private assignSource(config: PresentationImageConfig): void {\n const concrete = [\n \"blob\" in config && config.blob !== undefined,\n \"dataUrl\" in config && config.dataUrl !== undefined,\n \"uri\" in config && config.uri !== undefined,\n ].filter(Boolean).length;\n if (concrete > 1)\n throw new InvalidPresentationInputError(\n \"image source\",\n \"accepts exactly one concrete source: blob, dataUrl, or uri\",\n );\n if (concrete === 0 && !config.prompt)\n throw new InvalidPresentationInputError(\n \"image source\",\n \"requires blob, dataUrl, uri, or prompt\",\n );\n\n let blob: Uint8Array | undefined;\n let dataUrl: string | undefined;\n let uri: string | undefined;\n let contentType: PresentationRasterImageContentType | undefined;\n\n if (\"blob\" in config && config.blob !== undefined) {\n const bytes = copyImageBytes(config.blob);\n blob = bytes;\n contentType = validateRasterBytes(bytes, config.contentType, \"image blob\");\n } else if (\"dataUrl\" in config && config.dataUrl !== undefined) {\n const parsed = parseRasterDataUrl(config.dataUrl);\n if (\n config.contentType !== undefined &&\n normalizeRasterMime(config.contentType) !== parsed.type\n ) {\n throw new InvalidPresentationInputError(\n \"image contentType\",\n \"does not match the data URL MIME type\",\n );\n }\n dataUrl = parsed.canonical;\n contentType = parsed.type;\n } else if (\"uri\" in config && config.uri !== undefined) {\n this.slide.presentation.assertImageUriAccepted(config.uri);\n uri = config.uri;\n }\n\n this.blob = blob;\n this.dataUrl = dataUrl;\n this.uri = uri;\n this.contentType = contentType;\n this.validatedContentType = contentType;\n this.cachedCanonicalDataUrl = undefined;\n }\n}\n\nexport class PresentationImageCollection {\n readonly items: PresentationImage[] = [];\n\n constructor(private readonly slide: Slide) {}\n\n add(config: PresentationImageConfig): PresentationImage {\n const image = new PresentationImage(this.slide, config);\n this.items.push(image);\n this.slide.appendElement(image);\n return image;\n }\n}\n\n// oxlint-disable-next-line typescript/no-extraneous-class -- skill-compatible codec facade\nexport class PresentationFile {\n static async exportPptx(\n presentation: Presentation,\n options: PresentationPptxExportOptions = {},\n ): Promise<FileBlob> {\n validatePresentation(presentation, true);\n const { exportPresentationPptx } = await import(\"@opengeni/artifact-tool/presentation/pptx\");\n return await exportPresentationPptx(presentation, options);\n }\n\n static async importPptx(\n input: FileBlob | Blob | ArrayBuffer | Uint8Array,\n options: PresentationPptxImportOptions = {},\n ): Promise<Presentation> {\n const { importPresentationPptx } = await import(\"@opengeni/artifact-tool/presentation/pptx\");\n return await importPresentationPptx(input, options);\n }\n\n static fidelityReport(presentation: Presentation): readonly PresentationFidelityIssue[] {\n const issues: PresentationFidelityIssue[] = [];\n if (\n presentation.masters.items.length > 1 ||\n presentation.masters.items.some((master) => master.elements.length > 0)\n ) {\n issues.push({\n code: \"content-preserved-in-source\",\n severity: \"warning\",\n feature: \"master\",\n message:\n \"Master hierarchy is editable but requires the package-native PPTX writer for regeneration\",\n });\n }\n if (\n presentation.layouts.items.length > 1 ||\n presentation.layouts.items.some((layout) => layout.elements.length > 0)\n ) {\n issues.push({\n code: \"content-preserved-in-source\",\n severity: \"warning\",\n feature: \"layout\",\n message:\n \"Layout inheritance is editable but requires the package-native PPTX writer for regeneration\",\n });\n }\n if (presentation.slides.items.some((slide) => slide.groups.items.length > 0)) {\n issues.push({\n code: \"group-will-be-flattened\",\n severity: \"warning\",\n feature: \"group\",\n message:\n \"PptxGenJS cannot emit group scene nodes; explicit lossy export flattens their children\",\n });\n }\n for (const slide of presentation.slides.items) {\n for (const chart of slide.charts.items) {\n if (\n (chart.type === \"scatter\" || chart.type === \"bubble\") &&\n !chartSeriesShareXValues(chart)\n ) {\n issues.push({\n code: \"style-approximated\",\n severity: \"warning\",\n feature: \"unsupported-chart\",\n message: `Chart ${chart.id} has different X values per series; the fallback PPTX writer only supports one shared X vector`,\n });\n }\n }\n }\n const provenance = presentationLossState(presentation);\n if (provenance?.unsupportedParts.length) {\n issues.push({\n code: \"content-preserved-in-source\",\n severity: \"warning\",\n feature: \"theme\",\n message: \"Validated source-only OOXML parts cannot be regenerated after model edits\",\n parts: [...provenance.unsupportedParts],\n });\n }\n return issues;\n }\n\n static lossPreservationEnvelope(\n presentation: Presentation,\n ): PresentationLossPreservationEnvelope | null {\n const envelope = presentationLossState(presentation);\n return envelope\n ? {\n ...envelope,\n sourceBytes: envelope.sourceBytes.slice(),\n unsupportedParts: [...envelope.unsupportedParts],\n }\n : null;\n }\n}\n\nfunction chartSeriesShareXValues(chart: PresentationChart): boolean {\n const reference = chart.series.items[0]?.xValues ?? [];\n if (reference.length === 0) return false;\n return chart.series.items.every(\n (series) =>\n series.xValues.length === reference.length &&\n series.xValues.every((value, index) => Object.is(value, reference[index])),\n );\n}\n\ntype MontageDimensions = {\n columns: number;\n rows: number;\n gap: number;\n width: number;\n height: number;\n};\n\nfunction montageDimensions(\n presentation: Presentation,\n requestedColumns?: number,\n requestedGap?: number,\n): MontageDimensions {\n const count = presentation.slides.items.length;\n if (count === 0) {\n throw new InvalidPresentationInputError(\"montage\", \"cannot export an empty presentation\");\n }\n const columns = requestedColumns ?? Math.ceil(Math.sqrt(count));\n if (!Number.isInteger(columns) || columns <= 0) {\n throw new InvalidPresentationInputError(\"montage columns\", \"must be a positive integer\");\n }\n const gap = requestedGap ?? 24;\n if (!Number.isFinite(gap) || gap < 0) {\n throw new InvalidPresentationInputError(\"montage gap\", \"must be a non-negative number\");\n }\n const rows = Math.ceil(count / columns);\n const width = columns * presentation.slideSize.width + (columns + 1) * gap;\n const height = rows * presentation.slideSize.height + (rows + 1) * gap;\n if (!Number.isFinite(width) || !Number.isFinite(height)) {\n throw new InvalidPresentationInputError(\"montage geometry\", \"exceeds finite numeric bounds\");\n }\n return { columns, rows, gap, width, height };\n}\n\nfunction validateRenderScale(scale: number): void {\n if (!Number.isFinite(scale) || scale <= 0 || scale > 8) {\n throw new InvalidPresentationInputError(\"export scale\", \"must be greater than 0 and at most 8\");\n }\n}\n\nfunction assertRenderPixelBudget(width: number, height: number, scale: number): void {\n const scaledWidth = Math.ceil(width * scale);\n const scaledHeight = Math.ceil(height * scale);\n if (\n !Number.isSafeInteger(scaledWidth) ||\n !Number.isSafeInteger(scaledHeight) ||\n scaledWidth <= 0 ||\n scaledHeight <= 0\n ) {\n throw new InvalidPresentationInputError(\n \"render geometry\",\n \"scaled dimensions must be positive safe integers\",\n );\n }\n if (scaledWidth > MAX_RENDER_DIMENSION || scaledHeight > MAX_RENDER_DIMENSION) {\n throw new InvalidPresentationInputError(\n \"render dimension limit\",\n `${scaledWidth}x${scaledHeight} exceeds maximum dimension ${MAX_RENDER_DIMENSION}`,\n );\n }\n if (scaledWidth > Math.floor(MAX_RENDER_PIXELS / scaledHeight)) {\n throw new InvalidPresentationInputError(\n \"render pixel limit\",\n `${scaledWidth}x${scaledHeight} exceeds maximum ${MAX_RENDER_PIXELS} pixels`,\n );\n }\n}\n\nconst MAX_GEOMETRY_VALUE = 1_000_000;\nconst MAX_TEXT_LENGTH = 1_000_000;\nconst MAX_FONT_SIZE = 4_096;\nconst MAX_IMAGE_BYTES = 32 * 1024 * 1024;\nconst MAX_IMAGE_URI_LENGTH = 4_096;\nconst MAX_RENDER_DIMENSION = 32_768;\nconst MAX_RENDER_PIXELS = 67_108_864;\nconst MAX_TABLE_ROWS = 10_000;\nconst MAX_TABLE_COLUMNS = 1_024;\nconst MAX_TABLE_SPAN = 1_024;\nconst MAX_GROUP_DEPTH = 32;\nconst MAX_GROUP_CHILDREN = 100_000;\n\nconst PRESENTATION_GEOMETRIES = new Set<PresentationShapeGeometry>([\n \"textbox\",\n \"rect\",\n \"roundRect\",\n \"ellipse\",\n \"triangle\",\n \"rightArrow\",\n \"line\",\n]);\nconst CHART_TYPES = new Set<PresentationChartType>([\n \"bar\",\n \"line\",\n \"area\",\n \"pie\",\n \"doughnut\",\n \"scatter\",\n \"bubble\",\n \"radar\",\n]);\nconst LINE_STYLES: ReadonlySet<unknown> = new Set([\"solid\", \"dash\", \"dot\", \"none\"]);\nconst TEXT_ALIGNMENTS: ReadonlySet<unknown> = new Set([\"left\", \"center\", \"right\", \"justify\"]);\nconst VERTICAL_ALIGNMENTS: ReadonlySet<unknown> = new Set([\"top\", \"middle\", \"bottom\"]);\nconst BORDER_RADIUS_TOKENS: Readonly<Record<string, number>> = {\n rounded: 4,\n \"rounded-lg\": 8,\n \"rounded-xl\": 12,\n \"rounded-2xl\": 16,\n \"rounded-3xl\": 24,\n};\nconst FORBIDDEN_IMAGE_URI_SCHEMES = new Set([\n \"blob\",\n \"data\",\n \"file\",\n \"ftp\",\n \"ftps\",\n \"http\",\n \"https\",\n \"javascript\",\n]);\n\nfunction cloneTemplateElement(element: PresentationTemplateElement): PresentationTemplateElement {\n if (!element || typeof element !== \"object\") {\n throw new InvalidPresentationInputError(\"template element\", \"must be an object\");\n }\n switch (element.kind) {\n case \"shape\":\n return {\n kind: \"shape\",\n config: {\n ...element.config,\n ...(element.config.position ? { position: { ...element.config.position } } : {}),\n ...(element.config.line ? { line: { ...element.config.line } } : {}),\n ...(element.config.textStyle ? { textStyle: { ...element.config.textStyle } } : {}),\n },\n };\n case \"chart\":\n return {\n kind: \"chart\",\n type: element.type,\n ...(element.config\n ? {\n config: {\n ...element.config,\n ...(element.config.position ? { position: { ...element.config.position } } : {}),\n ...(element.config.categories\n ? { categories: [...element.config.categories] }\n : {}),\n ...(element.config.series\n ? {\n series: element.config.series.map((series) => ({\n ...series,\n ...(series.categories ? { categories: [...series.categories] } : {}),\n ...(series.values ? { values: [...series.values] } : {}),\n ...(series.xValues ? { xValues: [...series.xValues] } : {}),\n ...(series.bubbleSizes ? { bubbleSizes: [...series.bubbleSizes] } : {}),\n ...(series.line ? { line: { ...series.line } } : {}),\n })),\n }\n : {}),\n ...(element.config.legend ? { legend: { ...element.config.legend } } : {}),\n ...(element.config.xAxis ? { xAxis: { ...element.config.xAxis } } : {}),\n ...(element.config.yAxis ? { yAxis: { ...element.config.yAxis } } : {}),\n ...(element.config.dataLabels\n ? { dataLabels: { ...element.config.dataLabels } }\n : {}),\n },\n }\n : {}),\n };\n case \"image\": {\n const config = element.config;\n return {\n kind: \"image\",\n config: {\n ...config,\n ...(config.blob !== undefined\n ? {\n blob:\n config.blob instanceof Uint8Array ? config.blob.slice() : config.blob.slice(0),\n }\n : {}),\n ...(config.position ? { position: { ...config.position } } : {}),\n ...(config.frame ? { frame: { ...config.frame } } : {}),\n ...(config.crop ? { crop: { ...config.crop } } : {}),\n } as PresentationImageConfig,\n };\n }\n case \"table\":\n return {\n kind: \"table\",\n config: {\n ...element.config,\n ...(element.config.position ? { position: { ...element.config.position } } : {}),\n rows: element.config.rows.map((row) =>\n row.map((cell) =>\n cell === null || typeof cell === \"string\"\n ? cell\n : {\n ...cell,\n ...(cell.textStyle ? { textStyle: { ...cell.textStyle } } : {}),\n },\n ),\n ),\n ...(element.config.columnWidths\n ? { columnWidths: [...element.config.columnWidths] }\n : {}),\n ...(element.config.rowHeights ? { rowHeights: [...element.config.rowHeights] } : {}),\n ...(element.config.line ? { line: { ...element.config.line } } : {}),\n ...(element.config.textStyle ? { textStyle: { ...element.config.textStyle } } : {}),\n },\n };\n }\n}\n\nfunction normalizeTableDimensions(\n values: readonly number[] | undefined,\n expected: number,\n field: string,\n): number[] {\n if (values === undefined) return [];\n if (!Array.isArray(values) || values.length !== expected) {\n throw new InvalidPresentationInputError(`table ${field}`, `must contain ${expected} values`);\n }\n const output = [...values];\n if (output.some((value) => !Number.isFinite(value) || value <= 0 || value > MAX_GEOMETRY_VALUE)) {\n throw new InvalidPresentationInputError(\n `table ${field}`,\n \"must contain bounded positive numbers\",\n );\n }\n return output;\n}\n\nfunction validateTableOccupancy(\n rows: readonly (readonly (PresentationTableCell | null)[])[],\n): void {\n const rowCount = rows.length;\n const columnCount = rows[0]?.length ?? 0;\n const covered = Array.from({ length: rowCount }, () => new Uint8Array(columnCount));\n for (let row = 0; row < rowCount; row += 1) {\n for (let column = 0; column < columnCount; column += 1) {\n const cell = rows[row]![column];\n if (cell === undefined) {\n throw new InvalidPresentationInputError(\"table rows\", \"must form a rectangular matrix\");\n }\n if (cell === null) {\n if (covered[row]![column] === 0) {\n throw new InvalidPresentationInputError(\n \"table cell occupancy\",\n `uncovered null at row ${row + 1}, column ${column + 1}`,\n );\n }\n continue;\n }\n if (covered[row]![column] !== 0) {\n throw new InvalidPresentationInputError(\n \"table cell occupancy\",\n `spanned position at row ${row + 1}, column ${column + 1} must be null`,\n );\n }\n if (row + cell.rowSpan > rowCount || column + cell.colSpan > columnCount) {\n throw new InvalidPresentationInputError(\n \"table cell span\",\n `cell at row ${row + 1}, column ${column + 1} extends outside the table`,\n );\n }\n for (let coveredRow = row; coveredRow < row + cell.rowSpan; coveredRow += 1) {\n for (\n let coveredColumn = column;\n coveredColumn < column + cell.colSpan;\n coveredColumn += 1\n ) {\n if (coveredRow === row && coveredColumn === column) continue;\n if (covered[coveredRow]![coveredColumn] !== 0) {\n throw new InvalidPresentationInputError(\"table cell span\", \"overlaps another span\");\n }\n covered[coveredRow]![coveredColumn] = 1;\n }\n }\n }\n }\n}\n\nfunction normalizePlaceholder(\n value: PresentationShapeConfig[\"placeholder\"],\n): { type: string; index?: number } | undefined {\n if (value === undefined) return undefined;\n if (!value || typeof value !== \"object\") {\n throw new InvalidPresentationInputError(\"shape placeholder\", \"must be an object\");\n }\n assertSafeText(value.type, \"shape placeholder type\", 128);\n if (!/^[A-Za-z][A-Za-z0-9]*$/.test(value.type)) {\n throw new InvalidPresentationInputError(\"shape placeholder type\", \"is invalid\");\n }\n if (value.index !== undefined && (!Number.isSafeInteger(value.index) || value.index < 0)) {\n throw new InvalidPresentationInputError(\n \"shape placeholder index\",\n \"must be a non-negative safe integer\",\n );\n }\n return value.index === undefined\n ? { type: value.type }\n : { type: value.type, index: value.index };\n}\n\nfunction validateImageUriPolicy(\n resolver: PresentationImageResolver | undefined,\n schemes: readonly string[] | undefined,\n): ReadonlySet<string> {\n if (schemes !== undefined && !Array.isArray(schemes)) {\n throw new InvalidPresentationInputError(\"allowedImageUriSchemes\", \"must be an array\");\n }\n const normalized = new Set<string>();\n for (const value of schemes ?? []) {\n if (typeof value !== \"string\" || !/^[a-z][a-z0-9+.-]*$/i.test(value)) {\n throw new InvalidPresentationInputError(\n \"allowedImageUriSchemes\",\n \"contains an invalid URI scheme\",\n );\n }\n const scheme = value.toLowerCase();\n if (FORBIDDEN_IMAGE_URI_SCHEMES.has(scheme)) {\n throw new InvalidPresentationInputError(\n \"allowedImageUriSchemes\",\n `${scheme}: is reserved for active, local, or remote resources`,\n );\n }\n normalized.add(scheme);\n }\n if (!resolver && normalized.size > 0) {\n throw new InvalidPresentationInputError(\n \"allowedImageUriSchemes\",\n \"requires an injected imageResolver\",\n );\n }\n return normalized;\n}\n\nfunction imageUriScheme(uri: string): string {\n const match = /^([a-z][a-z0-9+.-]*):/i.exec(uri);\n if (!match) {\n throw new InvalidPresentationInputError(\n \"image uri\",\n \"must use a host-owned, explicitly allowed URI scheme\",\n );\n }\n return match[1]!.toLowerCase();\n}\n\nfunction validatePresentation(presentation: Presentation, requireResolvedImages: boolean): void {\n validatePosition(\n {\n left: 0,\n top: 0,\n width: presentation.slideSize.width,\n height: presentation.slideSize.height,\n },\n \"slideSize\",\n );\n for (const master of presentation.masters.items) {\n assertSafeText(master.name, `master ${master.id} name`, 512);\n colorValue(master.background);\n }\n for (const layout of presentation.layouts.items) {\n assertSafeText(layout.name, `layout ${layout.id} name`, 512);\n colorValue(layout.background);\n if (\n layout.masterId !== undefined &&\n !presentation.masters.items.some((master) => master.id === layout.masterId)\n ) {\n throw new InvalidPresentationInputError(\n `layout ${layout.id} masterId`,\n \"must reference a master in this presentation\",\n );\n }\n }\n for (const [slideIndex, slide] of presentation.slides.items.entries()) {\n assertSafeText(slide.title, `slides[${slideIndex}].title`);\n assertSafeText(slide.notes.toString(), `slides[${slideIndex}].notes`);\n colorValue(slide.background.fill);\n for (const shape of slide.shapes.items) {\n if (!PRESENTATION_GEOMETRIES.has(shape.geometry)) {\n throw new InvalidPresentationInputError(\"shape geometry\", \"is not supported\");\n }\n assertSafeText(shape.name, `shape ${shape.id} name`);\n validatePosition(shape.position, `shape ${shape.id} position`);\n colorValue(shape.fill);\n validateLine(shape.line, `shape ${shape.id} line`);\n validateRotation(shape.rotation, `shape ${shape.id} rotation`);\n validateBorderRadius(shape.borderRadius, `shape ${shape.id} borderRadius`);\n normalizePlaceholder(shape.placeholder);\n assertSafeText(shape.text.toString(), `shape ${shape.id} text`);\n validateTextStyle(shape.text.style, `shape ${shape.id} textStyle`);\n }\n for (const chart of slide.charts.items) {\n if (!CHART_TYPES.has(chart.type)) {\n throw new InvalidPresentationInputError(\"chart type\", \"is not supported\");\n }\n assertSafeText(chart.name, `chart ${chart.id} name`);\n assertSafeText(chart.title, `chart ${chart.id} title`);\n validatePosition(chart.position, `chart ${chart.id} position`);\n for (const [index, category] of chart.categories.entries()) {\n assertSafeText(category, `chart ${chart.id} categories[${index}]`);\n }\n validateOptionalFinite(chart.xAxis?.min, `chart ${chart.id} xAxis.min`);\n validateOptionalFinite(chart.xAxis?.max, `chart ${chart.id} xAxis.max`);\n validateOptionalFinite(chart.yAxis?.min, `chart ${chart.id} yAxis.min`);\n validateOptionalFinite(chart.yAxis?.max, `chart ${chart.id} yAxis.max`);\n for (const [seriesIndex, series] of chart.series.items.entries()) {\n assertSafeText(series.name, `chart ${chart.id} series[${seriesIndex}].name`);\n for (const [index, category] of series.categories.entries()) {\n assertSafeText(category, `chart ${chart.id} series[${seriesIndex}].categories[${index}]`);\n }\n validateFiniteArray(series.values, `chart ${chart.id} series[${seriesIndex}].values`);\n validateFiniteArray(series.xValues, `chart ${chart.id} series[${seriesIndex}].xValues`);\n validateFiniteArray(\n series.bubbleSizes,\n `chart ${chart.id} series[${seriesIndex}].bubbleSizes`,\n );\n if (series.fill !== undefined) colorValue(series.fill);\n if (series.line !== undefined) {\n validateLine(series.line, `chart ${chart.id} series[${seriesIndex}].line`);\n }\n }\n }\n for (const image of slide.images.items) {\n assertSafeText(image.name, `image ${image.id} name`);\n assertSafeText(image.alt, `image ${image.id} alt`);\n if (image.prompt !== undefined) assertSafeText(image.prompt, `image ${image.id} prompt`);\n validatePosition(image.position, `image ${image.id} position`);\n if (image.fit !== \"contain\" && image.fit !== \"cover\") {\n throw new InvalidPresentationInputError(\n `image ${image.id} fit`,\n \"must be contain or cover\",\n );\n }\n if (!([\"rect\", \"roundRect\", \"ellipse\"] as const).includes(image.geometry)) {\n throw new InvalidPresentationInputError(`image ${image.id} geometry`, \"is not supported\");\n }\n validateRotation(image.rotation, `image ${image.id} rotation`);\n validateBorderRadius(image.borderRadius, `image ${image.id} borderRadius`);\n if (image.crop !== undefined) normalizeCrop(image.crop);\n for (const [key, value] of [\n [\"flipHorizontal\", image.flipHorizontal],\n [\"flipVertical\", image.flipVertical],\n [\"lockAspectRatio\", image.lockAspectRatio],\n ] as const) {\n if (typeof value !== \"boolean\") {\n throw new InvalidPresentationInputError(`image ${image.id} ${key}`, \"must be boolean\");\n }\n }\n if (requireResolvedImages) image.sourceForSvg();\n }\n for (const table of slide.tables.items) validatePresentationTable(table);\n for (const group of slide.groups.items) {\n validatePresentationGroup(group, requireResolvedImages, new Set());\n }\n const indexedElements: PresentationElement[] = [\n ...slide.shapes.items,\n ...slide.charts.items,\n ...slide.images.items,\n ...slide.tables.items,\n ...slide.groups.items,\n ];\n if (\n slide.elements.length !== indexedElements.length ||\n new Set(slide.elements).size !== slide.elements.length ||\n indexedElements.some((element) => !slide.elements.includes(element))\n ) {\n throw new InvalidPresentationInputError(\n `slides[${slideIndex}].elements`,\n \"must contain each typed top-level element exactly once\",\n );\n }\n }\n}\n\nfunction validatePresentationTable(table: PresentationTable): void {\n assertSafeText(table.name, `table ${table.id} name`, 512);\n validatePosition(table.position, `table ${table.id} position`);\n colorValue(table.fill);\n validateLine(table.line, `table ${table.id} line`);\n validateTextStyle(table.textStyle, `table ${table.id} textStyle`);\n validateTableOccupancy(table.rows);\n for (const row of table.rows) {\n for (const cell of row) {\n if (!cell) continue;\n assertSafeText(cell.text.toString(), `table ${table.id} cell text`);\n validateTextStyle(cell.text.style, `table ${table.id} cell textStyle`);\n colorValue(cell.fill);\n }\n }\n normalizeTableDimensions(\n table.columnWidths.length === 0 ? undefined : table.columnWidths,\n table.rows[0]?.length ?? 0,\n \"columnWidths\",\n );\n normalizeTableDimensions(\n table.rowHeights.length === 0 ? undefined : table.rowHeights,\n table.rows.length,\n \"rowHeights\",\n );\n}\n\nfunction validatePresentationGroup(\n group: PresentationGroup,\n requireResolvedImages: boolean,\n ancestors: Set<PresentationGroup>,\n): void {\n if (ancestors.has(group)) {\n throw new InvalidPresentationInputError(`group ${group.id}`, \"contains a cycle\");\n }\n ancestors.add(group);\n assertSafeText(group.name, `group ${group.id} name`, 512);\n validatePosition(group.position, `group ${group.id} position`);\n validatePosition(\n {\n left: group.childOffset.left,\n top: group.childOffset.top,\n width: group.childExtent.width,\n height: group.childExtent.height,\n },\n `group ${group.id} child coordinate system`,\n );\n validateRotation(group.rotation, `group ${group.id} rotation`);\n for (const child of group.children) {\n if (child.slide !== group.slide) {\n throw new InvalidPresentationInputError(\n `group ${group.id}`,\n \"contains an element from another slide\",\n );\n }\n if (child instanceof PresentationGroup) {\n validatePresentationGroup(child, requireResolvedImages, ancestors);\n } else if (child instanceof PresentationTable) {\n validatePresentationTable(child);\n } else if (child instanceof PresentationShape) {\n validatePosition(child.position, `shape ${child.id} position`);\n assertSafeText(child.text.toString(), `shape ${child.id} text`);\n validateTextStyle(child.text.style, `shape ${child.id} textStyle`);\n colorValue(child.fill);\n validateLine(child.line, `shape ${child.id} line`);\n } else if (child instanceof PresentationChart) {\n validatePosition(child.position, `chart ${child.id} position`);\n for (const series of child.series.items)\n validateFiniteArray(series.values, `chart ${child.id} values`);\n } else if (child instanceof PresentationImage) {\n validatePosition(child.position, `image ${child.id} position`);\n if (requireResolvedImages) child.sourceForSvg();\n }\n }\n ancestors.delete(group);\n}\n\nfunction validatePosition(position: PresentationPosition, field: string): void {\n const values = [position.left, position.top, position.width, position.height];\n if (!values.every((value) => typeof value === \"number\" && Number.isFinite(value))) {\n throw new InvalidPresentationInputError(field, \"values must be finite numbers\");\n }\n if (position.width <= 0 || position.height <= 0) {\n throw new InvalidPresentationInputError(field, \"width and height must be positive\");\n }\n if (values.some((value) => Math.abs(value) > MAX_GEOMETRY_VALUE)) {\n throw new InvalidPresentationInputError(field, \"values exceed the supported geometry bounds\");\n }\n}\n\nfunction validateRotation(value: number, field: string): void {\n if (!Number.isFinite(value) || Math.abs(value) > MAX_GEOMETRY_VALUE) {\n throw new InvalidPresentationInputError(field, \"must be a bounded finite number\");\n }\n}\n\nfunction validateBorderRadius(value: number | string | undefined, field: string): void {\n if (value === undefined) return;\n if (typeof value === \"number\") {\n if (!Number.isFinite(value) || value < 0 || value > MAX_GEOMETRY_VALUE) {\n throw new InvalidPresentationInputError(field, \"must be a bounded non-negative number\");\n }\n return;\n }\n if (value !== \"rounded-full\" && !Object.hasOwn(BORDER_RADIUS_TOKENS, value)) {\n throw new InvalidPresentationInputError(field, \"uses an unsupported radius token\");\n }\n}\n\nfunction validateLine(line: PresentationLine, field: string): void {\n if (!line || typeof line !== \"object\") {\n throw new InvalidPresentationInputError(field, \"must be an object\");\n }\n if (line.style !== undefined && !LINE_STYLES.has(line.style)) {\n throw new InvalidPresentationInputError(field, \"uses an unsupported line style\");\n }\n if (line.fill !== undefined) colorValue(line.fill);\n if (\n line.width !== undefined &&\n (!Number.isFinite(line.width) || line.width < 0 || line.width > MAX_GEOMETRY_VALUE)\n ) {\n throw new InvalidPresentationInputError(field, \"width must be a bounded non-negative number\");\n }\n}\n\nfunction validateTextStyle(style: PresentationTextStyle, field: string): void {\n if (!style || typeof style !== \"object\") {\n throw new InvalidPresentationInputError(field, \"must be an object\");\n }\n if (style.fontFamily !== undefined) assertSafeText(style.fontFamily, `${field}.fontFamily`, 512);\n if (\n style.fontSize !== undefined &&\n (!Number.isFinite(style.fontSize) || style.fontSize <= 0 || style.fontSize > MAX_FONT_SIZE)\n ) {\n throw new InvalidPresentationInputError(\n `${field}.fontSize`,\n `must be greater than 0 and at most ${MAX_FONT_SIZE}`,\n );\n }\n if (style.color !== undefined) colorValue(style.color);\n if (style.alignment !== undefined && !TEXT_ALIGNMENTS.has(style.alignment)) {\n throw new InvalidPresentationInputError(`${field}.alignment`, \"is not supported\");\n }\n if (style.verticalAlignment !== undefined && !VERTICAL_ALIGNMENTS.has(style.verticalAlignment)) {\n throw new InvalidPresentationInputError(`${field}.verticalAlignment`, \"is not supported\");\n }\n for (const key of [\"bold\", \"italic\", \"underline\"] as const) {\n if (style[key] !== undefined && typeof style[key] !== \"boolean\") {\n throw new InvalidPresentationInputError(`${field}.${key}`, \"must be boolean\");\n }\n }\n}\n\nfunction validateOptionalFinite(value: number | undefined, field: string): void {\n if (value !== undefined && (!Number.isFinite(value) || Math.abs(value) > MAX_GEOMETRY_VALUE)) {\n throw new InvalidPresentationInputError(field, \"must be a bounded finite number\");\n }\n}\n\nfunction validateFiniteArray(values: number[], field: string): void {\n if (!Array.isArray(values)) {\n throw new InvalidPresentationInputError(field, \"must be an array\");\n }\n for (const value of values) validateOptionalFinite(value, field);\n}\n\nfunction assertSafeText(value: string, field: string, maxLength = MAX_TEXT_LENGTH): void {\n if (typeof value !== \"string\") {\n throw new InvalidPresentationInputError(field, \"must be a string\");\n }\n if (value.length > maxLength) {\n throw new InvalidPresentationInputError(field, `exceeds ${maxLength} UTF-16 code units`);\n }\n for (const character of value) {\n const codePoint = character.codePointAt(0)!;\n if (\n (codePoint < 0x20 && codePoint !== 0x09 && codePoint !== 0x0a && codePoint !== 0x0d) ||\n (codePoint >= 0xd800 && codePoint <= 0xdfff) ||\n codePoint === 0xfffe ||\n codePoint === 0xffff\n ) {\n throw new InvalidPresentationInputError(field, \"contains characters forbidden by XML 1.0\");\n }\n }\n}\n\nfunction copyImageBytes(value: ArrayBuffer | Uint8Array): Uint8Array {\n if (!(value instanceof ArrayBuffer) && !(value instanceof Uint8Array)) {\n throw new InvalidPresentationInputError(\"image blob\", \"must be an ArrayBuffer or Uint8Array\");\n }\n const bytes =\n value instanceof Uint8Array ? new Uint8Array(value) : new Uint8Array(value.slice(0));\n if (bytes.byteLength === 0 || bytes.byteLength > MAX_IMAGE_BYTES) {\n throw new InvalidPresentationInputError(\n \"image blob\",\n `must contain between 1 and ${MAX_IMAGE_BYTES} bytes`,\n );\n }\n return bytes;\n}\n\nfunction normalizeRasterMime(value: string): PresentationRasterImageContentType {\n try {\n return normalizeRasterContentType(value);\n } catch (error) {\n if (error instanceof RasterImageValidationError) {\n throw new InvalidPresentationInputError(\"image contentType\", error.detail);\n }\n throw error;\n }\n}\n\nfunction validateRasterBytes(\n bytes: Uint8Array,\n declaredType: string | undefined,\n field: string,\n): PresentationRasterImageContentType {\n try {\n return validateRasterImageBytes(bytes, declaredType);\n } catch (error) {\n if (error instanceof RasterImageValidationError) {\n throw new InvalidPresentationInputError(field, error.detail);\n }\n throw error;\n }\n}\n\nfunction parseRasterDataUrl(value: string): {\n type: PresentationRasterImageContentType;\n canonical: string;\n} {\n try {\n const result = canonicalizeRasterDataUrl(value, MAX_IMAGE_BYTES);\n return { type: result.contentType, canonical: result.canonical };\n } catch (error) {\n if (error instanceof RasterImageValidationError) {\n throw new InvalidPresentationInputError(\"image dataUrl\", error.detail);\n }\n throw error;\n }\n}\n\nfunction unresolvedImageUriError(id: string): UnsupportedPresentationFeatureError {\n return new UnsupportedPresentationFeatureError(\n \"unresolved image URI\",\n `Image ${id} is a host reference. Call image.resolveUri() explicitly before render or export`,\n );\n}\n\nfunction normalizePosition(\n input: Partial<PresentationPosition> | undefined,\n defaults: PresentationPosition = { left: 0, top: 0, width: 100, height: 100 },\n): PresentationPosition {\n const result = {\n left: input?.left ?? defaults.left,\n top: input?.top ?? defaults.top,\n width: input?.width ?? defaults.width,\n height: input?.height ?? defaults.height,\n };\n validatePosition(result, \"position\");\n return result;\n}\n\nfunction normalizeCrop(crop: {\n left: number;\n top: number;\n right: number;\n bottom: number;\n}): typeof crop {\n const normalized = { ...crop };\n if (\n !Object.values(normalized).every(\n (value) => typeof value === \"number\" && Number.isFinite(value) && value >= 0 && value <= 1,\n )\n ) {\n throw new InvalidPresentationInputError(\"image crop\", \"values must be between 0 and 1\");\n }\n if (normalized.left + normalized.right >= 1 || normalized.top + normalized.bottom >= 1) {\n throw new InvalidPresentationInputError(\n \"image crop\",\n \"cannot remove the complete source image\",\n );\n }\n return normalized;\n}\n\nfunction colorValue(fill: PresentationFill): string {\n if (typeof fill !== \"string\") {\n if (!fill || typeof fill !== \"object\" || (fill.type !== undefined && fill.type !== \"solid\")) {\n throw new InvalidPresentationInputError(\"fill\", \"must be a string or a solid color object\");\n }\n }\n const value = typeof fill === \"string\" ? fill : fill.color;\n if (typeof value !== \"string\") {\n throw new InvalidPresentationInputError(\"color\", \"must be a string\");\n }\n if (value === \"none\") return \"none\";\n const token = COLOR_TOKENS[value];\n if (token) return token;\n if (/^#[0-9a-f]{6}$/i.test(value)) return value.toLowerCase();\n if (/^#[0-9a-f]{3}$/i.test(value)) {\n return `#${value[1]}${value[1]}${value[2]}${value[2]}${value[3]}${value[3]}`.toLowerCase();\n }\n throw new InvalidPresentationInputError(\"color\", \"must be a known token, none, #RGB, or #RRGGBB\");\n}\n\nconst COLOR_TOKENS: Readonly<Record<string, string>> = {\n white: \"#ffffff\",\n black: \"#000000\",\n accent1: \"#2563eb\",\n accent2: \"#0f766e\",\n \"slate-50\": \"#f8fafc\",\n \"slate-100\": \"#f1f5f9\",\n \"slate-200\": \"#e2e8f0\",\n \"slate-300\": \"#cbd5e1\",\n \"slate-400\": \"#94a3b8\",\n \"slate-500\": \"#64748b\",\n \"slate-600\": \"#475569\",\n \"slate-700\": \"#334155\",\n \"slate-800\": \"#1e293b\",\n \"slate-900\": \"#0f172a\",\n \"slate-950\": \"#020617\",\n};\n\nfunction projectRecord(\n record: Record<string, unknown>,\n includeText: string | undefined,\n excludeText: string | undefined,\n): Record<string, unknown> {\n const include = parseProjection(includeText);\n const exclude = parseProjection(excludeText);\n if (include.size === 0 && exclude.size === 0) return record;\n const projected: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(record)) {\n if ((include.size === 0 || include.has(key)) && !exclude.has(key)) projected[key] = value;\n }\n return projected;\n}\n\nfunction parseProjection(value: string | undefined): Set<string> {\n return new Set(\n (value ?? \"\")\n .split(\",\")\n .map((part) => part.trim())\n .filter(Boolean),\n );\n}\n\nfunction boundPresentationRecords(\n records: Array<Record<string, unknown>>,\n maxChars: number,\n): PresentationInspectResult {\n if (!Number.isInteger(maxChars) || maxChars <= 0)\n throw new Error(\"inspect maxChars must be a positive integer\");\n return boundInspectionRecords(records, maxChars);\n}\n\nfunction jsonBlob(value: unknown, name: string): FileBlob {\n return new FileBlob([JSON.stringify(value, null, 2)], { name, type: \"application/json\" });\n}\n\nfunction positionTuple(position: PresentationPosition): [number, number, number, number] {\n return [position.left, position.top, position.width, position.height];\n}\n\nfunction finiteOr(value: number | undefined, fallback: number): number {\n if (value === undefined) return fallback;\n if (!Number.isFinite(value)) {\n throw new InvalidPresentationInputError(\"number\", \"must be finite\");\n }\n return value;\n}\n\nfunction truncate(value: string, max: number): string {\n return value.length <= max ? value : `${value.slice(0, Math.max(0, max - 1))}…`;\n}\n\nexport {\n assertRenderPixelBudget as assertPresentationRenderPixelBudget,\n colorValue as presentationColorValue,\n truncate as truncatePresentationText,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAGA,IAAM,YAAY,oBAAI,QAA4D;AAE3E,SAAS,sBACd,cACkD;AAClD,SAAO,UAAU,IAAI,YAAY;AACnC;AAEO,SAAS,yBACd,cACA,UACM;AACN,MAAI,SAAU,WAAU,IAAI,cAAc,QAAQ;AAAA,MAC7C,WAAU,OAAO,YAAY;AACpC;;;ACjBO,IAAM,kBACX;A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K,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC;AAC9E;","names":["executePresentationRender"]}
@@ -0,0 +1,40 @@
1
+ // src/inspection.ts
2
+ function defineHelpEntries(entries) {
3
+ return entries.map(([path, summary, ...examples]) => ({ path, summary, examples }));
4
+ }
5
+ function filterHelpEntries(entries, query, search, stripQueryPrefix = "") {
6
+ const normalized = query.trim().toLowerCase().replace(stripQueryPrefix, "");
7
+ return entries.filter((entry) => {
8
+ const content = `${entry.path} ${entry.summary} ${entry.examples.join(" ")}`.toLowerCase();
9
+ const matches = normalized === "*" || content.includes(normalized);
10
+ if (!matches || !search) return matches;
11
+ try {
12
+ return new RegExp(search, "iu").test(content);
13
+ } catch {
14
+ return content.includes(search.toLowerCase());
15
+ }
16
+ });
17
+ }
18
+ function boundInspectionRecords(records, maxChars) {
19
+ const accepted = [];
20
+ const lines = [];
21
+ let chars = 0;
22
+ for (const record of records) {
23
+ const line = JSON.stringify(record);
24
+ const additional = line.length + (accepted.length > 0 ? 1 : 0);
25
+ if (chars + additional > maxChars) {
26
+ return { records: accepted, ndjson: lines.join("\n"), truncated: true };
27
+ }
28
+ accepted.push(record);
29
+ lines.push(line);
30
+ chars += additional;
31
+ }
32
+ return { records: accepted, ndjson: lines.join("\n"), truncated: false };
33
+ }
34
+
35
+ export {
36
+ defineHelpEntries,
37
+ filterHelpEntries,
38
+ boundInspectionRecords
39
+ };
40
+ //# sourceMappingURL=chunk-Q2FFHEY7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/inspection.ts"],"sourcesContent":["export type HelpEntry = Record<string, unknown> & {\n path: string;\n summary: string;\n examples: string[];\n};\n\nexport function defineHelpEntries(\n entries: readonly (readonly [path: string, summary: string, ...examples: string[]])[],\n): HelpEntry[] {\n return entries.map(([path, summary, ...examples]) => ({ path, summary, examples }));\n}\n\nexport function filterHelpEntries(\n entries: readonly HelpEntry[],\n query: string,\n search?: string,\n stripQueryPrefix = \"\",\n): HelpEntry[] {\n const normalized = query.trim().toLowerCase().replace(stripQueryPrefix, \"\");\n return entries.filter((entry) => {\n const content = `${entry.path} ${entry.summary} ${entry.examples.join(\" \")}`.toLowerCase();\n const matches = normalized === \"*\" || content.includes(normalized);\n if (!matches || !search) return matches;\n try {\n return new RegExp(search, \"iu\").test(content);\n } catch {\n return content.includes(search.toLowerCase());\n }\n });\n}\n\nexport function boundInspectionRecords(\n records: readonly Record<string, unknown>[],\n maxChars: number,\n) {\n const accepted: Record<string, unknown>[] = [];\n const lines: string[] = [];\n let chars = 0;\n for (const record of records) {\n const line = JSON.stringify(record);\n const additional = line.length + (accepted.length > 0 ? 1 : 0);\n if (chars + additional > maxChars) {\n return { records: accepted, ndjson: lines.join(\"\\n\"), truncated: true };\n }\n accepted.push(record);\n lines.push(line);\n chars += additional;\n }\n return { records: accepted, ndjson: lines.join(\"\\n\"), truncated: false };\n}\n"],"mappings":";AAMO,SAAS,kBACd,SACa;AACb,SAAO,QAAQ,IAAI,CAAC,CAAC,MAAM,SAAY,WAAQ,OAAO,EAAE,MAAM,SAAS,SAAS,EAAE;AACpF;AAEO,SAAS,kBACd,SACA,OACA,QACA,mBAAmB,IACN;AACb,QAAM,aAAa,MAAM,KAAK,EAAE,YAAY,EAAE,QAAQ,kBAAkB,EAAE;AAC1E,SAAO,QAAQ,OAAO,CAAC,UAAU;AAC/B,UAAM,UAAU,GAAG,MAAM,IAAI,IAAI,MAAM,OAAO,IAAI,MAAM,SAAS,KAAK,GAAG,CAAC,GAAG,YAAY;AACzF,UAAM,UAAU,eAAe,OAAO,QAAQ,SAAS,UAAU;AACjE,QAAI,CAAC,WAAW,CAAC,OAAQ,QAAO;AAChC,QAAI;AACF,aAAO,IAAI,OAAO,QAAQ,IAAI,EAAE,KAAK,OAAO;AAAA,IAC9C,QAAQ;AACN,aAAO,QAAQ,SAAS,OAAO,YAAY,CAAC;AAAA,IAC9C;AAAA,EACF,CAAC;AACH;AAEO,SAAS,uBACd,SACA,UACA;AACA,QAAM,WAAsC,CAAC;AAC7C,QAAM,QAAkB,CAAC;AACzB,MAAI,QAAQ;AACZ,aAAW,UAAU,SAAS;AAC5B,UAAM,OAAO,KAAK,UAAU,MAAM;AAClC,UAAM,aAAa,KAAK,UAAU,SAAS,SAAS,IAAI,IAAI;AAC5D,QAAI,QAAQ,aAAa,UAAU;AACjC,aAAO,EAAE,SAAS,UAAU,QAAQ,MAAM,KAAK,IAAI,GAAG,WAAW,KAAK;AAAA,IACxE;AACA,aAAS,KAAK,MAAM;AACpB,UAAM,KAAK,IAAI;AACf,aAAS;AAAA,EACX;AACA,SAAO,EAAE,SAAS,UAAU,QAAQ,MAAM,KAAK,IAAI,GAAG,WAAW,MAAM;AACzE;","names":[]}
@@ -0,0 +1,57 @@
1
+ // src/document-docx-api.ts
2
+ var DOCX_MEDIA_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
3
+ var DocumentFidelityError = class extends Error {
4
+ constructor(message, issues) {
5
+ super(message);
6
+ this.issues = issues;
7
+ }
8
+ name = "DocumentFidelityError";
9
+ };
10
+
11
+ // src/document-docx-state.ts
12
+ var DOCUMENT_LOSS_PRESERVATION = /* @__PURE__ */ new WeakMap();
13
+ function documentFidelityReport(document) {
14
+ const envelope = DOCUMENT_LOSS_PRESERVATION.get(document);
15
+ if (!envelope) return [];
16
+ const changed = document.revision !== envelope.importedRevision;
17
+ return [
18
+ {
19
+ code: changed ? "content-will-be-discarded" : "content-preserved-in-source",
20
+ severity: changed ? "error" : "warning",
21
+ feature: "opaque-ooxml",
22
+ message: changed ? "The imported DOCX contains bounded inert OOXML outside the editable model; the document changed, so regenerating DOCX would discard it" : "The imported DOCX contains bounded inert OOXML outside the editable model; unchanged export returns the original package byte-for-byte",
23
+ parts: [...envelope.opaqueContent.parts],
24
+ relationships: envelope.opaqueContent.relationships.map((relationship) => ({
25
+ ...relationship
26
+ })),
27
+ contentTypes: envelope.opaqueContent.contentTypes.map((contentType) => ({ ...contentType }))
28
+ }
29
+ ];
30
+ }
31
+ function documentLossPreservationEnvelope(document) {
32
+ const envelope = DOCUMENT_LOSS_PRESERVATION.get(document);
33
+ if (!envelope) return null;
34
+ return {
35
+ version: 1,
36
+ mediaType: DOCX_MEDIA_TYPE,
37
+ sourceBytes: envelope.sourceBytes.slice(),
38
+ sourceDigest: envelope.sourceDigest,
39
+ opaqueContent: {
40
+ parts: [...envelope.opaqueContent.parts],
41
+ relationships: envelope.opaqueContent.relationships.map((relationship) => ({
42
+ ...relationship
43
+ })),
44
+ contentTypes: envelope.opaqueContent.contentTypes.map((contentType) => ({ ...contentType }))
45
+ },
46
+ modelDigest: envelope.modelDigest
47
+ };
48
+ }
49
+
50
+ export {
51
+ DOCX_MEDIA_TYPE,
52
+ DocumentFidelityError,
53
+ DOCUMENT_LOSS_PRESERVATION,
54
+ documentFidelityReport,
55
+ documentLossPreservationEnvelope
56
+ };
57
+ //# sourceMappingURL=chunk-RBGQADXA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/document-docx-api.ts","../src/document-docx-state.ts"],"sourcesContent":["import type { DocxImportLimits } from \"./document-docx-import\";\n\nexport const DOCX_MEDIA_TYPE =\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\" as const;\n\nexport type DocumentOpaqueRelationship = {\n sourcePart: string;\n type: string;\n targetPart: string;\n};\n\nexport type DocumentOpaqueContentType = {\n partName: string;\n contentType: string;\n};\n\nexport type DocumentOpaqueContent = {\n parts: readonly string[];\n relationships: readonly DocumentOpaqueRelationship[];\n contentTypes: readonly DocumentOpaqueContentType[];\n};\n\nexport type DocumentFidelityIssue = {\n code: \"content-preserved-in-source\" | \"content-will-be-discarded\";\n severity: \"warning\" | \"error\";\n feature: \"opaque-ooxml\";\n message: string;\n parts: readonly string[];\n relationships: readonly DocumentOpaqueRelationship[];\n contentTypes: readonly DocumentOpaqueContentType[];\n};\n\nexport type DocumentDocxImportOptions = {\n /** Preserve bounded inert OOXML outside the editable model, or reject it. */\n unsupportedContent?: \"preserve\" | \"error\";\n /** Every limit can only tighten the codec's hard browser-safe ceiling. */\n limits?: Partial<DocxImportLimits>;\n};\n\nexport type DocumentDocxExportOptions = {\n fileName?: string;\n /** Explicit acknowledgement required after editing a source with opaque OOXML. */\n unsupportedContent?: \"error\" | \"discard\";\n};\n\nexport type DocumentLossPreservationEnvelope = {\n version: 1;\n mediaType: typeof DOCX_MEDIA_TYPE;\n sourceBytes: Uint8Array;\n sourceDigest: string;\n opaqueContent: DocumentOpaqueContent;\n modelDigest: string;\n};\n\nexport class DocumentFidelityError extends Error {\n readonly name = \"DocumentFidelityError\";\n\n constructor(\n message: string,\n readonly issues: readonly DocumentFidelityIssue[],\n ) {\n super(message);\n }\n}\n","import type { Document } from \"./document\";\nimport {\n DOCX_MEDIA_TYPE,\n type DocumentFidelityIssue,\n type DocumentLossPreservationEnvelope,\n type DocumentOpaqueContent,\n} from \"./document-docx-api\";\n\nexport type DocumentLossPreservationState = {\n sourceBytes: Uint8Array;\n sourceDigest: string;\n importedRevision: number;\n opaqueContent: DocumentOpaqueContent;\n modelDigest: string;\n};\n\nexport const DOCUMENT_LOSS_PRESERVATION = new WeakMap<Document, DocumentLossPreservationState>();\n\nexport function documentFidelityReport(document: Document): readonly DocumentFidelityIssue[] {\n const envelope = DOCUMENT_LOSS_PRESERVATION.get(document);\n if (!envelope) return [];\n const changed = document.revision !== envelope.importedRevision;\n return [\n {\n code: changed ? \"content-will-be-discarded\" : \"content-preserved-in-source\",\n severity: changed ? \"error\" : \"warning\",\n feature: \"opaque-ooxml\",\n message: changed\n ? \"The imported DOCX contains bounded inert OOXML outside the editable model; the document changed, so regenerating DOCX would discard it\"\n : \"The imported DOCX contains bounded inert OOXML outside the editable model; unchanged export returns the original package byte-for-byte\",\n parts: [...envelope.opaqueContent.parts],\n relationships: envelope.opaqueContent.relationships.map((relationship) => ({\n ...relationship,\n })),\n contentTypes: envelope.opaqueContent.contentTypes.map((contentType) => ({ ...contentType })),\n },\n ];\n}\n\nexport function documentLossPreservationEnvelope(\n document: Document,\n): DocumentLossPreservationEnvelope | null {\n const envelope = DOCUMENT_LOSS_PRESERVATION.get(document);\n if (!envelope) return null;\n return {\n version: 1,\n mediaType: DOCX_MEDIA_TYPE,\n sourceBytes: envelope.sourceBytes.slice(),\n sourceDigest: envelope.sourceDigest,\n opaqueContent: {\n parts: [...envelope.opaqueContent.parts],\n relationships: envelope.opaqueContent.relationships.map((relationship) => ({\n ...relationship,\n })),\n contentTypes: envelope.opaqueContent.contentTypes.map((contentType) => ({ ...contentType })),\n },\n modelDigest: envelope.modelDigest,\n };\n}\n"],"mappings":";AAEO,IAAM,kBACX;AAmDK,IAAM,wBAAN,cAAoC,MAAM;AAAA,EAG/C,YACE,SACS,QACT;AACA,UAAM,OAAO;AAFJ;AAAA,EAGX;AAAA,EAPS,OAAO;AAQlB;;;AC/CO,IAAM,6BAA6B,oBAAI,QAAiD;AAExF,SAAS,uBAAuB,UAAsD;AAC3F,QAAM,WAAW,2BAA2B,IAAI,QAAQ;AACxD,MAAI,CAAC,SAAU,QAAO,CAAC;AACvB,QAAM,UAAU,SAAS,aAAa,SAAS;AAC/C,SAAO;AAAA,IACL;AAAA,MACE,MAAM,UAAU,8BAA8B;AAAA,MAC9C,UAAU,UAAU,UAAU;AAAA,MAC9B,SAAS;AAAA,MACT,SAAS,UACL,2IACA;AAAA,MACJ,OAAO,CAAC,GAAG,SAAS,cAAc,KAAK;AAAA,MACvC,eAAe,SAAS,cAAc,cAAc,IAAI,CAAC,kBAAkB;AAAA,QACzE,GAAG;AAAA,MACL,EAAE;AAAA,MACF,cAAc,SAAS,cAAc,aAAa,IAAI,CAAC,iBAAiB,EAAE,GAAG,YAAY,EAAE;AAAA,IAC7F;AAAA,EACF;AACF;AAEO,SAAS,iCACd,UACyC;AACzC,QAAM,WAAW,2BAA2B,IAAI,QAAQ;AACxD,MAAI,CAAC,SAAU,QAAO;AACtB,SAAO;AAAA,IACL,SAAS;AAAA,IACT,WAAW;AAAA,IACX,aAAa,SAAS,YAAY,MA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