whale-code 6.5.4 → 6.5.6

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 (853) hide show
  1. package/README.md +39 -31
  2. package/bin/{swagmanager-mcp.js → whale-code.js} +17 -2
  3. package/dist/cli/app.js +148 -72
  4. package/dist/cli/app.js.map +1 -0
  5. package/dist/cli/chat/AgentSelector.js +105 -10
  6. package/dist/cli/chat/AgentSelector.js.map +1 -0
  7. package/dist/cli/chat/ChatApp.d.ts +31 -0
  8. package/dist/cli/chat/ChatApp.js +539 -286
  9. package/dist/cli/chat/ChatApp.js.map +1 -0
  10. package/dist/cli/chat/ChatInput.js +1088 -770
  11. package/dist/cli/chat/ChatInput.js.map +1 -0
  12. package/dist/cli/chat/MarkdownText.js +39 -14
  13. package/dist/cli/chat/MarkdownText.js.map +1 -0
  14. package/dist/cli/chat/MemoryManager.js +181 -46
  15. package/dist/cli/chat/MemoryManager.js.map +1 -0
  16. package/dist/cli/chat/MessageList.d.ts +2 -3
  17. package/dist/cli/chat/MessageList.js +186 -45
  18. package/dist/cli/chat/MessageList.js.map +1 -0
  19. package/dist/cli/chat/ModelSelector.js +282 -63
  20. package/dist/cli/chat/ModelSelector.js.map +1 -0
  21. package/dist/cli/chat/NodeManager.js +165 -75
  22. package/dist/cli/chat/NodeManager.js.map +1 -0
  23. package/dist/cli/chat/NodeSelector.js +171 -30
  24. package/dist/cli/chat/NodeSelector.js.map +1 -0
  25. package/dist/cli/chat/PlanApproval.js +281 -57
  26. package/dist/cli/chat/PlanApproval.js.map +1 -0
  27. package/dist/cli/chat/RewindViewer.js +559 -144
  28. package/dist/cli/chat/RewindViewer.js.map +1 -0
  29. package/dist/cli/chat/SessionManager.js +137 -30
  30. package/dist/cli/chat/SessionManager.js.map +1 -0
  31. package/dist/cli/chat/SlashMenu.js +293 -164
  32. package/dist/cli/chat/SlashMenu.js.map +1 -0
  33. package/dist/cli/chat/StatusBar.js +172 -9
  34. package/dist/cli/chat/StatusBar.js.map +1 -0
  35. package/dist/cli/chat/StoreSelector.js +147 -18
  36. package/dist/cli/chat/StoreSelector.js.map +1 -0
  37. package/dist/cli/chat/StreamingText.d.ts +1 -5
  38. package/dist/cli/chat/StreamingText.js +22 -7
  39. package/dist/cli/chat/StreamingText.js.map +1 -0
  40. package/dist/cli/chat/SubagentPanel.d.ts +1 -2
  41. package/dist/cli/chat/SubagentPanel.js +612 -72
  42. package/dist/cli/chat/SubagentPanel.js.map +1 -0
  43. package/dist/cli/chat/TeamPanel.d.ts +1 -0
  44. package/dist/cli/chat/TeamPanel.js +230 -30
  45. package/dist/cli/chat/TeamPanel.js.map +1 -0
  46. package/dist/cli/chat/ThemeSelector.js +84 -24
  47. package/dist/cli/chat/ThemeSelector.js.map +1 -0
  48. package/dist/cli/chat/ToolIndicator.js +1476 -371
  49. package/dist/cli/chat/ToolIndicator.js.map +1 -0
  50. package/dist/cli/chat/hooks/useAgentLoop.d.ts +1 -0
  51. package/dist/cli/chat/hooks/useAgentLoop.js +481 -367
  52. package/dist/cli/chat/hooks/useAgentLoop.js.map +1 -0
  53. package/dist/cli/chat/hooks/useSlashCommands.d.ts +3 -14
  54. package/dist/cli/chat/hooks/useSlashCommands.js +744 -572
  55. package/dist/cli/chat/hooks/useSlashCommands.js.map +1 -0
  56. package/dist/cli/commands/config-cmd.js +56 -57
  57. package/dist/cli/commands/config-cmd.js.map +1 -0
  58. package/dist/cli/commands/db.js +184 -169
  59. package/dist/cli/commands/db.js.map +1 -0
  60. package/dist/cli/commands/doctor.js +212 -122
  61. package/dist/cli/commands/doctor.js.map +1 -0
  62. package/dist/cli/commands/init.js +211 -244
  63. package/dist/cli/commands/init.js.map +1 -0
  64. package/dist/cli/commands/mcp.js +127 -122
  65. package/dist/cli/commands/mcp.js.map +1 -0
  66. package/dist/cli/login/LoginApp.js +355 -141
  67. package/dist/cli/login/LoginApp.js.map +1 -0
  68. package/dist/cli/print-mode.js +196 -177
  69. package/dist/cli/print-mode.js.map +1 -0
  70. package/dist/cli/serve-mode.js +615 -530
  71. package/dist/cli/serve-mode.js.map +1 -0
  72. package/dist/cli/services/agent-config.d.ts +29 -0
  73. package/dist/cli/services/agent-config.js +91 -0
  74. package/dist/cli/services/agent-config.js.map +1 -0
  75. package/dist/cli/services/agent-definitions.d.ts +4 -1
  76. package/dist/cli/services/agent-definitions.js +97 -56
  77. package/dist/cli/services/agent-definitions.js.map +1 -0
  78. package/dist/cli/services/agent-events.js +225 -162
  79. package/dist/cli/services/agent-events.js.map +1 -0
  80. package/dist/cli/services/agent-loop.js +978 -669
  81. package/dist/cli/services/agent-loop.js.map +1 -0
  82. package/dist/cli/services/agent-worker-base.d.ts +35 -5
  83. package/dist/cli/services/agent-worker-base.js +337 -153
  84. package/dist/cli/services/agent-worker-base.js.map +1 -0
  85. package/dist/cli/services/api-retry.js +69 -64
  86. package/dist/cli/services/api-retry.js.map +1 -0
  87. package/dist/cli/services/auth-service.d.ts +3 -3
  88. package/dist/cli/services/auth-service.js +209 -132
  89. package/dist/cli/services/auth-service.js.map +1 -0
  90. package/dist/cli/services/background-processes.js +343 -267
  91. package/dist/cli/services/background-processes.js.map +1 -0
  92. package/dist/cli/services/browser-auth.d.ts +2 -2
  93. package/dist/cli/services/browser-auth.js +159 -118
  94. package/dist/cli/services/browser-auth.js.map +1 -0
  95. package/dist/cli/services/claude-md-loader.js +40 -36
  96. package/dist/cli/services/claude-md-loader.js.map +1 -0
  97. package/dist/cli/services/config-store.d.ts +9 -4
  98. package/dist/cli/services/config-store.js +164 -117
  99. package/dist/cli/services/config-store.js.map +1 -0
  100. package/dist/cli/services/debug-log.d.ts +1 -1
  101. package/dist/cli/services/debug-log.js +34 -35
  102. package/dist/cli/services/debug-log.js.map +1 -0
  103. package/dist/cli/services/env-detect.d.ts +7 -0
  104. package/dist/cli/services/env-detect.js +9 -0
  105. package/dist/cli/services/env-detect.js.map +1 -0
  106. package/dist/cli/services/error-logger.d.ts +2 -3
  107. package/dist/cli/services/error-logger.js +189 -180
  108. package/dist/cli/services/error-logger.js.map +1 -0
  109. package/dist/cli/services/file-history.d.ts +1 -1
  110. package/dist/cli/services/file-history.js +50 -54
  111. package/dist/cli/services/file-history.js.map +1 -0
  112. package/dist/cli/services/format-server-response.js +332 -372
  113. package/dist/cli/services/format-server-response.js.map +1 -0
  114. package/dist/cli/services/git-context.js +61 -45
  115. package/dist/cli/services/git-context.js.map +1 -0
  116. package/dist/cli/services/hooks.d.ts +2 -2
  117. package/dist/cli/services/hooks.js +195 -180
  118. package/dist/cli/services/hooks.js.map +1 -0
  119. package/dist/cli/services/ink-incremental.d.ts +19 -0
  120. package/dist/cli/services/ink-incremental.js +59 -0
  121. package/dist/cli/services/ink-incremental.js.map +1 -0
  122. package/dist/cli/services/ink-resize-fix.js +54 -44
  123. package/dist/cli/services/ink-resize-fix.js.map +1 -0
  124. package/dist/cli/services/ink-sync-output.d.ts +12 -0
  125. package/dist/cli/services/ink-sync-output.js +16 -0
  126. package/dist/cli/services/ink-sync-output.js.map +1 -0
  127. package/dist/cli/services/interactive-tools.js +268 -212
  128. package/dist/cli/services/interactive-tools.js.map +1 -0
  129. package/dist/cli/services/keybinding-manager.d.ts +11 -1
  130. package/dist/cli/services/keybinding-manager.js +126 -63
  131. package/dist/cli/services/keybinding-manager.js.map +1 -0
  132. package/dist/cli/services/local-tools.d.ts +1 -1
  133. package/dist/cli/services/local-tools.js +939 -656
  134. package/dist/cli/services/local-tools.js.map +1 -0
  135. package/dist/cli/services/lsp-manager.js +757 -594
  136. package/dist/cli/services/lsp-manager.js.map +1 -0
  137. package/dist/cli/services/mcp-client.d.ts +1 -1
  138. package/dist/cli/services/mcp-client.js +173 -134
  139. package/dist/cli/services/mcp-client.js.map +1 -0
  140. package/dist/cli/services/memory-manager.js +53 -40
  141. package/dist/cli/services/memory-manager.js.map +1 -0
  142. package/dist/cli/services/model-manager.js +55 -40
  143. package/dist/cli/services/model-manager.js.map +1 -0
  144. package/dist/cli/services/model-router.js +115 -85
  145. package/dist/cli/services/model-router.js.map +1 -0
  146. package/dist/cli/services/paths.d.ts +30 -0
  147. package/dist/cli/services/paths.js +81 -0
  148. package/dist/cli/services/paths.js.map +1 -0
  149. package/dist/cli/services/permission-modes.js +32 -25
  150. package/dist/cli/services/permission-modes.js.map +1 -0
  151. package/dist/cli/services/rewind.js +182 -168
  152. package/dist/cli/services/rewind.js.map +1 -0
  153. package/dist/cli/services/ripgrep.js +115 -115
  154. package/dist/cli/services/ripgrep.js.map +1 -0
  155. package/dist/cli/services/sandbox.d.ts +1 -1
  156. package/dist/cli/services/sandbox.js +58 -37
  157. package/dist/cli/services/sandbox.js.map +1 -0
  158. package/dist/cli/services/server-tools.js +738 -565
  159. package/dist/cli/services/server-tools.js.map +1 -0
  160. package/dist/cli/services/session-persistence.js +69 -74
  161. package/dist/cli/services/session-persistence.js.map +1 -0
  162. package/dist/cli/services/subagent-worker.js +42 -27
  163. package/dist/cli/services/subagent-worker.js.map +1 -0
  164. package/dist/cli/services/subagent.d.ts +2 -0
  165. package/dist/cli/services/subagent.js +606 -430
  166. package/dist/cli/services/subagent.js.map +1 -0
  167. package/dist/cli/services/system-prompt.js +86 -78
  168. package/dist/cli/services/system-prompt.js.map +1 -0
  169. package/dist/cli/services/task-decomposer.d.ts +1 -1
  170. package/dist/cli/services/task-decomposer.js +172 -139
  171. package/dist/cli/services/task-decomposer.js.map +1 -0
  172. package/dist/cli/services/team-lead.d.ts +2 -2
  173. package/dist/cli/services/team-lead.js +727 -529
  174. package/dist/cli/services/team-lead.js.map +1 -0
  175. package/dist/cli/services/team-state.js +319 -319
  176. package/dist/cli/services/team-state.js.map +1 -0
  177. package/dist/cli/services/teammate.d.ts +8 -2
  178. package/dist/cli/services/teammate.js +862 -560
  179. package/dist/cli/services/teammate.js.map +1 -0
  180. package/dist/cli/services/telemetry.d.ts +6 -1
  181. package/dist/cli/services/telemetry.js +180 -157
  182. package/dist/cli/services/telemetry.js.map +1 -0
  183. package/dist/cli/services/tools/agent-tools.d.ts +3 -3
  184. package/dist/cli/services/tools/agent-tools.js +480 -322
  185. package/dist/cli/services/tools/agent-tools.js.map +1 -0
  186. package/dist/cli/services/tools/file-ops.js +563 -450
  187. package/dist/cli/services/tools/file-ops.js.map +1 -0
  188. package/dist/cli/services/tools/search-tools.js +231 -162
  189. package/dist/cli/services/tools/search-tools.js.map +1 -0
  190. package/dist/cli/services/tools/shell-exec.js +197 -151
  191. package/dist/cli/services/tools/shell-exec.js.map +1 -0
  192. package/dist/cli/services/tools/task-manager.js +206 -173
  193. package/dist/cli/services/tools/task-manager.js.map +1 -0
  194. package/dist/cli/services/tools/web-tools.js +388 -341
  195. package/dist/cli/services/tools/web-tools.js.map +1 -0
  196. package/dist/cli/setup/SetupApp.d.ts +2 -2
  197. package/dist/cli/setup/SetupApp.js +608 -160
  198. package/dist/cli/setup/SetupApp.js.map +1 -0
  199. package/dist/cli/shared/ErrorBoundary.d.ts +22 -0
  200. package/dist/cli/shared/ErrorBoundary.js +73 -0
  201. package/dist/cli/shared/ErrorBoundary.js.map +1 -0
  202. package/dist/cli/shared/MatrixIntro.js +66 -69
  203. package/dist/cli/shared/MatrixIntro.js.map +1 -0
  204. package/dist/cli/shared/SpinnerSlot.d.ts +14 -0
  205. package/dist/cli/shared/SpinnerSlot.js +63 -0
  206. package/dist/cli/shared/SpinnerSlot.js.map +1 -0
  207. package/dist/cli/shared/Theme.d.ts +1 -1
  208. package/dist/cli/shared/Theme.js +136 -92
  209. package/dist/cli/shared/Theme.js.map +1 -0
  210. package/dist/cli/shared/WhaleBanner.js +99 -11
  211. package/dist/cli/shared/WhaleBanner.js.map +1 -0
  212. package/dist/cli/shared/markdown.d.ts +3 -1
  213. package/dist/cli/shared/markdown.js +736 -674
  214. package/dist/cli/shared/markdown.js.map +1 -0
  215. package/dist/cli/shared/marked-terminal.d.js +2 -0
  216. package/dist/cli/shared/marked-terminal.d.js.map +1 -0
  217. package/dist/cli/shared/theme-manager.js +99 -90
  218. package/dist/cli/shared/theme-manager.js.map +1 -0
  219. package/dist/cli/shared/theme-presets.js +256 -254
  220. package/dist/cli/shared/theme-presets.js.map +1 -0
  221. package/dist/cli/status/StatusApp.js +235 -86
  222. package/dist/cli/status/StatusApp.js.map +1 -0
  223. package/dist/cli/stores/StoreApp.js +275 -65
  224. package/dist/cli/stores/StoreApp.js.map +1 -0
  225. package/dist/index.d.ts +2 -2
  226. package/dist/index.js +509 -396
  227. package/dist/index.js.map +1 -0
  228. package/dist/local-agent/connection.d.ts +2 -2
  229. package/dist/local-agent/connection.js +352 -293
  230. package/dist/local-agent/connection.js.map +1 -0
  231. package/dist/local-agent/discovery.js +259 -122
  232. package/dist/local-agent/discovery.js.map +1 -0
  233. package/dist/local-agent/executor.js +216 -193
  234. package/dist/local-agent/executor.js.map +1 -0
  235. package/dist/local-agent/index.d.ts +2 -2
  236. package/dist/local-agent/index.js +156 -156
  237. package/dist/local-agent/index.js.map +1 -0
  238. package/dist/node/adapters/base.js +18 -8
  239. package/dist/node/adapters/base.js.map +1 -0
  240. package/dist/node/adapters/discord.js +286 -275
  241. package/dist/node/adapters/discord.js.map +1 -0
  242. package/dist/node/adapters/email.js +189 -202
  243. package/dist/node/adapters/email.js.map +1 -0
  244. package/dist/node/adapters/imessage.js +145 -142
  245. package/dist/node/adapters/imessage.js.map +1 -0
  246. package/dist/node/adapters/slack.js +237 -236
  247. package/dist/node/adapters/slack.js.map +1 -0
  248. package/dist/node/adapters/sms.js +149 -151
  249. package/dist/node/adapters/sms.js.map +1 -0
  250. package/dist/node/adapters/telegram.js +88 -92
  251. package/dist/node/adapters/telegram.js.map +1 -0
  252. package/dist/node/adapters/webchat.js +160 -136
  253. package/dist/node/adapters/webchat.js.map +1 -0
  254. package/dist/node/adapters/whatsapp.js +212 -215
  255. package/dist/node/adapters/whatsapp.js.map +1 -0
  256. package/dist/node/cli.js +884 -653
  257. package/dist/node/cli.js.map +1 -0
  258. package/dist/node/config.js +20 -18
  259. package/dist/node/config.js.map +1 -0
  260. package/dist/node/gateway-client.js +191 -181
  261. package/dist/node/gateway-client.js.map +1 -0
  262. package/dist/node/portal/clipboard.js +161 -130
  263. package/dist/node/portal/clipboard.js.map +1 -0
  264. package/dist/node/portal/discovery.js +51 -45
  265. package/dist/node/portal/discovery.js.map +1 -0
  266. package/dist/node/portal/forward.js +64 -58
  267. package/dist/node/portal/forward.js.map +1 -0
  268. package/dist/node/portal/index.js +246 -221
  269. package/dist/node/portal/index.js.map +1 -0
  270. package/dist/node/portal/multiplexer.js +192 -182
  271. package/dist/node/portal/multiplexer.js.map +1 -0
  272. package/dist/node/portal/permissions.js +102 -70
  273. package/dist/node/portal/permissions.js.map +1 -0
  274. package/dist/node/portal/protocol.js +153 -116
  275. package/dist/node/portal/protocol.js.map +1 -0
  276. package/dist/node/portal/screen.js +80 -69
  277. package/dist/node/portal/screen.js.map +1 -0
  278. package/dist/node/portal/session.js +124 -117
  279. package/dist/node/portal/session.js.map +1 -0
  280. package/dist/node/portal/shell.js +140 -113
  281. package/dist/node/portal/shell.js.map +1 -0
  282. package/dist/node/portal/stream.js +77 -75
  283. package/dist/node/portal/stream.js.map +1 -0
  284. package/dist/node/portal/transfer.js +190 -167
  285. package/dist/node/portal/transfer.js.map +1 -0
  286. package/dist/node/portal/ui.js +124 -99
  287. package/dist/node/portal/ui.js.map +1 -0
  288. package/dist/node/remote-desktop/compile-helper.js +50 -45
  289. package/dist/node/remote-desktop/compile-helper.js.map +1 -0
  290. package/dist/node/remote-desktop/index.js +215 -187
  291. package/dist/node/remote-desktop/index.js.map +1 -0
  292. package/dist/node/remote-desktop/protocol.js +45 -29
  293. package/dist/node/remote-desktop/protocol.js.map +1 -0
  294. package/dist/node/runtime.js +493 -410
  295. package/dist/node/runtime.js.map +1 -0
  296. package/dist/server/handlers/__test-utils__/test-db.js +39 -89
  297. package/dist/server/handlers/__test-utils__/test-db.js.map +1 -0
  298. package/dist/server/handlers/analytics.js +467 -261
  299. package/dist/server/handlers/analytics.js.map +1 -0
  300. package/dist/server/handlers/api-docs.d.ts +6 -0
  301. package/dist/server/handlers/api-docs.js +1613 -0
  302. package/dist/server/handlers/api-docs.js.map +1 -0
  303. package/dist/server/handlers/api-keys.js +295 -232
  304. package/dist/server/handlers/api-keys.js.map +1 -0
  305. package/dist/server/handlers/billing.js +330 -239
  306. package/dist/server/handlers/billing.js.map +1 -0
  307. package/dist/server/handlers/browser.js +468 -395
  308. package/dist/server/handlers/browser.js.map +1 -0
  309. package/dist/server/handlers/catalog.js +1377 -978
  310. package/dist/server/handlers/catalog.js.map +1 -0
  311. package/dist/server/handlers/clickhouse.js +157 -109
  312. package/dist/server/handlers/clickhouse.js.map +1 -0
  313. package/dist/server/handlers/comms.d.ts +0 -53
  314. package/dist/server/handlers/comms.js +1443 -970
  315. package/dist/server/handlers/comms.js.map +1 -0
  316. package/dist/server/handlers/creations.js +461 -394
  317. package/dist/server/handlers/creations.js.map +1 -0
  318. package/dist/server/handlers/crm.js +1082 -791
  319. package/dist/server/handlers/crm.js.map +1 -0
  320. package/dist/server/handlers/discovery.js +251 -232
  321. package/dist/server/handlers/discovery.js.map +1 -0
  322. package/dist/server/handlers/embeddings.js +241 -164
  323. package/dist/server/handlers/embeddings.js.map +1 -0
  324. package/dist/server/handlers/enrichment.js +887 -718
  325. package/dist/server/handlers/enrichment.js.map +1 -0
  326. package/dist/server/handlers/image-gen.js +467 -376
  327. package/dist/server/handlers/image-gen.js.map +1 -0
  328. package/dist/server/handlers/inventory.js +797 -424
  329. package/dist/server/handlers/inventory.js.map +1 -0
  330. package/dist/server/handlers/kali.js +272 -230
  331. package/dist/server/handlers/kali.js.map +1 -0
  332. package/dist/server/handlers/llm-providers.js +803 -580
  333. package/dist/server/handlers/llm-providers.js.map +1 -0
  334. package/dist/server/handlers/local-agent.js +133 -105
  335. package/dist/server/handlers/local-agent.js.map +1 -0
  336. package/dist/server/handlers/media.js +1179 -857
  337. package/dist/server/handlers/media.js.map +1 -0
  338. package/dist/server/handlers/meta-ads.js +2669 -2093
  339. package/dist/server/handlers/meta-ads.js.map +1 -0
  340. package/dist/server/handlers/nodes.js +1321 -913
  341. package/dist/server/handlers/nodes.js.map +1 -0
  342. package/dist/server/handlers/operations.js +183 -157
  343. package/dist/server/handlers/operations.js.map +1 -0
  344. package/dist/server/handlers/platform.js +346 -210
  345. package/dist/server/handlers/platform.js.map +1 -0
  346. package/dist/server/handlers/remove-bg.js +118 -86
  347. package/dist/server/handlers/remove-bg.js.map +1 -0
  348. package/dist/server/handlers/storefront.js +586 -446
  349. package/dist/server/handlers/storefront.js.map +1 -0
  350. package/dist/server/handlers/supply-chain.js +546 -326
  351. package/dist/server/handlers/supply-chain.js.map +1 -0
  352. package/dist/server/handlers/transcription.js +106 -97
  353. package/dist/server/handlers/transcription.js.map +1 -0
  354. package/dist/server/handlers/video-gen.js +593 -424
  355. package/dist/server/handlers/video-gen.js.map +1 -0
  356. package/dist/server/handlers/voice.js +1458 -1017
  357. package/dist/server/handlers/voice.js.map +1 -0
  358. package/dist/server/handlers/workflow-steps.js +2837 -2116
  359. package/dist/server/handlers/workflow-steps.js.map +1 -0
  360. package/dist/server/handlers/workflows.js +1630 -933
  361. package/dist/server/handlers/workflows.js.map +1 -0
  362. package/dist/server/index.js +3166 -2390
  363. package/dist/server/index.js.map +1 -0
  364. package/dist/server/lib/batch-client.js +471 -409
  365. package/dist/server/lib/batch-client.js.map +1 -0
  366. package/dist/server/lib/clickhouse-buffer.js +118 -104
  367. package/dist/server/lib/clickhouse-buffer.js.map +1 -0
  368. package/dist/server/lib/clickhouse-client.js +107 -107
  369. package/dist/server/lib/clickhouse-client.js.map +1 -0
  370. package/dist/server/lib/coa-renderer.js +1786 -356
  371. package/dist/server/lib/coa-renderer.js.map +1 -0
  372. package/dist/server/lib/code-worker-pool.js +227 -177
  373. package/dist/server/lib/code-worker-pool.js.map +1 -0
  374. package/dist/server/lib/code-worker.js +174 -164
  375. package/dist/server/lib/code-worker.js.map +1 -0
  376. package/dist/server/lib/compaction-service.d.ts +2 -12
  377. package/dist/server/lib/compaction-service.js +74 -184
  378. package/dist/server/lib/compaction-service.js.map +1 -0
  379. package/dist/server/lib/logger.js +36 -24
  380. package/dist/server/lib/logger.js.map +1 -0
  381. package/dist/server/lib/otel.js +101 -80
  382. package/dist/server/lib/otel.js.map +1 -0
  383. package/dist/server/lib/pdf-renderer.d.ts +1 -1
  384. package/dist/server/lib/pdf-renderer.js +954 -776
  385. package/dist/server/lib/pdf-renderer.js.map +1 -0
  386. package/dist/server/lib/prompt-sanitizer.js +188 -108
  387. package/dist/server/lib/prompt-sanitizer.js.map +1 -0
  388. package/dist/server/lib/provider-capabilities.js +136 -138
  389. package/dist/server/lib/provider-capabilities.js.map +1 -0
  390. package/dist/server/lib/provider-failover.js +190 -168
  391. package/dist/server/lib/provider-failover.js.map +1 -0
  392. package/dist/server/lib/rate-limiter.js +186 -117
  393. package/dist/server/lib/rate-limiter.js.map +1 -0
  394. package/dist/server/lib/react-pdf-layout.js +551 -382
  395. package/dist/server/lib/react-pdf-layout.js.map +1 -0
  396. package/dist/server/lib/server-agent-loop.d.ts +9 -0
  397. package/dist/server/lib/server-agent-loop.js +906 -624
  398. package/dist/server/lib/server-agent-loop.js.map +1 -0
  399. package/dist/server/lib/server-subagent.d.ts +2 -0
  400. package/dist/server/lib/server-subagent.js +260 -162
  401. package/dist/server/lib/server-subagent.js.map +1 -0
  402. package/dist/server/lib/session-checkpoint.js +105 -96
  403. package/dist/server/lib/session-checkpoint.js.map +1 -0
  404. package/dist/server/lib/ssrf-guard.js +193 -184
  405. package/dist/server/lib/ssrf-guard.js.map +1 -0
  406. package/dist/server/lib/supabase-client.js +94 -82
  407. package/dist/server/lib/supabase-client.js.map +1 -0
  408. package/dist/server/lib/template-resolver.js +154 -176
  409. package/dist/server/lib/template-resolver.js.map +1 -0
  410. package/dist/server/lib/utils.js +242 -133
  411. package/dist/server/lib/utils.js.map +1 -0
  412. package/dist/server/local-agent-gateway.d.ts +2 -2
  413. package/dist/server/local-agent-gateway.js +785 -627
  414. package/dist/server/local-agent-gateway.js.map +1 -0
  415. package/dist/server/providers/anthropic.js +254 -176
  416. package/dist/server/providers/anthropic.js.map +1 -0
  417. package/dist/server/providers/bedrock.js +221 -162
  418. package/dist/server/providers/bedrock.js.map +1 -0
  419. package/dist/server/providers/gemini.js +548 -418
  420. package/dist/server/providers/gemini.js.map +1 -0
  421. package/dist/server/providers/openai.js +571 -437
  422. package/dist/server/providers/openai.js.map +1 -0
  423. package/dist/server/providers/registry.js +23 -18
  424. package/dist/server/providers/registry.js.map +1 -0
  425. package/dist/server/providers/shared.js +123 -95
  426. package/dist/server/providers/shared.js.map +1 -0
  427. package/dist/server/providers/types.js +1 -11
  428. package/dist/server/providers/types.js.map +1 -0
  429. package/dist/server/proxy-handlers.js +209 -165
  430. package/dist/server/proxy-handlers.js.map +1 -0
  431. package/dist/server/tool-router.d.ts +13 -0
  432. package/dist/server/tool-router.js +960 -598
  433. package/dist/server/tool-router.js.map +1 -0
  434. package/dist/server/validation.js +248 -188
  435. package/dist/server/validation.js.map +1 -0
  436. package/dist/server/worker.js +202 -133
  437. package/dist/server/worker.js.map +1 -0
  438. package/dist/setup.d.ts +2 -2
  439. package/dist/setup.js +151 -147
  440. package/dist/setup.js.map +1 -0
  441. package/dist/shared/agent-core.d.ts +191 -24
  442. package/dist/shared/agent-core.js +971 -462
  443. package/dist/shared/agent-core.js.map +1 -0
  444. package/dist/shared/anthropic-types.js +1 -6
  445. package/dist/shared/anthropic-types.js.map +1 -0
  446. package/dist/shared/api-client.d.ts +17 -9
  447. package/dist/shared/api-client.js +419 -327
  448. package/dist/shared/api-client.js.map +1 -0
  449. package/dist/shared/compaction.d.ts +36 -0
  450. package/dist/shared/compaction.js +138 -0
  451. package/dist/shared/compaction.js.map +1 -0
  452. package/dist/shared/constants.js +67 -64
  453. package/dist/shared/constants.js.map +1 -0
  454. package/dist/shared/sse-parser.js +221 -219
  455. package/dist/shared/sse-parser.js.map +1 -0
  456. package/dist/shared/tool-dispatch.d.ts +4 -2
  457. package/dist/shared/tool-dispatch.js +226 -165
  458. package/dist/shared/tool-dispatch.js.map +1 -0
  459. package/dist/shared/types.js +1 -6
  460. package/dist/shared/types.js.map +1 -0
  461. package/dist/types/cli-highlight.d.js +2 -0
  462. package/dist/types/cli-highlight.d.js.map +1 -0
  463. package/dist/types/diff.d.js +2 -0
  464. package/dist/types/diff.d.js.map +1 -0
  465. package/dist/types/pdf-parse.d.js +2 -0
  466. package/dist/types/pdf-parse.d.js.map +1 -0
  467. package/dist/updater.d.ts +1 -1
  468. package/dist/updater.js +118 -92
  469. package/dist/updater.js.map +1 -0
  470. package/dist/webchat/widget.js +227 -380
  471. package/dist/webchat/widget.js.map +1 -0
  472. package/package.json +22 -10
  473. package/vendor/ink/build/ansi-tokenizer.d.ts +38 -0
  474. package/vendor/ink/build/ansi-tokenizer.js +316 -0
  475. package/vendor/ink/build/ansi-tokenizer.js.map +1 -0
  476. package/vendor/ink/build/apply-styles.js +175 -0
  477. package/vendor/ink/build/build-layout.js +77 -0
  478. package/vendor/ink/build/calculate-wrapped-text.js +53 -0
  479. package/vendor/ink/build/colorize.d.ts +3 -0
  480. package/vendor/ink/build/colorize.js +48 -0
  481. package/vendor/ink/build/colorize.js.map +1 -0
  482. package/vendor/ink/build/components/AccessibilityContext.d.ts +3 -0
  483. package/vendor/ink/build/components/AccessibilityContext.js +5 -0
  484. package/vendor/ink/build/components/AccessibilityContext.js.map +1 -0
  485. package/vendor/ink/build/components/App.d.ts +18 -0
  486. package/vendor/ink/build/components/App.js +351 -0
  487. package/vendor/ink/build/components/App.js.map +1 -0
  488. package/vendor/ink/build/components/AppContext.d.ts +15 -0
  489. package/vendor/ink/build/components/AppContext.js +11 -0
  490. package/vendor/ink/build/components/AppContext.js.map +1 -0
  491. package/vendor/ink/build/components/BackgroundContext.d.ts +4 -0
  492. package/vendor/ink/build/components/BackgroundContext.js +3 -0
  493. package/vendor/ink/build/components/BackgroundContext.js.map +1 -0
  494. package/vendor/ink/build/components/Box.d.ts +117 -0
  495. package/vendor/ink/build/components/Box.js +34 -0
  496. package/vendor/ink/build/components/Box.js.map +1 -0
  497. package/vendor/ink/build/components/Color.js +62 -0
  498. package/vendor/ink/build/components/Cursor.d.ts +83 -0
  499. package/vendor/ink/build/components/Cursor.js +53 -0
  500. package/vendor/ink/build/components/Cursor.js.map +1 -0
  501. package/vendor/ink/build/components/CursorContext.d.ts +11 -0
  502. package/vendor/ink/build/components/CursorContext.js +8 -0
  503. package/vendor/ink/build/components/CursorContext.js.map +1 -0
  504. package/vendor/ink/build/components/ErrorBoundary.d.ts +18 -0
  505. package/vendor/ink/build/components/ErrorBoundary.js +23 -0
  506. package/vendor/ink/build/components/ErrorBoundary.js.map +1 -0
  507. package/vendor/ink/build/components/ErrorOverview.d.ts +6 -0
  508. package/vendor/ink/build/components/ErrorOverview.js +84 -0
  509. package/vendor/ink/build/components/ErrorOverview.js.map +1 -0
  510. package/vendor/ink/build/components/FocusContext.d.ts +16 -0
  511. package/vendor/ink/build/components/FocusContext.js +17 -0
  512. package/vendor/ink/build/components/FocusContext.js.map +1 -0
  513. package/vendor/ink/build/components/Newline.d.ts +13 -0
  514. package/vendor/ink/build/components/Newline.js +8 -0
  515. package/vendor/ink/build/components/Newline.js.map +1 -0
  516. package/vendor/ink/build/components/Spacer.d.ts +7 -0
  517. package/vendor/ink/build/components/Spacer.js +11 -0
  518. package/vendor/ink/build/components/Spacer.js.map +1 -0
  519. package/vendor/ink/build/components/Static.d.ts +24 -0
  520. package/vendor/ink/build/components/Static.js +28 -0
  521. package/vendor/ink/build/components/Static.js.map +1 -0
  522. package/vendor/ink/build/components/StderrContext.d.ts +15 -0
  523. package/vendor/ink/build/components/StderrContext.js +13 -0
  524. package/vendor/ink/build/components/StderrContext.js.map +1 -0
  525. package/vendor/ink/build/components/StdinContext.d.ts +22 -0
  526. package/vendor/ink/build/components/StdinContext.js +19 -0
  527. package/vendor/ink/build/components/StdinContext.js.map +1 -0
  528. package/vendor/ink/build/components/StdoutContext.d.ts +15 -0
  529. package/vendor/ink/build/components/StdoutContext.js +13 -0
  530. package/vendor/ink/build/components/StdoutContext.js.map +1 -0
  531. package/vendor/ink/build/components/Text.d.ts +55 -0
  532. package/vendor/ink/build/components/Text.js +50 -0
  533. package/vendor/ink/build/components/Text.js.map +1 -0
  534. package/vendor/ink/build/components/Transform.d.ts +16 -0
  535. package/vendor/ink/build/components/Transform.js +15 -0
  536. package/vendor/ink/build/components/Transform.js.map +1 -0
  537. package/vendor/ink/build/cursor-helpers.d.ts +38 -0
  538. package/vendor/ink/build/cursor-helpers.js +56 -0
  539. package/vendor/ink/build/cursor-helpers.js.map +1 -0
  540. package/vendor/ink/build/devtools-window-polyfill.d.ts +1 -0
  541. package/vendor/ink/build/devtools-window-polyfill.js +65 -0
  542. package/vendor/ink/build/devtools-window-polyfill.js.map +1 -0
  543. package/vendor/ink/build/devtools.d.ts +1 -0
  544. package/vendor/ink/build/devtools.js +11 -0
  545. package/vendor/ink/build/devtools.js.map +1 -0
  546. package/vendor/ink/build/dom.d.ts +56 -0
  547. package/vendor/ink/build/dom.js +124 -0
  548. package/vendor/ink/build/dom.js.map +1 -0
  549. package/vendor/ink/build/experimental/apply-style.js +140 -0
  550. package/vendor/ink/build/experimental/dom.js +123 -0
  551. package/vendor/ink/build/experimental/output.js +91 -0
  552. package/vendor/ink/build/experimental/reconciler.js +141 -0
  553. package/vendor/ink/build/experimental/renderer.js +81 -0
  554. package/vendor/ink/build/get-max-width.d.ts +3 -0
  555. package/vendor/ink/build/get-max-width.js +10 -0
  556. package/vendor/ink/build/get-max-width.js.map +1 -0
  557. package/vendor/ink/build/hooks/use-app.d.ts +5 -0
  558. package/vendor/ink/build/hooks/use-app.js +8 -0
  559. package/vendor/ink/build/hooks/use-app.js.map +1 -0
  560. package/vendor/ink/build/hooks/use-cursor.d.ts +12 -0
  561. package/vendor/ink/build/hooks/use-cursor.js +29 -0
  562. package/vendor/ink/build/hooks/use-cursor.js.map +1 -0
  563. package/vendor/ink/build/hooks/use-focus-manager.d.ts +28 -0
  564. package/vendor/ink/build/hooks/use-focus-manager.js +17 -0
  565. package/vendor/ink/build/hooks/use-focus-manager.js.map +1 -0
  566. package/vendor/ink/build/hooks/use-focus.d.ts +29 -0
  567. package/vendor/ink/build/hooks/use-focus.js +42 -0
  568. package/vendor/ink/build/hooks/use-focus.js.map +1 -0
  569. package/vendor/ink/build/hooks/use-input.d.ts +131 -0
  570. package/vendor/ink/build/hooks/use-input.js +124 -0
  571. package/vendor/ink/build/hooks/use-input.js.map +1 -0
  572. package/vendor/ink/build/hooks/use-is-screen-reader-enabled.d.ts +5 -0
  573. package/vendor/ink/build/hooks/use-is-screen-reader-enabled.js +11 -0
  574. package/vendor/ink/build/hooks/use-is-screen-reader-enabled.js.map +1 -0
  575. package/vendor/ink/build/hooks/use-stderr.d.ts +5 -0
  576. package/vendor/ink/build/hooks/use-stderr.js +8 -0
  577. package/vendor/ink/build/hooks/use-stderr.js.map +1 -0
  578. package/vendor/ink/build/hooks/use-stdin.d.ts +5 -0
  579. package/vendor/ink/build/hooks/use-stdin.js +8 -0
  580. package/vendor/ink/build/hooks/use-stdin.js.map +1 -0
  581. package/vendor/ink/build/hooks/use-stdout.d.ts +5 -0
  582. package/vendor/ink/build/hooks/use-stdout.js +8 -0
  583. package/vendor/ink/build/hooks/use-stdout.js.map +1 -0
  584. package/vendor/ink/build/hooks/useInput.js +38 -0
  585. package/vendor/ink/build/index.d.ts +34 -0
  586. package/vendor/ink/build/index.js +20 -0
  587. package/vendor/ink/build/index.js.map +1 -0
  588. package/vendor/ink/build/ink.d.ts +90 -0
  589. package/vendor/ink/build/ink.js +654 -0
  590. package/vendor/ink/build/ink.js.map +1 -0
  591. package/vendor/ink/build/input-parser.d.ts +7 -0
  592. package/vendor/ink/build/input-parser.js +154 -0
  593. package/vendor/ink/build/input-parser.js.map +1 -0
  594. package/vendor/ink/build/instance.js +205 -0
  595. package/vendor/ink/build/instances.d.ts +3 -0
  596. package/vendor/ink/build/instances.js +8 -0
  597. package/vendor/ink/build/instances.js.map +1 -0
  598. package/vendor/ink/build/kitty-keyboard.d.ts +23 -0
  599. package/vendor/ink/build/kitty-keyboard.js +32 -0
  600. package/vendor/ink/build/kitty-keyboard.js.map +1 -0
  601. package/vendor/ink/build/layout.d.ts +7 -0
  602. package/vendor/ink/build/layout.js +33 -0
  603. package/vendor/ink/build/layout.js.map +1 -0
  604. package/vendor/ink/build/log-update.d.ts +19 -0
  605. package/vendor/ink/build/log-update.js +243 -0
  606. package/vendor/ink/build/log-update.js.map +1 -0
  607. package/vendor/ink/build/measure-element.d.ts +16 -0
  608. package/vendor/ink/build/measure-element.js +9 -0
  609. package/vendor/ink/build/measure-element.js.map +1 -0
  610. package/vendor/ink/build/measure-text.d.ts +6 -0
  611. package/vendor/ink/build/measure-text.js +21 -0
  612. package/vendor/ink/build/measure-text.js.map +1 -0
  613. package/vendor/ink/build/options.d.ts +52 -0
  614. package/vendor/ink/build/options.js +2 -0
  615. package/vendor/ink/build/options.js.map +1 -0
  616. package/vendor/ink/build/output.d.ts +35 -0
  617. package/vendor/ink/build/output.js +183 -0
  618. package/vendor/ink/build/output.js.map +1 -0
  619. package/vendor/ink/build/parse-keypress.d.ts +22 -0
  620. package/vendor/ink/build/parse-keypress.js +493 -0
  621. package/vendor/ink/build/parse-keypress.js.map +1 -0
  622. package/vendor/ink/build/reconciler.d.ts +4 -0
  623. package/vendor/ink/build/reconciler.js +274 -0
  624. package/vendor/ink/build/reconciler.js.map +1 -0
  625. package/vendor/ink/build/render-background.d.ts +4 -0
  626. package/vendor/ink/build/render-background.js +25 -0
  627. package/vendor/ink/build/render-background.js.map +1 -0
  628. package/vendor/ink/build/render-border.d.ts +4 -0
  629. package/vendor/ink/build/render-border.js +73 -0
  630. package/vendor/ink/build/render-border.js.map +1 -0
  631. package/vendor/ink/build/render-node-to-output.d.ts +14 -0
  632. package/vendor/ink/build/render-node-to-output.js +147 -0
  633. package/vendor/ink/build/render-node-to-output.js.map +1 -0
  634. package/vendor/ink/build/render-to-string.d.ts +38 -0
  635. package/vendor/ink/build/render-to-string.js +115 -0
  636. package/vendor/ink/build/render-to-string.js.map +1 -0
  637. package/vendor/ink/build/render.d.ts +121 -0
  638. package/vendor/ink/build/render.js +55 -0
  639. package/vendor/ink/build/render.js.map +1 -0
  640. package/vendor/ink/build/renderer.d.ts +8 -0
  641. package/vendor/ink/build/renderer.js +55 -0
  642. package/vendor/ink/build/renderer.js.map +1 -0
  643. package/vendor/ink/build/sanitize-ansi.d.ts +2 -0
  644. package/vendor/ink/build/sanitize-ansi.js +27 -0
  645. package/vendor/ink/build/sanitize-ansi.js.map +1 -0
  646. package/vendor/ink/build/screen-reader-update.d.ts +13 -0
  647. package/vendor/ink/build/screen-reader-update.js +38 -0
  648. package/vendor/ink/build/screen-reader-update.js.map +1 -0
  649. package/vendor/ink/build/squash-text-nodes.d.ts +3 -0
  650. package/vendor/ink/build/squash-text-nodes.js +36 -0
  651. package/vendor/ink/build/squash-text-nodes.js.map +1 -0
  652. package/vendor/ink/build/styles.d.ts +240 -0
  653. package/vendor/ink/build/styles.js +232 -0
  654. package/vendor/ink/build/styles.js.map +1 -0
  655. package/vendor/ink/build/utils.d.ts +2 -0
  656. package/vendor/ink/build/utils.js +4 -0
  657. package/vendor/ink/build/utils.js.map +1 -0
  658. package/vendor/ink/build/wrap-text.d.ts +3 -0
  659. package/vendor/ink/build/wrap-text.js +31 -0
  660. package/vendor/ink/build/wrap-text.js.map +1 -0
  661. package/vendor/ink/build/write-synchronized.d.ts +4 -0
  662. package/vendor/ink/build/write-synchronized.js +7 -0
  663. package/vendor/ink/build/write-synchronized.js.map +1 -0
  664. package/vendor/ink/license +10 -0
  665. package/vendor/ink/node_modules/@types/node/LICENSE +21 -0
  666. package/vendor/ink/node_modules/@types/node/README.md +15 -0
  667. package/vendor/ink/node_modules/@types/node/assert/strict.d.ts +105 -0
  668. package/vendor/ink/node_modules/@types/node/assert.d.ts +955 -0
  669. package/vendor/ink/node_modules/@types/node/async_hooks.d.ts +623 -0
  670. package/vendor/ink/node_modules/@types/node/buffer.buffer.d.ts +466 -0
  671. package/vendor/ink/node_modules/@types/node/buffer.d.ts +1810 -0
  672. package/vendor/ink/node_modules/@types/node/child_process.d.ts +1428 -0
  673. package/vendor/ink/node_modules/@types/node/cluster.d.ts +486 -0
  674. package/vendor/ink/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  675. package/vendor/ink/node_modules/@types/node/console.d.ts +151 -0
  676. package/vendor/ink/node_modules/@types/node/constants.d.ts +20 -0
  677. package/vendor/ink/node_modules/@types/node/crypto.d.ts +4065 -0
  678. package/vendor/ink/node_modules/@types/node/dgram.d.ts +564 -0
  679. package/vendor/ink/node_modules/@types/node/diagnostics_channel.d.ts +576 -0
  680. package/vendor/ink/node_modules/@types/node/dns/promises.d.ts +503 -0
  681. package/vendor/ink/node_modules/@types/node/dns.d.ts +922 -0
  682. package/vendor/ink/node_modules/@types/node/domain.d.ts +166 -0
  683. package/vendor/ink/node_modules/@types/node/events.d.ts +1054 -0
  684. package/vendor/ink/node_modules/@types/node/fs/promises.d.ts +1329 -0
  685. package/vendor/ink/node_modules/@types/node/fs.d.ts +4676 -0
  686. package/vendor/ink/node_modules/@types/node/globals.d.ts +150 -0
  687. package/vendor/ink/node_modules/@types/node/globals.typedarray.d.ts +101 -0
  688. package/vendor/ink/node_modules/@types/node/http.d.ts +2167 -0
  689. package/vendor/ink/node_modules/@types/node/http2.d.ts +2480 -0
  690. package/vendor/ink/node_modules/@types/node/https.d.ts +405 -0
  691. package/vendor/ink/node_modules/@types/node/index.d.ts +115 -0
  692. package/vendor/ink/node_modules/@types/node/inspector/promises.d.ts +41 -0
  693. package/vendor/ink/node_modules/@types/node/inspector.d.ts +224 -0
  694. package/vendor/ink/node_modules/@types/node/inspector.generated.d.ts +4226 -0
  695. package/vendor/ink/node_modules/@types/node/module.d.ts +819 -0
  696. package/vendor/ink/node_modules/@types/node/net.d.ts +933 -0
  697. package/vendor/ink/node_modules/@types/node/os.d.ts +507 -0
  698. package/vendor/ink/node_modules/@types/node/package.json +155 -0
  699. package/vendor/ink/node_modules/@types/node/path/posix.d.ts +8 -0
  700. package/vendor/ink/node_modules/@types/node/path/win32.d.ts +8 -0
  701. package/vendor/ink/node_modules/@types/node/path.d.ts +187 -0
  702. package/vendor/ink/node_modules/@types/node/perf_hooks.d.ts +643 -0
  703. package/vendor/ink/node_modules/@types/node/process.d.ts +2156 -0
  704. package/vendor/ink/node_modules/@types/node/punycode.d.ts +117 -0
  705. package/vendor/ink/node_modules/@types/node/querystring.d.ts +152 -0
  706. package/vendor/ink/node_modules/@types/node/quic.d.ts +910 -0
  707. package/vendor/ink/node_modules/@types/node/readline/promises.d.ts +161 -0
  708. package/vendor/ink/node_modules/@types/node/readline.d.ts +541 -0
  709. package/vendor/ink/node_modules/@types/node/repl.d.ts +415 -0
  710. package/vendor/ink/node_modules/@types/node/sea.d.ts +162 -0
  711. package/vendor/ink/node_modules/@types/node/sqlite.d.ts +955 -0
  712. package/vendor/ink/node_modules/@types/node/stream/consumers.d.ts +38 -0
  713. package/vendor/ink/node_modules/@types/node/stream/promises.d.ts +211 -0
  714. package/vendor/ink/node_modules/@types/node/stream/web.d.ts +296 -0
  715. package/vendor/ink/node_modules/@types/node/stream.d.ts +1760 -0
  716. package/vendor/ink/node_modules/@types/node/string_decoder.d.ts +67 -0
  717. package/vendor/ink/node_modules/@types/node/test/reporters.d.ts +96 -0
  718. package/vendor/ink/node_modules/@types/node/test.d.ts +2240 -0
  719. package/vendor/ink/node_modules/@types/node/timers/promises.d.ts +108 -0
  720. package/vendor/ink/node_modules/@types/node/timers.d.ts +159 -0
  721. package/vendor/ink/node_modules/@types/node/tls.d.ts +1198 -0
  722. package/vendor/ink/node_modules/@types/node/trace_events.d.ts +197 -0
  723. package/vendor/ink/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +462 -0
  724. package/vendor/ink/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  725. package/vendor/ink/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  726. package/vendor/ink/node_modules/@types/node/ts5.6/index.d.ts +117 -0
  727. package/vendor/ink/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  728. package/vendor/ink/node_modules/@types/node/ts5.7/index.d.ts +117 -0
  729. package/vendor/ink/node_modules/@types/node/tty.d.ts +250 -0
  730. package/vendor/ink/node_modules/@types/node/url.d.ts +519 -0
  731. package/vendor/ink/node_modules/@types/node/util/types.d.ts +558 -0
  732. package/vendor/ink/node_modules/@types/node/util.d.ts +1662 -0
  733. package/vendor/ink/node_modules/@types/node/v8.d.ts +983 -0
  734. package/vendor/ink/node_modules/@types/node/vm.d.ts +1208 -0
  735. package/vendor/ink/node_modules/@types/node/wasi.d.ts +202 -0
  736. package/vendor/ink/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
  737. package/vendor/ink/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  738. package/vendor/ink/node_modules/@types/node/web-globals/console.d.ts +9 -0
  739. package/vendor/ink/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
  740. package/vendor/ink/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  741. package/vendor/ink/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  742. package/vendor/ink/node_modules/@types/node/web-globals/events.d.ts +106 -0
  743. package/vendor/ink/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
  744. package/vendor/ink/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  745. package/vendor/ink/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  746. package/vendor/ink/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  747. package/vendor/ink/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  748. package/vendor/ink/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  749. package/vendor/ink/node_modules/@types/node/web-globals/streams.d.ts +115 -0
  750. package/vendor/ink/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  751. package/vendor/ink/node_modules/@types/node/web-globals/url.d.ts +24 -0
  752. package/vendor/ink/node_modules/@types/node/worker_threads.d.ts +717 -0
  753. package/vendor/ink/node_modules/@types/node/zlib.d.ts +618 -0
  754. package/vendor/ink/node_modules/node-pty/LICENSE +69 -0
  755. package/vendor/ink/node_modules/node-pty/README.md +164 -0
  756. package/vendor/ink/node_modules/node-pty/binding.gyp +150 -0
  757. package/vendor/ink/node_modules/node-pty/lib/conpty_console_list_agent.js +25 -0
  758. package/vendor/ink/node_modules/node-pty/lib/eventEmitter2.js +47 -0
  759. package/vendor/ink/node_modules/node-pty/lib/index.js +52 -0
  760. package/vendor/ink/node_modules/node-pty/lib/interfaces.js +7 -0
  761. package/vendor/ink/node_modules/node-pty/lib/shared/conout.js +11 -0
  762. package/vendor/ink/node_modules/node-pty/lib/terminal.js +190 -0
  763. package/vendor/ink/node_modules/node-pty/lib/types.js +7 -0
  764. package/vendor/ink/node_modules/node-pty/lib/unixTerminal.js +349 -0
  765. package/vendor/ink/node_modules/node-pty/lib/utils.js +39 -0
  766. package/vendor/ink/node_modules/node-pty/lib/windowsConoutConnection.js +125 -0
  767. package/vendor/ink/node_modules/node-pty/lib/windowsPtyAgent.js +287 -0
  768. package/vendor/ink/node_modules/node-pty/lib/windowsTerminal.js +201 -0
  769. package/vendor/ink/node_modules/node-pty/lib/worker/conoutSocketWorker.js +22 -0
  770. package/vendor/ink/node_modules/node-pty/package.json +65 -0
  771. package/vendor/ink/node_modules/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
  772. package/vendor/ink/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
  773. package/vendor/ink/node_modules/node-pty/prebuilds/darwin-x64/pty.node +0 -0
  774. package/vendor/ink/node_modules/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
  775. package/vendor/ink/node_modules/node-pty/prebuilds/linux-arm64/pty.node +0 -0
  776. package/vendor/ink/node_modules/node-pty/prebuilds/linux-x64/pty.node +0 -0
  777. package/vendor/ink/node_modules/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
  778. package/vendor/ink/node_modules/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
  779. package/vendor/ink/node_modules/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
  780. package/vendor/ink/node_modules/node-pty/prebuilds/win32-arm64/conpty.pdb +0 -0
  781. package/vendor/ink/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
  782. package/vendor/ink/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.pdb +0 -0
  783. package/vendor/ink/node_modules/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
  784. package/vendor/ink/node_modules/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
  785. package/vendor/ink/node_modules/node-pty/prebuilds/win32-x64/conpty.node +0 -0
  786. package/vendor/ink/node_modules/node-pty/prebuilds/win32-x64/conpty.pdb +0 -0
  787. package/vendor/ink/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
  788. package/vendor/ink/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.pdb +0 -0
  789. package/vendor/ink/node_modules/node-pty/scripts/post-install.js +76 -0
  790. package/vendor/ink/node_modules/node-pty/scripts/prebuild.js +34 -0
  791. package/vendor/ink/node_modules/node-pty/src/unix/pty.cc +875 -0
  792. package/vendor/ink/node_modules/node-pty/src/unix/spawn-helper.cc +23 -0
  793. package/vendor/ink/node_modules/node-pty/src/win/conpty.cc +582 -0
  794. package/vendor/ink/node_modules/node-pty/src/win/conpty.h +41 -0
  795. package/vendor/ink/node_modules/node-pty/src/win/conpty_console_list.cc +44 -0
  796. package/vendor/ink/node_modules/node-pty/src/win/path_util.cc +95 -0
  797. package/vendor/ink/node_modules/node-pty/src/win/path_util.h +26 -0
  798. package/vendor/ink/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-arm64/OpenConsole.exe +0 -0
  799. package/vendor/ink/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-arm64/conpty.dll +0 -0
  800. package/vendor/ink/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/OpenConsole.exe +0 -0
  801. package/vendor/ink/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/conpty.dll +0 -0
  802. package/vendor/ink/node_modules/node-pty/typings/node-pty.d.ts +215 -0
  803. package/vendor/ink/node_modules/undici-types/LICENSE +21 -0
  804. package/vendor/ink/node_modules/undici-types/README.md +6 -0
  805. package/vendor/ink/node_modules/undici-types/agent.d.ts +32 -0
  806. package/vendor/ink/node_modules/undici-types/api.d.ts +43 -0
  807. package/vendor/ink/node_modules/undici-types/balanced-pool.d.ts +30 -0
  808. package/vendor/ink/node_modules/undici-types/cache-interceptor.d.ts +173 -0
  809. package/vendor/ink/node_modules/undici-types/cache.d.ts +36 -0
  810. package/vendor/ink/node_modules/undici-types/client-stats.d.ts +15 -0
  811. package/vendor/ink/node_modules/undici-types/client.d.ts +108 -0
  812. package/vendor/ink/node_modules/undici-types/connector.d.ts +34 -0
  813. package/vendor/ink/node_modules/undici-types/content-type.d.ts +21 -0
  814. package/vendor/ink/node_modules/undici-types/cookies.d.ts +30 -0
  815. package/vendor/ink/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
  816. package/vendor/ink/node_modules/undici-types/dispatcher.d.ts +276 -0
  817. package/vendor/ink/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  818. package/vendor/ink/node_modules/undici-types/errors.d.ts +161 -0
  819. package/vendor/ink/node_modules/undici-types/eventsource.d.ts +66 -0
  820. package/vendor/ink/node_modules/undici-types/fetch.d.ts +211 -0
  821. package/vendor/ink/node_modules/undici-types/formdata.d.ts +108 -0
  822. package/vendor/ink/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  823. package/vendor/ink/node_modules/undici-types/global-origin.d.ts +7 -0
  824. package/vendor/ink/node_modules/undici-types/h2c-client.d.ts +73 -0
  825. package/vendor/ink/node_modules/undici-types/handlers.d.ts +15 -0
  826. package/vendor/ink/node_modules/undici-types/header.d.ts +160 -0
  827. package/vendor/ink/node_modules/undici-types/index.d.ts +88 -0
  828. package/vendor/ink/node_modules/undici-types/interceptors.d.ts +73 -0
  829. package/vendor/ink/node_modules/undici-types/mock-agent.d.ts +68 -0
  830. package/vendor/ink/node_modules/undici-types/mock-call-history.d.ts +111 -0
  831. package/vendor/ink/node_modules/undici-types/mock-client.d.ts +27 -0
  832. package/vendor/ink/node_modules/undici-types/mock-errors.d.ts +12 -0
  833. package/vendor/ink/node_modules/undici-types/mock-interceptor.d.ts +94 -0
  834. package/vendor/ink/node_modules/undici-types/mock-pool.d.ts +27 -0
  835. package/vendor/ink/node_modules/undici-types/package.json +55 -0
  836. package/vendor/ink/node_modules/undici-types/patch.d.ts +29 -0
  837. package/vendor/ink/node_modules/undici-types/pool-stats.d.ts +19 -0
  838. package/vendor/ink/node_modules/undici-types/pool.d.ts +41 -0
  839. package/vendor/ink/node_modules/undici-types/proxy-agent.d.ts +29 -0
  840. package/vendor/ink/node_modules/undici-types/readable.d.ts +68 -0
  841. package/vendor/ink/node_modules/undici-types/retry-agent.d.ts +8 -0
  842. package/vendor/ink/node_modules/undici-types/retry-handler.d.ts +125 -0
  843. package/vendor/ink/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  844. package/vendor/ink/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  845. package/vendor/ink/node_modules/undici-types/util.d.ts +18 -0
  846. package/vendor/ink/node_modules/undici-types/utility.d.ts +7 -0
  847. package/vendor/ink/node_modules/undici-types/webidl.d.ts +341 -0
  848. package/vendor/ink/node_modules/undici-types/websocket.d.ts +186 -0
  849. package/vendor/ink/package.json +201 -0
  850. package/vendor/ink/readme.md +2636 -0
  851. package/bin/swag-agent.js +0 -9
  852. package/dist/server/lib/pg-rate-limiter.d.ts +0 -21
  853. package/dist/server/lib/pg-rate-limiter.js +0 -86
@@ -1,411 +1,1841 @@
1
1
  // server/lib/coa-renderer.ts — React-PDF COA renderer
2
2
  // Ported from CoaGenerator edge function. Produces pixel-perfect branded COA PDFs.
3
+
3
4
  import React from "react";
4
- import { Document, Page, Text, View, Image, StyleSheet, renderToBuffer, Svg, Path, } from "@react-pdf/renderer";
5
+ import { Document, Page, Text, View, Image, StyleSheet, renderToBuffer, Svg, Path } from "@react-pdf/renderer";
5
6
  const e = React.createElement;
7
+
6
8
  // ============================================================================
7
9
  // Design Tokens
8
10
  // ============================================================================
11
+
9
12
  const colors = {
10
- black: "#000000",
11
- gray900: "#111827",
12
- gray800: "#1f2937",
13
- gray700: "#374151",
14
- gray600: "#4b5563",
15
- gray500: "#6b7280",
16
- gray400: "#9ca3af",
17
- gray300: "#d1d5db",
18
- gray200: "#e5e7eb",
19
- gray100: "#f3f4f6",
20
- gray50: "#f9fafb",
21
- green700: "#15803d",
22
- green500: "#10b981",
23
- green50: "#f0fdf4",
24
- white: "#ffffff",
13
+ black: "#000000",
14
+ gray900: "#111827",
15
+ gray800: "#1f2937",
16
+ gray700: "#374151",
17
+ gray600: "#4b5563",
18
+ gray500: "#6b7280",
19
+ gray400: "#9ca3af",
20
+ gray300: "#d1d5db",
21
+ gray200: "#e5e7eb",
22
+ gray100: "#f3f4f6",
23
+ gray50: "#f9fafb",
24
+ green700: "#15803d",
25
+ green500: "#10b981",
26
+ green50: "#f0fdf4",
27
+ white: "#ffffff"
25
28
  };
26
29
  const pieColors = {
27
- THCa: "#10B981",
28
- "D9-THC": "#F59E0B",
29
- "D8-THC": "#EF4444",
30
- THCP: "#8B5CF6",
31
- CBD: "#3B82F6",
32
- CBDa: "#06B6D4",
33
- CBG: "#14B8A6",
34
- CBGa: "#059669",
35
- CBC: "#EC4899",
36
- CBN: "#F97316",
37
- CBDV: "#6366F1",
38
- THCV: "#A855F7",
39
- CBL: "#84CC16",
40
- CBCA: "#D946EF",
41
- CBNA: "#F43F5E",
42
- Other: "#9CA3AF",
30
+ THCa: "#10B981",
31
+ "D9-THC": "#F59E0B",
32
+ "D8-THC": "#EF4444",
33
+ THCP: "#8B5CF6",
34
+ CBD: "#3B82F6",
35
+ CBDa: "#06B6D4",
36
+ CBG: "#14B8A6",
37
+ CBGa: "#059669",
38
+ CBC: "#EC4899",
39
+ CBN: "#F97316",
40
+ CBDV: "#6366F1",
41
+ THCV: "#A855F7",
42
+ CBL: "#84CC16",
43
+ CBCA: "#D946EF",
44
+ CBNA: "#F43F5E",
45
+ Other: "#9CA3AF"
43
46
  };
47
+
48
+ // ============================================================================
49
+ // Interfaces
50
+ // ============================================================================
51
+
44
52
  // ============================================================================
45
53
  // StyleSheets
46
54
  // ============================================================================
55
+
47
56
  const styles = StyleSheet.create({
48
- page: {
49
- paddingTop: 15,
50
- paddingBottom: 15,
51
- paddingLeft: 10,
52
- paddingRight: 10,
53
- fontSize: 8,
54
- fontFamily: "Helvetica",
55
- color: colors.gray900,
56
- backgroundColor: colors.white,
57
- },
58
- header: {
59
- flexDirection: "row",
60
- justifyContent: "space-between",
61
- borderBottomWidth: 1,
62
- borderBottomColor: colors.gray200,
63
- paddingBottom: 6,
64
- marginBottom: 6,
65
- },
66
- headerLeft: { flexDirection: "row", alignItems: "center" },
67
- logo: { width: 45, height: 45 },
68
- companyInfo: { marginLeft: 8 },
69
- companyName: { fontSize: 22, fontFamily: "Helvetica-Bold", color: colors.black },
70
- companySubname: { fontSize: 17, color: colors.black, marginTop: -2 },
71
- divider: { width: 1, height: 45, backgroundColor: colors.gray300, marginHorizontal: 10 },
72
- labContact: { fontSize: 8, color: colors.gray700, lineHeight: 1.4 },
73
- docTitle: { fontSize: 11, color: colors.gray700, marginTop: 6 },
74
- sampleSection: {
75
- flexDirection: "row",
76
- marginBottom: 8,
77
- paddingBottom: 6,
78
- borderBottomWidth: 1,
79
- borderBottomColor: colors.gray200,
80
- },
81
- sampleCol: { flex: 1, paddingHorizontal: 8 },
82
- sampleTitle: { fontSize: 11, fontFamily: "Helvetica-Bold", marginBottom: 4 },
83
- infoRow: { flexDirection: "row", marginBottom: 2 },
84
- infoLabel: { fontSize: 7.5, fontFamily: "Helvetica-Bold", color: colors.gray900 },
85
- infoValue: { fontSize: 7.5, color: colors.gray700, marginLeft: 3 },
86
- sectionHeader: { flexDirection: "row", justifyContent: "space-between", marginBottom: 4 },
87
- sectionTitle: { fontSize: 10, fontFamily: "Helvetica-Bold" },
88
- sectionStatus: { fontSize: 8, color: colors.gray700 },
89
- tableContainer: { flexDirection: "row" },
90
- table: { flex: 1, borderWidth: 1, borderColor: colors.gray200 },
91
- tableHeader: {
92
- flexDirection: "row",
93
- backgroundColor: colors.gray50,
94
- borderBottomWidth: 1,
95
- borderBottomColor: colors.gray200,
96
- },
97
- tableHeaderCell: {
98
- padding: 6, fontSize: 9, fontFamily: "Helvetica-Bold", textAlign: "center",
99
- borderRightWidth: 1, borderRightColor: colors.gray200,
100
- },
101
- tableHeaderCellLast: {
102
- padding: 6, fontSize: 9, fontFamily: "Helvetica-Bold", textAlign: "center",
103
- },
104
- tableRow: {
105
- flexDirection: "row", borderBottomWidth: 1, borderBottomColor: colors.gray200, minHeight: 22,
106
- },
107
- tableRowAlt: {
108
- flexDirection: "row", borderBottomWidth: 1, borderBottomColor: colors.gray200,
109
- backgroundColor: colors.gray50, minHeight: 22,
110
- },
111
- tableCell: {
112
- padding: 6, fontSize: 9, textAlign: "center",
113
- borderRightWidth: 1, borderRightColor: colors.gray200, color: colors.gray700,
114
- },
115
- tableCellLast: { padding: 6, fontSize: 9, textAlign: "center", color: colors.gray700 },
116
- tableCellLeft: {
117
- padding: 6, fontSize: 9, textAlign: "left",
118
- borderRightWidth: 1, borderRightColor: colors.gray200, fontFamily: "Helvetica-Bold",
119
- },
120
- tableSummaryRow: {
121
- flexDirection: "row", backgroundColor: colors.gray100, minHeight: 22,
122
- },
123
- summaryContainer: { width: 145, marginLeft: 12 },
124
- summaryBox: {
125
- borderWidth: 2, borderColor: colors.green500, backgroundColor: colors.green50,
126
- padding: 10, marginBottom: 8, alignItems: "center",
127
- },
128
- summaryBoxInactive: {
129
- borderWidth: 2, borderColor: colors.gray300, backgroundColor: colors.gray50,
130
- padding: 10, marginBottom: 8, alignItems: "center",
131
- },
132
- summaryValue: { fontSize: 18, fontFamily: "Helvetica-Bold", color: colors.green700 },
133
- summaryValueInactive: { fontSize: 18, fontFamily: "Helvetica-Bold", color: colors.gray500 },
134
- summaryLabel: { fontSize: 9, fontFamily: "Helvetica-Bold", color: colors.green700, marginTop: 3 },
135
- summaryLabelInactive: { fontSize: 9, fontFamily: "Helvetica-Bold", color: colors.gray500, marginTop: 3 },
136
- summaryTableTitle: { fontSize: 10, fontFamily: "Helvetica-Bold", marginTop: 10, marginBottom: 4 },
137
- summaryTable: { borderWidth: 1, borderColor: colors.gray200 },
138
- summaryTableRow: {
139
- flexDirection: "row", borderBottomWidth: 1, borderBottomColor: colors.gray200, minHeight: 18,
140
- },
141
- summaryTableCell: { padding: 4, fontSize: 8, flex: 1, textAlign: "center" },
142
- summaryTableCellLeft: {
143
- padding: 4, fontSize: 8, flex: 1, textAlign: "left", fontFamily: "Helvetica-Bold",
144
- },
145
- methodology: { backgroundColor: colors.gray50, padding: 8, marginTop: 8, marginBottom: 8 },
146
- methodologyTitle: { fontSize: 9, fontFamily: "Helvetica-Bold", marginBottom: 4 },
147
- methodologyText: { fontSize: 7, color: colors.gray700, lineHeight: 1.5 },
148
- footer: {
149
- flexDirection: "row", borderTopWidth: 1, borderTopColor: colors.gray200,
150
- paddingTop: 8, marginTop: 6,
151
- },
152
- footerLeft: { flex: 1, flexDirection: "row" },
153
- qrSection: { alignItems: "center", marginRight: 12 },
154
- qrCode: { width: 60, height: 60, borderWidth: 1, borderColor: colors.gray300 },
155
- qrLabel: { fontSize: 7, color: colors.gray700, marginTop: 3 },
156
- disclaimer: { flex: 1, fontSize: 7, color: colors.gray700, lineHeight: 1.4 },
157
- footerRight: { width: 150, alignItems: "flex-end" },
158
- footerCompany: { fontSize: 9, textAlign: "right", marginBottom: 8 },
159
- signatureSection: {
160
- borderTopWidth: 1, borderTopColor: colors.gray300, paddingTop: 8, alignItems: "flex-end",
161
- },
162
- signatureName: { fontSize: 9, fontFamily: "Helvetica-Bold" },
163
- signatureTitle: { fontSize: 8, color: colors.gray700 },
57
+ page: {
58
+ paddingTop: 15,
59
+ paddingBottom: 15,
60
+ paddingLeft: 10,
61
+ paddingRight: 10,
62
+ fontSize: 8,
63
+ fontFamily: "Helvetica",
64
+ color: colors.gray900,
65
+ backgroundColor: colors.white
66
+ },
67
+ header: {
68
+ flexDirection: "row",
69
+ justifyContent: "space-between",
70
+ borderBottomWidth: 1,
71
+ borderBottomColor: colors.gray200,
72
+ paddingBottom: 6,
73
+ marginBottom: 6
74
+ },
75
+ headerLeft: {
76
+ flexDirection: "row",
77
+ alignItems: "center"
78
+ },
79
+ logo: {
80
+ width: 45,
81
+ height: 45
82
+ },
83
+ companyInfo: {
84
+ marginLeft: 8
85
+ },
86
+ companyName: {
87
+ fontSize: 22,
88
+ fontFamily: "Helvetica-Bold",
89
+ color: colors.black
90
+ },
91
+ companySubname: {
92
+ fontSize: 17,
93
+ color: colors.black,
94
+ marginTop: -2
95
+ },
96
+ divider: {
97
+ width: 1,
98
+ height: 45,
99
+ backgroundColor: colors.gray300,
100
+ marginHorizontal: 10
101
+ },
102
+ labContact: {
103
+ fontSize: 8,
104
+ color: colors.gray700,
105
+ lineHeight: 1.4
106
+ },
107
+ docTitle: {
108
+ fontSize: 11,
109
+ color: colors.gray700,
110
+ marginTop: 6
111
+ },
112
+ sampleSection: {
113
+ flexDirection: "row",
114
+ marginBottom: 8,
115
+ paddingBottom: 6,
116
+ borderBottomWidth: 1,
117
+ borderBottomColor: colors.gray200
118
+ },
119
+ sampleCol: {
120
+ flex: 1,
121
+ paddingHorizontal: 8
122
+ },
123
+ sampleTitle: {
124
+ fontSize: 11,
125
+ fontFamily: "Helvetica-Bold",
126
+ marginBottom: 4
127
+ },
128
+ infoRow: {
129
+ flexDirection: "row",
130
+ marginBottom: 2
131
+ },
132
+ infoLabel: {
133
+ fontSize: 7.5,
134
+ fontFamily: "Helvetica-Bold",
135
+ color: colors.gray900
136
+ },
137
+ infoValue: {
138
+ fontSize: 7.5,
139
+ color: colors.gray700,
140
+ marginLeft: 3
141
+ },
142
+ sectionHeader: {
143
+ flexDirection: "row",
144
+ justifyContent: "space-between",
145
+ marginBottom: 4
146
+ },
147
+ sectionTitle: {
148
+ fontSize: 10,
149
+ fontFamily: "Helvetica-Bold"
150
+ },
151
+ sectionStatus: {
152
+ fontSize: 8,
153
+ color: colors.gray700
154
+ },
155
+ tableContainer: {
156
+ flexDirection: "row"
157
+ },
158
+ table: {
159
+ flex: 1,
160
+ borderWidth: 1,
161
+ borderColor: colors.gray200
162
+ },
163
+ tableHeader: {
164
+ flexDirection: "row",
165
+ backgroundColor: colors.gray50,
166
+ borderBottomWidth: 1,
167
+ borderBottomColor: colors.gray200
168
+ },
169
+ tableHeaderCell: {
170
+ padding: 6,
171
+ fontSize: 9,
172
+ fontFamily: "Helvetica-Bold",
173
+ textAlign: "center",
174
+ borderRightWidth: 1,
175
+ borderRightColor: colors.gray200
176
+ },
177
+ tableHeaderCellLast: {
178
+ padding: 6,
179
+ fontSize: 9,
180
+ fontFamily: "Helvetica-Bold",
181
+ textAlign: "center"
182
+ },
183
+ tableRow: {
184
+ flexDirection: "row",
185
+ borderBottomWidth: 1,
186
+ borderBottomColor: colors.gray200,
187
+ minHeight: 22
188
+ },
189
+ tableRowAlt: {
190
+ flexDirection: "row",
191
+ borderBottomWidth: 1,
192
+ borderBottomColor: colors.gray200,
193
+ backgroundColor: colors.gray50,
194
+ minHeight: 22
195
+ },
196
+ tableCell: {
197
+ padding: 6,
198
+ fontSize: 9,
199
+ textAlign: "center",
200
+ borderRightWidth: 1,
201
+ borderRightColor: colors.gray200,
202
+ color: colors.gray700
203
+ },
204
+ tableCellLast: {
205
+ padding: 6,
206
+ fontSize: 9,
207
+ textAlign: "center",
208
+ color: colors.gray700
209
+ },
210
+ tableCellLeft: {
211
+ padding: 6,
212
+ fontSize: 9,
213
+ textAlign: "left",
214
+ borderRightWidth: 1,
215
+ borderRightColor: colors.gray200,
216
+ fontFamily: "Helvetica-Bold"
217
+ },
218
+ tableSummaryRow: {
219
+ flexDirection: "row",
220
+ backgroundColor: colors.gray100,
221
+ minHeight: 22
222
+ },
223
+ summaryContainer: {
224
+ width: 145,
225
+ marginLeft: 12
226
+ },
227
+ summaryBox: {
228
+ borderWidth: 2,
229
+ borderColor: colors.green500,
230
+ backgroundColor: colors.green50,
231
+ padding: 10,
232
+ marginBottom: 8,
233
+ alignItems: "center"
234
+ },
235
+ summaryBoxInactive: {
236
+ borderWidth: 2,
237
+ borderColor: colors.gray300,
238
+ backgroundColor: colors.gray50,
239
+ padding: 10,
240
+ marginBottom: 8,
241
+ alignItems: "center"
242
+ },
243
+ summaryValue: {
244
+ fontSize: 18,
245
+ fontFamily: "Helvetica-Bold",
246
+ color: colors.green700
247
+ },
248
+ summaryValueInactive: {
249
+ fontSize: 18,
250
+ fontFamily: "Helvetica-Bold",
251
+ color: colors.gray500
252
+ },
253
+ summaryLabel: {
254
+ fontSize: 9,
255
+ fontFamily: "Helvetica-Bold",
256
+ color: colors.green700,
257
+ marginTop: 3
258
+ },
259
+ summaryLabelInactive: {
260
+ fontSize: 9,
261
+ fontFamily: "Helvetica-Bold",
262
+ color: colors.gray500,
263
+ marginTop: 3
264
+ },
265
+ summaryTableTitle: {
266
+ fontSize: 10,
267
+ fontFamily: "Helvetica-Bold",
268
+ marginTop: 10,
269
+ marginBottom: 4
270
+ },
271
+ summaryTable: {
272
+ borderWidth: 1,
273
+ borderColor: colors.gray200
274
+ },
275
+ summaryTableRow: {
276
+ flexDirection: "row",
277
+ borderBottomWidth: 1,
278
+ borderBottomColor: colors.gray200,
279
+ minHeight: 18
280
+ },
281
+ summaryTableCell: {
282
+ padding: 4,
283
+ fontSize: 8,
284
+ flex: 1,
285
+ textAlign: "center"
286
+ },
287
+ summaryTableCellLeft: {
288
+ padding: 4,
289
+ fontSize: 8,
290
+ flex: 1,
291
+ textAlign: "left",
292
+ fontFamily: "Helvetica-Bold"
293
+ },
294
+ methodology: {
295
+ backgroundColor: colors.gray50,
296
+ padding: 8,
297
+ marginTop: 8,
298
+ marginBottom: 8
299
+ },
300
+ methodologyTitle: {
301
+ fontSize: 9,
302
+ fontFamily: "Helvetica-Bold",
303
+ marginBottom: 4
304
+ },
305
+ methodologyText: {
306
+ fontSize: 7,
307
+ color: colors.gray700,
308
+ lineHeight: 1.5
309
+ },
310
+ footer: {
311
+ flexDirection: "row",
312
+ borderTopWidth: 1,
313
+ borderTopColor: colors.gray200,
314
+ paddingTop: 8,
315
+ marginTop: 6
316
+ },
317
+ footerLeft: {
318
+ flex: 1,
319
+ flexDirection: "row"
320
+ },
321
+ qrSection: {
322
+ alignItems: "center",
323
+ marginRight: 12
324
+ },
325
+ qrCode: {
326
+ width: 60,
327
+ height: 60,
328
+ borderWidth: 1,
329
+ borderColor: colors.gray300
330
+ },
331
+ qrLabel: {
332
+ fontSize: 7,
333
+ color: colors.gray700,
334
+ marginTop: 3
335
+ },
336
+ disclaimer: {
337
+ flex: 1,
338
+ fontSize: 7,
339
+ color: colors.gray700,
340
+ lineHeight: 1.4
341
+ },
342
+ footerRight: {
343
+ width: 150,
344
+ alignItems: "flex-end"
345
+ },
346
+ footerCompany: {
347
+ fontSize: 9,
348
+ textAlign: "right",
349
+ marginBottom: 8
350
+ },
351
+ signatureSection: {
352
+ borderTopWidth: 1,
353
+ borderTopColor: colors.gray300,
354
+ paddingTop: 8,
355
+ alignItems: "flex-end"
356
+ },
357
+ signatureName: {
358
+ fontSize: 9,
359
+ fontFamily: "Helvetica-Bold"
360
+ },
361
+ signatureTitle: {
362
+ fontSize: 8,
363
+ color: colors.gray700
364
+ }
164
365
  });
165
366
  const panelStyles = StyleSheet.create({
166
- pageHeader: {
167
- flexDirection: "row", justifyContent: "space-between", alignItems: "center",
168
- borderBottomWidth: 2, borderBottomColor: colors.green500, paddingBottom: 6, marginBottom: 8,
169
- },
170
- pageHeaderLeft: { flexDirection: "row", alignItems: "center" },
171
- pageHeaderLogo: { width: 28, height: 28 },
172
- pageHeaderTitle: { marginLeft: 8 },
173
- pageHeaderCompany: { fontSize: 14, fontFamily: "Helvetica-Bold" },
174
- pageHeaderSubtitle: { fontSize: 9, color: colors.gray600 },
175
- pageHeaderRight: { textAlign: "right" },
176
- pageTitle: { fontSize: 12, fontFamily: "Helvetica-Bold" },
177
- pageSampleInfo: { fontSize: 8, color: colors.gray600 },
178
- panelSection: { marginBottom: 6 },
179
- summaryCard: {
180
- backgroundColor: colors.green50, borderWidth: 2, borderColor: colors.green500,
181
- borderRadius: 8, padding: 8, marginBottom: 8,
182
- },
183
- summaryCardTitle: { fontSize: 10, fontFamily: "Helvetica-Bold", color: colors.green700, marginBottom: 6 },
184
- summaryCardText: { fontSize: 8, color: colors.gray700, lineHeight: 1.4 },
185
- panelHeader: {
186
- flexDirection: "row", justifyContent: "space-between", alignItems: "center",
187
- backgroundColor: colors.gray100, padding: 8, marginBottom: 1,
188
- },
189
- panelTitle: { fontSize: 11, fontFamily: "Helvetica-Bold", flexShrink: 0 },
190
- statusBadge: {
191
- backgroundColor: colors.green500, color: colors.white,
192
- paddingHorizontal: 8, paddingVertical: 3, borderRadius: 3,
193
- fontSize: 8, fontFamily: "Helvetica-Bold",
194
- },
195
- statusBadgeFail: {
196
- backgroundColor: "#EF4444", color: colors.white,
197
- paddingHorizontal: 8, paddingVertical: 3, borderRadius: 3,
198
- fontSize: 8, fontFamily: "Helvetica-Bold",
199
- },
200
- panelTable: { borderWidth: 1, borderColor: colors.gray200 },
201
- panelTableHeader: {
202
- flexDirection: "row", backgroundColor: colors.gray50,
203
- borderBottomWidth: 1, borderBottomColor: colors.gray200,
204
- },
205
- panelTableHeaderCell: {
206
- padding: 6, fontSize: 9, fontFamily: "Helvetica-Bold", textAlign: "center",
207
- borderRightWidth: 1, borderRightColor: colors.gray200,
208
- },
209
- panelTableRow: {
210
- flexDirection: "row", borderBottomWidth: 1, borderBottomColor: colors.gray200, minHeight: 18,
211
- },
212
- panelTableCell: {
213
- padding: 3, fontSize: 7, textAlign: "center",
214
- borderRightWidth: 1, borderRightColor: colors.gray200,
215
- },
216
- panelTableCellLeft: {
217
- padding: 3, fontSize: 7, textAlign: "left",
218
- borderRightWidth: 1, borderRightColor: colors.gray200,
219
- },
220
- pesticideTableRow: {
221
- flexDirection: "row", borderBottomWidth: 0.5, borderBottomColor: colors.gray200, minHeight: 14,
222
- },
223
- pesticideTableCell: {
224
- padding: 2, fontSize: 6.5, textAlign: "center",
225
- borderRightWidth: 0.5, borderRightColor: colors.gray200,
226
- },
227
- pesticideTableCellLeft: {
228
- padding: 2, fontSize: 6.5, textAlign: "left",
229
- borderRightWidth: 0.5, borderRightColor: colors.gray200,
230
- },
231
- passText: { color: colors.green700, fontFamily: "Helvetica-Bold" },
232
- failText: { color: "#EF4444", fontFamily: "Helvetica-Bold" },
233
- twoColumnContainer: { flexDirection: "row", gap: 12 },
234
- columnHalf: { flex: 1 },
235
- pageFooter: {
236
- position: "absolute", bottom: 20, left: 20, right: 20,
237
- flexDirection: "row", justifyContent: "space-between",
238
- borderTopWidth: 1, borderTopColor: colors.gray200, paddingTop: 8,
239
- },
240
- footerText: { fontSize: 7, color: colors.gray600 },
241
- methodology: { marginTop: 8, padding: 6, backgroundColor: colors.gray50 },
242
- methodologyTitle: { fontSize: 8, fontFamily: "Helvetica-Bold", marginBottom: 4 },
243
- methodologyText: { fontSize: 7, color: colors.gray600, lineHeight: 1.4 },
244
- categoryBadge: {
245
- backgroundColor: colors.green500, color: colors.white,
246
- paddingHorizontal: 6, paddingVertical: 2, fontSize: 7, fontFamily: "Helvetica-Bold",
247
- },
248
- categoryTitle: { fontSize: 9, fontFamily: "Helvetica-Bold", marginLeft: 8 },
249
- categorySubtitle: { fontSize: 7, color: colors.gray600, marginLeft: 8 },
367
+ pageHeader: {
368
+ flexDirection: "row",
369
+ justifyContent: "space-between",
370
+ alignItems: "center",
371
+ borderBottomWidth: 2,
372
+ borderBottomColor: colors.green500,
373
+ paddingBottom: 6,
374
+ marginBottom: 8
375
+ },
376
+ pageHeaderLeft: {
377
+ flexDirection: "row",
378
+ alignItems: "center"
379
+ },
380
+ pageHeaderLogo: {
381
+ width: 28,
382
+ height: 28
383
+ },
384
+ pageHeaderTitle: {
385
+ marginLeft: 8
386
+ },
387
+ pageHeaderCompany: {
388
+ fontSize: 14,
389
+ fontFamily: "Helvetica-Bold"
390
+ },
391
+ pageHeaderSubtitle: {
392
+ fontSize: 9,
393
+ color: colors.gray600
394
+ },
395
+ pageHeaderRight: {
396
+ textAlign: "right"
397
+ },
398
+ pageTitle: {
399
+ fontSize: 12,
400
+ fontFamily: "Helvetica-Bold"
401
+ },
402
+ pageSampleInfo: {
403
+ fontSize: 8,
404
+ color: colors.gray600
405
+ },
406
+ panelSection: {
407
+ marginBottom: 6
408
+ },
409
+ summaryCard: {
410
+ backgroundColor: colors.green50,
411
+ borderWidth: 2,
412
+ borderColor: colors.green500,
413
+ borderRadius: 8,
414
+ padding: 8,
415
+ marginBottom: 8
416
+ },
417
+ summaryCardTitle: {
418
+ fontSize: 10,
419
+ fontFamily: "Helvetica-Bold",
420
+ color: colors.green700,
421
+ marginBottom: 6
422
+ },
423
+ summaryCardText: {
424
+ fontSize: 8,
425
+ color: colors.gray700,
426
+ lineHeight: 1.4
427
+ },
428
+ panelHeader: {
429
+ flexDirection: "row",
430
+ justifyContent: "space-between",
431
+ alignItems: "center",
432
+ backgroundColor: colors.gray100,
433
+ padding: 8,
434
+ marginBottom: 1
435
+ },
436
+ panelTitle: {
437
+ fontSize: 11,
438
+ fontFamily: "Helvetica-Bold",
439
+ flexShrink: 0
440
+ },
441
+ statusBadge: {
442
+ backgroundColor: colors.green500,
443
+ color: colors.white,
444
+ paddingHorizontal: 8,
445
+ paddingVertical: 3,
446
+ borderRadius: 3,
447
+ fontSize: 8,
448
+ fontFamily: "Helvetica-Bold"
449
+ },
450
+ statusBadgeFail: {
451
+ backgroundColor: "#EF4444",
452
+ color: colors.white,
453
+ paddingHorizontal: 8,
454
+ paddingVertical: 3,
455
+ borderRadius: 3,
456
+ fontSize: 8,
457
+ fontFamily: "Helvetica-Bold"
458
+ },
459
+ panelTable: {
460
+ borderWidth: 1,
461
+ borderColor: colors.gray200
462
+ },
463
+ panelTableHeader: {
464
+ flexDirection: "row",
465
+ backgroundColor: colors.gray50,
466
+ borderBottomWidth: 1,
467
+ borderBottomColor: colors.gray200
468
+ },
469
+ panelTableHeaderCell: {
470
+ padding: 6,
471
+ fontSize: 9,
472
+ fontFamily: "Helvetica-Bold",
473
+ textAlign: "center",
474
+ borderRightWidth: 1,
475
+ borderRightColor: colors.gray200
476
+ },
477
+ panelTableRow: {
478
+ flexDirection: "row",
479
+ borderBottomWidth: 1,
480
+ borderBottomColor: colors.gray200,
481
+ minHeight: 18
482
+ },
483
+ panelTableCell: {
484
+ padding: 3,
485
+ fontSize: 7,
486
+ textAlign: "center",
487
+ borderRightWidth: 1,
488
+ borderRightColor: colors.gray200
489
+ },
490
+ panelTableCellLeft: {
491
+ padding: 3,
492
+ fontSize: 7,
493
+ textAlign: "left",
494
+ borderRightWidth: 1,
495
+ borderRightColor: colors.gray200
496
+ },
497
+ pesticideTableRow: {
498
+ flexDirection: "row",
499
+ borderBottomWidth: 0.5,
500
+ borderBottomColor: colors.gray200,
501
+ minHeight: 14
502
+ },
503
+ pesticideTableCell: {
504
+ padding: 2,
505
+ fontSize: 6.5,
506
+ textAlign: "center",
507
+ borderRightWidth: 0.5,
508
+ borderRightColor: colors.gray200
509
+ },
510
+ pesticideTableCellLeft: {
511
+ padding: 2,
512
+ fontSize: 6.5,
513
+ textAlign: "left",
514
+ borderRightWidth: 0.5,
515
+ borderRightColor: colors.gray200
516
+ },
517
+ passText: {
518
+ color: colors.green700,
519
+ fontFamily: "Helvetica-Bold"
520
+ },
521
+ failText: {
522
+ color: "#EF4444",
523
+ fontFamily: "Helvetica-Bold"
524
+ },
525
+ twoColumnContainer: {
526
+ flexDirection: "row",
527
+ gap: 12
528
+ },
529
+ columnHalf: {
530
+ flex: 1
531
+ },
532
+ pageFooter: {
533
+ position: "absolute",
534
+ bottom: 20,
535
+ left: 20,
536
+ right: 20,
537
+ flexDirection: "row",
538
+ justifyContent: "space-between",
539
+ borderTopWidth: 1,
540
+ borderTopColor: colors.gray200,
541
+ paddingTop: 8
542
+ },
543
+ footerText: {
544
+ fontSize: 7,
545
+ color: colors.gray600
546
+ },
547
+ methodology: {
548
+ marginTop: 8,
549
+ padding: 6,
550
+ backgroundColor: colors.gray50
551
+ },
552
+ methodologyTitle: {
553
+ fontSize: 8,
554
+ fontFamily: "Helvetica-Bold",
555
+ marginBottom: 4
556
+ },
557
+ methodologyText: {
558
+ fontSize: 7,
559
+ color: colors.gray600,
560
+ lineHeight: 1.4
561
+ },
562
+ categoryBadge: {
563
+ backgroundColor: colors.green500,
564
+ color: colors.white,
565
+ paddingHorizontal: 6,
566
+ paddingVertical: 2,
567
+ fontSize: 7,
568
+ fontFamily: "Helvetica-Bold"
569
+ },
570
+ categoryTitle: {
571
+ fontSize: 9,
572
+ fontFamily: "Helvetica-Bold",
573
+ marginLeft: 8
574
+ },
575
+ categorySubtitle: {
576
+ fontSize: 7,
577
+ color: colors.gray600,
578
+ marginLeft: 8
579
+ }
250
580
  });
581
+
251
582
  // ============================================================================
252
583
  // Pie Chart
253
584
  // ============================================================================
585
+
254
586
  const createPieSlice = (cx, cy, r, startAngle, endAngle) => {
255
- const start = {
256
- x: cx + r * Math.cos((startAngle * Math.PI) / 180),
257
- y: cy + r * Math.sin((startAngle * Math.PI) / 180),
258
- };
259
- const end = {
260
- x: cx + r * Math.cos((endAngle * Math.PI) / 180),
261
- y: cy + r * Math.sin((endAngle * Math.PI) / 180),
262
- };
263
- const largeArc = endAngle - startAngle > 180 ? 1 : 0;
264
- return `M ${cx} ${cy} L ${start.x} ${start.y} A ${r} ${r} 0 ${largeArc} 1 ${end.x} ${end.y} Z`;
587
+ const start = {
588
+ x: cx + r * Math.cos(startAngle * Math.PI / 180),
589
+ y: cy + r * Math.sin(startAngle * Math.PI / 180)
590
+ };
591
+ const end = {
592
+ x: cx + r * Math.cos(endAngle * Math.PI / 180),
593
+ y: cy + r * Math.sin(endAngle * Math.PI / 180)
594
+ };
595
+ const largeArc = endAngle - startAngle > 180 ? 1 : 0;
596
+ return `M ${cx} ${cy} L ${start.x} ${start.y} A ${r} ${r} 0 ${largeArc} 1 ${end.x} ${end.y} Z`;
265
597
  };
266
- const PieChart = ({ cannabinoids }) => {
267
- const detected = cannabinoids
268
- .filter((c) => c.result !== "ND" && c.percentWeight > 0)
269
- .sort((a, b) => b.percentWeight - a.percentWeight);
270
- const cx = 35, cy = 35, r = 30;
271
- if (detected.length === 0 || detected.reduce((sum, c) => sum + c.percentWeight, 0) === 0) {
272
- const placeholderData = [
273
- { name: "D9-THC", pct: 65 }, { name: "THCa", pct: 20 },
274
- { name: "CBD", pct: 10 }, { name: "Other", pct: 5 },
275
- ];
276
- let currentAngle = -90;
277
- const placeholderSlices = placeholderData.map((item, i) => {
278
- const angle = (item.pct / 100) * 360;
279
- const path = createPieSlice(cx, cy, r, currentAngle, currentAngle + angle);
280
- const color = pieColors[item.name] || pieColors.Other;
281
- currentAngle += angle;
282
- return e(Path, { key: String(i), d: path, fill: color, opacity: 0.4 });
283
- });
284
- const placeholderLegend = placeholderData.map((item, i) => {
285
- const color = pieColors[item.name] || pieColors.Other;
286
- return e(View, { key: String(i), style: { flexDirection: "row", alignItems: "center", marginBottom: 2 } }, e(View, { style: { width: 6, height: 6, backgroundColor: color, opacity: 0.4, marginRight: 3 } }), e(Text, { style: { fontSize: 6, color: colors.gray400 } }, `${item.name}: --%`));
287
- });
288
- return e(View, { style: { flexDirection: "row", alignItems: "flex-start" } }, e(Svg, { width: 70, height: 70, viewBox: "0 0 70 70" }, ...placeholderSlices), e(View, { style: { marginLeft: 4 } }, ...placeholderLegend));
289
- }
290
- const total = detected.reduce((sum, c) => sum + c.percentWeight, 0);
598
+ const PieChart = ({
599
+ cannabinoids
600
+ }) => {
601
+ const detected = cannabinoids.filter(c => c.result !== "ND" && c.percentWeight > 0).sort((a, b) => b.percentWeight - a.percentWeight);
602
+ const cx = 35,
603
+ cy = 35,
604
+ r = 30;
605
+ if (detected.length === 0 || detected.reduce((sum, c) => sum + c.percentWeight, 0) === 0) {
606
+ const placeholderData = [{
607
+ name: "D9-THC",
608
+ pct: 65
609
+ }, {
610
+ name: "THCa",
611
+ pct: 20
612
+ }, {
613
+ name: "CBD",
614
+ pct: 10
615
+ }, {
616
+ name: "Other",
617
+ pct: 5
618
+ }];
291
619
  let currentAngle = -90;
292
- const slices = detected.map((c, i) => {
293
- const angle = (c.percentWeight / total) * 360;
294
- const path = createPieSlice(cx, cy, r, currentAngle, currentAngle + angle);
295
- const color = pieColors[c.name] || pieColors.Other;
296
- currentAngle += angle;
297
- return e(Path, { key: String(i), d: path, fill: color });
620
+ const placeholderSlices = placeholderData.map((item, i) => {
621
+ const angle = item.pct / 100 * 360;
622
+ const path = createPieSlice(cx, cy, r, currentAngle, currentAngle + angle);
623
+ const color = pieColors[item.name] || pieColors.Other;
624
+ currentAngle += angle;
625
+ return e(Path, {
626
+ key: String(i),
627
+ d: path,
628
+ fill: color,
629
+ opacity: 0.4
630
+ });
631
+ });
632
+ const placeholderLegend = placeholderData.map((item, i) => {
633
+ const color = pieColors[item.name] || pieColors.Other;
634
+ return e(View, {
635
+ key: String(i),
636
+ style: {
637
+ flexDirection: "row",
638
+ alignItems: "center",
639
+ marginBottom: 2
640
+ }
641
+ }, e(View, {
642
+ style: {
643
+ width: 6,
644
+ height: 6,
645
+ backgroundColor: color,
646
+ opacity: 0.4,
647
+ marginRight: 3
648
+ }
649
+ }), e(Text, {
650
+ style: {
651
+ fontSize: 6,
652
+ color: colors.gray400
653
+ }
654
+ }, `${item.name}: --%`));
298
655
  });
299
- const legend = detected.slice(0, 6).map((c, i) => {
300
- const color = pieColors[c.name] || pieColors.Other;
301
- const displayName = c.name.replace(/Δ/g, "D").replace(/\u0394/g, "D").replace(/Delta/gi, "D");
302
- return e(View, { key: String(i), style: { flexDirection: "row", alignItems: "center", marginBottom: 2 } }, e(View, { style: { width: 6, height: 6, backgroundColor: color, marginRight: 3 } }), e(Text, { style: { fontSize: 6, color: colors.gray700 } }, `${displayName}: ${c.percentWeight.toFixed(2)}%`));
656
+ return e(View, {
657
+ style: {
658
+ flexDirection: "row",
659
+ alignItems: "flex-start"
660
+ }
661
+ }, e(Svg, {
662
+ width: 70,
663
+ height: 70,
664
+ viewBox: "0 0 70 70"
665
+ }, ...placeholderSlices), e(View, {
666
+ style: {
667
+ marginLeft: 4
668
+ }
669
+ }, ...placeholderLegend));
670
+ }
671
+ const total = detected.reduce((sum, c) => sum + c.percentWeight, 0);
672
+ let currentAngle = -90;
673
+ const slices = detected.map((c, i) => {
674
+ const angle = c.percentWeight / total * 360;
675
+ const path = createPieSlice(cx, cy, r, currentAngle, currentAngle + angle);
676
+ const color = pieColors[c.name] || pieColors.Other;
677
+ currentAngle += angle;
678
+ return e(Path, {
679
+ key: String(i),
680
+ d: path,
681
+ fill: color
303
682
  });
304
- return e(View, { style: { flexDirection: "row", alignItems: "flex-start" } }, e(Svg, { width: 70, height: 70, viewBox: "0 0 70 70" }, ...slices), e(View, { style: { marginLeft: 4 } }, ...legend));
683
+ });
684
+ const legend = detected.slice(0, 6).map((c, i) => {
685
+ const color = pieColors[c.name] || pieColors.Other;
686
+ const displayName = c.name.replace(/Δ/g, "D").replace(/\u0394/g, "D").replace(/Delta/gi, "D");
687
+ return e(View, {
688
+ key: String(i),
689
+ style: {
690
+ flexDirection: "row",
691
+ alignItems: "center",
692
+ marginBottom: 2
693
+ }
694
+ }, e(View, {
695
+ style: {
696
+ width: 6,
697
+ height: 6,
698
+ backgroundColor: color,
699
+ marginRight: 3
700
+ }
701
+ }), e(Text, {
702
+ style: {
703
+ fontSize: 6,
704
+ color: colors.gray700
705
+ }
706
+ }, `${displayName}: ${c.percentWeight.toFixed(2)}%`));
707
+ });
708
+ return e(View, {
709
+ style: {
710
+ flexDirection: "row",
711
+ alignItems: "flex-start"
712
+ }
713
+ }, e(Svg, {
714
+ width: 70,
715
+ height: 70,
716
+ viewBox: "0 0 70 70"
717
+ }, ...slices), e(View, {
718
+ style: {
719
+ marginLeft: 4
720
+ }
721
+ }, ...legend));
305
722
  };
723
+
306
724
  // ============================================================================
307
725
  // Shared Components (Pages 2-5)
308
726
  // ============================================================================
309
- const PanelPageHeader = ({ data, title }) => {
310
- return e(View, null, e(View, { style: styles.header }, e(View, { style: styles.headerLeft }, data.logoUrl
311
- ? e(Image, { src: data.logoUrl, style: styles.logo })
312
- : e(View, { style: { ...styles.logo, backgroundColor: colors.green500, borderRadius: 8 } }), e(View, { style: styles.companyInfo }, e(Text, { style: styles.companyName }, (data.labName || "Lab").split(" ")[0]), e(Text, { style: styles.companySubname }, (data.labName || "").split(" ").slice(1).join(" ") || "")), e(View, { style: styles.divider }), e(Text, { style: styles.labContact }, data.labContact || "")), e(Text, { style: { ...styles.docTitle, fontSize: 10, fontFamily: "Helvetica-Bold" } }, title)), e(View, { style: { ...styles.sampleSection, marginBottom: 8 } }, e(View, { style: styles.sampleCol }, e(Text, { style: styles.sampleTitle }, data.sampleName), e(View, { style: styles.infoRow }, e(Text, { style: styles.infoLabel }, "Sample ID:"), e(Text, { style: styles.infoValue }, data.sampleId)), e(View, { style: styles.infoRow }, e(Text, { style: styles.infoLabel }, "Matrix:"), e(Text, { style: styles.infoValue }, data.sampleType || "Plant"))), e(View, { style: styles.sampleCol }, e(View, { style: styles.infoRow }, e(Text, { style: styles.infoLabel }, "Collected:"), e(Text, { style: styles.infoValue }, data.dateCollected || "\u2014")), e(View, { style: styles.infoRow }, e(Text, { style: styles.infoLabel }, "Received:"), e(Text, { style: styles.infoValue }, data.dateReceived || "\u2014")), e(View, { style: styles.infoRow }, e(Text, { style: styles.infoLabel }, "Completed:"), e(Text, { style: styles.infoValue }, data.dateTested || "\u2014")), e(View, { style: styles.infoRow }, e(Text, { style: styles.infoLabel }, "Batch #:"), e(Text, { style: styles.infoValue }, data.batchId || "\u2014"))), e(View, { style: styles.sampleCol }, e(Text, { style: styles.infoLabel }, "Client:"), e(Text, { style: { ...styles.infoValue, fontFamily: "Helvetica-Bold", marginLeft: 0 } }, data.clientName), data.clientAddress ? e(Text, { style: { ...styles.infoValue, marginLeft: 0, fontSize: 6.5 } }, data.clientAddress) : null, data.licenseNumber ? e(View, { style: styles.infoRow }, e(Text, { style: styles.infoLabel }, "Lic #:"), e(Text, { style: styles.infoValue }, data.licenseNumber)) : null), e(View, { style: { ...styles.sampleCol, alignItems: "center", justifyContent: "center" } }, e(Text, { style: { ...styles.infoLabel, marginBottom: 4, textAlign: "center" } }, "Test Result"), e(View, { style: {
313
- width: 70, height: 40, borderWidth: 3, borderColor: colors.green500,
314
- borderRadius: 4, backgroundColor: colors.white, alignItems: "center", justifyContent: "center",
315
- } }, e(Text, { style: { fontSize: 18, fontFamily: "Helvetica-Bold", color: colors.green500, letterSpacing: 2 } }, "PASS")))));
727
+
728
+ const PanelPageHeader = ({
729
+ data,
730
+ title
731
+ }) => {
732
+ return e(View, null, e(View, {
733
+ style: styles.header
734
+ }, e(View, {
735
+ style: styles.headerLeft
736
+ }, data.logoUrl ? e(Image, {
737
+ src: data.logoUrl,
738
+ style: styles.logo
739
+ }) : e(View, {
740
+ style: {
741
+ ...styles.logo,
742
+ backgroundColor: colors.green500,
743
+ borderRadius: 8
744
+ }
745
+ }), e(View, {
746
+ style: styles.companyInfo
747
+ }, e(Text, {
748
+ style: styles.companyName
749
+ }, (data.labName || "Lab").split(" ")[0]), e(Text, {
750
+ style: styles.companySubname
751
+ }, (data.labName || "").split(" ").slice(1).join(" ") || "")), e(View, {
752
+ style: styles.divider
753
+ }), e(Text, {
754
+ style: styles.labContact
755
+ }, data.labContact || "")), e(Text, {
756
+ style: {
757
+ ...styles.docTitle,
758
+ fontSize: 10,
759
+ fontFamily: "Helvetica-Bold"
760
+ }
761
+ }, title)), e(View, {
762
+ style: {
763
+ ...styles.sampleSection,
764
+ marginBottom: 8
765
+ }
766
+ }, e(View, {
767
+ style: styles.sampleCol
768
+ }, e(Text, {
769
+ style: styles.sampleTitle
770
+ }, data.sampleName), e(View, {
771
+ style: styles.infoRow
772
+ }, e(Text, {
773
+ style: styles.infoLabel
774
+ }, "Sample ID:"), e(Text, {
775
+ style: styles.infoValue
776
+ }, data.sampleId)), e(View, {
777
+ style: styles.infoRow
778
+ }, e(Text, {
779
+ style: styles.infoLabel
780
+ }, "Matrix:"), e(Text, {
781
+ style: styles.infoValue
782
+ }, data.sampleType || "Plant"))), e(View, {
783
+ style: styles.sampleCol
784
+ }, e(View, {
785
+ style: styles.infoRow
786
+ }, e(Text, {
787
+ style: styles.infoLabel
788
+ }, "Collected:"), e(Text, {
789
+ style: styles.infoValue
790
+ }, data.dateCollected || "\u2014")), e(View, {
791
+ style: styles.infoRow
792
+ }, e(Text, {
793
+ style: styles.infoLabel
794
+ }, "Received:"), e(Text, {
795
+ style: styles.infoValue
796
+ }, data.dateReceived || "\u2014")), e(View, {
797
+ style: styles.infoRow
798
+ }, e(Text, {
799
+ style: styles.infoLabel
800
+ }, "Completed:"), e(Text, {
801
+ style: styles.infoValue
802
+ }, data.dateTested || "\u2014")), e(View, {
803
+ style: styles.infoRow
804
+ }, e(Text, {
805
+ style: styles.infoLabel
806
+ }, "Batch #:"), e(Text, {
807
+ style: styles.infoValue
808
+ }, data.batchId || "\u2014"))), e(View, {
809
+ style: styles.sampleCol
810
+ }, e(Text, {
811
+ style: styles.infoLabel
812
+ }, "Client:"), e(Text, {
813
+ style: {
814
+ ...styles.infoValue,
815
+ fontFamily: "Helvetica-Bold",
816
+ marginLeft: 0
817
+ }
818
+ }, data.clientName), data.clientAddress ? e(Text, {
819
+ style: {
820
+ ...styles.infoValue,
821
+ marginLeft: 0,
822
+ fontSize: 6.5
823
+ }
824
+ }, data.clientAddress) : null, data.licenseNumber ? e(View, {
825
+ style: styles.infoRow
826
+ }, e(Text, {
827
+ style: styles.infoLabel
828
+ }, "Lic #:"), e(Text, {
829
+ style: styles.infoValue
830
+ }, data.licenseNumber)) : null), e(View, {
831
+ style: {
832
+ ...styles.sampleCol,
833
+ alignItems: "center",
834
+ justifyContent: "center"
835
+ }
836
+ }, e(Text, {
837
+ style: {
838
+ ...styles.infoLabel,
839
+ marginBottom: 4,
840
+ textAlign: "center"
841
+ }
842
+ }, "Test Result"), e(View, {
843
+ style: {
844
+ width: 70,
845
+ height: 40,
846
+ borderWidth: 3,
847
+ borderColor: colors.green500,
848
+ borderRadius: 4,
849
+ backgroundColor: colors.white,
850
+ alignItems: "center",
851
+ justifyContent: "center"
852
+ }
853
+ }, e(Text, {
854
+ style: {
855
+ fontSize: 18,
856
+ fontFamily: "Helvetica-Bold",
857
+ color: colors.green500,
858
+ letterSpacing: 2
859
+ }
860
+ }, "PASS")))));
316
861
  };
317
- const PanelPageFooter = ({ data, pageNum, totalPages }) => {
318
- const methodText = pageNum === 2
319
- ? "All safety and compliance testing is performed in accordance with ISO 17025 accredited laboratory standards. Heavy metals via ICP-MS. Microbial via qPCR. Solvents via HS-GC-MS. Mycotoxins via LC-MS/MS. ND = Not Detected (below Limit of Detection)."
320
- : pageNum >= 3
321
- ? "Comprehensive pesticide screening performed using LC-MS/MS in accordance with ISO 17025 standards. Category I pesticides are banned substances with zero tolerance. Category II pesticides have established action levels. All results in ppm. ND = Not Detected."
322
- : "Testing performed using validated methods per ISO 17025 standards. This Certificate applies only to the sample(s) tested.";
323
- return e(View, null, e(View, { style: styles.methodology }, e(Text, { style: styles.methodologyTitle }, "Methodology & Quality Control"), e(Text, { style: styles.methodologyText }, methodText)), e(View, { style: styles.footer }, e(View, { style: styles.footerLeft }, data.qrCodeDataUrl ? e(View, { style: styles.qrSection }, e(Image, { src: data.qrCodeDataUrl, style: styles.qrCode }), e(Text, { style: styles.qrLabel }, "Scan for digital copy")) : null, e(Text, { style: styles.disclaimer }, `${data.labName || "This laboratory"} performs analytical testing using validated internal methodologies and quality control protocols. All results apply only to the sample(s) tested. This Certificate is not a declaration of product safety, efficacy, or regulatory compliance. Testing performed in accordance with applicable state regulations.\n\nThis report may not be reproduced except in full without written approval from ${data.labName || "the laboratory"}.`), e(Text, { style: { ...styles.disclaimer, marginTop: 4 } }, `For inquiries: support@quantixanalytics.com | Raleigh, NC | ${data.labWebsite || "www.quantixanalytics.com"}`)), e(View, { style: styles.footerRight }, e(View, { style: styles.footerCompany }, e(Text, { style: { fontFamily: "Helvetica-Bold" } }, data.labName || "Laboratory"), e(Text, {}, "All Rights Reserved"), e(Text, { style: { fontSize: 7, color: colors.gray600 } }, data.labWebsite || "www.quantixanalytics.com")), e(View, { style: styles.signatureSection }, data.signatureUrl ? e(Image, { src: data.signatureUrl, style: { width: 180, height: 70, marginBottom: 4 } }) : null, e(Text, { style: styles.signatureName }, data.labDirector || "Sarah Mitchell"), e(Text, { style: styles.signatureTitle }, data.directorTitle || "Laboratory Director"), e(Text, { style: styles.signatureTitle }, data.approvalDate || data.dateTested || "\u2014"), e(Text, { style: { fontSize: 7, color: colors.gray500, marginTop: 8, textAlign: "right" } }, `Page ${pageNum} of ${totalPages}`)))));
862
+ const PanelPageFooter = ({
863
+ data,
864
+ pageNum,
865
+ totalPages
866
+ }) => {
867
+ const methodText = pageNum === 2 ? "All safety and compliance testing is performed in accordance with ISO 17025 accredited laboratory standards. Heavy metals via ICP-MS. Microbial via qPCR. Solvents via HS-GC-MS. Mycotoxins via LC-MS/MS. ND = Not Detected (below Limit of Detection)." : pageNum >= 3 ? "Comprehensive pesticide screening performed using LC-MS/MS in accordance with ISO 17025 standards. Category I pesticides are banned substances with zero tolerance. Category II pesticides have established action levels. All results in ppm. ND = Not Detected." : "Testing performed using validated methods per ISO 17025 standards. This Certificate applies only to the sample(s) tested.";
868
+ return e(View, null, e(View, {
869
+ style: styles.methodology
870
+ }, e(Text, {
871
+ style: styles.methodologyTitle
872
+ }, "Methodology & Quality Control"), e(Text, {
873
+ style: styles.methodologyText
874
+ }, methodText)), e(View, {
875
+ style: styles.footer
876
+ }, e(View, {
877
+ style: styles.footerLeft
878
+ }, data.qrCodeDataUrl ? e(View, {
879
+ style: styles.qrSection
880
+ }, e(Image, {
881
+ src: data.qrCodeDataUrl,
882
+ style: styles.qrCode
883
+ }), e(Text, {
884
+ style: styles.qrLabel
885
+ }, "Scan for digital copy")) : null, e(Text, {
886
+ style: styles.disclaimer
887
+ }, `${data.labName || "This laboratory"} performs analytical testing using validated internal methodologies and quality control protocols. All results apply only to the sample(s) tested. This Certificate is not a declaration of product safety, efficacy, or regulatory compliance. Testing performed in accordance with applicable state regulations.\n\nThis report may not be reproduced except in full without written approval from ${data.labName || "the laboratory"}.`), e(Text, {
888
+ style: {
889
+ ...styles.disclaimer,
890
+ marginTop: 4
891
+ }
892
+ }, `For inquiries: support@quantixanalytics.com | Raleigh, NC | ${data.labWebsite || "www.quantixanalytics.com"}`)), e(View, {
893
+ style: styles.footerRight
894
+ }, e(View, {
895
+ style: styles.footerCompany
896
+ }, e(Text, {
897
+ style: {
898
+ fontFamily: "Helvetica-Bold"
899
+ }
900
+ }, data.labName || "Laboratory"), e(Text, {}, "All Rights Reserved"), e(Text, {
901
+ style: {
902
+ fontSize: 7,
903
+ color: colors.gray600
904
+ }
905
+ }, data.labWebsite || "www.quantixanalytics.com")), e(View, {
906
+ style: styles.signatureSection
907
+ }, data.signatureUrl ? e(Image, {
908
+ src: data.signatureUrl,
909
+ style: {
910
+ width: 180,
911
+ height: 70,
912
+ marginBottom: 4
913
+ }
914
+ }) : null, e(Text, {
915
+ style: styles.signatureName
916
+ }, data.labDirector || "Sarah Mitchell"), e(Text, {
917
+ style: styles.signatureTitle
918
+ }, data.directorTitle || "Laboratory Director"), e(Text, {
919
+ style: styles.signatureTitle
920
+ }, data.approvalDate || data.dateTested || "\u2014"), e(Text, {
921
+ style: {
922
+ fontSize: 7,
923
+ color: colors.gray500,
924
+ marginTop: 8,
925
+ textAlign: "right"
926
+ }
927
+ }, `Page ${pageNum} of ${totalPages}`)))));
324
928
  };
929
+
325
930
  // ============================================================================
326
931
  // Page 2: Safety & Compliance
327
932
  // ============================================================================
328
- const SafetyTestingPage = ({ data }) => {
329
- const microbialPassed = !data.microbialResults?.some((r) => r.status === "Fail");
330
- const heavyMetalsPassed = !data.heavyMetalsResults?.some((r) => r.status === "Fail");
331
- const mycotoxinsPassed = !data.mycotoxinResults?.some((r) => r.status === "Fail");
332
- return e(Page, { size: "A4", style: styles.page }, e(PanelPageHeader, { data, title: "Safety & Compliance Testing" }), e(View, { style: panelStyles.summaryCard }, e(Text, { style: panelStyles.summaryCardTitle }, "\u2713 All Safety Tests Passed"), e(Text, { style: panelStyles.summaryCardText }, "This sample has been tested for microbial contaminants, heavy metals, and mycotoxins. All results are within acceptable limits as defined by state regulations and industry standards.")), e(View, { style: panelStyles.twoColumnContainer }, e(View, { style: panelStyles.columnHalf }, e(View, { style: panelStyles.panelSection }, e(View, { style: panelStyles.panelHeader }, e(Text, { style: panelStyles.panelTitle }, "Microbial Contaminants"), e(Text, { style: microbialPassed ? panelStyles.statusBadge : panelStyles.statusBadgeFail }, microbialPassed ? "Pass" : "Fail")), e(View, { style: panelStyles.panelTable }, e(View, { style: panelStyles.panelTableHeader }, e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "45%", textAlign: "left" } }, "Test"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "20%" } }, "Result"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "20%" } }, "Limit"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "15%", borderRightWidth: 0 } }, "Status")), ...(data.microbialResults || []).map((r, i) => e(View, { key: String(i), style: panelStyles.panelTableRow }, e(Text, { style: { ...panelStyles.panelTableCellLeft, width: "45%" } }, r.analyte || r.test || ""), e(Text, { style: { ...panelStyles.panelTableCell, width: "20%", fontFamily: "Helvetica-Bold" } }, r.result === "ND" ? "ND" : String(r.result)), e(Text, { style: { ...panelStyles.panelTableCell, width: "20%" } }, String(r.limit || "")), e(Text, { style: {
333
- ...panelStyles.panelTableCell, width: "15%", borderRightWidth: 0,
334
- ...(r.status === "Pass" ? panelStyles.passText : panelStyles.failText),
335
- } }, r.status)))))), e(View, { style: panelStyles.columnHalf }, e(View, { style: panelStyles.panelSection }, e(View, { style: panelStyles.panelHeader }, e(Text, { style: panelStyles.panelTitle }, "Heavy Metals Analysis"), e(Text, { style: heavyMetalsPassed ? panelStyles.statusBadge : panelStyles.statusBadgeFail }, heavyMetalsPassed ? "Pass" : "Fail")), e(View, { style: panelStyles.panelTable }, e(View, { style: panelStyles.panelTableHeader }, e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "28%", textAlign: "left" } }, "Analyte"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "13%" } }, "LOD"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "13%" } }, "LOQ"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "15%" } }, "Result"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "13%" } }, "Limit"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "18%", borderRightWidth: 0 } }, "Status")), ...(data.heavyMetalsResults || []).map((r, i) => e(View, { key: String(i), style: panelStyles.panelTableRow }, e(Text, { style: { ...panelStyles.panelTableCellLeft, width: "28%" } }, r.analyte), e(Text, { style: { ...panelStyles.panelTableCell, width: "13%" } }, String(r.lod)), e(Text, { style: { ...panelStyles.panelTableCell, width: "13%" } }, String(r.loq)), e(Text, { style: { ...panelStyles.panelTableCell, width: "15%", fontFamily: "Helvetica-Bold" } }, r.result === "ND" ? "ND" : String(r.result)), e(Text, { style: { ...panelStyles.panelTableCell, width: "13%" } }, `<${r.limit}`), e(Text, { style: {
336
- ...panelStyles.panelTableCell, width: "18%", borderRightWidth: 0,
337
- ...(r.status === "Pass" ? panelStyles.passText : panelStyles.failText),
338
- } }, r.status))))), e(View, { style: panelStyles.panelSection }, e(View, { style: panelStyles.panelHeader }, e(Text, { style: panelStyles.panelTitle }, "Mycotoxins"), e(Text, { style: mycotoxinsPassed ? panelStyles.statusBadge : panelStyles.statusBadgeFail }, mycotoxinsPassed ? "Pass" : "Fail")), e(View, { style: panelStyles.panelTable }, e(View, { style: panelStyles.panelTableHeader }, e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "28%", textAlign: "left" } }, "Analyte"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "13%" } }, "LOD"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "13%" } }, "LOQ"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "15%" } }, "Result"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "13%" } }, "Limit"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "18%", borderRightWidth: 0 } }, "Status")), ...(data.mycotoxinResults || []).map((r, i) => e(View, { key: String(i), style: panelStyles.panelTableRow }, e(Text, { style: { ...panelStyles.panelTableCellLeft, width: "28%" } }, r.analyte), e(Text, { style: { ...panelStyles.panelTableCell, width: "13%" } }, String(r.lod)), e(Text, { style: { ...panelStyles.panelTableCell, width: "13%" } }, String(r.loq)), e(Text, { style: { ...panelStyles.panelTableCell, width: "15%", fontFamily: "Helvetica-Bold" } }, r.result === "ND" ? "ND" : String(r.result)), e(Text, { style: { ...panelStyles.panelTableCell, width: "13%" } }, `<${r.limit}`), e(Text, { style: {
339
- ...panelStyles.panelTableCell, width: "18%", borderRightWidth: 0,
340
- ...(r.status === "Pass" ? panelStyles.passText : panelStyles.failText),
341
- } }, r.status))))))), e(PanelPageFooter, { data, pageNum: 2, totalPages: data.totalPages || 4 }));
933
+
934
+ const SafetyTestingPage = ({
935
+ data
936
+ }) => {
937
+ const microbialPassed = !data.microbialResults?.some(r => r.status === "Fail");
938
+ const heavyMetalsPassed = !data.heavyMetalsResults?.some(r => r.status === "Fail");
939
+ const mycotoxinsPassed = !data.mycotoxinResults?.some(r => r.status === "Fail");
940
+ return e(Page, {
941
+ size: "A4",
942
+ style: styles.page
943
+ }, e(PanelPageHeader, {
944
+ data,
945
+ title: "Safety & Compliance Testing"
946
+ }), e(View, {
947
+ style: panelStyles.summaryCard
948
+ }, e(Text, {
949
+ style: panelStyles.summaryCardTitle
950
+ }, "\u2713 All Safety Tests Passed"), e(Text, {
951
+ style: panelStyles.summaryCardText
952
+ }, "This sample has been tested for microbial contaminants, heavy metals, and mycotoxins. All results are within acceptable limits as defined by state regulations and industry standards.")), e(View, {
953
+ style: panelStyles.twoColumnContainer
954
+ }, e(View, {
955
+ style: panelStyles.columnHalf
956
+ }, e(View, {
957
+ style: panelStyles.panelSection
958
+ }, e(View, {
959
+ style: panelStyles.panelHeader
960
+ }, e(Text, {
961
+ style: panelStyles.panelTitle
962
+ }, "Microbial Contaminants"), e(Text, {
963
+ style: microbialPassed ? panelStyles.statusBadge : panelStyles.statusBadgeFail
964
+ }, microbialPassed ? "Pass" : "Fail")), e(View, {
965
+ style: panelStyles.panelTable
966
+ }, e(View, {
967
+ style: panelStyles.panelTableHeader
968
+ }, e(Text, {
969
+ style: {
970
+ ...panelStyles.panelTableHeaderCell,
971
+ width: "45%",
972
+ textAlign: "left"
973
+ }
974
+ }, "Test"), e(Text, {
975
+ style: {
976
+ ...panelStyles.panelTableHeaderCell,
977
+ width: "20%"
978
+ }
979
+ }, "Result"), e(Text, {
980
+ style: {
981
+ ...panelStyles.panelTableHeaderCell,
982
+ width: "20%"
983
+ }
984
+ }, "Limit"), e(Text, {
985
+ style: {
986
+ ...panelStyles.panelTableHeaderCell,
987
+ width: "15%",
988
+ borderRightWidth: 0
989
+ }
990
+ }, "Status")), ...(data.microbialResults || []).map((r, i) => e(View, {
991
+ key: String(i),
992
+ style: panelStyles.panelTableRow
993
+ }, e(Text, {
994
+ style: {
995
+ ...panelStyles.panelTableCellLeft,
996
+ width: "45%"
997
+ }
998
+ }, r.analyte || r.test || ""), e(Text, {
999
+ style: {
1000
+ ...panelStyles.panelTableCell,
1001
+ width: "20%",
1002
+ fontFamily: "Helvetica-Bold"
1003
+ }
1004
+ }, r.result === "ND" ? "ND" : String(r.result)), e(Text, {
1005
+ style: {
1006
+ ...panelStyles.panelTableCell,
1007
+ width: "20%"
1008
+ }
1009
+ }, String(r.limit || "")), e(Text, {
1010
+ style: {
1011
+ ...panelStyles.panelTableCell,
1012
+ width: "15%",
1013
+ borderRightWidth: 0,
1014
+ ...(r.status === "Pass" ? panelStyles.passText : panelStyles.failText)
1015
+ }
1016
+ }, r.status)))))), e(View, {
1017
+ style: panelStyles.columnHalf
1018
+ }, e(View, {
1019
+ style: panelStyles.panelSection
1020
+ }, e(View, {
1021
+ style: panelStyles.panelHeader
1022
+ }, e(Text, {
1023
+ style: panelStyles.panelTitle
1024
+ }, "Heavy Metals Analysis"), e(Text, {
1025
+ style: heavyMetalsPassed ? panelStyles.statusBadge : panelStyles.statusBadgeFail
1026
+ }, heavyMetalsPassed ? "Pass" : "Fail")), e(View, {
1027
+ style: panelStyles.panelTable
1028
+ }, e(View, {
1029
+ style: panelStyles.panelTableHeader
1030
+ }, e(Text, {
1031
+ style: {
1032
+ ...panelStyles.panelTableHeaderCell,
1033
+ width: "28%",
1034
+ textAlign: "left"
1035
+ }
1036
+ }, "Analyte"), e(Text, {
1037
+ style: {
1038
+ ...panelStyles.panelTableHeaderCell,
1039
+ width: "13%"
1040
+ }
1041
+ }, "LOD"), e(Text, {
1042
+ style: {
1043
+ ...panelStyles.panelTableHeaderCell,
1044
+ width: "13%"
1045
+ }
1046
+ }, "LOQ"), e(Text, {
1047
+ style: {
1048
+ ...panelStyles.panelTableHeaderCell,
1049
+ width: "15%"
1050
+ }
1051
+ }, "Result"), e(Text, {
1052
+ style: {
1053
+ ...panelStyles.panelTableHeaderCell,
1054
+ width: "13%"
1055
+ }
1056
+ }, "Limit"), e(Text, {
1057
+ style: {
1058
+ ...panelStyles.panelTableHeaderCell,
1059
+ width: "18%",
1060
+ borderRightWidth: 0
1061
+ }
1062
+ }, "Status")), ...(data.heavyMetalsResults || []).map((r, i) => e(View, {
1063
+ key: String(i),
1064
+ style: panelStyles.panelTableRow
1065
+ }, e(Text, {
1066
+ style: {
1067
+ ...panelStyles.panelTableCellLeft,
1068
+ width: "28%"
1069
+ }
1070
+ }, r.analyte), e(Text, {
1071
+ style: {
1072
+ ...panelStyles.panelTableCell,
1073
+ width: "13%"
1074
+ }
1075
+ }, String(r.lod)), e(Text, {
1076
+ style: {
1077
+ ...panelStyles.panelTableCell,
1078
+ width: "13%"
1079
+ }
1080
+ }, String(r.loq)), e(Text, {
1081
+ style: {
1082
+ ...panelStyles.panelTableCell,
1083
+ width: "15%",
1084
+ fontFamily: "Helvetica-Bold"
1085
+ }
1086
+ }, r.result === "ND" ? "ND" : String(r.result)), e(Text, {
1087
+ style: {
1088
+ ...panelStyles.panelTableCell,
1089
+ width: "13%"
1090
+ }
1091
+ }, `<${r.limit}`), e(Text, {
1092
+ style: {
1093
+ ...panelStyles.panelTableCell,
1094
+ width: "18%",
1095
+ borderRightWidth: 0,
1096
+ ...(r.status === "Pass" ? panelStyles.passText : panelStyles.failText)
1097
+ }
1098
+ }, r.status))))), e(View, {
1099
+ style: panelStyles.panelSection
1100
+ }, e(View, {
1101
+ style: panelStyles.panelHeader
1102
+ }, e(Text, {
1103
+ style: panelStyles.panelTitle
1104
+ }, "Mycotoxins"), e(Text, {
1105
+ style: mycotoxinsPassed ? panelStyles.statusBadge : panelStyles.statusBadgeFail
1106
+ }, mycotoxinsPassed ? "Pass" : "Fail")), e(View, {
1107
+ style: panelStyles.panelTable
1108
+ }, e(View, {
1109
+ style: panelStyles.panelTableHeader
1110
+ }, e(Text, {
1111
+ style: {
1112
+ ...panelStyles.panelTableHeaderCell,
1113
+ width: "28%",
1114
+ textAlign: "left"
1115
+ }
1116
+ }, "Analyte"), e(Text, {
1117
+ style: {
1118
+ ...panelStyles.panelTableHeaderCell,
1119
+ width: "13%"
1120
+ }
1121
+ }, "LOD"), e(Text, {
1122
+ style: {
1123
+ ...panelStyles.panelTableHeaderCell,
1124
+ width: "13%"
1125
+ }
1126
+ }, "LOQ"), e(Text, {
1127
+ style: {
1128
+ ...panelStyles.panelTableHeaderCell,
1129
+ width: "15%"
1130
+ }
1131
+ }, "Result"), e(Text, {
1132
+ style: {
1133
+ ...panelStyles.panelTableHeaderCell,
1134
+ width: "13%"
1135
+ }
1136
+ }, "Limit"), e(Text, {
1137
+ style: {
1138
+ ...panelStyles.panelTableHeaderCell,
1139
+ width: "18%",
1140
+ borderRightWidth: 0
1141
+ }
1142
+ }, "Status")), ...(data.mycotoxinResults || []).map((r, i) => e(View, {
1143
+ key: String(i),
1144
+ style: panelStyles.panelTableRow
1145
+ }, e(Text, {
1146
+ style: {
1147
+ ...panelStyles.panelTableCellLeft,
1148
+ width: "28%"
1149
+ }
1150
+ }, r.analyte), e(Text, {
1151
+ style: {
1152
+ ...panelStyles.panelTableCell,
1153
+ width: "13%"
1154
+ }
1155
+ }, String(r.lod)), e(Text, {
1156
+ style: {
1157
+ ...panelStyles.panelTableCell,
1158
+ width: "13%"
1159
+ }
1160
+ }, String(r.loq)), e(Text, {
1161
+ style: {
1162
+ ...panelStyles.panelTableCell,
1163
+ width: "15%",
1164
+ fontFamily: "Helvetica-Bold"
1165
+ }
1166
+ }, r.result === "ND" ? "ND" : String(r.result)), e(Text, {
1167
+ style: {
1168
+ ...panelStyles.panelTableCell,
1169
+ width: "13%"
1170
+ }
1171
+ }, `<${r.limit}`), e(Text, {
1172
+ style: {
1173
+ ...panelStyles.panelTableCell,
1174
+ width: "18%",
1175
+ borderRightWidth: 0,
1176
+ ...(r.status === "Pass" ? panelStyles.passText : panelStyles.failText)
1177
+ }
1178
+ }, r.status))))))), e(PanelPageFooter, {
1179
+ data,
1180
+ pageNum: 2,
1181
+ totalPages: data.totalPages || 4
1182
+ }));
342
1183
  };
1184
+
343
1185
  // ============================================================================
344
1186
  // Pages 3 & 4: Pesticide tables (shared renderer)
345
1187
  // ============================================================================
346
- const PesticidePage = ({ data, category, pesticides, pageNum }) => {
347
- const allPassed = !pesticides.some((r) => r.status === "Fail");
348
- const half = Math.ceil(pesticides.length / 2);
349
- const leftColumn = pesticides.slice(0, half);
350
- const rightColumn = pesticides.slice(half);
351
- const isCat1 = category === "I";
352
- const renderColumn = (items) => e(View, { style: panelStyles.columnHalf }, e(View, { style: panelStyles.panelTable }, e(View, { style: panelStyles.panelTableHeader }, e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "60%", textAlign: "left" } }, "Analyte"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "20%" } }, "Result"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "20%", borderRightWidth: 0 } }, "Status")), ...items.map((r, i) => e(View, { key: String(i), style: panelStyles.pesticideTableRow }, e(Text, { style: { ...panelStyles.pesticideTableCellLeft, width: "60%" } }, r.analyte), e(Text, { style: { ...panelStyles.pesticideTableCell, width: "20%", fontFamily: "Helvetica-Bold" } }, r.result === "ND" ? "ND" : String(r.result)), e(Text, { style: {
353
- ...panelStyles.pesticideTableCell, width: "20%", borderRightWidth: 0,
354
- ...(r.status === "Pass" ? panelStyles.passText : panelStyles.failText),
355
- } }, r.status)))));
356
- return e(Page, { size: "A4", style: styles.page }, e(PanelPageHeader, { data, title: isCat1 ? "Pesticide Screening" : "Pesticide Screening (Continued)" }), e(View, { style: { ...panelStyles.summaryCard, backgroundColor: allPassed ? colors.green50 : "#FEF2F2" } }, e(Text, { style: panelStyles.summaryCardTitle }, allPassed ? "\u2713 All Pesticide Tests Passed" : "\u26A0 Pesticide Detection"), e(Text, { style: panelStyles.summaryCardText }, isCat1
357
- ? "Category I pesticides are banned substances with zero tolerance. Any detection of these pesticides results in automatic failure and product cannot be sold."
358
- : "Category II pesticides have established action levels. Results must be below the regulatory limits shown. These pesticides are restricted but allowed at specified concentrations.")), e(View, { style: { flexDirection: "row", alignItems: "center", marginBottom: 8 } }, e(Text, { style: panelStyles.categoryBadge }, `CATEGORY ${category}`), e(Text, { style: panelStyles.categoryTitle }, isCat1 ? `Zero Tolerance - ${pesticides.length} Analytes` : `Action Level - ${pesticides.length} Analytes`), e(Text, { style: panelStyles.categorySubtitle }, isCat1 ? "Any detection = FAIL" : "Must be below established limits")), isCat1 ? e(View, { style: { ...panelStyles.panelHeader, marginBottom: 8 } }, e(Text, { style: panelStyles.panelTitle }, "Pesticide Analysis - 66 Analytes"), e(Text, { style: allPassed ? panelStyles.statusBadge : panelStyles.statusBadgeFail }, allPassed ? "Pass" : "Fail")) : null, isCat1 ? e(Text, { style: { fontSize: 7, color: colors.gray600, marginBottom: 8 } }, "Method: LC-MS/MS | LOD: 0.005-0.05 ppm | LOQ: 0.01-0.1 ppm") : null, e(View, { style: panelStyles.twoColumnContainer }, renderColumn(leftColumn), renderColumn(rightColumn)), e(PanelPageFooter, { data, pageNum, totalPages: data.totalPages || 4 }));
1188
+
1189
+ const PesticidePage = ({
1190
+ data,
1191
+ category,
1192
+ pesticides,
1193
+ pageNum
1194
+ }) => {
1195
+ const allPassed = !pesticides.some(r => r.status === "Fail");
1196
+ const half = Math.ceil(pesticides.length / 2);
1197
+ const leftColumn = pesticides.slice(0, half);
1198
+ const rightColumn = pesticides.slice(half);
1199
+ const isCat1 = category === "I";
1200
+ const renderColumn = items => e(View, {
1201
+ style: panelStyles.columnHalf
1202
+ }, e(View, {
1203
+ style: panelStyles.panelTable
1204
+ }, e(View, {
1205
+ style: panelStyles.panelTableHeader
1206
+ }, e(Text, {
1207
+ style: {
1208
+ ...panelStyles.panelTableHeaderCell,
1209
+ width: "60%",
1210
+ textAlign: "left"
1211
+ }
1212
+ }, "Analyte"), e(Text, {
1213
+ style: {
1214
+ ...panelStyles.panelTableHeaderCell,
1215
+ width: "20%"
1216
+ }
1217
+ }, "Result"), e(Text, {
1218
+ style: {
1219
+ ...panelStyles.panelTableHeaderCell,
1220
+ width: "20%",
1221
+ borderRightWidth: 0
1222
+ }
1223
+ }, "Status")), ...items.map((r, i) => e(View, {
1224
+ key: String(i),
1225
+ style: panelStyles.pesticideTableRow
1226
+ }, e(Text, {
1227
+ style: {
1228
+ ...panelStyles.pesticideTableCellLeft,
1229
+ width: "60%"
1230
+ }
1231
+ }, r.analyte), e(Text, {
1232
+ style: {
1233
+ ...panelStyles.pesticideTableCell,
1234
+ width: "20%",
1235
+ fontFamily: "Helvetica-Bold"
1236
+ }
1237
+ }, r.result === "ND" ? "ND" : String(r.result)), e(Text, {
1238
+ style: {
1239
+ ...panelStyles.pesticideTableCell,
1240
+ width: "20%",
1241
+ borderRightWidth: 0,
1242
+ ...(r.status === "Pass" ? panelStyles.passText : panelStyles.failText)
1243
+ }
1244
+ }, r.status)))));
1245
+ return e(Page, {
1246
+ size: "A4",
1247
+ style: styles.page
1248
+ }, e(PanelPageHeader, {
1249
+ data,
1250
+ title: isCat1 ? "Pesticide Screening" : "Pesticide Screening (Continued)"
1251
+ }), e(View, {
1252
+ style: {
1253
+ ...panelStyles.summaryCard,
1254
+ backgroundColor: allPassed ? colors.green50 : "#FEF2F2"
1255
+ }
1256
+ }, e(Text, {
1257
+ style: panelStyles.summaryCardTitle
1258
+ }, allPassed ? "\u2713 All Pesticide Tests Passed" : "\u26A0 Pesticide Detection"), e(Text, {
1259
+ style: panelStyles.summaryCardText
1260
+ }, isCat1 ? "Category I pesticides are banned substances with zero tolerance. Any detection of these pesticides results in automatic failure and product cannot be sold." : "Category II pesticides have established action levels. Results must be below the regulatory limits shown. These pesticides are restricted but allowed at specified concentrations.")), e(View, {
1261
+ style: {
1262
+ flexDirection: "row",
1263
+ alignItems: "center",
1264
+ marginBottom: 8
1265
+ }
1266
+ }, e(Text, {
1267
+ style: panelStyles.categoryBadge
1268
+ }, `CATEGORY ${category}`), e(Text, {
1269
+ style: panelStyles.categoryTitle
1270
+ }, isCat1 ? `Zero Tolerance - ${pesticides.length} Analytes` : `Action Level - ${pesticides.length} Analytes`), e(Text, {
1271
+ style: panelStyles.categorySubtitle
1272
+ }, isCat1 ? "Any detection = FAIL" : "Must be below established limits")), isCat1 ? e(View, {
1273
+ style: {
1274
+ ...panelStyles.panelHeader,
1275
+ marginBottom: 8
1276
+ }
1277
+ }, e(Text, {
1278
+ style: panelStyles.panelTitle
1279
+ }, "Pesticide Analysis - 66 Analytes"), e(Text, {
1280
+ style: allPassed ? panelStyles.statusBadge : panelStyles.statusBadgeFail
1281
+ }, allPassed ? "Pass" : "Fail")) : null, isCat1 ? e(Text, {
1282
+ style: {
1283
+ fontSize: 7,
1284
+ color: colors.gray600,
1285
+ marginBottom: 8
1286
+ }
1287
+ }, "Method: LC-MS/MS | LOD: 0.005-0.05 ppm | LOQ: 0.01-0.1 ppm") : null, e(View, {
1288
+ style: panelStyles.twoColumnContainer
1289
+ }, renderColumn(leftColumn), renderColumn(rightColumn)), e(PanelPageFooter, {
1290
+ data,
1291
+ pageNum,
1292
+ totalPages: data.totalPages || 4
1293
+ }));
359
1294
  };
1295
+
360
1296
  // ============================================================================
361
1297
  // Page 5: Residual Solvents
362
1298
  // ============================================================================
363
- const ResidualSolventsPage = ({ data }) => {
364
- const allPassed = !data.testsResidualSolvents?.some((r) => r.status === "Fail");
365
- const solvents = data.testsResidualSolvents || [];
366
- const half = Math.ceil(solvents.length / 2);
367
- const leftColumn = solvents.slice(0, half);
368
- const rightColumn = solvents.slice(half);
369
- const renderColumn = (items) => e(View, { style: panelStyles.columnHalf }, e(View, { style: panelStyles.panelTable }, e(View, { style: panelStyles.panelTableHeader }, e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "45%", textAlign: "left" } }, "Solvent"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "25%" } }, "Result (ppm)"), e(Text, { style: { ...panelStyles.panelTableHeaderCell, width: "30%", borderRightWidth: 0 } }, "Limit (ppm)")), ...items.map((r, i) => e(View, { key: String(i), style: panelStyles.pesticideTableRow }, e(Text, { style: { ...panelStyles.pesticideTableCellLeft, width: "45%" } }, r.analyte), e(Text, { style: { ...panelStyles.pesticideTableCell, width: "25%", fontFamily: "Helvetica-Bold" } }, typeof r.result === "string" ? r.result : String(r.result)), e(Text, { style: { ...panelStyles.pesticideTableCell, width: "30%", borderRightWidth: 0 } }, String(r.limit))))));
370
- return e(Page, { size: "A4", style: styles.page }, e(PanelPageHeader, { data, title: "Residual Solvents Analysis" }), e(View, { style: { ...panelStyles.summaryCard, backgroundColor: allPassed ? colors.green50 : "#FEF2F2" } }, e(Text, { style: panelStyles.summaryCardTitle }, allPassed ? "\u2713 All Solvent Tests Passed" : "\u26A0 Solvent Detection"), e(Text, { style: panelStyles.summaryCardText }, "Residual solvents testing per USP <467> standards. Class 1 solvents (carcinogens) have strict limits. Class 2/3 solvents have higher allowable limits. All results in ppm (parts per million).")), e(View, { style: { flexDirection: "row", alignItems: "center", marginBottom: 12 } }, e(Text, { style: panelStyles.categoryBadge }, "USP <467>"), e(Text, { style: panelStyles.categoryTitle }, `Residual Solvents - ${solvents.length} Analytes`), e(Text, { style: panelStyles.categorySubtitle }, "HS-GC-MS Analysis")), e(View, { style: panelStyles.twoColumnContainer }, renderColumn(leftColumn), renderColumn(rightColumn)), e(PanelPageFooter, { data, pageNum: 5, totalPages: data.totalPages || 5 }));
1299
+
1300
+ const ResidualSolventsPage = ({
1301
+ data
1302
+ }) => {
1303
+ const allPassed = !data.testsResidualSolvents?.some(r => r.status === "Fail");
1304
+ const solvents = data.testsResidualSolvents || [];
1305
+ const half = Math.ceil(solvents.length / 2);
1306
+ const leftColumn = solvents.slice(0, half);
1307
+ const rightColumn = solvents.slice(half);
1308
+ const renderColumn = items => e(View, {
1309
+ style: panelStyles.columnHalf
1310
+ }, e(View, {
1311
+ style: panelStyles.panelTable
1312
+ }, e(View, {
1313
+ style: panelStyles.panelTableHeader
1314
+ }, e(Text, {
1315
+ style: {
1316
+ ...panelStyles.panelTableHeaderCell,
1317
+ width: "45%",
1318
+ textAlign: "left"
1319
+ }
1320
+ }, "Solvent"), e(Text, {
1321
+ style: {
1322
+ ...panelStyles.panelTableHeaderCell,
1323
+ width: "25%"
1324
+ }
1325
+ }, "Result (ppm)"), e(Text, {
1326
+ style: {
1327
+ ...panelStyles.panelTableHeaderCell,
1328
+ width: "30%",
1329
+ borderRightWidth: 0
1330
+ }
1331
+ }, "Limit (ppm)")), ...items.map((r, i) => e(View, {
1332
+ key: String(i),
1333
+ style: panelStyles.pesticideTableRow
1334
+ }, e(Text, {
1335
+ style: {
1336
+ ...panelStyles.pesticideTableCellLeft,
1337
+ width: "45%"
1338
+ }
1339
+ }, r.analyte), e(Text, {
1340
+ style: {
1341
+ ...panelStyles.pesticideTableCell,
1342
+ width: "25%",
1343
+ fontFamily: "Helvetica-Bold"
1344
+ }
1345
+ }, typeof r.result === "string" ? r.result : String(r.result)), e(Text, {
1346
+ style: {
1347
+ ...panelStyles.pesticideTableCell,
1348
+ width: "30%",
1349
+ borderRightWidth: 0
1350
+ }
1351
+ }, String(r.limit))))));
1352
+ return e(Page, {
1353
+ size: "A4",
1354
+ style: styles.page
1355
+ }, e(PanelPageHeader, {
1356
+ data,
1357
+ title: "Residual Solvents Analysis"
1358
+ }), e(View, {
1359
+ style: {
1360
+ ...panelStyles.summaryCard,
1361
+ backgroundColor: allPassed ? colors.green50 : "#FEF2F2"
1362
+ }
1363
+ }, e(Text, {
1364
+ style: panelStyles.summaryCardTitle
1365
+ }, allPassed ? "\u2713 All Solvent Tests Passed" : "\u26A0 Solvent Detection"), e(Text, {
1366
+ style: panelStyles.summaryCardText
1367
+ }, "Residual solvents testing per USP <467> standards. Class 1 solvents (carcinogens) have strict limits. Class 2/3 solvents have higher allowable limits. All results in ppm (parts per million).")), e(View, {
1368
+ style: {
1369
+ flexDirection: "row",
1370
+ alignItems: "center",
1371
+ marginBottom: 12
1372
+ }
1373
+ }, e(Text, {
1374
+ style: panelStyles.categoryBadge
1375
+ }, "USP <467>"), e(Text, {
1376
+ style: panelStyles.categoryTitle
1377
+ }, `Residual Solvents - ${solvents.length} Analytes`), e(Text, {
1378
+ style: panelStyles.categorySubtitle
1379
+ }, "HS-GC-MS Analysis")), e(View, {
1380
+ style: panelStyles.twoColumnContainer
1381
+ }, renderColumn(leftColumn), renderColumn(rightColumn)), e(PanelPageFooter, {
1382
+ data,
1383
+ pageNum: 5,
1384
+ totalPages: data.totalPages || 5
1385
+ }));
371
1386
  };
1387
+
372
1388
  // ============================================================================
373
1389
  // Main Document
374
1390
  // ============================================================================
375
- const CannabisCOADocument = ({ data }) => {
376
- const totalTHC = data.totalTHC && data.totalTHC > 0 ? data.totalTHC.toFixed(2) : "ND";
377
- const totalCBD = data.totalCBD || 0;
378
- const totalCBDDisplay = totalCBD > 0 ? totalCBD.toFixed(2) : "ND";
379
- const totalCannabinoids = data.totalCannabinoids && data.totalCannabinoids > 0 ? data.totalCannabinoids.toFixed(2) : "ND";
380
- const hasResidualSolvents = data.testsResidualSolvents && data.testsResidualSolvents.length > 0;
381
- const totalPages = data.fullPanel ? (hasResidualSolvents ? 5 : 4) : 1;
382
- const top4 = (data.cannabinoids || [])
383
- .filter((c) => c.result !== "ND" && c.percentWeight > 0)
384
- .sort((a, b) => b.percentWeight - a.percentWeight)
385
- .slice(0, 4);
386
- const pages = [];
387
- // Page 1: Cannabinoid Profile
388
- pages.push(e(Page, { key: "page1", size: "A4", style: styles.page }, e(View, { style: styles.header }, e(View, { style: styles.headerLeft }, data.logoUrl
389
- ? e(Image, { src: data.logoUrl, style: styles.logo })
390
- : e(View, { style: { ...styles.logo, backgroundColor: colors.green500, borderRadius: 8 } }), e(View, { style: styles.companyInfo }, e(Text, { style: styles.companyName }, (data.labName || "Lab").split(" ")[0]), e(Text, { style: styles.companySubname }, (data.labName || "").split(" ").slice(1).join(" ") || "")), e(View, { style: styles.divider }), e(Text, { style: styles.labContact }, data.labContact || "")), e(Text, { style: styles.docTitle }, "Certificate of Analysis")), e(View, { style: styles.sampleSection }, e(View, { style: styles.sampleCol }, e(Text, { style: styles.sampleTitle }, data.sampleName), e(View, { style: styles.infoRow }, e(Text, { style: styles.infoLabel }, "Sample ID:"), e(Text, { style: styles.infoValue }, data.sampleId)), e(View, { style: styles.infoRow }, e(Text, { style: styles.infoLabel }, "Matrix:"), e(Text, { style: styles.infoValue }, data.sampleType || "Plant")), e(View, { style: styles.infoRow }, e(Text, { style: styles.infoLabel }, "Sample Size:"), e(Text, { style: styles.infoValue }, data.sampleSize || "\u2014"))), e(View, { style: styles.sampleCol }, e(View, { style: styles.infoRow }, e(Text, { style: styles.infoLabel }, "Collected:"), e(Text, { style: styles.infoValue }, data.dateCollected || "\u2014")), e(View, { style: styles.infoRow }, e(Text, { style: styles.infoLabel }, "Received:"), e(Text, { style: styles.infoValue }, data.dateReceived || "\u2014")), e(View, { style: styles.infoRow }, e(Text, { style: styles.infoLabel }, "Completed:"), e(Text, { style: styles.infoValue }, data.dateTested || "\u2014")), e(View, { style: styles.infoRow }, e(Text, { style: styles.infoLabel }, "Batch #:"), e(Text, { style: styles.infoValue }, data.batchId || "\u2014"))), e(View, { style: styles.sampleCol }, e(Text, { style: styles.infoLabel }, "Client:"), e(Text, { style: { ...styles.infoValue, fontFamily: "Helvetica-Bold", marginLeft: 0 } }, data.clientName), data.clientAddress ? e(Text, { style: { ...styles.infoValue, marginLeft: 0, fontSize: 6.5 } }, data.clientAddress) : null, data.licenseNumber ? e(View, { style: styles.infoRow }, e(Text, { style: styles.infoLabel }, "Lic #:"), e(Text, { style: styles.infoValue }, data.licenseNumber)) : null), e(View, { style: { ...styles.sampleCol, alignItems: "center" } }, e(Text, { style: { ...styles.infoLabel, marginBottom: 4 } }, "Cannabinoid Distribution"), e(PieChart, { cannabinoids: data.cannabinoids || [] }))), e(View, { style: styles.sectionHeader }, e(Text, { style: styles.sectionTitle }, "Cannabinoids"), e(Text, { style: styles.sectionStatus }, "Complete")), e(View, { style: styles.tableContainer }, e(View, { style: styles.table }, e(View, { style: styles.tableHeader }, e(Text, { style: { ...styles.tableHeaderCell, width: "28%", textAlign: "left" } }, "Analyte"), e(Text, { style: { ...styles.tableHeaderCell, width: "14%" } }, "LOD mg/g"), e(Text, { style: { ...styles.tableHeaderCell, width: "14%" } }, "LOQ mg/g"), e(Text, { style: { ...styles.tableHeaderCell, width: "22%" } }, "Result %"), e(Text, { style: { ...styles.tableHeaderCellLast, width: "22%" } }, "Result mg/g")), ...(data.cannabinoids || []).map((c, i) => {
391
- const displayName = (c.name || "").replace(/Δ/g, "D").replace(/\u0394/g, "D").replace(/Delta/gi, "D");
392
- return e(View, { key: String(i), style: i % 2 === 0 ? styles.tableRow : styles.tableRowAlt }, e(Text, { style: { ...styles.tableCellLeft, width: "28%" } }, displayName), e(Text, { style: { ...styles.tableCell, width: "14%" } }, c.lod.toFixed(2)), e(Text, { style: { ...styles.tableCell, width: "14%" } }, c.loq.toFixed(2)), e(Text, { style: { ...styles.tableCell, width: "22%", fontFamily: "Helvetica-Bold" } }, c.result === "ND" ? "ND" : c.percentWeight.toFixed(2)), e(Text, { style: { ...styles.tableCellLast, width: "22%" } }, c.result === "ND" ? "ND" : c.mgPerG.toFixed(2)));
393
- }), e(View, { style: styles.tableSummaryRow }, e(Text, { style: { ...styles.tableCellLeft, width: "28%" } }, "Total THC"), e(Text, { style: { ...styles.tableCell, width: "14%" } }, ""), e(Text, { style: { ...styles.tableCell, width: "14%" } }, ""), e(Text, { style: { ...styles.tableCell, width: "22%", fontFamily: "Helvetica-Bold" } }, totalTHC), e(Text, { style: { ...styles.tableCellLast, width: "22%" } }, totalTHC === "ND" ? "ND" : (parseFloat(totalTHC) * 10).toFixed(2))), e(View, { style: styles.tableSummaryRow }, e(Text, { style: { ...styles.tableCellLeft, width: "28%" } }, "Total CBD"), e(Text, { style: { ...styles.tableCell, width: "14%" } }, ""), e(Text, { style: { ...styles.tableCell, width: "14%" } }, ""), e(Text, { style: { ...styles.tableCell, width: "22%", fontFamily: "Helvetica-Bold" } }, totalCBDDisplay), e(Text, { style: { ...styles.tableCellLast, width: "22%" } }, totalCBD > 0 ? (totalCBD * 10).toFixed(2) : "ND")), e(View, { style: { ...styles.tableSummaryRow, borderBottomWidth: 0 } }, e(Text, { style: { ...styles.tableCellLeft, width: "28%" } }, "Total Cannabinoids"), e(Text, { style: { ...styles.tableCell, width: "14%" } }, ""), e(Text, { style: { ...styles.tableCell, width: "14%" } }, ""), e(Text, { style: { ...styles.tableCell, width: "22%", fontFamily: "Helvetica-Bold" } }, totalCannabinoids), e(Text, { style: { ...styles.tableCellLast, width: "22%" } }, totalCannabinoids === "ND" ? "ND" : (parseFloat(totalCannabinoids) * 10).toFixed(2)))), e(View, { style: styles.summaryContainer }, ...top4.map((c, i) => e(View, { key: String(i), style: styles.summaryBox }, e(Text, { style: styles.summaryValue }, `${c.percentWeight.toFixed(2)}%`), e(Text, { style: styles.summaryLabel }, c.name.replace(/Δ/g, "D").replace(/\u0394/g, "D")))), e(Text, { style: styles.summaryTableTitle }, "Summary"), e(View, { style: styles.summaryTable }, e(View, { style: { ...styles.summaryTableRow, backgroundColor: colors.gray50 } }, e(Text, { style: styles.summaryTableCellLeft }, "Test"), e(Text, { style: styles.summaryTableCell }, "Date"), e(Text, { style: styles.summaryTableCell }, "Result")), e(View, { style: styles.summaryTableRow }, e(Text, { style: styles.summaryTableCellLeft }, "Batch"), e(Text, { style: styles.summaryTableCell }, data.testsBatch ? data.dateTested || "\u2014" : "\u2014"), e(Text, { style: styles.summaryTableCell }, data.testsBatch ? "Complete" : "Not Submitted")), e(View, { style: { ...styles.summaryTableRow, backgroundColor: colors.gray50 } }, e(Text, { style: styles.summaryTableCellLeft }, "Cannabinoids"), e(Text, { style: styles.summaryTableCell }, data.testsCannabinoids ? data.dateTested || "\u2014" : "\u2014"), e(Text, { style: styles.summaryTableCell }, data.testsCannabinoids ? "Complete" : "Not Tested")), e(View, { style: { ...styles.summaryTableRow, borderBottomWidth: 0 } }, e(Text, { style: styles.summaryTableCellLeft }, "Moisture"), e(Text, { style: styles.summaryTableCell }, data.testsMoisture ? data.dateTested || "\u2014" : "\u2014"), e(Text, { style: styles.summaryTableCell }, data.testsMoisture ? `${data.moisture ? data.moisture.toFixed(2) : "0.00"}%` : "Not Tested"))))), e(View, { style: styles.methodology }, e(Text, { style: styles.methodologyTitle }, data.notes || "Methodology & Quality Control"), e(Text, { style: styles.methodologyText }, "Total THC = D9-THC + 0.877 \u00D7 THCa. Total CBD = CBD + 0.877 \u00D7 CBDa. Total Cannabinoids = Sum of individual cannabinoids detected. Testing performed using validated HPLC-UV/MS methods per ISO 17025 standards. Unless otherwise stated, all quality control samples performed within specifications. This Certificate applies only to the sample(s) tested and is not a declaration of product safety, efficacy, or regulatory compliance.")), e(View, { style: styles.footer }, e(View, { style: styles.footerLeft }, data.qrCodeDataUrl ? e(View, { style: styles.qrSection }, e(Image, { src: data.qrCodeDataUrl, style: styles.qrCode }), e(Text, { style: styles.qrLabel }, "Scan for digital copy")) : null, e(Text, { style: styles.disclaimer }, `${data.labName || "This laboratory"} performs analytical testing using validated internal methodologies and quality control protocols. All results apply only to the sample(s) tested. This Certificate is not a declaration of product safety, efficacy, or regulatory compliance. Testing performed in accordance with applicable state regulations.\n\nThis report may not be reproduced except in full without written approval from ${data.labName || "the laboratory"}.`), e(Text, { style: { ...styles.disclaimer, marginTop: 4 } }, `For inquiries: support@quantixanalytics.com | Raleigh, NC | ${data.labWebsite || "www.quantixanalytics.com"}`)), e(View, { style: styles.footerRight }, e(View, { style: styles.footerCompany }, e(Text, { style: { fontFamily: "Helvetica-Bold" } }, data.labName || "Laboratory"), e(Text, {}, "All Rights Reserved"), e(Text, { style: { fontSize: 7, color: colors.gray600 } }, data.labWebsite || "www.quantixanalytics.com")), e(View, { style: styles.signatureSection }, data.signatureUrl ? e(Image, { src: data.signatureUrl, style: { width: 180, height: 70, marginBottom: 4 } }) : null, e(Text, { style: styles.signatureName }, data.labDirector || "Sarah Mitchell"), e(Text, { style: styles.signatureTitle }, data.directorTitle || "Laboratory Director"), e(Text, { style: styles.signatureTitle }, data.approvalDate || data.dateTested || "\u2014"), data.fullPanel ? e(Text, { style: { fontSize: 7, color: colors.gray500, marginTop: 8, textAlign: "right" } }, `Page 1 of ${totalPages}`) : null)))));
394
- if (data.fullPanel) {
395
- pages.push(e(SafetyTestingPage, { key: "page2", data: { ...data, totalPages } }));
396
- pages.push(e(PesticidePage, { key: "page3", data: { ...data, totalPages }, category: "I", pesticides: data.pesticidesCat1 || [], pageNum: 3 }));
397
- pages.push(e(PesticidePage, { key: "page4", data: { ...data, totalPages }, category: "II", pesticides: data.pesticidesCat2 || [], pageNum: 4 }));
398
- if (hasResidualSolvents) {
399
- pages.push(e(ResidualSolventsPage, { key: "page5", data: { ...data, totalPages } }));
1391
+
1392
+ const CannabisCOADocument = ({
1393
+ data
1394
+ }) => {
1395
+ const totalTHC = data.totalTHC && data.totalTHC > 0 ? data.totalTHC.toFixed(2) : "ND";
1396
+ const totalCBD = data.totalCBD || 0;
1397
+ const totalCBDDisplay = totalCBD > 0 ? totalCBD.toFixed(2) : "ND";
1398
+ const totalCannabinoids = data.totalCannabinoids && data.totalCannabinoids > 0 ? data.totalCannabinoids.toFixed(2) : "ND";
1399
+ const hasResidualSolvents = data.testsResidualSolvents && data.testsResidualSolvents.length > 0;
1400
+ const totalPages = data.fullPanel ? hasResidualSolvents ? 5 : 4 : 1;
1401
+ const top4 = (data.cannabinoids || []).filter(c => c.result !== "ND" && c.percentWeight > 0).sort((a, b) => b.percentWeight - a.percentWeight).slice(0, 4);
1402
+ const pages = [];
1403
+
1404
+ // Page 1: Cannabinoid Profile
1405
+ pages.push(e(Page, {
1406
+ key: "page1",
1407
+ size: "A4",
1408
+ style: styles.page
1409
+ }, e(View, {
1410
+ style: styles.header
1411
+ }, e(View, {
1412
+ style: styles.headerLeft
1413
+ }, data.logoUrl ? e(Image, {
1414
+ src: data.logoUrl,
1415
+ style: styles.logo
1416
+ }) : e(View, {
1417
+ style: {
1418
+ ...styles.logo,
1419
+ backgroundColor: colors.green500,
1420
+ borderRadius: 8
1421
+ }
1422
+ }), e(View, {
1423
+ style: styles.companyInfo
1424
+ }, e(Text, {
1425
+ style: styles.companyName
1426
+ }, (data.labName || "Lab").split(" ")[0]), e(Text, {
1427
+ style: styles.companySubname
1428
+ }, (data.labName || "").split(" ").slice(1).join(" ") || "")), e(View, {
1429
+ style: styles.divider
1430
+ }), e(Text, {
1431
+ style: styles.labContact
1432
+ }, data.labContact || "")), e(Text, {
1433
+ style: styles.docTitle
1434
+ }, "Certificate of Analysis")), e(View, {
1435
+ style: styles.sampleSection
1436
+ }, e(View, {
1437
+ style: styles.sampleCol
1438
+ }, e(Text, {
1439
+ style: styles.sampleTitle
1440
+ }, data.sampleName), e(View, {
1441
+ style: styles.infoRow
1442
+ }, e(Text, {
1443
+ style: styles.infoLabel
1444
+ }, "Sample ID:"), e(Text, {
1445
+ style: styles.infoValue
1446
+ }, data.sampleId)), e(View, {
1447
+ style: styles.infoRow
1448
+ }, e(Text, {
1449
+ style: styles.infoLabel
1450
+ }, "Matrix:"), e(Text, {
1451
+ style: styles.infoValue
1452
+ }, data.sampleType || "Plant")), e(View, {
1453
+ style: styles.infoRow
1454
+ }, e(Text, {
1455
+ style: styles.infoLabel
1456
+ }, "Sample Size:"), e(Text, {
1457
+ style: styles.infoValue
1458
+ }, data.sampleSize || "\u2014"))), e(View, {
1459
+ style: styles.sampleCol
1460
+ }, e(View, {
1461
+ style: styles.infoRow
1462
+ }, e(Text, {
1463
+ style: styles.infoLabel
1464
+ }, "Collected:"), e(Text, {
1465
+ style: styles.infoValue
1466
+ }, data.dateCollected || "\u2014")), e(View, {
1467
+ style: styles.infoRow
1468
+ }, e(Text, {
1469
+ style: styles.infoLabel
1470
+ }, "Received:"), e(Text, {
1471
+ style: styles.infoValue
1472
+ }, data.dateReceived || "\u2014")), e(View, {
1473
+ style: styles.infoRow
1474
+ }, e(Text, {
1475
+ style: styles.infoLabel
1476
+ }, "Completed:"), e(Text, {
1477
+ style: styles.infoValue
1478
+ }, data.dateTested || "\u2014")), e(View, {
1479
+ style: styles.infoRow
1480
+ }, e(Text, {
1481
+ style: styles.infoLabel
1482
+ }, "Batch #:"), e(Text, {
1483
+ style: styles.infoValue
1484
+ }, data.batchId || "\u2014"))), e(View, {
1485
+ style: styles.sampleCol
1486
+ }, e(Text, {
1487
+ style: styles.infoLabel
1488
+ }, "Client:"), e(Text, {
1489
+ style: {
1490
+ ...styles.infoValue,
1491
+ fontFamily: "Helvetica-Bold",
1492
+ marginLeft: 0
1493
+ }
1494
+ }, data.clientName), data.clientAddress ? e(Text, {
1495
+ style: {
1496
+ ...styles.infoValue,
1497
+ marginLeft: 0,
1498
+ fontSize: 6.5
1499
+ }
1500
+ }, data.clientAddress) : null, data.licenseNumber ? e(View, {
1501
+ style: styles.infoRow
1502
+ }, e(Text, {
1503
+ style: styles.infoLabel
1504
+ }, "Lic #:"), e(Text, {
1505
+ style: styles.infoValue
1506
+ }, data.licenseNumber)) : null), e(View, {
1507
+ style: {
1508
+ ...styles.sampleCol,
1509
+ alignItems: "center"
1510
+ }
1511
+ }, e(Text, {
1512
+ style: {
1513
+ ...styles.infoLabel,
1514
+ marginBottom: 4
1515
+ }
1516
+ }, "Cannabinoid Distribution"), e(PieChart, {
1517
+ cannabinoids: data.cannabinoids || []
1518
+ }))), e(View, {
1519
+ style: styles.sectionHeader
1520
+ }, e(Text, {
1521
+ style: styles.sectionTitle
1522
+ }, "Cannabinoids"), e(Text, {
1523
+ style: styles.sectionStatus
1524
+ }, "Complete")), e(View, {
1525
+ style: styles.tableContainer
1526
+ }, e(View, {
1527
+ style: styles.table
1528
+ }, e(View, {
1529
+ style: styles.tableHeader
1530
+ }, e(Text, {
1531
+ style: {
1532
+ ...styles.tableHeaderCell,
1533
+ width: "28%",
1534
+ textAlign: "left"
1535
+ }
1536
+ }, "Analyte"), e(Text, {
1537
+ style: {
1538
+ ...styles.tableHeaderCell,
1539
+ width: "14%"
1540
+ }
1541
+ }, "LOD mg/g"), e(Text, {
1542
+ style: {
1543
+ ...styles.tableHeaderCell,
1544
+ width: "14%"
1545
+ }
1546
+ }, "LOQ mg/g"), e(Text, {
1547
+ style: {
1548
+ ...styles.tableHeaderCell,
1549
+ width: "22%"
1550
+ }
1551
+ }, "Result %"), e(Text, {
1552
+ style: {
1553
+ ...styles.tableHeaderCellLast,
1554
+ width: "22%"
1555
+ }
1556
+ }, "Result mg/g")), ...(data.cannabinoids || []).map((c, i) => {
1557
+ const displayName = (c.name || "").replace(/Δ/g, "D").replace(/\u0394/g, "D").replace(/Delta/gi, "D");
1558
+ return e(View, {
1559
+ key: String(i),
1560
+ style: i % 2 === 0 ? styles.tableRow : styles.tableRowAlt
1561
+ }, e(Text, {
1562
+ style: {
1563
+ ...styles.tableCellLeft,
1564
+ width: "28%"
1565
+ }
1566
+ }, displayName), e(Text, {
1567
+ style: {
1568
+ ...styles.tableCell,
1569
+ width: "14%"
1570
+ }
1571
+ }, c.lod.toFixed(2)), e(Text, {
1572
+ style: {
1573
+ ...styles.tableCell,
1574
+ width: "14%"
1575
+ }
1576
+ }, c.loq.toFixed(2)), e(Text, {
1577
+ style: {
1578
+ ...styles.tableCell,
1579
+ width: "22%",
1580
+ fontFamily: "Helvetica-Bold"
1581
+ }
1582
+ }, c.result === "ND" ? "ND" : c.percentWeight.toFixed(2)), e(Text, {
1583
+ style: {
1584
+ ...styles.tableCellLast,
1585
+ width: "22%"
1586
+ }
1587
+ }, c.result === "ND" ? "ND" : c.mgPerG.toFixed(2)));
1588
+ }), e(View, {
1589
+ style: styles.tableSummaryRow
1590
+ }, e(Text, {
1591
+ style: {
1592
+ ...styles.tableCellLeft,
1593
+ width: "28%"
1594
+ }
1595
+ }, "Total THC"), e(Text, {
1596
+ style: {
1597
+ ...styles.tableCell,
1598
+ width: "14%"
1599
+ }
1600
+ }, ""), e(Text, {
1601
+ style: {
1602
+ ...styles.tableCell,
1603
+ width: "14%"
1604
+ }
1605
+ }, ""), e(Text, {
1606
+ style: {
1607
+ ...styles.tableCell,
1608
+ width: "22%",
1609
+ fontFamily: "Helvetica-Bold"
1610
+ }
1611
+ }, totalTHC), e(Text, {
1612
+ style: {
1613
+ ...styles.tableCellLast,
1614
+ width: "22%"
1615
+ }
1616
+ }, totalTHC === "ND" ? "ND" : (parseFloat(totalTHC) * 10).toFixed(2))), e(View, {
1617
+ style: styles.tableSummaryRow
1618
+ }, e(Text, {
1619
+ style: {
1620
+ ...styles.tableCellLeft,
1621
+ width: "28%"
1622
+ }
1623
+ }, "Total CBD"), e(Text, {
1624
+ style: {
1625
+ ...styles.tableCell,
1626
+ width: "14%"
1627
+ }
1628
+ }, ""), e(Text, {
1629
+ style: {
1630
+ ...styles.tableCell,
1631
+ width: "14%"
1632
+ }
1633
+ }, ""), e(Text, {
1634
+ style: {
1635
+ ...styles.tableCell,
1636
+ width: "22%",
1637
+ fontFamily: "Helvetica-Bold"
1638
+ }
1639
+ }, totalCBDDisplay), e(Text, {
1640
+ style: {
1641
+ ...styles.tableCellLast,
1642
+ width: "22%"
1643
+ }
1644
+ }, totalCBD > 0 ? (totalCBD * 10).toFixed(2) : "ND")), e(View, {
1645
+ style: {
1646
+ ...styles.tableSummaryRow,
1647
+ borderBottomWidth: 0
1648
+ }
1649
+ }, e(Text, {
1650
+ style: {
1651
+ ...styles.tableCellLeft,
1652
+ width: "28%"
1653
+ }
1654
+ }, "Total Cannabinoids"), e(Text, {
1655
+ style: {
1656
+ ...styles.tableCell,
1657
+ width: "14%"
1658
+ }
1659
+ }, ""), e(Text, {
1660
+ style: {
1661
+ ...styles.tableCell,
1662
+ width: "14%"
1663
+ }
1664
+ }, ""), e(Text, {
1665
+ style: {
1666
+ ...styles.tableCell,
1667
+ width: "22%",
1668
+ fontFamily: "Helvetica-Bold"
1669
+ }
1670
+ }, totalCannabinoids), e(Text, {
1671
+ style: {
1672
+ ...styles.tableCellLast,
1673
+ width: "22%"
1674
+ }
1675
+ }, totalCannabinoids === "ND" ? "ND" : (parseFloat(totalCannabinoids) * 10).toFixed(2)))), e(View, {
1676
+ style: styles.summaryContainer
1677
+ }, ...top4.map((c, i) => e(View, {
1678
+ key: String(i),
1679
+ style: styles.summaryBox
1680
+ }, e(Text, {
1681
+ style: styles.summaryValue
1682
+ }, `${c.percentWeight.toFixed(2)}%`), e(Text, {
1683
+ style: styles.summaryLabel
1684
+ }, c.name.replace(/Δ/g, "D").replace(/\u0394/g, "D")))), e(Text, {
1685
+ style: styles.summaryTableTitle
1686
+ }, "Summary"), e(View, {
1687
+ style: styles.summaryTable
1688
+ }, e(View, {
1689
+ style: {
1690
+ ...styles.summaryTableRow,
1691
+ backgroundColor: colors.gray50
1692
+ }
1693
+ }, e(Text, {
1694
+ style: styles.summaryTableCellLeft
1695
+ }, "Test"), e(Text, {
1696
+ style: styles.summaryTableCell
1697
+ }, "Date"), e(Text, {
1698
+ style: styles.summaryTableCell
1699
+ }, "Result")), e(View, {
1700
+ style: styles.summaryTableRow
1701
+ }, e(Text, {
1702
+ style: styles.summaryTableCellLeft
1703
+ }, "Batch"), e(Text, {
1704
+ style: styles.summaryTableCell
1705
+ }, data.testsBatch ? data.dateTested || "\u2014" : "\u2014"), e(Text, {
1706
+ style: styles.summaryTableCell
1707
+ }, data.testsBatch ? "Complete" : "Not Submitted")), e(View, {
1708
+ style: {
1709
+ ...styles.summaryTableRow,
1710
+ backgroundColor: colors.gray50
1711
+ }
1712
+ }, e(Text, {
1713
+ style: styles.summaryTableCellLeft
1714
+ }, "Cannabinoids"), e(Text, {
1715
+ style: styles.summaryTableCell
1716
+ }, data.testsCannabinoids ? data.dateTested || "\u2014" : "\u2014"), e(Text, {
1717
+ style: styles.summaryTableCell
1718
+ }, data.testsCannabinoids ? "Complete" : "Not Tested")), e(View, {
1719
+ style: {
1720
+ ...styles.summaryTableRow,
1721
+ borderBottomWidth: 0
1722
+ }
1723
+ }, e(Text, {
1724
+ style: styles.summaryTableCellLeft
1725
+ }, "Moisture"), e(Text, {
1726
+ style: styles.summaryTableCell
1727
+ }, data.testsMoisture ? data.dateTested || "\u2014" : "\u2014"), e(Text, {
1728
+ style: styles.summaryTableCell
1729
+ }, data.testsMoisture ? `${data.moisture ? data.moisture.toFixed(2) : "0.00"}%` : "Not Tested"))))), e(View, {
1730
+ style: styles.methodology
1731
+ }, e(Text, {
1732
+ style: styles.methodologyTitle
1733
+ }, data.notes || "Methodology & Quality Control"), e(Text, {
1734
+ style: styles.methodologyText
1735
+ }, "Total THC = D9-THC + 0.877 \u00D7 THCa. Total CBD = CBD + 0.877 \u00D7 CBDa. Total Cannabinoids = Sum of individual cannabinoids detected. Testing performed using validated HPLC-UV/MS methods per ISO 17025 standards. Unless otherwise stated, all quality control samples performed within specifications. This Certificate applies only to the sample(s) tested and is not a declaration of product safety, efficacy, or regulatory compliance.")), e(View, {
1736
+ style: styles.footer
1737
+ }, e(View, {
1738
+ style: styles.footerLeft
1739
+ }, data.qrCodeDataUrl ? e(View, {
1740
+ style: styles.qrSection
1741
+ }, e(Image, {
1742
+ src: data.qrCodeDataUrl,
1743
+ style: styles.qrCode
1744
+ }), e(Text, {
1745
+ style: styles.qrLabel
1746
+ }, "Scan for digital copy")) : null, e(Text, {
1747
+ style: styles.disclaimer
1748
+ }, `${data.labName || "This laboratory"} performs analytical testing using validated internal methodologies and quality control protocols. All results apply only to the sample(s) tested. This Certificate is not a declaration of product safety, efficacy, or regulatory compliance. Testing performed in accordance with applicable state regulations.\n\nThis report may not be reproduced except in full without written approval from ${data.labName || "the laboratory"}.`), e(Text, {
1749
+ style: {
1750
+ ...styles.disclaimer,
1751
+ marginTop: 4
1752
+ }
1753
+ }, `For inquiries: support@quantixanalytics.com | Raleigh, NC | ${data.labWebsite || "www.quantixanalytics.com"}`)), e(View, {
1754
+ style: styles.footerRight
1755
+ }, e(View, {
1756
+ style: styles.footerCompany
1757
+ }, e(Text, {
1758
+ style: {
1759
+ fontFamily: "Helvetica-Bold"
1760
+ }
1761
+ }, data.labName || "Laboratory"), e(Text, {}, "All Rights Reserved"), e(Text, {
1762
+ style: {
1763
+ fontSize: 7,
1764
+ color: colors.gray600
1765
+ }
1766
+ }, data.labWebsite || "www.quantixanalytics.com")), e(View, {
1767
+ style: styles.signatureSection
1768
+ }, data.signatureUrl ? e(Image, {
1769
+ src: data.signatureUrl,
1770
+ style: {
1771
+ width: 180,
1772
+ height: 70,
1773
+ marginBottom: 4
1774
+ }
1775
+ }) : null, e(Text, {
1776
+ style: styles.signatureName
1777
+ }, data.labDirector || "Sarah Mitchell"), e(Text, {
1778
+ style: styles.signatureTitle
1779
+ }, data.directorTitle || "Laboratory Director"), e(Text, {
1780
+ style: styles.signatureTitle
1781
+ }, data.approvalDate || data.dateTested || "\u2014"), data.fullPanel ? e(Text, {
1782
+ style: {
1783
+ fontSize: 7,
1784
+ color: colors.gray500,
1785
+ marginTop: 8,
1786
+ textAlign: "right"
1787
+ }
1788
+ }, `Page 1 of ${totalPages}`) : null)))));
1789
+ if (data.fullPanel) {
1790
+ pages.push(e(SafetyTestingPage, {
1791
+ key: "page2",
1792
+ data: {
1793
+ ...data,
1794
+ totalPages
1795
+ }
1796
+ }));
1797
+ pages.push(e(PesticidePage, {
1798
+ key: "page3",
1799
+ data: {
1800
+ ...data,
1801
+ totalPages
1802
+ },
1803
+ category: "I",
1804
+ pesticides: data.pesticidesCat1 || [],
1805
+ pageNum: 3
1806
+ }));
1807
+ pages.push(e(PesticidePage, {
1808
+ key: "page4",
1809
+ data: {
1810
+ ...data,
1811
+ totalPages
1812
+ },
1813
+ category: "II",
1814
+ pesticides: data.pesticidesCat2 || [],
1815
+ pageNum: 4
1816
+ }));
1817
+ if (hasResidualSolvents) {
1818
+ pages.push(e(ResidualSolventsPage, {
1819
+ key: "page5",
1820
+ data: {
1821
+ ...data,
1822
+ totalPages
400
1823
  }
1824
+ }));
401
1825
  }
402
- return e(Document, {}, ...pages);
1826
+ }
1827
+ return e(Document, {}, ...pages);
403
1828
  };
1829
+
404
1830
  // ============================================================================
405
1831
  // Public API
406
1832
  // ============================================================================
1833
+
407
1834
  export async function renderCOAToPdf(data) {
408
- const doc = React.createElement(CannabisCOADocument, { data });
409
- const buffer = await renderToBuffer(doc);
410
- return Buffer.from(buffer);
1835
+ const doc = /*#__PURE__*/React.createElement(CannabisCOADocument, {
1836
+ data
1837
+ });
1838
+ const buffer = await renderToBuffer(doc);
1839
+ return Buffer.from(buffer);
411
1840
  }
1841
+ //# sourceMappingURL=coa-renderer.js.map