@agimon-ai/doompi-author 0.0.1-alpha.2 → 0.0.1-alpha.21

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 (318) hide show
  1. package/README.md +5 -1
  2. package/dist/apiContracts.cjs +316 -0
  3. package/dist/apiContracts.cjs.map +1 -0
  4. package/dist/apiContracts.d.mts +53 -0
  5. package/dist/apiContracts.d.mts.map +1 -0
  6. package/dist/apiContracts.mjs +311 -0
  7. package/dist/apiContracts.mjs.map +1 -0
  8. package/dist/authorCommand-B90ghX5J.mjs +226 -0
  9. package/dist/authorCommand-B90ghX5J.mjs.map +1 -0
  10. package/dist/authorCommand-Cd5dnLF7.cjs +315 -0
  11. package/dist/authorCommand-Cd5dnLF7.cjs.map +1 -0
  12. package/dist/authorFacade-B9-Re3Ga.mjs +75 -0
  13. package/dist/authorFacade-B9-Re3Ga.mjs.map +1 -0
  14. package/dist/authorFacade-BvCSzZ5K.cjs +104 -0
  15. package/dist/authorFacade-BvCSzZ5K.cjs.map +1 -0
  16. package/dist/authorFacade-RZ6EXlR5.d.mts +113 -0
  17. package/dist/authorFacade-RZ6EXlR5.d.mts.map +1 -0
  18. package/dist/authorFacade.cjs +26 -0
  19. package/dist/authorFacade.d.mts +3 -0
  20. package/dist/authorFacade.mjs +3 -0
  21. package/dist/extensions/pi.cjs +172 -1
  22. package/dist/extensions/pi.cjs.map +1 -0
  23. package/dist/extensions/pi.d.mts +6 -2
  24. package/dist/extensions/pi.d.mts.map +1 -0
  25. package/dist/extensions/pi.mjs +167 -1
  26. package/dist/extensions/pi.mjs.map +1 -0
  27. package/dist/extensions/server.cjs +659 -0
  28. package/dist/extensions/server.cjs.map +1 -0
  29. package/dist/extensions/server.d.mts +5 -0
  30. package/dist/extensions/server.d.mts.map +1 -0
  31. package/dist/extensions/server.mjs +652 -0
  32. package/dist/extensions/server.mjs.map +1 -0
  33. package/dist/extensions/web.mjs +4231 -0
  34. package/dist/extensions/web.mjs.map +1 -0
  35. package/dist/index-Btm_xNOb.d.mts +386 -0
  36. package/dist/index-Btm_xNOb.d.mts.map +1 -0
  37. package/dist/index.cjs +35 -1
  38. package/dist/index.d.mts +2 -21
  39. package/dist/index.mjs +4 -1
  40. package/dist/monitor-7T5YF6px.mjs +70 -0
  41. package/dist/monitor-7T5YF6px.mjs.map +1 -0
  42. package/dist/monitor-BxY8s_AX.cjs +81 -0
  43. package/dist/monitor-BxY8s_AX.cjs.map +1 -0
  44. package/dist/structuredDocuments-Bg6DIqu5.cjs +960 -0
  45. package/dist/structuredDocuments-Bg6DIqu5.cjs.map +1 -0
  46. package/dist/structuredDocuments-CzMYD0Bq.mjs +810 -0
  47. package/dist/structuredDocuments-CzMYD0Bq.mjs.map +1 -0
  48. package/package.json +48 -38
  49. package/src/types/authorPreview.ts +76 -0
  50. package/src/types/webAuthor.ts +1 -1
  51. package/dist/_virtual/_rolldown/runtime.cjs +0 -1
  52. package/dist/adapters/authorApi.cjs +0 -2
  53. package/dist/adapters/authorApi.cjs.map +0 -1
  54. package/dist/adapters/authorBridgeApi.cjs +0 -2
  55. package/dist/adapters/authorBridgeApi.cjs.map +0 -1
  56. package/dist/adapters/authorDocumentApi.cjs +0 -2
  57. package/dist/adapters/authorDocumentApi.cjs.map +0 -1
  58. package/dist/adapters/pi/authorBridgeClient.cjs +0 -2
  59. package/dist/adapters/pi/authorBridgeClient.cjs.map +0 -1
  60. package/dist/adapters/pi/authorTools.cjs +0 -2
  61. package/dist/adapters/pi/authorTools.cjs.map +0 -1
  62. package/dist/adapters/pi/extension.cjs +0 -2
  63. package/dist/adapters/pi/extension.cjs.map +0 -1
  64. package/dist/adapters/structuredDocuments/common.cjs +0 -2
  65. package/dist/adapters/structuredDocuments/common.cjs.map +0 -1
  66. package/dist/adapters/structuredDocuments/csv.cjs +0 -7
  67. package/dist/adapters/structuredDocuments/csv.cjs.map +0 -1
  68. package/dist/adapters/structuredDocuments/index.cjs +0 -2
  69. package/dist/adapters/structuredDocuments/index.cjs.map +0 -1
  70. package/dist/adapters/structuredDocuments/markdownSlides.cjs +0 -6
  71. package/dist/adapters/structuredDocuments/markdownSlides.cjs.map +0 -1
  72. package/dist/adapters/structuredDocuments/ooxmlArchive.cjs +0 -2
  73. package/dist/adapters/structuredDocuments/ooxmlArchive.cjs.map +0 -1
  74. package/dist/adapters/structuredDocuments/pptx.cjs +0 -2
  75. package/dist/adapters/structuredDocuments/pptx.cjs.map +0 -1
  76. package/dist/adapters/structuredDocuments/xlsx.cjs +0 -2
  77. package/dist/adapters/structuredDocuments/xlsx.cjs.map +0 -1
  78. package/dist/adapters/structuredDocuments/xmlText.cjs +0 -2
  79. package/dist/adapters/structuredDocuments/xmlText.cjs.map +0 -1
  80. package/dist/adapters/webAuthorChannel.cjs +0 -2
  81. package/dist/adapters/webAuthorChannel.cjs.map +0 -1
  82. package/dist/commands/doomAuthorCommand.cjs +0 -2
  83. package/dist/commands/doomAuthorCommand.cjs.map +0 -1
  84. package/dist/container/index.cjs +0 -2
  85. package/dist/container/index.cjs.map +0 -1
  86. package/dist/extensions/pi.d.cts +0 -2
  87. package/dist/index.d.cts +0 -21
  88. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/engine/helpers/union.d.cts +0 -6
  89. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/engine/helpers/union.d.cts.map +0 -1
  90. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/engine/helpers/union.d.mts +0 -6
  91. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/engine/helpers/union.d.mts.map +0 -1
  92. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/_optional.d.cts +0 -7
  93. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/_optional.d.cts.map +0 -1
  94. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/_optional.d.mts +0 -7
  95. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/_optional.d.mts.map +0 -1
  96. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/object.d.cts +0 -12
  97. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/object.d.cts.map +0 -1
  98. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/object.d.mts +0 -12
  99. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/object.d.mts.map +0 -1
  100. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/properties.d.cts +0 -12
  101. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/properties.d.cts.map +0 -1
  102. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/properties.d.mts +0 -12
  103. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/properties.d.mts.map +0 -1
  104. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/record.d.cts +0 -9
  105. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/record.d.cts.map +0 -1
  106. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/record.d.mts +0 -9
  107. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/record.d.mts.map +0 -1
  108. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/schema.d.cts +0 -4
  109. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/schema.d.cts.map +0 -1
  110. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/schema.d.mts +0 -4
  111. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/schema.d.mts.map +0 -1
  112. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/string.d.cts +0 -9
  113. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/string.d.cts.map +0 -1
  114. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/string.d.mts +0 -9
  115. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/string.d.mts.map +0 -1
  116. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/unknown.d.cts +0 -8
  117. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/unknown.d.cts.map +0 -1
  118. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/unknown.d.mts +0 -8
  119. package/dist/node_modules/.pnpm/typebox@1.3.25/node_modules/typebox/build/type/types/unknown.d.mts.map +0 -1
  120. package/dist/packages/minor/doompi-author/src/adapters/authorApi.d.cts +0 -15
  121. package/dist/packages/minor/doompi-author/src/adapters/authorApi.d.cts.map +0 -1
  122. package/dist/packages/minor/doompi-author/src/adapters/authorApi.d.mts +0 -15
  123. package/dist/packages/minor/doompi-author/src/adapters/authorApi.d.mts.map +0 -1
  124. package/dist/packages/minor/doompi-author/src/adapters/authorApi.mjs +0 -2
  125. package/dist/packages/minor/doompi-author/src/adapters/authorApi.mjs.map +0 -1
  126. package/dist/packages/minor/doompi-author/src/adapters/authorBridgeApi.d.cts +0 -6
  127. package/dist/packages/minor/doompi-author/src/adapters/authorBridgeApi.d.cts.map +0 -1
  128. package/dist/packages/minor/doompi-author/src/adapters/authorBridgeApi.d.mts +0 -6
  129. package/dist/packages/minor/doompi-author/src/adapters/authorBridgeApi.d.mts.map +0 -1
  130. package/dist/packages/minor/doompi-author/src/adapters/authorBridgeApi.mjs +0 -2
  131. package/dist/packages/minor/doompi-author/src/adapters/authorBridgeApi.mjs.map +0 -1
  132. package/dist/packages/minor/doompi-author/src/adapters/authorDocumentApi.d.cts +0 -11
  133. package/dist/packages/minor/doompi-author/src/adapters/authorDocumentApi.d.cts.map +0 -1
  134. package/dist/packages/minor/doompi-author/src/adapters/authorDocumentApi.d.mts +0 -11
  135. package/dist/packages/minor/doompi-author/src/adapters/authorDocumentApi.d.mts.map +0 -1
  136. package/dist/packages/minor/doompi-author/src/adapters/authorDocumentApi.mjs +0 -2
  137. package/dist/packages/minor/doompi-author/src/adapters/authorDocumentApi.mjs.map +0 -1
  138. package/dist/packages/minor/doompi-author/src/adapters/pi/authorBridgeClient.d.cts +0 -18
  139. package/dist/packages/minor/doompi-author/src/adapters/pi/authorBridgeClient.d.cts.map +0 -1
  140. package/dist/packages/minor/doompi-author/src/adapters/pi/authorBridgeClient.d.mts +0 -18
  141. package/dist/packages/minor/doompi-author/src/adapters/pi/authorBridgeClient.d.mts.map +0 -1
  142. package/dist/packages/minor/doompi-author/src/adapters/pi/authorBridgeClient.mjs +0 -2
  143. package/dist/packages/minor/doompi-author/src/adapters/pi/authorBridgeClient.mjs.map +0 -1
  144. package/dist/packages/minor/doompi-author/src/adapters/pi/authorTools.d.cts +0 -9
  145. package/dist/packages/minor/doompi-author/src/adapters/pi/authorTools.d.cts.map +0 -1
  146. package/dist/packages/minor/doompi-author/src/adapters/pi/authorTools.d.mts +0 -9
  147. package/dist/packages/minor/doompi-author/src/adapters/pi/authorTools.d.mts.map +0 -1
  148. package/dist/packages/minor/doompi-author/src/adapters/pi/authorTools.mjs +0 -2
  149. package/dist/packages/minor/doompi-author/src/adapters/pi/authorTools.mjs.map +0 -1
  150. package/dist/packages/minor/doompi-author/src/adapters/pi/extension.d.cts +0 -19
  151. package/dist/packages/minor/doompi-author/src/adapters/pi/extension.d.cts.map +0 -1
  152. package/dist/packages/minor/doompi-author/src/adapters/pi/extension.d.mts +0 -19
  153. package/dist/packages/minor/doompi-author/src/adapters/pi/extension.d.mts.map +0 -1
  154. package/dist/packages/minor/doompi-author/src/adapters/pi/extension.mjs +0 -2
  155. package/dist/packages/minor/doompi-author/src/adapters/pi/extension.mjs.map +0 -1
  156. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/common.mjs +0 -2
  157. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/common.mjs.map +0 -1
  158. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/csv.d.cts +0 -7
  159. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/csv.d.cts.map +0 -1
  160. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/csv.d.mts +0 -7
  161. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/csv.d.mts.map +0 -1
  162. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/csv.mjs +0 -7
  163. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/csv.mjs.map +0 -1
  164. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/index.d.cts +0 -13
  165. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/index.d.cts.map +0 -1
  166. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/index.d.mts +0 -13
  167. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/index.d.mts.map +0 -1
  168. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/index.mjs +0 -2
  169. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/index.mjs.map +0 -1
  170. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/markdownSlides.d.cts +0 -7
  171. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/markdownSlides.d.cts.map +0 -1
  172. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/markdownSlides.d.mts +0 -7
  173. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/markdownSlides.d.mts.map +0 -1
  174. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/markdownSlides.mjs +0 -6
  175. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/markdownSlides.mjs.map +0 -1
  176. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/ooxmlArchive.d.cts +0 -13
  177. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/ooxmlArchive.d.cts.map +0 -1
  178. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/ooxmlArchive.d.mts +0 -13
  179. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/ooxmlArchive.d.mts.map +0 -1
  180. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/ooxmlArchive.mjs +0 -2
  181. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/ooxmlArchive.mjs.map +0 -1
  182. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/pptx.d.cts +0 -7
  183. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/pptx.d.cts.map +0 -1
  184. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/pptx.d.mts +0 -7
  185. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/pptx.d.mts.map +0 -1
  186. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/pptx.mjs +0 -2
  187. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/pptx.mjs.map +0 -1
  188. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xlsx.d.cts +0 -7
  189. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xlsx.d.cts.map +0 -1
  190. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xlsx.d.mts +0 -7
  191. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xlsx.d.mts.map +0 -1
  192. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xlsx.mjs +0 -2
  193. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xlsx.mjs.map +0 -1
  194. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xmlText.mjs +0 -2
  195. package/dist/packages/minor/doompi-author/src/adapters/structuredDocuments/xmlText.mjs.map +0 -1
  196. package/dist/packages/minor/doompi-author/src/adapters/webAuthorChannel.d.cts +0 -6
  197. package/dist/packages/minor/doompi-author/src/adapters/webAuthorChannel.d.cts.map +0 -1
  198. package/dist/packages/minor/doompi-author/src/adapters/webAuthorChannel.d.mts +0 -6
  199. package/dist/packages/minor/doompi-author/src/adapters/webAuthorChannel.d.mts.map +0 -1
  200. package/dist/packages/minor/doompi-author/src/adapters/webAuthorChannel.mjs +0 -2
  201. package/dist/packages/minor/doompi-author/src/adapters/webAuthorChannel.mjs.map +0 -1
  202. package/dist/packages/minor/doompi-author/src/commands/doomAuthorCommand.mjs +0 -2
  203. package/dist/packages/minor/doompi-author/src/commands/doomAuthorCommand.mjs.map +0 -1
  204. package/dist/packages/minor/doompi-author/src/container/index.d.cts +0 -5
  205. package/dist/packages/minor/doompi-author/src/container/index.d.cts.map +0 -1
  206. package/dist/packages/minor/doompi-author/src/container/index.d.mts +0 -5
  207. package/dist/packages/minor/doompi-author/src/container/index.d.mts.map +0 -1
  208. package/dist/packages/minor/doompi-author/src/container/index.mjs +0 -2
  209. package/dist/packages/minor/doompi-author/src/container/index.mjs.map +0 -1
  210. package/dist/packages/minor/doompi-author/src/schemas/authorTools.d.cts +0 -16
  211. package/dist/packages/minor/doompi-author/src/schemas/authorTools.d.cts.map +0 -1
  212. package/dist/packages/minor/doompi-author/src/schemas/authorTools.d.mts +0 -16
  213. package/dist/packages/minor/doompi-author/src/schemas/authorTools.d.mts.map +0 -1
  214. package/dist/packages/minor/doompi-author/src/schemas/authorTools.mjs +0 -2
  215. package/dist/packages/minor/doompi-author/src/schemas/authorTools.mjs.map +0 -1
  216. package/dist/packages/minor/doompi-author/src/services/authorBridgeState.d.cts +0 -31
  217. package/dist/packages/minor/doompi-author/src/services/authorBridgeState.d.cts.map +0 -1
  218. package/dist/packages/minor/doompi-author/src/services/authorBridgeState.d.mts +0 -31
  219. package/dist/packages/minor/doompi-author/src/services/authorBridgeState.d.mts.map +0 -1
  220. package/dist/packages/minor/doompi-author/src/services/authorBridgeState.mjs +0 -2
  221. package/dist/packages/minor/doompi-author/src/services/authorBridgeState.mjs.map +0 -1
  222. package/dist/packages/minor/doompi-author/src/services/authorCatalog.d.cts +0 -10
  223. package/dist/packages/minor/doompi-author/src/services/authorCatalog.d.cts.map +0 -1
  224. package/dist/packages/minor/doompi-author/src/services/authorCatalog.d.mts +0 -10
  225. package/dist/packages/minor/doompi-author/src/services/authorCatalog.d.mts.map +0 -1
  226. package/dist/packages/minor/doompi-author/src/services/authorMode.d.cts +0 -19
  227. package/dist/packages/minor/doompi-author/src/services/authorMode.d.cts.map +0 -1
  228. package/dist/packages/minor/doompi-author/src/services/authorMode.d.mts +0 -19
  229. package/dist/packages/minor/doompi-author/src/services/authorMode.d.mts.map +0 -1
  230. package/dist/packages/minor/doompi-author/src/services/authorMode.mjs +0 -3
  231. package/dist/packages/minor/doompi-author/src/services/authorMode.mjs.map +0 -1
  232. package/dist/packages/minor/doompi-author/src/services/extensionService.d.cts +0 -7
  233. package/dist/packages/minor/doompi-author/src/services/extensionService.d.cts.map +0 -1
  234. package/dist/packages/minor/doompi-author/src/services/extensionService.d.mts +0 -7
  235. package/dist/packages/minor/doompi-author/src/services/extensionService.d.mts.map +0 -1
  236. package/dist/packages/minor/doompi-author/src/services/extensionService.mjs +0 -2
  237. package/dist/packages/minor/doompi-author/src/services/extensionService.mjs.map +0 -1
  238. package/dist/packages/minor/doompi-author/src/types/author.d.cts +0 -39
  239. package/dist/packages/minor/doompi-author/src/types/author.d.cts.map +0 -1
  240. package/dist/packages/minor/doompi-author/src/types/author.d.mts +0 -39
  241. package/dist/packages/minor/doompi-author/src/types/author.d.mts.map +0 -1
  242. package/dist/packages/minor/doompi-author/src/types/author.mjs +0 -2
  243. package/dist/packages/minor/doompi-author/src/types/author.mjs.map +0 -1
  244. package/dist/packages/minor/doompi-author/src/types/authorApi.d.cts +0 -23
  245. package/dist/packages/minor/doompi-author/src/types/authorApi.d.cts.map +0 -1
  246. package/dist/packages/minor/doompi-author/src/types/authorApi.d.mts +0 -23
  247. package/dist/packages/minor/doompi-author/src/types/authorApi.d.mts.map +0 -1
  248. package/dist/packages/minor/doompi-author/src/types/authorApi.mjs +0 -2
  249. package/dist/packages/minor/doompi-author/src/types/authorApi.mjs.map +0 -1
  250. package/dist/packages/minor/doompi-author/src/types/extension.d.cts +0 -16
  251. package/dist/packages/minor/doompi-author/src/types/extension.d.cts.map +0 -1
  252. package/dist/packages/minor/doompi-author/src/types/extension.d.mts +0 -16
  253. package/dist/packages/minor/doompi-author/src/types/extension.d.mts.map +0 -1
  254. package/dist/packages/minor/doompi-author/src/types/structuredDocuments.d.cts +0 -60
  255. package/dist/packages/minor/doompi-author/src/types/structuredDocuments.d.cts.map +0 -1
  256. package/dist/packages/minor/doompi-author/src/types/structuredDocuments.d.mts +0 -60
  257. package/dist/packages/minor/doompi-author/src/types/structuredDocuments.d.mts.map +0 -1
  258. package/dist/packages/minor/doompi-author/src/types/webAuthor.d.cts +0 -67
  259. package/dist/packages/minor/doompi-author/src/types/webAuthor.d.cts.map +0 -1
  260. package/dist/packages/minor/doompi-author/src/types/webAuthor.d.mts +0 -67
  261. package/dist/packages/minor/doompi-author/src/types/webAuthor.d.mts.map +0 -1
  262. package/dist/packages/minor/doompi-author/src/types/webAuthor.mjs +0 -2
  263. package/dist/packages/minor/doompi-author/src/types/webAuthor.mjs.map +0 -1
  264. package/dist/schemas/authorTools.cjs +0 -2
  265. package/dist/schemas/authorTools.cjs.map +0 -1
  266. package/dist/services/authorBridgeState.cjs +0 -2
  267. package/dist/services/authorBridgeState.cjs.map +0 -1
  268. package/dist/services/authorMode.cjs +0 -3
  269. package/dist/services/authorMode.cjs.map +0 -1
  270. package/dist/services/extensionService.cjs +0 -2
  271. package/dist/services/extensionService.cjs.map +0 -1
  272. package/dist/sessionApi.cjs +0 -1
  273. package/dist/sessionApi.d.cts +0 -7
  274. package/dist/sessionApi.d.mts +0 -7
  275. package/dist/sessionApi.mjs +0 -1
  276. package/dist/types/author.cjs +0 -2
  277. package/dist/types/author.cjs.map +0 -1
  278. package/dist/types/authorApi.cjs +0 -2
  279. package/dist/types/authorApi.cjs.map +0 -1
  280. package/dist/types/webAuthor.cjs +0 -2
  281. package/dist/types/webAuthor.cjs.map +0 -1
  282. package/dist/webHub.cjs +0 -1
  283. package/dist/webHub.d.cts +0 -2
  284. package/dist/webHub.d.mts +0 -2
  285. package/dist/webHub.mjs +0 -1
  286. package/src/exports/webClient.ts +0 -76
  287. package/src/web/api/authorBroker.ts +0 -14
  288. package/src/web/api/authorBrowserBridge.ts +0 -225
  289. package/src/web/api/authorFiles.ts +0 -219
  290. package/src/web/api/authorMedia.ts +0 -19
  291. package/src/web/api/authorRuntime.ts +0 -164
  292. package/src/web/components/AuthorDocumentPanel.tsx +0 -232
  293. package/src/web/components/AuthorGridOverlay.tsx +0 -81
  294. package/src/web/components/AuthorMediaPreview.tsx +0 -41
  295. package/src/web/components/AuthorMediaView.tsx +0 -356
  296. package/src/web/components/AuthorPanel.tsx +0 -105
  297. package/src/web/components/AuthorRegionDrafts.tsx +0 -102
  298. package/src/web/components/AuthorRequestLog.tsx +0 -179
  299. package/src/web/components/AuthorStructuredView.tsx +0 -121
  300. package/src/web/components/AuthorTextView.tsx +0 -97
  301. package/src/web/components/AuthorToolPalette.tsx +0 -103
  302. package/src/web/components/AuthorVideoControls.tsx +0 -111
  303. package/src/web/components/DescribeAuthorToolsToolCard.tsx +0 -50
  304. package/src/web/components/OpenAuthoringFileToolCard.tsx +0 -66
  305. package/src/web/components/UseAuthorToolsToolCard.tsx +0 -50
  306. package/src/web/index.ts +0 -68
  307. package/src/web/lib/authorGrid.ts +0 -124
  308. package/src/web/lib/authorRegions.ts +0 -30
  309. package/src/web/lib/authorViewportTypes.ts +0 -202
  310. package/src/web/lib/describeAuthorToolsToolRender.ts +0 -20
  311. package/src/web/lib/useAuthorToolsToolRender.ts +0 -20
  312. package/src/web/stores/authorCapture.ts +0 -322
  313. package/src/web/stores/authorGridTools.ts +0 -316
  314. package/src/web/stores/authorProfiles.ts +0 -130
  315. package/src/web/stores/authorRequestLifecycle.ts +0 -82
  316. package/src/web/stores/authorStore.ts +0 -60
  317. package/src/web/stores/authorWorkspaceStore.ts +0 -525
  318. package/src/web/tsconfig.json +0 -22
@@ -0,0 +1,810 @@
1
+ import { parse } from "csv-parse/sync";
2
+ import { createHash } from "node:crypto";
3
+ import path from "node:path";
4
+ import { SaxesParser } from "saxes";
5
+ import yauzl from "yauzl";
6
+ import yazl from "yazl";
7
+ //#region src/models/authorBridgeState.ts
8
+ const AUTHOR_REQUEST_TIMEOUT_MS = 15e3;
9
+ const AUTHOR_OWNER_LEASE_MS = 1e4;
10
+ var AuthorBridgeError = class extends Error {
11
+ status;
12
+ constructor(message, status = 409) {
13
+ super(message);
14
+ this.status = status;
15
+ }
16
+ };
17
+ function createAuthorBridgeState(options) {
18
+ const { now, issueToken, scheduleTimeout } = options;
19
+ const timeoutMs = options.requestTimeoutMs ?? 15e3;
20
+ const leaseMs = options.leaseMs ?? 1e4;
21
+ let owner;
22
+ let pending;
23
+ let delivery;
24
+ let deliveryWaiter;
25
+ const tombstones = /* @__PURE__ */ new Set();
26
+ const rememberCancellation = (requestId) => {
27
+ tombstones.add(requestId);
28
+ if (tombstones.size > 100) tombstones.delete(tombstones.values().next().value);
29
+ };
30
+ const publishDelivery = (value) => {
31
+ if (deliveryWaiter === void 0) delivery = value;
32
+ else {
33
+ const waiter = deliveryWaiter;
34
+ deliveryWaiter = void 0;
35
+ waiter.resolve(value);
36
+ }
37
+ };
38
+ const rejectPending = (reason, sendCancel) => {
39
+ const current = pending;
40
+ if (current === void 0) return;
41
+ pending = void 0;
42
+ current.cancelTimer();
43
+ current.removeAbort?.();
44
+ rememberCancellation(current.request.requestId);
45
+ if (sendCancel) publishDelivery({
46
+ ...current.request,
47
+ kind: "cancel"
48
+ });
49
+ current.reject(new AuthorBridgeError(reason, 503));
50
+ };
51
+ const liveOwner = () => {
52
+ if (owner === void 0) throw new AuthorBridgeError("No Author viewport is registered.", 503);
53
+ if (owner.expiresAt <= now()) {
54
+ rejectPending("The Author viewport lease expired.", false);
55
+ owner = void 0;
56
+ throw new AuthorBridgeError("The Author viewport lease expired.", 503);
57
+ }
58
+ return owner;
59
+ };
60
+ const assertOwner = (bindingId, generation, ownerToken) => {
61
+ const current = liveOwner();
62
+ if (current.bindingId !== bindingId || current.generation !== generation || current.ownerToken !== ownerToken) throw new AuthorBridgeError("Stale Author viewport binding.");
63
+ return current;
64
+ };
65
+ const assertRequest = (bindingId, generation, ownerToken, catalogToken, requestId) => {
66
+ if (assertOwner(bindingId, generation, ownerToken).catalogToken !== catalogToken) throw new AuthorBridgeError("Stale Author catalog token.");
67
+ if (tombstones.has(requestId)) throw new AuthorBridgeError("The Author request was already cancelled.");
68
+ if (pending?.request.requestId !== requestId) throw new AuthorBridgeError("Stale Author request.");
69
+ return pending;
70
+ };
71
+ return {
72
+ register(bindingId, generation) {
73
+ if (bindingId === "" || !Number.isSafeInteger(generation) || generation < 0) throw new AuthorBridgeError("Invalid Author registration.", 400);
74
+ if (owner !== void 0 && owner.expiresAt > now()) {
75
+ if (owner.bindingId !== bindingId) throw new AuthorBridgeError("Another Author viewport owns the lease.");
76
+ if (generation < owner.generation) throw new AuthorBridgeError("Stale Author generation.");
77
+ if (generation === owner.generation) {
78
+ owner.expiresAt = now() + leaseMs;
79
+ return {
80
+ kind: "accepted",
81
+ generation,
82
+ ownerToken: owner.ownerToken,
83
+ ...owner.catalogToken === void 0 ? {} : { catalogToken: owner.catalogToken },
84
+ leaseMs
85
+ };
86
+ }
87
+ }
88
+ rejectPending("The Author viewport generation changed.", false);
89
+ delivery = void 0;
90
+ const current = {
91
+ bindingId,
92
+ generation,
93
+ ownerToken: issueToken(),
94
+ expiresAt: now() + leaseMs,
95
+ tools: []
96
+ };
97
+ owner = current;
98
+ return {
99
+ kind: "accepted",
100
+ generation,
101
+ ownerToken: current.ownerToken,
102
+ leaseMs
103
+ };
104
+ },
105
+ catalog(bindingId, generation, ownerToken, tools) {
106
+ const current = assertOwner(bindingId, generation, ownerToken);
107
+ if (!Array.isArray(tools) || tools.length > 15) throw new AuthorBridgeError("Invalid Author catalog.", 400);
108
+ const names = /* @__PURE__ */ new Set();
109
+ for (const tool of tools) {
110
+ if (typeof tool !== "object" || tool === null || typeof tool.name !== "string" || !/^[a-z][a-z0-9_]{0,29}$/.test(tool.name) || typeof tool.label !== "string" || typeof tool.description !== "string" || typeof tool.inputSchema !== "object" || tool.inputSchema === null || Array.isArray(tool.inputSchema) || names.has(tool.name)) throw new AuthorBridgeError("Invalid Author catalog.", 400);
111
+ names.add(tool.name);
112
+ }
113
+ if (pending !== void 0) throw new AuthorBridgeError("Cannot replace the Author catalog during a request.");
114
+ current.tools = tools.map((tool) => ({
115
+ ...tool,
116
+ inputSchema: { ...tool.inputSchema }
117
+ }));
118
+ current.catalogToken = issueToken();
119
+ current.expiresAt = now() + leaseMs;
120
+ return {
121
+ kind: "accepted",
122
+ generation,
123
+ ownerToken,
124
+ catalogToken: current.catalogToken,
125
+ leaseMs
126
+ };
127
+ },
128
+ describe() {
129
+ const current = liveOwner();
130
+ if (current.catalogToken === void 0) throw new AuthorBridgeError("The Author viewport has no catalog.", 503);
131
+ return {
132
+ catalogToken: current.catalogToken,
133
+ tools: current.tools
134
+ };
135
+ },
136
+ invoke(input, signal) {
137
+ let current;
138
+ try {
139
+ current = liveOwner();
140
+ if (current.catalogToken !== input.catalogToken) throw new AuthorBridgeError("The Author capability catalog changed.");
141
+ if (!current.tools.some((tool) => tool.name === input.name)) throw new AuthorBridgeError(`Unknown Author capability: ${input.name}`, 404);
142
+ if (pending !== void 0) throw new AuthorBridgeError("Another Author request is already pending.");
143
+ if (signal?.aborted) throw signal.reason instanceof Error ? signal.reason : /* @__PURE__ */ new Error("Author request cancelled.");
144
+ } catch (error) {
145
+ return Promise.reject(error);
146
+ }
147
+ const request = {
148
+ kind: "request",
149
+ generation: current.generation,
150
+ ownerToken: current.ownerToken,
151
+ catalogToken: current.catalogToken,
152
+ requestId: issueToken(),
153
+ name: input.name,
154
+ arguments: input.arguments
155
+ };
156
+ return new Promise((resolve, reject) => {
157
+ const cancel = (reason) => rejectPending(reason, true);
158
+ const cancelTimer = scheduleTimeout(() => cancel("The Author request timed out."), Math.min(timeoutMs, current.expiresAt - now()));
159
+ pending = {
160
+ request,
161
+ resolve,
162
+ reject,
163
+ cancelTimer
164
+ };
165
+ if (signal !== void 0) {
166
+ const onAbort = () => cancel("The Author request was cancelled.");
167
+ signal.addEventListener("abort", onAbort, { once: true });
168
+ pending.removeAbort = () => signal.removeEventListener("abort", onAbort);
169
+ }
170
+ publishDelivery(request);
171
+ });
172
+ },
173
+ async next(bindingId, generation, ownerToken, signal) {
174
+ assertOwner(bindingId, generation, ownerToken);
175
+ if (delivery !== void 0) {
176
+ const value = delivery;
177
+ delivery = void 0;
178
+ return value;
179
+ }
180
+ if (deliveryWaiter !== void 0) throw new AuthorBridgeError("An Author delivery poll is already active.");
181
+ return await new Promise((resolve, reject) => {
182
+ let waiter;
183
+ const onAbort = () => {
184
+ if (deliveryWaiter === waiter) deliveryWaiter = void 0;
185
+ reject(signal?.reason ?? /* @__PURE__ */ new Error("Author delivery poll cancelled."));
186
+ };
187
+ waiter = {
188
+ resolve(value) {
189
+ signal?.removeEventListener("abort", onAbort);
190
+ resolve(value);
191
+ },
192
+ reject
193
+ };
194
+ deliveryWaiter = waiter;
195
+ signal?.addEventListener("abort", onAbort, { once: true });
196
+ });
197
+ },
198
+ result(bindingId, generation, ownerToken, catalogToken, requestId, result) {
199
+ const current = assertRequest(bindingId, generation, ownerToken, catalogToken, requestId);
200
+ pending = void 0;
201
+ current.cancelTimer();
202
+ current.removeAbort?.();
203
+ current.resolve({
204
+ catalogToken,
205
+ name: current.request.name,
206
+ result
207
+ });
208
+ },
209
+ cancelled(bindingId, generation, ownerToken, catalogToken, requestId) {
210
+ const current = assertRequest(bindingId, generation, ownerToken, catalogToken, requestId);
211
+ pending = void 0;
212
+ current.cancelTimer();
213
+ current.removeAbort?.();
214
+ rememberCancellation(requestId);
215
+ current.reject(new AuthorBridgeError("The Author viewport cancelled the request."));
216
+ },
217
+ disconnect(bindingId, generation) {
218
+ if (owner?.bindingId !== bindingId || owner.generation !== generation) return;
219
+ rejectPending("The Author viewport disconnected.", false);
220
+ owner = void 0;
221
+ delivery = void 0;
222
+ },
223
+ close() {
224
+ rejectPending("The Author bridge closed.", false);
225
+ owner = void 0;
226
+ delivery = void 0;
227
+ deliveryWaiter?.reject(/* @__PURE__ */ new Error("The Author bridge closed."));
228
+ deliveryWaiter = void 0;
229
+ }
230
+ };
231
+ }
232
+ function digestOf(value) {
233
+ return createHash("sha256").update(value).digest("hex");
234
+ }
235
+ function parsedDocument(format, bytes, fragments, metadata = {}) {
236
+ return {
237
+ manifest: {
238
+ format,
239
+ sourceDigest: digestOf(bytes),
240
+ byteLength: bytes.byteLength,
241
+ fragmentCount: fragments.length,
242
+ metadata
243
+ },
244
+ fragments,
245
+ renderModel: renderModel(format, fragments)
246
+ };
247
+ }
248
+ function renderModel(format, fragments) {
249
+ return {
250
+ format,
251
+ blocks: fragments.map(({ id, text, readOnly }) => ({
252
+ id,
253
+ text,
254
+ readOnly: readOnly === true
255
+ }))
256
+ };
257
+ }
258
+ function preflight(document, operations, validate, binding) {
259
+ const fragments = new Map(document.fragments.map((fragment) => [fragment.id, fragment]));
260
+ const seen = /* @__PURE__ */ new Set();
261
+ const issues = [];
262
+ const log = [];
263
+ let replacementBytes = 0;
264
+ for (const operation of operations) {
265
+ const fragment = fragments.get(operation.fragmentId);
266
+ if (!fragment) {
267
+ issues.push({
268
+ code: "unknown-fragment",
269
+ message: "The operation names an unknown fragment.",
270
+ fragmentId: operation.fragmentId
271
+ });
272
+ continue;
273
+ }
274
+ if (seen.has(operation.fragmentId)) {
275
+ issues.push({
276
+ code: "duplicate-operation",
277
+ message: "A fragment may be replaced only once.",
278
+ fragmentId: operation.fragmentId
279
+ });
280
+ continue;
281
+ }
282
+ seen.add(operation.fragmentId);
283
+ const operationBytes = new TextEncoder().encode(operation.replacement).byteLength;
284
+ replacementBytes += operationBytes;
285
+ if (operationBytes > 10485760 || replacementBytes > 104857600) {
286
+ issues.push({
287
+ code: "replacement-limit",
288
+ message: "Replacement content exceeds the document mutation limits.",
289
+ fragmentId: operation.fragmentId
290
+ });
291
+ continue;
292
+ }
293
+ if (fragment.readOnly === true) {
294
+ issues.push({
295
+ code: "read-only",
296
+ message: "The fragment is read-only.",
297
+ fragmentId: operation.fragmentId
298
+ });
299
+ continue;
300
+ }
301
+ const issue = validate?.(operation, fragment);
302
+ if (issue) issues.push(issue);
303
+ else log.push({
304
+ ...operation,
305
+ previous: fragment.text
306
+ });
307
+ }
308
+ const digest = digestOf(JSON.stringify({
309
+ format: document.manifest.format,
310
+ binding,
311
+ sourceDigest: document.manifest.sourceDigest,
312
+ operations: log,
313
+ issues
314
+ }));
315
+ return {
316
+ accepted: issues.length === 0,
317
+ digest,
318
+ sourceDigest: document.manifest.sourceDigest,
319
+ operations: log,
320
+ issues
321
+ };
322
+ }
323
+ function requireAccepted(report, expectedDigest) {
324
+ if (!report.accepted || report.digest !== expectedDigest) throw new Error("An accepted, current preflight report digest is required.");
325
+ }
326
+ function decodeUtf8(bytes) {
327
+ const text = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
328
+ if (text.includes("\0")) throw new Error("NUL bytes are not supported.");
329
+ return text;
330
+ }
331
+ //#endregion
332
+ //#region src/services/structuredDocuments/csv.ts
333
+ const FORMULA_TRIGGER = /^\s*[=+\-@]/;
334
+ const MAX_CELLS = 1e6;
335
+ function detectDialect(text) {
336
+ const recordDelimiter = text.includes("\r\n") ? "\r\n" : "\n";
337
+ const firstRecord = text.split(/\r?\n/, 1)[0] ?? "";
338
+ return {
339
+ delimiter: [
340
+ ",",
341
+ ";",
342
+ " ",
343
+ "|"
344
+ ].reduce((best, candidate) => firstRecord.split(candidate).length > firstRecord.split(best).length ? candidate : best),
345
+ quote: "\"",
346
+ recordDelimiter
347
+ };
348
+ }
349
+ function normalizeDialect(text, requestedDialect) {
350
+ if (requestedDialect !== void 0 && (typeof requestedDialect !== "object" || requestedDialect === null || Array.isArray(requestedDialect))) throw new Error("CSV dialect must be an object.");
351
+ const dialect = {
352
+ ...detectDialect(text),
353
+ ...requestedDialect
354
+ };
355
+ if (![
356
+ ",",
357
+ ";",
358
+ " ",
359
+ "|"
360
+ ].includes(dialect.delimiter)) throw new Error("Invalid CSV delimiter.");
361
+ if (!["\"", "'"].includes(dialect.quote)) throw new Error("Invalid CSV quote.");
362
+ if (!["\n", "\r\n"].includes(dialect.recordDelimiter)) throw new Error("Invalid CSV record delimiter.");
363
+ return dialect;
364
+ }
365
+ function parseCsv(source, requestedDialect) {
366
+ const bytes = typeof source === "string" ? new TextEncoder().encode(source) : source;
367
+ if (bytes.byteLength > 26214400) throw new Error("CSV input exceeds the size limit.");
368
+ const text = decodeUtf8(bytes);
369
+ const dialect = normalizeDialect(text, requestedDialect);
370
+ const records = parse(text, {
371
+ bom: true,
372
+ delimiter: dialect.delimiter,
373
+ quote: dialect.quote,
374
+ record_delimiter: [dialect.recordDelimiter],
375
+ relax_column_count: false,
376
+ skip_empty_lines: false
377
+ });
378
+ if (records.reduce((total, row) => total + row.length, 0) > MAX_CELLS) throw new Error("CSV input has too many cells.");
379
+ return parsedDocument("csv", bytes, records.flatMap((row, rowIndex) => row.map((text, columnIndex) => {
380
+ if (FORMULA_TRIGGER.test(text)) throw new Error(`CSV formula trigger rejected at row ${rowIndex + 1}.`);
381
+ return {
382
+ id: `cell:${rowIndex + 1}:${columnIndex + 1}`,
383
+ kind: "cell",
384
+ text,
385
+ location: `row ${rowIndex + 1}, column ${columnIndex + 1}`
386
+ };
387
+ })), {
388
+ rows: records.length,
389
+ columns: records.reduce((maximum, row) => Math.max(maximum, row.length), 0),
390
+ delimiter: dialect.delimiter,
391
+ quote: dialect.quote,
392
+ recordDelimiter: dialect.recordDelimiter
393
+ });
394
+ }
395
+ function preflightCsv(source, operations, dialect) {
396
+ const bytes = typeof source === "string" ? new TextEncoder().encode(source) : source;
397
+ const normalizedDialect = normalizeDialect(decodeUtf8(bytes), dialect);
398
+ return preflight(parseCsv(bytes, normalizedDialect), operations, (operation) => FORMULA_TRIGGER.test(operation.replacement) ? {
399
+ code: "formula-trigger",
400
+ message: "CSV values may not begin with a formula trigger.",
401
+ fragmentId: operation.fragmentId
402
+ } : void 0, { dialect: normalizedDialect });
403
+ }
404
+ function encodeCell(value, dialect) {
405
+ const escaped = value.replaceAll(dialect.quote, dialect.quote + dialect.quote);
406
+ return value.includes(dialect.delimiter) || value.includes(dialect.quote) || /[\r\n]/.test(value) ? `${dialect.quote}${escaped}${dialect.quote}` : escaped;
407
+ }
408
+ function serializeCsv(source, operations, acceptedReportDigest, requestedDialect) {
409
+ const dialect = normalizeDialect(typeof source === "string" ? source : decodeUtf8(source), requestedDialect);
410
+ const document = parseCsv(source, dialect);
411
+ const report = preflightCsv(source, operations, dialect);
412
+ requireAccepted(report, acceptedReportDigest);
413
+ const replacements = new Map(report.operations.map((operation) => [operation.fragmentId, operation.replacement]));
414
+ const fragments = new Map(document.fragments.map((fragment) => [fragment.id, fragment]));
415
+ const rows = Number(document.manifest.metadata.rows);
416
+ const columns = Number(document.manifest.metadata.columns);
417
+ const outputRows = [];
418
+ for (let row = 1; row <= rows; row += 1) {
419
+ const values = [];
420
+ for (let column = 1; column <= columns; column += 1) {
421
+ const id = `cell:${row}:${column}`;
422
+ const fragment = fragments.get(id);
423
+ if (fragment) values.push(encodeCell(replacements.get(id) ?? fragment.text, dialect));
424
+ }
425
+ outputRows.push(values.join(dialect.delimiter));
426
+ }
427
+ const bytes = new TextEncoder().encode(outputRows.join(dialect.recordDelimiter));
428
+ return {
429
+ bytes,
430
+ operationLog: report.operations,
431
+ manifest: parseCsv(bytes, dialect).manifest
432
+ };
433
+ }
434
+ //#endregion
435
+ //#region src/services/structuredDocuments/markdownSlides.ts
436
+ const SLIDE_SEPARATOR = /^(?:---|\*\*\*)[ \t]*$/m;
437
+ const MAX_SLIDES = 1e3;
438
+ function parseMarkdownSlides(source) {
439
+ const bytes = typeof source === "string" ? new TextEncoder().encode(source) : source;
440
+ if (bytes.byteLength > 26214400) throw new Error("Markdown input exceeds the size limit.");
441
+ const slides = decodeUtf8(bytes).split(SLIDE_SEPARATOR);
442
+ if (slides.length > MAX_SLIDES) throw new Error("Markdown input has too many slides.");
443
+ const fragments = slides.map((slide, index) => ({
444
+ id: `slide:${index + 1}`,
445
+ kind: "slide",
446
+ text: slide.replace(/^\r?\n+|\r?\n+$/g, ""),
447
+ location: `slide ${index + 1}`
448
+ }));
449
+ return parsedDocument("markdown-slides", bytes, fragments, { slideCount: fragments.length });
450
+ }
451
+ function preflightMarkdownSlides(source, operations) {
452
+ return preflight(parseMarkdownSlides(source), operations);
453
+ }
454
+ function serializeMarkdownSlides(source, operations, acceptedReportDigest) {
455
+ const document = parseMarkdownSlides(source);
456
+ const report = preflight(document, operations);
457
+ requireAccepted(report, acceptedReportDigest);
458
+ const replacements = new Map(report.operations.map((operation) => [operation.fragmentId, operation.replacement]));
459
+ const output = document.fragments.map((fragment) => replacements.get(fragment.id) ?? fragment.text).join("\n\n---\n\n");
460
+ const bytes = new TextEncoder().encode(output);
461
+ return {
462
+ bytes,
463
+ operationLog: report.operations,
464
+ manifest: parseMarkdownSlides(bytes).manifest
465
+ };
466
+ }
467
+ //#endregion
468
+ //#region src/services/structuredDocuments/ooxmlArchive.ts
469
+ function normalizedEntryName(name) {
470
+ const slashName = name.replaceAll("\\", "/");
471
+ if (slashName.startsWith("/") || /^[A-Za-z]:/.test(slashName)) throw new Error("Absolute archive entry path rejected.");
472
+ const normalized = path.posix.normalize(slashName);
473
+ if (normalized === ".." || normalized.startsWith("..") || normalized.includes("/../")) throw new Error("Archive path traversal rejected.");
474
+ return normalized.replace(/^\.\//, "");
475
+ }
476
+ function openArchive(bytes) {
477
+ return new Promise((resolve, reject) => {
478
+ yauzl.fromBuffer(bytes, {
479
+ lazyEntries: true,
480
+ decodeStrings: true,
481
+ validateEntrySizes: true
482
+ }, (error, zipFile) => {
483
+ if (error || !zipFile) reject(error ?? /* @__PURE__ */ new Error("Malformed ZIP archive."));
484
+ else resolve(zipFile);
485
+ });
486
+ });
487
+ }
488
+ function readEntry(zipFile, entry) {
489
+ return new Promise((resolve, reject) => {
490
+ zipFile.openReadStream(entry, (error, stream) => {
491
+ if (error || !stream) {
492
+ reject(error ?? /* @__PURE__ */ new Error("Could not read archive entry."));
493
+ return;
494
+ }
495
+ const chunks = [];
496
+ stream.on("data", (chunk) => chunks.push(chunk));
497
+ stream.once("error", reject);
498
+ stream.once("end", () => resolve(Buffer.concat(chunks)));
499
+ });
500
+ });
501
+ }
502
+ function validateXml(name, data) {
503
+ if (data.byteLength > 10485760) throw new Error(`XML entry exceeds its size limit: ${name}`);
504
+ const xml = new TextDecoder("utf-8", { fatal: true }).decode(data);
505
+ const withoutDeclaration = xml.replace(/^\uFEFF?\s*<\?xml\s[^?]*\?>/i, "");
506
+ if (/<!DOCTYPE|<!ENTITY|<\?/i.test(withoutDeclaration)) throw new Error(`Unsafe XML construct rejected: ${name}`);
507
+ const parser = new SaxesParser({ xmlns: true });
508
+ let parseError;
509
+ parser.on("error", (error) => {
510
+ parseError = error;
511
+ });
512
+ parser.write(xml).close();
513
+ if (parseError) throw new Error(`Malformed XML entry: ${name}`);
514
+ if (/TargetMode\s*=\s*["']External["']/i.test(xml)) throw new Error("External OOXML relationship rejected.");
515
+ if (/<(?:\w+:)?(?:workbookProtection|sheetProtection|documentProtection|modifyVerifier)\b/i.test(xml)) throw new Error("Protected OOXML content rejected.");
516
+ }
517
+ async function readOoxmlArchive(source) {
518
+ if (source.byteLength > 26214400) throw new Error("OOXML archive exceeds the compressed size limit.");
519
+ const zipFile = await openArchive(Buffer.from(source));
520
+ return await new Promise((resolve, reject) => {
521
+ const entries = [];
522
+ const names = /* @__PURE__ */ new Set();
523
+ let expanded = 0;
524
+ const fail = (error) => {
525
+ zipFile.close();
526
+ reject(error instanceof Error ? error : new Error(String(error)));
527
+ };
528
+ zipFile.once("error", fail);
529
+ zipFile.on("entry", (entry) => {
530
+ (async () => {
531
+ if (entries.length >= 4096) throw new Error("OOXML archive has too many entries.");
532
+ if ((entry.generalPurposeBitFlag & 1) !== 0) throw new Error("Encrypted OOXML archive rejected.");
533
+ if ((entry.externalFileAttributes >>> 16 & 61440) === 40960) throw new Error("Archive symlink rejected.");
534
+ if (entry.compressionMethod !== 0 && entry.compressionMethod !== 8) throw new Error("Unsupported ZIP compression method.");
535
+ const name = normalizedEntryName(entry.fileName);
536
+ if (!name || names.has(name)) throw new Error("Duplicate normalized archive entry rejected.");
537
+ names.add(name);
538
+ expanded += entry.uncompressedSize;
539
+ if (expanded > 104857600) throw new Error("OOXML archive exceeds the expanded size limit.");
540
+ if (entry.uncompressedSize > Math.max(1, entry.compressedSize) * 100) throw new Error("OOXML archive compression ratio exceeds the limit.");
541
+ const lower = name.toLowerCase();
542
+ if (lower === "encryptedpackage" || lower === "encryptioninfo" || lower.includes("vbaproject") || lower.includes("_xmlsignatures") || lower.endsWith(".bin")) throw new Error("Encrypted, signed, or macro-enabled OOXML content rejected.");
543
+ const data = name.endsWith("/") ? Buffer.alloc(0) : await readEntry(zipFile, entry);
544
+ if (/\.xml$|\.rels$/i.test(name)) validateXml(name, data);
545
+ entries.push({
546
+ name,
547
+ data,
548
+ compressionMethod: entry.compressionMethod
549
+ });
550
+ zipFile.readEntry();
551
+ })().catch(fail);
552
+ });
553
+ zipFile.once("end", () => {
554
+ if (!names.has("[Content_Types].xml")) {
555
+ fail(/* @__PURE__ */ new Error("Unsupported OOXML archive: missing content types."));
556
+ return;
557
+ }
558
+ resolve({
559
+ entries,
560
+ byName: new Map(entries.map((entry) => [entry.name, entry]))
561
+ });
562
+ });
563
+ zipFile.readEntry();
564
+ });
565
+ }
566
+ function assertOoxmlKind(archive, kind) {
567
+ const contentTypes = archive.byName.get("[Content_Types].xml")?.data.toString("utf8") ?? "";
568
+ const required = kind === "pptx" ? "presentationml.presentation.main+xml" : "spreadsheetml.sheet.main+xml";
569
+ if (!contentTypes.includes(required)) throw new Error(`Unsupported OOXML archive: not a ${kind.toUpperCase()} document.`);
570
+ if (/macroEnabled|vnd\.ms-office\.vbaProject/i.test(contentTypes)) throw new Error("Macro-enabled OOXML content rejected.");
571
+ }
572
+ async function writeOoxmlArchive(archive, replacements) {
573
+ const zipFile = new yazl.ZipFile();
574
+ const chunks = [];
575
+ const output = new Promise((resolve, reject) => {
576
+ zipFile.outputStream.on("data", (chunk) => chunks.push(chunk));
577
+ zipFile.outputStream.once("error", reject);
578
+ zipFile.outputStream.once("end", () => resolve(Buffer.concat(chunks)));
579
+ });
580
+ for (const entry of archive.entries) if (entry.name.endsWith("/")) zipFile.addEmptyDirectory(entry.name);
581
+ else zipFile.addBuffer(replacements.get(entry.name) ?? entry.data, entry.name, { compress: entry.compressionMethod === 8 });
582
+ zipFile.end();
583
+ return await output;
584
+ }
585
+ //#endregion
586
+ //#region src/services/structuredDocuments/xmlText.ts
587
+ function decodeXmlText(value) {
588
+ return value.replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&quot;", "\"").replaceAll("&apos;", "'").replaceAll("&amp;", "&");
589
+ }
590
+ function encodeXmlText(value) {
591
+ return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
592
+ }
593
+ function replaceRange(source, start, end, replacement) {
594
+ return source.slice(0, start) + replacement + source.slice(end);
595
+ }
596
+ //#endregion
597
+ //#region src/services/structuredDocuments/pptx.ts
598
+ async function stateOf$1(source) {
599
+ const archive = await readOoxmlArchive(source);
600
+ assertOoxmlKind(archive, "pptx");
601
+ const fragments = [];
602
+ const ranges = /* @__PURE__ */ new Map();
603
+ const slideEntries = archive.entries.filter((entry) => /^ppt\/slides\/slide\d+\.xml$/i.test(entry.name)).sort((left, right) => left.name.localeCompare(right.name, void 0, { numeric: true }));
604
+ for (const entry of slideEntries) {
605
+ const paragraphs = entry.data.toString("utf8").matchAll(/<a:p(?:\s[^>]*)?>([\s\S]*?)<\/a:p>/g);
606
+ let runIndex = 0;
607
+ for (const paragraph of paragraphs) {
608
+ const body = paragraph[1] ?? "";
609
+ const runCount = (body.match(/<a:r(?:\s[^>]*)?>/g) ?? []).length;
610
+ const textCount = (body.match(/<a:t(?:\s[^>]*)?>/g) ?? []).length;
611
+ if (textCount === 0) continue;
612
+ if (runCount !== 1 || textCount !== 1) throw new Error("Unsupported PPTX paragraph with multiple text styles.");
613
+ const textMatch = /<a:t(?:\s[^>]*)?>([\s\S]*?)<\/a:t>/.exec(body);
614
+ if (!textMatch) throw new Error("Malformed PPTX text run.");
615
+ runIndex += 1;
616
+ const id = `${entry.name}#text:${runIndex}`;
617
+ const paragraphStart = paragraph.index ?? 0;
618
+ const bodyOffset = paragraph[0].indexOf(body);
619
+ const textOffset = body.indexOf(textMatch[1] ?? "", textMatch.index);
620
+ const start = paragraphStart + bodyOffset + textOffset;
621
+ const end = start + (textMatch[1]?.length ?? 0);
622
+ fragments.push({
623
+ id,
624
+ kind: "text-run",
625
+ text: decodeXmlText(textMatch[1] ?? ""),
626
+ location: entry.name
627
+ });
628
+ ranges.set(id, {
629
+ entry: entry.name,
630
+ start,
631
+ end
632
+ });
633
+ }
634
+ }
635
+ return {
636
+ archive,
637
+ document: parsedDocument("pptx", source, fragments, { slides: slideEntries.length }),
638
+ ranges
639
+ };
640
+ }
641
+ async function parsePptx(source) {
642
+ return (await stateOf$1(source)).document;
643
+ }
644
+ async function preflightPptx(source, operations) {
645
+ return preflight((await stateOf$1(source)).document, operations);
646
+ }
647
+ async function serializePptx(source, operations, acceptedReportDigest) {
648
+ const state = await stateOf$1(source);
649
+ const report = preflight(state.document, operations);
650
+ requireAccepted(report, acceptedReportDigest);
651
+ const byEntry = /* @__PURE__ */ new Map();
652
+ for (const operation of report.operations) {
653
+ const range = state.ranges.get(operation.fragmentId);
654
+ if (!range) throw new Error("PPTX text run changed during serialization.");
655
+ const list = byEntry.get(range.entry) ?? [];
656
+ list.push({
657
+ start: range.start,
658
+ end: range.end,
659
+ replacement: encodeXmlText(operation.replacement)
660
+ });
661
+ byEntry.set(range.entry, list);
662
+ }
663
+ const replacements = /* @__PURE__ */ new Map();
664
+ for (const [entryName, edits] of byEntry) {
665
+ let xml = state.archive.byName.get(entryName)?.data.toString("utf8") ?? "";
666
+ for (const edit of edits.sort((left, right) => right.start - left.start)) xml = replaceRange(xml, edit.start, edit.end, edit.replacement);
667
+ replacements.set(entryName, Buffer.from(xml));
668
+ }
669
+ const bytes = await writeOoxmlArchive(state.archive, replacements);
670
+ return {
671
+ bytes,
672
+ operationLog: report.operations,
673
+ manifest: (await parsePptx(bytes)).manifest
674
+ };
675
+ }
676
+ //#endregion
677
+ //#region src/services/structuredDocuments/xlsx.ts
678
+ function textNodes(xml) {
679
+ return [...xml.matchAll(/<(?:\w+:)?t(?:\s[^>]*)?>([\s\S]*?)<\/(?:\w+:)?t>/g)].map((match) => decodeXmlText(match[1] ?? "")).join("");
680
+ }
681
+ function sharedStrings(archive) {
682
+ const xml = archive.byName.get("xl/sharedStrings.xml")?.data.toString("utf8");
683
+ if (!xml) return [];
684
+ return [...xml.matchAll(/<si(?:\s[^>]*)?>([\s\S]*?)<\/si>/g)].map((match) => {
685
+ const body = match[1] ?? "";
686
+ return {
687
+ text: textNodes(body),
688
+ multiRun: [...body.matchAll(/<(?:\w+:)?r(?:\s[^>]*)?>/g)].length > 1
689
+ };
690
+ });
691
+ }
692
+ function attribute(attributes, name) {
693
+ return new RegExp(`\\s${name}=["']([^"']*)["']`).exec(attributes)?.[1];
694
+ }
695
+ async function stateOf(source) {
696
+ const archive = await readOoxmlArchive(source);
697
+ assertOoxmlKind(archive, "xlsx");
698
+ const shared = sharedStrings(archive);
699
+ const fragments = [];
700
+ const ranges = /* @__PURE__ */ new Map();
701
+ const worksheets = archive.entries.filter((entry) => /^xl\/worksheets\/sheet\d+\.xml$/i.test(entry.name)).sort((left, right) => left.name.localeCompare(right.name, void 0, { numeric: true }));
702
+ for (const entry of worksheets) {
703
+ const xml = entry.data.toString("utf8");
704
+ for (const match of xml.matchAll(/<c(\s[^>]*)>([\s\S]*?)<\/c>/g)) {
705
+ const attributes = match[1] ?? "";
706
+ const body = match[2] ?? "";
707
+ const reference = attribute(attributes, "r");
708
+ if (!reference) continue;
709
+ const type = attribute(attributes, "t");
710
+ const formula = /<f(?:\s[^>]*)?>[\s\S]*?<\/f>|<f\s*\/>/.test(body);
711
+ const value = /<v(?:\s[^>]*)?>([\s\S]*?)<\/v>/.exec(body)?.[1] ?? "";
712
+ let text;
713
+ let multiRun = false;
714
+ if (type === "s") {
715
+ const index = Number(value);
716
+ const sharedString = shared[index];
717
+ if (!Number.isInteger(index) || sharedString === void 0) throw new Error(`Malformed shared string cell: ${reference}`);
718
+ text = sharedString.text;
719
+ multiRun = sharedString.multiRun;
720
+ } else if (type === "inlineStr") {
721
+ text = textNodes(body);
722
+ multiRun = [...body.matchAll(/<(?:\w+:)?r(?:\s[^>]*)?>/g)].length > 1;
723
+ } else text = decodeXmlText(value);
724
+ const id = `${entry.name}#cell:${reference}`;
725
+ fragments.push({
726
+ id,
727
+ kind: "cell",
728
+ text,
729
+ readOnly: formula || multiRun,
730
+ location: `${entry.name}!${reference}`
731
+ });
732
+ ranges.set(id, {
733
+ entry: entry.name,
734
+ start: match.index,
735
+ end: match.index + match[0].length,
736
+ attributes
737
+ });
738
+ }
739
+ }
740
+ return {
741
+ archive,
742
+ document: parsedDocument("xlsx", source, fragments, { worksheets: worksheets.length }),
743
+ ranges
744
+ };
745
+ }
746
+ async function parseXlsx(source) {
747
+ return (await stateOf(source)).document;
748
+ }
749
+ async function preflightXlsx(source, operations) {
750
+ return preflight((await stateOf(source)).document, operations, (operation) => /^\s*=/.test(operation.replacement) ? {
751
+ code: "formula-input",
752
+ message: "Formula input is not accepted.",
753
+ fragmentId: operation.fragmentId
754
+ } : void 0);
755
+ }
756
+ async function serializeXlsx(source, operations, acceptedReportDigest) {
757
+ const state = await stateOf(source);
758
+ const report = await preflightXlsx(source, operations);
759
+ requireAccepted(report, acceptedReportDigest);
760
+ const byEntry = /* @__PURE__ */ new Map();
761
+ for (const operation of report.operations) {
762
+ const range = state.ranges.get(operation.fragmentId);
763
+ if (!range) throw new Error("XLSX cell changed during serialization.");
764
+ const list = byEntry.get(range.entry) ?? [];
765
+ list.push({
766
+ ...range,
767
+ replacement: operation.replacement
768
+ });
769
+ byEntry.set(range.entry, list);
770
+ }
771
+ const replacements = /* @__PURE__ */ new Map();
772
+ for (const [entryName, edits] of byEntry) {
773
+ let xml = state.archive.byName.get(entryName)?.data.toString("utf8") ?? "";
774
+ for (const edit of edits.sort((left, right) => right.start - left.start)) {
775
+ const cell = `<c${edit.attributes.replace(/\st=["'][^"']*["']/, "") + " t=\"inlineStr\""}><is><t>${encodeXmlText(edit.replacement)}</t></is></c>`;
776
+ xml = replaceRange(xml, edit.start, edit.end, cell);
777
+ }
778
+ replacements.set(entryName, Buffer.from(xml));
779
+ }
780
+ const bytes = await writeOoxmlArchive(state.archive, replacements);
781
+ return {
782
+ bytes,
783
+ operationLog: report.operations,
784
+ manifest: (await parseXlsx(bytes)).manifest
785
+ };
786
+ }
787
+ //#endregion
788
+ //#region src/services/structuredDocuments/index.ts
789
+ async function parseStructuredDocument(format, bytes, csvDialect) {
790
+ if (format === "markdown-slides") return parseMarkdownSlides(bytes);
791
+ if (format === "csv") return parseCsv(bytes, csvDialect);
792
+ if (format === "pptx") return await parsePptx(bytes);
793
+ return await parseXlsx(bytes);
794
+ }
795
+ async function preflightStructuredDocument(format, bytes, operations, csvDialect) {
796
+ if (format === "markdown-slides") return preflightMarkdownSlides(bytes, operations);
797
+ if (format === "csv") return preflightCsv(bytes, operations, csvDialect);
798
+ if (format === "pptx") return await preflightPptx(bytes, operations);
799
+ return await preflightXlsx(bytes, operations);
800
+ }
801
+ async function serializeStructuredDocument(format, bytes, operations, acceptedReportDigest, csvDialect) {
802
+ if (format === "markdown-slides") return serializeMarkdownSlides(bytes, operations, acceptedReportDigest);
803
+ if (format === "csv") return serializeCsv(bytes, operations, acceptedReportDigest, csvDialect);
804
+ if (format === "pptx") return await serializePptx(bytes, operations, acceptedReportDigest);
805
+ return await serializeXlsx(bytes, operations, acceptedReportDigest);
806
+ }
807
+ //#endregion
808
+ export { AUTHOR_OWNER_LEASE_MS as _, preflightXlsx as a, createAuthorBridgeState as b, preflightPptx as c, parseMarkdownSlides as d, preflightMarkdownSlides as f, serializeCsv as g, preflightCsv as h, parseXlsx as i, serializePptx as l, parseCsv as m, preflightStructuredDocument as n, serializeXlsx as o, serializeMarkdownSlides as p, serializeStructuredDocument as r, parsePptx as s, parseStructuredDocument as t, readOoxmlArchive as u, AUTHOR_REQUEST_TIMEOUT_MS as v, AuthorBridgeError as y };
809
+
810
+ //# sourceMappingURL=structuredDocuments-CzMYD0Bq.mjs.map